@agility/content-fetch
Version:
JS/TS library for the Agility Fetch API
50 lines (49 loc) • 1.58 kB
TypeScript
export interface Config {
/**
* The optional baseUrl for the API. If not provided, the API will use the default baseUrl for the instance.
* This is mostly used for testing purposes.
*/
baseUrl?: string | null;
/**
* If true, the API will use the Preview API. If false, it will use the Fetch API. Default is false.
* Make sure the API Key provided matches this value.
*/
isPreview?: boolean;
/**
* The guid that represents your instance.
*/
guid?: string | null;
/**
* The Fetch or Preview API key.
*/
apiKey?: string | null;
locale?: string | null;
/**
* Additional headers to include in the request.
*/
headers?: {
[key: string]: string;
};
requiresGuidInHeaders?: boolean;
/**
* The logging level. Default is 'warn'.
*/
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
/**
* Enable debug mode for detailed logging. Default is false.
* When enabled:
* - Adds comprehensive request/response logging with timing information
* - Includes response headers in the returned data as 'agilityResponseHeaders'
* - Logs error details including status codes, headers, and response bodies
* - Sanitizes sensitive data (API keys) in debug output
*/
debug?: boolean;
/**
* Optional Caching options. Caching is disabled by default.
* This is mostly used for Next.js and other server-side rendering frameworks.
*/
caching?: {
maxAge?: number;
};
fetchConfig?: any;
}