Skip to content

Commit 3206d81

Browse files
author
devexperience
committed
Generated version 0.20.1
This commit was automatically created by a GitHub Action to generate version 0.20.1 of this library.
1 parent 98c0f3d commit 3206d81

10 files changed

Lines changed: 60 additions & 32 deletions

File tree

.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ common.ts
77
configuration.ts
88
index.ts
99
package.json
10+
tsconfig.esm.json
1011
tsconfig.json

.openapi-generator/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.4.0
1+
7.0.1

api.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
*/
1414

1515

16-
import { Configuration } from './configuration';
17-
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
16+
import type { Configuration } from './configuration';
17+
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
18+
import globalAxios from 'axios';
1819
// Some imports not used depending on template conditions
1920
// @ts-ignore
2021
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
22+
import type { RequestArgs } from './base';
2123
// @ts-ignore
22-
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
24+
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base';
2325

2426
/**
2527
*
@@ -9569,7 +9571,7 @@ export const MxPlatformApiAxiosParamCreator = function (configuration?: Configur
95699571
// http basic authentication required
95709572
setBasicAuthToObject(localVarRequestOptions, configuration)
95719573

9572-
if (acceptLanguage !== undefined && acceptLanguage !== null) {
9574+
if (acceptLanguage != null) {
95739575
localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
95749576
}
95759577

@@ -10629,7 +10631,7 @@ export const MxPlatformApiFp = function(configuration?: Configuration) {
1062910631
* @param {*} [options] Override http request option.
1063010632
* @throws {RequiredError}
1063110633
*/
10632-
async downloadStatementPDF(memberGuid: string, statementGuid: string, userGuid: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
10634+
async downloadStatementPDF(memberGuid: string, statementGuid: string, userGuid: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<File>> {
1063310635
const localVarAxiosArgs = await localVarAxiosParamCreator.downloadStatementPDF(memberGuid, statementGuid, userGuid, options);
1063410636
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1063510637
},
@@ -10642,7 +10644,7 @@ export const MxPlatformApiFp = function(configuration?: Configuration) {
1064210644
* @param {*} [options] Override http request option.
1064310645
* @throws {RequiredError}
1064410646
*/
10645-
async downloadTaxDocument(taxDocumentGuid: string, memberGuid: string, userGuid: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
10647+
async downloadTaxDocument(taxDocumentGuid: string, memberGuid: string, userGuid: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<File>> {
1064610648
const localVarAxiosArgs = await localVarAxiosParamCreator.downloadTaxDocument(taxDocumentGuid, memberGuid, userGuid, options);
1064710649
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1064810650
},
@@ -12081,7 +12083,7 @@ export const MxPlatformApiFactory = function (configuration?: Configuration, bas
1208112083
* @param {*} [options] Override http request option.
1208212084
* @throws {RequiredError}
1208312085
*/
12084-
downloadStatementPDF(memberGuid: string, statementGuid: string, userGuid: string, options?: any): AxiosPromise<any> {
12086+
downloadStatementPDF(memberGuid: string, statementGuid: string, userGuid: string, options?: any): AxiosPromise<File> {
1208512087
return localVarFp.downloadStatementPDF(memberGuid, statementGuid, userGuid, options).then((request) => request(axios, basePath));
1208612088
},
1208712089
/**
@@ -12093,7 +12095,7 @@ export const MxPlatformApiFactory = function (configuration?: Configuration, bas
1209312095
* @param {*} [options] Override http request option.
1209412096
* @throws {RequiredError}
1209512097
*/
12096-
downloadTaxDocument(taxDocumentGuid: string, memberGuid: string, userGuid: string, options?: any): AxiosPromise<any> {
12098+
downloadTaxDocument(taxDocumentGuid: string, memberGuid: string, userGuid: string, options?: any): AxiosPromise<File> {
1209712099
return localVarFp.downloadTaxDocument(taxDocumentGuid, memberGuid, userGuid, options).then((request) => request(axios, basePath));
1209812100
},
1209912101
/**
@@ -14711,3 +14713,4 @@ export class MxPlatformApi extends BaseAPI {
1471114713
}
1471214714

1471314715

14716+

base.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
*/
1414

1515

16-
import { Configuration } from "./configuration";
16+
import type { Configuration } from './configuration';
1717
// Some imports not used depending on template conditions
1818
// @ts-ignore
19-
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
19+
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
20+
import globalAxios from 'axios';
2021

2122
export const BASE_PATH = "https://api.mx.com".replace(/\/+$/, "");
2223

@@ -64,8 +65,8 @@ export class BaseAPI {
6465
* @extends {Error}
6566
*/
6667
export class RequiredError extends Error {
67-
name: "RequiredError" = "RequiredError";
6868
constructor(public field: string, msg?: string) {
6969
super(msg);
70+
this.name = "RequiredError"
7071
}
7172
}

common.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
*/
1414

1515

16-
import { Configuration } from "./configuration";
17-
import { RequiredError, RequestArgs } from "./base";
18-
import { AxiosInstance, AxiosResponse } from 'axios';
16+
import type { Configuration } from "./configuration";
17+
import type { RequestArgs } from "./base";
18+
import type { AxiosInstance, AxiosResponse } from 'axios';
19+
import { RequiredError } from "./base";
1920

2021
/**
2122
*
@@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope
8384
}
8485
}
8586

87+
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
88+
if (parameter == null) return;
89+
if (typeof parameter === "object") {
90+
if (Array.isArray(parameter)) {
91+
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
92+
}
93+
else {
94+
Object.keys(parameter).forEach(currentKey =>
95+
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
96+
);
97+
}
98+
}
99+
else {
100+
if (urlSearchParams.has(key)) {
101+
urlSearchParams.append(key, parameter);
102+
}
103+
else {
104+
urlSearchParams.set(key, parameter);
105+
}
106+
}
107+
}
108+
86109
/**
87110
*
88111
* @export
89112
*/
90113
export const setSearchParams = function (url: URL, ...objects: any[]) {
91114
const searchParams = new URLSearchParams(url.search);
92-
for (const object of objects) {
93-
for (const key in object) {
94-
if (Array.isArray(object[key])) {
95-
searchParams.delete(key);
96-
for (const item of object[key]) {
97-
searchParams.append(key, item);
98-
}
99-
} else {
100-
searchParams.set(key, object[key]);
101-
}
102-
}
103-
}
115+
setFlattenedQueryParams(searchParams, objects);
104116
url.search = searchParams.toString();
105117
}
106118

@@ -132,7 +144,7 @@ export const toPathString = function (url: URL) {
132144
*/
133145
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
134146
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
135-
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
147+
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || axios.defaults.baseURL || basePath) + axiosArgs.url};
136148
return axios.request<T, R>(axiosRequestArgs);
137149
};
138150
}

openapi/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
npmName: mx-platform-node
3-
npmVersion: 0.20.0
3+
npmVersion: 0.20.1
44
supportsES6: true

openapitools.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
22
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
3-
"spaces": 2
3+
"spaces": 2,
4+
"generator-cli": {
5+
"version": "7.0.1"
6+
}
47
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mx-platform-node",
3-
"version": "0.20.0",
3+
"version": "0.20.1",
44
"description": "A Node library for the MX Platform API.",
55
"author": "MX",
66
"keywords": [

tsconfig.esm.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "esnext",
5+
"outDir": "dist/esm"
6+
}
7+
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"compilerOptions": {
33
"declaration": true,
4-
"target": "es6",
4+
"target": "ES6",
55
"module": "commonjs",
66
"noImplicitAny": true,
77
"outDir": "dist",
88
"rootDir": ".",
9+
"moduleResolution": "node",
910
"typeRoots": [
1011
"node_modules/@types"
1112
]

0 commit comments

Comments
 (0)