laplace-api 1.1.1 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laplace-api",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Client library for Laplace API for the US stock market and BIST (Istanbul stock market) fundamental financial data.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -67,13 +67,13 @@ export class CustomThemeClient extends Client {
67
67
  }
68
68
 
69
69
  async createCustomTheme(params: CreateCustomThemeParams): Promise<string> {
70
- const response = await this.sendRequest<string>({
70
+ const response = await this.sendRequest<{ id: string }>({
71
71
  method: 'POST',
72
72
  url: `/api/v1/custom-theme`,
73
73
  data: params,
74
74
  });
75
75
 
76
- return response;
76
+ return response.id;
77
77
  }
78
78
 
79
79
  async updateCustomTheme(id: string, params: UpdateCustomThemeParams): Promise<void> {
@@ -127,11 +127,15 @@ export interface TickSizeRule {
127
127
  }
128
128
 
129
129
  export class StockClient extends Client {
130
- async getAllStocks(region: Region): Promise<Stock[]> {
130
+ async getAllStocks(region: Region, page: number|null = null, pageSize: number|null = null): Promise<Stock[]> {
131
131
  return this.sendRequest<Stock[]>({
132
132
  method: 'GET',
133
- url: '/api/v1/stock/all',
134
- params: { region },
133
+ url: '/api/v2/stock/all',
134
+ params: {
135
+ region,
136
+ ...(page !== null ? { page } : {}),
137
+ ...(pageSize !== null ? { pageSize } : {}),
138
+ },
135
139
  });
136
140
  }
137
141
 
@@ -26,6 +26,13 @@ describe('Stocks', () => {
26
26
  expect(resp).not.toBeEmpty();
27
27
  });
28
28
 
29
+
30
+ test('GetAllStocksWithPagination', async () => {
31
+ const resp = await client.getAllStocks(Region.Tr, 10, 10);
32
+ expect(resp).not.toBeEmpty();
33
+ expect(resp.length).toBe(10);
34
+ });
35
+
29
36
  test('GetStockDetailByID', async () => {
30
37
  const resp = await client.getStockDetailById("61dd0d6f0ec2114146342fd0", Locale.Tr);
31
38
  expect(resp).not.toBeEmpty();