shipstation-client
Version:
ShipStation V2 SDK
437 lines (394 loc) • 21.4 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* ShipStation API v2
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 2.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { CreateWebhookRequestBody } from '../models';
// @ts-ignore
import type { CreateWebhookResponseBody } from '../models';
// @ts-ignore
import type { ErrorResponseBody } from '../models';
// @ts-ignore
import type { GetWebhookByIdResponseBody } from '../models';
// @ts-ignore
import type { UpdateWebhookRequestBody } from '../models';
// @ts-ignore
import type { Webhook } from '../models';
/**
* WebhooksApi - axios parameter creator
* @export
*/
export const WebhooksApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Create a webook for specific events in the environment.
* @summary Create a webhook
* @param {CreateWebhookRequestBody} createWebhookRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createWebhook: async (createWebhookRequestBody: CreateWebhookRequestBody, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'createWebhookRequestBody' is not null or undefined
assertParamExists('createWebhook', 'createWebhookRequestBody', createWebhookRequestBody)
const localVarPath = `/v2/environment/webhooks`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(createWebhookRequestBody, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Delete a webhook
* @summary Delete webhook by id
* @param {string} webhookId Webhook ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteWebhook: async (webhookId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'webhookId' is not null or undefined
assertParamExists('deleteWebhook', 'webhookId', webhookId)
const localVarPath = `/v2/environment/webhooks/{webhook_id}`
.replace(`{${"webhook_id"}}`, encodeURIComponent(String(webhookId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Retrieve individual webhook by an ID
* @summary Get webhook by id
* @param {string} webhookId Webhook ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getWebhookById: async (webhookId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'webhookId' is not null or undefined
assertParamExists('getWebhookById', 'webhookId', webhookId)
const localVarPath = `/v2/environment/webhooks/{webhook_id}`
.replace(`{${"webhook_id"}}`, encodeURIComponent(String(webhookId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* List all webhooks currently enabled for the account.
* @summary List webhooks
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listWebhooks: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/v2/environment/webhooks`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Update the webhook url property
* @summary Update a webhook
* @param {string} webhookId Webhook ID
* @param {UpdateWebhookRequestBody} updateWebhookRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateWebhook: async (webhookId: string, updateWebhookRequestBody: UpdateWebhookRequestBody, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'webhookId' is not null or undefined
assertParamExists('updateWebhook', 'webhookId', webhookId)
// verify required parameter 'updateWebhookRequestBody' is not null or undefined
assertParamExists('updateWebhook', 'updateWebhookRequestBody', updateWebhookRequestBody)
const localVarPath = `/v2/environment/webhooks/{webhook_id}`
.replace(`{${"webhook_id"}}`, encodeURIComponent(String(webhookId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(updateWebhookRequestBody, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* WebhooksApi - functional programming interface
* @export
*/
export const WebhooksApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = WebhooksApiAxiosParamCreator(configuration)
return {
/**
* Create a webook for specific events in the environment.
* @summary Create a webhook
* @param {CreateWebhookRequestBody} createWebhookRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createWebhook(createWebhookRequestBody: CreateWebhookRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateWebhookResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createWebhook(createWebhookRequestBody, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhooksApi.createWebhook']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Delete a webhook
* @summary Delete webhook by id
* @param {string} webhookId Webhook ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async deleteWebhook(webhookId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteWebhook(webhookId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhooksApi.deleteWebhook']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Retrieve individual webhook by an ID
* @summary Get webhook by id
* @param {string} webhookId Webhook ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getWebhookById(webhookId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetWebhookByIdResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getWebhookById(webhookId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhooksApi.getWebhookById']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* List all webhooks currently enabled for the account.
* @summary List webhooks
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listWebhooks(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<Webhook>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listWebhooks(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhooksApi.listWebhooks']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Update the webhook url property
* @summary Update a webhook
* @param {string} webhookId Webhook ID
* @param {UpdateWebhookRequestBody} updateWebhookRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async updateWebhook(webhookId: string, updateWebhookRequestBody: UpdateWebhookRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.updateWebhook(webhookId, updateWebhookRequestBody, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['WebhooksApi.updateWebhook']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* WebhooksApi - factory interface
* @export
*/
export const WebhooksApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = WebhooksApiFp(configuration)
return {
/**
* Create a webook for specific events in the environment.
* @summary Create a webhook
* @param {CreateWebhookRequestBody} createWebhookRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createWebhook(createWebhookRequestBody: CreateWebhookRequestBody, options?: RawAxiosRequestConfig): AxiosPromise<CreateWebhookResponseBody> {
return localVarFp.createWebhook(createWebhookRequestBody, options).then((request) => request(axios, basePath));
},
/**
* Delete a webhook
* @summary Delete webhook by id
* @param {string} webhookId Webhook ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteWebhook(webhookId: string, options?: RawAxiosRequestConfig): AxiosPromise<string> {
return localVarFp.deleteWebhook(webhookId, options).then((request) => request(axios, basePath));
},
/**
* Retrieve individual webhook by an ID
* @summary Get webhook by id
* @param {string} webhookId Webhook ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getWebhookById(webhookId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetWebhookByIdResponseBody> {
return localVarFp.getWebhookById(webhookId, options).then((request) => request(axios, basePath));
},
/**
* List all webhooks currently enabled for the account.
* @summary List webhooks
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listWebhooks(options?: RawAxiosRequestConfig): AxiosPromise<Array<Webhook>> {
return localVarFp.listWebhooks(options).then((request) => request(axios, basePath));
},
/**
* Update the webhook url property
* @summary Update a webhook
* @param {string} webhookId Webhook ID
* @param {UpdateWebhookRequestBody} updateWebhookRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateWebhook(webhookId: string, updateWebhookRequestBody: UpdateWebhookRequestBody, options?: RawAxiosRequestConfig): AxiosPromise<string> {
return localVarFp.updateWebhook(webhookId, updateWebhookRequestBody, options).then((request) => request(axios, basePath));
},
};
};
/**
* WebhooksApi - object-oriented interface
* @export
* @class WebhooksApi
* @extends {BaseAPI}
*/
export class WebhooksApi extends BaseAPI {
/**
* Create a webook for specific events in the environment.
* @summary Create a webhook
* @param {CreateWebhookRequestBody} createWebhookRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhooksApi
*/
public createWebhook(createWebhookRequestBody: CreateWebhookRequestBody, options?: RawAxiosRequestConfig) {
return WebhooksApiFp(this.configuration).createWebhook(createWebhookRequestBody, options).then((request) => request(this.axios, this.basePath));
}
/**
* Delete a webhook
* @summary Delete webhook by id
* @param {string} webhookId Webhook ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhooksApi
*/
public deleteWebhook(webhookId: string, options?: RawAxiosRequestConfig) {
return WebhooksApiFp(this.configuration).deleteWebhook(webhookId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Retrieve individual webhook by an ID
* @summary Get webhook by id
* @param {string} webhookId Webhook ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhooksApi
*/
public getWebhookById(webhookId: string, options?: RawAxiosRequestConfig) {
return WebhooksApiFp(this.configuration).getWebhookById(webhookId, options).then((request) => request(this.axios, this.basePath));
}
/**
* List all webhooks currently enabled for the account.
* @summary List webhooks
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhooksApi
*/
public listWebhooks(options?: RawAxiosRequestConfig) {
return WebhooksApiFp(this.configuration).listWebhooks(options).then((request) => request(this.axios, this.basePath));
}
/**
* Update the webhook url property
* @summary Update a webhook
* @param {string} webhookId Webhook ID
* @param {UpdateWebhookRequestBody} updateWebhookRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof WebhooksApi
*/
public updateWebhook(webhookId: string, updateWebhookRequestBody: UpdateWebhookRequestBody, options?: RawAxiosRequestConfig) {
return WebhooksApiFp(this.configuration).updateWebhook(webhookId, updateWebhookRequestBody, options).then((request) => request(this.axios, this.basePath));
}
}