@sp-api-sdk/vendor-invoices-api-v1 2.0.7 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,7 +76,9 @@ const VendorPaymentsApiFp = function (configuration) {
76
76
  */
77
77
  async submitInvoices(body, options) {
78
78
  const localVarAxiosArgs = await localVarAxiosParamCreator.submitInvoices(body, options);
79
- return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration);
79
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
80
+ const localVarOperationServerBasePath = base_1.operationServerMap['VendorPaymentsApi.submitInvoices']?.[localVarOperationServerIndex]?.url;
81
+ return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
80
82
  },
81
83
  };
82
84
  };
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  return (mod && mod.__esModule) ? mod : { "default": mod };
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
19
+ exports.operationServerMap = exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
20
20
  const axios_1 = __importDefault(require("axios"));
21
21
  exports.BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, "");
22
22
  /**
@@ -43,7 +43,7 @@ class BaseAPI {
43
43
  this.axios = axios;
44
44
  if (configuration) {
45
45
  this.configuration = configuration;
46
- this.basePath = configuration.basePath || this.basePath;
46
+ this.basePath = configuration.basePath ?? basePath;
47
47
  }
48
48
  }
49
49
  }
@@ -64,3 +64,8 @@ class RequiredError extends Error {
64
64
  }
65
65
  }
66
66
  exports.RequiredError = RequiredError;
67
+ /**
68
+ *
69
+ * @export
70
+ */
71
+ exports.operationServerMap = {};
@@ -138,7 +138,7 @@ exports.toPathString = toPathString;
138
138
  */
139
139
  const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
140
140
  return (axios = globalAxios, basePath = BASE_PATH) => {
141
- const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url };
141
+ const axiosRequestArgs = { ...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url };
142
142
  return axios.request(axiosRequestArgs);
143
143
  };
144
144
  };
@@ -49,6 +49,13 @@ class Configuration {
49
49
  * @memberof Configuration
50
50
  */
51
51
  basePath;
52
+ /**
53
+ * override server index
54
+ *
55
+ * @type {number}
56
+ * @memberof Configuration
57
+ */
58
+ serverIndex;
52
59
  /**
53
60
  * base options for axios calls
54
61
  *
@@ -70,6 +77,7 @@ class Configuration {
70
77
  this.password = param.password;
71
78
  this.accessToken = param.accessToken;
72
79
  this.basePath = param.basePath;
80
+ this.serverIndex = param.serverIndex;
73
81
  this.baseOptions = param.baseOptions;
74
82
  this.formDataCtor = param.formDataCtor;
75
83
  }
@@ -16,7 +16,7 @@ import globalAxios from 'axios';
16
16
  // @ts-ignore
17
17
  import { DUMMY_BASE_URL, assertParamExists, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
18
18
  // @ts-ignore
19
- import { BASE_PATH, BaseAPI } from '../base';
19
+ import { BASE_PATH, BaseAPI, operationServerMap } from '../base';
20
20
  /**
21
21
  * VendorPaymentsApi - axios parameter creator
22
22
  * @export
@@ -69,7 +69,9 @@ export const VendorPaymentsApiFp = function (configuration) {
69
69
  */
70
70
  async submitInvoices(body, options) {
71
71
  const localVarAxiosArgs = await localVarAxiosParamCreator.submitInvoices(body, options);
72
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
72
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
73
+ const localVarOperationServerBasePath = operationServerMap['VendorPaymentsApi.submitInvoices']?.[localVarOperationServerIndex]?.url;
74
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
73
75
  },
74
76
  };
75
77
  };
@@ -37,7 +37,7 @@ export class BaseAPI {
37
37
  this.axios = axios;
38
38
  if (configuration) {
39
39
  this.configuration = configuration;
40
- this.basePath = configuration.basePath || this.basePath;
40
+ this.basePath = configuration.basePath ?? basePath;
41
41
  }
42
42
  }
43
43
  }
@@ -56,3 +56,8 @@ export class RequiredError extends Error {
56
56
  this.name = "RequiredError";
57
57
  }
58
58
  }
59
+ /**
60
+ *
61
+ * @export
62
+ */
63
+ export const operationServerMap = {};
@@ -127,7 +127,7 @@ export const toPathString = function (url) {
127
127
  */
128
128
  export const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
129
129
  return (axios = globalAxios, basePath = BASE_PATH) => {
130
- const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url };
130
+ const axiosRequestArgs = { ...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url };
131
131
  return axios.request(axiosRequestArgs);
132
132
  };
133
133
  };
