cas-parser-node 1.4.1 → 1.7.1

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 +128 -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,49 @@
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.ContractNote = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const uploads_1 = require("../internal/uploads.js");
7
+ class ContractNote extends resource_1.APIResource {
8
+ /**
9
+ * This endpoint parses Contract Note PDF files from various brokers including
10
+ * Zerodha, Groww, Upstox, ICICI Securities, and others.
11
+ *
12
+ * **What is a Contract Note?** A contract note is a legal document that provides
13
+ * details of all trades executed by an investor. It includes:
14
+ *
15
+ * - Trade details with timestamps, quantities, and prices
16
+ * - Brokerage and charges breakdown
17
+ * - Settlement information
18
+ * - Regulatory compliance details
19
+ *
20
+ * **Supported Brokers:**
21
+ *
22
+ * - Zerodha Broking Limited
23
+ * - Groww Invest Tech Private Limited
24
+ * - Upstox (RKSV Securities)
25
+ * - ICICI Securities Limited
26
+ * - Auto-detection for unknown brokers
27
+ *
28
+ * **Key Features:**
29
+ *
30
+ * - **Auto-detection**: Automatically identifies broker type from PDF content
31
+ * - **Comprehensive parsing**: Extracts equity transactions, derivatives
32
+ * transactions, detailed trades, and charges
33
+ * - **Flexible input**: Accepts both file upload and URL-based PDF input
34
+ * - **Password protection**: Supports password-protected PDFs
35
+ *
36
+ * The API returns structured data including contract note information, client
37
+ * details, transaction summaries, and detailed trade-by-trade breakdowns.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const response = await client.contractNote.parse();
42
+ * ```
43
+ */
44
+ parse(body, options) {
45
+ return this._client.post('/v4/contract_note/parse', (0, uploads_1.maybeMultipartFormRequestOptions)({ body, ...options }, this._client));
46
+ }
47
+ }
48
+ exports.ContractNote = ContractNote;
49
+ //# sourceMappingURL=contract-note.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-note.js","sourceRoot":"","sources":["../src/resources/contract-note.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAuE;AAEvE,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,KAAK,CAAC,IAA6B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,yBAAyB,EACzB,IAAA,0CAAgC,EAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CACrE,CAAC;IACJ,CAAC;CACF;AA3CD,oCA2CC"}
@@ -0,0 +1,45 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { maybeMultipartFormRequestOptions } from "../internal/uploads.mjs";
4
+ export class ContractNote extends APIResource {
5
+ /**
6
+ * This endpoint parses Contract Note PDF files from various brokers including
7
+ * Zerodha, Groww, Upstox, ICICI Securities, and others.
8
+ *
9
+ * **What is a Contract Note?** A contract note is a legal document that provides
10
+ * details of all trades executed by an investor. It includes:
11
+ *
12
+ * - Trade details with timestamps, quantities, and prices
13
+ * - Brokerage and charges breakdown
14
+ * - Settlement information
15
+ * - Regulatory compliance details
16
+ *
17
+ * **Supported Brokers:**
18
+ *
19
+ * - Zerodha Broking Limited
20
+ * - Groww Invest Tech Private Limited
21
+ * - Upstox (RKSV Securities)
22
+ * - ICICI Securities Limited
23
+ * - Auto-detection for unknown brokers
24
+ *
25
+ * **Key Features:**
26
+ *
27
+ * - **Auto-detection**: Automatically identifies broker type from PDF content
28
+ * - **Comprehensive parsing**: Extracts equity transactions, derivatives
29
+ * transactions, detailed trades, and charges
30
+ * - **Flexible input**: Accepts both file upload and URL-based PDF input
31
+ * - **Password protection**: Supports password-protected PDFs
32
+ *
33
+ * The API returns structured data including contract note information, client
34
+ * details, transaction summaries, and detailed trade-by-trade breakdowns.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const response = await client.contractNote.parse();
39
+ * ```
40
+ */
41
+ parse(body, options) {
42
+ return this._client.post('/v4/contract_note/parse', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
43
+ }
44
+ }
45
+ //# sourceMappingURL=contract-note.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-note.mjs","sourceRoot":"","sources":["../src/resources/contract-note.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,gCAAgC,EAAE;AAE3C,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,KAAK,CAAC,IAA6B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,yBAAyB,EACzB,gCAAgC,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CACrE,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,47 @@
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 Credits extends APIResource {
5
+ /**
6
+ * Check your remaining API credits and usage for the current billing period.
7
+ *
8
+ * Returns:
9
+ *
10
+ * - Number of API calls used and remaining credits
11
+ * - Credit limit and reset date
12
+ * - List of enabled features for your plan
13
+ *
14
+ * Credits reset at the start of each billing period.
15
+ */
16
+ check(options?: RequestOptions): APIPromise<CreditCheckResponse>;
17
+ }
18
+ export interface CreditCheckResponse {
19
+ /**
20
+ * List of API features enabled for your plan
21
+ */
22
+ enabled_features?: Array<string>;
23
+ /**
24
+ * Whether the account has unlimited credits
25
+ */
26
+ is_unlimited?: boolean;
27
+ /**
28
+ * Total credit limit for billing period
29
+ */
30
+ limit?: number;
31
+ /**
32
+ * Remaining credits (null if unlimited)
33
+ */
34
+ remaining?: number | null;
35
+ /**
36
+ * When credits reset (ISO 8601)
37
+ */
38
+ resets_at?: string | null;
39
+ /**
40
+ * Number of credits used this billing period
41
+ */
42
+ used?: number;
43
+ }
44
+ export declare namespace Credits {
45
+ export { type CreditCheckResponse as CreditCheckResponse };
46
+ }
47
+ //# sourceMappingURL=credits.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credits.d.mts","sourceRoot":"","sources":["../src/resources/credits.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAGjE;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEjC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAC5D"}
@@ -0,0 +1,47 @@
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 Credits extends APIResource {
5
+ /**
6
+ * Check your remaining API credits and usage for the current billing period.
7
+ *
8
+ * Returns:
9
+ *
10
+ * - Number of API calls used and remaining credits
11
+ * - Credit limit and reset date
12
+ * - List of enabled features for your plan
13
+ *
14
+ * Credits reset at the start of each billing period.
15
+ */
16
+ check(options?: RequestOptions): APIPromise<CreditCheckResponse>;
17
+ }
18
+ export interface CreditCheckResponse {
19
+ /**
20
+ * List of API features enabled for your plan
21
+ */
22
+ enabled_features?: Array<string>;
23
+ /**
24
+ * Whether the account has unlimited credits
25
+ */
26
+ is_unlimited?: boolean;
27
+ /**
28
+ * Total credit limit for billing period
29
+ */
30
+ limit?: number;
31
+ /**
32
+ * Remaining credits (null if unlimited)
33
+ */
34
+ remaining?: number | null;
35
+ /**
36
+ * When credits reset (ISO 8601)
37
+ */
38
+ resets_at?: string | null;
39
+ /**
40
+ * Number of credits used this billing period
41
+ */
42
+ used?: number;
43
+ }
44
+ export declare namespace Credits {
45
+ export { type CreditCheckResponse as CreditCheckResponse };
46
+ }
47
+ //# sourceMappingURL=credits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credits.d.ts","sourceRoot":"","sources":["../src/resources/credits.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAGjE;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEjC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAC5D"}
@@ -0,0 +1,23 @@
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.Credits = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ class Credits extends resource_1.APIResource {
7
+ /**
8
+ * Check your remaining API credits and usage for the current billing period.
9
+ *
10
+ * Returns:
11
+ *
12
+ * - Number of API calls used and remaining credits
13
+ * - Credit limit and reset date
14
+ * - List of enabled features for your plan
15
+ *
16
+ * Credits reset at the start of each billing period.
17
+ */
18
+ check(options) {
19
+ return this._client.post('/credits', options);
20
+ }
21
+ }
22
+ exports.Credits = Credits;
23
+ //# sourceMappingURL=credits.js.map
@@ -0,0 +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"}
@@ -0,0 +1,19 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ export class Credits extends APIResource {
4
+ /**
5
+ * Check your remaining API credits and usage for the current billing period.
6
+ *
7
+ * Returns:
8
+ *
9
+ * - Number of API calls used and remaining credits
10
+ * - Credit limit and reset date
11
+ * - List of enabled features for your plan
12
+ *
13
+ * Credits reset at the start of each billing period.
14
+ */
15
+ check(options) {
16
+ return this._client.post('/credits', options);
17
+ }
18
+ }
19
+ //# sourceMappingURL=credits.mjs.map
@@ -0,0 +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"}
@@ -0,0 +1,206 @@
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 Inbox extends APIResource {
5
+ /**
6
+ * Verify if an `inbox_token` is still valid and check connection status.
7
+ *
8
+ * Use this to check if the user needs to re-authenticate (e.g., if they revoked
9
+ * access in their email provider settings).
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const response = await client.inbox.checkConnectionStatus({
14
+ * 'x-inbox-token': 'x-inbox-token',
15
+ * });
16
+ * ```
17
+ */
18
+ checkConnectionStatus(params: InboxCheckConnectionStatusParams, options?: RequestOptions): APIPromise<InboxCheckConnectionStatusResponse>;
19
+ /**
20
+ * Initiate OAuth flow to connect user's email inbox.
21
+ *
22
+ * Returns an `oauth_url` that you should redirect the user to. After
23
+ * authorization, they are redirected back to your `redirect_uri` with the
24
+ * following query parameters:
25
+ *
26
+ * **On success:**
27
+ *
28
+ * - `inbox_token` - Encrypted token to store client-side
29
+ * - `email` - Email address of the connected account
30
+ * - `state` - Your original state parameter (for CSRF verification)
31
+ *
32
+ * **On error:**
33
+ *
34
+ * - `error` - Error code (e.g., `access_denied`, `token_exchange_failed`)
35
+ * - `state` - Your original state parameter
36
+ *
37
+ * **Store the `inbox_token` client-side** and use it for all subsequent inbox API
38
+ * calls.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const response = await client.inbox.connectEmail({
43
+ * redirect_uri: 'https://yourapp.com/oauth-callback',
44
+ * });
45
+ * ```
46
+ */
47
+ connectEmail(body: InboxConnectEmailParams, options?: RequestOptions): APIPromise<InboxConnectEmailResponse>;
48
+ /**
49
+ * Revoke email access and invalidate the token.
50
+ *
51
+ * This calls the provider's token revocation API (e.g., Google's revoke endpoint)
52
+ * to ensure the user's consent is properly removed.
53
+ *
54
+ * After calling this, the `inbox_token` becomes unusable.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const response = await client.inbox.disconnectEmail({
59
+ * 'x-inbox-token': 'x-inbox-token',
60
+ * });
61
+ * ```
62
+ */
63
+ disconnectEmail(params: InboxDisconnectEmailParams, options?: RequestOptions): APIPromise<InboxDisconnectEmailResponse>;
64
+ /**
65
+ * Search the user's email inbox for CAS files from known senders (CAMS, KFintech,
66
+ * CDSL, NSDL).
67
+ *
68
+ * Files are uploaded to temporary cloud storage. **URLs expire in 24 hours.**
69
+ *
70
+ * Optionally filter by CAS provider and date range.
71
+ *
72
+ * **Billing:** 0.2 credits per request (charged regardless of success or number of
73
+ * files found).
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const response = await client.inbox.listCasFiles({
78
+ * 'x-inbox-token': 'x-inbox-token',
79
+ * });
80
+ * ```
81
+ */
82
+ listCasFiles(params: InboxListCasFilesParams, options?: RequestOptions): APIPromise<InboxListCasFilesResponse>;
83
+ }
84
+ export interface InboxCheckConnectionStatusResponse {
85
+ /**
86
+ * Whether the token is valid and usable
87
+ */
88
+ connected?: boolean;
89
+ /**
90
+ * Email address of the connected account
91
+ */
92
+ email?: string;
93
+ provider?: string;
94
+ status?: string;
95
+ }
96
+ export interface InboxConnectEmailResponse {
97
+ /**
98
+ * Seconds until the OAuth URL expires (typically 10 minutes)
99
+ */
100
+ expires_in?: number;
101
+ /**
102
+ * Redirect user to this URL to start OAuth flow
103
+ */
104
+ oauth_url?: string;
105
+ status?: string;
106
+ }
107
+ export interface InboxDisconnectEmailResponse {
108
+ msg?: string;
109
+ status?: string;
110
+ }
111
+ export interface InboxListCasFilesResponse {
112
+ /**
113
+ * Number of CAS files found
114
+ */
115
+ count?: number;
116
+ files?: Array<InboxListCasFilesResponse.File>;
117
+ status?: string;
118
+ }
119
+ export declare namespace InboxListCasFilesResponse {
120
+ /**
121
+ * A CAS file found in the user's email inbox
122
+ */
123
+ interface File {
124
+ /**
125
+ * Detected CAS provider based on sender email
126
+ */
127
+ cas_type?: 'cdsl' | 'nsdl' | 'cams' | 'kfintech';
128
+ /**
129
+ * URL expiration time in seconds (default 86400 = 24 hours)
130
+ */
131
+ expires_in?: number;
132
+ /**
133
+ * Standardized filename (provider_YYYYMMDD_uniqueid.pdf)
134
+ */
135
+ filename?: string;
136
+ /**
137
+ * Date the email was received
138
+ */
139
+ message_date?: string;
140
+ /**
141
+ * Unique identifier for the email message (use for subsequent API calls)
142
+ */
143
+ message_id?: string;
144
+ /**
145
+ * Original attachment filename from the email
146
+ */
147
+ original_filename?: string;
148
+ /**
149
+ * File size in bytes
150
+ */
151
+ size?: number;
152
+ /**
153
+ * Direct download URL (presigned, expires based on expires_in)
154
+ */
155
+ url?: string;
156
+ }
157
+ }
158
+ export interface InboxCheckConnectionStatusParams {
159
+ /**
160
+ * The encrypted inbox token
161
+ */
162
+ 'x-inbox-token': string;
163
+ }
164
+ export interface InboxConnectEmailParams {
165
+ /**
166
+ * Your callback URL to receive the inbox_token (must be http or https)
167
+ */
168
+ redirect_uri: string;
169
+ /**
170
+ * State parameter for CSRF protection (returned in redirect)
171
+ */
172
+ state?: string;
173
+ }
174
+ export interface InboxDisconnectEmailParams {
175
+ /**
176
+ * The encrypted inbox token to revoke
177
+ */
178
+ 'x-inbox-token': string;
179
+ }
180
+ export interface InboxListCasFilesParams {
181
+ /**
182
+ * Header param: The encrypted inbox token
183
+ */
184
+ 'x-inbox-token': string;
185
+ /**
186
+ * Body param: Filter by CAS provider(s):
187
+ *
188
+ * - `cdsl` → eCAS@cdslstatement.com
189
+ * - `nsdl` → NSDL-CAS@nsdl.co.in
190
+ * - `cams` → donotreply@camsonline.com
191
+ * - `kfintech` → samfS@kfintech.com
192
+ */
193
+ cas_types?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
194
+ /**
195
+ * Body param: End date in ISO format (YYYY-MM-DD). Defaults to today.
196
+ */
197
+ end_date?: string;
198
+ /**
199
+ * Body param: Start date in ISO format (YYYY-MM-DD). Defaults to 30 days ago.
200
+ */
201
+ start_date?: string;
202
+ }
203
+ export declare namespace Inbox {
204
+ export { type InboxCheckConnectionStatusResponse as InboxCheckConnectionStatusResponse, type InboxConnectEmailResponse as InboxConnectEmailResponse, type InboxDisconnectEmailResponse as InboxDisconnectEmailResponse, type InboxListCasFilesResponse as InboxListCasFilesResponse, type InboxCheckConnectionStatusParams as InboxCheckConnectionStatusParams, type InboxConnectEmailParams as InboxConnectEmailParams, type InboxDisconnectEmailParams as InboxDisconnectEmailParams, type InboxListCasFilesParams as InboxListCasFilesParams, };
205
+ }
206
+ //# sourceMappingURL=inbox.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox.d.mts","sourceRoot":"","sources":["../src/resources/inbox.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,206 @@
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 Inbox extends APIResource {
5
+ /**
6
+ * Verify if an `inbox_token` is still valid and check connection status.
7
+ *
8
+ * Use this to check if the user needs to re-authenticate (e.g., if they revoked
9
+ * access in their email provider settings).
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const response = await client.inbox.checkConnectionStatus({
14
+ * 'x-inbox-token': 'x-inbox-token',
15
+ * });
16
+ * ```
17
+ */
18
+ checkConnectionStatus(params: InboxCheckConnectionStatusParams, options?: RequestOptions): APIPromise<InboxCheckConnectionStatusResponse>;
19
+ /**
20
+ * Initiate OAuth flow to connect user's email inbox.
21
+ *
22
+ * Returns an `oauth_url` that you should redirect the user to. After
23
+ * authorization, they are redirected back to your `redirect_uri` with the
24
+ * following query parameters:
25
+ *
26
+ * **On success:**
27
+ *
28
+ * - `inbox_token` - Encrypted token to store client-side
29
+ * - `email` - Email address of the connected account
30
+ * - `state` - Your original state parameter (for CSRF verification)
31
+ *
32
+ * **On error:**
33
+ *
34
+ * - `error` - Error code (e.g., `access_denied`, `token_exchange_failed`)
35
+ * - `state` - Your original state parameter
36
+ *
37
+ * **Store the `inbox_token` client-side** and use it for all subsequent inbox API
38
+ * calls.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const response = await client.inbox.connectEmail({
43
+ * redirect_uri: 'https://yourapp.com/oauth-callback',
44
+ * });
45
+ * ```
46
+ */
47
+ connectEmail(body: InboxConnectEmailParams, options?: RequestOptions): APIPromise<InboxConnectEmailResponse>;
48
+ /**
49
+ * Revoke email access and invalidate the token.
50
+ *
51
+ * This calls the provider's token revocation API (e.g., Google's revoke endpoint)
52
+ * to ensure the user's consent is properly removed.
53
+ *
54
+ * After calling this, the `inbox_token` becomes unusable.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const response = await client.inbox.disconnectEmail({
59
+ * 'x-inbox-token': 'x-inbox-token',
60
+ * });
61
+ * ```
62
+ */
63
+ disconnectEmail(params: InboxDisconnectEmailParams, options?: RequestOptions): APIPromise<InboxDisconnectEmailResponse>;
64
+ /**
65
+ * Search the user's email inbox for CAS files from known senders (CAMS, KFintech,
66
+ * CDSL, NSDL).
67
+ *
68
+ * Files are uploaded to temporary cloud storage. **URLs expire in 24 hours.**
69
+ *
70
+ * Optionally filter by CAS provider and date range.
71
+ *
72
+ * **Billing:** 0.2 credits per request (charged regardless of success or number of
73
+ * files found).
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const response = await client.inbox.listCasFiles({
78
+ * 'x-inbox-token': 'x-inbox-token',
79
+ * });
80
+ * ```
81
+ */
82
+ listCasFiles(params: InboxListCasFilesParams, options?: RequestOptions): APIPromise<InboxListCasFilesResponse>;
83
+ }
84
+ export interface InboxCheckConnectionStatusResponse {
85
+ /**
86
+ * Whether the token is valid and usable
87
+ */
88
+ connected?: boolean;
89
+ /**
90
+ * Email address of the connected account
91
+ */
92
+ email?: string;
93
+ provider?: string;
94
+ status?: string;
95
+ }
96
+ export interface InboxConnectEmailResponse {
97
+ /**
98
+ * Seconds until the OAuth URL expires (typically 10 minutes)
99
+ */
100
+ expires_in?: number;
101
+ /**
102
+ * Redirect user to this URL to start OAuth flow
103
+ */
104
+ oauth_url?: string;
105
+ status?: string;
106
+ }
107
+ export interface InboxDisconnectEmailResponse {
108
+ msg?: string;
109
+ status?: string;
110
+ }
111
+ export interface InboxListCasFilesResponse {
112
+ /**
113
+ * Number of CAS files found
114
+ */
115
+ count?: number;
116
+ files?: Array<InboxListCasFilesResponse.File>;
117
+ status?: string;
118
+ }
119
+ export declare namespace InboxListCasFilesResponse {
120
+ /**
121
+ * A CAS file found in the user's email inbox
122
+ */
123
+ interface File {
124
+ /**
125
+ * Detected CAS provider based on sender email
126
+ */
127
+ cas_type?: 'cdsl' | 'nsdl' | 'cams' | 'kfintech';
128
+ /**
129
+ * URL expiration time in seconds (default 86400 = 24 hours)
130
+ */
131
+ expires_in?: number;
132
+ /**
133
+ * Standardized filename (provider_YYYYMMDD_uniqueid.pdf)
134
+ */
135
+ filename?: string;
136
+ /**
137
+ * Date the email was received
138
+ */
139
+ message_date?: string;
140
+ /**
141
+ * Unique identifier for the email message (use for subsequent API calls)
142
+ */
143
+ message_id?: string;
144
+ /**
145
+ * Original attachment filename from the email
146
+ */
147
+ original_filename?: string;
148
+ /**
149
+ * File size in bytes
150
+ */
151
+ size?: number;
152
+ /**
153
+ * Direct download URL (presigned, expires based on expires_in)
154
+ */
155
+ url?: string;
156
+ }
157
+ }
158
+ export interface InboxCheckConnectionStatusParams {
159
+ /**
160
+ * The encrypted inbox token
161
+ */
162
+ 'x-inbox-token': string;
163
+ }
164
+ export interface InboxConnectEmailParams {
165
+ /**
166
+ * Your callback URL to receive the inbox_token (must be http or https)
167
+ */
168
+ redirect_uri: string;
169
+ /**
170
+ * State parameter for CSRF protection (returned in redirect)
171
+ */
172
+ state?: string;
173
+ }
174
+ export interface InboxDisconnectEmailParams {
175
+ /**
176
+ * The encrypted inbox token to revoke
177
+ */
178
+ 'x-inbox-token': string;
179
+ }
180
+ export interface InboxListCasFilesParams {
181
+ /**
182
+ * Header param: The encrypted inbox token
183
+ */
184
+ 'x-inbox-token': string;
185
+ /**
186
+ * Body param: Filter by CAS provider(s):
187
+ *
188
+ * - `cdsl` → eCAS@cdslstatement.com
189
+ * - `nsdl` → NSDL-CAS@nsdl.co.in
190
+ * - `cams` → donotreply@camsonline.com
191
+ * - `kfintech` → samfS@kfintech.com
192
+ */
193
+ cas_types?: Array<'cdsl' | 'nsdl' | 'cams' | 'kfintech'>;
194
+ /**
195
+ * Body param: End date in ISO format (YYYY-MM-DD). Defaults to today.
196
+ */
197
+ end_date?: string;
198
+ /**
199
+ * Body param: Start date in ISO format (YYYY-MM-DD). Defaults to 30 days ago.
200
+ */
201
+ start_date?: string;
202
+ }
203
+ export declare namespace Inbox {
204
+ export { type InboxCheckConnectionStatusResponse as InboxCheckConnectionStatusResponse, type InboxConnectEmailResponse as InboxConnectEmailResponse, type InboxDisconnectEmailResponse as InboxDisconnectEmailResponse, type InboxListCasFilesResponse as InboxListCasFilesResponse, type InboxCheckConnectionStatusParams as InboxCheckConnectionStatusParams, type InboxConnectEmailParams as InboxConnectEmailParams, type InboxDisconnectEmailParams as InboxDisconnectEmailParams, type InboxListCasFilesParams as InboxListCasFilesParams, };
205
+ }
206
+ //# sourceMappingURL=inbox.d.ts.map