shipstation-client
Version:
ShipStation V2 SDK
199 lines (198 loc) • 9.53 kB
JavaScript
;
/* 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.TagsApi = exports.TagsApiFactory = exports.TagsApiFp = exports.TagsApiAxiosParamCreator = 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");
/**
* TagsApi - axios parameter creator
* @export
*/
const TagsApiAxiosParamCreator = function (configuration) {
return {
/**
* Create a new Tag for customizing how you track your shipments
* @summary Create a new tag
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createTag: (tagName_1, ...args_1) => __awaiter(this, [tagName_1, ...args_1], void 0, function* (tagName, options = {}) {
// verify required parameter 'tagName' is not null or undefined
(0, common_1.assertParamExists)('createTag', 'tagName', tagName);
const localVarPath = `/v2/tags/{tag_name}`
.replace(`{${"tag_name"}}`, encodeURIComponent(String(tagName)));
// 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);
(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,
};
}),
/**
* Get a list of all tags associated with an account.
* @summary Get tags
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listTags: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
const localVarPath = `/v2/tags`;
// 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,
};
}),
};
};
exports.TagsApiAxiosParamCreator = TagsApiAxiosParamCreator;
/**
* TagsApi - functional programming interface
* @export
*/
const TagsApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.TagsApiAxiosParamCreator)(configuration);
return {
/**
* Create a new Tag for customizing how you track your shipments
* @summary Create a new tag
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createTag(tagName, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.createTag(tagName, 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['TagsApi.createTag']) === 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);
});
},
/**
* Get a list of all tags associated with an account.
* @summary Get tags
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listTags(options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.listTags(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['TagsApi.listTags']) === 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.TagsApiFp = TagsApiFp;
/**
* TagsApi - factory interface
* @export
*/
const TagsApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.TagsApiFp)(configuration);
return {
/**
* Create a new Tag for customizing how you track your shipments
* @summary Create a new tag
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createTag(tagName, options) {
return localVarFp.createTag(tagName, options).then((request) => request(axios, basePath));
},
/**
* Get a list of all tags associated with an account.
* @summary Get tags
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listTags(options) {
return localVarFp.listTags(options).then((request) => request(axios, basePath));
},
};
};
exports.TagsApiFactory = TagsApiFactory;
/**
* TagsApi - object-oriented interface
* @export
* @class TagsApi
* @extends {BaseAPI}
*/
class TagsApi extends base_1.BaseAPI {
/**
* Create a new Tag for customizing how you track your shipments
* @summary Create a new tag
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TagsApi
*/
createTag(tagName, options) {
return (0, exports.TagsApiFp)(this.configuration).createTag(tagName, options).then((request) => request(this.axios, this.basePath));
}
/**
* Get a list of all tags associated with an account.
* @summary Get tags
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TagsApi
*/
listTags(options) {
return (0, exports.TagsApiFp)(this.configuration).listTags(options).then((request) => request(this.axios, this.basePath));
}
}
exports.TagsApi = TagsApi;