@@ -46,6 +46,13 @@ export class Configuration {
46
46
  * @memberof Configuration
47
47
  */
48
48
  basePath;
49
+ /**
50
+ * override server index
51
+ *
52
+ * @type {number}
53
+ * @memberof Configuration
54
+ */
55
+ serverIndex;
49
56
  /**
50
57
  * base options for axios calls
51
58
  *
@@ -67,6 +74,7 @@ export class Configuration {
67
74
  this.password = param.password;
68
75
  this.accessToken = param.accessToken;
69
76
  this.basePath = param.basePath;
77
+ this.serverIndex = param.serverIndex;
70
78
  this.baseOptions = param.baseOptions;
71
79
  this.formDataCtor = param.formDataCtor;
72
80
  }
@@ -10,11 +10,11 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import type { Configuration } from '../configuration';
13
- import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
13
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
14
14
  import globalAxios from 'axios';
15
- import { RequestArgs, BaseAPI } from '../base';
16
- import { SubmitInvoicesRequest } from '../models';
17
- import { SubmitInvoicesResponse } from '../models';
15
+ import { type RequestArgs, BaseAPI } from '../base';
16
+ import type { SubmitInvoicesRequest } from '../models';
17
+ import type { SubmitInvoicesResponse } from '../models';
18
18
  /**
19
19
  * VendorPaymentsApi - axios parameter creator
20
20
  * @export
@@ -26,7 +26,7 @@ export declare const VendorPaymentsApiAxiosParamCreator: (configuration?: Config
26
26
  * @param {*} [options] Override http request option.
27
27
  * @throws {RequiredError}
28
28
  */
29
- submitInvoices: (body: SubmitInvoicesRequest, options?: AxiosRequestConfig) => Promise<RequestArgs>;
29
+ submitInvoices: (body: SubmitInvoicesRequest, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
30
30
  };
31
31
  /**
32
32
  * VendorPaymentsApi - functional programming interface
@@ -39,7 +39,7 @@ export declare const VendorPaymentsApiFp: (configuration?: Configuration) => {
39
39
  * @param {*} [options] Override http request option.
40
40
  * @throws {RequiredError}
41
41
  */
42
- submitInvoices(body: SubmitInvoicesRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SubmitInvoicesResponse>>;
42
+ submitInvoices(body: SubmitInvoicesRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SubmitInvoicesResponse>>;
43
43
  };
44
44
  /**
45
45
  * VendorPaymentsApi - factory interface
@@ -52,7 +52,7 @@ export declare const VendorPaymentsApiFactory: (configuration?: Configuration, b
52
52
  * @param {*} [options] Override http request option.
53
53
  * @throws {RequiredError}
54
54
  */
55
- submitInvoices(requestParameters: VendorPaymentsApiSubmitInvoicesRequest, options?: AxiosRequestConfig): AxiosPromise<SubmitInvoicesResponse>;
55
+ submitInvoices(requestParameters: VendorPaymentsApiSubmitInvoicesRequest, options?: RawAxiosRequestConfig): AxiosPromise<SubmitInvoicesResponse>;
56
56
  };
57
57
  /**
58
58
  * Request parameters for submitInvoices operation in VendorPaymentsApi.
@@ -81,5 +81,5 @@ export declare class VendorPaymentsApi extends BaseAPI {
81
81
  * @throws {RequiredError}
82
82
  * @memberof VendorPaymentsApi
83
83
  */
84
- submitInvoices(requestParameters: VendorPaymentsApiSubmitInvoicesRequest, options?: AxiosRequestConfig): Promise<globalAxios.AxiosResponse<SubmitInvoicesResponse, any>>;
84
+ submitInvoices(requestParameters: VendorPaymentsApiSubmitInvoicesRequest, options?: RawAxiosRequestConfig): Promise<globalAxios.AxiosResponse<SubmitInvoicesResponse, any>>;
85
85
  }
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import type { Configuration } from './configuration';
13
- import type { AxiosInstance, AxiosRequestConfig } from 'axios';
13
+ import type { AxiosInstance, RawAxiosRequestConfig } from 'axios';
14
14
  export declare const BASE_PATH: string;
15
15
  /**
16
16
  *
@@ -29,7 +29,7 @@ export declare const COLLECTION_FORMATS: {
29
29
  */
30
30
  export interface RequestArgs {
31
31
  url: string;
32
- options: AxiosRequestConfig;
32
+ options: RawAxiosRequestConfig;
33
33
  }
34
34
  /**
35
35
  *
@@ -52,3 +52,15 @@ export declare class RequiredError extends Error {
52
52
  field: string;
53
53
  constructor(field: string, msg?: string);
54
54
  }
55
+ interface ServerMap {
56
+ [key: string]: {
57
+ url: string;
58
+ description: string;
59
+ }[];
60
+ }
61
+ /**
62
+ *
63
+ * @export
64
+ */
65
+ export declare const operationServerMap: ServerMap;
66
+ export {};
@@ -15,6 +15,7 @@ export interface ConfigurationParameters {
15
15
  password?: string;
16
16
  accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
17
17
  basePath?: string;
18
+ serverIndex?: number;
18
19
  baseOptions?: any;
19
20
  formDataCtor?: new () => any;
20
21
  }
