colorado-booth-sdk
v1.1.3
Published
test
Readme
Getting Started with MultiAuth-Sample
Introduction
API for Markdown Notes app.
Install the Package
Run the following command from your project directory to install the package from npm:
npm install [email protected]For additional package details, see the Npm page for the [email protected] npm.
Test the SDK
To validate the functionality of this SDK, you can execute all tests located in the test directory. This SDK utilizes Jest as both the testing framework and test runner.
To run the tests, navigate to the root directory of the SDK and execute the following command:
npm run testOr you can also run tests with coverage report:
npm run test:coverageInitialize the API Client
Note: Documentation for the client can be found here.
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
| accessToken2 | string | |
| port | string | Default: '80' |
| suites | SuiteCodeEnum | Default: SuiteCodeEnum.Hearts |
| environment | Environment | The API environment. Default: Environment.Testing |
| timeout | number | Timeout for API calls.Default: 0 |
| httpClientOptions | Partial<HttpClientOptions> | Stable configurable http client options. |
| unstableHttpClientOptions | any | Unstable configurable http client options. |
| basicAuthCredentials | BasicAuthCredentials | The credential object for basicAuth |
| apiKeyCredentials | ApiKeyCredentials | The credential object for apiKey |
| apiHeaderCredentials | ApiHeaderCredentials | The credential object for apiHeader |
| oAuthCCGCredentials | OAuthCCGCredentials | The credential object for oAuthCCG |
| oAuthACGCredentials | OAuthACGCredentials | The credential object for oAuthACG |
| oAuthROPCGCredentials | OAuthROPCGCredentials | The credential object for oAuthROPCG |
| oAuthBearerTokenCredentials | OAuthBearerTokenCredentials | The credential object for oAuthBearerToken |
The API client can be initialized as follows:
Code-Based Client Initialization
import {
Client,
Environment,
OAuthScopeOAuthACGEnum,
SuiteCodeEnum,
} from 'colorado-booth-sdk';
const client = new Client({
basicAuthCredentials: {
username: 'Username',
password: 'Password'
},
apiKeyCredentials: {
'token': 'token',
'api-key': 'api-key'
},
apiHeaderCredentials: {
'token': 'token',
'api-key': 'api-key'
},
oAuthCCGCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
oAuthACGCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret',
oAuthRedirectUri: 'OAuthRedirectUri',
oAuthScopes: [
OAuthScopeOAuthACGEnum.ReadScope
]
},
oAuthROPCGCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret',
oAuthUsername: 'OAuthUsername',
oAuthPassword: 'OAuthPassword'
},
oAuthBearerTokenCredentials: {
accessToken: 'AccessToken'
},
accessToken2: 'accessToken',
timeout: 0,
environment: Environment.Testing,
port: '80',
suites: SuiteCodeEnum.Hearts,
});Configuration-Based Client Initialization
import * as path from 'path';
import * as fs from 'fs';
import { Client } from 'colorado-booth-sdk';
// Provide absolute path for the configuration file
const absolutePath = path.resolve('./config.json');
// Read the configuration file content
const fileContent = fs.readFileSync(absolutePath, 'utf-8');
// Initialize client from JSON configuration content
const client = Client.fromJsonConfig(fileContent);See the Configuration-Based Client Initialization section for details.
Environment-Based Client Initialization
import * as dotenv from 'dotenv';
import * as path from 'path';
import * as fs from 'fs';
import { Client } from 'colorado-booth-sdk';
// Optional - Provide absolute path for the .env file
const absolutePath = path.resolve('./.env');
if (fs.existsSync(absolutePath)) {
// Load environment variables from .env file
dotenv.config({ path: absolutePath, override: true });
}
// Initialize client using environment variables
const client = Client.fromEnvironment(process.env);See the Environment-Based Client Initialization section for details.
Environments
The SDK can be configured to use a different environment for making API calls. Available environments are:
Fields
| Name | Description | | --- | --- | | Production | - | | Testing | Default |
Authorization
This API uses the following authentication schemes.
basicAuth (Basic Authentication)apiKey (Custom Query Parameter)apiHeader (Custom Header Signature)OAuthCCG (OAuth 2 Client Credentials Grant)OAuthACG (OAuth 2 Authorization Code Grant)OAuthROPCG (OAuth 2 Resource Owner Credentials Grant)OAuthBearerToken (OAuth 2 Bearer token)CustomAuth (Custom Authentication)
List of APIs
SDK Infrastructure
Configuration
- HttpClientOptions
- RetryConfiguration
- ProxySettings
- Configuration-Based Client Initialization
- Environment-Based Client Initialization
