@invezgo/sdk 1.3.2 → 2.1.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 (58) hide show
  1. package/README.md +318 -314
  2. package/dist/cache.d.ts +27 -0
  3. package/dist/cache.d.ts.map +1 -0
  4. package/dist/client.d.ts +15 -18
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/errors.d.ts +71 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/generated/resources.d.ts +3382 -0
  9. package/dist/generated/resources.d.ts.map +1 -0
  10. package/dist/generated/types.d.ts +3873 -0
  11. package/dist/generated/types.d.ts.map +1 -0
  12. package/dist/http.d.ts +66 -0
  13. package/dist/http.d.ts.map +1 -0
  14. package/dist/index.d.ts +9 -16
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +760 -1080
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +781 -0
  19. package/dist/index.mjs.map +1 -0
  20. package/package.json +66 -63
  21. package/dist/endpoints/ai.d.ts +0 -98
  22. package/dist/endpoints/ai.d.ts.map +0 -1
  23. package/dist/endpoints/alerts.d.ts +0 -49
  24. package/dist/endpoints/alerts.d.ts.map +0 -1
  25. package/dist/endpoints/analysis.d.ts +0 -380
  26. package/dist/endpoints/analysis.d.ts.map +0 -1
  27. package/dist/endpoints/batch.d.ts +0 -40
  28. package/dist/endpoints/batch.d.ts.map +0 -1
  29. package/dist/endpoints/health.d.ts +0 -24
  30. package/dist/endpoints/health.d.ts.map +0 -1
  31. package/dist/endpoints/journals.d.ts +0 -49
  32. package/dist/endpoints/journals.d.ts.map +0 -1
  33. package/dist/endpoints/membership.d.ts +0 -35
  34. package/dist/endpoints/membership.d.ts.map +0 -1
  35. package/dist/endpoints/portfolios.d.ts +0 -14
  36. package/dist/endpoints/portfolios.d.ts.map +0 -1
  37. package/dist/endpoints/posts.d.ts +0 -42
  38. package/dist/endpoints/posts.d.ts.map +0 -1
  39. package/dist/endpoints/profile.d.ts +0 -34
  40. package/dist/endpoints/profile.d.ts.map +0 -1
  41. package/dist/endpoints/recommendation.d.ts +0 -10
  42. package/dist/endpoints/recommendation.d.ts.map +0 -1
  43. package/dist/endpoints/screener.d.ts +0 -45
  44. package/dist/endpoints/screener.d.ts.map +0 -1
  45. package/dist/endpoints/search.d.ts +0 -18
  46. package/dist/endpoints/search.d.ts.map +0 -1
  47. package/dist/endpoints/trades.d.ts +0 -31
  48. package/dist/endpoints/trades.d.ts.map +0 -1
  49. package/dist/endpoints/usage.d.ts +0 -11
  50. package/dist/endpoints/usage.d.ts.map +0 -1
  51. package/dist/endpoints/watchlists.d.ts +0 -64
  52. package/dist/endpoints/watchlists.d.ts.map +0 -1
  53. package/dist/index.esm.js +0 -1130
  54. package/dist/index.esm.js.map +0 -1
  55. package/dist/invezgo.d.ts +0 -42
  56. package/dist/invezgo.d.ts.map +0 -1
  57. package/dist/types.d.ts +0 -610
  58. package/dist/types.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,1130 +1,810 @@
