INNER CODE UNIT · TypeScript
initializeApiClient
gobii-ai/gobii-platform · misc/ts-example-client/src/index.ts:93
function initializeApiClient(apiKey: string, basePath?: string) {
if (!apiKey) {
console.error(`Error: API Key not found. Set the ${process.env.GOBII_API_KEY_ENV_VAR || 'GOBII_API_KEY'} environment variable.`);
process.exit(1);
}
// Create the configuration object
const configOptions: any = {
headers: {
'X-Api-Key': apiKey
}
};
// If basePath is provided, override the default path
if (basePath) {
configOptions.basePath = `${basePath}/api/v1`;
}