Skip to content

Commit

Permalink
update to v6.91.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gateio committed Feb 10, 2025
1 parent 3834172 commit da1b896
Show file tree
Hide file tree
Showing 400 changed files with 13,133 additions and 19,254 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/npm-publish.yml

This file was deleted.

88 changes: 43 additions & 45 deletions README.md

Large diffs are not rendered by default.

140 changes: 70 additions & 70 deletions api/accountApi.ts

Large diffs are not rendered by default.

53 changes: 29 additions & 24 deletions api/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,35 @@
* Do not edit the class manually.
*/


/* eslint-disable @typescript-eslint/no-floating-promises */

import { Authentication, GateApiV4Auth, HttpBasicAuth, HttpBearerAuth, OAuth, ObjectSerializer } from '../model/models';
import {
Authentication,
GateApiV4Auth,
HttpBasicAuth,
HttpBearerAuth,
OAuth,
ObjectSerializer
} from "../model/models";

import JSONBig from 'json-bigint';
import JSONBig from 'json-bigint';
import globalAxios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';


export class ApiClient {
protected _basePath = 'https://api.gateio.ws/api/v4';

protected _basePath: string = 'https://api.gateio.ws/api/v4';
protected _defaultHeaders: any = {};

protected authentications: { [key: string]: Authentication } = {
apiv4: new GateApiV4Auth(),
};
'apiv4': new GateApiV4Auth(),
}

constructor(basePath?: string, protected axiosInstance: AxiosInstance = globalAxios) {
this._basePath = basePath || this._basePath;


this.axiosInstance.defaults.transformResponse = [
(data) => {
try {
Expand All @@ -35,7 +46,7 @@ export class ApiClient {
console.error('Failed to parse JSON:', error);
return data;
}
},
}
];
}

Expand All @@ -56,36 +67,30 @@ export class ApiClient {
}

public setApiKeySecret(key: string, secret: string) {
const auth = this.authentications['apiv4'] as GateApiV4Auth;
let auth = this.authentications['apiv4'] as GateApiV4Auth;
auth.key = key;
auth.secret = secret;
}

public applyToRequest(config: AxiosRequestConfig, authSettings: Array<string>): AxiosRequestConfig {
for (const auth of authSettings) {
const authenticator = this.authentications[auth];
for (let auth of authSettings) {
let authenticator = this.authentications[auth];
if (authenticator) {
config = authenticator.applyToRequest(config);
}
}
return config;
}

public async request<T>(
config: AxiosRequestConfig,
responseType: string,
authSettings: Array<string>,
): Promise<{ response: AxiosResponse; body: T }> {
return Promise.resolve(config)
.then((c) => this.applyToRequest(c, authSettings))
.then((c) => {
return this.axiosInstance.request(c).then((rsp) => {
let body = rsp.data;
if (responseType.length > 0) {
body = ObjectSerializer.deserialize(rsp.data, responseType);
}
return { response: rsp, body: body };
});
public async request<T>(config: AxiosRequestConfig, responseType: string, authSettings: Array<string>): Promise<{ response: AxiosResponse; body: T; }> {
return Promise.resolve(config).then(c => this.applyToRequest(c, authSettings)).then(c => {
return this.axiosInstance.request(c).then(rsp => {
let body = rsp.data;
if (responseType.length > 0) {
body = ObjectSerializer.deserialize(rsp.data, responseType);
}
return { response: rsp, body: body };
});
});
}
}
22 changes: 2 additions & 20 deletions api/apis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './apiClient';
export * from "./apiClient";
export * from './accountApi';
import { AccountApi } from './accountApi';
export * from './collateralLoanApi';
Expand Down Expand Up @@ -34,22 +34,4 @@ import { WalletApi } from './walletApi';
export * from './withdrawalApi';
import { WithdrawalApi } from './withdrawalApi';

export const APIS = [
AccountApi,
CollateralLoanApi,
DeliveryApi,
EarnApi,
EarnUniApi,
FlashSwapApi,
FuturesApi,
MarginApi,
MarginUniApi,
MultiCollateralLoanApi,
OptionsApi,
RebateApi,
SpotApi,
SubAccountApi,
UnifiedApi,
WalletApi,
WithdrawalApi,
];
export const APIS = [AccountApi, CollateralLoanApi, DeliveryApi, EarnApi, EarnUniApi, FlashSwapApi, FuturesApi, MarginApi, MarginUniApi, MultiCollateralLoanApi, OptionsApi, RebateApi, SpotApi, SubAccountApi, UnifiedApi, WalletApi, WithdrawalApi];
Loading

0 comments on commit da1b896

Please sign in to comment.