@scaleleap/selling-partner-api-sdk
Version:
📦 A fully typed TypeScript and Node.js SDK library for Amazon Selling Partner API
171 lines • 14.3 kB
JavaScript
;
/* tslint:disable */
/* eslint-disable */
/**
* The Selling Partner API for Finances
* The Selling Partner API for Finances provides financial information relevant to a seller\'s business. You can obtain financial events for a given order or date range without having to wait until a statement period closes.
*
* The version of the OpenAPI document: 2024-06-19
*
*
* 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.DefaultApi = exports.DefaultApiFactory = exports.DefaultApiFp = exports.DefaultApiAxiosParamCreator = exports.RelatedIdentifierRelatedIdentifierNameEnum = exports.ItemRelatedIdentifierItemRelatedIdentifierNameEnum = 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");
/**
* @export
* @enum {string}
*/
var ItemRelatedIdentifierItemRelatedIdentifierNameEnum;
(function (ItemRelatedIdentifierItemRelatedIdentifierNameEnum) {
ItemRelatedIdentifierItemRelatedIdentifierNameEnum["OrderAdjustmentItemId"] = "ORDER_ADJUSTMENT_ITEM_ID";
ItemRelatedIdentifierItemRelatedIdentifierNameEnum["CouponId"] = "COUPON_ID";
ItemRelatedIdentifierItemRelatedIdentifierNameEnum["RemovalShipmentItemId"] = "REMOVAL_SHIPMENT_ITEM_ID";
ItemRelatedIdentifierItemRelatedIdentifierNameEnum["TransactionId"] = "TRANSACTION_ID";
})(ItemRelatedIdentifierItemRelatedIdentifierNameEnum || (exports.ItemRelatedIdentifierItemRelatedIdentifierNameEnum = ItemRelatedIdentifierItemRelatedIdentifierNameEnum = {}));
/**
* @export
* @enum {string}
*/
var RelatedIdentifierRelatedIdentifierNameEnum;
(function (RelatedIdentifierRelatedIdentifierNameEnum) {
RelatedIdentifierRelatedIdentifierNameEnum["OrderId"] = "ORDER_ID";
RelatedIdentifierRelatedIdentifierNameEnum["ShipmentId"] = "SHIPMENT_ID";
RelatedIdentifierRelatedIdentifierNameEnum["EventGroupId"] = "EVENT_GROUP_ID";
RelatedIdentifierRelatedIdentifierNameEnum["RefundId"] = "REFUND_ID";
RelatedIdentifierRelatedIdentifierNameEnum["InvoiceId"] = "INVOICE_ID";
RelatedIdentifierRelatedIdentifierNameEnum["DisbursementId"] = "DISBURSEMENT_ID";
RelatedIdentifierRelatedIdentifierNameEnum["TransferId"] = "TRANSFER_ID";
RelatedIdentifierRelatedIdentifierNameEnum["DeferredTransactionId"] = "DEFERRED_TRANSACTION_ID";
})(RelatedIdentifierRelatedIdentifierNameEnum || (exports.RelatedIdentifierRelatedIdentifierNameEnum = RelatedIdentifierRelatedIdentifierNameEnum = {}));
/**
* DefaultApi - axios parameter creator
* @export
*/
const DefaultApiAxiosParamCreator = function (configuration) {
return {
/**
* Returns transactions for the given parameters. Orders from the last 48 hours might not be included in financial events. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 10 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits).
* @param {string} postedAfter The response includes financial events posted after (or on) this date. This date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time must be more than two minutes before the time of the request.
* @param {string} [postedBefore] The response includes financial events posted before (but not on) this date. This date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time must be later than `PostedAfter` and more than two minutes before the request was submitted. If `PostedAfter` and `PostedBefore` are more than 180 days apart, the response is empty. **Default:** Two minutes before the time of the request.
* @param {string} [marketplaceId] The ID of the marketplace from which you want to retrieve transactions.
* @param {string} [nextToken] The response includes `nextToken` when the number of results exceeds the specified `pageSize` value. To get the next page of results, call the operation with this token and include the same arguments as the call that produced the token. To get a complete list, call this operation until `nextToken` is null. Note that this operation can return empty pages.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listTransactions: async (postedAfter, postedBefore, marketplaceId, nextToken, options = {}) => {
// verify required parameter 'postedAfter' is not null or undefined
(0, common_1.assertParamExists)('listTransactions', 'postedAfter', postedAfter);
const localVarPath = `/finances/2024-06-19/transactions`;
// 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 (postedAfter !== undefined) {
localVarQueryParameter['postedAfter'] = (postedAfter instanceof Date) ?
postedAfter.toISOString() :
postedAfter;
}
if (postedBefore !== undefined) {
localVarQueryParameter['postedBefore'] = (postedBefore instanceof Date) ?
postedBefore.toISOString() :
postedBefore;
}
if (marketplaceId !== undefined) {
localVarQueryParameter['marketplaceId'] = marketplaceId;
}
if (nextToken !== undefined) {
localVarQueryParameter['nextToken'] = nextToken;
}
(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.DefaultApiAxiosParamCreator = DefaultApiAxiosParamCreator;
/**
* DefaultApi - functional programming interface
* @export
*/
const DefaultApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.DefaultApiAxiosParamCreator)(configuration);
return {
/**
* Returns transactions for the given parameters. Orders from the last 48 hours might not be included in financial events. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 10 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits).
* @param {string} postedAfter The response includes financial events posted after (or on) this date. This date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time must be more than two minutes before the time of the request.
* @param {string} [postedBefore] The response includes financial events posted before (but not on) this date. This date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time must be later than `PostedAfter` and more than two minutes before the request was submitted. If `PostedAfter` and `PostedBefore` are more than 180 days apart, the response is empty. **Default:** Two minutes before the time of the request.
* @param {string} [marketplaceId] The ID of the marketplace from which you want to retrieve transactions.
* @param {string} [nextToken] The response includes `nextToken` when the number of results exceeds the specified `pageSize` value. To get the next page of results, call the operation with this token and include the same arguments as the call that produced the token. To get a complete list, call this operation until `nextToken` is null. Note that this operation can return empty pages.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listTransactions(postedAfter, postedBefore, marketplaceId, nextToken, options) {
const localVarAxiosArgs = await localVarAxiosParamCreator.listTransactions(postedAfter, postedBefore, marketplaceId, nextToken, options);
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
},
};
};
exports.DefaultApiFp = DefaultApiFp;
/**
* DefaultApi - factory interface
* @export
*/
const DefaultApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.DefaultApiFp)(configuration);
return {
/**
* Returns transactions for the given parameters. Orders from the last 48 hours might not be included in financial events. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 10 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits).
* @param {string} postedAfter The response includes financial events posted after (or on) this date. This date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time must be more than two minutes before the time of the request.
* @param {string} [postedBefore] The response includes financial events posted before (but not on) this date. This date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time must be later than `PostedAfter` and more than two minutes before the request was submitted. If `PostedAfter` and `PostedBefore` are more than 180 days apart, the response is empty. **Default:** Two minutes before the time of the request.
* @param {string} [marketplaceId] The ID of the marketplace from which you want to retrieve transactions.
* @param {string} [nextToken] The response includes `nextToken` when the number of results exceeds the specified `pageSize` value. To get the next page of results, call the operation with this token and include the same arguments as the call that produced the token. To get a complete list, call this operation until `nextToken` is null. Note that this operation can return empty pages.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listTransactions(postedAfter, postedBefore, marketplaceId, nextToken, options) {
return localVarFp.listTransactions(postedAfter, postedBefore, marketplaceId, nextToken, options).then((request) => request(axios, basePath));
},
};
};
exports.DefaultApiFactory = DefaultApiFactory;
/**
* DefaultApi - object-oriented interface
* @export
* @class DefaultApi
* @extends {BaseAPI}
*/
class DefaultApi extends base_1.BaseAPI {
/**
* Returns transactions for the given parameters. Orders from the last 48 hours might not be included in financial events. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 10 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits).
* @param {DefaultApiListTransactionsRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
listTransactions(requestParameters, options) {
return (0, exports.DefaultApiFp)(this.configuration).listTransactions(requestParameters.postedAfter, requestParameters.postedBefore, requestParameters.marketplaceId, requestParameters.nextToken, options).then((request) => request(this.axios, this.basePath));
}
}
exports.DefaultApi = DefaultApi;
//# sourceMappingURL=api.js.map