1
0
mirror of synced 2024-11-24 21:36:02 +03:00

update class name

This commit is contained in:
Akolzin Dmitry 2019-03-06 16:38:47 +03:00
parent d0b31da80d
commit 6edec6141c
2 changed files with 32 additions and 32 deletions

View File

@ -15,17 +15,17 @@ In your file
###### CommonJS ###### CommonJS
``` ```
var RetailcrmBotApiClient = require('mg-api-client'); var MgBotApiClient = require('mg-api-client');
``` ```
###### es6 ###### es6
``` ```
import RetailcrmBotApiClient from 'mg-api-client'; import MgBotApiClient from 'mg-api-client';
``` ```
# Usage # Usage
#### Get users #### Get users
```javascript ```javascript
const api = new RetailcrmBotApiClient({ const api = new MgBotApiClient({
host: 'https://api.example.com', host: 'https://api.example.com',
token: 'your bot token', token: 'your bot token',
apiVersion: 'v1' // optional apiVersion: 'v1' // optional
@ -42,7 +42,7 @@ api.getUsers()
#### Send message #### Send message
```javascript ```javascript
const api = new RetailcrmBotApiClient({ const api = new MgBotApiClient({
host: 'https://api.example.com', host: 'https://api.example.com',
token: 'your bot token', token: 'your bot token',
apiVersion: 'v1' // optional apiVersion: 'v1' // optional
@ -67,13 +67,13 @@ api.sendMessage(message)
```javascript ```javascript
const WebSocket = require('ws'); const WebSocket = require('ws');
const api = new RetailcrmBotApiClient({ const api = new MgBotApiClient({
host: 'https://api.example.com', host: 'https://api.example.com',
token: 'your bot token', token: 'your bot token',
apiVersion: 'v1' // optional apiVersion: 'v1' // optional
}).client; }).client;
const wsData = api.getWebsocketData([RetailcrmBotApiClient.types().wsMessageNew]); const wsData = api.getWebsocketData([MgBotApiClient.types().wsMessageNew]);
const ws = new WebSocket(wsData.get('url'), { const ws = new WebSocket(wsData.get('url'), {
headers: wsData.get('headers') headers: wsData.get('headers')
}); });

View File

@ -2,7 +2,7 @@
* New message websocket event * New message websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsMessageNew * @example MgBotApiClient.types().wsMessageNew
*/ */
export const wsMessageNew = 'message_new'; export const wsMessageNew = 'message_new';
@ -10,7 +10,7 @@ export const wsMessageNew = 'message_new';
* Updating message websocket event * Updating message websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsMessageUpdated * @example MgBotApiClient.types().wsMessageUpdated
*/ */
export const wsMessageUpdated = 'message_updated'; export const wsMessageUpdated = 'message_updated';
@ -18,7 +18,7 @@ export const wsMessageUpdated = 'message_updated';
* Websocket event delete message * Websocket event delete message
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsMessageDeleted * @example MgBotApiClient.types().wsMessageDeleted
*/ */
export const wsMessageDeleted = 'message_deleted'; export const wsMessageDeleted = 'message_deleted';
@ -26,7 +26,7 @@ export const wsMessageDeleted = 'message_deleted';
* Dialogue opening websocket event * Dialogue opening websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsDialogOpened * @example MgBotApiClient.types().wsDialogOpened
* *
*/ */
export const wsDialogOpened = 'dialog_opened'; export const wsDialogOpened = 'dialog_opened';
@ -35,7 +35,7 @@ export const wsDialogOpened = 'dialog_opened';
* Dialogue closing websocket event * Dialogue closing websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsDialogClosed * @example MgBotApiClient.types().wsDialogClosed
*/ */
export const wsDialogClosed = 'dialog_closed'; export const wsDialogClosed = 'dialog_closed';
@ -43,7 +43,7 @@ export const wsDialogClosed = 'dialog_closed';
* Dialogue appointment websocket event * Dialogue appointment websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsDialogAssign * @example MgBotApiClient.types().wsDialogAssign
*/ */
export const wsDialogAssign = 'dialog_assign'; export const wsDialogAssign = 'dialog_assign';
@ -51,7 +51,7 @@ export const wsDialogAssign = 'dialog_assign';
* Chat creating websocket event * Chat creating websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsChatCreated * @example MgBotApiClient.types().wsChatCreated
*/ */
export const wsChatCreated = 'chat_created'; export const wsChatCreated = 'chat_created';
@ -59,7 +59,7 @@ export const wsChatCreated = 'chat_created';
* Chat updating websocket event * Chat updating websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsChatUpdated * @example MgBotApiClient.types().wsChatUpdated
*/ */
export const wsChatUpdated = 'chat_updated'; export const wsChatUpdated = 'chat_updated';
@ -67,7 +67,7 @@ export const wsChatUpdated = 'chat_updated';
* Unread chat updating websocket event * Unread chat updating websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsChatUnreadUpdated * @example MgBotApiClient.types().wsChatUnreadUpdated
*/ */
export const wsChatUnreadUpdated = 'chat_unread_updated'; export const wsChatUnreadUpdated = 'chat_unread_updated';
@ -75,7 +75,7 @@ export const wsChatUnreadUpdated = 'chat_unread_updated';
* User online status updating websocket event * User online status updating websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsUserOnlineUpdated * @example MgBotApiClient.types().wsUserOnlineUpdated
*/ */
export const wsUserOnlineUpdated = 'user_online_updated'; export const wsUserOnlineUpdated = 'user_online_updated';
@ -83,7 +83,7 @@ export const wsUserOnlineUpdated = 'user_online_updated';
* User joined chat websocket event * User joined chat websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsUserJoinedChat * @example MgBotApiClient.types().wsUserJoinedChat
*/ */
export const wsUserJoinedChat = 'user_joined_chat'; export const wsUserJoinedChat = 'user_joined_chat';
@ -91,7 +91,7 @@ export const wsUserJoinedChat = 'user_joined_chat';
* User left chat websocket event * User left chat websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsUserLeftChat * @example MgBotApiClient.types().wsUserLeftChat
* *
*/ */
export const wsUserLeftChat = 'user_left_chat'; export const wsUserLeftChat = 'user_left_chat';
@ -100,7 +100,7 @@ export const wsUserLeftChat = 'user_left_chat';
* User updating websocket event * User updating websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsUserUpdated * @example MgBotApiClient.types().wsUserUpdated
*/ */
export const wsUserUpdated = 'user_updated'; export const wsUserUpdated = 'user_updated';
@ -108,7 +108,7 @@ export const wsUserUpdated = 'user_updated';
* Customer updating websocket event * Customer updating websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsCustomerUpdated * @example MgBotApiClient.types().wsCustomerUpdated
*/ */
export const wsCustomerUpdated = 'customer_updated'; export const wsCustomerUpdated = 'customer_updated';
@ -116,7 +116,7 @@ export const wsCustomerUpdated = 'customer_updated';
* Bot updating websocket event * Bot updating websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsBotUpdated * @example MgBotApiClient.types().wsBotUpdated
* *
*/ */
export const wsBotUpdated = 'bot_updated'; export const wsBotUpdated = 'bot_updated';
@ -125,7 +125,7 @@ export const wsBotUpdated = 'bot_updated';
* Channel updating websocket event * Channel updating websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsChannelUpdated * @example MgBotApiClient.types().wsChannelUpdated
*/ */
export const wsChannelUpdated = 'channel_updated'; export const wsChannelUpdated = 'channel_updated';
@ -133,7 +133,7 @@ export const wsChannelUpdated = 'channel_updated';
* Settings updating websocket event * Settings updating websocket event
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().wsSettingsUpdated * @example MgBotApiClient.types().wsSettingsUpdated
*/ */
export const wsSettingsUpdated = 'settings_updated'; export const wsSettingsUpdated = 'settings_updated';
@ -142,7 +142,7 @@ export const wsSettingsUpdated = 'settings_updated';
* Public message scope * Public message scope
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().messageScopePublic * @example MgBotApiClient.types().messageScopePublic
*/ */
export const messageScopePublic = 'public'; export const messageScopePublic = 'public';
@ -150,7 +150,7 @@ export const messageScopePublic = 'public';
* Public message scope * Public message scope
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().messageScopePrivate * @example MgBotApiClient.types().messageScopePrivate
*/ */
export const messageScopePrivate = 'private'; export const messageScopePrivate = 'private';
@ -159,7 +159,7 @@ export const messageScopePrivate = 'private';
* Text message type * Text message type
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().msgTypeText * @example MgBotApiClient.types().msgTypeText
*/ */
export const msgTypeText = 'text'; export const msgTypeText = 'text';
@ -167,7 +167,7 @@ export const msgTypeText = 'text';
* System message type * System message type
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().msgTypeSystem * @example MgBotApiClient.types().msgTypeSystem
*/ */
export const msgTypeSystem = 'system'; export const msgTypeSystem = 'system';
@ -175,7 +175,7 @@ export const msgTypeSystem = 'system';
* Command message type * Command message type
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().msgTypeCommand * @example MgBotApiClient.types().msgTypeCommand
*/ */
export const msgTypeCommand = 'command'; export const msgTypeCommand = 'command';
@ -183,7 +183,7 @@ export const msgTypeCommand = 'command';
* Order message type * Order message type
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().msgTypeOrder * @example MgBotApiClient.types().msgTypeOrder
*/ */
export const msgTypeOrder = 'order'; export const msgTypeOrder = 'order';
@ -191,7 +191,7 @@ export const msgTypeOrder = 'order';
* Product message type * Product message type
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().msgTypeProduct * @example MgBotApiClient.types().msgTypeProduct
*/ */
export const msgTypeProduct = 'product'; export const msgTypeProduct = 'product';
@ -199,7 +199,7 @@ export const msgTypeProduct = 'product';
* File message type * File message type
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().msgTypeFile * @example MgBotApiClient.types().msgTypeFile
*/ */
export const msgTypeFile = 'file'; export const msgTypeFile = 'file';
@ -207,6 +207,6 @@ export const msgTypeFile = 'file';
* Image message type * Image message type
* @constant * @constant
* @type {string} * @type {string}
* @example RetailcrmBotApiClient.types().msgTypeImage * @example MgBotApiClient.types().msgTypeImage
*/ */
export const msgTypeImage = 'image'; export const msgTypeImage = 'image';