@umerx/umerx-blackdog-configurator-client-typescript
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -13,2 +13,19 @@ import { Response as ResponseTypes, Symbol as SymbolTypes, Strategy as StrategyTypes, StrategyLog as StrategyLogTypes, StrategyValue as StrategyValueTypes, Order as OrderTypes, Position as PositionTypes, StrategyTemplateSeaDogDiscountScheme as StrategyTemplateSeaDogDiscountSchemeTypes, } from '@umerx/umerx-blackdog-configurator-types-typescript'; | ||
} | ||
async function handleResponseErrors(func) { | ||
try { | ||
return await func(); | ||
} | ||
catch (e) { | ||
if (e instanceof AxiosError && undefined !== e?.status) { | ||
try { | ||
const errorResponse = ResponseTypes.ResponseBaseErrorFromRaw(e?.response?.data); | ||
throw new ClientResponseError(errorResponse.message, e.status, errorResponse); | ||
} | ||
catch (e2) { | ||
throw e; | ||
} | ||
} | ||
throw e; | ||
} | ||
} | ||
export class SymbolImpl { | ||
@@ -20,3 +37,3 @@ baseUrl; | ||
async getMany(query) { | ||
try { | ||
return handleResponseErrors(async () => { | ||
const response = await axios.get(`${this.baseUrl}/?${new URLSearchParams(Object.entries(query)).toString()}`); | ||
@@ -28,15 +45,3 @@ const responseBody = SymbolTypes.SymbolGetManyResponseBodyFromRaw(response.data); | ||
return responseBody; | ||
} | ||
catch (e) { | ||
if (e instanceof AxiosError && undefined !== e?.status) { | ||
try { | ||
const errorResponse = ResponseTypes.ResponseBaseErrorFromRaw(e?.response?.data); | ||
throw new ClientResponseError(errorResponse.message, e.status, errorResponse); | ||
} | ||
catch (e2) { | ||
throw e; | ||
} | ||
} | ||
throw e; | ||
} | ||
}); | ||
} | ||
@@ -66,8 +71,10 @@ async getSingle(params) { | ||
async getMany(query) { | ||
const response = await axios.get(`${this.baseUrl}/?${new URLSearchParams(Object.entries(query)).toString()}`); | ||
const responseBody = StrategyTypes.StrategyGetManyResponseBodyFromRaw(response.data); | ||
if (responseBody.status !== 'success') { | ||
throw new ClientResponseError(responseBody.message, response.status, responseBody); | ||
} | ||
return responseBody; | ||
return handleResponseErrors(async () => { | ||
const response = await axios.get(`${this.baseUrl}/?${new URLSearchParams(Object.entries(query)).toString()}`); | ||
const responseBody = StrategyTypes.StrategyGetManyResponseBodyFromRaw(response.data); | ||
if (responseBody.status !== 'success') { | ||
throw new ClientResponseError(responseBody.message, response.status, responseBody); | ||
} | ||
return responseBody; | ||
}); | ||
} | ||
@@ -74,0 +81,0 @@ async getSingle(params) { |
{ | ||
"name": "@umerx/umerx-blackdog-configurator-client-typescript", | ||
"private": false, | ||
"version": "0.0.32", | ||
"version": "0.0.33", | ||
"main": "build/index.js", | ||
@@ -6,0 +6,0 @@ "types": "build/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71095
557