Skip to content

Commit b9079a9

Browse files
chore(internal): codegen related update
1 parent 8b38574 commit b9079a9

File tree

14 files changed

+570
-0
lines changed

14 files changed

+570
-0
lines changed

src/cas_parser/_client.py

Lines changed: 384 additions & 0 deletions
Large diffs are not rendered by default.

src/cas_parser/resources/access_token.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222

2323

2424
class AccessTokenResource(SyncAPIResource):
25+
"""
26+
Endpoints for managing access tokens for the Portfolio Connect SDK.
27+
Use these to generate short-lived `at_` prefixed tokens that can be safely passed to frontend applications.
28+
Access tokens can be used in place of API keys on all v4 endpoints.
29+
"""
30+
2531
@cached_property
2632
def with_raw_response(self) -> AccessTokenResourceWithRawResponse:
2733
"""
@@ -91,6 +97,12 @@ def create(
9197

9298

9399
class AsyncAccessTokenResource(AsyncAPIResource):
100+
"""
101+
Endpoints for managing access tokens for the Portfolio Connect SDK.
102+
Use these to generate short-lived `at_` prefixed tokens that can be safely passed to frontend applications.
103+
Access tokens can be used in place of API keys on all v4 endpoints.
104+
"""
105+
94106
@cached_property
95107
def with_raw_response(self) -> AsyncAccessTokenResourceWithRawResponse:
96108
"""

src/cas_parser/resources/cams_kfintech.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525

2626
class CamsKfintechResource(SyncAPIResource):
27+
"""Endpoints for parsing CAS PDF files from different sources."""
28+
2729
@cached_property
2830
def with_raw_response(self) -> CamsKfintechResourceWithRawResponse:
2931
"""
@@ -101,6 +103,8 @@ def parse(
101103

102104

103105
class AsyncCamsKfintechResource(AsyncAPIResource):
106+
"""Endpoints for parsing CAS PDF files from different sources."""
107+
104108
@cached_property
105109
def with_raw_response(self) -> AsyncCamsKfintechResourceWithRawResponse:
106110
"""

src/cas_parser/resources/cdsl/cdsl.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@
3232

3333

3434
class CdslResource(SyncAPIResource):
35+
"""Endpoints for parsing CAS PDF files from different sources."""
36+
3537
@cached_property
3638
def fetch(self) -> FetchResource:
39+
"""
40+
Endpoints for fetching CAS documents with instant download.
41+
Currently supports CDSL via OTP authentication.
42+
"""
3743
return FetchResource(self._client)
3844

