Redesign
This commit is contained in:
@@ -44,8 +44,6 @@ export interface VINDecodeResponse {
|
||||
|
||||
export interface PlatformVehiclesClientConfig {
|
||||
baseURL: string;
|
||||
apiKey: string;
|
||||
tenantId?: string;
|
||||
timeout?: number;
|
||||
logger?: Logger;
|
||||
}
|
||||
@@ -58,27 +56,19 @@ export class PlatformVehiclesClient {
|
||||
private readonly httpClient: AxiosInstance;
|
||||
private readonly logger: Logger | undefined;
|
||||
private readonly circuitBreakers: Map<string, CircuitBreaker> = new Map();
|
||||
private readonly tenantId: string | undefined;
|
||||
|
||||
constructor(config: PlatformVehiclesClientConfig) {
|
||||
this.logger = config.logger;
|
||||
this.tenantId = config.tenantId || process.env.TENANT_ID;
|
||||
|
||||
|
||||
// Initialize HTTP client
|
||||
this.httpClient = axios.create({
|
||||
baseURL: config.baseURL,
|
||||
timeout: config.timeout || 3000,
|
||||
headers: {
|
||||
'Authorization': `Bearer ${config.apiKey}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
// Inject tenant header for all requests when available
|
||||
if (this.tenantId) {
|
||||
this.httpClient.defaults.headers.common['X-Tenant-ID'] = this.tenantId;
|
||||
}
|
||||
|
||||
// Setup response interceptors for logging
|
||||
this.httpClient.interceptors.response.use(
|
||||
(response) => {
|
||||
|
||||
Reference in New Issue
Block a user