laplace-api 1.1.1 → 1.1.3

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.3",
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> {
@@ -55,21 +55,13 @@ export interface LocaleString {
55
55
  [key: string]: string;
56
56
  }
57
57
 
58
- export interface StockDetail {
59
- id: string;
60
- assetType: AssetType;
58
+ export interface StockDetail extends Stock {
61
59
  assetClass: AssetClass;
62
- name: string;
63
- symbol: string;
64
60
  description: string;
65
61
  localized_description: LocaleString;
66
62
  shortDescription: string;
67
63
  localizedShortDescription: LocaleString;
68
64
  region: string;
69
- sectorId: string;
70
- industryId: string;
71
- updatedDate: string;
72
- active: boolean;
73
65
  markets: Market[];
74
66
  }
75
67
 
@@ -127,11 +119,15 @@ export interface TickSizeRule {
127
119
  }
128
120
 
129
121
  export class StockClient extends Client {
130
- async getAllStocks(region: Region): Promise<Stock[]> {
122
+ async getAllStocks(region: Region, page: number|null = null, pageSize: number|null = null): Promise<Stock[]> {
131
123
  return this.sendRequest<Stock[]>({
132
124
  method: 'GET',
133
- url: '/api/v1/stock/all',
134
- params: { region },
125
+ url: '/api/v2/stock/all',
126
+ params: {
127
+ region,
128
+ ...(page !== null ? { page } : {}),
129
+ ...(pageSize !== null ? { pageSize } : {}),
130
+ },
135
131
  });
136
132
  }
137
133
 
@@ -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();