1
- class InvezgoError extends Error {
2
- constructor(statusCode, message, error, response) {
3
- super(message);
4
- this.statusCode = statusCode;
5
- this.message = message;
6
- this.error = error;
7
- this.response = response;
8
- this.name = 'InvezgoError';
9
- Object.setPrototypeOf(this, InvezgoError.prototype);
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ class AnalysisResource {
6
+ transport;
7
+ constructor(transport) {
8
+ this.transport = transport;
10
9
  }
11
- }
12
- class HttpClient {
13
- constructor(config) {
14
- // Ensure baseURL doesn't have trailing slash since paths start with /
15
- const baseURL = config.baseURL || 'https://api.invezgo.com';
16
- this.baseURL = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL;
17
- this.apiKey = config.apiKey;
18
- this.timeout = config.timeout || 30000;
19
- if (!this.apiKey) {
20
- throw new Error('API Key is required');
21
- }
10
+ getStockList(options) {
11
+ return this.transport.request({ method: 'GET', route: '/analysis/list/stock', cache: 'default' }, options);
22
12
  }
23
- async request(method, path, options = {}) {
24
- const url = `${this.baseURL}${path}`;
25
- const controller = new AbortController();
26
- const timeoutId = setTimeout(() => controller.abort(), options.timeout || this.timeout);
27
- try {
28
- const headers = {
29
- 'Authorization': `Bearer ${this.apiKey}`,
30
- 'Content-Type': 'application/json',
31
- 'User-Agent': 'Invezgo JS SDK',
32
- ...options.headers,
33
- };
34
- const response = await fetch(url, {
35
- method,
36
- headers,
37
- signal: controller.signal,
38
- });
39
- clearTimeout(timeoutId);
40
- // Handle 204 No Content
41
- if (response.status === 204) {
42
- return [];
43
- }
44
- const data = await response.json().catch(() => ({}));
45
- // Handle error responses
46
- if (!response.ok) {
47
- throw new InvezgoError(response.status, data?.message || response.statusText, data?.error, data);
48
- }
49
- return data;
50
- }
51
- catch (error) {
52
- clearTimeout(timeoutId);
53
- if (error.name === 'AbortError') {
54
- throw new InvezgoError(408, 'Request timeout', 'Timeout');
55
- }
56
- if (error instanceof InvezgoError) {
57
- throw error;
58
- }
59
- throw new InvezgoError(500, error.message || 'Unknown error occurred', 'InternalError', error);
60
- }
13
+ getBrokerList(options) {
14
+ return this.transport.request({ method: 'GET', route: '/analysis/list/broker', cache: 'default' }, options);
61
15
  }
62
- async get(path, params, options) {
63
- let url = path;
64
- if (params && Object.keys(params).length > 0) {
65
- const searchParams = new URLSearchParams();
66
- Object.entries(params).forEach(([key, value]) => {
67
- if (value !== undefined && value !== null) {
68
- if (Array.isArray(value)) {
69
- value.forEach(v => searchParams.append(key, String(v)));
70
- }
71
- else {
72
- searchParams.append(key, String(value));
73
- }
74
- }
75
- });
76
- url = `${path}?${searchParams.toString()}`;
77
- }
78
- return this.request('GET', url, options);
79
- }
80
- async post(path, body, options) {
81
- const requestOptions = {
82
- ...options,
83
- headers: {
84
- ...options?.headers,
85
- },
86
- };
87
- const controller = new AbortController();
88
- const timeoutId = setTimeout(() => controller.abort(), requestOptions.timeout || this.timeout);
89
- try {
90
- const url = `${this.baseURL}${path}`;
91
- const headers = {
92
- 'Authorization': `Bearer ${this.apiKey}`,
93
- 'Content-Type': 'application/json',
94
- 'User-Agent': 'Invezgo JS SDK',
95
- ...requestOptions.headers,
96
- };
97
- const response = await fetch(url, {
98
- method: 'POST',
99
- headers,
100
- body: body ? JSON.stringify(body) : undefined,
101
- signal: controller.signal,
102
- });
103
- clearTimeout(timeoutId);
104
- if (response.status === 204) {
105
- return {};
106
- }
107
- const data = await response.json().catch(() => ({}));
108
- if (!response.ok) {
109
- throw new InvezgoError(response.status, data?.message || response.statusText, data?.error, data);
110
- }
111
- return data;
112
- }
113
- catch (error) {
114
- clearTimeout(timeoutId);
115
- if (error.name === 'AbortError') {
116
- throw new InvezgoError(408, 'Request timeout', 'Timeout');
117
- }
118
- if (error instanceof InvezgoError) {
119
- throw error;
120
- }
121
- throw new InvezgoError(500, error.message || 'Unknown error occurred', 'InternalError', error);
122
- }
16
+ getIndexList(options) {
17
+ return this.transport.request({ method: 'GET', route: '/analysis/list/index', cache: 'default' }, options);
123
18
  }
124
- async put(path, body, options) {
125
- const controller = new AbortController();
126
- const timeoutId = setTimeout(() => controller.abort(), options?.timeout || this.timeout);
127
- try {
128
- const url = `${this.baseURL}${path}`;
129
- const headers = {
130
- 'Authorization': `Bearer ${this.apiKey}`,
131
- 'Content-Type': 'application/json',
132
- 'User-Agent': 'Invezgo JS SDK',
133
- ...options?.headers,
134
- };
135
- const response = await fetch(url, {
136
- method: 'PUT',
137
- headers,
138
- body: body ? JSON.stringify(body) : undefined,
139
- signal: controller.signal,
140
- });
141
- clearTimeout(timeoutId);
142
- if (response.status === 204) {
143
- return {};
144
- }
145
- const data = await response.json().catch(() => ({}));
146
- if (!response.ok) {
147
- throw new InvezgoError(response.status, data?.message || response.statusText, data?.error, data);
148
- }
149
- return data;
150
- }
151
- catch (error) {
152
- clearTimeout(timeoutId);
153
- if (error.name === 'AbortError') {
154
- throw new InvezgoError(408, 'Request timeout', 'Timeout');
155
- }
156
- if (error instanceof InvezgoError) {
157
- throw error;
158
- }
159
- throw new InvezgoError(500, error.message || 'Unknown error occurred', 'InternalError', error);
160
- }
19
+ getUma(params, options) {
20
+ return this.transport.request({ method: 'GET', route: '/analysis/uma', cache: 'default', query: params }, options);
161
21
  }
162
- async patch(path, body, options) {
163
- const controller = new AbortController();
164
- const timeoutId = setTimeout(() => controller.abort(), options?.timeout || this.timeout);
165
- try {
166
- const url = `${this.baseURL}${path}`;
167
- const headers = {
168
- 'Authorization': `Bearer ${this.apiKey}`,
169
- 'Content-Type': 'application/json',
170
- 'User-Agent': 'Invezgo JS SDK',
171
- ...options?.headers,
172
- };
173
- const response = await fetch(url, {
174
- method: 'PATCH',
175
- headers,
176
- body: body ? JSON.stringify(body) : undefined,
177
- signal: controller.signal,
178
- });
179
- clearTimeout(timeoutId);
180
- if (response.status === 204) {
181
- return {};
182
- }
183
- const data = await response.json().catch(() => ({}));
184
- if (!response.ok) {
185
- throw new InvezgoError(response.status, data?.message || response.statusText, data?.error, data);
186
- }
187
- return data;
188
- }
189
- catch (error) {
190
- clearTimeout(timeoutId);
191
- if (error.name === 'AbortError') {
192
- throw new InvezgoError(408, 'Request timeout', 'Timeout');
193
- }
194
- if (error instanceof InvezgoError) {
195
- throw error;
196
- }
197
- throw new InvezgoError(500, error.message || 'Unknown error occurred', 'InternalError', error);
198
- }
22
+ getSuspend(params, options) {
23
+ return this.transport.request({ method: 'GET', route: '/analysis/suspend', cache: 'default', query: params }, options);
199
24
  }
200
- async delete(path, params, options) {
201
- let url = path;
202
- if (params && Object.keys(params).length > 0) {
203
- const searchParams = new URLSearchParams();
204
- Object.entries(params).forEach(([key, value]) => {
205
- if (value !== undefined && value !== null) {
206
- if (Array.isArray(value)) {
207
- value.forEach(v => searchParams.append(key, String(v)));
208
- }
209
- else {
210
- searchParams.append(key, String(value));
211
- }
212
- }
213
- });
214
- url = `${path}?${searchParams.toString()}`;
215
- }
216
- return this.request('DELETE', url, options);
25
+ getNotation(options) {
26
+ return this.transport.request({ method: 'GET', route: '/analysis/notation', cache: 'default' }, options);
217
27
  }
218
- }
219
-
220
- class AlertsEndpoints {
221
- constructor(client) {
222
- this.client = client;
223
- }
224
- /**
225
- * Get list of alerts.
226
- */
227
- async list() {
228
- return this.client.get('/alerts');
229
- }
230
- /**
231
- * Create alert.
232
- */
233
- async add(dto) {
234
- return this.client.post('/alerts', dto);
235
- }
236
- /**
237
- * Update alert.
238
- */
239
- async update(id, dto) {
240
- return this.client.put(`/alerts/${id}`, dto);
241
- }
242
- /**
243
- * Delete alert.
244
- */
245
- async delete(id) {
246
- return this.client.delete(`/alerts/${id}`);
247
- }
248
- /**
249
- * Test alert formula.
250
- */
251
- async test(dto) {
252
- return this.client.post('/alerts/test', dto);
28
+ getInformation(code, options) {
29
+ return this.transport.request({ method: 'GET', route: '/analysis/information/{code}', cache: 'default', pathParams: { code } }, options);
30
+ }
31
+ getTopChange(params, options) {
32
+ return this.transport.request({ method: 'GET', route: '/analysis/top/change', cache: 'default', query: params }, options);
33
+ }
34
+ getTopForeign(params, options) {
35
+ return this.transport.request({ method: 'GET', route: '/analysis/top/foreign', cache: 'default', query: params }, options);
36
+ }
37
+ getTopAccumulation(params, options) {
38
+ return this.transport.request({ method: 'GET', route: '/analysis/top/accumulation', cache: 'default', query: params }, options);
39
+ }
40
+ getTopRitel(params, options) {
41
+ return this.transport.request({ method: 'GET', route: '/analysis/top/ritel', cache: 'default', query: params }, options);
42
+ }
43
+ getStockRunningTrade(code, params, options) {
44
+ return this.transport.request({ method: 'GET', route: '/analysis/running-trade/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
45
+ }
46
+ getIntradayChart(code, params, options) {
47
+ return this.transport.request({ method: 'GET', route: '/analysis/intraday/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
48
+ }
49
+ getOrderBook(code, params, options) {
50
+ return this.transport.request({ method: 'GET', route: '/analysis/order-book/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
51
+ }
52
+ getOrderQueue(code, params, options) {
53
+ return this.transport.request({ method: 'GET', route: '/analysis/queue/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
54
+ }
55
+ getIntradayData(code, params, options) {
56
+ return this.transport.request({ method: 'GET', route: '/analysis/intraday-data/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
57
+ }
58
+ getIntradayIndex(code, options) {
59
+ return this.transport.request({ method: 'GET', route: '/analysis/intraday-index/{code}', cache: 'realtime', pathParams: { code } }, options);
60
+ }
61
+ getAdvanceChart(code, params, options) {
62
+ return this.transport.request({ method: 'GET', route: '/analysis/chart/stock/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
63
+ }
64
+ getIndexChart(code, params, options) {
65
+ return this.transport.request({ method: 'GET', route: '/analysis/chart/index/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
66
+ }
67
+ getMultiTimeChart(code, params, options) {
68
+ return this.transport.request({ method: 'GET', route: '/analysis/chart/multi-time/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
69
+ }
70
+ getIndicatorChart(indicator, code, params, options) {
71
+ return this.transport.request({ method: 'GET', route: '/analysis/chart/stock/{indicator}/{code}', cache: 'default', pathParams: { indicator, code }, query: params }, options);
72
+ }
73
+ getShareholderDetail(params, options) {
74
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder-detail', cache: 'default', query: params }, options);
75
+ }
76
+ getShareholderOneDetail(params, options) {
77
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder-detail-one', cache: 'default', query: params }, options);
78
+ }
79
+ getShareholderHigh(options) {
80
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder/high', cache: 'default' }, options);
81
+ }
82
+ getShareholderNumber(code, options) {
83
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder/number/{code}', cache: 'default', pathParams: { code } }, options);
84
+ }
85
+ getShareholderRelation(params, options) {
86
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder/relation', cache: 'default', query: params }, options);
87
+ }
88
+ getShareholder(code, options) {
89
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder/{code}', cache: 'default', pathParams: { code } }, options);
90
+ }
91
+ getShareholderKSEI(code, params, options) {
92
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder/ksei/{code}', cache: 'default', pathParams: { code }, query: params }, options);
93
+ }
94
+ getShareholderClassification(code, params, options) {
95
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder/classification/{code}', cache: 'default', pathParams: { code }, query: params }, options);
96
+ }
97
+ getShareholderClassifyTable(code, options) {
98
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder/classify-table/{code}', cache: 'default', pathParams: { code } }, options);
99
+ }
100
+ getFreeFloat(code, params, options) {
101
+ return this.transport.request({ method: 'GET', route: '/analysis/free-float/{code}', cache: 'default', pathParams: { code }, query: params }, options);
102
+ }
103
+ getSummaryStock(code, params, options) {
104
+ return this.transport.request({ method: 'GET', route: '/analysis/summary/stock/{code}', cache: 'default', pathParams: { code }, query: params }, options);
105
+ }
106
+ getSummaryBroker(code, params, options) {
107
+ return this.transport.request({ method: 'GET', route: '/analysis/summary/broker/{code}', cache: 'default', pathParams: { code }, query: params }, options);
108
+ }
109
+ getSectorStalker(params, options) {
110
+ return this.transport.request({ method: 'GET', route: '/analysis/stalker/sector', cache: 'realtime', query: params }, options);
111
+ }
112
+ getSectorRotation(params, options) {
113
+ return this.transport.request({ method: 'GET', route: '/analysis/sector/rotation', cache: 'realtime', query: params }, options);
114
+ }
115
+ getBrokerStalker(broker, stock, params, options) {
116
+ return this.transport.request({ method: 'GET', route: '/analysis/stalker/broker/{broker}/{stock}', cache: 'default', pathParams: { broker, stock }, query: params }, options);
117
+ }
118
+ getBrokerStalkerList(code, params, options) {
119
+ return this.transport.request({ method: 'GET', route: '/analysis/stalker/list/{code}', cache: 'default', pathParams: { code }, query: params }, options);
120
+ }
121
+ getSummaryStockChart(code, params, options) {
122
+ return this.transport.request({ method: 'GET', route: '/analysis/summary-chart/stock/{code}', cache: 'default', pathParams: { code }, query: params }, options);
123
+ }
124
+ getSummaryBrokerChart(code, params, options) {
125
+ return this.transport.request({ method: 'GET', route: '/analysis/summary-chart/broker/{code}', cache: 'default', pathParams: { code }, query: params }, options);
126
+ }
127
+ getInventoryStockChart(code, params, options) {
128
+ return this.transport.request({ method: 'GET', route: '/analysis/inventory-chart/stock/{code}', cache: 'default', pathParams: { code }, query: params }, options);
129
+ }
130
+ getInventoryBrokerChart(code, params, options) {
131
+ return this.transport.request({ method: 'GET', route: '/analysis/inventory-chart/broker/{code}', cache: 'default', pathParams: { code }, query: params }, options);
132
+ }
133
+ getMomentumChart(code, params, options) {
134
+ return this.transport.request({ method: 'GET', route: '/analysis/momentum-chart/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
135
+ }
136
+ getIntradayInventoryChart(code, params, options) {
137
+ return this.transport.request({ method: 'GET', route: '/analysis/intraday-inventory-chart/{code}', cache: 'default', pathParams: { code }, query: params }, options);
138
+ }
139
+ getSankeyChart(code, params, options) {
140
+ return this.transport.request({ method: 'GET', route: '/analysis/sankey-chart/{code}', cache: 'default', pathParams: { code }, query: params }, options);
141
+ }
142
+ getPriceTable(code, params, options) {
143
+ return this.transport.request({ method: 'GET', route: '/analysis/price-table/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
144
+ }
145
+ getTimeTable(code, params, options) {
146
+ return this.transport.request({ method: 'GET', route: '/analysis/time-table/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
147
+ }
148
+ getPriceDiary(code, options) {
149
+ return this.transport.request({ method: 'GET', route: '/analysis/price-diary/{code}', cache: 'default', pathParams: { code } }, options);
150
+ }
151
+ getPriceSeasonality(code, params, options) {
152
+ return this.transport.request({ method: 'GET', route: '/analysis/price-seasonality/{code}', cache: 'default', pathParams: { code }, query: params }, options);
153
+ }
154
+ getShareholderAbove(params, options) {
155
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder-above', cache: 'default', query: params }, options);
156
+ }
157
+ getShareholderAboveChart(code, params, options) {
158
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder-above-chart/{code}', cache: 'default', pathParams: { code }, query: params }, options);
159
+ }
160
+ getShareholderOne(params, options) {
161
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder-one', cache: 'default', query: params }, options);
162
+ }
163
+ getShareholderOneChart(code, params, options) {
164
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder-one-chart/{code}', cache: 'default', pathParams: { code }, query: params }, options);
165
+ }
166
+ getInsider(params, options) {
167
+ return this.transport.request({ method: 'GET', route: '/analysis/shareholder-insider', cache: 'default', query: params }, options);
168
+ }
169
+ getInsiderChart(code, params, options) {
170
+ return this.transport.request({ method: 'GET', route: '/analysis/insider-chart/{code}', cache: 'default', pathParams: { code }, query: params }, options);
171
+ }
172
+ getFinancialStatement(code, params, options) {
173
+ return this.transport.request({ method: 'GET', route: '/analysis/financial-statement/{code}', cache: 'default', pathParams: { code }, query: params }, options);
174
+ }
175
+ getFinancialStatementChart(code, params, options) {
176
+ return this.transport.request({ method: 'GET', route: '/analysis/financial-statement-chart/{code}', cache: 'default', pathParams: { code }, query: params }, options);
177
+ }
178
+ getKeystat(code, params, options) {
179
+ return this.transport.request({ method: 'GET', route: '/analysis/keystat/{code}', cache: 'default', pathParams: { code }, query: params }, options);
180
+ }
181
+ getKeystatChart(code, params, options) {
182
+ return this.transport.request({ method: 'GET', route: '/analysis/keystat-chart/{code}', cache: 'default', pathParams: { code }, query: params }, options);
183
+ }
184
+ getFlowOfFunds(code, params, options) {
185
+ return this.transport.request({ method: 'GET', route: '/analysis/flow-of-funds/{code}', cache: 'default', pathParams: { code }, query: params }, options);
186
+ }
187
+ getCalendar(params, options) {
188
+ return this.transport.request({ method: 'GET', route: '/analysis/calendar', cache: 'default', query: params }, options);
189
+ }
190
+ getNews(params, options) {
191
+ return this.transport.request({ method: 'GET', route: '/analysis/news', cache: 'default', query: params }, options);
192
+ }
193
+ getDisclosure(params, options) {
194
+ return this.transport.request({ method: 'GET', route: '/analysis/disclosure', cache: 'default', query: params }, options);
253
195
  }
254
196
  }
255
-
256
- class AnalysisEndpoints {
257
- constructor(client) {
258
- this.client = client;
259
- }
260
- /**
261
- * Get list of all stocks listed on BEI.
262
- */
263
- async getStockList() {
264
- return this.client.get('/analysis/list/stock');
265
- }
266
- /**
267
- * Get list of all brokers/securities on BEI.
268
- */
269
- async getBrokerList() {
270
- return this.client.get('/analysis/list/broker');
271
- }
272
- /**
273
- * Get list of all supported IDX indexes.
274
- */
275
- async getIndexList() {
276
- return this.client.get('/analysis/list/index');
277
- }
278
- /**
279
- * Get complete company information.
280
- */
281
- async getInformation(code) {
282
- return this.client.get(`/analysis/information/${code}`);
283
- }
284
- /**
285
- * Get top gainer and loser stocks for a specific date.
286
- */
287
- async getTopChange(date) {
288
- return this.client.get('/analysis/top/change', { date });
289
- }
290
- /**
291
- * Get top foreign accumulation and distribution.
292
- */
293
- async getTopForeign(date) {
294
- return this.client.get('/analysis/top/foreign', { date });
295
- }
296
- /**
297
- * Get top bandarmology accumulation and distribution.
298
- */
299
- async getTopAccumulation(date) {
300
- return this.client.get('/analysis/top/accumulation', { date });
301
- }
302
- /**
303
- * Get top retail accumulation and distribution.
304
- */
305
- async getTopRitel(date) {
306
- return this.client.get('/analysis/top/ritel', { date });
307
- }
308
- /**
309
- * Alias for getTopRitel.
310
- */
311
- async getTopRetail(date) {
312
- return this.getTopRitel(date);
313
- }
314
- /**
315
- * Get intraday chart data.
316
- */
317
- async getIntradayChart(code, market = 'RG') {
318
- return this.client.get(`/analysis/intraday/${code}`, { market });
319
- }
320
- /**
321
- * Get intraday stock summary data.
322
- */
323
- async getIntradayData(code, market = 'RG') {
324
- return this.client.get(`/analysis/intraday-data/${code}`, { market });
325
- }
326
- /**
327
- * Get intraday index summary data.
328
- */
329
- async getIntradayIndex(code, market = 'RG') {
330
- return this.client.get(`/analysis/intraday-index/${code}`, { market });
331
- }
332
- /**
333
- * Get order book data.
334
- */
335
- async getOrderBook(code, market = 'RG') {
336
- return this.client.get(`/analysis/order-book/${code}`, { market });
337
- }
338
- /**
339
- * Get complete stock chart data.
340
- */
341
- async getChart(code, params) {
342
- return this.client.get(`/analysis/chart/stock/${code}`, params);
343
- }
344
- /**
345
- * Get historical index chart data.
346
- */
347
- async getIndexChart(code, params) {
348
- return this.client.get(`/analysis/chart/index/${code}`, params);
349
- }
350
- /**
351
- * Get stock chart with technical indicator.
352
- */
353
- async getIndicatorChart(code, indicator, params) {
354
- return this.client.get(`/analysis/chart/stock/${indicator}/${code}`, params);
355
- }
356
- /**
357
- * Get shareholder detail above 5%.
358
- */
359
- async getShareholderDetail(code) {
360
- return this.client.get(`/analysis/shareholder-detail/${code}`);
361
- }
362
- /**
363
- * Get shareholder detail above 1% for a specific holder.
364
- */
365
- async getShareholderDetailOne(params) {
366
- return this.client.get('/analysis/shareholder-detail-one', params);
367
- }
368
- /**
369
- * Get number of shareholders.
370
- */
371
- async getShareholderNumber(code) {
372
- return this.client.get(`/analysis/shareholder/number/${code}`);
373
- }
374
- /**
375
- * Get shareholder relation graph.
376
- */
377
- async getShareholderRelation(params) {
378
- return this.client.get('/analysis/shareholder/relation', params);
379
- }
380
- /**
381
- * Get shareholder composition.
382
- */
383
- async getShareholder(code) {
384
- return this.client.get(`/analysis/shareholder/${code}`);
385
- }
386
- /**
387
- * Get KSEI shareholder data.
388
- */
389
- async getShareholderKSEI(code, range) {
390
- return this.client.get(`/analysis/shareholder/ksei/${code}`, {
391
- range: Math.min(range, 12),
392
- });
197
+ class BatchResource {
198
+ transport;
199
+ constructor(transport) {
200
+ this.transport = transport;
393
201
  }
394
- /**
395
- * Get broker summary for a stock.
396
- */
397
- async getBrokerSummaryStock(code, params) {
398
- return this.client.get(`/analysis/summary/stock/${code}`, params);
399
- }
400
- /**
401
- * Get broker summary for a broker.
402
- */
403
- async getBrokerSummaryBroker(code, params) {
404
- return this.client.get(`/analysis/summary/broker/${code}`, params);
405
- }
406
- /**
407
- * Get sector stalker data.
408
- */
409
- async getStalkerSector(params) {
410
- return this.client.get('/analysis/stalker/sector', params);
411
- }
412
- /**
413
- * Get sector rotation chart.
414
- */
415
- async getSectorRotation(params) {
416
- return this.client.get('/analysis/sector/rotation', params);
417
- }
418
- /**
419
- * Get broker stalker data for a stock.
420
- */
421
- async getBrokerStalker(broker, stock, params) {
422
- return this.client.get(`/analysis/stalker/broker/${broker}/${stock}`, params);
423
- }
424
- /**
425
- * Get broker stalker list.
426
- */
427
- async getBrokerStalkerList(code, params) {
428
- return this.client.get(`/analysis/stalker/list/${code}`, params);
429
- }
430
- /**
431
- * Get broker summary chart for a stock.
432
- */
433
- async getBrokerSummaryChartStock(code, params) {
434
- return this.client.get(`/analysis/summary-chart/stock/${code}`, params);
435
- }
436
- /**
437
- * Get broker summary chart for a broker.
438
- */
439
- async getBrokerSummaryChartBroker(code, params) {
440
- return this.client.get(`/analysis/summary-chart/broker/${code}`, params);
441
- }
442
- /**
443
- * Get inventory chart for a stock.
444
- */
445
- async getInventoryChartStock(code, params) {
446
- return this.client.get(`/analysis/inventory-chart/stock/${code}`, params);
447
- }
448
- /**
449
- * Get inventory chart for a broker.
450
- */
451
- async getInventoryChartBroker(code, params) {
452
- return this.client.get(`/analysis/inventory-chart/broker/${code}`, params);
453
- }
454
- /**
455
- * Get momentum chart.
456
- */
457
- async getMomentumChart(code, params) {
458
- return this.client.get(`/analysis/momentum-chart/${code}`, params);
459
- }
460
- /**
461
- * Get intraday inventory chart.
462
- */
463
- async getIntradayInventoryChart(code, params) {
464
- return this.client.get(`/analysis/intraday-inventory-chart/${code}`, params);
465
- }
466
- /**
467
- * Get distribution or crossing chart.
468
- */
469
- async getSankeyChart(code, params) {
470
- return this.client.get(`/analysis/sankey-chart/${code}`, params);
471
- }
472
- /**
473
- * Get price table.
474
- */
475
- async getPriceTable(code, date) {
476
- return this.client.get(`/analysis/price-table/${code}`, { date });
477
- }
478
- /**
479
- * Get time table.
480
- */
481
- async getTimeTable(code, params) {
482
- return this.client.get(`/analysis/time-table/${code}`, params);
483
- }
484
- /**
485
- * Get price diary.
486
- */
487
- async getPriceDiary(code) {
488
- return this.client.get(`/analysis/price-diary/${code}`);
489
- }
490
- /**
491
- * Get price seasonality.
492
- */
493
- async getPriceSeasonality(code, range) {
494
- return this.client.get(`/analysis/price-seasonality/${code}`, {
495
- range: Math.min(range, 60),
496
- });
202
+ getOrderBook(code, params, options) {
203
+ return this.transport.request({ method: 'GET', route: '/batch/order-book/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
497
204
  }
498
- /**
499
- * Get shareholders above 5%.
500
- */
501
- async getShareholderAbove(params) {
502
- return this.client.get('/analysis/shareholder-above', params);
503
- }
504
- /**
505
- * Get shareholder above 5% chart.
506
- */
507
- async getShareholderAboveChart(code, params) {
508
- return this.client.get(`/analysis/shareholder-above-chart/${code}`, params);
509
- }
510
- /**
511
- * Get shareholders above 1%.
512
- */
513
- async getShareholderOne(params) {
514
- return this.client.get('/analysis/shareholder-one', params);
515
- }
516
- /**
517
- * Get shareholder above 1% chart.
518
- */
519
- async getShareholderOneChart(code, params) {
520
- return this.client.get(`/analysis/shareholder-one-chart/${code}`, params);
521
- }
522
- /**
523
- * Get insider trading data.
524
- */
525
- async getInsiderTrading(params) {
526
- return this.client.get('/analysis/shareholder-insider', params);
527
- }
528
- /**
529
- * Get insider chart.
530
- */
531
- async getInsiderChart(code, params) {
532
- return this.client.get(`/analysis/insider-chart/${code}`, params);
533
- }
534
- /**
535
- * Get financial statement.
536
- */
537
- async getFinancialStatement(code, params) {
538
- return this.client.get(`/analysis/financial-statement/${code}`, { ...params, limit: Math.min(params.limit, 20) });
539
- }
540
- /**
541
- * Get financial statement chart.
542
- */
543
- async getFinancialStatementChart(code, params) {
544
- return this.client.get(`/analysis/financial-statement-chart/${code}`, { ...params, limit: Math.min(params.limit, 20) });
545
- }
546
- /**
547
- * Get key statistics.
548
- */
549
- async getKeyStat(code, params) {
550
- return this.client.get(`/analysis/keystat/${code}`, {
551
- ...params,
552
- limit: Math.min(params.limit, 20),
553
- });
205
+ getIntradayData(code, params, options) {
206
+ return this.transport.request({ method: 'GET', route: '/batch/intraday-data/{code}', cache: 'realtime', pathParams: { code }, query: params }, options);
554
207
  }
555
- /**
556
- * Get key statistics chart.
557
- */
558
- async getKeyStatChart(code, params) {
559
- return this.client.get(`/analysis/keystat-chart/${code}`, {
560
- ...params,
561
- limit: Math.min(params.limit, 20),
562
- });
208
+ getIntradayIndex(code, options) {
209
+ return this.transport.request({ method: 'GET', route: '/batch/intraday-index/{code}', cache: 'realtime', pathParams: { code } }, options);
563
210
  }
564
- /**
565
- * Get corporate action calendar.
566
- */
567
- async getCalendar(params) {
568
- return this.client.get('/analysis/calendar', params);
569
- }
570
- /**
571
- * Alias for getCalendar.
572
- */
573
- async getCorporateActionCalendar(params) {
574
- return this.getCalendar(params);
575
- }
576
- /**
577
- * Get multi-timeframe chart data for stocks or indexes.
578
- */
579
- async getMultiTimeChart(code, params) {
580
- return this.client.get(`/analysis/chart/multi-time/${code}`, params);
581
- }
582
- /**
583
- * Get high concentration stock ownership data for all issuers.
584
- */
585
- async getShareholderHigh() {
586
- return this.client.get('/analysis/shareholder/high');
587
- }
588
- /**
589
- * Get complete shareholder data with all investor classifications for a specific period.
590
- */
591
- async getShareholderClassification(code, range) {
592
- return this.client.get(`/analysis/shareholder/classification/${code}`, { range: Math.min(range, 36) });
593
- }
594
- /**
595
- * Get latest shareholder data with investor classifications in table format.
596
- */
597
- async getShareholderClassifyTable(code) {
598
- return this.client.get(`/analysis/shareholder/classify-table/${code}`);
599
- }
600
- /**
601
- * Get order queue (order tracking) for a stock at a specific price, side, page, and limit.
602
- */
603
- async getOrderQueue(code, params) {
604
- return this.client.get(`/analysis/queue/${code}`, params);
605
- }
606
- /**
607
- * Get realtime/historical running trade transaction data for a specific stock code.
608
- *
609
- * @param code Stock code (e.g. 'BBCA')
610
- * @param params Query parameters including date (YYYY-MM-DD), page, limit, type, orderby, etc.
611
- */
612
- async getRunningTrade(code, params) {
613
- return this.client.get(`/analysis/running-trade/${code}`, params);
614
- }
615
- /**
616
- * Alias for getRunningTrade.
617
- */
618
- async getStockRunningTrade(code, params) {
619
- return this.getRunningTrade(code, params);
211
+ }
212
+ class SearchResource {
213
+ transport;
214
+ constructor(transport) {
215
+ this.transport = transport;
216
+ }
217
+ search(params, options) {
218
+ return this.transport.request({ method: 'GET', route: '/search', cache: 'default', query: params }, options);
219
+ }
220
+ searchStock(params, options) {
221
+ return this.transport.request({ method: 'GET', route: '/search/stock', cache: 'default', query: params }, options);
222
+ }
223
+ searchUser(params, options) {
224
+ return this.transport.request({ method: 'GET', route: '/search/user', cache: 'default', query: params }, options);
620
225
  }
621
226
  }
622
-
623
- class WatchlistsEndpoints {
624
- constructor(client) {
625
- this.client = client;
626
- }
627
- /**
628
- * Get list of watchlists.
629
- */
630
- async list(group = 'null') {
631
- return this.client.get('/watchlists', { group });
632
- }
633
- /**
634
- * Add stock to watchlist.
635
- */
636
- async add(dto) {
637
- return this.client.post('/watchlists', dto);
638
- }
639
- /**
640
- * Delete watchlist entries.
641
- *
642
- * The current OpenAPI spec does not describe delete filters,
643
- * but the SDK keeps optional query params for batch deletion support.
644
- */
645
- async delete(params) {
646
- return this.client.delete('/watchlists', params);
647
- }
648
- /**
649
- * Get list of watchlist groups.
650
- */
651
- async listGroups() {
652
- return this.client.get('/watchlists/group');
653
- }
654
- /**
655
- * Add new watchlist group.
656
- */
657
- async addGroup(dto) {
658
- return this.client.post('/watchlists/group', dto);
659
- }
660
- /**
661
- * Update watchlist group.
662
- */
663
- async updateGroup(id, dto) {
664
- return this.client.put(`/watchlists/group/${id}`, dto);
665
- }
666
- /**
667
- * Delete watchlist group.
668
- */
669
- async deleteGroup(id) {
670
- return this.client.delete(`/watchlists/group/${id}`);
671
- }
672
- /**
673
- * Update watchlist.
674
- */
675
- async update(id, dto) {
676
- return this.client.put(`/watchlists/${id}`, dto);
677
- }
678
- /**
679
- * Update watchlist note.
680
- */
681
- async updateNote(id, dto) {
682
- return this.client.patch(`/watchlists/${id}`, dto);
227
+ class ScreenerResource {
228
+ transport;
229
+ constructor(transport) {
230
+ this.transport = transport;
231
+ }
232
+ screen(body, options) {
233
+ return this.transport.request({ method: 'POST', route: '/screener/screen', cache: 'none', body }, options);
234
+ }
235
+ list(options) {
236
+ return this.transport.request({ method: 'GET', route: '/screener', cache: 'default' }, options);
237
+ }
238
+ save(body, options) {
239
+ return this.transport.request({ method: 'POST', route: '/screener', cache: 'none', body }, options);
240
+ }
241
+ update(id, body, options) {
242
+ return this.transport.request({ method: 'PUT', route: '/screener/{id}', cache: 'none', pathParams: { id }, body }, options);
243
+ }
244
+ delete(id, options) {
245
+ return this.transport.request({ method: 'DELETE', route: '/screener/{id}', cache: 'none', pathParams: { id } }, options);
683
246
  }
684
247
  }
685
-
686
- class JournalsEndpoints {
687
- constructor(client) {
688
- this.client = client;
689
- }
690
- /**
691
- * Extract journal transactions from uploaded file.
692
- */
693
- async extractFromFile(file) {
694
- const formData = new FormData();
695
- formData.append('file', file);
696
- const url = `${this.client.baseURL}/journals/file`;
697
- const response = await fetch(url, {
698
- method: 'POST',
699
- headers: {
700
- Authorization: `Bearer ${this.client.apiKey}`,
701
- },
702
- body: formData,
703
- });
704
- if (!response.ok) {
705
- const data = (await response.json().catch(() => ({})));
706
- throw new InvezgoError(response.status, data.message || 'Failed to extract journal from file', data.error, data);
707
- }
708
- return response.json().catch(() => ({}));
709
- }
710
- /**
711
- * Add new journal transaction.
712
- */
713
- async add(dto) {
714
- return this.client.post('/journals', dto);
715
- }
716
- /**
717
- * List journal transactions.
718
- */
719
- async list() {
720
- return this.client.get('/journals');
721
- }
722
- /**
723
- * Delete journal entries.
724
- *
725
- * The current OpenAPI spec does not describe delete filters,
726
- * but the SDK keeps optional query params for batch deletion support.
727
- */
728
- async delete(params) {
729
- return this.client.delete('/journals', params);
730
- }
731
- /**
732
- * Get journal transactions summary.
733
- */
734
- async getSummary() {
735
- return this.client.get('/journals/summary');
736
- }
737
- /**
738
- * Update journal transaction note.
739
- */
740
- async updateNote(id, dto) {
741
- return this.client.patch(`/journals/${id}`, dto);
248
+ class UsageResource {
249
+ transport;
250
+ constructor(transport) {
251
+ this.transport = transport;
252
+ }
253
+ getApiUsage(options) {
254
+ return this.transport.request({ method: 'GET', route: '/usage/api', cache: 'none' }, options);
255
+ }
256
+ getLogs(params, options) {
257
+ return this.transport.request({ method: 'GET', route: '/usage/logs', cache: 'none', query: params }, options);
742
258
  }
743
259
  }
744
-
745
- class PortfoliosEndpoints {
746
- constructor(client) {
747
- this.client = client;
748
- }
749
- /**
750
- * Get list of portfolios
751
- */
752
- async list() {
753
- return this.client.get('/portfolios');
754
- }
755
- /**
756
- * Get portfolio summary
757
- */
758
- async getSummary() {
759
- return this.client.get('/portfolios/summary');
260
+ class WatchlistsResource {
261
+ transport;
262
+ constructor(transport) {
263
+ this.transport = transport;
264
+ }
265
+ list(params, options) {
266
+ return this.transport.request({ method: 'GET', route: '/watchlists', cache: 'default', query: params }, options);
267
+ }
268
+ add(body, options) {
269
+ return this.transport.request({ method: 'POST', route: '/watchlists', cache: 'none', body }, options);
270
+ }
271
+ delete(body, options) {
272
+ return this.transport.request({ method: 'DELETE', route: '/watchlists', cache: 'none', body }, options);
273
+ }
274
+ listGroups(options) {
275
+ return this.transport.request({ method: 'GET', route: '/watchlists/group', cache: 'default' }, options);
276
+ }
277
+ addGroup(body, options) {
278
+ return this.transport.request({ method: 'POST', route: '/watchlists/group', cache: 'none', body }, options);
279
+ }
280
+ updateGroup(id, body, options) {
281
+ return this.transport.request({ method: 'PUT', route: '/watchlists/group/{id}', cache: 'none', pathParams: { id }, body }, options);
282
+ }
283
+ deleteGroup(id, options) {
284
+ return this.transport.request({ method: 'DELETE', route: '/watchlists/group/{id}', cache: 'none', pathParams: { id } }, options);
285
+ }
286
+ update(id, body, options) {
287
+ return this.transport.request({ method: 'PUT', route: '/watchlists/{id}', cache: 'none', pathParams: { id }, body }, options);
288
+ }
289
+ updateNote(id, body, options) {
290
+ return this.transport.request({ method: 'PATCH', route: '/watchlists/{id}', cache: 'none', pathParams: { id }, body }, options);
760
291
  }
761
292
  }
762
-
763
- class SearchEndpoints {
764
- constructor(client) {
765
- this.client = client;
766
- }
767
- /**
768
- * Search for stocks or users
769
- */
770
- async search(query) {
771
- return this.client.get('/search', { query });
772
- }
773
- /**
774
- * Search for stocks
775
- */
776
- async searchStock(query, cursor) {
777
- return this.client.get('/search/stock', { query, cursor });
778
- }
779
- /**
780
- * Search for users
781
- */
782
- async searchUser(query, cursor) {
783
- return this.client.get('/search/user', { query, cursor });
293
+ class JournalsResource {
294
+ transport;
295
+ constructor(transport) {
296
+ this.transport = transport;
297
+ }
298
+ add(body, options) {
299
+ return this.transport.request({ method: 'POST', route: '/journals', cache: 'none', body }, options);
300
+ }
301
+ list(params, options) {
302
+ return this.transport.request({ method: 'GET', route: '/journals', cache: 'default', query: params }, options);
303
+ }
304
+ delete(body, options) {
305
+ return this.transport.request({ method: 'DELETE', route: '/journals', cache: 'none', body }, options);
306
+ }
307
+ getSummary(params, options) {
308
+ return this.transport.request({ method: 'GET', route: '/journals/summary', cache: 'default', query: params }, options);
784
309
  }
785
310
  }
786
-
787
- class ProfileEndpoints {
788
- constructor(client) {
789
- this.client = client;
790
- }
791
- /**
792
- * Get user profile details
793
- */
794
- async getUserDetails(username) {
795
- return this.client.get(`/profile/detail/${username}`);
796
- }
797
- /**
798
- * Get user posts
799
- */
800
- async getUserPosts(username, page, limit) {
801
- return this.client.get(`/profile/posts/${username}`, { page, limit });
802
- }
803
- /**
804
- * Get user posts by category
805
- */
806
- async getCategoryPosts(username, category, page, limit) {
807
- return this.client.get(`/profile/posts/${username}/${category}`, { page, limit });
808
- }
809
- /**
810
- * Get user watchlist
811
- */
812
- async getUserWatchlist(username) {
813
- return this.client.get(`/profile/watchlist/${username}`);
814
- }
815
- /**
816
- * Get user followers
817
- */
818
- async getFollowers(username) {
819
- return this.client.get(`/profile/follow/${username}`);
820
- }
821
- /**
822
- * Get users being followed
823
- */
824
- async getFollowing(username) {
825
- return this.client.get(`/profile/following/${username}`);
826
- }
827
- /**
828
- * Get user memberships
829
- */
830
- async getMemberships(username) {
831
- return this.client.get(`/profile/membership/${username}`);
311
+ class PortfoliosResource {
312
+ transport;
313
+ constructor(transport) {
314
+ this.transport = transport;
315
+ }
316
+ list(options) {
317
+ return this.transport.request({ method: 'GET', route: '/portfolios', cache: 'default' }, options);
318
+ }
319
+ getSummary(options) {
320
+ return this.transport.request({ method: 'GET', route: '/portfolios/summary', cache: 'default' }, options);
832
321
  }
833
322
  }
834
-
835
- class MembershipEndpoints {
836
- constructor(client) {
837
- this.client = client;
838
- }
839
- /**
840
- * Get list of memberships.
841
- */
842
- async list() {
843
- return this.client.get('/membership');
844
- }
845
- /**
846
- * Add new membership.
847
- */
848
- async add(dto) {
849
- return this.client.post('/membership', dto);
850
- }
851
- /**
852
- * Get membership scopes.
853
- */
854
- async getScope() {
855
- return this.client.get('/membership/scope');
856
- }
857
- /**
858
- * Get membership transactions.
859
- */
860
- async getTransactions() {
861
- return this.client.get('/membership/list');
862
- }
863
- /**
864
- * Update membership.
865
- */
866
- async update(id, dto) {
867
- return this.client.put(`/membership/${id}`, dto);
868
- }
869
- /**
870
- * Delete membership.
871
- */
872
- async delete(id) {
873
- return this.client.delete(`/membership/${id}`);
323
+ class AlertsResource {
324
+ transport;
325
+ constructor(transport) {
326
+ this.transport = transport;
327
+ }
328
+ create(body, options) {
329
+ return this.transport.request({ method: 'POST', route: '/alerts', cache: 'none', body }, options);
330
+ }
331
+ list(options) {
332
+ return this.transport.request({ method: 'GET', route: '/alerts', cache: 'default' }, options);
333
+ }
334
+ test(body, options) {
335
+ return this.transport.request({ method: 'POST', route: '/alerts/test', cache: 'none', body }, options);
336
+ }
337
+ update(id, body, options) {
338
+ return this.transport.request({ method: 'PUT', route: '/alerts/{id}', cache: 'none', pathParams: { id }, body }, options);
339
+ }
340
+ delete(id, options) {
341
+ return this.transport.request({ method: 'DELETE', route: '/alerts/{id}', cache: 'none', pathParams: { id } }, options);
874
342
  }
875
343
  }
876
-
877
- class PostsEndpoints {
878
- constructor(client) {
879
- this.client = client;
880
- }
881
- /**
882
- * Get all posts
883
- */
884
- async getAll() {
885
- return this.client.get('/posts');
886
- }
887
- /**
888
- * Get posts by category
889
- */
890
- async getByCategory(category) {
891
- return this.client.get(`/posts/category/${category}`);
892
- }
893
- /**
894
- * Get posts for a stock
895
- */
896
- async getStockPosts(code) {
897
- return this.client.get(`/posts/space/${code}`);
898
- }
899
- /**
900
- * Get stock posts by category
901
- */
902
- async getStockCategoryPosts(code, category) {
903
- return this.client.get(`/posts/space/category/${code}/${category}`);
904
- }
905
- /**
906
- * Get post details
907
- */
908
- async getPostById(id) {
909
- return this.client.get(`/posts/detail/${id}`);
910
- }
911
- /**
912
- * Get post comments
913
- */
914
- async getComments(id) {
915
- return this.client.get(`/posts/comment/${id}`);
916
- }
917
- /**
918
- * Get liked posts
919
- */
920
- async getLiked() {
921
- return this.client.get('/posts/like');
922
- }
923
- /**
924
- * Get favorite posts
925
- */
926
- async getFavorites() {
927
- return this.client.get('/posts/favorite');
928
- }
929
- /**
930
- * Get post voters
931
- */
932
- async getVoters(id) {
933
- return this.client.get(`/posts/vote/${id}`);
344
+ class PostsResource {
345
+ transport;
346
+ constructor(transport) {
347
+ this.transport = transport;
348
+ }
349
+ list(params, options) {
350
+ return this.transport.request({ method: 'GET', route: '/posts', cache: 'default', query: params }, options);
351
+ }
352
+ listByCategory(category, params, options) {
353
+ return this.transport.request({ method: 'GET', route: '/posts/category/{category}', cache: 'default', pathParams: { category }, query: params }, options);
354
+ }
355
+ listByStock(code, params, options) {
356
+ return this.transport.request({ method: 'GET', route: '/posts/space/{code}', cache: 'default', pathParams: { code }, query: params }, options);
357
+ }
358
+ listByStockCategory(code, category, params, options) {
359
+ return this.transport.request({ method: 'GET', route: '/posts/space/category/{code}/{category}', cache: 'default', pathParams: { code, category }, query: params }, options);
360
+ }
361
+ get(id, options) {
362
+ return this.transport.request({ method: 'GET', route: '/posts/detail/{id}', cache: 'default', pathParams: { id } }, options);
363
+ }
364
+ getComments(id, params, options) {
365
+ return this.transport.request({ method: 'GET', route: '/posts/comment/{id}', cache: 'default', pathParams: { id }, query: params }, options);
366
+ }
367
+ getLikes(params, options) {
368
+ return this.transport.request({ method: 'GET', route: '/posts/like', cache: 'default', query: params }, options);
369
+ }
370
+ getFavorites(params, options) {
371
+ return this.transport.request({ method: 'GET', route: '/posts/favorite', cache: 'default', query: params }, options);
372
+ }
373
+ getVoters(id, options) {
374
+ return this.transport.request({ method: 'GET', route: '/posts/vote/{id}', cache: 'default', pathParams: { id } }, options);
934
375
  }
935
376
  }
936
-
937
- class RecommendationEndpoints {
938
- constructor(client) {
939
- this.client = client;
377
+ class TradesResource {
378
+ transport;
379
+ constructor(transport) {
380
+ this.transport = transport;
381
+ }
382
+ list(params, options) {
383
+ return this.transport.request({ method: 'GET', route: '/trades', cache: 'default', query: params }, options);
384
+ }
385
+ delete(body, options) {
386
+ return this.transport.request({ method: 'DELETE', route: '/trades', cache: 'none', body }, options);
940
387
  }
941
- /**
942
- * Get user recommendations.
943
- */
944
- async getUserRecommendations() {
945
- return this.client.get('/recommendation/user');
388
+ getSummary(params, options) {
389
+ return this.transport.request({ method: 'GET', route: '/trades/summary', cache: 'default', query: params }, options);
390
+ }
391
+ getSummaryChart(params, options) {
392
+ return this.transport.request({ method: 'GET', route: '/trades/summary-chart', cache: 'default', query: params }, options);
393
+ }
394
+ updateNote(id, body, options) {
395
+ return this.transport.request({ method: 'PATCH', route: '/trades/{id}', cache: 'none', pathParams: { id }, body }, options);
946
396
  }
947
397
  }
948
-
949
- class TradesEndpoints {
950
- constructor(client) {
951
- this.client = client;
952
- }
953
- /**
954
- * Get list of realized trades
955
- */
956
- async list() {
957
- return this.client.get('/trades');
958
- }
959
- /**
960
- * Delete trades
961
- */
962
- async delete(params) {
963
- return this.client.delete('/trades', params);
964
- }
965
- /**
966
- * Get trades summary
967
- */
968
- async getSummary() {
969
- return this.client.get('/trades/summary');
970
- }
971
- /**
972
- * Get trades summary chart
973
- */
974
- async getSummaryChart() {
975
- return this.client.get('/trades/summary-chart');
976
- }
977
- /**
978
- * Update trade note
979
- */
980
- async updateNote(id, dto) {
981
- return this.client.patch(`/trades/${id}`, dto);
398
+ class InvezgoResources {
399
+ analysis;
400
+ batch;
401
+ search;
402
+ screener;
403
+ usage;
404
+ watchlists;
405
+ journals;
406
+ portfolios;
407
+ alerts;
408
+ posts;
409
+ trades;
410
+ constructor(transport) {
411
+ this.analysis = new AnalysisResource(transport);
412
+ this.batch = new BatchResource(transport);
413
+ this.search = new SearchResource(transport);
414
+ this.screener = new ScreenerResource(transport);
415
+ this.usage = new UsageResource(transport);
416
+ this.watchlists = new WatchlistsResource(transport);
417
+ this.journals = new JournalsResource(transport);
418
+ this.portfolios = new PortfoliosResource(transport);
419
+ this.alerts = new AlertsResource(transport);
420
+ this.posts = new PostsResource(transport);
421
+ this.trades = new TradesResource(transport);
982
422
  }
983
423
  }
984
424
 
985
- class ScreenerEndpoints {
986
- constructor(client) {
987
- this.client = client;
988
- }
989
- /**
990
- * Get list of preset screeners.
991
- */
992
- async list() {
993
- return this.client.get('/screener');
994
- }
995
- /**
996
- * Save preset screener.
997
- */
998
- async save(dto) {
999
- return this.client.post('/screener', dto);
1000
- }
1001
- /**
1002
- * Update preset screener.
1003
- */
1004
- async update(id, dto) {
1005
- return this.client.put(`/screener/${id}`, dto);
1006
- }
1007
- /**
1008
- * Delete preset screener.
1009
- */
1010
- async delete(id) {
1011
- return this.client.delete(`/screener/${id}`);
1012
- }
1013
- /**
1014
- * Run screener.
1015
- */
1016
- async screen(dto) {
1017
- return this.client.post('/screener/screen', dto);
425
+ const encoder = new TextEncoder();
426
+ class LruCache {
427
+ maxEntries;
428
+ maxBytes;
429
+ now;
430
+ map = new Map();
431
+ totalBytes = 0;
432
+ constructor(maxEntries, maxBytes, now = () => performance.now()) {
433
+ this.maxEntries = maxEntries;
434
+ this.maxBytes = maxBytes;
435
+ this.now = now;
436
+ }
437
+ get size() {
438
+ return this.map.size;
439
+ }
440
+ get bytes() {
441
+ return this.totalBytes;
442
+ }
443
+ get(key) {
444
+ const entry = this.map.get(key);
445
+ if (!entry)
446
+ return undefined;
447
+ this.map.delete(key);
448
+ if (entry.expiresAt <= this.now()) {
449
+ this.totalBytes -= entry.size;
450
+ return undefined;
451
+ }
452
+ this.map.set(key, entry);
453
+ return entry.body;
454
+ }
455
+ set(key, body, ttlMs) {
456
+ const size = encoder.encode(body).length;
457
+ this.delete(key);
458
+ if (ttlMs <= 0 || size > this.maxBytes || this.maxEntries <= 0)
459
+ return;
460
+ this.map.set(key, { body, size, expiresAt: this.now() + ttlMs });
461
+ this.totalBytes += size;
462
+ for (const [oldest, entry] of this.map) {
463
+ if (this.map.size <= this.maxEntries && this.totalBytes <= this.maxBytes)
464
+ break;
465
+ this.map.delete(oldest);
466
+ this.totalBytes -= entry.size;
467
+ }
468
+ }
469
+ delete(key) {
470
+ const entry = this.map.get(key);
471
+ if (entry) {
472
+ this.map.delete(key);
473
+ this.totalBytes -= entry.size;
474
+ }
475
+ }
476
+ deleteWhere(predicate) {
477
+ for (const key of [...this.map.keys()])
478
+ if (predicate(key))
479
+ this.delete(key);
480
+ }
481
+ clear() {
482
+ this.map.clear();
483
+ this.totalBytes = 0;
1018
484
  }
1019
485
  }
1020
486
 
1021
- class UsageEndpoints {
1022
- constructor(client) {
1023
- this.client = client;
487
+ class InvezgoError extends Error {
488
+ status;
489
+ error;
490
+ requestId;
491
+ path;
492
+ body;
493
+ constructor(init) {
494
+ super(init.message, init.cause === undefined ? undefined : { cause: init.cause });
495
+ this.name = new.target.name;
496
+ this.status = init.status;
497
+ this.error = init.error;
498
+ this.requestId = init.requestId;
499
+ this.path = init.path;
500
+ this.body = init.body;
1024
501
  }
1025
- /**
1026
- * Get API usage statistics for the configured API key.
1027
- */
1028
- async getApiUsage() {
1029
- return this.client.get('/usage/api');
502
+ }
503
+ class ValidationError extends InvezgoError {
504
+ }
505
+ class AuthenticationError extends InvezgoError {
506
+ }
507
+ class PaymentRequiredError extends InvezgoError {
508
+ }
509
+ class NotFoundError extends InvezgoError {
510
+ }
511
+ class ServerError extends InvezgoError {
512
+ }
513
+ class RateLimitError extends InvezgoError {
514
+ retryAfter;
515
+ limit;
516
+ remaining;
517
+ reset;
518
+ quotaExceeded;
519
+ constructor(init) {
520
+ super(init);
521
+ this.retryAfter = init.retryAfter;
522
+ this.limit = init.limit;
523
+ this.remaining = init.remaining;
524
+ this.reset = init.reset;
525
+ this.quotaExceeded = init.quotaExceeded;
1030
526
  }
1031
527
  }
528
+ class ConnectionError extends InvezgoError {
529
+ }
530
+ class TimeoutError extends ConnectionError {
531
+ }
532
+ function errorClassFor(status) {
533
+ if (status === 400 || status === 422)
534
+ return ValidationError;
535
+ if (status === 401)
536
+ return AuthenticationError;
537
+ if (status === 402)
538
+ return PaymentRequiredError;
539
+ if (status === 404)
540
+ return NotFoundError;
541
+ if (status >= 500)
542
+ return ServerError;
543
+ return InvezgoError;
544
+ }
1032
545
 
1033
- class BatchEndpoints {
1034
- constructor(client) {
1035
- this.client = client;
1036
- }
1037
- formatCode(code) {
1038
- return Array.isArray(code) ? code.join('|') : code;
1039
- }
1040
- /**
1041
- * Get order book data for multiple stocks in a single request (max 3 for MAX, 10 for ELITE).
1042
- *
1043
- * @param code Stock codes (e.g. 'BBCA|GOTO|HUMI' or ['BBCA', 'GOTO', 'HUMI'])
1044
- * @param params Parameters including required market ('RG', 'NG', 'TN'), optional date, and time
1045
- */
1046
- async getOrderBook(code, params) {
1047
- const formattedCode = this.formatCode(code);
1048
- return this.client.get(`/batch/order-book/${formattedCode}`, params);
1049
- }
1050
- /**
1051
- * Alias for getOrderBook.
1052
- */
1053
- async getOrderBookBatch(code, params) {
1054
- return this.getOrderBook(code, params);
1055
- }
1056
- /**
1057
- * Get summary intraday price data for multiple stocks in a single request (max 3 for MAX, 10 for ELITE).
1058
- *
1059
- * @param code Stock codes (e.g. 'BBCA|GOTO|HUMI' or ['BBCA', 'GOTO', 'HUMI'])
1060
- * @param params Parameters including required market ('RG', 'NG', 'TN') and optional date
1061
- */
1062
- async getIntradayData(code, params) {
1063
- const formattedCode = this.formatCode(code);
1064
- return this.client.get(`/batch/intraday-data/${formattedCode}`, params);
1065
- }
1066
- /**
1067
- * Alias for getIntradayData.
1068
- */
1069
- async getIntradayDataBatch(code, params) {
1070
- return this.getIntradayData(code, params);
1071
- }
1072
- /**
1073
- * Get summary intraday price data for multiple indexes in a single request (max 3 for MAX, 10 for ELITE).
1074
- *
1075
- * @param code Index codes (e.g. 'COMPOSITE|LQ45|IDX30' or ['COMPOSITE', 'LQ45', 'IDX30'])
1076
- */
1077
- async getIntradayIndex(code) {
1078
- const formattedCode = this.formatCode(code);
1079
- return this.client.get(`/batch/intraday-index/${formattedCode}`);
1080
- }
1081
- /**
1082
- * Alias for getIntradayIndex.
1083
- */
1084
- async getIntradayIndexBatch(code) {
1085
- return this.getIntradayIndex(code);
546
+ const VERSION = '2.1.0';
547
+ const DEFAULT_BASE_URL = 'https://api.invezgo.com';
548
+ const PERSONAL_SEGMENTS = new Set(['watchlists', 'journals', 'portfolios', 'trades', 'alerts', 'screener']);
549
+ const QUOTA_MESSAGE = /quota|kuota|monthly|bulanan/i;
550
+ class Transport {
551
+ keys;
552
+ baseUrl;
553
+ timeout;
554
+ fetchImpl;
555
+ cache;
556
+ ttlMs = 0;
557
+ realtimeTtlMs = 0;
558
+ blocks = new Map();
559
+ constructor(config) {
560
+ if (!config || typeof config.apiKey !== 'string' || !config.apiKey.trim()) {
561
+ throw new TypeError('Invezgo: `apiKey` is required');
562
+ }
563
+ this.keys = [...new Set([config.apiKey, ...(config.additionalApiKeys ?? [])].filter((k) => !!k && !!k.trim()))];
564
+ this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, '');
565
+ this.timeout = config.timeout ?? 30_000;
566
+ const f = config.fetch ?? globalThis.fetch;
567
+ if (typeof f !== 'function')
568
+ throw new TypeError('Invezgo: global fetch is unavailable; pass `fetch` in the config (Node >= 18)');
569
+ this.fetchImpl = f;
570
+ if (config.cache !== false) {
571
+ const o = config.cache === true || config.cache === undefined ? {} : config.cache;
572
+ this.cache = new LruCache(o.maxEntries ?? 1000, o.maxBytes ?? 32 * 1024 * 1024);
573
+ this.ttlMs = (o.ttl ?? 60) * 1000;
574
+ this.realtimeTtlMs = (o.realtimeTtl ?? 5) * 1000;
575
+ }
576
+ }
577
+ clearCache() {
578
+ this.cache?.clear();
579
+ }
580
+ async request(spec, options) {
581
+ const path = spec.route.replace(/\{(\w+)\}/g, (_, name) => {
582
+ const value = spec.pathParams?.[name];
583
+ if (value === undefined || value === null || value === '')
584
+ throw new TypeError(`Invezgo: path parameter \`${name}\` is required`);
585
+ return encodeURIComponent(String(value));
586
+ });
587
+ const qs = canonicalQuery(spec.query);
588
+ const target = qs ? `${path}?${qs}` : path;
589
+ const ttl = spec.method !== 'GET' ? 0 : spec.cache === 'realtime' ? this.realtimeTtlMs : spec.cache === 'default' ? this.ttlMs : 0;
590
+ if (this.cache && ttl > 0) {
591
+ const hit = this.cache.get(target);
592
+ if (hit !== undefined)
593
+ return parseBody(hit);
594
+ }
595
+ const tried = new Set();
596
+ let last;
597
+ for (;;) {
598
+ const index = this.pickKey(spec.route, tried);
599
+ if (index < 0)
600
+ throw this.allKeysBlocked(spec.route, last);
601
+ tried.add(index);
602
+ const res = await this.send(index, spec, target, options);
603
+ const text = await res.text();
604
+ if (res.status === 429) {
605
+ last = this.rateLimited(index, spec.route, res, text);
606
+ continue;
607
+ }
608
+ if (!res.ok)
609
+ throw buildError(res, text);
610
+ let data;
611
+ try {
612
+ data = parseBody(text);
613
+ }
614
+ catch (cause) {
615
+ throw new InvezgoError({ status: res.status, message: 'Invezgo: response is not valid JSON', body: text, path, cause });
616
+ }
617
+ if (this.cache) {
618
+ if (ttl > 0)
619
+ this.cache.set(target, text, ttl);
620
+ else if (spec.method !== 'GET')
621
+ this.cache.deleteWhere((key) => PERSONAL_SEGMENTS.has(key.split(/[/?]/)[1]));
622
+ }
623
+ return data;
624
+ }
625
+ }
626
+ async send(index, spec, target, options) {
627
+ const headers = {
628
+ Authorization: `Bearer ${this.keys[index]}`,
629
+ Accept: 'application/json',
630
+ 'User-Agent': `invezgo-js-sdk/${VERSION}`,
631
+ };
632
+ let body;
633
+ if (spec.body !== undefined) {
634
+ headers['Content-Type'] = 'application/json';
635
+ body = JSON.stringify(spec.body);
636
+ }
637
+ const controller = new AbortController();
638
+ let timedOut = false;
639
+ const timer = setTimeout(() => {
640
+ timedOut = true;
641
+ controller.abort();
642
+ }, this.timeout);
643
+ const signal = options?.signal;
644
+ const onAbort = () => controller.abort(signal?.reason);
645
+ if (signal?.aborted)
646
+ onAbort();
647
+ else
648
+ signal?.addEventListener('abort', onAbort, { once: true });
649
+ try {
650
+ return await this.fetchImpl(this.baseUrl + target, { method: spec.method, headers, body, signal: controller.signal });
651
+ }
652
+ catch (cause) {
653
+ if (signal?.aborted)
654
+ throw cause;
655
+ if (timedOut)
656
+ throw new TimeoutError({ status: 0, message: `Invezgo: request timed out after ${this.timeout} ms`, path: target, cause });
657
+ throw new ConnectionError({ status: 0, message: `Invezgo: network error: ${cause?.message ?? cause}`, path: target, cause });
658
+ }
659
+ finally {
660
+ clearTimeout(timer);
661
+ signal?.removeEventListener('abort', onAbort);
662
+ }
663
+ }
664
+ blockedFor(index, route, now) {
665
+ let ms = 0;
666
+ let quota = false;
667
+ for (const [id, isQuota] of [[`${index}`, true], [`${index} ${route}`, false]]) {
668
+ const b = this.blocks.get(id);
669
+ if (!b)
670
+ continue;
671
+ if (b.until <= now)
672
+ this.blocks.delete(id);
673
+ else if (b.until - now > ms) {
674
+ ms = b.until - now;
675
+ quota = isQuota;
676
+ }
677
+ }
678
+ return { ms, quota };
679
+ }
680
+ pickKey(route, tried) {
681
+ const now = performance.now();
682
+ for (let i = 0; i < this.keys.length; i++) {
683
+ if (!tried.has(i) && this.blockedFor(i, route, now).ms === 0)
684
+ return i;
685
+ }
686
+ return -1;
687
+ }
688
+ rateLimited(index, route, res, text) {
689
+ const err = buildError(res, text);
690
+ const retryAfter = num(res.headers.get('retry-after'));
691
+ const reset = num(res.headers.get('x-ratelimit-reset'));
692
+ let wait = 60;
693
+ if (retryAfter !== undefined && retryAfter > 0)
694
+ wait = retryAfter;
695
+ else if (reset !== undefined && reset - Date.now() / 1000 > 0)
696
+ wait = reset - Date.now() / 1000;
697
+ const quota = QUOTA_MESSAGE.test(err.message);
698
+ this.blocks.set(quota ? `${index}` : `${index} ${route}`, { until: performance.now() + wait * 1000, quota });
699
+ return new RateLimitError({
700
+ status: 429,
701
+ message: err.message,
702
+ error: err.error,
703
+ requestId: err.requestId,
704
+ path: err.path,
705
+ body: err.body,
706
+ retryAfter: Math.ceil(wait),
707
+ limit: num(res.headers.get('x-ratelimit-limit')),
708
+ remaining: num(res.headers.get('x-ratelimit-remaining')),
709
+ reset,
710
+ quotaExceeded: quota,
711
+ });
712
+ }
713
+ allKeysBlocked(route, last) {
714
+ const now = performance.now();
715
+ let min = Infinity;
716
+ let allQuota = true;
717
+ for (let i = 0; i < this.keys.length; i++) {
718
+ const b = this.blockedFor(i, route, now);
719
+ min = Math.min(min, b.ms);
720
+ allQuota &&= b.quota;
721
+ }
722
+ const retryAfter = Math.max(0, Math.ceil((Number.isFinite(min) ? min : 0) / 1000));
723
+ if (last) {
724
+ return new RateLimitError({ ...last, message: last.message, retryAfter, quotaExceeded: last.quotaExceeded });
725
+ }
726
+ return new RateLimitError({
727
+ status: 429,
728
+ message: `Invezgo: all API keys are rate limited; retry in ${retryAfter}s`,
729
+ retryAfter,
730
+ quotaExceeded: allQuota,
731
+ });
1086
732
  }
1087
733
  }
734
+ function canonicalQuery(query) {
735
+ if (!query)
736
+ return '';
737
+ const entries = Object.entries(query)
738
+ .filter(([, v]) => v !== undefined && v !== null)
739
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
740
+ .map(([k, v]) => [k, String(v)]);
741
+ return new URLSearchParams(entries).toString();
742
+ }
743
+ function parseBody(text) {
744
+ return text.trim() === '' ? null : JSON.parse(text);
745
+ }
746
+ function num(value) {
747
+ if (value === null || value.trim() === '')
748
+ return undefined;
749
+ const n = Number(value);
750
+ return Number.isFinite(n) ? n : undefined;
751
+ }
752
+ function buildError(res, text) {
753
+ let body = text;
754
+ try {
755
+ body = text ? JSON.parse(text) : undefined;
756
+ }
757
+ catch {
758
+ }
759
+ const b = (typeof body === 'object' && body !== null ? body : {});
760
+ const msg = Array.isArray(b.message) ? b.message.join('; ') : typeof b.message === 'string' ? b.message : '';
761
+ const Cls = errorClassFor(res.status);
762
+ return new Cls({
763
+ status: res.status,
764
+ message: msg || res.statusText || `HTTP ${res.status}`,
765
+ error: typeof b.error === 'string' ? b.error : undefined,
766
+ requestId: typeof b.requestId === 'string' ? b.requestId : (res.headers.get('request-id') ?? undefined),
767
+ path: typeof b.path === 'string' ? b.path : undefined,
768
+ body,
769
+ });
770
+ }
1088
771
 
1089
- class Invezgo {
772
+ class Invezgo extends InvezgoResources {
773
+ #transport;
1090
774
  constructor(config) {
1091
- this.client = new HttpClient(config);
1092
- this.alerts = new AlertsEndpoints(this.client);
1093
- this.analysis = new AnalysisEndpoints(this.client);
1094
- this.watchlists = new WatchlistsEndpoints(this.client);
1095
- this.journals = new JournalsEndpoints(this.client);
1096
- this.portfolios = new PortfoliosEndpoints(this.client);
1097
- this.search = new SearchEndpoints(this.client);
1098
- this.profile = new ProfileEndpoints(this.client);
1099
- this.membership = new MembershipEndpoints(this.client);
1100
- this.posts = new PostsEndpoints(this.client);
1101
- this.recommendation = new RecommendationEndpoints(this.client);
1102
- this.trades = new TradesEndpoints(this.client);
1103
- this.screener = new ScreenerEndpoints(this.client);
1104
- this.usage = new UsageEndpoints(this.client);
1105
- this.batch = new BatchEndpoints(this.client);
1106
- }
1107
- /**
1108
- * Update API key.
1109
- */
1110
- setApiKey(apiKey) {
1111
- this.client.apiKey = apiKey;
1112
- }
1113
- /**
1114
- * Check whether an API key is currently configured.
1115
- */
1116
- hasApiKey() {
1117
- return !!this.client.apiKey;
775
+ const transport = new Transport(config);
776
+ super(transport);
777
+ this.#transport = transport;
778
+ }
779
+ clearCache() {
780
+ this.#transport.clearCache();
1118
781
  }
1119
782
  }
1120
783
 
1121
- /**
1122
- * Invezgo SDK for JavaScript and TypeScript.
1123
- *
1124
- * Official SDK for accessing Invezgo API.
1125
- *
1126
- * @packageDocumentation
1127
- */
1128
-
1129
- export { AlertsEndpoints, BatchEndpoints, Invezgo, InvezgoError, JournalsEndpoints, MembershipEndpoints, RecommendationEndpoints, ScreenerEndpoints, TradesEndpoints, UsageEndpoints, WatchlistsEndpoints, Invezgo as default };
784
+ exports.AlertsResource = AlertsResource;
785
+ exports.AnalysisResource = AnalysisResource;
786
+ exports.AuthenticationError = AuthenticationError;
787
+ exports.BatchResource = BatchResource;
788
+ exports.ConnectionError = ConnectionError;
789
+ exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL;
790
+ exports.Invezgo = Invezgo;
791
+ exports.InvezgoClient = Invezgo;
792
+ exports.InvezgoError = InvezgoError;
793
+ exports.InvezgoResources = InvezgoResources;
794
+ exports.JournalsResource = JournalsResource;
795
+ exports.NotFoundError = NotFoundError;
796
+ exports.PaymentRequiredError = PaymentRequiredError;
797
+ exports.PortfoliosResource = PortfoliosResource;
798
+ exports.PostsResource = PostsResource;
799
+ exports.RateLimitError = RateLimitError;
800
+ exports.ScreenerResource = ScreenerResource;
801
+ exports.SearchResource = SearchResource;
802
+ exports.ServerError = ServerError;
803
+ exports.TimeoutError = TimeoutError;
804
+ exports.TradesResource = TradesResource;
805
+ exports.UsageResource = UsageResource;
806
+ exports.VERSION = VERSION;
807
+ exports.ValidationError = ValidationError;
808
+ exports.WatchlistsResource = WatchlistsResource;
809
+ exports.default = Invezgo;
1130
810
  //# sourceMappingURL=index.js.map