Skip to content

Commit dcf866c

Browse files
feat(api): api update
1 parent 70c5e58 commit dcf866c

23 files changed

+37
-1726
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 17
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-56b0f699c5437d9e5326626d35dfc972c17d01f12cb416c7f4854c8ea6d0e95e.yml
3-
openapi_spec_hash: 158f405c1880706266d83e6ff16b9d2f
1+
configured_endpoints: 12
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-6a9d3b677dcfb856dc571865c34b3fe401e4d7f0d799edfc743acb9a55800bd0.yml
3+
openapi_spec_hash: 037703a6c741e4310fda3f57c22fa51e
44
config_hash: 41c337f5cda03b13880617490f82bad0

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ client = CasParser(
4343
environment="environment_1",
4444
)
4545

46-
response = client.credits.check()
47-
print(response.enabled_features)
46+
unified_response = client.cams_kfintech.parse()
47+
print(unified_response.demat_accounts)
4848
```
4949

5050
While you can provide an `api_key` keyword argument,
@@ -69,8 +69,8 @@ client = AsyncCasParser(
6969

7070

7171
async def main() -> None:
72-
response = await client.credits.check()
73-
print(response.enabled_features)
72+
unified_response = await client.cams_kfintech.parse()
73+
print(unified_response.demat_accounts)
7474

7575

7676
asyncio.run(main())
@@ -103,8 +103,8 @@ async def main() -> None:
103103
api_key=os.environ.get("CAS_PARSER_API_KEY"), # This is the default and can be omitted
104104
http_client=DefaultAioHttpClient(),
105105
) as client:
106-
response = await client.credits.check()
107-
print(response.enabled_features)
106+
unified_response = await client.cams_kfintech.parse()
107+
print(unified_response.demat_accounts)
108108

109109

110110
asyncio.run(main())
@@ -135,7 +135,7 @@ from cas_parser import CasParser
135135
client = CasParser()
136136

137137
try:
138-
client.credits.check()
138+
client.cams_kfintech.parse()
139139
except cas_parser.APIConnectionError as e:
140140
print("The server could not be reached")
141141
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -178,7 +178,7 @@ client = CasParser(
178178
)
179179

180180
# Or, configure per-request:
181-
client.with_options(max_retries=5).credits.check()
181+
client.with_options(max_retries=5).cams_kfintech.parse()
182182
```
183183

184184
### Timeouts
@@ -201,7 +201,7 @@ client = CasParser(
201201
)
202202

203203
# Override per-request:
204-
client.with_options(timeout=5.0).credits.check()
204+
client.with_options(timeout=5.0).cams_kfintech.parse()
205205
```
206206

207207
On timeout, an `APITimeoutError` is thrown.
@@ -242,11 +242,11 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
242242
from cas_parser import CasParser
243243

244244
client = CasParser()
245-
response = client.credits.with_raw_response.check()
245+
response = client.cams_kfintech.with_raw_response.parse()
246246
print(response.headers.get('X-My-Header'))
247247

248-
credit = response.parse() # get the object that `credits.check()` would have returned
249-
print(credit.enabled_features)
248+
cams_kfintech = response.parse() # get the object that `cams_kfintech.parse()` would have returned
249+
print(cams_kfintech.demat_accounts)
250250
```
251251

