1
0
mirror of synced 2024-11-21 20:16:03 +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
```
var RetailcrmBotApiClient = require('mg-api-client');
var MgBotApiClient = require('mg-api-client');
```
###### es6
```
import RetailcrmBotApiClient from 'mg-api-client';
import MgBotApiClient from 'mg-api-client';
```
# Usage
#### Get users
```javascript
const api = new RetailcrmBotApiClient({
const api = new MgBotApiClient({
host: 'https://api.example.com',
token: 'your bot token',
apiVersion: 'v1' // optional
@ -42,7 +42,7 @@ api.getUsers()
#### Send message
```javascript
const api = new RetailcrmBotApiClient({
const api = new MgBotApiClient({
host: 'https://api.example.com',
token: 'your bot token',
apiVersion: 'v1' // optional
@ -67,13 +67,13 @@ api.sendMessage(message)
```javascript
const WebSocket = require('ws');
const api = new RetailcrmBotApiClient({
const api = new MgBotApiClient({
host: 'https://api.example.com',
token: 'your bot token',
apiVersion: 'v1' // optional
}).client;
const wsData = api.getWebsocketData([RetailcrmBotApiClient.types().wsMessageNew]);
const wsData = api.getWebsocketData([MgBotApiClient.types().wsMessageNew]);
const ws = new WebSocket(wsData.get('url'), {
headers: wsData.get('headers')
});

View File

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