cas-parser-node 1.7.2 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +1 -3
  3. package/client.d.mts +4 -17
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +4 -17
  6. package/client.d.ts.map +1 -1
  7. package/client.js +8 -16
  8. package/client.js.map +1 -1
  9. package/client.mjs +8 -16
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/access-token.d.mts +2 -0
  13. package/resources/access-token.d.mts.map +1 -1
  14. package/resources/access-token.d.ts +2 -0
  15. package/resources/access-token.d.ts.map +1 -1
  16. package/resources/access-token.js +3 -1
  17. package/resources/access-token.js.map +1 -1
  18. package/resources/access-token.mjs +3 -1
  19. package/resources/access-token.mjs.map +1 -1
  20. package/resources/credits.js +1 -1
  21. package/resources/credits.js.map +1 -1
  22. package/resources/credits.mjs +1 -1
  23. package/resources/credits.mjs.map +1 -1
  24. package/resources/inbound-email.d.mts +273 -0
  25. package/resources/inbound-email.d.mts.map +1 -0
  26. package/resources/inbound-email.d.ts +273 -0
  27. package/resources/inbound-email.d.ts.map +1 -0
  28. package/resources/inbound-email.js +85 -0
  29. package/resources/inbound-email.js.map +1 -0
  30. package/resources/inbound-email.mjs +81 -0
  31. package/resources/inbound-email.mjs.map +1 -0
  32. package/resources/inbox.d.mts +5 -0
  33. package/resources/inbox.d.mts.map +1 -1
  34. package/resources/inbox.d.ts +5 -0
  35. package/resources/inbox.d.ts.map +1 -1
  36. package/resources/index.d.mts +1 -0
  37. package/resources/index.d.mts.map +1 -1
  38. package/resources/index.d.ts +1 -0
  39. package/resources/index.d.ts.map +1 -1
  40. package/resources/index.js +3 -1
  41. package/resources/index.js.map +1 -1
  42. package/resources/index.mjs +1 -0
  43. package/resources/index.mjs.map +1 -1
  44. package/resources/logs.d.mts +4 -0
  45. package/resources/logs.d.mts.map +1 -1
  46. package/resources/logs.d.ts +4 -0
  47. package/resources/logs.d.ts.map +1 -1
  48. package/resources/logs.js +6 -2
  49. package/resources/logs.js.map +1 -1
  50. package/resources/logs.mjs +6 -2
  51. package/resources/logs.mjs.map +1 -1
  52. package/resources/verify-token.js +1 -1
  53. package/resources/verify-token.mjs +1 -1
  54. package/src/client.ts +26 -31
  55. package/src/resources/access-token.ts +3 -1
  56. package/src/resources/credits.ts +1 -1
  57. package/src/resources/inbound-email.ts +332 -0
  58. package/src/resources/inbox.ts +6 -0
  59. package/src/resources/index.ts +9 -0
  60. package/src/resources/logs.ts +6 -2
  61. package/src/resources/verify-token.ts +1 -1
  62. package/src/version.ts +1 -1
  63. package/version.d.mts +1 -1
  64. package/version.d.ts +1 -1
  65. package/version.js +1 -1
  66. package/version.mjs +1 -1
