cas-parser-node 1.4.1 → 1.6.2

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 (181) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/LICENSE +1 -1
  3. package/README.md +30 -32
  4. package/client.d.mts +51 -7
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +51 -7
  7. package/client.d.ts.map +1 -1
  8. package/client.js +56 -12
  9. package/client.js.map +1 -1
  10. package/client.mjs +56 -12
  11. package/client.mjs.map +1 -1
  12. package/internal/parse.d.mts.map +1 -1
  13. package/internal/parse.d.ts.map +1 -1
  14. package/internal/parse.js +5 -0
  15. package/internal/parse.js.map +1 -1
  16. package/internal/parse.mjs +5 -0
  17. package/internal/parse.mjs.map +1 -1
  18. package/internal/to-file.d.mts +1 -1
  19. package/internal/to-file.d.ts +1 -1
  20. package/internal/to-file.js +1 -1
  21. package/internal/to-file.mjs +1 -1
  22. package/internal/tslib.js +17 -17
  23. package/package.json +9 -10
  24. package/resources/access-token.d.mts +48 -0
  25. package/resources/access-token.d.mts.map +1 -0
  26. package/resources/access-token.d.ts +48 -0
  27. package/resources/access-token.d.ts.map +1 -0
  28. package/resources/access-token.js +30 -0
  29. package/resources/access-token.js.map +1 -0
  30. package/resources/access-token.mjs +26 -0
  31. package/resources/access-token.mjs.map +1 -0
  32. package/resources/{cas-parser.d.mts → cams-kfintech.d.mts} +282 -105
  33. package/resources/cams-kfintech.d.mts.map +1 -0
  34. package/resources/{cas-parser.d.ts → cams-kfintech.d.ts} +282 -105
  35. package/resources/cams-kfintech.d.ts.map +1 -0
  36. package/resources/cams-kfintech.js +18 -0
  37. package/resources/cams-kfintech.js.map +1 -0
  38. package/resources/cams-kfintech.mjs +14 -0
  39. package/resources/cams-kfintech.mjs.map +1 -0
  40. package/resources/cdsl/cdsl.d.mts +39 -0
  41. package/resources/cdsl/cdsl.d.mts.map +1 -0
  42. package/resources/cdsl/cdsl.d.ts +39 -0
  43. package/resources/cdsl/cdsl.d.ts.map +1 -0
  44. package/resources/cdsl/cdsl.js +31 -0
  45. package/resources/cdsl/cdsl.js.map +1 -0
  46. package/resources/cdsl/cdsl.mjs +26 -0
  47. package/resources/cdsl/cdsl.mjs.map +1 -0
  48. package/resources/cdsl/fetch.d.mts +91 -0
  49. package/resources/cdsl/fetch.d.mts.map +1 -0
  50. package/resources/cdsl/fetch.d.ts +91 -0
  51. package/resources/cdsl/fetch.d.ts.map +1 -0
  52. package/resources/cdsl/fetch.js +50 -0
  53. package/resources/cdsl/fetch.js.map +1 -0
  54. package/resources/cdsl/fetch.mjs +46 -0
  55. package/resources/cdsl/fetch.mjs.map +1 -0
  56. package/resources/cdsl/index.d.mts +3 -0
  57. package/resources/cdsl/index.d.mts.map +1 -0
  58. package/resources/cdsl/index.d.ts +3 -0
  59. package/resources/cdsl/index.d.ts.map +1 -0
  60. package/resources/cdsl/index.js +9 -0
  61. package/resources/cdsl/index.js.map +1 -0
  62. package/resources/cdsl/index.mjs +4 -0
  63. package/resources/cdsl/index.mjs.map +1 -0
  64. package/resources/cdsl.d.mts +2 -0
  65. package/resources/cdsl.d.mts.map +1 -0
  66. package/resources/cdsl.d.ts +2 -0
  67. package/resources/cdsl.d.ts.map +1 -0
  68. package/resources/cdsl.js +6 -0
  69. package/resources/cdsl.js.map +1 -0
  70. package/resources/cdsl.mjs +3 -0
  71. package/resources/cdsl.mjs.map +1 -0
  72. package/resources/contract-note.d.mts +323 -0
  73. package/resources/contract-note.d.mts.map +1 -0
  74. package/resources/contract-note.d.ts +323 -0
  75. package/resources/contract-note.d.ts.map +1 -0
  76. package/resources/contract-note.js +49 -0
  77. package/resources/contract-note.js.map +1 -0
  78. package/resources/contract-note.mjs +45 -0
  79. package/resources/contract-note.mjs.map +1 -0
  80. package/resources/credits.d.mts +47 -0
  81. package/resources/credits.d.mts.map +1 -0
  82. package/resources/credits.d.ts +47 -0
  83. package/resources/credits.d.ts.map +1 -0
  84. package/resources/credits.js +23 -0
  85. package/resources/credits.js.map +1 -0
  86. package/resources/credits.mjs +19 -0
  87. package/resources/credits.mjs.map +1 -0
  88. package/resources/inbox.d.mts +206 -0
  89. package/resources/inbox.d.mts.map +1 -0
  90. package/resources/inbox.d.ts +206 -0
  91. package/resources/inbox.d.ts.map +1 -0
  92. package/resources/inbox.js +109 -0
  93. package/resources/inbox.js.map +1 -0
  94. package/resources/inbox.mjs +105 -0
  95. package/resources/inbox.mjs.map +1 -0
  96. package/resources/index.d.mts +11 -2
  97. package/resources/index.d.mts.map +1 -1
  98. package/resources/index.d.ts +11 -2
  99. package/resources/index.d.ts.map +1 -1
  100. package/resources/index.js +23 -5
  101. package/resources/index.js.map +1 -1
  102. package/resources/index.mjs +11 -2
  103. package/resources/index.mjs.map +1 -1
  104. package/resources/kfintech.d.mts +53 -0
  105. package/resources/kfintech.d.mts.map +1 -0
  106. package/resources/kfintech.d.ts +53 -0
  107. package/resources/kfintech.d.ts.map +1 -0
  108. package/resources/kfintech.js +29 -0
  109. package/resources/kfintech.js.map +1 -0
  110. package/resources/kfintech.mjs +25 -0
  111. package/resources/kfintech.mjs.map +1 -0
  112. package/resources/logs.d.mts +129 -0
  113. package/resources/logs.d.mts.map +1 -0
  114. package/resources/logs.d.ts +129 -0
  115. package/resources/logs.d.ts.map +1 -0
  116. package/resources/logs.js +37 -0
  117. package/resources/logs.js.map +1 -0
  118. package/resources/logs.mjs +33 -0
  119. package/resources/logs.mjs.map +1 -0
  120. package/resources/nsdl.d.mts +30 -0
  121. package/resources/nsdl.d.mts.map +1 -0
  122. package/resources/nsdl.d.ts +30 -0
  123. package/resources/nsdl.d.ts.map +1 -0
  124. package/resources/nsdl.js +18 -0
  125. package/resources/nsdl.js.map +1 -0
  126. package/resources/nsdl.mjs +14 -0
  127. package/resources/nsdl.mjs.map +1 -0
  128. package/resources/smart.d.mts +31 -0
  129. package/resources/smart.d.mts.map +1 -0
  130. package/resources/smart.d.ts +31 -0
  131. package/resources/smart.d.ts.map +1 -0
  132. package/resources/smart.js +19 -0
  133. package/resources/smart.js.map +1 -0
  134. package/resources/smart.mjs +15 -0
  135. package/resources/smart.mjs.map +1 -0
  136. package/resources/verify-token.d.mts +28 -0
  137. package/resources/verify-token.d.mts.map +1 -0
  138. package/resources/verify-token.d.ts +28 -0
  139. package/resources/verify-token.d.ts.map +1 -0
  140. package/resources/verify-token.js +16 -0
  141. package/resources/verify-token.js.map +1 -0
  142. package/resources/verify-token.mjs +12 -0
  143. package/resources/verify-token.mjs.map +1 -0
  144. package/src/client.ts +143 -31
  145. package/src/internal/parse.ts +6 -0
  146. package/src/internal/to-file.ts +1 -1
  147. package/src/resources/access-token.ts +63 -0
  148. package/src/resources/{cas-parser.ts → cams-kfintech.ts} +340 -130
  149. package/src/resources/cdsl/cdsl.ts +67 -0
  150. package/src/resources/cdsl/fetch.ts +122 -0
  151. package/src/resources/cdsl/index.ts +10 -0
  152. package/src/resources/cdsl.ts +3 -0
  153. package/src/resources/contract-note.ts +402 -0
  154. package/src/resources/credits.ts +58 -0
  155. package/src/resources/inbox.ts +283 -0
  156. package/src/resources/index.ts +31 -11
  157. package/src/resources/kfintech.ts +71 -0
  158. package/src/resources/logs.ts +170 -0
  159. package/src/resources/nsdl.ts +42 -0
  160. package/src/resources/smart.ts +46 -0
  161. package/src/resources/verify-token.ts +36 -0
  162. package/src/version.ts +1 -1
  163. package/version.d.mts +1 -1
  164. package/version.d.ts +1 -1
  165. package/version.js +1 -1
  166. package/version.mjs +1 -1
  167. package/resources/cas-generator.d.mts +0 -56
  168. package/resources/cas-generator.d.mts.map +0 -1
  169. package/resources/cas-generator.d.ts +0 -56
  170. package/resources/cas-generator.d.ts.map +0 -1
  171. package/resources/cas-generator.js +0 -27
  172. package/resources/cas-generator.js.map +0 -1
  173. package/resources/cas-generator.mjs +0 -23
  174. package/resources/cas-generator.mjs.map +0 -1
  175. package/resources/cas-parser.d.mts.map +0 -1
  176. package/resources/cas-parser.d.ts.map +0 -1
  177. package/resources/cas-parser.js +0 -43
  178. package/resources/cas-parser.js.map +0 -1
  179. package/resources/cas-parser.mjs +0 -39
  180. package/resources/cas-parser.mjs.map +0 -1
  181. package/src/resources/cas-generator.ts +0 -75
