cas-parser-node 1.7.1 → 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 +29 -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 +10 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +10 -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 +29 -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,332 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
7
+
8
+ export class InboundEmail extends APIResource {
9
+ /**
10
+ * Create a dedicated inbound email address for collecting CAS statements via email
11
+ * forwarding.
12
+ *
13
+ * **How it works:**
14
+ *
15
+ * 1. Create an inbound email with your webhook URL
16
+ * 2. Display the email address to your user (e.g., "Forward your CAS to
17
+ * ie_xxx@import.casparser.in")
18
+ * 3. When an investor forwards a CAS email, we verify the sender and deliver to
19
+ * your webhook
20
+ *
21
+ * **Webhook Delivery:**
22
+ *
23
+ * - We POST to your `callback_url` with JSON body containing files (matching
24
+ * EmailCASFile schema)
25
+ * - Failed deliveries are retried automatically with exponential backoff
26
+ *
27
+ * **Inactivity:**
28
+ *
29
+ * - Inbound emails with no activity in 30 days are marked inactive
30
+ * - Active inbound emails remain operational indefinitely
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const inboundEmail = await client.inboundEmail.create({
35
+ * callback_url:
36
+ * 'https://api.yourapp.com/webhooks/cas-email',
37
+ * });
38
+ * ```
39
+ */
40
+ create(body: InboundEmailCreateParams, options?: RequestOptions): APIPromise<InboundEmailCreateResponse> {
41
+ return this._client.post('/v4/inbound-email', { body, ...options });
42
+ }
43
+
44
+ /**
45
+ * Retrieve details of a specific mailbox including statistics.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const inboundEmail = await client.inboundEmail.retrieve(
50
+ * 'ie_a1b2c3d4e5f6',
51
+ * );
52
+ * ```
53
+ */
54
+ retrieve(inboundEmailID: string, options?: RequestOptions): APIPromise<InboundEmailRetrieveResponse> {
55
+ return this._client.get(path`/v4/inbound-email/${inboundEmailID}`, options);
56
+ }
57
+
58
+ /**
59
+ * List all mailboxes associated with your API key. Returns active and inactive
60
+ * mailboxes (deleted mailboxes are excluded).
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const inboundEmails = await client.inboundEmail.list();
65
+ * ```
66
+ */
67
+ list(
68
+ query: InboundEmailListParams | null | undefined = {},
69
+ options?: RequestOptions,
70
+ ): APIPromise<InboundEmailListResponse> {
71
+ return this._client.get('/v4/inbound-email', { query, ...options });
72
+ }
73
+
74
+ /**
75
+ * Permanently delete an inbound email address. It will stop accepting emails.
76
+ *
77
+ * **Note:** Deletion is immediate and cannot be undone. Any emails received after
78
+ * deletion will be rejected.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const inboundEmail = await client.inboundEmail.delete(
83
+ * 'inbound_email_id',
84
+ * );
85
+ * ```
86
+ */
87
+ delete(inboundEmailID: string, options?: RequestOptions): APIPromise<InboundEmailDeleteResponse> {
88
+ return this._client.delete(path`/v4/inbound-email/${inboundEmailID}`, options);
89
+ }
90
+ }
91
+
92
+ /**
93
+ * An inbound email address for receiving forwarded CAS emails
94
+ */
95
+ export interface InboundEmailCreateResponse {
96
+ /**
97
+ * Accepted CAS providers (empty = all)
98
+ */
99
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
100
+
101
+ /**
102
+ * Webhook URL for email notifications
103
+ */
104
+ callback_url?: string;
105
+
106
+ /**
107
+ * When the mailbox was created
108
+ */
109
+ created_at?: string;
110
+
111
+ /**
112
+ * The inbound email address to forward CAS statements to
113
+ */
114
+ email?: string;
115
+
116
+ /**
117
+ * Unique inbound email identifier
118
+ */
119
+ inbound_email_id?: string;
120
+
121
+ /**
122
+ * Custom key-value metadata
123
+ */
124
+ metadata?: { [key: string]: string };
125
+
126
+ /**
127
+ * Your internal reference identifier
128
+ */
129
+ reference?: string | null;
130
+
131
+ /**
132
+ * Current mailbox status
133
+ */
134
+ status?: 'active' | 'paused';
135
+
136
+ /**
137
+ * When the mailbox was last updated
138
+ */
139
+ updated_at?: string;
140
+ }
141
+
142
+ /**
143
+ * An inbound email address for receiving forwarded CAS emails
144
+ */
145
+ export interface InboundEmailRetrieveResponse {
146
+ /**
147
+ * Accepted CAS providers (empty = all)
148
+ */
149
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
150
+
151
+ /**
152
+ * Webhook URL for email notifications
153
+ */
154
+ callback_url?: string;
155
+
156
+ /**
157
+ * When the mailbox was created
158
+ */
159
+ created_at?: string;
160
+
161
+ /**
162
+ * The inbound email address to forward CAS statements to
163
+ */
164
+ email?: string;
165
+
166
+ /**
167
+ * Unique inbound email identifier
168
+ */
169
+ inbound_email_id?: string;
170
+
171
+ /**
172
+ * Custom key-value metadata
173
+ */
174
+ metadata?: { [key: string]: string };
175
+
176
+ /**
177
+ * Your internal reference identifier
178
+ */
179
+ reference?: string | null;
180
+
181
+ /**
182
+ * Current mailbox status
183
+ */
184
+ status?: 'active' | 'paused';
185
+
186
+ /**
187
+ * When the mailbox was last updated
188
+ */
189
+ updated_at?: string;
190
+ }
191
+
192
+ export interface InboundEmailListResponse {
193
+ inbound_emails?: Array<InboundEmailListResponse.InboundEmail>;
194
+
195
+ limit?: number;
196
+
197
+ offset?: number;
198
+
199
+ status?: string;
200
+
201
+ /**
202
+ * Total number of inbound emails (for pagination)
203
+ */
204
+ total?: number;
205
+ }
206
+
207
+ export namespace InboundEmailListResponse {
208
+ /**
209
+ * An inbound email address for receiving forwarded CAS emails
210
+ */
211
+ export interface InboundEmail {
212
+ /**
213
+ * Accepted CAS providers (empty = all)
214
+ */
215
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
216
+
217
+ /**
218
+ * Webhook URL for email notifications
219
+ */
220
+ callback_url?: string;
221
+
222
+ /**
223
+ * When the mailbox was created
224
+ */
225
+ created_at?: string;
226
+
227
+ /**
228
+ * The inbound email address to forward CAS statements to
229
+ */
230
+ email?: string;
231
+
232
+ /**
233
+ * Unique inbound email identifier
234
+ */
235
+ inbound_email_id?: string;
236
+
237
+ /**
238
+ * Custom key-value metadata
239
+ */
240
+ metadata?: { [key: string]: string };
241
+
242
+ /**
243
+ * Your internal reference identifier
244
+ */
245
+ reference?: string | null;
246
+
247
+ /**
248
+ * Current mailbox status
249
+ */
250
+ status?: 'active' | 'paused';
251
+
252
+ /**
253
+ * When the mailbox was last updated
254
+ */
255
+ updated_at?: string;
256
+ }
257
+ }
258
+
259
+ export interface InboundEmailDeleteResponse {
260
+ msg?: string;
261
+
262
+ status?: string;
263
+ }
264
+
265
+ export interface InboundEmailCreateParams {
266
+ /**
267
+ * Webhook URL where we POST email notifications. Must be HTTPS in production (HTTP
268
+ * allowed for localhost during development).
269
+ */
270
+ callback_url: string;
271
+
272
+ /**
273
+ * Optional custom email prefix for user-friendly addresses.
274
+ *
275
+ * - Must be 3-32 characters
276
+ * - Alphanumeric + hyphens only
277
+ * - Must start and end with letter/number
278
+ * - Example: `john-portfolio@import.casparser.in`
279
+ * - If omitted, generates random ID like `ie_abc123xyz@import.casparser.in`
280
+ */
281
+ alias?: string;
282
+
283
+ /**
284
+ * Filter emails by CAS provider. If omitted, accepts all providers.
285
+ *
286
+ * - `cdsl` → eCAS@cdslstatement.com
287
+ * - `nsdl` → NSDL-CAS@nsdl.co.in
288
+ * - `cams` → donotreply@camsonline.com
289
+ * - `kfintech` → samfS@kfintech.com
290
+ */
291
+ allowed_sources?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
292
+
293
+ /**
294
+ * Optional key-value pairs (max 10) to include in webhook payload. Useful for
295
+ * passing context like plan_type, campaign_id, etc.
296
+ */
297
+ metadata?: { [key: string]: string };
298
+
299
+ /**
300
+ * Your internal identifier (e.g., user_id, account_id). Returned in webhook
301
+ * payload for correlation.
302
+ */
303
+ reference?: string;
304
+ }
305
+
306
+ export interface InboundEmailListParams {
307
+ /**
308
+ * Maximum number of inbound emails to return
309
+ */
310
+ limit?: number;
311
+
312
+ /**
313
+ * Pagination offset
314
+ */
315
+ offset?: number;
316
+
317
+ /**
318
+ * Filter by status
319
+ */
320
+ status?: 'active' | 'paused' | 'all';
321
+ }
322
+
323
+ export declare namespace InboundEmail {
324
+ export {
325
+ type InboundEmailCreateResponse as InboundEmailCreateResponse,
326
+ type InboundEmailRetrieveResponse as InboundEmailRetrieveResponse,
327
+ type InboundEmailListResponse as InboundEmailListResponse,
328
+ type InboundEmailDeleteResponse as InboundEmailDeleteResponse,
329
+ type InboundEmailCreateParams as InboundEmailCreateParams,
330
+ type InboundEmailListParams as InboundEmailListParams,
331
+ };
332
+ }
@@ -204,6 +204,12 @@ export namespace InboxListCasFilesResponse {
204
204
  */
205
205
  original_filename?: string;
206
206
 
207
+ /**
208
+ * Email address of the CAS authority (CDSL, NSDL, CAMS, or KFintech) who
209
+ * originally sent this statement
210
+ */
211
+ sender_email?: string;
212
+
207
213
  /**
208
214
  * File size in bytes
209
215
  */
@@ -11,6 +11,15 @@ export {
11
11
  export { Cdsl, type CdslParsePdfParams } from './cdsl/cdsl';
12
12
  export { ContractNote, type ContractNoteParseResponse, type ContractNoteParseParams } from './contract-note';
13
13
  export { Credits, type CreditCheckResponse } from './credits';
14
+ export {
15
+ InboundEmail,
16
+ type InboundEmailCreateResponse,
17
+ type InboundEmailRetrieveResponse,
18
+ type InboundEmailListResponse,
19
+ type InboundEmailDeleteResponse,
20
+ type InboundEmailCreateParams,
21
+ type InboundEmailListParams,
22
+ } from './inbound-email';
14
23
  export {
15
24
  Inbox,
16
25
  type InboxCheckConnectionStatusResponse,
@@ -11,6 +11,8 @@ export class Logs extends APIResource {
11
11
  * Returns a list of API calls with timestamps, features used, status codes, and
12
12
  * credits consumed. Useful for monitoring usage patterns and debugging.
13
13
  *
14
+ * **Legacy path:** `/logs` (still supported)
15
+ *
14
16
  * @example
15
17
  * ```ts
16
18
  * const log = await client.logs.create();
@@ -20,7 +22,7 @@ export class Logs extends APIResource {
20
22
  body: LogCreateParams | null | undefined = {},
21
23
  options?: RequestOptions,
22
24
  ): APIPromise<LogCreateResponse> {
23
- return this._client.post('/logs', { body, ...options });
25
+ return this._client.post('/v1/usage', { body, ...options });
24
26
  }
25
27
 
26
28
  /**
@@ -29,6 +31,8 @@ export class Logs extends APIResource {
29
31
  * Useful for understanding which API features are being used most and tracking
30
32
  * usage trends.
31
33
  *
34
+ * **Legacy path:** `/logs/summary` (still supported)
35
+ *
32
36
  * @example
33
37
  * ```ts
34
38
  * const response = await client.logs.getSummary();
@@ -38,7 +42,7 @@ export class Logs extends APIResource {
38
42
  body: LogGetSummaryParams | null | undefined = {},
39
43
  options?: RequestOptions,
40
44
  ): APIPromise<LogGetSummaryResponse> {
41
- return this._client.post('/logs/summary', { body, ...options });
45
+ return this._client.post('/v1/usage/summary', { body, ...options });
42
46
  }
43
47
  }
44
48
 
@@ -10,7 +10,7 @@ export class VerifyToken extends APIResource {
10
10
  * issues.
11
11
  */
12
12
  verify(options?: RequestOptions): APIPromise<VerifyTokenVerifyResponse> {
13
- return this._client.post('/v1/verify-token', options);
13
+ return this._client.post('/v1/token/verify', options);
14
14
  }
15
15
  }
16
16
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.7.1'; // x-release-please-version
1
+ export const VERSION = '1.8.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.7.1";
1
+ export declare const VERSION = "1.8.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.7.1";
1
+ export declare const VERSION = "1.8.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.7.1'; // x-release-please-version
4
+ exports.VERSION = '1.8.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.7.1'; // x-release-please-version
1
+ export const VERSION = '1.8.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map