cas-parser-node 1.7.2 → 1.8.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 (65) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/client.d.mts +3 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/access-token.d.mts +2 -0
  12. package/resources/access-token.d.mts.map +1 -1
  13. package/resources/access-token.d.ts +2 -0
  14. package/resources/access-token.d.ts.map +1 -1
  15. package/resources/access-token.js +3 -1
  16. package/resources/access-token.js.map +1 -1
  17. package/resources/access-token.mjs +3 -1
  18. package/resources/access-token.mjs.map +1 -1
  19. package/resources/credits.js +1 -1
  20. package/resources/credits.js.map +1 -1
  21. package/resources/credits.mjs +1 -1
  22. package/resources/credits.mjs.map +1 -1
  23. package/resources/inbound-email.d.mts +273 -0
  24. package/resources/inbound-email.d.mts.map +1 -0
  25. package/resources/inbound-email.d.ts +273 -0
  26. package/resources/inbound-email.d.ts.map +1 -0
  27. package/resources/inbound-email.js +85 -0
  28. package/resources/inbound-email.js.map +1 -0
  29. package/resources/inbound-email.mjs +81 -0
  30. package/resources/inbound-email.mjs.map +1 -0
  31. package/resources/inbox.d.mts +5 -0
  32. package/resources/inbox.d.mts.map +1 -1
  33. package/resources/inbox.d.ts +5 -0
  34. package/resources/inbox.d.ts.map +1 -1
  35. package/resources/index.d.mts +1 -0
  36. package/resources/index.d.mts.map +1 -1
  37. package/resources/index.d.ts +1 -0
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js +3 -1
  40. package/resources/index.js.map +1 -1
  41. package/resources/index.mjs +1 -0
  42. package/resources/index.mjs.map +1 -1
  43. package/resources/logs.d.mts +4 -0
  44. package/resources/logs.d.mts.map +1 -1
  45. package/resources/logs.d.ts +4 -0
  46. package/resources/logs.d.ts.map +1 -1
  47. package/resources/logs.js +6 -2
  48. package/resources/logs.js.map +1 -1
  49. package/resources/logs.mjs +6 -2
  50. package/resources/logs.mjs.map +1 -1
  51. package/resources/verify-token.js +1 -1
  52. package/resources/verify-token.mjs +1 -1
  53. package/src/client.ts +21 -0
  54. package/src/resources/access-token.ts +3 -1
  55. package/src/resources/credits.ts +1 -1
  56. package/src/resources/inbound-email.ts +332 -0
  57. package/src/resources/inbox.ts +6 -0
  58. package/src/resources/index.ts +9 -0
  59. package/src/resources/logs.ts +6 -2
  60. package/src/resources/verify-token.ts +1 -1
  61. package/src/version.ts +1 -1
  62. package/version.d.mts +1 -1
  63. package/version.d.ts +1 -1
  64. package/version.js +1 -1
  65. package/version.mjs +1 -1
@@ -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,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC;IAE/D;;OAEG;IACH,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ACpB;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,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC;IAE/D;;OAEG;IACH,YAAY,CA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,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,85 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.InboundEmail = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const path_1 = require("../internal/utils/path.js");
7
+ class InboundEmail extends resource_1.APIResource {
8
+ /**
9
+ * Create a dedicated inbound email address for collecting CAS statements via email
10
+ * forwarding.
11
+ *
12
+ * **How it works:**
13
+ *
14
+ * 1. Create an inbound email with your webhook URL
15
+ * 2. Display the email address to your user (e.g., "Forward your CAS to
16
+ * ie_xxx@import.casparser.in")
17
+ * 3. When an investor forwards a CAS email, we verify the sender and deliver to
18
+ * your webhook
19
+ *
20
+ * **Webhook Delivery:**
21
+ *
22
+ * - We POST to your `callback_url` with JSON body containing files (matching
23
+ * EmailCASFile schema)
24
+ * - Failed deliveries are retried automatically with exponential backoff
25
+ *
26
+ * **Inactivity:**
27
+ *
28
+ * - Inbound emails with no activity in 30 days are marked inactive
29
+ * - Active inbound emails remain operational indefinitely
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const inboundEmail = await client.inboundEmail.create({
34
+ * callback_url:
35
+ * 'https://api.yourapp.com/webhooks/cas-email',
36
+ * });
37
+ * ```
38
+ */
39
+ create(body, options) {
40
+ return this._client.post('/v4/inbound-email', { body, ...options });
41
+ }
42
+ /**
43
+ * Retrieve details of a specific mailbox including statistics.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const inboundEmail = await client.inboundEmail.retrieve(
48
+ * 'ie_a1b2c3d4e5f6',
49
+ * );
50
+ * ```
51
+ */
52
+ retrieve(inboundEmailID, options) {
53
+ return this._client.get((0, path_1.path) `/v4/inbound-email/${inboundEmailID}`, options);
54
+ }
55
+ /**
56
+ * List all mailboxes associated with your API key. Returns active and inactive
57
+ * mailboxes (deleted mailboxes are excluded).
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const inboundEmails = await client.inboundEmail.list();
62
+ * ```
63
+ */
64
+ list(query = {}, options) {
65
+ return this._client.get('/v4/inbound-email', { query, ...options });
66
+ }
67
+ /**
68
+ * Permanently delete an inbound email address. It will stop accepting emails.
69
+ *
70
+ * **Note:** Deletion is immediate and cannot be undone. Any emails received after
71
+ * deletion will be rejected.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const inboundEmail = await client.inboundEmail.delete(
76
+ * 'inbound_email_id',
77
+ * );
78
+ * ```
79
+ */
80
+ delete(inboundEmailID, options) {
81
+ return this._client.delete((0, path_1.path) `/v4/inbound-email/${inboundEmailID}`, options);
82
+ }
83
+ }
84
+ exports.InboundEmail = InboundEmail;
85
+ //# sourceMappingURL=inbound-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-email.js","sourceRoot":"","sources":["../src/resources/inbound-email.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAA8C;AAE9C,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,IAA8B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAsB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,qBAAqB,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CACF,QAAmD,EAAE,EACrD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,cAAsB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,qBAAqB,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC;CACF;AAlFD,oCAkFC"}