Skip to content

Commit

Permalink
Merge pull request #39 from SIDANWhatever/feature/issue-12
Browse files Browse the repository at this point in the history
fix: aligning return type with code cleaning
  • Loading branch information
Vardominator authored Feb 13, 2024
2 parents e307364 + f96a1cb commit fe9032d
Show file tree
Hide file tree
Showing 29 changed files with 314 additions and 517 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ dist
.tern-port

package-lock.json

# local testing
test.ts
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maestro-org/typescript-sdk",
"version": "1.5.0",
"version": "1.5.1",
"description": "TypeScript SDK for the Maestro Dapp Platform",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down Expand Up @@ -49,4 +49,4 @@
"yarn eslint --fix"
]
}
}
}
61 changes: 29 additions & 32 deletions src/api/accounts/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios';
import { AxiosRequestConfig } from 'axios';
import { RequestArgs } from '../../base';
import {
assertParamExists,
Expand Down Expand Up @@ -39,11 +39,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountAddresses: async (
accountAddresses: (
stakeAddr: string,
localVarQueryParameter: AccountAddressesQueryParams = {},
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
): RequestArgs => {
// verify required parameter 'stakeAddr' is not null or undefined
assertParamExists('accountAddresses', 'stakeAddr', stakeAddr);
const localVarPath = `/accounts/{stake_addr}/addresses`.replace(
Expand Down Expand Up @@ -81,11 +81,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountAssets: async (
accountAssets: (
stakeAddr: string,
localVarQueryParameter: AccountAssetsQueryParams = {},
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
): RequestArgs => {
// verify required parameter 'stakeAddr' is not null or undefined
assertParamExists('accountAssets', 'stakeAddr', stakeAddr);
const localVarPath = `/accounts/{stake_addr}/assets`.replace(
Expand Down Expand Up @@ -124,11 +124,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountHistory: async (
accountHistory: (
stakeAddr: string,
localVarQueryParameter: AccountHistoryQueryParams = {},
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
): RequestArgs => {
// verify required parameter 'stakeAddr' is not null or undefined
assertParamExists('accountHistory', 'stakeAddr', stakeAddr);
const localVarPath = `/accounts/{stake_addr}/history`.replace(
Expand Down Expand Up @@ -165,7 +165,7 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountInfo: async (stakeAddr: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
accountInfo: (stakeAddr: string, options: AxiosRequestConfig = {}): RequestArgs => {
// verify required parameter 'stakeAddr' is not null or undefined
assertParamExists('accountInfo', 'stakeAddr', stakeAddr);
const localVarPath = `/accounts/{stake_addr}`.replace(
Expand Down Expand Up @@ -204,11 +204,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountRewards: async (
accountRewards: (
stakeAddr: string,
localVarQueryParameter: AccountRewardsQueryParams = {},
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
): RequestArgs => {
// verify required parameter 'stakeAddr' is not null or undefined
assertParamExists('accountRewards', 'stakeAddr', stakeAddr);
const localVarPath = `/accounts/{stake_addr}/rewards`.replace(
Expand Down Expand Up @@ -246,11 +246,11 @@ export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountUpdates: async (
accountUpdates: (
stakeAddr: string,
localVarQueryParameter: AccountUpdatesQueryParams = {},
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
): RequestArgs => {
// verify required parameter 'stakeAddr' is not null or undefined
assertParamExists('accountUpdates', 'stakeAddr', stakeAddr);
const localVarPath = `/accounts/{stake_addr}/updates`.replace(
Expand Down Expand Up @@ -297,12 +297,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async accountAddresses(
accountAddresses(
stakeAddr: string,
queryParams?: AccountAddressesQueryParams,
options?: AxiosRequestConfig,
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAddress>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.accountAddresses(stakeAddr, queryParams, options);
): () => Promise<PaginatedAddress> {
const localVarAxiosArgs = localVarAxiosParamCreator.accountAddresses(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
Expand All @@ -313,12 +313,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async accountAssets(
accountAssets(
stakeAddr: string,
queryParams?: AccountAssetsQueryParams,
options?: AxiosRequestConfig,
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAsset>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.accountAssets(stakeAddr, queryParams, options);
): () => Promise<PaginatedAsset> {
const localVarAxiosArgs = localVarAxiosParamCreator.accountAssets(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
Expand All @@ -329,12 +329,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async accountHistory(
accountHistory(
stakeAddr: string,
queryParams?: AccountHistoryQueryParams,
options?: AxiosRequestConfig,
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAccountHistory>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.accountHistory(stakeAddr, queryParams, options);
): () => Promise<PaginatedAccountHistory> {
const localVarAxiosArgs = localVarAxiosParamCreator.accountHistory(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
Expand All @@ -344,11 +344,8 @@ export const AccountsApiFp = (configuration: Configuration) => {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async accountInfo(
stakeAddr: string,
options?: AxiosRequestConfig,
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<TimestampedAccountInfo>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.accountInfo(stakeAddr, options);
accountInfo(stakeAddr: string, options?: AxiosRequestConfig): () => Promise<TimestampedAccountInfo> {
const localVarAxiosArgs = localVarAxiosParamCreator.accountInfo(stakeAddr, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
Expand All @@ -359,12 +356,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async accountRewards(
accountRewards(
stakeAddr: string,
queryParams?: AccountRewardsQueryParams,
options?: AxiosRequestConfig,
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAccountReward>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.accountRewards(stakeAddr, queryParams, options);
): () => Promise<PaginatedAccountReward> {
const localVarAxiosArgs = localVarAxiosParamCreator.accountRewards(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
Expand All @@ -375,12 +372,12 @@ export const AccountsApiFp = (configuration: Configuration) => {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async accountUpdates(
accountUpdates(
stakeAddr: string,
queryParams?: AccountUpdatesQueryParams,
options?: AxiosRequestConfig,
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PaginatedAccountUpdate>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.accountUpdates(stakeAddr, queryParams, options);
): () => Promise<PaginatedAccountUpdate> {
const localVarAxiosArgs = localVarAxiosParamCreator.accountUpdates(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
};
Expand Down
24 changes: 6 additions & 18 deletions src/api/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ export class AccountsApi extends BaseAPI {
queryParams?: AccountAddressesQueryParams,
options?: AxiosRequestConfig,
) {
return AccountsApiFp(this.configuration)
.accountAddresses(stakeAddr, queryParams, options)
.then((request) => request());
return AccountsApiFp(this.configuration).accountAddresses(stakeAddr, queryParams, options)();
}

/**
Expand All @@ -45,9 +43,7 @@ export class AccountsApi extends BaseAPI {
* @memberof AccountsApi
*/
public accountAssets(stakeAddr: string, queryParams?: AccountAssetsQueryParams, options?: AxiosRequestConfig) {
return AccountsApiFp(this.configuration)
.accountAssets(stakeAddr, queryParams, options)
.then((request) => request());
return AccountsApiFp(this.configuration).accountAssets(stakeAddr, queryParams, options)();
}

/**
Expand All @@ -60,9 +56,7 @@ export class AccountsApi extends BaseAPI {
* @memberof AccountsApi
*/
public accountHistory(stakeAddr: string, queryParams?: AccountHistoryQueryParams, options?: AxiosRequestConfig) {
return AccountsApiFp(this.configuration)
.accountHistory(stakeAddr, queryParams, options)
.then((request) => request());
return AccountsApiFp(this.configuration).accountHistory(stakeAddr, queryParams, options)();
}

/**
Expand All @@ -74,9 +68,7 @@ export class AccountsApi extends BaseAPI {
* @memberof AccountsApi
*/
public accountInfo(stakeAddr: string, options?: AxiosRequestConfig) {
return AccountsApiFp(this.configuration)
.accountInfo(stakeAddr, options)
.then((request) => request());
return AccountsApiFp(this.configuration).accountInfo(stakeAddr, options)();
}

/**
Expand All @@ -89,9 +81,7 @@ export class AccountsApi extends BaseAPI {
* @memberof AccountsApi
*/
public accountRewards(stakeAddr: string, queryParams?: AccountRewardsQueryParams, options?: AxiosRequestConfig) {
return AccountsApiFp(this.configuration)
.accountRewards(stakeAddr, queryParams, options)
.then((request) => request());
return AccountsApiFp(this.configuration).accountRewards(stakeAddr, queryParams, options)();
}

/**
Expand All @@ -104,9 +94,7 @@ export class AccountsApi extends BaseAPI {
* @memberof AccountsApi
*/
public accountUpdates(stakeAddr: string, queryParams?: AccountUpdatesQueryParams, options?: AxiosRequestConfig) {
return AccountsApiFp(this.configuration)
.accountUpdates(stakeAddr, queryParams, options)
.then((request) => request());
return AccountsApiFp(this.configuration).accountUpdates(stakeAddr, queryParams, options)();
}
}

Expand Down
Loading

0 comments on commit fe9032d

Please sign in to comment.