shipstation-client
Version:
ShipStation V2 SDK
408 lines (367 loc) • 21.6 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 { DeletePickupByIdResponseBody } from '../models';
// @ts-ignore
import type { ErrorResponseBody } from '../models';
// @ts-ignore
import type { GetPickupByIdResponseBody } from '../models';
// @ts-ignore
import type { GetPickupsResponseBody } from '../models';
// @ts-ignore
import type { SchedulePickupRequestBody } from '../models';
// @ts-ignore
import type { SchedulePickupResponseBody1 } from '../models';
/**
* PackagePickupsApi - axios parameter creator
* @export
*/
export const PackagePickupsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Delete a previously-scheduled pickup by ID
* @summary Delete a scheduled pickup
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteScheduledPickup: async (pickupId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'pickupId' is not null or undefined
assertParamExists('deleteScheduledPickup', 'pickupId', pickupId)
const localVarPath = `/v2/pickups/{pickup_id}`
.replace(`{${"pickup_id"}}`, encodeURIComponent(String(pickupId)));
// 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,
};
},
/**
* Get Pickup By ID
* @summary Get pickup by id
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPickupById: async (pickupId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'pickupId' is not null or undefined
assertParamExists('getPickupById', 'pickupId', pickupId)
const localVarPath = `/v2/pickups/{pickup_id}`
.replace(`{${"pickup_id"}}`, encodeURIComponent(String(pickupId)));
// 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 pickups that have been scheduled for this carrier
* @summary List scheduled pickups
* @param {string} [carrierId] Carrier ID
* @param {string} [warehouseId] Warehouse ID
* @param {string} [createdAtStart] Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)
* @param {string} [createdAtEnd] Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pageSize] The number of results to return per response.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listScheduledPickups: async (carrierId?: string, warehouseId?: string, createdAtStart?: string, createdAtEnd?: string, page?: number, pageSize?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/v2/pickups`;
// 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)
if (carrierId !== undefined) {
localVarQueryParameter['carrier_id'] = carrierId;
}
if (warehouseId !== undefined) {
localVarQueryParameter['warehouse_id'] = warehouseId;
}
if (createdAtStart !== undefined) {
localVarQueryParameter['created_at_start'] = (createdAtStart as any instanceof Date) ?
(createdAtStart as any).toISOString() :
createdAtStart;
}
if (createdAtEnd !== undefined) {
localVarQueryParameter['created_at_end'] = (createdAtEnd as any instanceof Date) ?
(createdAtEnd as any).toISOString() :
createdAtEnd;
}
if (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (pageSize !== undefined) {
localVarQueryParameter['page_size'] = pageSize;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Schedule a package pickup with a carrier
* @summary Schedule a pickup
* @param {SchedulePickupRequestBody} schedulePickupRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
schedulePickup: async (schedulePickupRequestBody: SchedulePickupRequestBody, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'schedulePickupRequestBody' is not null or undefined
assertParamExists('schedulePickup', 'schedulePickupRequestBody', schedulePickupRequestBody)
const localVarPath = `/v2/pickups`;
// 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(schedulePickupRequestBody, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* PackagePickupsApi - functional programming interface
* @export
*/
export const PackagePickupsApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = PackagePickupsApiAxiosParamCreator(configuration)
return {
/**
* Delete a previously-scheduled pickup by ID
* @summary Delete a scheduled pickup
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async deleteScheduledPickup(pickupId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DeletePickupByIdResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteScheduledPickup(pickupId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['PackagePickupsApi.deleteScheduledPickup']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Get Pickup By ID
* @summary Get pickup by id
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getPickupById(pickupId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetPickupByIdResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getPickupById(pickupId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['PackagePickupsApi.getPickupById']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* List all pickups that have been scheduled for this carrier
* @summary List scheduled pickups
* @param {string} [carrierId] Carrier ID
* @param {string} [warehouseId] Warehouse ID
* @param {string} [createdAtStart] Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)
* @param {string} [createdAtEnd] Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pageSize] The number of results to return per response.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listScheduledPickups(carrierId?: string, warehouseId?: string, createdAtStart?: string, createdAtEnd?: string, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetPickupsResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listScheduledPickups(carrierId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['PackagePickupsApi.listScheduledPickups']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Schedule a package pickup with a carrier
* @summary Schedule a pickup
* @param {SchedulePickupRequestBody} schedulePickupRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async schedulePickup(schedulePickupRequestBody: SchedulePickupRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SchedulePickupResponseBody1>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.schedulePickup(schedulePickupRequestBody, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['PackagePickupsApi.schedulePickup']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* PackagePickupsApi - factory interface
* @export
*/
export const PackagePickupsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = PackagePickupsApiFp(configuration)
return {
/**
* Delete a previously-scheduled pickup by ID
* @summary Delete a scheduled pickup
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteScheduledPickup(pickupId: string, options?: RawAxiosRequestConfig): AxiosPromise<DeletePickupByIdResponseBody> {
return localVarFp.deleteScheduledPickup(pickupId, options).then((request) => request(axios, basePath));
},
/**
* Get Pickup By ID
* @summary Get pickup by id
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPickupById(pickupId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetPickupByIdResponseBody> {
return localVarFp.getPickupById(pickupId, options).then((request) => request(axios, basePath));
},
/**
* List all pickups that have been scheduled for this carrier
* @summary List scheduled pickups
* @param {string} [carrierId] Carrier ID
* @param {string} [warehouseId] Warehouse ID
* @param {string} [createdAtStart] Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)
* @param {string} [createdAtEnd] Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pageSize] The number of results to return per response.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listScheduledPickups(carrierId?: string, warehouseId?: string, createdAtStart?: string, createdAtEnd?: string, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): AxiosPromise<GetPickupsResponseBody> {
return localVarFp.listScheduledPickups(carrierId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, options).then((request) => request(axios, basePath));
},
/**
* Schedule a package pickup with a carrier
* @summary Schedule a pickup
* @param {SchedulePickupRequestBody} schedulePickupRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
schedulePickup(schedulePickupRequestBody: SchedulePickupRequestBody, options?: RawAxiosRequestConfig): AxiosPromise<SchedulePickupResponseBody1> {
return localVarFp.schedulePickup(schedulePickupRequestBody, options).then((request) => request(axios, basePath));
},
};
};
/**
* PackagePickupsApi - object-oriented interface
* @export
* @class PackagePickupsApi
* @extends {BaseAPI}
*/
export class PackagePickupsApi extends BaseAPI {
/**
* Delete a previously-scheduled pickup by ID
* @summary Delete a scheduled pickup
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PackagePickupsApi
*/
public deleteScheduledPickup(pickupId: string, options?: RawAxiosRequestConfig) {
return PackagePickupsApiFp(this.configuration).deleteScheduledPickup(pickupId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Get Pickup By ID
* @summary Get pickup by id
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PackagePickupsApi
*/
public getPickupById(pickupId: string, options?: RawAxiosRequestConfig) {
return PackagePickupsApiFp(this.configuration).getPickupById(pickupId, options).then((request) => request(this.axios, this.basePath));
}
/**
* List all pickups that have been scheduled for this carrier
* @summary List scheduled pickups
* @param {string} [carrierId] Carrier ID
* @param {string} [warehouseId] Warehouse ID
* @param {string} [createdAtStart] Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)
* @param {string} [createdAtEnd] Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pageSize] The number of results to return per response.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PackagePickupsApi
*/
public listScheduledPickups(carrierId?: string, warehouseId?: string, createdAtStart?: string, createdAtEnd?: string, page?: number, pageSize?: number, options?: RawAxiosRequestConfig) {
return PackagePickupsApiFp(this.configuration).listScheduledPickups(carrierId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, options).then((request) => request(this.axios, this.basePath));
}
/**
* Schedule a package pickup with a carrier
* @summary Schedule a pickup
* @param {SchedulePickupRequestBody} schedulePickupRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PackagePickupsApi
*/
public schedulePickup(schedulePickupRequestBody: SchedulePickupRequestBody, options?: RawAxiosRequestConfig) {
return PackagePickupsApiFp(this.configuration).schedulePickup(schedulePickupRequestBody, options).then((request) => request(this.axios, this.basePath));
}
}