diff --git a/src/lib/base.ts b/src/lib/base.ts index 98b61c3..a7c0902 100644 --- a/src/lib/base.ts +++ b/src/lib/base.ts @@ -8,10 +8,17 @@ export interface ApiResult { } export class BaseClient { + protected readonly baseUrl: string; + constructor( - protected readonly baseUrl: string, + baseUrl: string, protected readonly apiKey?: string - ) {} + ) { + const root = baseUrl.replace(/\/$/, ''); + this.baseUrl = root.endsWith('/api/v3') + ? root + : `${root}/api/v3`; + } /** * Handles the Envelope logic