cas-parser-node 1.4.0 → 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 (186) hide show
  1. package/CHANGELOG.md +118 -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/internal/utils/values.js +3 -3
  24. package/internal/utils/values.js.map +1 -1
  25. package/internal/utils/values.mjs +3 -3
  26. package/internal/utils/values.mjs.map +1 -1
  27. package/package.json +9 -10
  28. package/resources/access-token.d.mts +48 -0
  29. package/resources/access-token.d.mts.map +1 -0
  30. package/resources/access-token.d.ts +48 -0
  31. package/resources/access-token.d.ts.map +1 -0
  32. package/resources/access-token.js +30 -0
  33. package/resources/access-token.js.map +1 -0
  34. package/resources/access-token.mjs +26 -0
  35. package/resources/access-token.mjs.map +1 -0
  36. package/resources/{cas-parser.d.mts → cams-kfintech.d.mts} +282 -105
  37. package/resources/cams-kfintech.d.mts.map +1 -0
  38. package/resources/{cas-parser.d.ts → cams-kfintech.d.ts} +282 -105
  39. package/resources/cams-kfintech.d.ts.map +1 -0
  40. package/resources/cams-kfintech.js +18 -0
  41. package/resources/cams-kfintech.js.map +1 -0
  42. package/resources/cams-kfintech.mjs +14 -0
  43. package/resources/cams-kfintech.mjs.map +1 -0
  44. package/resources/cdsl/cdsl.d.mts +39 -0
  45. package/resources/cdsl/cdsl.d.mts.map +1 -0
  46. package/resources/cdsl/cdsl.d.ts +39 -0
  47. package/resources/cdsl/cdsl.d.ts.map +1 -0
  48. package/resources/cdsl/cdsl.js +31 -0
  49. package/resources/cdsl/cdsl.js.map +1 -0
  50. package/resources/cdsl/cdsl.mjs +26 -0
  51. package/resources/cdsl/cdsl.mjs.map +1 -0
  52. package/resources/cdsl/fetch.d.mts +91 -0
  53. package/resources/cdsl/fetch.d.mts.map +1 -0
  54. package/resources/cdsl/fetch.d.ts +91 -0
  55. package/resources/cdsl/fetch.d.ts.map +1 -0
  56. package/resources/cdsl/fetch.js +50 -0
  57. package/resources/cdsl/fetch.js.map +1 -0
  58. package/resources/cdsl/fetch.mjs +46 -0
  59. package/resources/cdsl/fetch.mjs.map +1 -0
  60. package/resources/cdsl/index.d.mts +3 -0
  61. package/resources/cdsl/index.d.mts.map +1 -0
  62. package/resources/cdsl/index.d.ts +3 -0
  63. package/resources/cdsl/index.d.ts.map +1 -0
  64. package/resources/cdsl/index.js +9 -0
  65. package/resources/cdsl/index.js.map +1 -0
  66. package/resources/cdsl/index.mjs +4 -0
  67. package/resources/cdsl/index.mjs.map +1 -0
  68. package/resources/cdsl.d.mts +2 -0
  69. package/resources/cdsl.d.mts.map +1 -0
  70. package/resources/cdsl.d.ts +2 -0
  71. package/resources/cdsl.d.ts.map +1 -0
  72. package/resources/cdsl.js +6 -0
  73. package/resources/cdsl.js.map +1 -0
  74. package/resources/cdsl.mjs +3 -0
  75. package/resources/cdsl.mjs.map +1 -0
  76. package/resources/contract-note.d.mts +323 -0
  77. package/resources/contract-note.d.mts.map +1 -0
  78. package/resources/contract-note.d.ts +323 -0
  79. package/resources/contract-note.d.ts.map +1 -0
  80. package/resources/contract-note.js +49 -0
  81. package/resources/contract-note.js.map +1 -0
  82. package/resources/contract-note.mjs +45 -0
  83. package/resources/contract-note.mjs.map +1 -0
  84. package/resources/credits.d.mts +47 -0
  85. package/resources/credits.d.mts.map +1 -0
  86. package/resources/credits.d.ts +47 -0
  87. package/resources/credits.d.ts.map +1 -0
  88. package/resources/credits.js +23 -0
  89. package/resources/credits.js.map +1 -0
  90. package/resources/credits.mjs +19 -0
  91. package/resources/credits.mjs.map +1 -0
  92. package/resources/inbox.d.mts +206 -0
  93. package/resources/inbox.d.mts.map +1 -0
  94. package/resources/inbox.d.ts +206 -0
  95. package/resources/inbox.d.ts.map +1 -0
  96. package/resources/inbox.js +109 -0
  97. package/resources/inbox.js.map +1 -0
  98. package/resources/inbox.mjs +105 -0
  99. package/resources/inbox.mjs.map +1 -0
  100. package/resources/index.d.mts +11 -2
  101. package/resources/index.d.mts.map +1 -1
  102. package/resources/index.d.ts +11 -2
  103. package/resources/index.d.ts.map +1 -1
  104. package/resources/index.js +23 -5
  105. package/resources/index.js.map +1 -1
  106. package/resources/index.mjs +11 -2
  107. package/resources/index.mjs.map +1 -1
  108. package/resources/kfintech.d.mts +53 -0
  109. package/resources/kfintech.d.mts.map +1 -0
  110. package/resources/kfintech.d.ts +53 -0
  111. package/resources/kfintech.d.ts.map +1 -0
  112. package/resources/kfintech.js +29 -0
  113. package/resources/kfintech.js.map +1 -0
  114. package/resources/kfintech.mjs +25 -0
  115. package/resources/kfintech.mjs.map +1 -0
  116. package/resources/logs.d.mts +129 -0
  117. package/resources/logs.d.mts.map +1 -0
  118. package/resources/logs.d.ts +129 -0
  119. package/resources/logs.d.ts.map +1 -0
  120. package/resources/logs.js +37 -0
  121. package/resources/logs.js.map +1 -0
  122. package/resources/logs.mjs +33 -0
  123. package/resources/logs.mjs.map +1 -0
  124. package/resources/nsdl.d.mts +30 -0
  125. package/resources/nsdl.d.mts.map +1 -0
  126. package/resources/nsdl.d.ts +30 -0
  127. package/resources/nsdl.d.ts.map +1 -0
  128. package/resources/nsdl.js +18 -0
  129. package/resources/nsdl.js.map +1 -0
  130. package/resources/nsdl.mjs +14 -0
  131. package/resources/nsdl.mjs.map +1 -0
  132. package/resources/smart.d.mts +31 -0
  133. package/resources/smart.d.mts.map +1 -0
  134. package/resources/smart.d.ts +31 -0
  135. package/resources/smart.d.ts.map +1 -0
  136. package/resources/smart.js +19 -0
  137. package/resources/smart.js.map +1 -0
  138. package/resources/smart.mjs +15 -0
  139. package/resources/smart.mjs.map +1 -0
  140. package/resources/verify-token.d.mts +28 -0
  141. package/resources/verify-token.d.mts.map +1 -0
  142. package/resources/verify-token.d.ts +28 -0
  143. package/resources/verify-token.d.ts.map +1 -0
  144. package/resources/verify-token.js +16 -0
  145. package/resources/verify-token.js.map +1 -0
  146. package/resources/verify-token.mjs +12 -0
  147. package/resources/verify-token.mjs.map +1 -0
  148. package/src/client.ts +143 -31
  149. package/src/internal/parse.ts +6 -0
  150. package/src/internal/to-file.ts +1 -1
  151. package/src/internal/utils/values.ts +3 -3
  152. package/src/resources/access-token.ts +63 -0
  153. package/src/resources/{cas-parser.ts → cams-kfintech.ts} +340 -130
  154. package/src/resources/cdsl/cdsl.ts +67 -0
  155. package/src/resources/cdsl/fetch.ts +122 -0
  156. package/src/resources/cdsl/index.ts +10 -0
  157. package/src/resources/cdsl.ts +3 -0
  158. package/src/resources/contract-note.ts +402 -0
  159. package/src/resources/credits.ts +58 -0
  160. package/src/resources/inbox.ts +283 -0
  161. package/src/resources/index.ts +31 -11
  162. package/src/resources/kfintech.ts +71 -0
  163. package/src/resources/logs.ts +170 -0
  164. package/src/resources/nsdl.ts +42 -0
  165. package/src/resources/smart.ts +46 -0
  166. package/src/resources/verify-token.ts +36 -0
  167. package/src/version.ts +1 -1
  168. package/version.d.mts +1 -1
  169. package/version.d.ts +1 -1
  170. package/version.js +1 -1
  171. package/version.mjs +1 -1
  172. package/resources/cas-generator.d.mts +0 -56
  173. package/resources/cas-generator.d.mts.map +0 -1
  174. package/resources/cas-generator.d.ts +0 -56
  175. package/resources/cas-generator.d.ts.map +0 -1
  176. package/resources/cas-generator.js +0 -27
  177. package/resources/cas-generator.js.map +0 -1
  178. package/resources/cas-generator.mjs +0 -23
  179. package/resources/cas-generator.mjs.map +0 -1
  180. package/resources/cas-parser.d.mts.map +0 -1
  181. package/resources/cas-parser.d.ts.map +0 -1
  182. package/resources/cas-parser.js +0 -43
  183. package/resources/cas-parser.js.map +0 -1
  184. package/resources/cas-parser.mjs +0 -39
  185. package/resources/cas-parser.mjs.map +0 -1
  186. package/src/resources/cas-generator.ts +0 -75