@@ -53,6 +54,13 @@ export declare class Configuration {
53
54
  * @memberof Configuration
54
55
  */
55
56
  basePath?: string;
57
+ /**
58
+ * override server index
59
+ *
60
+ * @type {number}
61
+ * @memberof Configuration
62
+ */
63
+ serverIndex?: number;
56
64
  /**
57
65
  * base options for axios calls
58
66
  *
@@ -9,8 +9,8 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import { Money } from './money';
13
- import { TaxDetails } from './tax-details';
12
+ import type { Money } from './money';
13
+ import type { TaxDetails } from './tax-details';
14
14
  /**
15
15
  * Monetary and tax details of the allowance.
16
16
  * @export
@@ -9,8 +9,8 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import { Money } from './money';
13
- import { TaxDetails } from './tax-details';
12
+ import type { Money } from './money';
13
+ import type { TaxDetails } from './tax-details';
14
14
  /**
15
15
  * Monetary and tax details of the charge.
16
16
  * @export
@@ -9,12 +9,12 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import { AllowanceDetails } from './allowance-details';
13
- import { ChargeDetails } from './charge-details';
14
- import { CreditNoteDetails } from './credit-note-details';
15
- import { ItemQuantity } from './item-quantity';
16
- import { Money } from './money';
17
- import { TaxDetails } from './tax-details';
12
+ import type { AllowanceDetails } from './allowance-details';
13
+ import type { ChargeDetails } from './charge-details';
14
+ import type { CreditNoteDetails } from './credit-note-details';
15
+ import type { ItemQuantity } from './item-quantity';
16
+ import type { Money } from './money';
17
+ import type { TaxDetails } from './tax-details';
18
18
  /**
19
19
  * Details of the item being invoiced.
20
20
  * @export
@@ -9,14 +9,14 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import { AdditionalDetails } from './additional-details';
13
- import { AllowanceDetails } from './allowance-details';
14
- import { ChargeDetails } from './charge-details';
15
- import { InvoiceItem } from './invoice-item';
16
- import { Money } from './money';
17
- import { PartyIdentification } from './party-identification';
18
- import { PaymentTerms } from './payment-terms';
19
- import { TaxDetails } from './tax-details';
12
+ import type { AdditionalDetails } from './additional-details';
13
+ import type { AllowanceDetails } from './allowance-details';
14
+ import type { ChargeDetails } from './charge-details';
15
+ import type { InvoiceItem } from './invoice-item';
16
+ import type { Money } from './money';
17
+ import type { PartyIdentification } from './party-identification';
18
+ import type { PaymentTerms } from './payment-terms';
19
+ import type { TaxDetails } from './tax-details';
20
20
  /**
21
21
  *
22
22
  * @export
@@ -9,8 +9,8 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import { Address } from './address';
13
- import { TaxRegistrationDetails } from './tax-registration-details';
12
+ import type { Address } from './address';
13
+ import type { TaxRegistrationDetails } from './tax-registration-details';
14
14
  /**
15
15
  *
16
16
  * @export
@@ -9,7 +9,7 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import { Invoice } from './invoice';
12
+ import type { Invoice } from './invoice';
13
13
  /**
14
14
  * The request schema for the submitInvoices operation.
15
15
  * @export
@@ -9,7 +9,7 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import { TransactionId } from './transaction-id';
12
+ import type { TransactionId } from './transaction-id';
13
13
  /**
14
14
  * The response schema for the submitInvoices operation.
15
15
  * @export
@@ -9,7 +9,7 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import { Money } from './money';
12
+ import type { Money } from './money';
13
13
  /**
14
14
  * Details of tax amount applied.
15
15
  * @export
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sp-api-sdk/vendor-invoices-api-v1",
3
3
  "author": "Bertrand Marron <bertrand@bizon.solutions>",
4
4
  "description": "The Selling Partner API for Retail Procurement Payments provides programmatic access to vendors payments data.",
5
- "version": "2.0.7",
5
+ "version": "2.1.0",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/es/index.js",
8
8
  "types": "dist/types/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "dist/**/*.d.ts"
19
19
  ],
20
20
  "dependencies": {
21
- "@sp-api-sdk/common": "2.0.7",
22
- "axios": "^1.6.8"
21
+ "@sp-api-sdk/common": "2.0.8",
22
+ "axios": "^1.7.0"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -40,5 +40,5 @@
40
40
  "sp sdk",
41
41
  "vendor invoices api"
42
42
  ],
43
- "gitHead": "556cf5234c43b36ddaffa12f795a925b1c7fc63b"
43
+ "gitHead": "5a245a25a9f1765c825e2178668d4b0f4e44689b"
44
44
  }