@@ -0,0 +1,283 @@
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 { buildHeaders } from '../internal/headers';
6
+ import { RequestOptions } from '../internal/request-options';
7
+
8
+ export class Inbox extends APIResource {
9
+ /**
10
+ * Verify if an `inbox_token` is still valid and check connection status.
11
+ *
12
+ * Use this to check if the user needs to re-authenticate (e.g., if they revoked
13
+ * access in their email provider settings).
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const response = await client.inbox.checkConnectionStatus({
18
+ * 'x-inbox-token': 'x-inbox-token',
19
+ * });
20
+ * ```
21
+ */
22
+ checkConnectionStatus(
23
+ params: InboxCheckConnectionStatusParams,
24
+ options?: RequestOptions,
25
+ ): APIPromise<InboxCheckConnectionStatusResponse> {
26
+ const { 'x-inbox-token': xInboxToken } = params;
27
+ return this._client.post('/v4/inbox/status', {
28
+ ...options,
29
+ headers: buildHeaders([{ 'x-inbox-token': xInboxToken }, options?.headers]),
30
+ });
31
+ }
32
+
33
+ /**
34
+ * Initiate OAuth flow to connect user's email inbox.
35
+ *
36
+ * Returns an `oauth_url` that you should redirect the user to. After
37
+ * authorization, they are redirected back to your `redirect_uri` with the
38
+ * following query parameters:
39
+ *
40
+ * **On success:**
41
+ *
42
+ * - `inbox_token` - Encrypted token to store client-side
43
+ * - `email` - Email address of the connected account
44
+ * - `state` - Your original state parameter (for CSRF verification)
45
+ *
46
+ * **On error:**
47
+ *
48
+ * - `error` - Error code (e.g., `access_denied`, `token_exchange_failed`)
49
+ * - `state` - Your original state parameter
50
+ *
51
+ * **Store the `inbox_token` client-side** and use it for all subsequent inbox API
52
+ * calls.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const response = await client.inbox.connectEmail({
57
+ * redirect_uri: 'https://yourapp.com/oauth-callback',
58
+ * });
59
+ * ```
60
+ */
61
+ connectEmail(
62
+ body: InboxConnectEmailParams,
63
+ options?: RequestOptions,
64
+ ): APIPromise<InboxConnectEmailResponse> {
65
+ return this._client.post('/v4/inbox/connect', { body, ...options });
66
+ }
67
+
68
+ /**
69
+ * Revoke email access and invalidate the token.
70
+ *
71
+ * This calls the provider's token revocation API (e.g., Google's revoke endpoint)
72
+ * to ensure the user's consent is properly removed.
73
+ *
74
+ * After calling this, the `inbox_token` becomes unusable.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const response = await client.inbox.disconnectEmail({
79
+ * 'x-inbox-token': 'x-inbox-token',
80
+ * });
81
+ * ```
82
+ */
83
+ disconnectEmail(
84
+ params: InboxDisconnectEmailParams,
85
+ options?: RequestOptions,
86
+ ): APIPromise<InboxDisconnectEmailResponse> {
87
+ const { 'x-inbox-token': xInboxToken } = params;
88
+ return this._client.post('/v4/inbox/disconnect', {
89
+ ...options,
90
+ headers: buildHeaders([{ 'x-inbox-token': xInboxToken }, options?.headers]),
91
+ });
92
+ }
93
+
94
+ /**
95
+ * Search the user's email inbox for CAS files from known senders (CAMS, KFintech,
96
+ * CDSL, NSDL).
97
+ *
98
+ * Files are uploaded to temporary cloud storage. **URLs expire in 24 hours.**
99
+ *
100
+ * Optionally filter by CAS provider and date range.
101
+ *
102
+ * **Billing:** 0.2 credits per request (charged regardless of success or number of
103
+ * files found).
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * const response = await client.inbox.listCasFiles({
108
+ * 'x-inbox-token': 'x-inbox-token',
109
+ * });
110
+ * ```
111
+ */
112
+ listCasFiles(
113
+ params: InboxListCasFilesParams,
114
+ options?: RequestOptions,
115
+ ): APIPromise<InboxListCasFilesResponse> {
116
+ const { 'x-inbox-token': xInboxToken, ...body } = params;
117
+ return this._client.post('/v4/inbox/cas', {
118
+ body,
119
+ ...options,
120
+ headers: buildHeaders([{ 'x-inbox-token': xInboxToken }, options?.headers]),
121
+ });
122
+ }
123
+ }
124
+
125
+ export interface InboxCheckConnectionStatusResponse {
126
+ /**
127
+ * Whether the token is valid and usable
128
+ */
129
+ connected?: boolean;
130
+
131
+ /**
132
+ * Email address of the connected account
133
+ */
134
+ email?: string;
135
+
136
+ provider?: string;
137
+
138
+ status?: string;
139
+ }
140
+
141
+ export interface InboxConnectEmailResponse {
142
+ /**
143
+ * Seconds until the OAuth URL expires (typically 10 minutes)
144
+ */
145
+ expires_in?: number;
146
+
147
+ /**
148
+ * Redirect user to this URL to start OAuth flow
149
+ */
150
+ oauth_url?: string;
151
+
152
+ status?: string;
153
+ }
154
+
155
+ export interface InboxDisconnectEmailResponse {
156
+ msg?: string;
157
+
158
+ status?: string;
159
+ }
160
+
161
+ export interface InboxListCasFilesResponse {
162
+ /**
163
+ * Number of CAS files found
164
+ */
165
+ count?: number;
166
+
167
+ files?: Array<InboxListCasFilesResponse.File>;
168
+
169
+ status?: string;
170
+ }
171
+
172
+ export namespace InboxListCasFilesResponse {
173
+ /**
174
+ * A CAS file found in the user's email inbox
175
+ */
176
+ export interface File {
177
+ /**
178
+ * Detected CAS provider based on sender email
179
+ */
180
+ cas_type?: 'cdsl' | 'nsdl' | 'cams' | 'kfintech';
181
+
182
+ /**
183
+ * URL expiration time in seconds (default 86400 = 24 hours)
184
+ */
185
+ expires_in?: number;
186
+
187
+ /**
188
+ * Standardized filename (provider_YYYYMMDD_uniqueid.pdf)
189
+ */
190
+ filename?: string;
191
+
192
+ /**
193
+ * Date the email was received
194
+ */
195
+ message_date?: string;
196
+
197
+ /**
198
+ * Unique identifier for the email message (use for subsequent API calls)
199
+ */
200
+ message_id?: string;
201
+
202
+ /**
203
+ * Original attachment filename from the email
204
+ */
205
+ original_filename?: string;
206
+
207
+ /**
208
+ * File size in bytes
209
+ */
210
+ size?: number;
211
+
212
+ /**
213
+ * Direct download URL (presigned, expires based on expires_in)
214
+ */
215
+ url?: string;
216
+ }
217
+ }
218
+
219
+ export interface InboxCheckConnectionStatusParams {
220
+ /**
221
+ * The encrypted inbox token
222
+ */
223
+ 'x-inbox-token': string;
224
+ }
225
+
226
+ export interface InboxConnectEmailParams {
227
+ /**
228
+ * Your callback URL to receive the inbox_token (must be http or https)
229
+ */
230
+ redirect_uri: string;
231
+
232
+ /**
233
+ * State parameter for CSRF protection (returned in redirect)
234
+ */
235
+ state?: string;
236
+ }
237
+
238
+ export interface InboxDisconnectEmailParams {
239
+ /**
240
+ * The encrypted inbox token to revoke
241
+ */
242
+ 'x-inbox-token': string;
243
+ }
244
+
245
+ export interface InboxListCasFilesParams {
246
+ /**
247
+ * Header param: The encrypted inbox token
248
+ */
249
+ 'x-inbox-token': string;
250
+
251
+ /**
252
+ * Body param: Filter by CAS provider(s):
253
+ *
254
+ * - `cdsl` → eCAS@cdslstatement.com
255
+ * - `nsdl` → NSDL-CAS@nsdl.co.in
256
+ * - `cams` → donotreply@camsonline.com
257
+ * - `kfintech` → samfS@kfintech.com
258
+ */
259
+ cas_types?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
260
+
261
+ /**
262
+ * Body param: End date in ISO format (YYYY-MM-DD). Defaults to today.
263
+ */
264
+ end_date?: string;
265
+
266
+ /**
267
+ * Body param: Start date in ISO format (YYYY-MM-DD). Defaults to 30 days ago.
268
+ */
269
+ start_date?: string;
270
+ }
271
+
272
+ export declare namespace Inbox {
273
+ export {
274
+ type InboxCheckConnectionStatusResponse as InboxCheckConnectionStatusResponse,
275
+ type InboxConnectEmailResponse as InboxConnectEmailResponse,
276
+ type InboxDisconnectEmailResponse as InboxDisconnectEmailResponse,
277
+ type InboxListCasFilesResponse as InboxListCasFilesResponse,
278
+ type InboxCheckConnectionStatusParams as InboxCheckConnectionStatusParams,
279
+ type InboxConnectEmailParams as InboxConnectEmailParams,
280
+ type InboxDisconnectEmailParams as InboxDisconnectEmailParams,
281
+ type InboxListCasFilesParams as InboxListCasFilesParams,
282
+ };
283
+ }
@@ -1,15 +1,35 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export { AccessToken, type AccessTokenCreateResponse, type AccessTokenCreateParams } from './access-token';
3
4
  export {
4
- CasGenerator,
5
- type CasGeneratorGenerateCasResponse,
6
- type CasGeneratorGenerateCasParams,
7
- } from './cas-generator';
8
- export {
9
- CasParserResource,
5
+ CamsKfintech,
6
+ type LinkedHolder,
7
+ type Transaction,
10
8
  type UnifiedResponse,
11
- type CasParserCamsKfintechParams,
12
- type CasParserCdslParams,
13
- type CasParserNsdlParams,
14
- type CasParserSmartParseParams,
15
- } from './cas-parser';
9
+ type CamsKfintechParseParams,
10
+ } from './cams-kfintech';
11
+ export { Cdsl, type CdslParsePdfParams } from './cdsl/cdsl';
12
+ export { ContractNote, type ContractNoteParseResponse, type ContractNoteParseParams } from './contract-note';
13
+ export { Credits, type CreditCheckResponse } from './credits';
14
+ export {
15
+ Inbox,
16
+ type InboxCheckConnectionStatusResponse,
17
+ type InboxConnectEmailResponse,
18
+ type InboxDisconnectEmailResponse,
19
+ type InboxListCasFilesResponse,
20
+ type InboxCheckConnectionStatusParams,
21
+ type InboxConnectEmailParams,
22
+ type InboxDisconnectEmailParams,
23
+ type InboxListCasFilesParams,
24
+ } from './inbox';
25
+ export { Kfintech, type KfintechGenerateCasResponse, type KfintechGenerateCasParams } from './kfintech';
26
+ export {
27
+ Logs,
28
+ type LogCreateResponse,
29
+ type LogGetSummaryResponse,
30
+ type LogCreateParams,
31
+ type LogGetSummaryParams,
32
+ } from './logs';
33
+ export { Nsdl, type NsdlParseParams } from './nsdl';
34
+ export { Smart, type SmartParseCasPdfParams } from './smart';
35
+ export { VerifyToken, type VerifyTokenVerifyResponse } from './verify-token';
@@ -0,0 +1,71 @@
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
+
7
+ export class Kfintech extends APIResource {
8
+ /**
9
+ * Generate CAS via KFintech mailback. The CAS PDF will be sent to the investor's
10
+ * email.
11
+ *
12
+ * This is an async operation - the investor receives the CAS via email within a
13
+ * few minutes. For instant CAS retrieval, use CDSL Fetch (`/v4/cdsl/fetch`).
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const response = await client.kfintech.generateCas({
18
+ * email: 'user@example.com',
19
+ * from_date: '2023-01-01',
20
+ * password: 'Abcdefghi12$',
21
+ * to_date: '2023-12-31',
22
+ * });
23
+ * ```
24
+ */
25
+ generateCas(
26
+ body: KfintechGenerateCasParams,
27
+ options?: RequestOptions,
28
+ ): APIPromise<KfintechGenerateCasResponse> {
29
+ return this._client.post('/v4/kfintech/generate', { body, ...options });
30
+ }
31
+ }
32
+
33
+ export interface KfintechGenerateCasResponse {
34
+ msg?: string;
35
+
36
+ status?: string;
37
+ }
38
+
39
+ export interface KfintechGenerateCasParams {
40
+ /**
41
+ * Email address to receive the CAS document
42
+ */
43
+ email: string;
44
+
45
+ /**
46
+ * Start date (YYYY-MM-DD)
47
+ */
48
+ from_date: string;
49
+
50
+ /**
51
+ * Password for the PDF
52
+ */
53
+ password: string;
54
+
55
+ /**
56
+ * End date (YYYY-MM-DD)
57
+ */
58
+ to_date: string;
59
+
60
+ /**
61
+ * PAN number (optional)
62
+ */
63
+ pan_no?: string;
64
+ }
65
+
66
+ export declare namespace Kfintech {
67
+ export {
68
+ type KfintechGenerateCasResponse as KfintechGenerateCasResponse,
69
+ type KfintechGenerateCasParams as KfintechGenerateCasParams,
70
+ };
71
+ }
@@ -0,0 +1,170 @@
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
+
7
+ export class Logs extends APIResource {
8
+ /**
9
+ * Retrieve detailed API usage logs for your account.
10
+ *
11
+ * Returns a list of API calls with timestamps, features used, status codes, and
12
+ * credits consumed. Useful for monitoring usage patterns and debugging.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const log = await client.logs.create();
17
+ * ```
18
+ */
19
+ create(
20
+ body: LogCreateParams | null | undefined = {},
21
+ options?: RequestOptions,
22
+ ): APIPromise<LogCreateResponse> {
23
+ return this._client.post('/logs', { body, ...options });
24
+ }
25
+
26
+ /**
27
+ * Get aggregated usage statistics grouped by feature.
28
+ *
29
+ * Useful for understanding which API features are being used most and tracking
30
+ * usage trends.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const response = await client.logs.getSummary();
35
+ * ```
36
+ */
37
+ getSummary(
38
+ body: LogGetSummaryParams | null | undefined = {},
39
+ options?: RequestOptions,
40
+ ): APIPromise<LogGetSummaryResponse> {
41
+ return this._client.post('/logs/summary', { body, ...options });
42
+ }
43
+ }
44
+
45
+ export interface LogCreateResponse {
46
+ /**
47
+ * Number of logs returned
48
+ */
49
+ count?: number;
50
+
51
+ logs?: Array<LogCreateResponse.Log>;
52
+
53
+ status?: string;
54
+ }
55
+
56
+ export namespace LogCreateResponse {
57
+ export interface Log {
58
+ /**
59
+ * Credits consumed for this request
60
+ */
61
+ credits?: number;
62
+
63
+ /**
64
+ * API feature used
65
+ */
66
+ feature?: string;
67
+
68
+ /**
69
+ * API endpoint path
70
+ */
71
+ path?: string;
72
+
73
+ /**
74
+ * Unique request identifier
75
+ */
76
+ request_id?: string;
77
+
78
+ /**
79
+ * HTTP response status code
80
+ */
81
+ status_code?: number;
82
+
83
+ /**
84
+ * When the request was made
85
+ */
86
+ timestamp?: string;
87
+ }
88
+ }
89
+
90
+ export interface LogGetSummaryResponse {
91
+ status?: string;
92
+
93
+ summary?: LogGetSummaryResponse.Summary;
94
+ }
95
+
96
+ export namespace LogGetSummaryResponse {
97
+ export interface Summary {
98
+ /**
99
+ * Usage breakdown by feature
100
+ */
101
+ by_feature?: Array<Summary.ByFeature>;
102
+
103
+ /**
104
+ * Total credits consumed in the period
105
+ */
106
+ total_credits?: number;
107
+
108
+ /**
109
+ * Total API requests made in the period
110
+ */
111
+ total_requests?: number;
112
+ }
113
+
114
+ export namespace Summary {
115
+ export interface ByFeature {
116
+ /**
117
+ * Credits consumed by this feature
118
+ */
119
+ credits?: number;
120
+
121
+ /**
122
+ * API feature name
123
+ */
124
+ feature?: string;
125
+
126
+ /**
127
+ * Number of requests for this feature
128
+ */
129
+ requests?: number;
130
+ }
131
+ }
132
+ }
133
+
134
+ export interface LogCreateParams {
135
+ /**
136
+ * End time filter (ISO 8601). Defaults to now.
137
+ */
138
+ end_time?: string;
139
+
140
+ /**
141
+ * Maximum number of logs to return
142
+ */
143
+ limit?: number;
144
+
145
+ /**
146
+ * Start time filter (ISO 8601). Defaults to 30 days ago.
147
+ */
148
+ start_time?: string;
149
+ }
150
+
151
+ export interface LogGetSummaryParams {
152
+ /**
153
+ * End time filter (ISO 8601). Defaults to now.
154
+ */
155
+ end_time?: string;
156
+
157
+ /**
158
+ * Start time filter (ISO 8601). Defaults to start of current month.
159
+ */
160
+ start_time?: string;
161
+ }
162
+
163
+ export declare namespace Logs {
164
+ export {
165
+ type LogCreateResponse as LogCreateResponse,
166
+ type LogGetSummaryResponse as LogGetSummaryResponse,
167
+ type LogCreateParams as LogCreateParams,
168
+ type LogGetSummaryParams as LogGetSummaryParams,
169
+ };
170
+ }
@@ -0,0 +1,42 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as CamsKfintechAPI from './cams-kfintech';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { maybeMultipartFormRequestOptions } from '../internal/uploads';
8
+
9
+ export class Nsdl extends APIResource {
10
+ /**
11
+ * This endpoint specifically parses NSDL CAS (Consolidated Account Statement) PDF
12
+ * files and returns data in a unified format. Use this endpoint when you know the
13
+ * PDF is from NSDL.
14
+ */
15
+ parse(body: NsdlParseParams, options?: RequestOptions): APIPromise<CamsKfintechAPI.UnifiedResponse> {
16
+ return this._client.post(
17
+ '/v4/nsdl/parse',
18
+ maybeMultipartFormRequestOptions({ body, ...options }, this._client),
19
+ );
20
+ }
21
+ }
22
+
23
+ export interface NsdlParseParams {
24
+ /**
25
+ * Password for the PDF file (if required)
26
+ */
27
+ password?: string;
28
+
29
+ /**
30
+ * Base64 encoded CAS PDF file (required if pdf_url not provided)
31
+ */
32
+ pdf_file?: string;
33
+
34
+ /**
35
+ * URL to the CAS PDF file (required if pdf_file not provided)
36
+ */
37
+ pdf_url?: string;
38
+ }
39
+
40
+ export declare namespace Nsdl {
41
+ export { type NsdlParseParams as NsdlParseParams };
42
+ }
@@ -0,0 +1,46 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as CamsKfintechAPI from './cams-kfintech';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { maybeMultipartFormRequestOptions } from '../internal/uploads';
8
+
9
+ export class Smart extends APIResource {
10
+ /**
11
+ * This endpoint parses CAS (Consolidated Account Statement) PDF files from NSDL,
12
+ * CDSL, or CAMS/KFintech and returns data in a unified format. It auto-detects the
13
+ * CAS type and transforms the data into a consistent structure regardless of the
14
+ * source.
15
+ */
16
+ parseCasPdf(
17
+ body: SmartParseCasPdfParams,
18
+ options?: RequestOptions,
19
+ ): APIPromise<CamsKfintechAPI.UnifiedResponse> {
20
+ return this._client.post(
21
+ '/v4/smart/parse',
22
+ maybeMultipartFormRequestOptions({ body, ...options }, this._client),
23
+ );
24
+ }
25
+ }
26
+
27
+ export interface SmartParseCasPdfParams {
28
+ /**
29
+ * Password for the PDF file (if required)
30
+ */
31
+ password?: string;
32
+
33
+ /**
34
+ * Base64 encoded CAS PDF file (required if pdf_url not provided)
35
+ */
36
+ pdf_file?: string;
37
+
38
+ /**
39
+ * URL to the CAS PDF file (required if pdf_file not provided)
40
+ */
41
+ pdf_url?: string;
42
+ }
43
+
44
+ export declare namespace Smart {
45
+ export { type SmartParseCasPdfParams as SmartParseCasPdfParams };
46
+ }
@@ -0,0 +1,36 @@
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
+
7
+ export class VerifyToken extends APIResource {
8
+ /**
9
+ * Verify an access token and check if it's still valid. Useful for debugging token
10
+ * issues.
11
+ */
12
+ verify(options?: RequestOptions): APIPromise<VerifyTokenVerifyResponse> {
13
+ return this._client.post('/v1/verify-token', options);
14
+ }
15
+ }
16
+
17
+ export interface VerifyTokenVerifyResponse {
18
+ /**
19
+ * Error message (only shown if invalid)
20
+ */
21
+ error?: string;
22
+
23
+ /**
24
+ * Masked API key (only shown if valid)
25
+ */
26
+ masked_api_key?: string;
27
+
28
+ /**
29
+ * Whether the token is valid
30
+ */
31
+ valid?: boolean;
32
+ }
33
+
34
+ export declare namespace VerifyToken {
35
+ export { type VerifyTokenVerifyResponse as VerifyTokenVerifyResponse };
36
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.4.1'; // x-release-please-version
1
+ export const VERSION = '1.6.2'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.4.1";
1
+ export declare const VERSION = "1.6.2";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.4.1";
1
+ export declare const VERSION = "1.6.2";
2
2
  //# sourceMappingURL=version.d.ts.map