UNPKG

shipstation-client

Version:
412 lines (411 loc) 22.9 kB
"use strict"; /* 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. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebhooksApi = exports.WebhooksApiFactory = exports.WebhooksApiFp = exports.WebhooksApiAxiosParamCreator = void 0; const axios_1 = require("axios"); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("../common"); // @ts-ignore const base_1 = require("../base"); /** * WebhooksApi - axios parameter creator * @export */ const WebhooksApiAxiosParamCreator = function (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_1, ...args_1) => __awaiter(this, [createWebhookRequestBody_1, ...args_1], void 0, function* (createWebhookRequestBody, options = {}) { // verify required parameter 'createWebhookRequestBody' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createWebhookRequestBody, localVarRequestOptions, configuration); return { url: (0, common_1.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: (webhookId_1, ...args_1) => __awaiter(this, [webhookId_1, ...args_1], void 0, function* (webhookId, options = {}) { // verify required parameter 'webhookId' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.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: (webhookId_1, ...args_1) => __awaiter(this, [webhookId_1, ...args_1], void 0, function* (webhookId, options = {}) { // verify required parameter 'webhookId' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * List all webhooks currently enabled for the account. * @summary List webhooks * @param {*} [options] Override http request option. * @throws {RequiredError} */ listWebhooks: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) { const localVarPath = `/v2/environment/webhooks`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.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: (webhookId_1, updateWebhookRequestBody_1, ...args_1) => __awaiter(this, [webhookId_1, updateWebhookRequestBody_1, ...args_1], void 0, function* (webhookId, updateWebhookRequestBody, options = {}) { // verify required parameter 'webhookId' is not null or undefined (0, common_1.assertParamExists)('updateWebhook', 'webhookId', webhookId); // verify required parameter 'updateWebhookRequestBody' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(updateWebhookRequestBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; exports.WebhooksApiAxiosParamCreator = WebhooksApiAxiosParamCreator; /** * WebhooksApi - functional programming interface * @export */ const WebhooksApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.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} */ createWebhook(createWebhookRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.createWebhook(createWebhookRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['WebhooksApi.createWebhook']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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} */ deleteWebhook(webhookId, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteWebhook(webhookId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['WebhooksApi.deleteWebhook']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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} */ getWebhookById(webhookId, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.getWebhookById(webhookId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['WebhooksApi.getWebhookById']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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} */ listWebhooks(options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.listWebhooks(options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['WebhooksApi.listWebhooks']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.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} */ updateWebhook(webhookId, updateWebhookRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.updateWebhook(webhookId, updateWebhookRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['WebhooksApi.updateWebhook']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, }; }; exports.WebhooksApiFp = WebhooksApiFp; /** * WebhooksApi - factory interface * @export */ const WebhooksApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.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, options) { 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, options) { 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, options) { 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) { 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, updateWebhookRequestBody, options) { return localVarFp.updateWebhook(webhookId, updateWebhookRequestBody, options).then((request) => request(axios, basePath)); }, }; }; exports.WebhooksApiFactory = WebhooksApiFactory; /** * WebhooksApi - object-oriented interface * @export * @class WebhooksApi * @extends {BaseAPI} */ class WebhooksApi extends base_1.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 */ createWebhook(createWebhookRequestBody, options) { return (0, exports.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 */ deleteWebhook(webhookId, options) { return (0, exports.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 */ getWebhookById(webhookId, options) { return (0, exports.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 */ listWebhooks(options) { return (0, exports.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 */ updateWebhook(webhookId, updateWebhookRequestBody, options) { return (0, exports.WebhooksApiFp)(this.configuration).updateWebhook(webhookId, updateWebhookRequestBody, options).then((request) => request(this.axios, this.basePath)); } } exports.WebhooksApi = WebhooksApi;