@@ -0,0 +1,67 @@
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 * as FetchAPI from './fetch';
6
+ import {
7
+ Fetch,
8
+ FetchRequestOtpParams,
9
+ FetchRequestOtpResponse,
10
+ FetchVerifyOtpParams,
11
+ FetchVerifyOtpResponse,
12
+ } from './fetch';
13
+ import { APIPromise } from '../../core/api-promise';
14
+ import { RequestOptions } from '../../internal/request-options';
15
+ import { maybeMultipartFormRequestOptions } from '../../internal/uploads';
16
+
17
+ export class Cdsl extends APIResource {
18
+ fetch: FetchAPI.Fetch = new FetchAPI.Fetch(this._client);
19
+
20
+ /**
21
+ * This endpoint specifically parses CDSL CAS (Consolidated Account Statement) PDF
22
+ * files and returns data in a unified format. Use this endpoint when you know the
23
+ * PDF is from CDSL.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const unifiedResponse = await client.cdsl.parsePdf();
28
+ * ```
29
+ */
30
+ parsePdf(body: CdslParsePdfParams, options?: RequestOptions): APIPromise<CamsKfintechAPI.UnifiedResponse> {
31
+ return this._client.post(
32
+ '/v4/cdsl/parse',
33
+ maybeMultipartFormRequestOptions({ body, ...options }, this._client),
34
+ );
35
+ }
36
+ }
37
+
38
+ export interface CdslParsePdfParams {
39
+ /**
40
+ * Password for the PDF file (if required)
41
+ */
42
+ password?: string;
43
+
44
+ /**
45
+ * Base64 encoded CAS PDF file (required if pdf_url not provided)
46
+ */
47
+ pdf_file?: string;
48
+
49
+ /**
50
+ * URL to the CAS PDF file (required if pdf_file not provided)
51
+ */
52
+ pdf_url?: string;
53
+ }
54
+
55
+ Cdsl.Fetch = Fetch;
56
+
57
+ export declare namespace Cdsl {
58
+ export { type CdslParsePdfParams as CdslParsePdfParams };
59
+
60
+ export {
61
+ Fetch as Fetch,
62
+ type FetchRequestOtpResponse as FetchRequestOtpResponse,
63
+ type FetchVerifyOtpResponse as FetchVerifyOtpResponse,
64
+ type FetchRequestOtpParams as FetchRequestOtpParams,
65
+ type FetchVerifyOtpParams as FetchVerifyOtpParams,
66
+ };
67
+ }
@@ -0,0 +1,122 @@
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 Fetch extends APIResource {
9
+ /**
10
+ * **Step 1 of 2**: Request OTP for CDSL CAS fetch.
11
+ *
12
+ * This endpoint:
13
+ *
14
+ * 1. Solves reCAPTCHA automatically (~15-20 seconds)
15
+ * 2. Submits login credentials to CDSL portal
16
+ * 3. Triggers OTP to user's registered mobile number
17
+ *
18
+ * After user receives OTP, call `/v4/cdsl/fetch/{session_id}/verify` to complete.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const response = await client.cdsl.fetch.requestOtp({
23
+ * bo_id: '1234567890123456',
24
+ * dob: '1990-01-15',
25
+ * pan: 'ABCDE1234F',
26
+ * });
27
+ * ```
28
+ */
29
+ requestOtp(body: FetchRequestOtpParams, options?: RequestOptions): APIPromise<FetchRequestOtpResponse> {
30
+ return this._client.post('/v4/cdsl/fetch', { body, ...options });
31
+ }
32
+
33
+ /**
34
+ * **Step 2 of 2**: Verify OTP and retrieve CDSL CAS files.
35
+ *
36
+ * After successful verification, CAS PDFs are fetched from CDSL portal, uploaded
37
+ * to cloud storage, and returned as direct download URLs.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const response = await client.cdsl.fetch.verifyOtp(
42
+ * 'session_id',
43
+ * { otp: '123456' },
44
+ * );
45
+ * ```
46
+ */
47
+ verifyOtp(
48
+ sessionID: string,
49
+ body: FetchVerifyOtpParams,
50
+ options?: RequestOptions,
51
+ ): APIPromise<FetchVerifyOtpResponse> {
52
+ return this._client.post(path`/v4/cdsl/fetch/${sessionID}/verify`, { body, ...options });
53
+ }
54
+ }
55
+
56
+ export interface FetchRequestOtpResponse {
57
+ msg?: string;
58
+
59
+ /**
60
+ * Session ID for verify step
61
+ */
62
+ session_id?: string;
63
+
64
+ status?: string;
65
+ }
66
+
67
+ export interface FetchVerifyOtpResponse {
68
+ files?: Array<FetchVerifyOtpResponse.File>;
69
+
70
+ msg?: string;
71
+
72
+ status?: string;
73
+ }
74
+
75
+ export namespace FetchVerifyOtpResponse {
76
+ export interface File {
77
+ filename?: string;
78
+
79
+ /**
80
+ * Direct download URL (cloud storage)
81
+ */
82
+ url?: string;
83
+ }
84
+ }
85
+
86
+ export interface FetchRequestOtpParams {
87
+ /**
88
+ * CDSL BO ID (16 digits)
89
+ */
90
+ bo_id: string;
91
+
92
+ /**
93
+ * Date of birth (YYYY-MM-DD)
94
+ */
95
+ dob: string;
96
+
97
+ /**
98
+ * PAN number
99
+ */
100
+ pan: string;
101
+ }
102
+
103
+ export interface FetchVerifyOtpParams {
104
+ /**
105
+ * OTP received on mobile
106
+ */
107
+ otp: string;
108
+
109
+ /**
110
+ * Number of monthly statements to fetch (default 6)
111
+ */
112
+ num_periods?: number;
113
+ }
114
+
115
+ export declare namespace Fetch {
116
+ export {
117
+ type FetchRequestOtpResponse as FetchRequestOtpResponse,
118
+ type FetchVerifyOtpResponse as FetchVerifyOtpResponse,
119
+ type FetchRequestOtpParams as FetchRequestOtpParams,
120
+ type FetchVerifyOtpParams as FetchVerifyOtpParams,
121
+ };
122
+ }
@@ -0,0 +1,10 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Cdsl, type CdslParsePdfParams } from './cdsl';
4
+ export {
5
+ Fetch,
6
+ type FetchRequestOtpResponse,
7
+ type FetchVerifyOtpResponse,
8
+ type FetchRequestOtpParams,
9
+ type FetchVerifyOtpParams,
10
+ } from './fetch';
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './cdsl/index';
@@ -0,0 +1,402 @@
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 { maybeMultipartFormRequestOptions } from '../internal/uploads';
7
+
8
+ export class ContractNote extends APIResource {
9
+ /**
10
+ * This endpoint parses Contract Note PDF files from various brokers including
11
+ * Zerodha, Groww, Upstox, ICICI Securities, and others.
12
+ *
13
+ * **What is a Contract Note?** A contract note is a legal document that provides
14
+ * details of all trades executed by an investor. It includes:
15
+ *
16
+ * - Trade details with timestamps, quantities, and prices
17
+ * - Brokerage and charges breakdown
18
+ * - Settlement information
19
+ * - Regulatory compliance details
20
+ *
21
+ * **Supported Brokers:**
22
+ *
23
+ * - Zerodha Broking Limited
24
+ * - Groww Invest Tech Private Limited
25
+ * - Upstox (RKSV Securities)
26
+ * - ICICI Securities Limited
27
+ * - Auto-detection for unknown brokers
28
+ *
29
+ * **Key Features:**
30
+ *
31
+ * - **Auto-detection**: Automatically identifies broker type from PDF content
32
+ * - **Comprehensive parsing**: Extracts equity transactions, derivatives
33
+ * transactions, detailed trades, and charges
34
+ * - **Flexible input**: Accepts both file upload and URL-based PDF input
35
+ * - **Password protection**: Supports password-protected PDFs
36
+ *
37
+ * The API returns structured data including contract note information, client
38
+ * details, transaction summaries, and detailed trade-by-trade breakdowns.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const response = await client.contractNote.parse();
43
+ * ```
44
+ */
45
+ parse(body: ContractNoteParseParams, options?: RequestOptions): APIPromise<ContractNoteParseResponse> {
46
+ return this._client.post(
47
+ '/v4/contract_note/parse',
48
+ maybeMultipartFormRequestOptions({ body, ...options }, this._client),
49
+ );
50
+ }
51
+ }
52
+
53
+ export interface ContractNoteParseResponse {
54
+ data?: ContractNoteParseResponse.Data;
55
+
56
+ msg?: string;
57
+
58
+ status?: string;
59
+ }
60
+
61
+ export namespace ContractNoteParseResponse {
62
+ export interface Data {
63
+ broker_info?: Data.BrokerInfo;
64
+
65
+ /**
66
+ * Breakdown of various charges and fees
67
+ */
68
+ charges_summary?: Data.ChargesSummary;
69
+
70
+ client_info?: Data.ClientInfo;
71
+
72
+ contract_note_info?: Data.ContractNoteInfo;
73
+
74
+ /**
75
+ * Summary of derivatives transactions
76
+ */
77
+ derivatives_transactions?: Array<Data.DerivativesTransaction>;
78
+
79
+ /**
80
+ * Detailed breakdown of all individual trades
81
+ */
82
+ detailed_trades?: Array<Data.DetailedTrade>;
83
+
84
+ /**
85
+ * Summary of equity transactions grouped by security
86
+ */
87
+ equity_transactions?: Array<Data.EquityTransaction>;
88
+ }
89
+
90
+ export namespace Data {
91
+ export interface BrokerInfo {
92
+ /**
93
+ * Auto-detected or specified broker type
94
+ */
95
+ broker_type?: 'zerodha' | 'groww' | 'upstox' | 'icici' | 'unknown';
96
+
97
+ /**
98
+ * Broker company name
99
+ */
100
+ name?: string;
101
+
102
+ /**
103
+ * SEBI registration number of the broker
104
+ */
105
+ sebi_registration?: string;
106
+ }
107
+
108
+ /**
109
+ * Breakdown of various charges and fees
110
+ */
111
+ export interface ChargesSummary {
112
+ /**
113
+ * Central GST amount
114
+ */
115
+ cgst?: number;
116
+
117
+ /**
118
+ * Exchange transaction charges
119
+ */
120
+ exchange_transaction_charges?: number;
121
+
122
+ /**
123
+ * Integrated GST amount
124
+ */
125
+ igst?: number;
126
+
127
+ /**
128
+ * Final net amount receivable or payable
129
+ */
130
+ net_amount_receivable_payable?: number;
131
+
132
+ /**
133
+ * Net pay-in/pay-out obligation
134
+ */
135
+ pay_in_pay_out_obligation?: number;
136
+
137
+ /**
138
+ * SEBI turnover fees
139
+ */
140
+ sebi_turnover_fees?: number;
141
+
142
+ /**
143
+ * Securities Transaction Tax
144
+ */
145
+ securities_transaction_tax?: number;
146
+
147
+ /**
148
+ * State GST amount
149
+ */
150
+ sgst?: number;
151
+
152
+ /**
153
+ * Stamp duty charges
154
+ */
155
+ stamp_duty?: number;
156
+
157
+ /**
158
+ * Taxable brokerage amount
159
+ */
160
+ taxable_value_brokerage?: number;
161
+ }
162
+
163
+ export interface ClientInfo {
164
+ /**
165
+ * Client address
166
+ */
167
+ address?: string;
168
+
169
+ /**
170
+ * GST state code
171
+ */
172
+ gst_state_code?: string;
173
+
174
+ /**
175
+ * Client name
176
+ */
177
+ name?: string;
178
+
179
+ /**
180
+ * Client PAN number
181
+ */
182
+ pan?: string;
183
+
184
+ /**
185
+ * GST place of supply
186
+ */
187
+ place_of_supply?: string;
188
+
189
+ /**
190
+ * Unique Client Code
191
+ */
192
+ ucc?: string;
193
+ }
194
+
195
+ export interface ContractNoteInfo {
196
+ /**
197
+ * Contract note reference number
198
+ */
199
+ contract_note_number?: string;
200
+
201
+ /**
202
+ * Settlement date for the trades
203
+ */
204
+ settlement_date?: string;
205
+
206
+ /**
207
+ * Settlement reference number
208
+ */
209
+ settlement_number?: string;
210
+
211
+ /**
212
+ * Date when trades were executed
213
+ */
214
+ trade_date?: string;
215
+ }
216
+
217
+ export interface DerivativesTransaction {
218
+ /**
219
+ * Brokerage charged per unit
220
+ */
221
+ brokerage_per_unit?: number;
222
+
223
+ /**
224
+ * Transaction type (Buy/Sell/Bring Forward/Carry Forward)
225
+ */
226
+ buy_sell_bf_cf?: string;
227
+
228
+ /**
229
+ * Closing rate per unit
230
+ */
231
+ closing_rate_per_unit?: number;
232
+
233
+ /**
234
+ * Derivatives contract description
235
+ */
236
+ contract_description?: string;
237
+
238
+ /**
239
+ * Net total amount
240
+ */
241
+ net_total?: number;
242
+
243
+ /**
244
+ * Quantity traded
245
+ */
246
+ quantity?: number;
247
+
248
+ /**
249
+ * Weighted Average Price per unit
250
+ */
251
+ wap_per_unit?: number;
252
+ }
253
+
254
+ export interface DetailedTrade {
255
+ /**
256
+ * Brokerage charged for this trade
257
+ */
258
+ brokerage?: number;
259
+
260
+ /**
261
+ * Transaction type (B for Buy, S for Sell)
262
+ */
263
+ buy_sell?: string;
264
+
265
+ /**
266
+ * Closing rate per unit
267
+ */
268
+ closing_rate_per_unit?: number;
269
+
270
+ /**
271
+ * Exchange name
272
+ */
273
+ exchange?: string;
274
+
275
+ /**
276
+ * Net rate per unit
277
+ */
278
+ net_rate_per_unit?: number;
279
+
280
+ /**
281
+ * Net total for this trade
282
+ */
283
+ net_total?: number;
284
+
285
+ /**
286
+ * Order reference number
287
+ */
288
+ order_number?: string;
289
+
290
+ /**
291
+ * Time when order was placed
292
+ */
293
+ order_time?: string;
294
+
295
+ /**
296
+ * Quantity traded
297
+ */
298
+ quantity?: number;
299
+
300
+ /**
301
+ * Additional remarks or notes
302
+ */
303
+ remarks?: string;
304
+
305
+ /**
306
+ * Security name with exchange and ISIN
307
+ */
308
+ security_description?: string;
309
+
310
+ /**
311
+ * Trade reference number
312
+ */
313
+ trade_number?: string;
314
+
315
+ /**
316
+ * Time when trade was executed
317
+ */
318
+ trade_time?: string;
319
+ }
320
+
321
+ export interface EquityTransaction {
322
+ /**
323
+ * Total quantity purchased
324
+ */
325
+ buy_quantity?: number;
326
+
327
+ /**
328
+ * Total value of buy transactions
329
+ */
330
+ buy_total_value?: number;
331
+
332
+ /**
333
+ * Weighted Average Price for buy transactions
334
+ */
335
+ buy_wap?: number;
336
+
337
+ /**
338
+ * ISIN code of the security
339
+ */
340
+ isin?: string;
341
+
342
+ /**
343
+ * Net amount payable/receivable for this security
344
+ */
345
+ net_obligation?: number;
346
+
347
+ /**
348
+ * Name of the security
349
+ */
350
+ security_name?: string;
351
+
352
+ /**
353
+ * Trading symbol
354
+ */
355
+ security_symbol?: string;
356
+
357
+ /**
358
+ * Total quantity sold
359
+ */
360
+ sell_quantity?: number;
361
+
362
+ /**
363
+ * Total value of sell transactions
364
+ */
365
+ sell_total_value?: number;
366
+
367
+ /**
368
+ * Weighted Average Price for sell transactions
369
+ */
370
+ sell_wap?: number;
371
+ }
372
+ }
373
+ }
374
+
375
+ export interface ContractNoteParseParams {
376
+ /**
377
+ * Optional broker type override. If not provided, system will auto-detect.
378
+ */
379
+ broker_type?: 'zerodha' | 'groww' | 'upstox' | 'icici';
380
+
381
+ /**
382
+ * Password for the PDF file (usually PAN number for Zerodha)
383
+ */
384
+ password?: string;
385
+
386
+ /**
387
+ * Base64 encoded contract note PDF file
388
+ */
389
+ pdf_file?: string;
390
+
391
+ /**
392
+ * URL to the contract note PDF file
393
+ */
394
+ pdf_url?: string;
395
+ }
396
+
397
+ export declare namespace ContractNote {
398
+ export {
399
+ type ContractNoteParseResponse as ContractNoteParseResponse,
400
+ type ContractNoteParseParams as ContractNoteParseParams,
401
+ };
402
+ }
@@ -0,0 +1,58 @@
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 Credits extends APIResource {
8
+ /**
9
+ * Check your remaining API credits and usage for the current billing period.
10
+ *
11
+ * Returns:
12
+ *
13
+ * - Number of API calls used and remaining credits
14
+ * - Credit limit and reset date
15
+ * - List of enabled features for your plan
16
+ *
17
+ * Credits reset at the start of each billing period.
18
+ */
19
+ check(options?: RequestOptions): APIPromise<CreditCheckResponse> {
20
+ return this._client.post('/credits', options);
21
+ }
22
+ }
23
+
24
+ export interface CreditCheckResponse {
25
+ /**
26
+ * List of API features enabled for your plan
27
+ */
28
+ enabled_features?: Array<string>;
29
+
30
+ /**
31
+ * Whether the account has unlimited credits
32
+ */
33
+ is_unlimited?: boolean;
34
+
35
+ /**
36
+ * Total credit limit for billing period
37
+ */
38
+ limit?: number;
39
+
40
+ /**
41
+ * Remaining credits (null if unlimited)
42
+ */
43
+ remaining?: number | null;
44
+
45
+ /**
46
+ * When credits reset (ISO 8601)
47
+ */
48
+ resets_at?: string | null;
49
+
50
+ /**
51
+ * Number of credits used this billing period
52
+ */
53
+ used?: number;
54
+ }
55
+
56
+ export declare namespace Credits {
57
+ export { type CreditCheckResponse as CreditCheckResponse };
58
+ }