@@ -10,6 +10,8 @@ class AccessToken extends resource_1.APIResource {
10
10
  * **Use this endpoint from your backend** to create tokens that can be safely
11
11
  * passed to frontend/SDK.
12
12
  *
13
+ * **Legacy path:** `/v1/access-token` (still supported)
14
+ *
13
15
  * Access tokens:
14
16
  *
15
17
  * - Are prefixed with `at_` for easy identification
@@ -23,7 +25,7 @@ class AccessToken extends resource_1.APIResource {
23
25
  * ```
24
26
  */
25
27
  create(body = {}, options) {
26
- return this._client.post('/v1/access-token', { body, ...options });
28
+ return this._client.post('/v1/token', { body, ...options });
27
29
  }
28
30
  }
29
31
  exports.AccessToken = AccessToken;
@@ -1 +1 @@
1
- {"version":3,"file":"access-token.js","sourceRoot":"","sources":["../src/resources/access-token.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CACJ,OAAmD,EAAE,EACrD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;CACF;AAzBD,kCAyBC"}
1
+ {"version":3,"file":"access-token.js","sourceRoot":"","sources":["../src/resources/access-token.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CACJ,OAAmD,EAAE,EACrD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF;AA3BD,kCA2BC"}
@@ -7,6 +7,8 @@ export class AccessToken extends APIResource {
7
7
  * **Use this endpoint from your backend** to create tokens that can be safely
8
8
  * passed to frontend/SDK.
9
9
  *
10
+ * **Legacy path:** `/v1/access-token` (still supported)
11
+ *
10
12
  * Access tokens:
11
13
  *
12
14
  * - Are prefixed with `at_` for easy identification
@@ -20,7 +22,7 @@ export class AccessToken extends APIResource {
20
22
  * ```
21
23
  */
22
24
  create(body = {}, options) {
23
- return this._client.post('/v1/access-token', { body, ...options });
25
+ return this._client.post('/v1/token', { body, ...options });
24
26
  }
25
27
  }
26
28
  //# sourceMappingURL=access-token.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"access-token.mjs","sourceRoot":"","sources":["../src/resources/access-token.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CACJ,OAAmD,EAAE,EACrD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;CACF"}
1
+ {"version":3,"file":"access-token.mjs","sourceRoot":"","sources":["../src/resources/access-token.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CACJ,OAAmD,EAAE,EACrD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -16,7 +16,7 @@ class Credits extends resource_1.APIResource {
16
16
  * Credits reset at the start of each billing period.
17
17
  */
18
18
  check(options) {
19
- return this._client.post('/credits', options);
19
+ return this._client.post('/v1/credits', options);
20
20
  }
21
21
  }
22
22
  exports.Credits = Credits;
@@ -1 +1 @@
1
- {"version":3,"file":"credits.js","sourceRoot":"","sources":["../src/resources/credits.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAwB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACF;AAfD,0BAeC"}
1
+ {"version":3,"file":"credits.js","sourceRoot":"","sources":["../src/resources/credits.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAwB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF;AAfD,0BAeC"}
@@ -13,7 +13,7 @@ export class Credits extends APIResource {
13
13
  * Credits reset at the start of each billing period.
14
14
  */
15
15
  check(options) {
16
- return this._client.post('/credits', options);
16
+ return this._client.post('/v1/credits', options);
17
17
  }
18
18
  }
19
19
  //# sourceMappingURL=credits.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"credits.mjs","sourceRoot":"","sources":["../src/resources/credits.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAwB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACF"}
1
+ {"version":3,"file":"credits.mjs","sourceRoot":"","sources":["../src/resources/credits.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAwB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF"}
@@ -0,0 +1,273 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { RequestOptions } from "../internal/request-options.mjs";
4
+ export declare class InboundEmail extends APIResource {
5
+ /**
6
+ * Create a dedicated inbound email address for collecting CAS statements via email
7
+ * forwarding.
8
+ *
9
+ * **How it works:**
10
+ *
11
+ * 1. Create an inbound email with your webhook URL
12
+ * 2. Display the email address to your user (e.g., "Forward your CAS to
13
+ * ie_xxx@import.casparser.in")
14
+ * 3. When an investor forwards a CAS email, we verify the sender and deliver to
15
+ * your webhook
16
+ *
17
+ * **Webhook Delivery:**
18
+ *
19
+ * - We POST to your `callback_url` with JSON body containing files (matching
20
+ * EmailCASFile schema)
21
+ * - Failed deliveries are retried automatically with exponential backoff
22
+ *
23
+ * **Inactivity:**
24
+ *
25
+ * - Inbound emails with no activity in 30 days are marked inactive
26
+ * - Active inbound emails remain operational indefinitely
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const inboundEmail = await client.inboundEmail.create({
31
+ * callback_url:
32
+ * 'https://api.yourapp.com/webhooks/cas-email',
33
+ * });
34
+ * ```
35
+ */
36
+ create(body: InboundEmailCreateParams, options?: RequestOptions): APIPromise<InboundEmailCreateResponse>;
37
+ /**
38
+ * Retrieve details of a specific mailbox including statistics.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const inboundEmail = await client.inboundEmail.retrieve(
43
+ * 'ie_a1b2c3d4e5f6',
44
+ * );
45
+ * ```
46
+ */
47
+ retrieve(inboundEmailID: string, options?: RequestOptions): APIPromise<InboundEmailRetrieveResponse>;
48
+ /**
49
+ * List all mailboxes associated with your API key. Returns active and inactive
50
+ * mailboxes (deleted mailboxes are excluded).
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const inboundEmails = await client.inboundEmail.list();
55
+ * ```
56
+ */
57
+ list(query?: InboundEmailListParams | null | undefined, options?: RequestOptions): APIPromise<InboundEmailListResponse>;
58
+ /**
59
+ * Permanently delete an inbound email address. It will stop accepting emails.
60
+ *
61
+ * **Note:** Deletion is immediate and cannot be undone. Any emails received after
62
+ * deletion will be rejected.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const inboundEmail = await client.inboundEmail.delete(
67
+ * 'inbound_email_id',
68
+ * );
69
+ * ```
70
+ */
71
+ delete(inboundEmailID: string, options?: RequestOptions): APIPromise<InboundEmailDeleteResponse>;
72
+ }
73
+ /**
74
+ * An inbound email address for receiving forwarded CAS emails
75
+ */
76
+ export interface InboundEmailCreateResponse {
77
+ /**
78
+ * Accepted CAS providers (empty = all)
79
+ */
80
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
81
+ /**
82
+ * Webhook URL for email notifications
83
+ */
84
+ callback_url?: string;
85
+ /**
86
+ * When the mailbox was created
87
+ */
88
+ created_at?: string;
89
+ /**
90
+ * The inbound email address to forward CAS statements to
91
+ */
92
+ email?: string;
93
+ /**
94
+ * Unique inbound email identifier
95
+ */
96
+ inbound_email_id?: string;
97
+ /**
98
+ * Custom key-value metadata
99
+ */
100
+ metadata?: {
101
+ [key: string]: string;
102
+ };
103
+ /**
104
+ * Your internal reference identifier
105
+ */
106
+ reference?: string | null;
107
+ /**
108
+ * Current mailbox status
109
+ */
110
+ status?: 'active' | 'paused';
111
+ /**
112
+ * When the mailbox was last updated
113
+ */
114
+ updated_at?: string;
115
+ }
116
+ /**
117
+ * An inbound email address for receiving forwarded CAS emails
118
+ */
119
+ export interface InboundEmailRetrieveResponse {
120
+ /**
121
+ * Accepted CAS providers (empty = all)
122
+ */
123
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
124
+ /**
125
+ * Webhook URL for email notifications
126
+ */
127
+ callback_url?: string;
128
+ /**
129
+ * When the mailbox was created
130
+ */
131
+ created_at?: string;
132
+ /**
133
+ * The inbound email address to forward CAS statements to
134
+ */
135
+ email?: string;
136
+ /**
137
+ * Unique inbound email identifier
138
+ */
139
+ inbound_email_id?: string;
140
+ /**
141
+ * Custom key-value metadata
142
+ */
143
+ metadata?: {
144
+ [key: string]: string;
145
+ };
146
+ /**
147
+ * Your internal reference identifier
148
+ */
149
+ reference?: string | null;
150
+ /**
151
+ * Current mailbox status
152
+ */
153
+ status?: 'active' | 'paused';
154
+ /**
155
+ * When the mailbox was last updated
156
+ */
157
+ updated_at?: string;
158
+ }
159
+ export interface InboundEmailListResponse {
160
+ inbound_emails?: Array<InboundEmailListResponse.InboundEmail>;
161
+ limit?: number;
162
+ offset?: number;
163
+ status?: string;
164
+ /**
165
+ * Total number of inbound emails (for pagination)
166
+ */
167
+ total?: number;
168
+ }
169
+ export declare namespace InboundEmailListResponse {
170
+ /**
171
+ * An inbound email address for receiving forwarded CAS emails
172
+ */
173
+ interface InboundEmail {
174
+ /**
175
+ * Accepted CAS providers (empty = all)
176
+ */
177
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
178
+ /**
179
+ * Webhook URL for email notifications
180
+ */
181
+ callback_url?: string;
182
+ /**
183
+ * When the mailbox was created
184
+ */
185
+ created_at?: string;
186
+ /**
187
+ * The inbound email address to forward CAS statements to
188
+ */
189
+ email?: string;
190
+ /**
191
+ * Unique inbound email identifier
192
+ */
193
+ inbound_email_id?: string;
194
+ /**
195
+ * Custom key-value metadata
196
+ */
197
+ metadata?: {
198
+ [key: string]: string;
199
+ };
200
+ /**
201
+ * Your internal reference identifier
202
+ */
203
+ reference?: string | null;
204
+ /**
205
+ * Current mailbox status
206
+ */
207
+ status?: 'active' | 'paused';
208
+ /**
209
+ * When the mailbox was last updated
210
+ */
211
+ updated_at?: string;
212
+ }
213
+ }
214
+ export interface InboundEmailDeleteResponse {
215
+ msg?: string;
216
+ status?: string;
217
+ }
218
+ export interface InboundEmailCreateParams {
219
+ /**
220
+ * Webhook URL where we POST email notifications. Must be HTTPS in production (HTTP
221
+ * allowed for localhost during development).
222
+ */
223
+ callback_url: string;
224
+ /**
225
+ * Optional custom email prefix for user-friendly addresses.
226
+ *
227
+ * - Must be 3-32 characters
228
+ * - Alphanumeric + hyphens only
229
+ * - Must start and end with letter/number
230
+ * - Example: `john-portfolio@import.casparser.in`
231
+ * - If omitted, generates random ID like `ie_abc123xyz@import.casparser.in`
232
+ */
233
+ alias?: string;
234
+ /**
235
+ * Filter emails by CAS provider. If omitted, accepts all providers.
236
+ *
237
+ * - `cdsl` → eCAS@cdslstatement.com
238
+ * - `nsdl` → NSDL-CAS@nsdl.co.in
239
+ * - `cams` → donotreply@camsonline.com
240
+ * - `kfintech` → samfS@kfintech.com
241
+ */
242
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
243
+ /**
244
+ * Optional key-value pairs (max 10) to include in webhook payload. Useful for
245
+ * passing context like plan_type, campaign_id, etc.
246
+ */
247
+ metadata?: {
248
+ [key: string]: string;
249
+ };
250
+ /**
251
+ * Your internal identifier (e.g., user_id, account_id). Returned in webhook
252
+ * payload for correlation.
253
+ */
254
+ reference?: string;
255
+ }
256
+ export interface InboundEmailListParams {
257
+ /**
258
+ * Maximum number of inbound emails to return
259
+ */
260
+ limit?: number;
261
+ /**
262
+ * Pagination offset
263
+ */
264
+ offset?: number;
265
+ /**
266
+ * Filter by status
267
+ */
268
+ status?: 'active' | 'paused' | 'all';
269
+ }
270
+ export declare namespace InboundEmail {
271
+ export { type InboundEmailCreateResponse as InboundEmailCreateResponse, type InboundEmailRetrieveResponse as InboundEmailRetrieveResponse, type InboundEmailListResponse as InboundEmailListResponse, type InboundEmailDeleteResponse as InboundEmailDeleteResponse, type InboundEmailCreateParams as InboundEmailCreateParams, type InboundEmailListParams as InboundEmailListParams, };
272
+ }
273
+ //# sourceMappingURL=inbound-email.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-email.d.mts","sourceRoot":"","sources":["../src/resources/inbound-email.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAIxG;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,4BAA4B,CAAC;IAIpG;;;;;;;;OAQG;IACH,IAAI,CACF,KAAK,GAAE,sBAAsB,GAAG,IAAI,GAAG,SAAc,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;IAIvC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;CAGjG;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,eAAe,CAAC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EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;CACtC;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
@@ -0,0 +1,273 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import { APIPromise } from "../core/api-promise.js";
3
+ import { RequestOptions } from "../internal/request-options.js";
4
+ export declare class InboundEmail extends APIResource {
5
+ /**
6
+ * Create a dedicated inbound email address for collecting CAS statements via email
7
+ * forwarding.
8
+ *
9
+ * **How it works:**
10
+ *
11
+ * 1. Create an inbound email with your webhook URL
12
+ * 2. Display the email address to your user (e.g., "Forward your CAS to
13
+ * ie_xxx@import.casparser.in")
14
+ * 3. When an investor forwards a CAS email, we verify the sender and deliver to
15
+ * your webhook
16
+ *
17
+ * **Webhook Delivery:**
18
+ *
19
+ * - We POST to your `callback_url` with JSON body containing files (matching
20
+ * EmailCASFile schema)
21
+ * - Failed deliveries are retried automatically with exponential backoff
22
+ *
23
+ * **Inactivity:**
24
+ *
25
+ * - Inbound emails with no activity in 30 days are marked inactive
26
+ * - Active inbound emails remain operational indefinitely
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const inboundEmail = await client.inboundEmail.create({
31
+ * callback_url:
32
+ * 'https://api.yourapp.com/webhooks/cas-email',
33
+ * });
34
+ * ```
35
+ */
36
+ create(body: InboundEmailCreateParams, options?: RequestOptions): APIPromise<InboundEmailCreateResponse>;
37
+ /**
38
+ * Retrieve details of a specific mailbox including statistics.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const inboundEmail = await client.inboundEmail.retrieve(
43
+ * 'ie_a1b2c3d4e5f6',
44
+ * );
45
+ * ```
46
+ */
47
+ retrieve(inboundEmailID: string, options?: RequestOptions): APIPromise<InboundEmailRetrieveResponse>;
48
+ /**
49
+ * List all mailboxes associated with your API key. Returns active and inactive
50
+ * mailboxes (deleted mailboxes are excluded).
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const inboundEmails = await client.inboundEmail.list();
55
+ * ```
56
+ */
57
+ list(query?: InboundEmailListParams | null | undefined, options?: RequestOptions): APIPromise<InboundEmailListResponse>;
58
+ /**
59
+ * Permanently delete an inbound email address. It will stop accepting emails.
60
+ *
61
+ * **Note:** Deletion is immediate and cannot be undone. Any emails received after
62
+ * deletion will be rejected.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const inboundEmail = await client.inboundEmail.delete(
67
+ * 'inbound_email_id',
68
+ * );
69
+ * ```
70
+ */
71
+ delete(inboundEmailID: string, options?: RequestOptions): APIPromise<InboundEmailDeleteResponse>;
72
+ }
73
+ /**
74
+ * An inbound email address for receiving forwarded CAS emails
75
+ */
76
+ export interface InboundEmailCreateResponse {
77
+ /**
78
+ * Accepted CAS providers (empty = all)
79
+ */
80
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
81
+ /**
82
+ * Webhook URL for email notifications
83
+ */
84
+ callback_url?: string;
85
+ /**
86
+ * When the mailbox was created
87
+ */
88
+ created_at?: string;
89
+ /**
90
+ * The inbound email address to forward CAS statements to
91
+ */
92
+ email?: string;
93
+ /**
94
+ * Unique inbound email identifier
95
+ */
96
+ inbound_email_id?: string;
97
+ /**
98
+ * Custom key-value metadata
99
+ */
100
+ metadata?: {
101
+ [key: string]: string;
102
+ };
103
+ /**
104
+ * Your internal reference identifier
105
+ */
106
+ reference?: string | null;
107
+ /**
108
+ * Current mailbox status
109
+ */
110
+ status?: 'active' | 'paused';
111
+ /**
112
+ * When the mailbox was last updated
113
+ */
114
+ updated_at?: string;
115
+ }
116
+ /**
117
+ * An inbound email address for receiving forwarded CAS emails
118
+ */
119
+ export interface InboundEmailRetrieveResponse {
120
+ /**
121
+ * Accepted CAS providers (empty = all)
122
+ */
123
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
124
+ /**
125
+ * Webhook URL for email notifications
126
+ */
127
+ callback_url?: string;
128
+ /**
129
+ * When the mailbox was created
130
+ */
131
+ created_at?: string;
132
+ /**
133
+ * The inbound email address to forward CAS statements to
134
+ */
135
+ email?: string;
136
+ /**
137
+ * Unique inbound email identifier
138
+ */
139
+ inbound_email_id?: string;
140
+ /**
141
+ * Custom key-value metadata
142
+ */
143
+ metadata?: {
144
+ [key: string]: string;
145
+ };
146
+ /**
147
+ * Your internal reference identifier
148
+ */
149
+ reference?: string | null;
150
+ /**
151
+ * Current mailbox status
152
+ */
153
+ status?: 'active' | 'paused';
154
+ /**
155
+ * When the mailbox was last updated
156
+ */
157
+ updated_at?: string;
158
+ }
159
+ export interface InboundEmailListResponse {
160
+ inbound_emails?: Array<InboundEmailListResponse.InboundEmail>;
161
+ limit?: number;
162
+ offset?: number;
163
+ status?: string;
164
+ /**
165
+ * Total number of inbound emails (for pagination)
166
+ */
167
+ total?: number;
168
+ }
169
+ export declare namespace InboundEmailListResponse {
170
+ /**
171
+ * An inbound email address for receiving forwarded CAS emails
172
+ */
173
+ interface InboundEmail {
174
+ /**
175
+ * Accepted CAS providers (empty = all)
176
+ */
177
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
178
+ /**
179
+ * Webhook URL for email notifications
180
+ */
181
+ callback_url?: string;
182
+ /**
183
+ * When the mailbox was created
184
+ */
185
+ created_at?: string;
186
+ /**
187
+ * The inbound email address to forward CAS statements to
188
+ */
189
+ email?: string;
190
+ /**
191
+ * Unique inbound email identifier
192
+ */
193
+ inbound_email_id?: string;
194
+ /**
195
+ * Custom key-value metadata
196
+ */
197
+ metadata?: {
198
+ [key: string]: string;
199
+ };
200
+ /**
201
+ * Your internal reference identifier
202
+ */
203
+ reference?: string | null;
204
+ /**
205
+ * Current mailbox status
206
+ */
207
+ status?: 'active' | 'paused';
208
+ /**
209
+ * When the mailbox was last updated
210
+ */
211
+ updated_at?: string;
212
+ }
213
+ }
214
+ export interface InboundEmailDeleteResponse {
215
+ msg?: string;
216
+ status?: string;
217
+ }
218
+ export interface InboundEmailCreateParams {
219
+ /**
220
+ * Webhook URL where we POST email notifications. Must be HTTPS in production (HTTP
221
+ * allowed for localhost during development).
222
+ */
223
+ callback_url: string;
224
+ /**
225
+ * Optional custom email prefix for user-friendly addresses.
226
+ *
227
+ * - Must be 3-32 characters
228
+ * - Alphanumeric + hyphens only
229
+ * - Must start and end with letter/number
230
+ * - Example: `john-portfolio@import.casparser.in`
231
+ * - If omitted, generates random ID like `ie_abc123xyz@import.casparser.in`
232
+ */
233
+ alias?: string;
234
+ /**
235
+ * Filter emails by CAS provider. If omitted, accepts all providers.
236
+ *
237
+ * - `cdsl` → eCAS@cdslstatement.com
238
+ * - `nsdl` → NSDL-CAS@nsdl.co.in
239
+ * - `cams` → donotreply@camsonline.com
240
+ * - `kfintech` → samfS@kfintech.com
241
+ */
242
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
243
+ /**
244
+ * Optional key-value pairs (max 10) to include in webhook payload. Useful for
245
+ * passing context like plan_type, campaign_id, etc.
246
+ */
247
+ metadata?: {
248
+ [key: string]: string;
249
+ };
250
+ /**
251
+ * Your internal identifier (e.g., user_id, account_id). Returned in webhook
252
+ * payload for correlation.
253
+ */
254
+ reference?: string;
255
+ }
256
+ export interface InboundEmailListParams {
257
+ /**
258
+ * Maximum number of inbound emails to return
259
+ */
260
+ limit?: number;
261
+ /**
262
+ * Pagination offset
263
+ */
264
+ offset?: number;
265
+ /**
266
+ * Filter by status
267
+ */
268
+ status?: 'active' | 'paused' | 'all';
269
+ }
270
+ export declare namespace InboundEmail {
271
+ export { type InboundEmailCreateResponse as InboundEmailCreateResponse, type InboundEmailRetrieveResponse as InboundEmailRetrieveResponse, type InboundEmailListResponse as InboundEmailListResponse, type InboundEmailDeleteResponse as InboundEmailDeleteResponse, type InboundEmailCreateParams as InboundEmailCreateParams, type InboundEmailListParams as InboundEmailListParams, };
272
+ }
273
+ //# sourceMappingURL=inbound-email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-email.d.ts","sourceRoot":"","sources":["../src/resources/inbound-email.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAIxG;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,4BAA4B,CAAC;IAIpG;;;;;;;;OAQG;IACH,IAAI,CACF,KAAK,GAAE,sBAAsB,GAAG,IAAI,GAAG,SAAc,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,wBAAwB,CAAC;IAIvC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;CAGjG;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,eAAe,CAAC,EAAE,K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