252252
These methods return an [`APIResponse`](https://github.com/CASParser/cas-parser-python/tree/main/src/cas_parser/_response.py) object.
@@ -260,7 +260,7 @@ The above interface eagerly reads the full response body when you make the reque
260260
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
261261

262262
```python
263-
with client.credits.with_streaming_response.check() as response:
263+
with client.cams_kfintech.with_streaming_response.parse() as response:
264264
print(response.headers.get("X-My-Header"))
265265

266266
for line in response.iter_lines():

api.md

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,3 @@
1-
# Credits
2-
3-
Types:
4-
5-
```python
6-
from cas_parser.types import CreditCheckResponse
7-
```
8-
9-
Methods:
10-
11-
- <code title="post /credits">client.credits.<a href="./src/cas_parser/resources/credits.py">check</a>() -> <a href="./src/cas_parser/types/credit_check_response.py">CreditCheckResponse</a></code>
12-
13-
# Logs
14-
15-
Types:
16-
17-
```python
18-
from cas_parser.types import LogCreateResponse, LogGetSummaryResponse
19-
```
20-
21-
Methods:
22-
23-
- <code title="post /logs">client.logs.<a href="./src/cas_parser/resources/logs.py">create</a>(\*\*<a href="src/cas_parser/types/log_create_params.py">params</a>) -> <a href="./src/cas_parser/types/log_create_response.py">LogCreateResponse</a></code>
24-
- <code title="post /logs/summary">client.logs.<a href="./src/cas_parser/resources/logs.py">get_summary</a>(\*\*<a href="src/cas_parser/types/log_get_summary_params.py">params</a>) -> <a href="./src/cas_parser/types/log_get_summary_response.py">LogGetSummaryResponse</a></code>
25-
26-
# AccessToken
27-
28-
Types:
29-
30-
```python
31-
from cas_parser.types import AccessTokenCreateResponse
32-
```
33-
34-
Methods:
35-
36-
- <code title="post /v1/access-token">client.access_token.<a href="./src/cas_parser/resources/access_token.py">create</a>(\*\*<a href="src/cas_parser/types/access_token_create_params.py">params</a>) -> <a href="./src/cas_parser/types/access_token_create_response.py">AccessTokenCreateResponse</a></code>
37-
38-
# VerifyToken
39-
40-
Types:
41-
42-
```python
43-
from cas_parser.types import VerifyTokenVerifyResponse
44-
```
45-
46-
Methods:
47-
48-
- <code title="post /v1/verify-token">client.verify_token.<a href="./src/cas_parser/resources/verify_token.py">verify</a>() -> <a href="./src/cas_parser/types/verify_token_verify_response.py">VerifyTokenVerifyResponse</a></code>
49-
501
# CamsKfintech
512

523
Types:

src/cas_parser/_client.py

Lines changed: 1 addition & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,12 @@
3131
)
3232

3333
if TYPE_CHECKING:
34-
from .resources import (
35-
cdsl,
36-
logs,
37-
nsdl,
38-
inbox,
39-
smart,
40-
credits,
41-
kfintech,
42-
access_token,
43-
verify_token,
44-
cams_kfintech,
45-
contract_note,
46-
)
47-
from .resources.logs import LogsResource, AsyncLogsResource
34+
from .resources import cdsl, nsdl, inbox, smart, kfintech, cams_kfintech, contract_note
4835
from .resources.nsdl import NsdlResource, AsyncNsdlResource
4936
from .resources.inbox import InboxResource, AsyncInboxResource
5037
from .resources.smart import SmartResource, AsyncSmartResource
51-
from .resources.credits import CreditsResource, AsyncCreditsResource
5238
from .resources.kfintech import KfintechResource, AsyncKfintechResource
5339
from .resources.cdsl.cdsl import CdslResource, AsyncCdslResource
54-
from .resources.access_token import AccessTokenResource, AsyncAccessTokenResource
55-
from .resources.verify_token import VerifyTokenResource, AsyncVerifyTokenResource
5640
from .resources.cams_kfintech import CamsKfintechResource, AsyncCamsKfintechResource
5741
from .resources.contract_note import ContractNoteResource, AsyncContractNoteResource
5842

@@ -154,30 +138,6 @@ def __init__(
154138
_strict_response_validation=_strict_response_validation,
155139
)
156140

157-
@cached_property
158-
def credits(self) -> CreditsResource:
159-
from .resources.credits import CreditsResource
160-
161-
return CreditsResource(self)
162-
163-
@cached_property
164-
def logs(self) -> LogsResource:
165-
from .resources.logs import LogsResource
166-
167-
return LogsResource(self)
168-
169-
@cached_property
170-
def access_token(self) -> AccessTokenResource:
171-
from .resources.access_token import AccessTokenResource
172-
173-
return AccessTokenResource(self)
174-
175-
@cached_property
176-
def verify_token(self) -> VerifyTokenResource:
177-
from .resources.verify_token import VerifyTokenResource
178-
179-
return VerifyTokenResource(self)
180-
181141
@cached_property
182142
def cams_kfintech(self) -> CamsKfintechResource:
183143
from .resources.cams_kfintech import CamsKfintechResource
@@ -414,30 +374,6 @@ def __init__(
414374
_strict_response_validation=_strict_response_validation,
415375
)
416376

417-
@cached_property
418-
def credits(self) -> AsyncCreditsResource:
419-
from .resources.credits import AsyncCreditsResource
420-
421-
return AsyncCreditsResource(self)
422-
423-
@cached_property
424-
def logs(self) -> AsyncLogsResource:
425-
from .resources.logs import AsyncLogsResource
426-
427-
return AsyncLogsResource(self)
428-
429-
@cached_property
430-
def access_token(self) -> AsyncAccessTokenResource:
431-
from .resources.access_token import AsyncAccessTokenResource
432-
433-
return AsyncAccessTokenResource(self)
434-
435-
@cached_property
436-
def verify_token(self) -> AsyncVerifyTokenResource:
437-
from .resources.verify_token import AsyncVerifyTokenResource
438-
439-
return AsyncVerifyTokenResource(self)
440-
441377
@cached_property
442378
def cams_kfintech(self) -> AsyncCamsKfintechResource:
443379
from .resources.cams_kfintech import AsyncCamsKfintechResource
@@ -601,30 +537,6 @@ class CasParserWithRawResponse:
601537
def __init__(self, client: CasParser) -> None:
602538
self._client = client
603539

604-
@cached_property
605-
def credits(self) -> credits.CreditsResourceWithRawResponse:
606-
from .resources.credits import CreditsResourceWithRawResponse
607-
608-
return CreditsResourceWithRawResponse(self._client.credits)
609-
610-
@cached_property
611-
def logs(self) -> logs.LogsResourceWithRawResponse:
612-
from .resources.logs import LogsResourceWithRawResponse
613-
614-
return LogsResourceWithRawResponse(self._client.logs)
615-
616-
@cached_property
617-
def access_token(self) -> access_token.AccessTokenResourceWithRawResponse:
618-
from .resources.access_token import AccessTokenResourceWithRawResponse
619-
620-
return AccessTokenResourceWithRawResponse(self._client.access_token)
621-
622-
@cached_property
623-
def verify_token(self) -> verify_token.VerifyTokenResourceWithRawResponse:
624-
from .resources.verify_token import VerifyTokenResourceWithRawResponse
625-
626-
return VerifyTokenResourceWithRawResponse(self._client.verify_token)
627-
628540
@cached_property
629541
def cams_kfintech(self) -> cams_kfintech.CamsKfintechResourceWithRawResponse:
630542
from .resources.cams_kfintech import CamsKfintechResourceWithRawResponse
@@ -674,30 +586,6 @@ class AsyncCasParserWithRawResponse:
674586
def __init__(self, client: AsyncCasParser) -> None:
675587
self._client = client
676588

677-
@cached_property
678-
def credits(self) -> credits.AsyncCreditsResourceWithRawResponse:
679-
from .resources.credits import AsyncCreditsResourceWithRawResponse
680-
681-
return AsyncCreditsResourceWithRawResponse(self._client.credits)
682-
683-
@cached_property
684-
def logs(self) -> logs.AsyncLogsResourceWithRawResponse:
685-
from .resources.logs import AsyncLogsResourceWithRawResponse
686-
687-
return AsyncLogsResourceWithRawResponse(self._client.logs)
688-
689-
@cached_property
690-
def access_token(self) -> access_token.AsyncAccessTokenResourceWithRawResponse:
691-
from .resources.access_token import AsyncAccessTokenResourceWithRawResponse
692-
693-
return AsyncAccessTokenResourceWithRawResponse(self._client.access_token)
694-
695-
@cached_property
696-
def verify_token(self) -> verify_token.AsyncVerifyTokenResourceWithRawResponse:
697-
from .resources.verify_token import AsyncVerifyTokenResourceWithRawResponse
698-
699-
return AsyncVerifyTokenResourceWithRawResponse(self._client.verify_token)
700-
701589
@cached_property
702590
def cams_kfintech(self) -> cams_kfintech.AsyncCamsKfintechResourceWithRawResponse:
703591
from .resources.cams_kfintech import AsyncCamsKfintechResourceWithRawResponse
@@ -747,30 +635,6 @@ class CasParserWithStreamedResponse:
747635
def __init__(self, client: CasParser) -> None:
748636
self._client = client
749637

750-
@cached_property
751-
def credits(self) -> credits.CreditsResourceWithStreamingResponse:
752-
from .resources.credits import CreditsResourceWithStreamingResponse
753-
754-
return CreditsResourceWithStreamingResponse(self._client.credits)
755-
756-
@cached_property
757-
def logs(self) -> logs.LogsResourceWithStreamingResponse:
758-
from .resources.logs import LogsResourceWithStreamingResponse
759-
760-
return LogsResourceWithStreamingResponse(self._client.logs)
761-
762-
@cached_property
763-
def access_token(self) -> access_token.AccessTokenResourceWithStreamingResponse:
764-
from .resources.access_token import AccessTokenResourceWithStreamingResponse
765-
766-
return AccessTokenResourceWithStreamingResponse(self._client.access_token)
767-
768-
@cached_property
769-
def verify_token(self) -> verify_token.VerifyTokenResourceWithStreamingResponse:
770-
from .resources.verify_token import VerifyTokenResourceWithStreamingResponse
771-
772-
return VerifyTokenResourceWithStreamingResponse(self._client.verify_token)
773-
774638
@cached_property
775639
def cams_kfintech(self) -> cams_kfintech.CamsKfintechResourceWithStreamingResponse:
776640
from .resources.cams_kfintech import CamsKfintechResourceWithStreamingResponse
@@ -820,30 +684,6 @@ class AsyncCasParserWithStreamedResponse:
820684
def __init__(self, client: AsyncCasParser) -> None:
821685
self._client = client
822686

823-
@cached_property
824-
def credits(self) -> credits.AsyncCreditsResourceWithStreamingResponse:
825-
from .resources.credits import AsyncCreditsResourceWithStreamingResponse
826-
827-
return AsyncCreditsResourceWithStreamingResponse(self._client.credits)
828-
829-
@cached_property
830-
def logs(self) -> logs.AsyncLogsResourceWithStreamingResponse:
831-
from .resources.logs import AsyncLogsResourceWithStreamingResponse
832-
833-
return AsyncLogsResourceWithStreamingResponse(self._client.logs)
834-
835-
@cached_property
836-
def access_token(self) -> access_token.AsyncAccessTokenResourceWithStreamingResponse:
837-
from .resources.access_token import AsyncAccessTokenResourceWithStreamingResponse
838-
839-
return AsyncAccessTokenResourceWithStreamingResponse(self._client.access_token)
840-
841-
@cached_property
842-
def verify_token(self) -> verify_token.AsyncVerifyTokenResourceWithStreamingResponse:
843-
from .resources.verify_token import AsyncVerifyTokenResourceWithStreamingResponse
844-
845-
return AsyncVerifyTokenResourceWithStreamingResponse(self._client.verify_token)
846-
847687
@cached_property
848688
def cams_kfintech(self) -> cams_kfintech.AsyncCamsKfintechResourceWithStreamingResponse:
849689
from .resources.cams_kfintech import AsyncCamsKfintechResourceWithStreamingResponse

0 commit comments

Comments
 (0)