UNPKG

@shipengine/connect

Version:

The official developer tooling for building ShipEngine connect apps

45 lines (44 loc) 1.34 kB
import { Method } from 'axios'; import Apps from './resources/apps'; import Deployments from './resources/deployments'; import Diagnostics from './resources/diagnostics'; import Sellers from './resources/sellers'; import Users from './resources/users'; import Configuration from './resources/configuration'; import Documents from './resources/documents'; export interface ApiClientParams { endpoint: string; method: Method; body?: object; headers?: object; isFileUpload?: boolean; } export declare enum ApiClientErrors { BadRequest = "ERR_BAD_REQUEST", NotFound = "ERR_NOT_FOUND", Unauthorized = "ERR_UNAUTHORIZED", InternalServerError = "ERR_INTERNAL_SERVER", UnhandledError = "ERR_UNHANDLED" } export interface ApiClientError { code: ApiClientErrors; message: string; } /** * Create an instance of the APIClient. * @param {string} apiKey A valid API key. */ export default class APIClient { apps: Apps; configuration: Configuration; deployments: Deployments; diagnostics: Diagnostics; sellers: Sellers; users: Users; documents: Documents; apiKey: string; private readonly debug; private _apiAuthority; constructor(apiKey: string, debug?: boolean); call<T>({ endpoint, method, body, headers, isFileUpload, }: ApiClientParams): Promise<T>; }