2858 lines
87 KiB
Go
2858 lines
87 KiB
Go
|
// Package public provides primitives to interact with the openapi HTTP API.
|
|||
|
//
|
|||
|
// Code generated by github.com/deepmap/oapi-codegen version v1.9.0 DO NOT EDIT.
|
|||
|
package public
|
|||
|
|
|||
|
import (
|
|||
|
"bytes"
|
|||
|
"compress/gzip"
|
|||
|
"context"
|
|||
|
"encoding/base64"
|
|||
|
"encoding/json"
|
|||
|
"fmt"
|
|||
|
"io/ioutil"
|
|||
|
"net/http"
|
|||
|
"net/url"
|
|||
|
"path"
|
|||
|
"strings"
|
|||
|
|
|||
|
"github.com/deepmap/oapi-codegen/pkg/runtime"
|
|||
|
"github.com/getkin/kin-openapi/openapi3"
|
|||
|
)
|
|||
|
|
|||
|
// GetApiV5PublicDeliveryExerciseHistoryParams defines parameters for GetApiV5PublicDeliveryExerciseHistory.
|
|||
|
type GetApiV5PublicDeliveryExerciseHistoryParams struct {
|
|||
|
// 产品类型<br>`FUTURES`:交割合约,`OPTION`:期权
|
|||
|
InstType string `json:"instType"`
|
|||
|
|
|||
|
// 合约标的指数,如:`BTC-USD`<br>仅适用于`交割/期权`
|
|||
|
Uly string `json:"uly"`
|
|||
|
|
|||
|
// 请求此时间戳之前(更旧的数据)的分页内容,传的值为对应接口的`ts`
|
|||
|
After *string `json:"after,omitempty"`
|
|||
|
|
|||
|
// 请求此时间戳之后(更新的数据)的分页内容,传的值为对应接口的`ts`
|
|||
|
Before *string `json:"before,omitempty"`
|
|||
|
|
|||
|
// 分页返回的结果集数量,最大为100,不填默认返回100条
|
|||
|
Limit *string `json:"limit,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicDiscountRateInterestFreeQuotaParams defines parameters for GetApiV5PublicDiscountRateInterestFreeQuota.
|
|||
|
type GetApiV5PublicDiscountRateInterestFreeQuotaParams struct {
|
|||
|
// 币种,如:`BTC`
|
|||
|
Ccy *string `json:"ccy,omitempty"`
|
|||
|
|
|||
|
// 折算率等级<br>`1`:第一档,`2`:第二档,`3`:第三档,`4`:第四档,`5`:第五档
|
|||
|
DiscountLv *string `json:"discountLv,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicEstimatedPriceParams defines parameters for GetApiV5PublicEstimatedPrice.
|
|||
|
type GetApiV5PublicEstimatedPriceParams struct {
|
|||
|
// 产品ID,如:`BTC-USD-200214`<br>适用于`交割/期权`
|
|||
|
InstId string `json:"instId"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicFundingRateParams defines parameters for GetApiV5PublicFundingRate.
|
|||
|
type GetApiV5PublicFundingRateParams struct {
|
|||
|
// 产品ID,如:`BTC-USDT-SWAP`<br>仅适用于`永续`
|
|||
|
InstId *string `json:"instId,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicFundingRateHistoryParams defines parameters for GetApiV5PublicFundingRateHistory.
|
|||
|
type GetApiV5PublicFundingRateHistoryParams struct {
|
|||
|
// 产品ID,如:`BTC-USDT-SWAP`<br>仅适用于`永续`
|
|||
|
InstId *string `json:"instId,omitempty"`
|
|||
|
|
|||
|
// 请求此时间戳之前(更旧的数据)的分页内容,传的值为对应接口的`fundingTime`
|
|||
|
After *string `json:"after,omitempty"`
|
|||
|
|
|||
|
// 请求此时间戳之后(更新的数据)的分页内容,传的值为对应接口的`fundingTime`
|
|||
|
Before *string `json:"before,omitempty"`
|
|||
|
|
|||
|
// 分页返回的结果集数量,最大为100,不填默认返回100条
|
|||
|
Limit *string `json:"limit,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicInstrumentsParams defines parameters for GetApiV5PublicInstruments.
|
|||
|
type GetApiV5PublicInstrumentsParams struct {
|
|||
|
// 产品类型<br>`SPOT`:币币;`MARGIN`:币币杠杆;`SWAP`:永续合约 `FUTURES`:交割合约;`OPTION`:期权
|
|||
|
InstType string `json:"instType"`
|
|||
|
|
|||
|
// 合约标的指数,如:`BTC-USD`<br>仅适用于`交割/永续/期权`,`期权`必填
|
|||
|
Uly *string `json:"uly,omitempty"`
|
|||
|
|
|||
|
// 产品ID,如 `BTC-USDT`
|
|||
|
InstId *string `json:"instId,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicInsuranceFundParams defines parameters for GetApiV5PublicInsuranceFund.
|
|||
|
type GetApiV5PublicInsuranceFundParams struct {
|
|||
|
// 产品类型<br>`MARGIN`:币币杠杆,`SWAP`:永续合约,`FUTURES`:交割合约,`OPTION`:期权
|
|||
|
InstType string `json:"instType"`
|
|||
|
|
|||
|
// 产品类型<br>`liquidation_balance_deposit`:强平注入,`bankruptcy_loss`:穿仓亏损,`platform_revenue`:平台收入注入
|
|||
|
Type *string `json:"type,omitempty"`
|
|||
|
|
|||
|
// 标的指数<br>仅适用于`交割/永续/期权`,且必填写
|
|||
|
Uly *string `json:"uly,omitempty"`
|
|||
|
|
|||
|
// 币种,仅适用`币币杠杆`,且必填写
|
|||
|
Ccy *string `json:"ccy,omitempty"`
|
|||
|
|
|||
|
// 请求此时间戳之后(更新的数据)的分页内容,传的值为对应接口的`ts`
|
|||
|
Before *string `json:"before,omitempty"`
|
|||
|
|
|||
|
// 请求此时间戳之前(更旧的数据)的分页内容,传的值为对应接口的`ts`
|
|||
|
After *string `json:"after,omitempty"`
|
|||
|
|
|||
|
// 分页返回的结果集数量,最大为100,不填默认返回100条
|
|||
|
Limit *string `json:"limit,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicLiquidationOrdersParams defines parameters for GetApiV5PublicLiquidationOrders.
|
|||
|
type GetApiV5PublicLiquidationOrdersParams struct {
|
|||
|
// 产品类型<br>`MARGIN`:币币杠杆,`SWAP`:永续合约,`FUTURES`:交割合约,`OPTION`:期权
|
|||
|
InstType string `json:"instType"`
|
|||
|
|
|||
|
// 保证金模式<br>`cross`:全仓,`isolated`:逐仓
|
|||
|
MgnMode *string `json:"mgnMode,omitempty"`
|
|||
|
|
|||
|
// 产品ID,仅适用于`币币杠杆`
|
|||
|
InstId *string `json:"instId,omitempty"`
|
|||
|
|
|||
|
// 币种,仅适用于全仓`币币杠杆`
|
|||
|
Ccy *string `json:"ccy,omitempty"`
|
|||
|
|
|||
|
// 合约标的指数<br>`交割/永续/期权`合约情况下,该参数必填
|
|||
|
Uly *string `json:"uly,omitempty"`
|
|||
|
|
|||
|
// `this_week`:本周,`next_week`:次周,`quarter`:季度,`next_quarter`:次季度<br>`交割`合约情况下,该参数必填
|
|||
|
Alias *string `json:"alias,omitempty"`
|
|||
|
|
|||
|
// 状态<br>`unfilled`:未成交,`filled`:已成交<br>默认为`unfilled`<br>`交割/永续`合约情况下,该参数必填
|
|||
|
State *string `json:"state,omitempty"`
|
|||
|
|
|||
|
// 请求此时间戳之前(更旧的数据)的分页内容,传的值为对应接口的`ts`
|
|||
|
After *string `json:"after,omitempty"`
|
|||
|
|
|||
|
// 请求此时间戳之后(更新的数据)的分页内容,传的值为对应接口的`ts`
|
|||
|
Before *string `json:"before,omitempty"`
|
|||
|
|
|||
|
// 分页返回的结果集数量,最大为100,不填默认返回100条
|
|||
|
Limit *string `json:"limit,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicMarkPriceParams defines parameters for GetApiV5PublicMarkPrice.
|
|||
|
type GetApiV5PublicMarkPriceParams struct {
|
|||
|
// 产品类型<br>`MARGIN`:币币杠杆,`SWAP`:永续合约,`FUTURES`:交割合约,`OPTION`:期权
|
|||
|
InstType string `json:"instType"`
|
|||
|
|
|||
|
// 产品ID,如:`BTC-USDT-SWAP`
|
|||
|
InstId *string `json:"instId,omitempty"`
|
|||
|
|
|||
|
// 合约标的指数,如:`BTC-USD`
|
|||
|
Uly *string `json:"uly,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicOpenInterestParams defines parameters for GetApiV5PublicOpenInterest.
|
|||
|
type GetApiV5PublicOpenInterestParams struct {
|
|||
|
// 产品类型<br>`FUTURES`:交割合约,`SWAP`:永续合约,`OPTION`:期权
|
|||
|
InstType string `json:"instType"`
|
|||
|
|
|||
|
// 合约标的指数,如:`BTC-USD`<br>仅适用于`交割/永续/期权`
|
|||
|
Uly *string `json:"uly,omitempty"`
|
|||
|
|
|||
|
// 产品ID,如:`BTC-USD-SWAP`<br>仅适用于`交割/永续/期权`
|
|||
|
InstId *string `json:"instId,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicOptSummaryParams defines parameters for GetApiV5PublicOptSummary.
|
|||
|
type GetApiV5PublicOptSummaryParams struct {
|
|||
|
// 合约标的指数,如:`BTC-USD-200103-5500-C`<br>仅适用于`期权`
|
|||
|
Uly string `json:"uly"`
|
|||
|
|
|||
|
// 合约到期日,格式为`YYMMDD`,如 `200527`
|
|||
|
ExpTime string `json:"expTime"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicPositionTiersParams defines parameters for GetApiV5PublicPositionTiers.
|
|||
|
type GetApiV5PublicPositionTiersParams struct {
|
|||
|
// 产品类型<br>`MARGIN`:币币杠杆,`SWAP`:永续合约,`FUTURES`:交割合约,`OPTION`:期权
|
|||
|
InstType string `json:"instType"`
|
|||
|
|
|||
|
// 交易模式<br>`isolated`:逐仓,`cross`:全仓
|
|||
|
TdMode string `json:"tdMode"`
|
|||
|
|
|||
|
// 产品ID,如:`BTC-USDT`<br>仅适用`币币杠杆`,且必填
|
|||
|
InstId *string `json:"instId,omitempty"`
|
|||
|
|
|||
|
// 合约标的指数,如:`BTC-USD`<br>仅适用于`交割/永续/期权`,且必填
|
|||
|
Uly *string `json:"uly,omitempty"`
|
|||
|
|
|||
|
// 指定档位
|
|||
|
Tier *string `json:"tier,omitempty"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicPriceLimitParams defines parameters for GetApiV5PublicPriceLimit.
|
|||
|
type GetApiV5PublicPriceLimitParams struct {
|
|||
|
// 产品ID,如:`BTC-USDT-SWAP`<br>适用于`交割/永续/期权`
|
|||
|
InstId string `json:"instId"`
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicUnderlyingParams defines parameters for GetApiV5PublicUnderlying.
|
|||
|
type GetApiV5PublicUnderlyingParams struct {
|
|||
|
// 产品类型<br>`SWAP`:永续合约,`FUTURES`:交割合约,`OPTION`:期权
|
|||
|
InstType string `json:"instType"`
|
|||
|
}
|
|||
|
|
|||
|
// RequestEditorFn is the function signature for the RequestEditor callback function
|
|||
|
type RequestEditorFn func(ctx context.Context, req *http.Request) error
|
|||
|
|
|||
|
// Doer performs HTTP requests.
|
|||
|
//
|
|||
|
// The standard http.Client implements this interface.
|
|||
|
type HttpRequestDoer interface {
|
|||
|
Do(req *http.Request) (*http.Response, error)
|
|||
|
}
|
|||
|
|
|||
|
// Client which conforms to the OpenAPI3 specification for this service.
|
|||
|
type Client struct {
|
|||
|
// The endpoint of the server conforming to this interface, with scheme,
|
|||
|
// https://api.deepmap.com for example. This can contain a path relative
|
|||
|
// to the server, such as https://api.deepmap.com/dev-test, and all the
|
|||
|
// paths in the swagger spec will be appended to the server.
|
|||
|
Server string
|
|||
|
|
|||
|
// Doer for performing requests, typically a *http.Client with any
|
|||
|
// customized settings, such as certificate chains.
|
|||
|
Client HttpRequestDoer
|
|||
|
|
|||
|
// A list of callbacks for modifying requests which are generated before sending over
|
|||
|
// the network.
|
|||
|
RequestEditors []RequestEditorFn
|
|||
|
}
|
|||
|
|
|||
|
// ClientOption allows setting custom parameters during construction
|
|||
|
type ClientOption func(*Client) error
|
|||
|
|
|||
|
// Creates a new Client, with reasonable defaults
|
|||
|
func NewClient(server string, opts ...ClientOption) (*Client, error) {
|
|||
|
// create a client with sane default values
|
|||
|
client := Client{
|
|||
|
Server: server,
|
|||
|
}
|
|||
|
// mutate client and add all optional params
|
|||
|
for _, o := range opts {
|
|||
|
if err := o(&client); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
}
|
|||
|
// ensure the server URL always has a trailing slash
|
|||
|
if !strings.HasSuffix(client.Server, "/") {
|
|||
|
client.Server += "/"
|
|||
|
}
|
|||
|
// create httpClient, if not already present
|
|||
|
if client.Client == nil {
|
|||
|
client.Client = &http.Client{}
|
|||
|
}
|
|||
|
return &client, nil
|
|||
|
}
|
|||
|
|
|||
|
// WithHTTPClient allows overriding the default Doer, which is
|
|||
|
// automatically created using http.Client. This is useful for tests.
|
|||
|
func WithHTTPClient(doer HttpRequestDoer) ClientOption {
|
|||
|
return func(c *Client) error {
|
|||
|
c.Client = doer
|
|||
|
return nil
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// WithRequestEditorFn allows setting up a callback function, which will be
|
|||
|
// called right before sending the request. This can be used to mutate the request.
|
|||
|
func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
|
|||
|
return func(c *Client) error {
|
|||
|
c.RequestEditors = append(c.RequestEditors, fn)
|
|||
|
return nil
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// The interface specification for the client above.
|
|||
|
type ClientInterface interface {
|
|||
|
// GetApiV5PublicDeliveryExerciseHistory request
|
|||
|
GetApiV5PublicDeliveryExerciseHistory(ctx context.Context, params *GetApiV5PublicDeliveryExerciseHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicDiscountRateInterestFreeQuota request
|
|||
|
GetApiV5PublicDiscountRateInterestFreeQuota(ctx context.Context, params *GetApiV5PublicDiscountRateInterestFreeQuotaParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicEstimatedPrice request
|
|||
|
GetApiV5PublicEstimatedPrice(ctx context.Context, params *GetApiV5PublicEstimatedPriceParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicFundingRate request
|
|||
|
GetApiV5PublicFundingRate(ctx context.Context, params *GetApiV5PublicFundingRateParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicFundingRateHistory request
|
|||
|
GetApiV5PublicFundingRateHistory(ctx context.Context, params *GetApiV5PublicFundingRateHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicInstruments request
|
|||
|
GetApiV5PublicInstruments(ctx context.Context, params *GetApiV5PublicInstrumentsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicInsuranceFund request
|
|||
|
GetApiV5PublicInsuranceFund(ctx context.Context, params *GetApiV5PublicInsuranceFundParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicInterestRateLoanQuota request
|
|||
|
GetApiV5PublicInterestRateLoanQuota(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicLiquidationOrders request
|
|||
|
GetApiV5PublicLiquidationOrders(ctx context.Context, params *GetApiV5PublicLiquidationOrdersParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicMarkPrice request
|
|||
|
GetApiV5PublicMarkPrice(ctx context.Context, params *GetApiV5PublicMarkPriceParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicOpenInterest request
|
|||
|
GetApiV5PublicOpenInterest(ctx context.Context, params *GetApiV5PublicOpenInterestParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicOptSummary request
|
|||
|
GetApiV5PublicOptSummary(ctx context.Context, params *GetApiV5PublicOptSummaryParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicPositionTiers request
|
|||
|
GetApiV5PublicPositionTiers(ctx context.Context, params *GetApiV5PublicPositionTiersParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicPriceLimit request
|
|||
|
GetApiV5PublicPriceLimit(ctx context.Context, params *GetApiV5PublicPriceLimitParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicTime request
|
|||
|
GetApiV5PublicTime(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
|
|||
|
// GetApiV5PublicUnderlying request
|
|||
|
GetApiV5PublicUnderlying(ctx context.Context, params *GetApiV5PublicUnderlyingParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicDeliveryExerciseHistory(ctx context.Context, params *GetApiV5PublicDeliveryExerciseHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicDeliveryExerciseHistoryRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicDiscountRateInterestFreeQuota(ctx context.Context, params *GetApiV5PublicDiscountRateInterestFreeQuotaParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicDiscountRateInterestFreeQuotaRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicEstimatedPrice(ctx context.Context, params *GetApiV5PublicEstimatedPriceParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicEstimatedPriceRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicFundingRate(ctx context.Context, params *GetApiV5PublicFundingRateParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicFundingRateRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicFundingRateHistory(ctx context.Context, params *GetApiV5PublicFundingRateHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicFundingRateHistoryRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicInstruments(ctx context.Context, params *GetApiV5PublicInstrumentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicInstrumentsRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicInsuranceFund(ctx context.Context, params *GetApiV5PublicInsuranceFundParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicInsuranceFundRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicInterestRateLoanQuota(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicInterestRateLoanQuotaRequest(c.Server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicLiquidationOrders(ctx context.Context, params *GetApiV5PublicLiquidationOrdersParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicLiquidationOrdersRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicMarkPrice(ctx context.Context, params *GetApiV5PublicMarkPriceParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicMarkPriceRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicOpenInterest(ctx context.Context, params *GetApiV5PublicOpenInterestParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicOpenInterestRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicOptSummary(ctx context.Context, params *GetApiV5PublicOptSummaryParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicOptSummaryRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicPositionTiers(ctx context.Context, params *GetApiV5PublicPositionTiersParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicPositionTiersRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicPriceLimit(ctx context.Context, params *GetApiV5PublicPriceLimitParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicPriceLimitRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicTime(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicTimeRequest(c.Server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) GetApiV5PublicUnderlying(ctx context.Context, params *GetApiV5PublicUnderlyingParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
|||
|
req, err := NewGetApiV5PublicUnderlyingRequest(c.Server, params)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
req = req.WithContext(ctx)
|
|||
|
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return c.Client.Do(req)
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicDeliveryExerciseHistoryRequest generates requests for GetApiV5PublicDeliveryExerciseHistory
|
|||
|
func NewGetApiV5PublicDeliveryExerciseHistoryRequest(server string, params *GetApiV5PublicDeliveryExerciseHistoryParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/delivery-exercise-history")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, params.Uly); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if params.After != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Before != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Limit != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicDiscountRateInterestFreeQuotaRequest generates requests for GetApiV5PublicDiscountRateInterestFreeQuota
|
|||
|
func NewGetApiV5PublicDiscountRateInterestFreeQuotaRequest(server string, params *GetApiV5PublicDiscountRateInterestFreeQuotaParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/discount-rate-interest-free-quota")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if params.Ccy != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ccy", runtime.ParamLocationQuery, *params.Ccy); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.DiscountLv != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "discountLv", runtime.ParamLocationQuery, *params.DiscountLv); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicEstimatedPriceRequest generates requests for GetApiV5PublicEstimatedPrice
|
|||
|
func NewGetApiV5PublicEstimatedPriceRequest(server string, params *GetApiV5PublicEstimatedPriceParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/estimated-price")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, params.InstId); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicFundingRateRequest generates requests for GetApiV5PublicFundingRate
|
|||
|
func NewGetApiV5PublicFundingRateRequest(server string, params *GetApiV5PublicFundingRateParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/funding-rate")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if params.InstId != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicFundingRateHistoryRequest generates requests for GetApiV5PublicFundingRateHistory
|
|||
|
func NewGetApiV5PublicFundingRateHistoryRequest(server string, params *GetApiV5PublicFundingRateHistoryParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/funding-rate-history")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if params.InstId != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.After != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Before != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Limit != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicInstrumentsRequest generates requests for GetApiV5PublicInstruments
|
|||
|
func NewGetApiV5PublicInstrumentsRequest(server string, params *GetApiV5PublicInstrumentsParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/instruments")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if params.Uly != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.InstId != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicInsuranceFundRequest generates requests for GetApiV5PublicInsuranceFund
|
|||
|
func NewGetApiV5PublicInsuranceFundRequest(server string, params *GetApiV5PublicInsuranceFundParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/insurance-fund")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if params.Type != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "type", runtime.ParamLocationQuery, *params.Type); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Uly != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Ccy != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ccy", runtime.ParamLocationQuery, *params.Ccy); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Before != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.After != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Limit != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicInterestRateLoanQuotaRequest generates requests for GetApiV5PublicInterestRateLoanQuota
|
|||
|
func NewGetApiV5PublicInterestRateLoanQuotaRequest(server string) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/interest-rate-loan-quota")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicLiquidationOrdersRequest generates requests for GetApiV5PublicLiquidationOrders
|
|||
|
func NewGetApiV5PublicLiquidationOrdersRequest(server string, params *GetApiV5PublicLiquidationOrdersParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/liquidation-orders")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if params.MgnMode != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "mgnMode", runtime.ParamLocationQuery, *params.MgnMode); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.InstId != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Ccy != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ccy", runtime.ParamLocationQuery, *params.Ccy); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Uly != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Alias != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "alias", runtime.ParamLocationQuery, *params.Alias); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.State != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.After != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Before != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Limit != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicMarkPriceRequest generates requests for GetApiV5PublicMarkPrice
|
|||
|
func NewGetApiV5PublicMarkPriceRequest(server string, params *GetApiV5PublicMarkPriceParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/mark-price")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if params.InstId != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Uly != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicOpenInterestRequest generates requests for GetApiV5PublicOpenInterest
|
|||
|
func NewGetApiV5PublicOpenInterestRequest(server string, params *GetApiV5PublicOpenInterestParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/open-interest")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if params.Uly != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.InstId != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicOptSummaryRequest generates requests for GetApiV5PublicOptSummary
|
|||
|
func NewGetApiV5PublicOptSummaryRequest(server string, params *GetApiV5PublicOptSummaryParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/opt-summary")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, params.Uly); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "expTime", runtime.ParamLocationQuery, params.ExpTime); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicPositionTiersRequest generates requests for GetApiV5PublicPositionTiers
|
|||
|
func NewGetApiV5PublicPositionTiersRequest(server string, params *GetApiV5PublicPositionTiersParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/position-tiers")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "tdMode", runtime.ParamLocationQuery, params.TdMode); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if params.InstId != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Uly != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if params.Tier != nil {
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "tier", runtime.ParamLocationQuery, *params.Tier); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicPriceLimitRequest generates requests for GetApiV5PublicPriceLimit
|
|||
|
func NewGetApiV5PublicPriceLimitRequest(server string, params *GetApiV5PublicPriceLimitParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/price-limit")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, params.InstId); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicTimeRequest generates requests for GetApiV5PublicTime
|
|||
|
func NewGetApiV5PublicTimeRequest(server string) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/time")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
// NewGetApiV5PublicUnderlyingRequest generates requests for GetApiV5PublicUnderlying
|
|||
|
func NewGetApiV5PublicUnderlyingRequest(server string, params *GetApiV5PublicUnderlyingParams) (*http.Request, error) {
|
|||
|
var err error
|
|||
|
|
|||
|
serverURL, err := url.Parse(server)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
operationPath := fmt.Sprintf("/api/v5/public/underlying")
|
|||
|
if operationPath[0] == '/' {
|
|||
|
operationPath = "." + operationPath
|
|||
|
}
|
|||
|
|
|||
|
queryURL, err := serverURL.Parse(operationPath)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
queryValues := queryURL.Query()
|
|||
|
|
|||
|
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
|
|||
|
return nil, err
|
|||
|
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
|||
|
return nil, err
|
|||
|
} else {
|
|||
|
for k, v := range parsed {
|
|||
|
for _, v2 := range v {
|
|||
|
queryValues.Add(k, v2)
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
queryURL.RawQuery = queryValues.Encode()
|
|||
|
|
|||
|
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return req, nil
|
|||
|
}
|
|||
|
|
|||
|
func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error {
|
|||
|
for _, r := range c.RequestEditors {
|
|||
|
if err := r(ctx, req); err != nil {
|
|||
|
return err
|
|||
|
}
|
|||
|
}
|
|||
|
for _, r := range additionalEditors {
|
|||
|
if err := r(ctx, req); err != nil {
|
|||
|
return err
|
|||
|
}
|
|||
|
}
|
|||
|
return nil
|
|||
|
}
|
|||
|
|
|||
|
// ClientWithResponses builds on ClientInterface to offer response payloads
|
|||
|
type ClientWithResponses struct {
|
|||
|
ClientInterface
|
|||
|
}
|
|||
|
|
|||
|
// NewClientWithResponses creates a new ClientWithResponses, which wraps
|
|||
|
// Client with return type handling
|
|||
|
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) {
|
|||
|
client, err := NewClient(server, opts...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return &ClientWithResponses{client}, nil
|
|||
|
}
|
|||
|
|
|||
|
// WithBaseURL overrides the baseURL.
|
|||
|
func WithBaseURL(baseURL string) ClientOption {
|
|||
|
return func(c *Client) error {
|
|||
|
newBaseURL, err := url.Parse(baseURL)
|
|||
|
if err != nil {
|
|||
|
return err
|
|||
|
}
|
|||
|
c.Server = newBaseURL.String()
|
|||
|
return nil
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// ClientWithResponsesInterface is the interface specification for the client with responses above.
|
|||
|
type ClientWithResponsesInterface interface {
|
|||
|
// GetApiV5PublicDeliveryExerciseHistory request
|
|||
|
GetApiV5PublicDeliveryExerciseHistoryWithResponse(ctx context.Context, params *GetApiV5PublicDeliveryExerciseHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicDeliveryExerciseHistoryResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicDiscountRateInterestFreeQuota request
|
|||
|
GetApiV5PublicDiscountRateInterestFreeQuotaWithResponse(ctx context.Context, params *GetApiV5PublicDiscountRateInterestFreeQuotaParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicDiscountRateInterestFreeQuotaResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicEstimatedPrice request
|
|||
|
GetApiV5PublicEstimatedPriceWithResponse(ctx context.Context, params *GetApiV5PublicEstimatedPriceParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicEstimatedPriceResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicFundingRate request
|
|||
|
GetApiV5PublicFundingRateWithResponse(ctx context.Context, params *GetApiV5PublicFundingRateParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicFundingRateResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicFundingRateHistory request
|
|||
|
GetApiV5PublicFundingRateHistoryWithResponse(ctx context.Context, params *GetApiV5PublicFundingRateHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicFundingRateHistoryResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicInstruments request
|
|||
|
GetApiV5PublicInstrumentsWithResponse(ctx context.Context, params *GetApiV5PublicInstrumentsParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicInstrumentsResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicInsuranceFund request
|
|||
|
GetApiV5PublicInsuranceFundWithResponse(ctx context.Context, params *GetApiV5PublicInsuranceFundParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicInsuranceFundResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicInterestRateLoanQuota request
|
|||
|
GetApiV5PublicInterestRateLoanQuotaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV5PublicInterestRateLoanQuotaResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicLiquidationOrders request
|
|||
|
GetApiV5PublicLiquidationOrdersWithResponse(ctx context.Context, params *GetApiV5PublicLiquidationOrdersParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicLiquidationOrdersResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicMarkPrice request
|
|||
|
GetApiV5PublicMarkPriceWithResponse(ctx context.Context, params *GetApiV5PublicMarkPriceParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicMarkPriceResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicOpenInterest request
|
|||
|
GetApiV5PublicOpenInterestWithResponse(ctx context.Context, params *GetApiV5PublicOpenInterestParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicOpenInterestResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicOptSummary request
|
|||
|
GetApiV5PublicOptSummaryWithResponse(ctx context.Context, params *GetApiV5PublicOptSummaryParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicOptSummaryResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicPositionTiers request
|
|||
|
GetApiV5PublicPositionTiersWithResponse(ctx context.Context, params *GetApiV5PublicPositionTiersParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicPositionTiersResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicPriceLimit request
|
|||
|
GetApiV5PublicPriceLimitWithResponse(ctx context.Context, params *GetApiV5PublicPriceLimitParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicPriceLimitResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicTime request
|
|||
|
GetApiV5PublicTimeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV5PublicTimeResponse, error)
|
|||
|
|
|||
|
// GetApiV5PublicUnderlying request
|
|||
|
GetApiV5PublicUnderlyingWithResponse(ctx context.Context, params *GetApiV5PublicUnderlyingParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicUnderlyingResponse, error)
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicDeliveryExerciseHistoryResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicDeliveryExerciseHistoryResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicDeliveryExerciseHistoryResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicDiscountRateInterestFreeQuotaResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicDiscountRateInterestFreeQuotaResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicDiscountRateInterestFreeQuotaResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicEstimatedPriceResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicEstimatedPriceResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicEstimatedPriceResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicFundingRateResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicFundingRateResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicFundingRateResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicFundingRateHistoryResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicFundingRateHistoryResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicFundingRateHistoryResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicInstrumentsResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicInstrumentsResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicInstrumentsResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicInsuranceFundResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicInsuranceFundResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicInsuranceFundResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicInterestRateLoanQuotaResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicInterestRateLoanQuotaResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicInterestRateLoanQuotaResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicLiquidationOrdersResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicLiquidationOrdersResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicLiquidationOrdersResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicMarkPriceResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicMarkPriceResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicMarkPriceResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicOpenInterestResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicOpenInterestResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicOpenInterestResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicOptSummaryResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicOptSummaryResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicOptSummaryResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicPositionTiersResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicPositionTiersResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicPositionTiersResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicPriceLimitResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicPriceLimitResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicPriceLimitResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicTimeResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicTimeResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicTimeResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
type GetApiV5PublicUnderlyingResponse struct {
|
|||
|
Body []byte
|
|||
|
HTTPResponse *http.Response
|
|||
|
JSON200 *map[string]interface{}
|
|||
|
}
|
|||
|
|
|||
|
// Status returns HTTPResponse.Status
|
|||
|
func (r GetApiV5PublicUnderlyingResponse) Status() string {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.Status
|
|||
|
}
|
|||
|
return http.StatusText(0)
|
|||
|
}
|
|||
|
|
|||
|
// StatusCode returns HTTPResponse.StatusCode
|
|||
|
func (r GetApiV5PublicUnderlyingResponse) StatusCode() int {
|
|||
|
if r.HTTPResponse != nil {
|
|||
|
return r.HTTPResponse.StatusCode
|
|||
|
}
|
|||
|
return 0
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicDeliveryExerciseHistoryWithResponse request returning *GetApiV5PublicDeliveryExerciseHistoryResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicDeliveryExerciseHistoryWithResponse(ctx context.Context, params *GetApiV5PublicDeliveryExerciseHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicDeliveryExerciseHistoryResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicDeliveryExerciseHistory(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicDeliveryExerciseHistoryResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicDiscountRateInterestFreeQuotaWithResponse request returning *GetApiV5PublicDiscountRateInterestFreeQuotaResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicDiscountRateInterestFreeQuotaWithResponse(ctx context.Context, params *GetApiV5PublicDiscountRateInterestFreeQuotaParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicDiscountRateInterestFreeQuotaResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicDiscountRateInterestFreeQuota(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicDiscountRateInterestFreeQuotaResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicEstimatedPriceWithResponse request returning *GetApiV5PublicEstimatedPriceResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicEstimatedPriceWithResponse(ctx context.Context, params *GetApiV5PublicEstimatedPriceParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicEstimatedPriceResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicEstimatedPrice(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicEstimatedPriceResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicFundingRateWithResponse request returning *GetApiV5PublicFundingRateResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicFundingRateWithResponse(ctx context.Context, params *GetApiV5PublicFundingRateParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicFundingRateResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicFundingRate(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicFundingRateResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicFundingRateHistoryWithResponse request returning *GetApiV5PublicFundingRateHistoryResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicFundingRateHistoryWithResponse(ctx context.Context, params *GetApiV5PublicFundingRateHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicFundingRateHistoryResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicFundingRateHistory(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicFundingRateHistoryResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicInstrumentsWithResponse request returning *GetApiV5PublicInstrumentsResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicInstrumentsWithResponse(ctx context.Context, params *GetApiV5PublicInstrumentsParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicInstrumentsResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicInstruments(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicInstrumentsResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicInsuranceFundWithResponse request returning *GetApiV5PublicInsuranceFundResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicInsuranceFundWithResponse(ctx context.Context, params *GetApiV5PublicInsuranceFundParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicInsuranceFundResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicInsuranceFund(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicInsuranceFundResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicInterestRateLoanQuotaWithResponse request returning *GetApiV5PublicInterestRateLoanQuotaResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicInterestRateLoanQuotaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV5PublicInterestRateLoanQuotaResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicInterestRateLoanQuota(ctx, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicInterestRateLoanQuotaResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicLiquidationOrdersWithResponse request returning *GetApiV5PublicLiquidationOrdersResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicLiquidationOrdersWithResponse(ctx context.Context, params *GetApiV5PublicLiquidationOrdersParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicLiquidationOrdersResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicLiquidationOrders(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicLiquidationOrdersResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicMarkPriceWithResponse request returning *GetApiV5PublicMarkPriceResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicMarkPriceWithResponse(ctx context.Context, params *GetApiV5PublicMarkPriceParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicMarkPriceResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicMarkPrice(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicMarkPriceResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicOpenInterestWithResponse request returning *GetApiV5PublicOpenInterestResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicOpenInterestWithResponse(ctx context.Context, params *GetApiV5PublicOpenInterestParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicOpenInterestResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicOpenInterest(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicOpenInterestResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicOptSummaryWithResponse request returning *GetApiV5PublicOptSummaryResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicOptSummaryWithResponse(ctx context.Context, params *GetApiV5PublicOptSummaryParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicOptSummaryResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicOptSummary(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicOptSummaryResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicPositionTiersWithResponse request returning *GetApiV5PublicPositionTiersResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicPositionTiersWithResponse(ctx context.Context, params *GetApiV5PublicPositionTiersParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicPositionTiersResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicPositionTiers(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicPositionTiersResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicPriceLimitWithResponse request returning *GetApiV5PublicPriceLimitResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicPriceLimitWithResponse(ctx context.Context, params *GetApiV5PublicPriceLimitParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicPriceLimitResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicPriceLimit(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicPriceLimitResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicTimeWithResponse request returning *GetApiV5PublicTimeResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicTimeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV5PublicTimeResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicTime(ctx, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicTimeResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// GetApiV5PublicUnderlyingWithResponse request returning *GetApiV5PublicUnderlyingResponse
|
|||
|
func (c *ClientWithResponses) GetApiV5PublicUnderlyingWithResponse(ctx context.Context, params *GetApiV5PublicUnderlyingParams, reqEditors ...RequestEditorFn) (*GetApiV5PublicUnderlyingResponse, error) {
|
|||
|
rsp, err := c.GetApiV5PublicUnderlying(ctx, params, reqEditors...)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
return ParseGetApiV5PublicUnderlyingResponse(rsp)
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicDeliveryExerciseHistoryResponse parses an HTTP response from a GetApiV5PublicDeliveryExerciseHistoryWithResponse call
|
|||
|
func ParseGetApiV5PublicDeliveryExerciseHistoryResponse(rsp *http.Response) (*GetApiV5PublicDeliveryExerciseHistoryResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicDeliveryExerciseHistoryResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicDiscountRateInterestFreeQuotaResponse parses an HTTP response from a GetApiV5PublicDiscountRateInterestFreeQuotaWithResponse call
|
|||
|
func ParseGetApiV5PublicDiscountRateInterestFreeQuotaResponse(rsp *http.Response) (*GetApiV5PublicDiscountRateInterestFreeQuotaResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicDiscountRateInterestFreeQuotaResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicEstimatedPriceResponse parses an HTTP response from a GetApiV5PublicEstimatedPriceWithResponse call
|
|||
|
func ParseGetApiV5PublicEstimatedPriceResponse(rsp *http.Response) (*GetApiV5PublicEstimatedPriceResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicEstimatedPriceResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicFundingRateResponse parses an HTTP response from a GetApiV5PublicFundingRateWithResponse call
|
|||
|
func ParseGetApiV5PublicFundingRateResponse(rsp *http.Response) (*GetApiV5PublicFundingRateResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicFundingRateResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicFundingRateHistoryResponse parses an HTTP response from a GetApiV5PublicFundingRateHistoryWithResponse call
|
|||
|
func ParseGetApiV5PublicFundingRateHistoryResponse(rsp *http.Response) (*GetApiV5PublicFundingRateHistoryResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicFundingRateHistoryResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicInstrumentsResponse parses an HTTP response from a GetApiV5PublicInstrumentsWithResponse call
|
|||
|
func ParseGetApiV5PublicInstrumentsResponse(rsp *http.Response) (*GetApiV5PublicInstrumentsResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicInstrumentsResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicInsuranceFundResponse parses an HTTP response from a GetApiV5PublicInsuranceFundWithResponse call
|
|||
|
func ParseGetApiV5PublicInsuranceFundResponse(rsp *http.Response) (*GetApiV5PublicInsuranceFundResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicInsuranceFundResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicInterestRateLoanQuotaResponse parses an HTTP response from a GetApiV5PublicInterestRateLoanQuotaWithResponse call
|
|||
|
func ParseGetApiV5PublicInterestRateLoanQuotaResponse(rsp *http.Response) (*GetApiV5PublicInterestRateLoanQuotaResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicInterestRateLoanQuotaResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicLiquidationOrdersResponse parses an HTTP response from a GetApiV5PublicLiquidationOrdersWithResponse call
|
|||
|
func ParseGetApiV5PublicLiquidationOrdersResponse(rsp *http.Response) (*GetApiV5PublicLiquidationOrdersResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicLiquidationOrdersResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicMarkPriceResponse parses an HTTP response from a GetApiV5PublicMarkPriceWithResponse call
|
|||
|
func ParseGetApiV5PublicMarkPriceResponse(rsp *http.Response) (*GetApiV5PublicMarkPriceResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicMarkPriceResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicOpenInterestResponse parses an HTTP response from a GetApiV5PublicOpenInterestWithResponse call
|
|||
|
func ParseGetApiV5PublicOpenInterestResponse(rsp *http.Response) (*GetApiV5PublicOpenInterestResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicOpenInterestResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicOptSummaryResponse parses an HTTP response from a GetApiV5PublicOptSummaryWithResponse call
|
|||
|
func ParseGetApiV5PublicOptSummaryResponse(rsp *http.Response) (*GetApiV5PublicOptSummaryResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicOptSummaryResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicPositionTiersResponse parses an HTTP response from a GetApiV5PublicPositionTiersWithResponse call
|
|||
|
func ParseGetApiV5PublicPositionTiersResponse(rsp *http.Response) (*GetApiV5PublicPositionTiersResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicPositionTiersResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicPriceLimitResponse parses an HTTP response from a GetApiV5PublicPriceLimitWithResponse call
|
|||
|
func ParseGetApiV5PublicPriceLimitResponse(rsp *http.Response) (*GetApiV5PublicPriceLimitResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicPriceLimitResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicTimeResponse parses an HTTP response from a GetApiV5PublicTimeWithResponse call
|
|||
|
func ParseGetApiV5PublicTimeResponse(rsp *http.Response) (*GetApiV5PublicTimeResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicTimeResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// ParseGetApiV5PublicUnderlyingResponse parses an HTTP response from a GetApiV5PublicUnderlyingWithResponse call
|
|||
|
func ParseGetApiV5PublicUnderlyingResponse(rsp *http.Response) (*GetApiV5PublicUnderlyingResponse, error) {
|
|||
|
bodyBytes, err := ioutil.ReadAll(rsp.Body)
|
|||
|
defer func() { _ = rsp.Body.Close() }()
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
response := &GetApiV5PublicUnderlyingResponse{
|
|||
|
Body: bodyBytes,
|
|||
|
HTTPResponse: rsp,
|
|||
|
}
|
|||
|
|
|||
|
switch {
|
|||
|
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
|||
|
var dest map[string]interface{}
|
|||
|
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
response.JSON200 = &dest
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return response, nil
|
|||
|
}
|
|||
|
|
|||
|
// Base64 encoded, gzipped, json marshaled Swagger object
|
|||
|
var swaggerSpec = []string{
|
|||
|
|
|||
|
"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",
|
|||
|
"z55sneQTAxP/FwAA//8rbxVWr0EAAA==",
|
|||
|
}
|
|||
|
|
|||
|
// GetSwagger returns the content of the embedded swagger specification file
|
|||
|
// or error if failed to decode
|
|||
|
func decodeSpec() ([]byte, error) {
|
|||
|
zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
|
|||
|
if err != nil {
|
|||
|
return nil, fmt.Errorf("error base64 decoding spec: %s", err)
|
|||
|
}
|
|||
|
zr, err := gzip.NewReader(bytes.NewReader(zipped))
|
|||
|
if err != nil {
|
|||
|
return nil, fmt.Errorf("error decompressing spec: %s", err)
|
|||
|
}
|
|||
|
var buf bytes.Buffer
|
|||
|
_, err = buf.ReadFrom(zr)
|
|||
|
if err != nil {
|
|||
|
return nil, fmt.Errorf("error decompressing spec: %s", err)
|
|||
|
}
|
|||
|
|
|||
|
return buf.Bytes(), nil
|
|||
|
}
|
|||
|
|
|||
|
var rawSpec = decodeSpecCached()
|
|||
|
|
|||
|
// a naive cached of a decoded swagger spec
|
|||
|
func decodeSpecCached() func() ([]byte, error) {
|
|||
|
data, err := decodeSpec()
|
|||
|
return func() ([]byte, error) {
|
|||
|
return data, err
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
|
|||
|
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
|
|||
|
var res = make(map[string]func() ([]byte, error))
|
|||
|
if len(pathToFile) > 0 {
|
|||
|
res[pathToFile] = rawSpec
|
|||
|
}
|
|||
|
|
|||
|
return res
|
|||
|
}
|
|||
|
|
|||
|
// GetSwagger returns the Swagger specification corresponding to the generated code
|
|||
|
// in this file. The external references of Swagger specification are resolved.
|
|||
|
// The logic of resolving external references is tightly connected to "import-mapping" feature.
|
|||
|
// Externally referenced files must be embedded in the corresponding golang packages.
|
|||
|
// Urls can be supported but this task was out of the scope.
|
|||
|
func GetSwagger() (swagger *openapi3.T, err error) {
|
|||
|
var resolvePath = PathToRawSpec("")
|
|||
|
|
|||
|
loader := openapi3.NewLoader()
|
|||
|
loader.IsExternalRefsAllowed = true
|
|||
|
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
|
|||
|
var pathToFile = url.String()
|
|||
|
pathToFile = path.Clean(pathToFile)
|
|||
|
getSpec, ok := resolvePath[pathToFile]
|
|||
|
if !ok {
|
|||
|
err1 := fmt.Errorf("path not found: %s", pathToFile)
|
|||
|
return nil, err1
|
|||
|
}
|
|||
|
return getSpec()
|
|||
|
}
|
|||
|
var specData []byte
|
|||
|
specData, err = rawSpec()
|
|||
|
if err != nil {
|
|||
|
return
|
|||
|
}
|
|||
|
swagger, err = loader.LoadFromData(specData)
|
|||
|
if err != nil {
|
|||
|
return
|
|||
|
}
|
|||
|
return
|
|||
|
}
|
|||
|
|