Skip to content

Commit

Permalink
feat: export default API version
Browse files Browse the repository at this point in the history
  • Loading branch information
vansergen committed Aug 28, 2020
1 parent beb77b1 commit 50d06e0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import FetchError from "./error";

export const ExanteDemoURL = "https://api-demo.exante.eu/";
export const ExanteLiveURL = "https://api-live.exante.eu/";
export const DefaultAPIVersion = "2.0";

export interface IExanteOptions {
client_id: string;
Expand Down Expand Up @@ -105,9 +106,9 @@ export class RestClient {
/**
* Get the list of user accounts and their statuses
*/
public async getAccounts({ version = "2.0" }: IVersion = {}): Promise<
IUserAccount[]
> {
public async getAccounts({
version = DefaultAPIVersion,
}: IVersion = {}): Promise<IUserAccount[]> {
const url = new URL(`/md/${version}/accounts`, this.url);
const accounts = (await this.fetch(url)) as IUserAccount[];
return accounts;
Expand All @@ -117,7 +118,7 @@ export class RestClient {
* Get the summary for the specified account.
*/
public async getAccountSummary({
version = "2.0",
version = DefaultAPIVersion,
id,
date,
currency,
Expand Down

0 comments on commit 50d06e0

Please sign in to comment.