Skip to content

Commit

Permalink
feat: update API models (#1031)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
- Removes authorization API client. Refer to the [SP-API
Deprecations](https://developer-docs.amazon.com/sp-api/docs/sp-api-deprecations)
table for more information.

Adds support for:

- Data Kiosk APi
- Fulfillment Inbound API (`v20240320`)
- Shipping API (`v2`)
- Supply Sources API

Closes #1021
Closes #1022
Closes #564

Co-authored-by: nguyentoanit <nguyentoanit@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and nguyentoanit committed Apr 3, 2024
1 parent 230e642 commit 3215b39
Show file tree
Hide file tree
Showing 59 changed files with 15,715 additions and 1,407 deletions.
14 changes: 14 additions & 0 deletions src/api-clients/application-management-api-client.ts
@@ -0,0 +1,14 @@
import { ApplicationsApi, Configuration } from '../api-models/application-management-api-model'
import { ApiClientHelpers } from '../helpers'
import { DEFAULT_API_BASE_PATH } from '../types'
import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters'

export class ApplicationManagementApiClient extends ApplicationsApi {
constructor(parameters: APIConfigurationParameters) {
const axios = ApiClientHelpers.getAxiosInstance(parameters)

const configuration = new Configuration(parameters)

super(configuration, DEFAULT_API_BASE_PATH, axios)
}
}
14 changes: 14 additions & 0 deletions src/api-clients/data-kiosk-api-client.ts
@@ -0,0 +1,14 @@
import { Configuration, QueriesApi } from '../api-models/data-kiosk-api-model'
import { ApiClientHelpers } from '../helpers'
import { DEFAULT_API_BASE_PATH } from '../types'
import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters'

export class DataKioskApiClient extends QueriesApi {
constructor(parameters: APIConfigurationParameters) {
const axios = ApiClientHelpers.getAxiosInstance(parameters)

const configuration = new Configuration(parameters)

super(configuration, DEFAULT_API_BASE_PATH, axios)
}
}
14 changes: 14 additions & 0 deletions src/api-clients/fulfillment-inbound-api-client-v20240320.ts
@@ -0,0 +1,14 @@
import { Configuration, FbaInboundApi } from '../api-models/fulfillment-inbound-api-model-v20240320'
import { ApiClientHelpers } from '../helpers'
import { DEFAULT_API_BASE_PATH } from '../types'
import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters'

export class FulfillmentInboundApiClientV20240320 extends FbaInboundApi {
constructor(parameters: APIConfigurationParameters) {
const axios = ApiClientHelpers.getAxiosInstance(parameters)

const configuration = new Configuration(parameters)

super(configuration, DEFAULT_API_BASE_PATH, axios)
}
}
7 changes: 5 additions & 2 deletions src/api-clients/index.ts
@@ -1,16 +1,17 @@
export * from './aplus-content-api-client'
export * from './authorization-api-client'
export * from './application-management-api-client'
export * from './catalog-items-api-client'
export * from './catalog-items-api-client-v20201201'
export * from './catalog-items-api-client-v20220401'
export * from './data-kiosk-api-client'
export * from './easy-ship-client'
export * from './fba-inbound-eligibility-api-client'
export * from './fba-inventory-api-client'
export * from './fba-small-and-light-api-client'
export * from './feeds-api-client'
export * from './feeds-api-client-v20210630'
export * from './finances-api-client'
export * from './fulfillment-inbound-api-client'
export * from './fulfillment-inbound-api-client-v20240320'
export * from './fulfillment-outbound-api-client'
export * from './listings-items-api-client'
export * from './listings-items-api-client-v20210801'
Expand All @@ -31,7 +32,9 @@ export * from './sellers-api-client'
export * from './services-api-client'
export * from './shipment-invoicing-api-client'
export * from './shipping-api-client'
export * from './shipping-api-client-v2'
export * from './solicitations-api-client'
export * from './supply-sources-api-client'
export * from './tokens-api-client'
export * from './uploads-api-client'
export * from './vendor-direct-fulfillment-inventory-api-client'
Expand Down
14 changes: 14 additions & 0 deletions src/api-clients/shipping-api-client-v2.ts
@@ -0,0 +1,14 @@
import { Configuration, ShippingApi } from '../api-models/shipping-api-model-v2'
import { ApiClientHelpers } from '../helpers'
import { DEFAULT_API_BASE_PATH } from '../types'
import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters'

export class ShippingApiClientV2 extends ShippingApi {
constructor(parameters: APIConfigurationParameters) {
const axios = ApiClientHelpers.getAxiosInstance(parameters)

const configuration = new Configuration(parameters)

super(configuration, DEFAULT_API_BASE_PATH, axios)
}
}
14 changes: 14 additions & 0 deletions src/api-clients/supply-sources-api-client.ts
@@ -0,0 +1,14 @@
import { Configuration, SupplySourcesApi } from '../api-models/supply-sources-api-model'
import { ApiClientHelpers } from '../helpers'
import { DEFAULT_API_BASE_PATH } from '../types'
import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters'

export class SupplySourcesApiClient extends SupplySourcesApi {
constructor(parameters: APIConfigurationParameters) {
const axios = ApiClientHelpers.getAxiosInstance(parameters)

const configuration = new Configuration(parameters)

super(configuration, DEFAULT_API_BASE_PATH, axios)
}
}
156 changes: 156 additions & 0 deletions src/api-models/application-management-api-model/api.ts
@@ -0,0 +1,156 @@
/* tslint:disable */
/* eslint-disable */
/**
* Selling Partner API for Application Management
* The Selling Partner API for Application Management lets you programmatically update the client secret on registered applications.
*
* The version of the OpenAPI document: 2023-11-30
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


import { Configuration } from './configuration';
import globalAxios, { AxiosPromise, AxiosInstance } 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, RequestArgs, BaseAPI, RequiredError } from './base';

/**
* A list of error responses returned when a request is unsuccessful.
* @export
* @interface ErrorList
*/
export interface ErrorList {
/**
* array of errors
* @type {Array<Error>}
* @memberof ErrorList
*/
errors: Array<Error>;
}
/**
* Error response returned when the request is unsuccessful.
* @export
* @interface ModelError
*/
export interface ModelError {
/**
* An error code that identifies the type of error that occurred.
* @type {string}
* @memberof ModelError
*/
code: string;
/**
* A message that describes the error condition.
* @type {string}
* @memberof ModelError
*/
message: string;
/**
* Additional details that can help the caller understand or fix the issue.
* @type {string}
* @memberof ModelError
*/
details?: string;
}

/**
* ApplicationsApi - axios parameter creator
* @export
*/
export const ApplicationsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Rotates application client secrets for a developer application. Developers must register a destination queue in the developer console before calling this operation. When this operation is called a new client secret is generated and sent to the developer-registered queue. For more information, refer to [Rotate your application client secret](https://developer-docs.amazon.com/sp-api/v0/docs/application-management-api-v2023-11-30-use-case-guide#tutorial-rotate-your-applications-client-secret). **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
rotateApplicationClientSecret: async (options: any = {}): Promise<RequestArgs> => {
const localVarPath = `/applications/2023-11-30/clientSecret`;
// 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;



setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};

/**
* ApplicationsApi - functional programming interface
* @export
*/
export const ApplicationsApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = ApplicationsApiAxiosParamCreator(configuration)
return {
/**
* Rotates application client secrets for a developer application. Developers must register a destination queue in the developer console before calling this operation. When this operation is called a new client secret is generated and sent to the developer-registered queue. For more information, refer to [Rotate your application client secret](https://developer-docs.amazon.com/sp-api/v0/docs/application-management-api-v2023-11-30-use-case-guide#tutorial-rotate-your-applications-client-secret). **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async rotateApplicationClientSecret(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.rotateApplicationClientSecret(options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
}
};

/**
* ApplicationsApi - factory interface
* @export
*/
export const ApplicationsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = ApplicationsApiFp(configuration)
return {
/**
* Rotates application client secrets for a developer application. Developers must register a destination queue in the developer console before calling this operation. When this operation is called a new client secret is generated and sent to the developer-registered queue. For more information, refer to [Rotate your application client secret](https://developer-docs.amazon.com/sp-api/v0/docs/application-management-api-v2023-11-30-use-case-guide#tutorial-rotate-your-applications-client-secret). **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
rotateApplicationClientSecret(options?: any): AxiosPromise<void> {
return localVarFp.rotateApplicationClientSecret(options).then((request) => request(axios, basePath));
},
};
};

/**
* ApplicationsApi - object-oriented interface
* @export
* @class ApplicationsApi
* @extends {BaseAPI}
*/
export class ApplicationsApi extends BaseAPI {
/**
* Rotates application client secrets for a developer application. Developers must register a destination queue in the developer console before calling this operation. When this operation is called a new client secret is generated and sent to the developer-registered queue. For more information, refer to [Rotate your application client secret](https://developer-docs.amazon.com/sp-api/v0/docs/application-management-api-v2023-11-30-use-case-guide#tutorial-rotate-your-applications-client-secret). **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 1 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApplicationsApi
*/
public rotateApplicationClientSecret(options?: any) {
return ApplicationsApiFp(this.configuration).rotateApplicationClientSecret(options).then((request) => request(this.axios, this.basePath));
}
}


71 changes: 71 additions & 0 deletions src/api-models/application-management-api-model/base.ts
@@ -0,0 +1,71 @@
/* tslint:disable */
/* eslint-disable */
/**
* Selling Partner API for Application Management
* The Selling Partner API for Application Management lets you programmatically update the client secret on registered applications.
*
* The version of the OpenAPI document: 2023-11-30
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


import { Configuration } from "./configuration";
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';

export const BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, "");

/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};

/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: any;
}

/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};

/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

0 comments on commit 3215b39

Please sign in to comment.