-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
91 changed files
with
4,409 additions
and
627 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Gate API v4 | ||
* | ||
* Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. | ||
* | ||
* Contact: support@mail.gate.io | ||
* Generated by: OpenAPI Generator (https://openapi-generator.tech) | ||
*/ | ||
|
||
package gateapi | ||
|
||
import ( | ||
"context" | ||
"io/ioutil" | ||
"net/http" | ||
"net/url" | ||
) | ||
|
||
// Linger please | ||
var ( | ||
_ context.Context | ||
) | ||
|
||
// AccountApiService AccountApi service | ||
type AccountApiService service | ||
|
||
/* | ||
GetAccountDetail Get account detail | ||
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). | ||
@return AccountDetail | ||
*/ | ||
func (a *AccountApiService) GetAccountDetail(ctx context.Context) (AccountDetail, *http.Response, error) { | ||
var ( | ||
localVarHTTPMethod = http.MethodGet | ||
localVarPostBody interface{} | ||
localVarFormFileName string | ||
localVarFileName string | ||
localVarFileBytes []byte | ||
localVarReturnValue AccountDetail | ||
) | ||
|
||
// create path and map variables | ||
localVarPath := a.client.cfg.BasePath + "/account/detail" | ||
localVarHeaderParams := make(map[string]string) | ||
localVarQueryParams := url.Values{} | ||
localVarFormParams := url.Values{} | ||
|
||
// to determine the Content-Type header | ||
localVarHTTPContentTypes := []string{} | ||
|
||
// set Content-Type header | ||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) | ||
if localVarHTTPContentType != "" { | ||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType | ||
} | ||
|
||
// to determine the Accept header | ||
localVarHTTPHeaderAccepts := []string{"application/json"} | ||
|
||
// set Accept header | ||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) | ||
if localVarHTTPHeaderAccept != "" { | ||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept | ||
} | ||
if ctx == nil { | ||
ctx = context.Background() | ||
} | ||
if ctx.Value(ContextGateAPIV4) == nil { | ||
// for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present | ||
ctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{ | ||
Key: a.client.cfg.Key, | ||
Secret: a.client.cfg.Secret, | ||
}) | ||
} | ||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) | ||
if err != nil { | ||
return localVarReturnValue, nil, err | ||
} | ||
|
||
localVarHTTPResponse, err := a.client.callAPI(r) | ||
if err != nil || localVarHTTPResponse == nil { | ||
return localVarReturnValue, localVarHTTPResponse, err | ||
} | ||
|
||
localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) | ||
localVarHTTPResponse.Body.Close() | ||
if err != nil { | ||
return localVarReturnValue, localVarHTTPResponse, err | ||
} | ||
|
||
if localVarHTTPResponse.StatusCode >= 300 { | ||
newErr := GenericOpenAPIError{ | ||
body: localVarBody, | ||
error: localVarHTTPResponse.Status + ", " + string(localVarBody), | ||
} | ||
var gateErr GateAPIError | ||
if e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")); e == nil && gateErr.Label != "" { | ||
gateErr.APIError = newErr | ||
return localVarReturnValue, localVarHTTPResponse, gateErr | ||
} | ||
return localVarReturnValue, localVarHTTPResponse, newErr | ||
} | ||
|
||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) | ||
if err != nil { | ||
newErr := GenericOpenAPIError{ | ||
body: localVarBody, | ||
error: err.Error(), | ||
} | ||
return localVarReturnValue, localVarHTTPResponse, newErr | ||
} | ||
|
||
return localVarReturnValue, localVarHTTPResponse, nil | ||
} |
Oops, something went wrong.