github.com/vmpartner/bitmex@v1.1.0/swagger/leaderboard_api.go (about)

     1  /* 
     2   * BitMEX API
     3   *
     4   * ## REST API for the BitMEX Trading Platform  [View Changelog](/app/apiChangelog)    #### Getting Started   ##### Fetching Data  All REST endpoints are documented below. You can try out any query right from this interface.  Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first.  Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](https://www.bitmex.com/app/restAPI).  *All* table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits.  ##### Return Types  By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data.  ##### Trade Data Queries  *This is only a small subset of what is available, to get you started.*  Fill in the parameters and click the `Try it out!` button to try any of these queries.  * [Pricing Data](#!/Quote/Quote_get)  * [Trade Data](#!/Trade/Trade_get)  * [OrderBook Data](#!/OrderBook/OrderBook_getL2)  * [Settlement Data](#!/Settlement/Settlement_get)  * [Exchange Statistics](#!/Stats/Stats_history)  Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available.  ##### Swagger Specification  [⇩ Download Swagger JSON](swagger.json)    ## All API Endpoints  Click to expand a section. 
     5   *
     6   * OpenAPI spec version: 1.2.0
     7   * Contact: support@bitmex.com
     8   * Generated by: https://github.com/swagger-api/swagger-codegen.git
     9   */
    10  
    11  package swagger
    12  
    13  import (
    14  	"net/url"
    15  	"net/http"
    16  	"strings"
    17  	"golang.org/x/net/context"
    18  	"encoding/json"
    19  )
    20  
    21  // Linger please
    22  var (
    23  	_ context.Context
    24  )
    25  
    26  type LeaderboardApiService service
    27  
    28  /* LeaderboardApiService Get current leaderboard.
    29  
    30   @param optional (nil or map[string]interface{}) with one or more of:
    31       @param "method" (string) Ranking type. Options: \"notional\", \"ROE\"
    32   @return []Leaderboard*/
    33  func (a *LeaderboardApiService) LeaderboardGet(localVarOptionals map[string]interface{}) ([]Leaderboard, *http.Response, error) {
    34  	var (
    35  		localVarHttpMethod = strings.ToUpper("Get")
    36  		localVarPostBody   interface{}
    37  		localVarFileName   string
    38  		localVarFileBytes  []byte
    39  		successPayload     []Leaderboard
    40  	)
    41  
    42  	// create path and map variables
    43  	localVarPath := a.client.cfg.BasePath + "/leaderboard"
    44  
    45  	localVarHeaderParams := make(map[string]string)
    46  	localVarQueryParams := url.Values{}
    47  	localVarFormParams := url.Values{}
    48  
    49  	if err := typeCheckParameter(localVarOptionals["method"], "string", "method"); err != nil {
    50  		return successPayload, nil, err
    51  	}
    52  
    53  	if localVarTempParam, localVarOk := localVarOptionals["method"].(string); localVarOk {
    54  		localVarQueryParams.Add("method", parameterToString(localVarTempParam, ""))
    55  	}
    56  	// to determine the Content-Type header
    57  	localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded",}
    58  
    59  	// set Content-Type header
    60  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
    61  	if localVarHttpContentType != "" {
    62  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
    63  	}
    64  
    65  	// to determine the Accept header
    66  	localVarHttpHeaderAccepts := []string{
    67  		"application/json",
    68  		"application/xml",
    69  		"text/xml",
    70  		"application/javascript",
    71  		"text/javascript",
    72  	}
    73  
    74  	// set Accept header
    75  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
    76  	if localVarHttpHeaderAccept != "" {
    77  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
    78  	}
    79  	r, err := a.client.prepareRequest(nil, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
    80  	if err != nil {
    81  		return successPayload, nil, err
    82  	}
    83  
    84  	localVarHttpResponse, err := a.client.callAPI(r)
    85  	if err != nil || localVarHttpResponse == nil {
    86  		return successPayload, localVarHttpResponse, err
    87  	}
    88  	defer localVarHttpResponse.Body.Close()
    89  	if localVarHttpResponse.StatusCode >= 300 {
    90  		return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status)
    91  	}
    92  
    93  	if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
    94  		return successPayload, localVarHttpResponse, err
    95  	}
    96  
    97  	return successPayload, localVarHttpResponse, err
    98  }