-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flash swap api; missing fields in futures auto order; wallet sub acco…
…unt balances
- Loading branch information
Showing
33 changed files
with
1,473 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,239 @@ | ||
/** | ||
* Gate API v4 | ||
* Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user\'s behalf. | ||
* | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
/* tslint:disable:no-unused-locals */ | ||
import { FlashSwapCurrency } from '../model/flashSwapCurrency'; | ||
import { FlashSwapOrder } from '../model/flashSwapOrder'; | ||
import { FlashSwapOrderPreview } from '../model/flashSwapOrderPreview'; | ||
import { FlashSwapOrderRequest } from '../model/flashSwapOrderRequest'; | ||
import { ObjectSerializer } from '../model/models'; | ||
import { ApiClient } from './apiClient'; | ||
import { AxiosRequestConfig, AxiosResponse } from 'axios'; | ||
|
||
// =============================================== | ||
// This file is autogenerated - Please do not edit | ||
// =============================================== | ||
|
||
export class FlashSwapApi { | ||
protected client: ApiClient; | ||
|
||
constructor(client?: ApiClient) { | ||
if (client) { | ||
this.client = client; | ||
} else { | ||
this.client = new ApiClient(); | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* @summary List all supported currencies in flash swap | ||
*/ | ||
public async listFlashSwapCurrencies(): Promise<{ response: AxiosResponse; body: Array<FlashSwapCurrency> }> { | ||
const localVarPath = this.client.basePath + '/flash_swap/currencies'; | ||
const localVarQueryParameters: any = {}; | ||
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); | ||
const produces = ['application/json']; | ||
// give precedence to 'application/json' | ||
if (produces.indexOf('application/json') >= 0) { | ||
localVarHeaderParams.Accept = 'application/json'; | ||
} else { | ||
localVarHeaderParams.Accept = produces.join(','); | ||
} | ||
|
||
const config: AxiosRequestConfig = { | ||
method: 'GET', | ||
params: localVarQueryParameters, | ||
headers: localVarHeaderParams, | ||
url: localVarPath, | ||
}; | ||
|
||
const authSettings = []; | ||
return this.client.request<Array<FlashSwapCurrency>>(config, 'Array<FlashSwapCurrency>', authSettings); | ||
} | ||
|
||
/** | ||
* | ||
* @summary List all flash swap orders | ||
* @param opts Optional parameters | ||
* @param opts.status Flash swap order status `1` - success `2` - failure | ||
* @param opts.sellCurrency Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` | ||
* @param opts.buyCurrency Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` | ||
* @param opts.reverse If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) | ||
* @param opts.limit Maximum number of records to be returned in a single list | ||
* @param opts.page Page number | ||
*/ | ||
public async listFlashSwapOrders(opts: { | ||
status?: number; | ||
sellCurrency?: string; | ||
buyCurrency?: string; | ||
reverse?: boolean; | ||
limit?: number; | ||
page?: number; | ||
}): Promise<{ response: AxiosResponse; body: Array<FlashSwapOrder> }> { | ||
const localVarPath = this.client.basePath + '/flash_swap/orders'; | ||
const localVarQueryParameters: any = {}; | ||
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); | ||
const produces = ['application/json']; | ||
// give precedence to 'application/json' | ||
if (produces.indexOf('application/json') >= 0) { | ||
localVarHeaderParams.Accept = 'application/json'; | ||
} else { | ||
localVarHeaderParams.Accept = produces.join(','); | ||
} | ||
|
||
opts = opts || {}; | ||
if (opts.status !== undefined) { | ||
localVarQueryParameters['status'] = ObjectSerializer.serialize(opts.status, 'number'); | ||
} | ||
|
||
if (opts.sellCurrency !== undefined) { | ||
localVarQueryParameters['sell_currency'] = ObjectSerializer.serialize(opts.sellCurrency, 'string'); | ||
} | ||
|
||
if (opts.buyCurrency !== undefined) { | ||
localVarQueryParameters['buy_currency'] = ObjectSerializer.serialize(opts.buyCurrency, 'string'); | ||
} | ||
|
||
if (opts.reverse !== undefined) { | ||
localVarQueryParameters['reverse'] = ObjectSerializer.serialize(opts.reverse, 'boolean'); | ||
} | ||
|
||
if (opts.limit !== undefined) { | ||
localVarQueryParameters['limit'] = ObjectSerializer.serialize(opts.limit, 'number'); | ||
} | ||
|
||
if (opts.page !== undefined) { | ||
localVarQueryParameters['page'] = ObjectSerializer.serialize(opts.page, 'number'); | ||
} | ||
|
||
const config: AxiosRequestConfig = { | ||
method: 'GET', | ||
params: localVarQueryParameters, | ||
headers: localVarHeaderParams, | ||
url: localVarPath, | ||
}; | ||
|
||
const authSettings = ['apiv4']; | ||
return this.client.request<Array<FlashSwapOrder>>(config, 'Array<FlashSwapOrder>', authSettings); | ||
} | ||
|
||
/** | ||
* Initiate a flash swap preview in advance because order creation requires a preview result | ||
* @summary Create a flash swap order | ||
* @param flashSwapOrderRequest | ||
*/ | ||
public async createFlashSwapOrder( | ||
flashSwapOrderRequest: FlashSwapOrderRequest, | ||
): Promise<{ response: AxiosResponse; body: FlashSwapOrder }> { | ||
const localVarPath = this.client.basePath + '/flash_swap/orders'; | ||
const localVarQueryParameters: any = {}; | ||
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); | ||
const produces = ['application/json']; | ||
// give precedence to 'application/json' | ||
if (produces.indexOf('application/json') >= 0) { | ||
localVarHeaderParams.Accept = 'application/json'; | ||
} else { | ||
localVarHeaderParams.Accept = produces.join(','); | ||
} | ||
|
||
// verify required parameter 'flashSwapOrderRequest' is not null or undefined | ||
if (flashSwapOrderRequest === null || flashSwapOrderRequest === undefined) { | ||
throw new Error( | ||
'Required parameter flashSwapOrderRequest was null or undefined when calling createFlashSwapOrder.', | ||
); | ||
} | ||
|
||
const config: AxiosRequestConfig = { | ||
method: 'POST', | ||
params: localVarQueryParameters, | ||
headers: localVarHeaderParams, | ||
url: localVarPath, | ||
data: ObjectSerializer.serialize(flashSwapOrderRequest, 'FlashSwapOrderRequest'), | ||
}; | ||
|
||
const authSettings = ['apiv4']; | ||
return this.client.request<FlashSwapOrder>(config, 'FlashSwapOrder', authSettings); | ||
} | ||
|
||
/** | ||
* | ||
* @summary Get a single flash swap order\'s detail | ||
* @param orderId Flash swap order ID | ||
*/ | ||
public async getFlashSwapOrder(orderId: number): Promise<{ response: AxiosResponse; body: FlashSwapOrder }> { | ||
const localVarPath = | ||
this.client.basePath + | ||
'/flash_swap/orders/{order_id}'.replace('{' + 'order_id' + '}', encodeURIComponent(String(orderId))); | ||
const localVarQueryParameters: any = {}; | ||
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); | ||
const produces = ['application/json']; | ||
// give precedence to 'application/json' | ||
if (produces.indexOf('application/json') >= 0) { | ||
localVarHeaderParams.Accept = 'application/json'; | ||
} else { | ||
localVarHeaderParams.Accept = produces.join(','); | ||
} | ||
|
||
// verify required parameter 'orderId' is not null or undefined | ||
if (orderId === null || orderId === undefined) { | ||
throw new Error('Required parameter orderId was null or undefined when calling getFlashSwapOrder.'); | ||
} | ||
|
||
const config: AxiosRequestConfig = { | ||
method: 'GET', | ||
params: localVarQueryParameters, | ||
headers: localVarHeaderParams, | ||
url: localVarPath, | ||
}; | ||
|
||
const authSettings = ['apiv4']; | ||
return this.client.request<FlashSwapOrder>(config, 'FlashSwapOrder', authSettings); | ||
} | ||
|
||
/** | ||
* | ||
* @summary Initiate a flash swap order preview | ||
* @param flashSwapOrderRequest | ||
*/ | ||
public async previewFlashSwapOrder( | ||
flashSwapOrderRequest: FlashSwapOrderRequest, | ||
): Promise<{ response: AxiosResponse; body: FlashSwapOrderPreview }> { | ||
const localVarPath = this.client.basePath + '/flash_swap/orders/preview'; | ||
const localVarQueryParameters: any = {}; | ||
const localVarHeaderParams: any = (<any>Object).assign({}, this.client.defaultHeaders); | ||
const produces = ['application/json']; | ||
// give precedence to 'application/json' | ||
if (produces.indexOf('application/json') >= 0) { | ||
localVarHeaderParams.Accept = 'application/json'; | ||
} else { | ||
localVarHeaderParams.Accept = produces.join(','); | ||
} | ||
|
||
// verify required parameter 'flashSwapOrderRequest' is not null or undefined | ||
if (flashSwapOrderRequest === null || flashSwapOrderRequest === undefined) { | ||
throw new Error( | ||
'Required parameter flashSwapOrderRequest was null or undefined when calling previewFlashSwapOrder.', | ||
); | ||
} | ||
|
||
const config: AxiosRequestConfig = { | ||
method: 'POST', | ||
params: localVarQueryParameters, | ||
headers: localVarHeaderParams, | ||
url: localVarPath, | ||
data: ObjectSerializer.serialize(flashSwapOrderRequest, 'FlashSwapOrderRequest'), | ||
}; | ||
|
||
const authSettings = ['apiv4']; | ||
return this.client.request<FlashSwapOrderPreview>(config, 'FlashSwapOrderPreview', authSettings); | ||
} | ||
} |
Oops, something went wrong.