data-and-reporting-sdk
Version:
Data And Reporting product consists of API's which provides details of transaction and invoice informations about shell cards. The Shell Card Transaction and Invoice API is REST-based and employs Basic authentication in Version 1 and Oauth authentication
42 lines (32 loc) • 1.41 kB
text/typescript
/**
* Shell Data & Reporting APIsLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
import { Client, Configuration, Environment } from '../src';
export const testClient = new Client(createConfigurationFromEnvironment());
function createConfigurationFromEnvironment(): Partial<Configuration> {
const config: Partial<Configuration> = {};
const environment = process.env.SHELL_DATA_REPORTING_AP_IS_LIB_ENVIRONMENT;
const timeout = process.env.SHELL_DATA_REPORTING_AP_IS_LIB_TIMEOUT;
const username = process.env.SHELL_DATA_REPORTING_AP_IS_LIB_USERNAME;
const password = process.env.SHELL_DATA_REPORTING_AP_IS_LIB_PASSWORD;
const oAuthClientId = process.env.SHELL_DATA_REPORTING_AP_IS_LIB_O_AUTH_CLIENT_ID;
const oAuthClientSecret = process.env.SHELL_DATA_REPORTING_AP_IS_LIB_O_AUTH_CLIENT_SECRET;
if (environment !== undefined) {
config.environment = environment as Environment;
}
if (timeout !== undefined && timeout !== '') {
config.timeout = parseInt(timeout);
}
if (username !== undefined && password !== undefined) {
config.basicAuthCredentials = { username: username, password: password };
}
if (oAuthClientId !== undefined && oAuthClientSecret !== undefined) {
config.bearerTokenCredentials = {
oAuthClientId: oAuthClientId,
oAuthClientSecret: oAuthClientSecret,
};
}
return config;
}