Skip to content

Commit fe9032d

Browse files
authored
Merge pull request #39 from SIDANWhatever/feature/issue-12
fix: aligning return type with code cleaning
2 parents e307364 + f96a1cb commit fe9032d

File tree

29 files changed

+314
-517
lines changed

29 files changed

+314
-517
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,6 @@ dist
104104
.tern-port
105105

106106
package-lock.json
107+
108+
# local testing
109+
test.ts

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@maestro-org/typescript-sdk",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"description": "TypeScript SDK for the Maestro Dapp Platform",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",
@@ -49,4 +49,4 @@
4949
"yarn eslint --fix"
5050
]
5151
}
52-
}
52+
}

src/api/accounts/helpers.ts

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios';
1+
import { AxiosRequestConfig } from 'axios';
22
import { RequestArgs } from '../../base';
33
import {
44
assertParamExists,
@@ -39,11 +39,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
3939
* @param {*} [options] Override http request option.
4040
* @throws {RequiredError}
4141
*/
42-
accountAddresses: async (
42+
accountAddresses: (
4343
stakeAddr: string,
4444
localVarQueryParameter: AccountAddressesQueryParams = {},
4545
options: AxiosRequestConfig = {},
46-
): Promise<RequestArgs> => {
46+
): RequestArgs => {
4747
// verify required parameter 'stakeAddr' is not null or undefined
4848
assertParamExists('accountAddresses', 'stakeAddr', stakeAddr);
4949
const localVarPath = `/accounts/{stake_addr}/addresses`.replace(
@@ -81,11 +81,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
8181
* @param {*} [options] Override http request option.
8282
* @throws {RequiredError}
8383
*/
84-
accountAssets: async (
84+
accountAssets: (
8585
stakeAddr: string,
8686
localVarQueryParameter: AccountAssetsQueryParams = {},
8787
options: AxiosRequestConfig = {},
88-
): Promise<RequestArgs> => {
88+
): RequestArgs => {
8989
// verify required parameter 'stakeAddr' is not null or undefined
9090
assertParamExists('accountAssets', 'stakeAddr', stakeAddr);
9191
const localVarPath = `/accounts/{stake_addr}/assets`.replace(
@@ -124,11 +124,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
124124
* @param {*} [options] Override http request option.
125125
* @throws {RequiredError}
126126
*/
127-
accountHistory: async (
127+
accountHistory: (
128128
stakeAddr: string,
129129
localVarQueryParameter: AccountHistoryQueryParams = {},
130130
options: AxiosRequestConfig = {},
131-
): Promise<RequestArgs> => {
131+
): RequestArgs => {
132132
// verify required parameter 'stakeAddr' is not null or undefined
133133
assertParamExists('accountHistory', 'stakeAddr', stakeAddr);
134134
const localVarPath = `/accounts/{stake_addr}/history`.replace(
@@ -165,7 +165,7 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
165165
* @param {*} [options] Override http request option.
166166
* @throws {RequiredError}
167167
*/
168-
accountInfo: async (stakeAddr: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
168+
accountInfo: (stakeAddr: string, options: AxiosRequestConfig = {}): RequestArgs => {
169169
// verify required parameter 'stakeAddr' is not null or undefined
170170
assertParamExists('accountInfo', 'stakeAddr', stakeAddr);
171171
const localVarPath = `/accounts/{stake_addr}`.replace(
@@ -204,11 +204,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
204204
* @param {*} [options] Override http request option.
205205
* @throws {RequiredError}
206206
*/
207-
accountRewards: async (
207+
accountRewards: (
208208
stakeAddr: string,
209209
localVarQueryParameter: AccountRewardsQueryParams = {},
210210
options: AxiosRequestConfig = {},
211-
): Promise<RequestArgs> => {
211+
): RequestArgs => {
212212
// verify required parameter 'stakeAddr' is not null or undefined
213213
assertParamExists('accountRewards', 'stakeAddr', stakeAddr);
214214
const localVarPath = `/accounts/{stake_addr}/rewards`.replace(
@@ -246,11 +246,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
246246
* @param {*} [options] Override http request option.
247247
* @throws {RequiredError}
248248
*/
249-
accountUpdates: async (
249+
accountUpdates: (
250250
stakeAddr: string,
251251
localVarQueryParameter: AccountUpdatesQueryParams = {},
252252
options: AxiosRequestConfig = {},
253-
): Promise<RequestArgs> => {
253+
): RequestArgs => {
254254
// verify required parameter 'stakeAddr' is not null or undefined
255255
assertParamExists('accountUpdates', 'stakeAddr', stakeAddr);
256256
const localVarPath = `/accounts/{stake_addr}/updates`.replace(
@@ -297,12 +297,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
297297
* @param {*} [options] Override http request option.
298298
* @throws {RequiredError}
299299
*/
300-
async accountAddresses(
300+
accountAddresses(
301301
stakeAddr: string,
302302
queryParams?: AccountAddressesQueryParams,
303303
options?: AxiosRequestConfig,
304-
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAddress>> {
305-
const localVarAxiosArgs = await localVarAxiosParamCreator.accountAddresses(stakeAddr, queryParams, options);
304+
): () => Promise<PaginatedAddress> {
305+
const localVarAxiosArgs = localVarAxiosParamCreator.accountAddresses(stakeAddr, queryParams, options);
306306
return createRequestFunction(localVarAxiosArgs, configuration);
307307
},
308308
/**
@@ -313,12 +313,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
313313
* @param {*} [options] Override http request option.
314314
* @throws {RequiredError}
315315
*/
316-
async accountAssets(
316+
accountAssets(
317317
stakeAddr: string,
318318
queryParams?: AccountAssetsQueryParams,
319319
options?: AxiosRequestConfig,
320-
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAsset>> {
321-
const localVarAxiosArgs = await localVarAxiosParamCreator.accountAssets(stakeAddr, queryParams, options);
320+
): () => Promise<PaginatedAsset> {
321+
const localVarAxiosArgs = localVarAxiosParamCreator.accountAssets(stakeAddr, queryParams, options);
322322
return createRequestFunction(localVarAxiosArgs, configuration);
323323
},
324324
/**
@@ -329,12 +329,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
329329
* @param {*} [options] Override http request option.
330330
* @throws {RequiredError}
331331
*/
332-
async accountHistory(
332+
accountHistory(
333333
stakeAddr: string,
334334
queryParams?: AccountHistoryQueryParams,
335335
options?: AxiosRequestConfig,
336-
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAccountHistory>> {
337-
const localVarAxiosArgs = await localVarAxiosParamCreator.accountHistory(stakeAddr, queryParams, options);
336+
): () => Promise<PaginatedAccountHistory> {
337+
const localVarAxiosArgs = localVarAxiosParamCreator.accountHistory(stakeAddr, queryParams, options);
338338
return createRequestFunction(localVarAxiosArgs, configuration);
339339
},
340340
/**
@@ -344,11 +344,8 @@ export const AccountsApiFp = (configuration: Configuration) => {
344344
* @param {*} [options] Override http request option.
345345
* @throws {RequiredError}
346346
*/
347-
async accountInfo(
348-
stakeAddr: string,
349-
options?: AxiosRequestConfig,
350-
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<TimestampedAccountInfo>> {
351-
const localVarAxiosArgs = await localVarAxiosParamCreator.accountInfo(stakeAddr, options);
347+
accountInfo(stakeAddr: string, options?: AxiosRequestConfig): () => Promise<TimestampedAccountInfo> {
348+
const localVarAxiosArgs = localVarAxiosParamCreator.accountInfo(stakeAddr, options);
352349
return createRequestFunction(localVarAxiosArgs, configuration);
353350
},
354351
/**
@@ -359,12 +356,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
359356
* @param {*} [options] Override http request option.
360357
* @throws {RequiredError}
361358
*/
362-
async accountRewards(
359+
accountRewards(
363360
stakeAddr: string,
364361
queryParams?: AccountRewardsQueryParams,
365362
options?: AxiosRequestConfig,
366-
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAccountReward>> {
367-
const localVarAxiosArgs = await localVarAxiosParamCreator.accountRewards(stakeAddr, queryParams, options);
363+
): () => Promise<PaginatedAccountReward> {
364+
const localVarAxiosArgs = localVarAxiosParamCreator.accountRewards(stakeAddr, queryParams, options);
368365
return createRequestFunction(localVarAxiosArgs, configuration);
369366
},
370367
/**
@@ -375,12 +372,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
375372
* @param {*} [options] Override http request option.
376373
* @throws {RequiredError}
377374
*/
378-
async accountUpdates(
375+
accountUpdates(
379376
stakeAddr: string,
380377
queryParams?: AccountUpdatesQueryParams,
381378
options?: AxiosRequestConfig,
382-
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAccountUpdate>> {
383-
const localVarAxiosArgs = await localVarAxiosParamCreator.accountUpdates(stakeAddr, queryParams, options);
379+
): () => Promise<PaginatedAccountUpdate> {
380+
const localVarAxiosArgs = localVarAxiosParamCreator.accountUpdates(stakeAddr, queryParams, options);
384381
return createRequestFunction(localVarAxiosArgs, configuration);
385382
},
386383
};

src/api/accounts/index.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ export class AccountsApi extends BaseAPI {
3030
queryParams?: AccountAddressesQueryParams,
3131
options?: AxiosRequestConfig,
3232
) {
33-
return AccountsApiFp(this.configuration)
34-
.accountAddresses(stakeAddr, queryParams, options)
35-
.then((request) => request());
33+
return AccountsApiFp(this.configuration).accountAddresses(stakeAddr, queryParams, options)();
3634
}
3735

3836
/**
@@ -45,9 +43,7 @@ export class AccountsApi extends BaseAPI {
4543
* @memberof AccountsApi
4644
*/
4745
public accountAssets(stakeAddr: string, queryParams?: AccountAssetsQueryParams, options?: AxiosRequestConfig) {
48-
return AccountsApiFp(this.configuration)
49-
.accountAssets(stakeAddr, queryParams, options)
50-
.then((request) => request());
46+
return AccountsApiFp(this.configuration).accountAssets(stakeAddr, queryParams, options)();
5147
}
5248

5349
/**
@@ -60,9 +56,7 @@ export class AccountsApi extends BaseAPI {
6056
* @memberof AccountsApi
6157
*/
6258
public accountHistory(stakeAddr: string, queryParams?: AccountHistoryQueryParams, options?: AxiosRequestConfig) {
63-
return AccountsApiFp(this.configuration)
64-
.accountHistory(stakeAddr, queryParams, options)
65-
.then((request) => request());
59+
return AccountsApiFp(this.configuration).accountHistory(stakeAddr, queryParams, options)();
6660
}
6761

6862
/**
@@ -74,9 +68,7 @@ export class AccountsApi extends BaseAPI {
7468
* @memberof AccountsApi
7569
*/
7670
public accountInfo(stakeAddr: string, options?: AxiosRequestConfig) {
77-
return AccountsApiFp(this.configuration)
78-
.accountInfo(stakeAddr, options)
79-
.then((request) => request());
71+
return AccountsApiFp(this.configuration).accountInfo(stakeAddr, options)();
8072
}
8173

8274
/**
@@ -89,9 +81,7 @@ export class AccountsApi extends BaseAPI {
8981
* @memberof AccountsApi
9082
*/
9183
public accountRewards(stakeAddr: string, queryParams?: AccountRewardsQueryParams, options?: AxiosRequestConfig) {
92-
return AccountsApiFp(this.configuration)
93-
.accountRewards(stakeAddr, queryParams, options)
94-
.then((request) => request());
84+
return AccountsApiFp(this.configuration).accountRewards(stakeAddr, queryParams, options)();
9585
}
9686

9787
/**
@@ -104,9 +94,7 @@ export class AccountsApi extends BaseAPI {
10494
* @memberof AccountsApi
10595
*/
10696
public accountUpdates(stakeAddr: string, queryParams?: AccountUpdatesQueryParams, options?: AxiosRequestConfig) {
107-
return AccountsApiFp(this.configuration)
108-
.accountUpdates(stakeAddr, queryParams, options)
109-
.then((request) => request());
97+
return AccountsApiFp(this.configuration).accountUpdates(stakeAddr, queryParams, options)();
11098
}
11199
}
112100

0 commit comments

Comments
 (0)