// Package account 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 account import ( "bytes" "compress/gzip" "context" "encoding/base64" "encoding/json" "fmt" "io" "io/ioutil" "net/http" "net/url" "path" "strings" "github.com/deepmap/oapi-codegen/pkg/runtime" "github.com/getkin/kin-openapi/openapi3" ) // GetApiV5AccountAccountPositionRiskParams defines parameters for GetApiV5AccountAccountPositionRisk. type GetApiV5AccountAccountPositionRiskParams struct { // 产品类型
`SPOT`:币币
`MARGIN`:币币杠杆
`SWAP`:永续合约
`FUTURES`:交割合约
`OPTION`:期权 InstType *string `json:"instType,omitempty"` } // GetApiV5AccountBalanceParams defines parameters for GetApiV5AccountBalance. type GetApiV5AccountBalanceParams struct { // 币种,如:`BTC` Ccy *string `json:"ccy,omitempty"` } // GetApiV5AccountBillsParams defines parameters for GetApiV5AccountBills. type GetApiV5AccountBillsParams struct { // 产品类型
`SPOT`:币币
`MARGIN`:币币杠杆
`SWAP`:永续合约
`FUTURES`:交割合约
`OPTION`:期权 InstType *string `json:"instType,omitempty"` // 币种,如:`BTC` Ccy *string `json:"ccy,omitempty"` // 仓位类型
`isolated`:逐仓 `cross`:全仓 MgnMode *string `json:"mgnMode,omitempty"` // 合约类型
`linear`:正向合约 `inverse`:反向合约
仅交割/永续有效 CtType *string `json:"ctType,omitempty"` // 账单类型
1:划转 2:交易 3:交割 4:自动换币 5:强平 6:保证金划转 7:扣息 8:资金费 9:自动减仓 10:穿仓补偿 11:系统换币 12:策略划拨 Type *string `json:"type,omitempty"` // 子账单类型
1:买入 2:卖出 3:开多 4:开空 5:平多 6:平空 9:扣息 11:转入 12:转出 160:手动追加保证金 161:手动减少保证金 162:自动追加保证金 114:自动换币买入 115:自动换币卖出 118:系统换币转入 119:系统换币转出 100:强减平多 101:强减平空 102:强减买入 103:强减卖出 104:强平平多 105:强平平空 106:强平买入 107:强平卖出 110:强平换币转入 111:强平换币转出 125:自动减仓平多 126:自动减仓平空 127:自动减仓买入 128:自动减仓卖出 170:到期行权 171:到期被行权 172:到期作废 112:交割平多 113:交割平空 117:交割/期权穿仓补偿 173:资金费支出 174:资金费收入 200:系统转入 201:手动转入 202:系统转出 203:手动转出 SubType *string `json:"subType,omitempty"` // 请求此ID之前(更旧的数据)的分页内容,传的值为对应接口的`billId` After *string `json:"after,omitempty"` // 请求此ID之后(更新的数据)的分页内容,传的值为对应接口的`billId` Before *string `json:"before,omitempty"` // 返回结果的数量,默认100条 Limit *string `json:"limit,omitempty"` } // GetApiV5AccountBillsArchiveParams defines parameters for GetApiV5AccountBillsArchive. type GetApiV5AccountBillsArchiveParams struct { // 产品类型
`SPOT`:币币
`MARGIN`:币币杠杆
`SWAP`:永续合约
`FUTURES`:交割合约
`OPTION`:期权 InstType *string `json:"instType,omitempty"` // 币种,如:`BTC` Ccy *string `json:"ccy,omitempty"` // 仓位类型
`isolated`:逐仓 `cross`:全仓 MgnMode *string `json:"mgnMode,omitempty"` // 合约类型
`linear`:正向合约 `inverse`:反向合约
仅交割/永续有效 CtType *string `json:"ctType,omitempty"` // 账单类型
1:划转 2:交易 3:交割 4:自动换币 5:强平 6:保证金划转 7:扣息 8:资金费 9:自动减仓 10:穿仓补偿 11:系统换币 12:策略划拨 Type *string `json:"type,omitempty"` // 子账单类型
1:买入 2:卖出 3:开多 4:开空 5:平多 6:平空 9:扣息 11:转入 12:转出 160:手动追加保证金 161:手动减少保证金 162:自动追加保证金 114:自动换币买入 115:自动换币卖出 118:系统换币转入 119:系统换币转出 100:强减平多 101:强减平空 102:强减买入 103:强减卖出 104:强平平多 105:强平平空 106:强平买入 107:强平卖出 110:强平换币转入 111:强平换币转出 125:自动减仓平多 126:自动减仓平空 127:自动减仓买入 128:自动减仓卖出 170:到期行权 171:到期被行权 172:到期作废 112:交割平多 113:交割平空 117:交割/期权穿仓补偿 173:资金费支出 174:资金费收入 200:系统转入 201:手动转入 202:系统转出 203:手动转出 SubType *string `json:"subType,omitempty"` // 请求此ID之前(更旧的数据)的分页内容,传的值为对应接口的`billId` After *string `json:"after,omitempty"` // 请求此ID之后(更新的数据)的分页内容,传的值为对应接口的`billId` Before *string `json:"before,omitempty"` // 返回结果的数量,默认100条 Limit *string `json:"limit,omitempty"` } // GetApiV5AccountInterestAccruedParams defines parameters for GetApiV5AccountInterestAccrued. type GetApiV5AccountInterestAccruedParams struct { // 产品ID,如:`BTC-USDT` InstId *string `json:"instId,omitempty"` // 保证金模式
`isolated`:逐仓 `cross`:全仓 MgnMode *string `json:"mgnMode,omitempty"` // 币种,如:`BTC` Ccy *string `json:"ccy,omitempty"` // 查询在此之前的内容,值为时间戳,Unix时间戳为毫秒数格式 After *string `json:"after,omitempty"` // 查询在此之后的内容,值为时间戳,Unix时间戳为毫秒数格式 Before *string `json:"before,omitempty"` // 分页返回的结果集数量,最大为100,不填默认返回100条 Limit *string `json:"limit,omitempty"` } // GetApiV5AccountInterestRateParams defines parameters for GetApiV5AccountInterestRate. type GetApiV5AccountInterestRateParams struct { // 币种,如:`BTC` Ccy *string `json:"ccy,omitempty"` } // GetApiV5AccountLeverageInfoParams defines parameters for GetApiV5AccountLeverageInfo. type GetApiV5AccountLeverageInfoParams struct { // 产品ID,如:`BTC-USDT-SWAP`
支持多产品ID查询(不超过20个),半角逗号分隔 InstId string `json:"instId"` // 保证金模式
`cross`:全仓 `isolated`:逐仓 MgnMode string `json:"mgnMode"` } // GetApiV5AccountMaxAvailSizeParams defines parameters for GetApiV5AccountMaxAvailSize. type GetApiV5AccountMaxAvailSizeParams struct { // 产品ID,如:`BTC-USDT`
支持多产品ID查询(不超过5个),半角逗号分隔 InstId string `json:"instId"` // 交易模式
`cross`:全仓 `isolated`:逐仓 `cash`:非保证金 TdMode string `json:"tdMode"` // 保证金币种,仅适用于单币种保证金模式下的全仓杠杆订单 Ccy *string `json:"ccy,omitempty"` // 是否为只减仓模式,仅适用于`币币杠杆` ReduceOnly *bool `json:"reduceOnly,omitempty"` } // GetApiV5AccountMaxLoanParams defines parameters for GetApiV5AccountMaxLoan. type GetApiV5AccountMaxLoanParams struct { // 产品ID,如:`BTC-USDT` InstId string `json:"instId"` // 仓位类型
`cross`:全仓 `isolated`:逐仓 MgnMode string `json:"mgnMode"` // 保证金币种,如:`BTC`
币币杠杆单币种全仓情况下必须指定保证金币种 MgnCcy *string `json:"mgnCcy,omitempty"` } // GetApiV5AccountMaxSizeParams defines parameters for GetApiV5AccountMaxSize. type GetApiV5AccountMaxSizeParams struct { // 产品ID,如:`BTC-USDT`
支持多产品ID查询(不超过5个),半角逗号分隔 InstId string `json:"instId"` // 交易模式
`cross`:全仓 `isolated`:逐仓 `cash`:非保证金 TdMode string `json:"tdMode"` // 保证金币种,仅适用于单币种保证金模式下的全仓杠杆订单 Ccy *string `json:"ccy,omitempty"` // 委托价格
当不填委托价时会按当前最新成交价计算
当指定多个`instId`查询时,忽略该参数,按当前最新成交价计算 Px *string `json:"px,omitempty"` } // GetApiV5AccountMaxWithdrawalParams defines parameters for GetApiV5AccountMaxWithdrawal. type GetApiV5AccountMaxWithdrawalParams struct { // 币种,如:`BTC` Ccy *string `json:"ccy,omitempty"` } // PostApiV5AccountPositionMarginBalanceJSONBody defines parameters for PostApiV5AccountPositionMarginBalance. type PostApiV5AccountPositionMarginBalanceJSONBody struct { // 必填
增加或减少的保证金数量 Amt *string `json:"amt,omitempty"` // 必填
产品ID,如:`BTC-USDT-SWAP` InstId string `json:"instId"` // 必填
持仓方向,默认值是`net`
`long`:双向持仓多头
`short`:双向持仓空头
`net`:单向持仓 PosSide string `json:"posSide"` // 必填
增加/减少保证金
`add`:增加 `reduce`:减少 Type string `json:"type"` } // GetApiV5AccountPositionsParams defines parameters for GetApiV5AccountPositions. type GetApiV5AccountPositionsParams struct { // 产品类型
`SPOT`:币币
`MARGIN`:币币杠杆
`SWAP`:永续合约
`FUTURES`:交割合约
`OPTION`:期权 InstType *string `json:"instType,omitempty"` // 产品ID,如:`BTC-USDT`
支持多个instId查询(不超过10个),半角逗号分隔 InstId *string `json:"instId,omitempty"` // 持仓ID,支持多个posId查询(不超过20个),半角逗号分割 PosId *string `json:"posId,omitempty"` } // PostApiV5AccountSetGreeksJSONBody defines parameters for PostApiV5AccountSetGreeks. type PostApiV5AccountSetGreeksJSONBody struct { // 希腊字母展示方式
`PA`:币本位,`BS`:美元本位 GreeksType string `json:"greeksType"` } // PostApiV5AccountSetLeverageJSONBody defines parameters for PostApiV5AccountSetLeverage. type PostApiV5AccountSetLeverageJSONBody struct { // 可选
保证金币种,仅适用于跨币种保证金模式的全仓`币币杠杆`。 Ccy *string `json:"ccy,omitempty"` // 可选
产品ID:币对、合约
`instId`和`ccy`至少要传一个;如果两个都传,默认使用instId InstId *string `json:"instId,omitempty"` // 必填
杠杆倍数 Lever string `json:"lever"` // 保证金模式
`isolated`:逐仓,`cross`:全仓
如果`ccy`有效传值,该参数值只能为`cross`。 MgnMode string `json:"mgnMode"` // 可选
持仓方向
`long`:双向持仓多头
`short`:双向持仓空头
`net`:单向持仓
在双向持仓且保证金模式为逐仓条件下必填,且仅可选择`long`或`short`,其他情况下非必填,默认`net`;仅适用于`交割/永续` PosSide *string `json:"posSide,omitempty"` } // PostApiV5AccountSetPositionModeJSONBody defines parameters for PostApiV5AccountSetPositionMode. type PostApiV5AccountSetPositionModeJSONBody struct { // 持仓方式
`long_short_mode`:双向持仓
`net_mode`:单向持仓 PosMode string `json:"posMode"` } // GetApiV5AccountTradeFeeParams defines parameters for GetApiV5AccountTradeFee. type GetApiV5AccountTradeFeeParams struct { // 产品类型
`SPOT`:币币
`MARGIN`:币币杠杆
`SWAP`:永续合约
`FUTURES`:交割合约
`OPTION`:期权 InstType string `json:"instType"` // 产品ID,如:`BTC-USDT`
仅适用于instType为币币/币币杠杆 InstId *string `json:"instId,omitempty"` // 合约标的指数,如:`BTC-USD`
仅适用于`instType`为`交割`/`永续`/`期权` Uly *string `json:"uly,omitempty"` // 币种手续费类别
1:第一类币种费率 2:第二类币种费率 3:第三类币种费率 4:第四类币种费率 Category *string `json:"category,omitempty"` } // PostApiV5AccountPositionMarginBalanceJSONRequestBody defines body for PostApiV5AccountPositionMarginBalance for application/json ContentType. type PostApiV5AccountPositionMarginBalanceJSONRequestBody = PostApiV5AccountPositionMarginBalanceJSONBody // PostApiV5AccountSetGreeksJSONRequestBody defines body for PostApiV5AccountSetGreeks for application/json ContentType. type PostApiV5AccountSetGreeksJSONRequestBody = PostApiV5AccountSetGreeksJSONBody // PostApiV5AccountSetLeverageJSONRequestBody defines body for PostApiV5AccountSetLeverage for application/json ContentType. type PostApiV5AccountSetLeverageJSONRequestBody = PostApiV5AccountSetLeverageJSONBody // PostApiV5AccountSetPositionModeJSONRequestBody defines body for PostApiV5AccountSetPositionMode for application/json ContentType. type PostApiV5AccountSetPositionModeJSONRequestBody = PostApiV5AccountSetPositionModeJSONBody // 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 { // GetApiV5AccountAccountPositionRisk request GetApiV5AccountAccountPositionRisk(ctx context.Context, params *GetApiV5AccountAccountPositionRiskParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountBalance request GetApiV5AccountBalance(ctx context.Context, params *GetApiV5AccountBalanceParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountBills request GetApiV5AccountBills(ctx context.Context, params *GetApiV5AccountBillsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountBillsArchive request GetApiV5AccountBillsArchive(ctx context.Context, params *GetApiV5AccountBillsArchiveParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountConfig request GetApiV5AccountConfig(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountInterestAccrued request GetApiV5AccountInterestAccrued(ctx context.Context, params *GetApiV5AccountInterestAccruedParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountInterestRate request GetApiV5AccountInterestRate(ctx context.Context, params *GetApiV5AccountInterestRateParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountLeverageInfo request GetApiV5AccountLeverageInfo(ctx context.Context, params *GetApiV5AccountLeverageInfoParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountMaxAvailSize request GetApiV5AccountMaxAvailSize(ctx context.Context, params *GetApiV5AccountMaxAvailSizeParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountMaxLoan request GetApiV5AccountMaxLoan(ctx context.Context, params *GetApiV5AccountMaxLoanParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountMaxSize request GetApiV5AccountMaxSize(ctx context.Context, params *GetApiV5AccountMaxSizeParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountMaxWithdrawal request GetApiV5AccountMaxWithdrawal(ctx context.Context, params *GetApiV5AccountMaxWithdrawalParams, reqEditors ...RequestEditorFn) (*http.Response, error) // PostApiV5AccountPositionMarginBalance request with any body PostApiV5AccountPositionMarginBalanceWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PostApiV5AccountPositionMarginBalance(ctx context.Context, body PostApiV5AccountPositionMarginBalanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountPositions request GetApiV5AccountPositions(ctx context.Context, params *GetApiV5AccountPositionsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // PostApiV5AccountSetGreeks request with any body PostApiV5AccountSetGreeksWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PostApiV5AccountSetGreeks(ctx context.Context, body PostApiV5AccountSetGreeksJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // PostApiV5AccountSetLeverage request with any body PostApiV5AccountSetLeverageWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PostApiV5AccountSetLeverage(ctx context.Context, body PostApiV5AccountSetLeverageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // PostApiV5AccountSetPositionMode request with any body PostApiV5AccountSetPositionModeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PostApiV5AccountSetPositionMode(ctx context.Context, body PostApiV5AccountSetPositionModeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetApiV5AccountTradeFee request GetApiV5AccountTradeFee(ctx context.Context, params *GetApiV5AccountTradeFeeParams, reqEditors ...RequestEditorFn) (*http.Response, error) } func (c *Client) GetApiV5AccountAccountPositionRisk(ctx context.Context, params *GetApiV5AccountAccountPositionRiskParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountAccountPositionRiskRequest(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) GetApiV5AccountBalance(ctx context.Context, params *GetApiV5AccountBalanceParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountBalanceRequest(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) GetApiV5AccountBills(ctx context.Context, params *GetApiV5AccountBillsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountBillsRequest(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) GetApiV5AccountBillsArchive(ctx context.Context, params *GetApiV5AccountBillsArchiveParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountBillsArchiveRequest(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) GetApiV5AccountConfig(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountConfigRequest(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) GetApiV5AccountInterestAccrued(ctx context.Context, params *GetApiV5AccountInterestAccruedParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountInterestAccruedRequest(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) GetApiV5AccountInterestRate(ctx context.Context, params *GetApiV5AccountInterestRateParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountInterestRateRequest(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) GetApiV5AccountLeverageInfo(ctx context.Context, params *GetApiV5AccountLeverageInfoParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountLeverageInfoRequest(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) GetApiV5AccountMaxAvailSize(ctx context.Context, params *GetApiV5AccountMaxAvailSizeParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountMaxAvailSizeRequest(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) GetApiV5AccountMaxLoan(ctx context.Context, params *GetApiV5AccountMaxLoanParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountMaxLoanRequest(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) GetApiV5AccountMaxSize(ctx context.Context, params *GetApiV5AccountMaxSizeParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountMaxSizeRequest(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) GetApiV5AccountMaxWithdrawal(ctx context.Context, params *GetApiV5AccountMaxWithdrawalParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountMaxWithdrawalRequest(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) PostApiV5AccountPositionMarginBalanceWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV5AccountPositionMarginBalanceRequestWithBody(c.Server, contentType, body) 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) PostApiV5AccountPositionMarginBalance(ctx context.Context, body PostApiV5AccountPositionMarginBalanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV5AccountPositionMarginBalanceRequest(c.Server, body) 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) GetApiV5AccountPositions(ctx context.Context, params *GetApiV5AccountPositionsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountPositionsRequest(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) PostApiV5AccountSetGreeksWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV5AccountSetGreeksRequestWithBody(c.Server, contentType, body) 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) PostApiV5AccountSetGreeks(ctx context.Context, body PostApiV5AccountSetGreeksJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV5AccountSetGreeksRequest(c.Server, body) 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) PostApiV5AccountSetLeverageWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV5AccountSetLeverageRequestWithBody(c.Server, contentType, body) 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) PostApiV5AccountSetLeverage(ctx context.Context, body PostApiV5AccountSetLeverageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV5AccountSetLeverageRequest(c.Server, body) 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) PostApiV5AccountSetPositionModeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV5AccountSetPositionModeRequestWithBody(c.Server, contentType, body) 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) PostApiV5AccountSetPositionMode(ctx context.Context, body PostApiV5AccountSetPositionModeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewPostApiV5AccountSetPositionModeRequest(c.Server, body) 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) GetApiV5AccountTradeFee(ctx context.Context, params *GetApiV5AccountTradeFeeParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetApiV5AccountTradeFeeRequest(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) } // NewGetApiV5AccountAccountPositionRiskRequest generates requests for GetApiV5AccountAccountPositionRisk func NewGetApiV5AccountAccountPositionRiskRequest(server string, params *GetApiV5AccountAccountPositionRiskParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/account-position-risk") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } queryValues := queryURL.Query() if params.InstType != nil { 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 } // NewGetApiV5AccountBalanceRequest generates requests for GetApiV5AccountBalance func NewGetApiV5AccountBalanceRequest(server string, params *GetApiV5AccountBalanceParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/balance") 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) } } } } queryURL.RawQuery = queryValues.Encode() req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetApiV5AccountBillsRequest generates requests for GetApiV5AccountBills func NewGetApiV5AccountBillsRequest(server string, params *GetApiV5AccountBillsParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/bills") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } queryValues := queryURL.Query() if params.InstType != nil { 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.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.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.CtType != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ctType", runtime.ParamLocationQuery, *params.CtType); 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.SubType != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "subType", runtime.ParamLocationQuery, *params.SubType); 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 } // NewGetApiV5AccountBillsArchiveRequest generates requests for GetApiV5AccountBillsArchive func NewGetApiV5AccountBillsArchiveRequest(server string, params *GetApiV5AccountBillsArchiveParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/bills-archive") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } queryValues := queryURL.Query() if params.InstType != nil { 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.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.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.CtType != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ctType", runtime.ParamLocationQuery, *params.CtType); 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.SubType != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "subType", runtime.ParamLocationQuery, *params.SubType); 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 } // NewGetApiV5AccountConfigRequest generates requests for GetApiV5AccountConfig func NewGetApiV5AccountConfigRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/config") 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 } // NewGetApiV5AccountInterestAccruedRequest generates requests for GetApiV5AccountInterestAccrued func NewGetApiV5AccountInterestAccruedRequest(server string, params *GetApiV5AccountInterestAccruedParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/interest-accrued") 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.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.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.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 } // NewGetApiV5AccountInterestRateRequest generates requests for GetApiV5AccountInterestRate func NewGetApiV5AccountInterestRateRequest(server string, params *GetApiV5AccountInterestRateParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/interest-rate") 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) } } } } queryURL.RawQuery = queryValues.Encode() req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetApiV5AccountLeverageInfoRequest generates requests for GetApiV5AccountLeverageInfo func NewGetApiV5AccountLeverageInfoRequest(server string, params *GetApiV5AccountLeverageInfoParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/leverage-info") 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) } } } 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) } } } queryURL.RawQuery = queryValues.Encode() req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewGetApiV5AccountMaxAvailSizeRequest generates requests for GetApiV5AccountMaxAvailSize func NewGetApiV5AccountMaxAvailSizeRequest(server string, params *GetApiV5AccountMaxAvailSizeParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/max-avail-size") 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) } } } 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.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.ReduceOnly != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "reduceOnly", runtime.ParamLocationQuery, *params.ReduceOnly); 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 } // NewGetApiV5AccountMaxLoanRequest generates requests for GetApiV5AccountMaxLoan func NewGetApiV5AccountMaxLoanRequest(server string, params *GetApiV5AccountMaxLoanParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/max-loan") 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) } } } 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.MgnCcy != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "mgnCcy", runtime.ParamLocationQuery, *params.MgnCcy); 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 } // NewGetApiV5AccountMaxSizeRequest generates requests for GetApiV5AccountMaxSize func NewGetApiV5AccountMaxSizeRequest(server string, params *GetApiV5AccountMaxSizeParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/max-size") 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) } } } 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.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.Px != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "px", runtime.ParamLocationQuery, *params.Px); 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 } // NewGetApiV5AccountMaxWithdrawalRequest generates requests for GetApiV5AccountMaxWithdrawal func NewGetApiV5AccountMaxWithdrawalRequest(server string, params *GetApiV5AccountMaxWithdrawalParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/max-withdrawal") 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) } } } } queryURL.RawQuery = queryValues.Encode() req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewPostApiV5AccountPositionMarginBalanceRequest calls the generic PostApiV5AccountPositionMarginBalance builder with application/json body func NewPostApiV5AccountPositionMarginBalanceRequest(server string, body PostApiV5AccountPositionMarginBalanceJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewPostApiV5AccountPositionMarginBalanceRequestWithBody(server, "application/json", bodyReader) } // NewPostApiV5AccountPositionMarginBalanceRequestWithBody generates requests for PostApiV5AccountPositionMarginBalance with any type of body func NewPostApiV5AccountPositionMarginBalanceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/position/margin-balance") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewGetApiV5AccountPositionsRequest generates requests for GetApiV5AccountPositions func NewGetApiV5AccountPositionsRequest(server string, params *GetApiV5AccountPositionsParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/positions") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } queryValues := queryURL.Query() if params.InstType != nil { 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.PosId != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "posId", runtime.ParamLocationQuery, *params.PosId); 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 } // NewPostApiV5AccountSetGreeksRequest calls the generic PostApiV5AccountSetGreeks builder with application/json body func NewPostApiV5AccountSetGreeksRequest(server string, body PostApiV5AccountSetGreeksJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewPostApiV5AccountSetGreeksRequestWithBody(server, "application/json", bodyReader) } // NewPostApiV5AccountSetGreeksRequestWithBody generates requests for PostApiV5AccountSetGreeks with any type of body func NewPostApiV5AccountSetGreeksRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/set-greeks") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewPostApiV5AccountSetLeverageRequest calls the generic PostApiV5AccountSetLeverage builder with application/json body func NewPostApiV5AccountSetLeverageRequest(server string, body PostApiV5AccountSetLeverageJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewPostApiV5AccountSetLeverageRequestWithBody(server, "application/json", bodyReader) } // NewPostApiV5AccountSetLeverageRequestWithBody generates requests for PostApiV5AccountSetLeverage with any type of body func NewPostApiV5AccountSetLeverageRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/set-leverage") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewPostApiV5AccountSetPositionModeRequest calls the generic PostApiV5AccountSetPositionMode builder with application/json body func NewPostApiV5AccountSetPositionModeRequest(server string, body PostApiV5AccountSetPositionModeJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewPostApiV5AccountSetPositionModeRequestWithBody(server, "application/json", bodyReader) } // NewPostApiV5AccountSetPositionModeRequestWithBody generates requests for PostApiV5AccountSetPositionMode with any type of body func NewPostApiV5AccountSetPositionModeRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/set-position-mode") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewGetApiV5AccountTradeFeeRequest generates requests for GetApiV5AccountTradeFee func NewGetApiV5AccountTradeFeeRequest(server string, params *GetApiV5AccountTradeFeeParams) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/api/v5/account/trade-fee") 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) } } } } if params.Category != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "category", runtime.ParamLocationQuery, *params.Category); 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 { // GetApiV5AccountAccountPositionRisk request GetApiV5AccountAccountPositionRiskWithResponse(ctx context.Context, params *GetApiV5AccountAccountPositionRiskParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountAccountPositionRiskResponse, error) // GetApiV5AccountBalance request GetApiV5AccountBalanceWithResponse(ctx context.Context, params *GetApiV5AccountBalanceParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountBalanceResponse, error) // GetApiV5AccountBills request GetApiV5AccountBillsWithResponse(ctx context.Context, params *GetApiV5AccountBillsParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountBillsResponse, error) // GetApiV5AccountBillsArchive request GetApiV5AccountBillsArchiveWithResponse(ctx context.Context, params *GetApiV5AccountBillsArchiveParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountBillsArchiveResponse, error) // GetApiV5AccountConfig request GetApiV5AccountConfigWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV5AccountConfigResponse, error) // GetApiV5AccountInterestAccrued request GetApiV5AccountInterestAccruedWithResponse(ctx context.Context, params *GetApiV5AccountInterestAccruedParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountInterestAccruedResponse, error) // GetApiV5AccountInterestRate request GetApiV5AccountInterestRateWithResponse(ctx context.Context, params *GetApiV5AccountInterestRateParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountInterestRateResponse, error) // GetApiV5AccountLeverageInfo request GetApiV5AccountLeverageInfoWithResponse(ctx context.Context, params *GetApiV5AccountLeverageInfoParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountLeverageInfoResponse, error) // GetApiV5AccountMaxAvailSize request GetApiV5AccountMaxAvailSizeWithResponse(ctx context.Context, params *GetApiV5AccountMaxAvailSizeParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountMaxAvailSizeResponse, error) // GetApiV5AccountMaxLoan request GetApiV5AccountMaxLoanWithResponse(ctx context.Context, params *GetApiV5AccountMaxLoanParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountMaxLoanResponse, error) // GetApiV5AccountMaxSize request GetApiV5AccountMaxSizeWithResponse(ctx context.Context, params *GetApiV5AccountMaxSizeParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountMaxSizeResponse, error) // GetApiV5AccountMaxWithdrawal request GetApiV5AccountMaxWithdrawalWithResponse(ctx context.Context, params *GetApiV5AccountMaxWithdrawalParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountMaxWithdrawalResponse, error) // PostApiV5AccountPositionMarginBalance request with any body PostApiV5AccountPositionMarginBalanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5AccountPositionMarginBalanceResponse, error) PostApiV5AccountPositionMarginBalanceWithResponse(ctx context.Context, body PostApiV5AccountPositionMarginBalanceJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5AccountPositionMarginBalanceResponse, error) // GetApiV5AccountPositions request GetApiV5AccountPositionsWithResponse(ctx context.Context, params *GetApiV5AccountPositionsParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountPositionsResponse, error) // PostApiV5AccountSetGreeks request with any body PostApiV5AccountSetGreeksWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetGreeksResponse, error) PostApiV5AccountSetGreeksWithResponse(ctx context.Context, body PostApiV5AccountSetGreeksJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetGreeksResponse, error) // PostApiV5AccountSetLeverage request with any body PostApiV5AccountSetLeverageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetLeverageResponse, error) PostApiV5AccountSetLeverageWithResponse(ctx context.Context, body PostApiV5AccountSetLeverageJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetLeverageResponse, error) // PostApiV5AccountSetPositionMode request with any body PostApiV5AccountSetPositionModeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetPositionModeResponse, error) PostApiV5AccountSetPositionModeWithResponse(ctx context.Context, body PostApiV5AccountSetPositionModeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetPositionModeResponse, error) // GetApiV5AccountTradeFee request GetApiV5AccountTradeFeeWithResponse(ctx context.Context, params *GetApiV5AccountTradeFeeParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountTradeFeeResponse, error) } type GetApiV5AccountAccountPositionRiskResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountAccountPositionRiskResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountAccountPositionRiskResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountBalanceResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountBalanceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountBalanceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountBillsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountBillsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountBillsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountBillsArchiveResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountBillsArchiveResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountBillsArchiveResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountConfigResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountConfigResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountConfigResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountInterestAccruedResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountInterestAccruedResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountInterestAccruedResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountInterestRateResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountInterestRateResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountInterestRateResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountLeverageInfoResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountLeverageInfoResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountLeverageInfoResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountMaxAvailSizeResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountMaxAvailSizeResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountMaxAvailSizeResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountMaxLoanResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountMaxLoanResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountMaxLoanResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountMaxSizeResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountMaxSizeResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountMaxSizeResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountMaxWithdrawalResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountMaxWithdrawalResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountMaxWithdrawalResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type PostApiV5AccountPositionMarginBalanceResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { AdditionalProperties map[string]map[string]interface{} `json:"-"` } } // Status returns HTTPResponse.Status func (r PostApiV5AccountPositionMarginBalanceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r PostApiV5AccountPositionMarginBalanceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountPositionsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountPositionsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountPositionsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type PostApiV5AccountSetGreeksResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { AdditionalProperties map[string]map[string]interface{} `json:"-"` } } // Status returns HTTPResponse.Status func (r PostApiV5AccountSetGreeksResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r PostApiV5AccountSetGreeksResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type PostApiV5AccountSetLeverageResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { AdditionalProperties map[string]map[string]interface{} `json:"-"` } } // Status returns HTTPResponse.Status func (r PostApiV5AccountSetLeverageResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r PostApiV5AccountSetLeverageResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type PostApiV5AccountSetPositionModeResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { AdditionalProperties map[string]map[string]interface{} `json:"-"` } } // Status returns HTTPResponse.Status func (r PostApiV5AccountSetPositionModeResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r PostApiV5AccountSetPositionModeResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetApiV5AccountTradeFeeResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status func (r GetApiV5AccountTradeFeeResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetApiV5AccountTradeFeeResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // GetApiV5AccountAccountPositionRiskWithResponse request returning *GetApiV5AccountAccountPositionRiskResponse func (c *ClientWithResponses) GetApiV5AccountAccountPositionRiskWithResponse(ctx context.Context, params *GetApiV5AccountAccountPositionRiskParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountAccountPositionRiskResponse, error) { rsp, err := c.GetApiV5AccountAccountPositionRisk(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountAccountPositionRiskResponse(rsp) } // GetApiV5AccountBalanceWithResponse request returning *GetApiV5AccountBalanceResponse func (c *ClientWithResponses) GetApiV5AccountBalanceWithResponse(ctx context.Context, params *GetApiV5AccountBalanceParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountBalanceResponse, error) { rsp, err := c.GetApiV5AccountBalance(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountBalanceResponse(rsp) } // GetApiV5AccountBillsWithResponse request returning *GetApiV5AccountBillsResponse func (c *ClientWithResponses) GetApiV5AccountBillsWithResponse(ctx context.Context, params *GetApiV5AccountBillsParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountBillsResponse, error) { rsp, err := c.GetApiV5AccountBills(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountBillsResponse(rsp) } // GetApiV5AccountBillsArchiveWithResponse request returning *GetApiV5AccountBillsArchiveResponse func (c *ClientWithResponses) GetApiV5AccountBillsArchiveWithResponse(ctx context.Context, params *GetApiV5AccountBillsArchiveParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountBillsArchiveResponse, error) { rsp, err := c.GetApiV5AccountBillsArchive(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountBillsArchiveResponse(rsp) } // GetApiV5AccountConfigWithResponse request returning *GetApiV5AccountConfigResponse func (c *ClientWithResponses) GetApiV5AccountConfigWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV5AccountConfigResponse, error) { rsp, err := c.GetApiV5AccountConfig(ctx, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountConfigResponse(rsp) } // GetApiV5AccountInterestAccruedWithResponse request returning *GetApiV5AccountInterestAccruedResponse func (c *ClientWithResponses) GetApiV5AccountInterestAccruedWithResponse(ctx context.Context, params *GetApiV5AccountInterestAccruedParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountInterestAccruedResponse, error) { rsp, err := c.GetApiV5AccountInterestAccrued(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountInterestAccruedResponse(rsp) } // GetApiV5AccountInterestRateWithResponse request returning *GetApiV5AccountInterestRateResponse func (c *ClientWithResponses) GetApiV5AccountInterestRateWithResponse(ctx context.Context, params *GetApiV5AccountInterestRateParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountInterestRateResponse, error) { rsp, err := c.GetApiV5AccountInterestRate(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountInterestRateResponse(rsp) } // GetApiV5AccountLeverageInfoWithResponse request returning *GetApiV5AccountLeverageInfoResponse func (c *ClientWithResponses) GetApiV5AccountLeverageInfoWithResponse(ctx context.Context, params *GetApiV5AccountLeverageInfoParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountLeverageInfoResponse, error) { rsp, err := c.GetApiV5AccountLeverageInfo(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountLeverageInfoResponse(rsp) } // GetApiV5AccountMaxAvailSizeWithResponse request returning *GetApiV5AccountMaxAvailSizeResponse func (c *ClientWithResponses) GetApiV5AccountMaxAvailSizeWithResponse(ctx context.Context, params *GetApiV5AccountMaxAvailSizeParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountMaxAvailSizeResponse, error) { rsp, err := c.GetApiV5AccountMaxAvailSize(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountMaxAvailSizeResponse(rsp) } // GetApiV5AccountMaxLoanWithResponse request returning *GetApiV5AccountMaxLoanResponse func (c *ClientWithResponses) GetApiV5AccountMaxLoanWithResponse(ctx context.Context, params *GetApiV5AccountMaxLoanParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountMaxLoanResponse, error) { rsp, err := c.GetApiV5AccountMaxLoan(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountMaxLoanResponse(rsp) } // GetApiV5AccountMaxSizeWithResponse request returning *GetApiV5AccountMaxSizeResponse func (c *ClientWithResponses) GetApiV5AccountMaxSizeWithResponse(ctx context.Context, params *GetApiV5AccountMaxSizeParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountMaxSizeResponse, error) { rsp, err := c.GetApiV5AccountMaxSize(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountMaxSizeResponse(rsp) } // GetApiV5AccountMaxWithdrawalWithResponse request returning *GetApiV5AccountMaxWithdrawalResponse func (c *ClientWithResponses) GetApiV5AccountMaxWithdrawalWithResponse(ctx context.Context, params *GetApiV5AccountMaxWithdrawalParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountMaxWithdrawalResponse, error) { rsp, err := c.GetApiV5AccountMaxWithdrawal(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountMaxWithdrawalResponse(rsp) } // PostApiV5AccountPositionMarginBalanceWithBodyWithResponse request with arbitrary body returning *PostApiV5AccountPositionMarginBalanceResponse func (c *ClientWithResponses) PostApiV5AccountPositionMarginBalanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5AccountPositionMarginBalanceResponse, error) { rsp, err := c.PostApiV5AccountPositionMarginBalanceWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParsePostApiV5AccountPositionMarginBalanceResponse(rsp) } func (c *ClientWithResponses) PostApiV5AccountPositionMarginBalanceWithResponse(ctx context.Context, body PostApiV5AccountPositionMarginBalanceJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5AccountPositionMarginBalanceResponse, error) { rsp, err := c.PostApiV5AccountPositionMarginBalance(ctx, body, reqEditors...) if err != nil { return nil, err } return ParsePostApiV5AccountPositionMarginBalanceResponse(rsp) } // GetApiV5AccountPositionsWithResponse request returning *GetApiV5AccountPositionsResponse func (c *ClientWithResponses) GetApiV5AccountPositionsWithResponse(ctx context.Context, params *GetApiV5AccountPositionsParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountPositionsResponse, error) { rsp, err := c.GetApiV5AccountPositions(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountPositionsResponse(rsp) } // PostApiV5AccountSetGreeksWithBodyWithResponse request with arbitrary body returning *PostApiV5AccountSetGreeksResponse func (c *ClientWithResponses) PostApiV5AccountSetGreeksWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetGreeksResponse, error) { rsp, err := c.PostApiV5AccountSetGreeksWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParsePostApiV5AccountSetGreeksResponse(rsp) } func (c *ClientWithResponses) PostApiV5AccountSetGreeksWithResponse(ctx context.Context, body PostApiV5AccountSetGreeksJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetGreeksResponse, error) { rsp, err := c.PostApiV5AccountSetGreeks(ctx, body, reqEditors...) if err != nil { return nil, err } return ParsePostApiV5AccountSetGreeksResponse(rsp) } // PostApiV5AccountSetLeverageWithBodyWithResponse request with arbitrary body returning *PostApiV5AccountSetLeverageResponse func (c *ClientWithResponses) PostApiV5AccountSetLeverageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetLeverageResponse, error) { rsp, err := c.PostApiV5AccountSetLeverageWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParsePostApiV5AccountSetLeverageResponse(rsp) } func (c *ClientWithResponses) PostApiV5AccountSetLeverageWithResponse(ctx context.Context, body PostApiV5AccountSetLeverageJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetLeverageResponse, error) { rsp, err := c.PostApiV5AccountSetLeverage(ctx, body, reqEditors...) if err != nil { return nil, err } return ParsePostApiV5AccountSetLeverageResponse(rsp) } // PostApiV5AccountSetPositionModeWithBodyWithResponse request with arbitrary body returning *PostApiV5AccountSetPositionModeResponse func (c *ClientWithResponses) PostApiV5AccountSetPositionModeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetPositionModeResponse, error) { rsp, err := c.PostApiV5AccountSetPositionModeWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParsePostApiV5AccountSetPositionModeResponse(rsp) } func (c *ClientWithResponses) PostApiV5AccountSetPositionModeWithResponse(ctx context.Context, body PostApiV5AccountSetPositionModeJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5AccountSetPositionModeResponse, error) { rsp, err := c.PostApiV5AccountSetPositionMode(ctx, body, reqEditors...) if err != nil { return nil, err } return ParsePostApiV5AccountSetPositionModeResponse(rsp) } // GetApiV5AccountTradeFeeWithResponse request returning *GetApiV5AccountTradeFeeResponse func (c *ClientWithResponses) GetApiV5AccountTradeFeeWithResponse(ctx context.Context, params *GetApiV5AccountTradeFeeParams, reqEditors ...RequestEditorFn) (*GetApiV5AccountTradeFeeResponse, error) { rsp, err := c.GetApiV5AccountTradeFee(ctx, params, reqEditors...) if err != nil { return nil, err } return ParseGetApiV5AccountTradeFeeResponse(rsp) } // ParseGetApiV5AccountAccountPositionRiskResponse parses an HTTP response from a GetApiV5AccountAccountPositionRiskWithResponse call func ParseGetApiV5AccountAccountPositionRiskResponse(rsp *http.Response) (*GetApiV5AccountAccountPositionRiskResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountAccountPositionRiskResponse{ 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 } // ParseGetApiV5AccountBalanceResponse parses an HTTP response from a GetApiV5AccountBalanceWithResponse call func ParseGetApiV5AccountBalanceResponse(rsp *http.Response) (*GetApiV5AccountBalanceResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountBalanceResponse{ 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 } // ParseGetApiV5AccountBillsResponse parses an HTTP response from a GetApiV5AccountBillsWithResponse call func ParseGetApiV5AccountBillsResponse(rsp *http.Response) (*GetApiV5AccountBillsResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountBillsResponse{ 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 } // ParseGetApiV5AccountBillsArchiveResponse parses an HTTP response from a GetApiV5AccountBillsArchiveWithResponse call func ParseGetApiV5AccountBillsArchiveResponse(rsp *http.Response) (*GetApiV5AccountBillsArchiveResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountBillsArchiveResponse{ 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 } // ParseGetApiV5AccountConfigResponse parses an HTTP response from a GetApiV5AccountConfigWithResponse call func ParseGetApiV5AccountConfigResponse(rsp *http.Response) (*GetApiV5AccountConfigResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountConfigResponse{ 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 } // ParseGetApiV5AccountInterestAccruedResponse parses an HTTP response from a GetApiV5AccountInterestAccruedWithResponse call func ParseGetApiV5AccountInterestAccruedResponse(rsp *http.Response) (*GetApiV5AccountInterestAccruedResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountInterestAccruedResponse{ 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 } // ParseGetApiV5AccountInterestRateResponse parses an HTTP response from a GetApiV5AccountInterestRateWithResponse call func ParseGetApiV5AccountInterestRateResponse(rsp *http.Response) (*GetApiV5AccountInterestRateResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountInterestRateResponse{ 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 } // ParseGetApiV5AccountLeverageInfoResponse parses an HTTP response from a GetApiV5AccountLeverageInfoWithResponse call func ParseGetApiV5AccountLeverageInfoResponse(rsp *http.Response) (*GetApiV5AccountLeverageInfoResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountLeverageInfoResponse{ 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 } // ParseGetApiV5AccountMaxAvailSizeResponse parses an HTTP response from a GetApiV5AccountMaxAvailSizeWithResponse call func ParseGetApiV5AccountMaxAvailSizeResponse(rsp *http.Response) (*GetApiV5AccountMaxAvailSizeResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountMaxAvailSizeResponse{ 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 } // ParseGetApiV5AccountMaxLoanResponse parses an HTTP response from a GetApiV5AccountMaxLoanWithResponse call func ParseGetApiV5AccountMaxLoanResponse(rsp *http.Response) (*GetApiV5AccountMaxLoanResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountMaxLoanResponse{ 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 } // ParseGetApiV5AccountMaxSizeResponse parses an HTTP response from a GetApiV5AccountMaxSizeWithResponse call func ParseGetApiV5AccountMaxSizeResponse(rsp *http.Response) (*GetApiV5AccountMaxSizeResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountMaxSizeResponse{ 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 } // ParseGetApiV5AccountMaxWithdrawalResponse parses an HTTP response from a GetApiV5AccountMaxWithdrawalWithResponse call func ParseGetApiV5AccountMaxWithdrawalResponse(rsp *http.Response) (*GetApiV5AccountMaxWithdrawalResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountMaxWithdrawalResponse{ 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 } // ParsePostApiV5AccountPositionMarginBalanceResponse parses an HTTP response from a PostApiV5AccountPositionMarginBalanceWithResponse call func ParsePostApiV5AccountPositionMarginBalanceResponse(rsp *http.Response) (*PostApiV5AccountPositionMarginBalanceResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &PostApiV5AccountPositionMarginBalanceResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { AdditionalProperties map[string]map[string]interface{} `json:"-"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseGetApiV5AccountPositionsResponse parses an HTTP response from a GetApiV5AccountPositionsWithResponse call func ParseGetApiV5AccountPositionsResponse(rsp *http.Response) (*GetApiV5AccountPositionsResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountPositionsResponse{ 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 } // ParsePostApiV5AccountSetGreeksResponse parses an HTTP response from a PostApiV5AccountSetGreeksWithResponse call func ParsePostApiV5AccountSetGreeksResponse(rsp *http.Response) (*PostApiV5AccountSetGreeksResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &PostApiV5AccountSetGreeksResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { AdditionalProperties map[string]map[string]interface{} `json:"-"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParsePostApiV5AccountSetLeverageResponse parses an HTTP response from a PostApiV5AccountSetLeverageWithResponse call func ParsePostApiV5AccountSetLeverageResponse(rsp *http.Response) (*PostApiV5AccountSetLeverageResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &PostApiV5AccountSetLeverageResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { AdditionalProperties map[string]map[string]interface{} `json:"-"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParsePostApiV5AccountSetPositionModeResponse parses an HTTP response from a PostApiV5AccountSetPositionModeWithResponse call func ParsePostApiV5AccountSetPositionModeResponse(rsp *http.Response) (*PostApiV5AccountSetPositionModeResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &PostApiV5AccountSetPositionModeResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { AdditionalProperties map[string]map[string]interface{} `json:"-"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseGetApiV5AccountTradeFeeResponse parses an HTTP response from a GetApiV5AccountTradeFeeWithResponse call func ParseGetApiV5AccountTradeFeeResponse(rsp *http.Response) (*GetApiV5AccountTradeFeeResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetApiV5AccountTradeFeeResponse{ 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{ "H4sIAAAAAAAC/+x823MTR/b/v6Ka39uWLHdPz9VvhpAsVeQXF5jNw25qNUiDUaJbpDGBTblKBoxlsDEX", "2xBjY0wMmJvtbAjIkhz/MZkeSU/+F77V3TOj0UiyJSNy2fKTpL6ePqfPOZ8+3Uffc5FUIp1K6kkjyw18", "PxbkYsnzKW7gey6qZyOZWNqIpZLcAPf/AubObmVuvbr51npwK/CvZOBfowCgyDn6oVc3n+IbK9WrO9at", "p3j2x8rcupV/X1vK4Yl85YdS7Yfre+VpVoVnX5rlxerme+unK9b6qnVzpXJrEz+5yobrt8ezB8+0+vW3", "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fpfS3CmU4BltsbV0JW/gDCdkn2uUNdfWWRnY9", "TAhETQRWns80EFh9v94rAr1BgYMIE3yEUQTYyDlWRI9kzeLclzH+23OxnX/0X8WPBTmxkTBretKa32pB", "mC9W+cFUOazZx5pS/jaZ0dnNWm7Kd/DeNwDbTuLuihovRH/LXekqENCKHhdtLzIV+S033hLz21FTfHc6", "HIlcDlcnf8Zbd6rPxs3yY7OQo3j2IX52xXq0ZBbWzMLL2tUds/zYPe2zf8ZzoXUTzTbnO4om+N4/+Idy", "BfehL1iJQ/NF9X3nfrpeyg+WamaWH+Ncea887YaSca6MZ19Wr+6YhaI9WBuptY+otBCbN6Lyh0RPfIxY", "WvcOYhbmmkxW0TEUq2bpHbt0xKuv6MvPObM0wRZp3XzB6LfyCy5903jinVlacK8ra8uP3M5sc9kEPmx4", "OtCQCRg+EIbUL2bZVvwrYZED7RkCnZrZXgRVqCk+zCslAl3cv29M2DrcMX5xo8L1W7KeYBjbtXj2t9eX", "tE9PaIFC6sBj/6GSujvGPk7Hbd86GtESs/uI9Kt/s+LXm7WLnTanZeyvaQ7ZfyUN20fKvdMYJjVqLzvV", "GHrK7qMJV51FIodJh0/1/91c/Pq+tHPKDohMftBjgA4jlV6/5ExtFoqMQ/1eRn3sJB7GRevxZGXxGsPP", "TcTvQ3vYIT5M0AyTS7g/bLvY/jATQrt3eqPxy4dJ6bGmblZKb6pvt8lmzL9qTjCvvH5tFnKklrYnLW9N", "0nxzUlOc9tcgp8+Uv0ZgNfjhQ19Nu5tezdBHUpk/9rrXoYGF8qJ6PHZRz9jBPP2SnonEsno9atqYb+nk", "3Z2ieXcJ7RuKFlgkTqE2yFMC61mRCMoSlETA8718GsAeXNj/Gcge2jiyd8XQwiqOuaUt/q7Byr+vy8vp", "NPbV2P8FAAD//379QwTUWwAA", } // 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 }