Skip to content

Latest commit

 

History

History
253 lines (177 loc) · 6.71 KB

File metadata and controls

253 lines (177 loc) · 6.71 KB

BitMexApi.ChatApi

All URIs are relative to https://www.bitmex.com/api/v1

Method HTTP request Description
chatGet GET /chat Get chat messages.
chatGetChannels GET /chat/channels Get available channels.
chatGetConnected GET /chat/connected Get connected users.
chatGetPinnedMessage GET /chat/pinned Get pinned message for a channel.
chatNew POST /chat Send a chat message.

chatGet

[Chat] chatGet(opts)

Get chat messages.

Example

var BitMexApi = require('bit_mex_api');

var apiInstance = new BitMexApi.ChatApi();

var opts = { 
  'count': 100, // Number | Number of results to fetch.
  'start': 0, // Number | Starting ID for results.
  'reverse': true, // Boolean | If true, will sort results newest first.
  'channelID': 1 // Number | Channel id. GET /chat/channels for ids. Global English by default
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.chatGet(opts, callback);

Parameters

Name Type Description Notes
count Number Number of results to fetch. [optional] [default to 100]
start Number Starting ID for results. [optional] [default to 0]
reverse Boolean If true, will sort results newest first. [optional] [default to true]
channelID Number Channel id. GET /chat/channels for ids. Global English by default [optional] [default to 1]

Return type

[Chat]

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript

chatGetChannels

[ChatChannel] chatGetChannels()

Get available channels.

Example

var BitMexApi = require('bit_mex_api');

var apiInstance = new BitMexApi.ChatApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.chatGetChannels(callback);

Parameters

This endpoint does not need any parameter.

Return type

[ChatChannel]

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript

chatGetConnected

ConnectedUsers chatGetConnected()

Get connected users.

Returns an array with browser users in the first position and API users (bots) in the second position.

Example

var BitMexApi = require('bit_mex_api');

var apiInstance = new BitMexApi.ChatApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.chatGetConnected(callback);

Parameters

This endpoint does not need any parameter.

Return type

ConnectedUsers

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript

chatGetPinnedMessage

PinnedMessage chatGetPinnedMessage(channelID)

Get pinned message for a channel.

Example

var BitMexApi = require('bit_mex_api');

var apiInstance = new BitMexApi.ChatApi();

var channelID = 1.2; // Number | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.chatGetPinnedMessage(channelID, callback);

Parameters

Name Type Description Notes
channelID Number

Return type

PinnedMessage

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript

chatNew

Chat chatNew(message, opts)

Send a chat message.

Example

var BitMexApi = require('bit_mex_api');
var defaultClient = BitMexApi.ApiClient.instance;

// Configure API key authorization: apiExpires
var apiExpires = defaultClient.authentications['apiExpires'];
apiExpires.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiExpires.apiKeyPrefix = 'Token';

// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

// Configure API key authorization: apiSignature
var apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix = 'Token';

var apiInstance = new BitMexApi.ChatApi();

var message = "message_example"; // String | 

var opts = { 
  'channelID': 1 // Number | Channel to post to. Default 1 (English).
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.chatNew(message, opts, callback);

Parameters

Name Type Description Notes
message String
channelID Number Channel to post to. Default 1 (English). [optional] [default to 1]

Return type

Chat

Authorization

apiExpires, apiKey, apiSignature

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/xml, text/xml, application/javascript, text/javascript