@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
53 lines • 1.65 kB
TypeScript
import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
export interface AugurAPIConfig {
apiKey?: string;
bearerToken?: string;
siteId: string;
baseUrl?: string;
timeout?: number;
retries?: number;
retryDelay?: number;
onRequest?: (config: AxiosRequestConfig) => AxiosRequestConfig | Promise<AxiosRequestConfig>;
onResponse?: <T = unknown>(response: AxiosResponse<T>) => AxiosResponse<T> | Promise<AxiosResponse<T>>;
onError?: (error: AxiosError) => void | Promise<void>;
}
export interface RequestConfig {
timeout?: number;
signal?: AbortSignal;
headers?: Record<string, string>;
responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';
}
export declare const DEFAULT_CONFIG: {
timeout: number;
retries: number;
retryDelay: number;
};
export interface ServiceConfig {
name: string;
baseUrl: string;
}
/**
* Interface for context object containing authentication and site information
*/
export interface AugurContext {
/** Site identifier */
siteId: string;
/** JWT bearer token for authentication */
jwt?: string;
/** Alternative bearer token field */
bearerToken?: string;
/** Request parameters */
parameters?: Record<string, unknown>;
/** Filter parameters */
filters?: Record<string, unknown>;
/** User ID */
userId?: string | number;
}
/**
* Context creation error for invalid or missing context data
*/
export declare class ContextCreationError extends Error {
readonly field?: string | undefined;
constructor(message: string, field?: string | undefined);
}
//# sourceMappingURL=config.d.ts.map