3945
@cached_property
@@ -113,8 +119,14 @@ def parse_pdf(
113119

114120

115121
class AsyncCdslResource(AsyncAPIResource):
122+
"""Endpoints for parsing CAS PDF files from different sources."""
123+
116124
@cached_property
117125
def fetch(self) -> AsyncFetchResource:
126+
"""
127+
Endpoints for fetching CAS documents with instant download.
128+
Currently supports CDSL via OTP authentication.
129+
"""
118130
return AsyncFetchResource(self._client)
119131

120132
@cached_property
@@ -203,6 +215,10 @@ def __init__(self, cdsl: CdslResource) -> None:
203215

204216
@cached_property
205217
def fetch(self) -> FetchResourceWithRawResponse:
218+
"""
219+
Endpoints for fetching CAS documents with instant download.
220+
Currently supports CDSL via OTP authentication.
221+
"""
206222
return FetchResourceWithRawResponse(self._cdsl.fetch)
207223

208224

@@ -216,6 +232,10 @@ def __init__(self, cdsl: AsyncCdslResource) -> None:
216232

217233
@cached_property
218234
def fetch(self) -> AsyncFetchResourceWithRawResponse:
235+
"""
236+
Endpoints for fetching CAS documents with instant download.
237+
Currently supports CDSL via OTP authentication.
238+
"""
219239
return AsyncFetchResourceWithRawResponse(self._cdsl.fetch)
220240

221241

@@ -229,6 +249,10 @@ def __init__(self, cdsl: CdslResource) -> None:
229249

230250
@cached_property
231251
def fetch(self) -> FetchResourceWithStreamingResponse:
252+
"""
253+
Endpoints for fetching CAS documents with instant download.
254+
Currently supports CDSL via OTP authentication.
255+
"""
232256
return FetchResourceWithStreamingResponse(self._cdsl.fetch)
233257

234258

@@ -242,4 +266,8 @@ def __init__(self, cdsl: AsyncCdslResource) -> None:
242266

243267
@cached_property
244268
def fetch(self) -> AsyncFetchResourceWithStreamingResponse:
269+
"""
270+
Endpoints for fetching CAS documents with instant download.
271+
Currently supports CDSL via OTP authentication.
272+
"""
245273
return AsyncFetchResourceWithStreamingResponse(self._cdsl.fetch)

src/cas_parser/resources/cdsl/fetch.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323

2424

2525
class FetchResource(SyncAPIResource):
26+
"""
27+
Endpoints for fetching CAS documents with instant download.
28+
Currently supports CDSL via OTP authentication.
29+
"""
30+
2631
@cached_property
2732
def with_raw_response(self) -> FetchResourceWithRawResponse:
2833
"""
@@ -149,6 +154,11 @@ def verify_otp(
149154

150155

151156
class AsyncFetchResource(AsyncAPIResource):
157+
"""
158+
Endpoints for fetching CAS documents with instant download.
159+
Currently supports CDSL via OTP authentication.
160+
"""
161+
152162
@cached_property
153163
def with_raw_response(self) -> AsyncFetchResourceWithRawResponse:
154164
"""

src/cas_parser/resources/contract_note.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525

2626

2727
class ContractNoteResource(SyncAPIResource):
28+
"""
29+
Endpoints for parsing Contract Note PDF files from various SEBI brokers like Zerodha, Groww, Upstox, ICICI etc.
30+
"""
31+
2832
@cached_property
2933
def with_raw_response(self) -> ContractNoteResourceWithRawResponse:
3034
"""
@@ -132,6 +136,10 @@ def parse(
132136

133137

134138
class AsyncContractNoteResource(AsyncAPIResource):
139+
"""
140+
Endpoints for parsing Contract Note PDF files from various SEBI brokers like Zerodha, Groww, Upstox, ICICI etc.
141+
"""
142+
135143
@cached_property
136144
def with_raw_response(self) -> AsyncContractNoteResourceWithRawResponse:
137145
"""

src/cas_parser/resources/credits.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121

2222
class CreditsResource(SyncAPIResource):
23+
"""
24+
Endpoints for checking API quota and credits usage.
25+
These endpoints help you monitor your API usage and remaining quota.
26+
"""
27+
2328
@cached_property
2429
def with_raw_response(self) -> CreditsResourceWithRawResponse:
2530
"""
@@ -70,6 +75,11 @@ def check(
7075

7176

7277
class AsyncCreditsResource(AsyncAPIResource):
78+
"""
79+
Endpoints for checking API quota and credits usage.
80+
These endpoints help you monitor your API usage and remaining quota.
81+
"""
82+
7383
@cached_property
7484
def with_raw_response(self) -> AsyncCreditsResourceWithRawResponse:
7585
"""

src/cas_parser/resources/inbound_email.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,29 @@
2828

2929

3030
class InboundEmailResource(SyncAPIResource):
31+
"""
32+
Create dedicated inbound email addresses for investors to forward their CAS statements.
33+
34+
**Use Case:** Your app wants to collect CAS statements from users without requiring OAuth or file upload.
35+
36+
**How it works:**
37+
1. Call `POST /v4/inbound-email` to create a unique inbound email address
38+
2. Display this email to your user: "Forward your CAS statement to ie_xxx@import.casparser.in"
39+
3. When user forwards a CAS email, we verify sender authenticity (SPF/DKIM) and call your webhook
40+
4. Your webhook receives email metadata + attachment download URLs
41+
42+
**Sender Validation:**
43+
- Only emails from verified CAS authorities are processed:
44+
- CDSL: `eCAS@cdslstatement.com`
45+
- NSDL: `NSDL-CAS@nsdl.co.in`
46+
- CAMS: `donotreply@camsonline.com`
47+
- KFintech: `samfS@kfintech.com`
48+
- Emails failing SPF/DKIM/DMARC are rejected
49+
- Forwarded emails must contain the original sender in headers
50+
51+
**Billing:** 0.2 credits per successfully processed valid email
52+
"""
53+
3154
@cached_property
3255
def with_raw_response(self) -> InboundEmailResourceWithRawResponse:
3356
"""
@@ -260,6 +283,29 @@ def delete(
260283

261284

262285
class AsyncInboundEmailResource(AsyncAPIResource):
286+
"""
287+
Create dedicated inbound email addresses for investors to forward their CAS statements.
288+
289+
**Use Case:** Your app wants to collect CAS statements from users without requiring OAuth or file upload.
290+
291+
**How it works:**
292+
1. Call `POST /v4/inbound-email` to create a unique inbound email address
293+
2. Display this email to your user: "Forward your CAS statement to ie_xxx@import.casparser.in"
294+
3. When user forwards a CAS email, we verify sender authenticity (SPF/DKIM) and call your webhook
295+
4. Your webhook receives email metadata + attachment download URLs
296+
297+
**Sender Validation:**
298+
- Only emails from verified CAS authorities are processed:
299+
- CDSL: `eCAS@cdslstatement.com`
300+
- NSDL: `NSDL-CAS@nsdl.co.in`
301+
- CAMS: `donotreply@camsonline.com`
302+
- KFintech: `samfS@kfintech.com`
303+
- Emails failing SPF/DKIM/DMARC are rejected
304+
- Forwarded emails must contain the original sender in headers
305+
306+
**Billing:** 0.2 credits per successfully processed valid email
307+
"""
308+
263309
@cached_property
264310
def with_raw_response(self) -> AsyncInboundEmailResourceWithRawResponse:
265311
"""

src/cas_parser/resources/inbox.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@
2929

3030

3131
class InboxResource(SyncAPIResource):
32+
"""Endpoints for importing CAS files directly from user email inboxes.
33+
34+
**Supported Providers:** Gmail (more coming soon)
35+
36+
**How it works:**
37+
1. Call `POST /v4/inbox/connect` to get an OAuth URL
38+
2. Redirect user to the OAuth URL for consent
39+
3. User is redirected back to your `redirect_uri` with an encrypted `inbox_token`
40+
4. Use the token to list/fetch CAS files from their inbox (`/v4/inbox/cas`)
41+
5. Files are uploaded to temporary cloud storage (URLs expire in 24 hours)
42+
43+
**Security:**
44+
- Read-only access (we cannot send emails)
45+
- Tokens are encrypted with server-side secret
46+
- User can revoke access anytime via `/v4/inbox/disconnect`
47+
"""
48+
3249
@cached_property
3350
def with_raw_response(self) -> InboxResourceWithRawResponse:
3451
"""
@@ -246,6 +263,23 @@ def list_cas_files(
246263

247264

248265
class AsyncInboxResource(AsyncAPIResource):
266+
"""Endpoints for importing CAS files directly from user email inboxes.
267+
268+
**Supported Providers:** Gmail (more coming soon)
269+
270+
**How it works:**
271+
1. Call `POST /v4/inbox/connect` to get an OAuth URL
272+
2. Redirect user to the OAuth URL for consent
273+
3. User is redirected back to your `redirect_uri` with an encrypted `inbox_token`
274+
4. Use the token to list/fetch CAS files from their inbox (`/v4/inbox/cas`)
275+
5. Files are uploaded to temporary cloud storage (URLs expire in 24 hours)
276+
277+
**Security:**
278+
- Read-only access (we cannot send emails)
279+
- Tokens are encrypted with server-side secret
280+
- User can revoke access anytime via `/v4/inbox/disconnect`
281+
"""
282+
249283
@cached_property
250284
def with_raw_response(self) -> AsyncInboxResourceWithRawResponse:
251285
"""

src/cas_parser/resources/kfintech.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323

2424
class KfintechResource(SyncAPIResource):
25+
"""Endpoints for generating new CAS documents via email mailback (KFintech)."""
26+
2527
@cached_property
2628
def with_raw_response(self) -> KfintechResourceWithRawResponse:
2729
"""
@@ -103,6 +105,8 @@ def generate_cas(
103105

104106

105107
class AsyncKfintechResource(AsyncAPIResource):
108+
"""Endpoints for generating new CAS documents via email mailback (KFintech)."""
109+
106110
@cached_property
107111
def with_raw_response(self) -> AsyncKfintechResourceWithRawResponse:
108112
"""

0 commit comments

Comments
 (0)