github.com/vmpartner/bitmex@v1.1.0/swagger/notification_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 NotificationApiService service
    27  
    28  /* NotificationApiService Get your current notifications.
    29   This is an upcoming feature and currently does not return data.
    30   * @param ctx context.Context Authentication Context 
    31   @return []Notification*/
    32  func (a *NotificationApiService) NotificationGet(ctx context.Context, ) ([]Notification, *http.Response, error) {
    33  	var (
    34  		localVarHttpMethod = strings.ToUpper("Get")
    35  		localVarPostBody   interface{}
    36  		localVarFileName   string
    37  		localVarFileBytes  []byte
    38  		successPayload     []Notification
    39  	)
    40  
    41  	// create path and map variables
    42  	localVarPath := a.client.cfg.BasePath + "/notification"
    43  
    44  	localVarHeaderParams := make(map[string]string)
    45  	localVarQueryParams := url.Values{}
    46  	localVarFormParams := url.Values{}
    47  
    48  	// to determine the Content-Type header
    49  	localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded",}
    50  
    51  	// set Content-Type header
    52  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
    53  	if localVarHttpContentType != "" {
    54  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
    55  	}
    56  
    57  	// to determine the Accept header
    58  	localVarHttpHeaderAccepts := []string{
    59  		"application/json",
    60  		"application/xml",
    61  		"text/xml",
    62  		"application/javascript",
    63  		"text/javascript",
    64  	}
    65  
    66  	// set Accept header
    67  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
    68  	if localVarHttpHeaderAccept != "" {
    69  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
    70  	}
    71  	if ctx != nil {
    72  		// API Key Authentication
    73  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
    74  			var key string
    75  			if auth.Prefix != "" {
    76  				key = auth.Prefix + " " + auth.Key
    77  			} else {
    78  				key = auth.Key
    79  			}
    80  			localVarHeaderParams["api-key"] = key
    81  		}
    82  	}
    83  	if ctx != nil {
    84  		// API Key Authentication
    85  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
    86  			var key string
    87  			if auth.Prefix != "" {
    88  				key = auth.Prefix + " " + auth.Key
    89  			} else {
    90  				key = auth.Key
    91  			}
    92  			localVarHeaderParams["api-nonce"] = key
    93  		}
    94  	}
    95  	if ctx != nil {
    96  		// API Key Authentication
    97  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
    98  			var key string
    99  			if auth.Prefix != "" {
   100  				key = auth.Prefix + " " + auth.Key
   101  			} else {
   102  				key = auth.Key
   103  			}
   104  			localVarHeaderParams["api-signature"] = key
   105  		}
   106  	}
   107  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   108  	if err != nil {
   109  		return successPayload, nil, err
   110  	}
   111  
   112  	localVarHttpResponse, err := a.client.callAPI(r)
   113  	if err != nil || localVarHttpResponse == nil {
   114  		return successPayload, localVarHttpResponse, err
   115  	}
   116  	defer localVarHttpResponse.Body.Close()
   117  	if localVarHttpResponse.StatusCode >= 300 {
   118  		return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status)
   119  	}
   120  
   121  	if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
   122  		return successPayload, localVarHttpResponse, err
   123  	}
   124  
   125  	return successPayload, localVarHttpResponse, err
   126  }