API Reference

Instantiates a Standard SDK with your APIs of choice.

Parameters

The build method takes one argument which may have either or both of apiSpecs and sklEngineOptions.

ApiSpecOptions

ApiSpecOptions are the configurations you pass when building a Standard SDK for the APIs you want to work with. Different types of APIs have their own specific options. Currently we only support OpenAPI specs.

Return Value

A StandardSDK instance with a namespace for each key in apiSpecs. It may also have an skl property if sklEngineOptions was supplied.

Example Usage

In Typescript:

import ticketmasterOpenApiSpec from './path/to/ticketmaster-openapi-spec.json';

const standardSdk = StandardSDK.build({
  apiSpecs: {
    ticketmaster: {
      type: 'openapi',
      value: ticketmasterOpenApiSpec,
      defaultConfiguration: {
        apiKey: 'abc123'
      },
      defaultOptions: {
        headers: {
          'X-Powered-By': 'Comake'
        }
      }
    },
  },
});

A namespace of a StandardSDK instance corresponding to a set of supplied Api Spec Options. A namespace has a property for each operation in the supplied API specification. Each namespace also includes methods setDefaultConfiguration and setDefaultOptions to update the default configuration and options to all operations if the API.

Example Usage

In Typescript:

const sdkNamespace = standardSdk.ticketmaster;

Sets the default configuration for all operations of in an API namespace. When using an API described via an OpenAPI spec, the configuration parameter should be a OpenApiClientConfiguration object as defined in @comake/openapi-operation-executor.

Example Usage

In Typescript:

standardSdk.ticketmaster.setDefaultConfiguration({
  apiKey: 'acb123'
});

Sets the default options for all operations of in an API namespace. When using an API described via an OpenAPI spec, the options parameter should be an AxiosRequestConfig object as defined in the axios API documentation.

Example Usage

In Typescript:

standardSdk.ticketmaster.setDefaultOptions({
  headers: {
    'X-Powered-By': 'Comake'
  }
});

Executes the API operation called <operation> according to the API specification corresponding to the namespace <namespace>.

Parameters

All parameters are optional, however, when using Typescript and executing an OpenAPI operation with required parameters or request body, the args parameter will be required.

⚠️ StandardSDK uses the @comake/openapi-operation-executor package to execute OpenAPI operations. This library currently supports OpenAPI security types oauth2, apiKey, and http with schemes basic or bearer. See the OpenAPI Spec for reference and the @comake/openapi-operation-executor API docs for more information.

Return Value

Operations return Promises which resolve to different values depending on the type of API. OpenAPI operations will resolve to an AxiosResponse object.

Example Usage

In Typescript:

const axiosResponse = await standardSdk.ticketmaster.SearchEvents(
  { city: 'Atlanta' }, // args
  { apiKey: '<your ticketmaster api key>' }, // configuration
  { headers: { 'X-Origin-SDK': 'StandardSDK' } } // options
);

A SKL JS Engine instance which is instantiated when the sklEngineOptions parameter is supplied when Standard SDK is built.

Example Usage

In Typescript:

const skl = standardSdk.skl;

The Verb execution interface of the SKL JS Engine instance accessed through Standard SDK.

Example Usage

In Typescript:

const skl = standardSdk.skl.verb;

Executes the verb called <verb> according to its Schema and related Mappings in the Schemas provided to the SKL JS Engine instance via the sklEngineOptions parameter when building Standard SDK.

Parameters

Return Value

Verbs executed using SKL JS Engine return Promises which resolve to an AxiosResponse object.

Example Usage

In Typescript:

const response = standardSdk.skl.verb.getEvents({
  account: 'https://example.com/data/TicketmasterAccount',
  city: 'New York',
});

Last updated