UNPKG

@scaleleap/selling-partner-api-sdk

Version:

📦 A fully typed TypeScript and Node.js SDK library for Amazon Selling Partner API

143 lines • 11.7 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * Selling Partner API for Authorization * The Selling Partner API for Authorization helps developers manage authorizations and check the specific permissions associated with a given authorization. * * The version of the OpenAPI document: v1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AuthorizationApi = exports.AuthorizationApiFactory = exports.AuthorizationApiFp = exports.AuthorizationApiAxiosParamCreator = void 0; const axios_1 = __importDefault(require("axios")); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("./common"); // @ts-ignore const base_1 = require("./base"); /** * AuthorizationApi - axios parameter creator * @export */ const AuthorizationApiAxiosParamCreator = function (configuration) { return { /** * With the getAuthorizationCode operation, you can request a Login With Amazon (LWA) authorization code that will allow you to call a Selling Partner API on behalf of a seller who has already authorized you to call Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an MWS auth token, and a seller ID. Taken together, these represent the Amazon MWS authorization that the seller previously granted you. The operation returns an LWA authorization code that can be exchanged for a refresh token and access token representing authorization to call the Selling Partner API on the seller\'s behalf. By using this API, sellers who have already authorized you for Amazon MWS do not need to re-authorize you for the Selling Partner API. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. * @summary Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization. * @param {string} sellingPartnerId The seller ID of the seller for whom you are requesting Selling Partner API authorization. This must be the seller ID of the seller who authorized your application on the Marketplace Appstore. * @param {string} developerId Your developer ID. This must be one of the developer ID values that you provided when you registered your application in Developer Central. * @param {string} mwsAuthToken The MWS Auth Token that was generated when the seller authorized your application on the Marketplace Appstore. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAuthorizationCode: async (sellingPartnerId, developerId, mwsAuthToken, options = {}) => { // verify required parameter 'sellingPartnerId' is not null or undefined (0, common_1.assertParamExists)('getAuthorizationCode', 'sellingPartnerId', sellingPartnerId); // verify required parameter 'developerId' is not null or undefined (0, common_1.assertParamExists)('getAuthorizationCode', 'developerId', developerId); // verify required parameter 'mwsAuthToken' is not null or undefined (0, common_1.assertParamExists)('getAuthorizationCode', 'mwsAuthToken', mwsAuthToken); const localVarPath = `/authorization/v1/authorizationCode`; // 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 = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {}; const localVarQueryParameter = {}; if (sellingPartnerId !== undefined) { localVarQueryParameter['sellingPartnerId'] = sellingPartnerId; } if (developerId !== undefined) { localVarQueryParameter['developerId'] = developerId; } if (mwsAuthToken !== undefined) { localVarQueryParameter['mwsAuthToken'] = mwsAuthToken; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; exports.AuthorizationApiAxiosParamCreator = AuthorizationApiAxiosParamCreator; /** * AuthorizationApi - functional programming interface * @export */ const AuthorizationApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.AuthorizationApiAxiosParamCreator)(configuration); return { /** * With the getAuthorizationCode operation, you can request a Login With Amazon (LWA) authorization code that will allow you to call a Selling Partner API on behalf of a seller who has already authorized you to call Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an MWS auth token, and a seller ID. Taken together, these represent the Amazon MWS authorization that the seller previously granted you. The operation returns an LWA authorization code that can be exchanged for a refresh token and access token representing authorization to call the Selling Partner API on the seller\'s behalf. By using this API, sellers who have already authorized you for Amazon MWS do not need to re-authorize you for the Selling Partner API. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. * @summary Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization. * @param {string} sellingPartnerId The seller ID of the seller for whom you are requesting Selling Partner API authorization. This must be the seller ID of the seller who authorized your application on the Marketplace Appstore. * @param {string} developerId Your developer ID. This must be one of the developer ID values that you provided when you registered your application in Developer Central. * @param {string} mwsAuthToken The MWS Auth Token that was generated when the seller authorized your application on the Marketplace Appstore. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAuthorizationCode(sellingPartnerId, developerId, mwsAuthToken, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.getAuthorizationCode(sellingPartnerId, developerId, mwsAuthToken, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, }; }; exports.AuthorizationApiFp = AuthorizationApiFp; /** * AuthorizationApi - factory interface * @export */ const AuthorizationApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.AuthorizationApiFp)(configuration); return { /** * With the getAuthorizationCode operation, you can request a Login With Amazon (LWA) authorization code that will allow you to call a Selling Partner API on behalf of a seller who has already authorized you to call Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an MWS auth token, and a seller ID. Taken together, these represent the Amazon MWS authorization that the seller previously granted you. The operation returns an LWA authorization code that can be exchanged for a refresh token and access token representing authorization to call the Selling Partner API on the seller\'s behalf. By using this API, sellers who have already authorized you for Amazon MWS do not need to re-authorize you for the Selling Partner API. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. * @summary Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization. * @param {string} sellingPartnerId The seller ID of the seller for whom you are requesting Selling Partner API authorization. This must be the seller ID of the seller who authorized your application on the Marketplace Appstore. * @param {string} developerId Your developer ID. This must be one of the developer ID values that you provided when you registered your application in Developer Central. * @param {string} mwsAuthToken The MWS Auth Token that was generated when the seller authorized your application on the Marketplace Appstore. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAuthorizationCode(sellingPartnerId, developerId, mwsAuthToken, options) { return localVarFp.getAuthorizationCode(sellingPartnerId, developerId, mwsAuthToken, options).then((request) => request(axios, basePath)); }, }; }; exports.AuthorizationApiFactory = AuthorizationApiFactory; /** * AuthorizationApi - object-oriented interface * @export * @class AuthorizationApi * @extends {BaseAPI} */ class AuthorizationApi extends base_1.BaseAPI { /** * With the getAuthorizationCode operation, you can request a Login With Amazon (LWA) authorization code that will allow you to call a Selling Partner API on behalf of a seller who has already authorized you to call Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an MWS auth token, and a seller ID. Taken together, these represent the Amazon MWS authorization that the seller previously granted you. The operation returns an LWA authorization code that can be exchanged for a refresh token and access token representing authorization to call the Selling Partner API on the seller\'s behalf. By using this API, sellers who have already authorized you for Amazon MWS do not need to re-authorize you for the Selling Partner API. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. * @summary Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization. * @param {AuthorizationApiGetAuthorizationCodeRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AuthorizationApi */ getAuthorizationCode(requestParameters, options) { return (0, exports.AuthorizationApiFp)(this.configuration).getAuthorizationCode(requestParameters.sellingPartnerId, requestParameters.developerId, requestParameters.mwsAuthToken, options).then((request) => request(this.axios, this.basePath)); } } exports.AuthorizationApi = AuthorizationApi; //# sourceMappingURL=api.js.map