mg-bot-api-client-go/v1/types.go

727 lines
21 KiB
Go
Raw Normal View History

2018-08-03 18:11:37 +03:00
package v1
import (
2018-09-04 11:30:00 +03:00
"encoding/json"
2018-08-03 18:11:37 +03:00
"net/http"
2018-12-26 17:38:41 +03:00
"time"
2018-08-03 18:11:37 +03:00
)
2018-08-29 02:44:06 +03:00
const (
ChannelTypeTelegram string = "telegram"
ChannelTypeFacebook string = "fbmessenger"
ChannelTypeViber string = "viber"
ChannelTypeWhatsapp string = "whatsapp"
ChannelTypeSkype string = "skype"
ChannelTypeVk string = "vk"
ChannelTypeInstagram string = "instagram"
ChannelTypeConsultant string = "consultant"
ChannelTypeCustom string = "custom"
ChatMemberStateActive string = "active"
ChatMemberStateKicked string = "kicked"
ChatMemberStateLeaved string = "leaved"
MessageScopePublic string = "public"
MessageScopePrivate string = "private"
2019-03-01 15:11:41 +03:00
WsEventMessageNew string = "message_new"
WsEventMessageUpdated string = "message_updated"
WsEventMessageDeleted string = "message_deleted"
WsEventDialogOpened string = "dialog_opened"
WsEventDialogClosed string = "dialog_closed"
WsEventDialogAssign string = "dialog_assign"
WsEventChatCreated string = "chat_created"
WsEventChatUpdated string = "chat_updated"
WsEventChatUnreadUpdated string = "chat_unread_updated"
WsEventUserOnlineUpdated string = "user_online_updated"
WsEventUserJoined string = "user_joined_chat"
WsEventUserLeave string = "user_left_chat"
WsEventUserUpdated string = "user_updated"
WsCustomerUpdated string = "customer_updated"
WsBotUpdated string = "bot_updated"
WsEventChannelUpdated string = "channel_updated"
WsEventSettingsUpdated string = "settings_updated"
2018-08-30 13:35:11 +03:00
ChannelFeatureNone string = "none"
ChannelFeatureReceive string = "receive"
ChannelFeatureSend string = "send"
ChannelFeatureBoth string = "both"
2018-09-08 01:21:41 +03:00
BotRoleDistributor string = "distributor"
BotRoleResponsible string = "responsible"
2018-09-13 11:38:13 +03:00
MsgTypeText string = "text"
MsgTypeSystem string = "system"
MsgTypeCommand string = "command"
MsgTypeOrder string = "order"
MsgTypeProduct string = "product"
2018-12-26 17:38:41 +03:00
MsgTypeFile string = "file"
MsgTypeImage string = "image"
2018-09-20 11:41:20 +03:00
MsgOrderStatusCodeNew = "new"
MsgOrderStatusCodeApproval = "approval"
MsgOrderStatusCodeAssembling = "assembling"
MsgOrderStatusCodeDelivery = "delivery"
MsgOrderStatusCodeComplete = "complete"
MsgOrderStatusCodeCancel = "cancel"
MsgCurrencyRub = "rub"
MsgCurrencyUah = "uah"
MsgCurrencyByr = "byr"
MsgCurrencyKzt = "kzt"
MsgCurrencyUsd = "usd"
MsgCurrencyEur = "eur"
SuggestionTypeText = "text"
SuggestionTypeEmail = "email"
SuggestionTypePhone = "phone"
2018-08-29 02:44:06 +03:00
)
2018-08-03 18:11:37 +03:00
// MgClient type
type MgClient struct {
URL string `json:"url"`
Token string `json:"token"`
Debug bool `json:"debug"`
httpClient *http.Client
2021-11-25 12:51:29 +03:00
logger BasicLogger `json:"-"`
2018-08-03 18:11:37 +03:00
}
2018-08-29 02:44:06 +03:00
// Request types
type (
BotsRequest struct {
ID uint64 `url:"id,omitempty"`
Active uint8 `url:"active,omitempty"`
2018-09-11 14:14:05 +03:00
Self uint8 `url:"self,omitempty"`
2018-09-08 01:21:41 +03:00
Role string `url:"role,omitempty"`
2018-08-29 02:44:06 +03:00
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
2019-05-23 13:45:06 +03:00
Limit int `url:"int,omitempty"`
2018-08-29 02:44:06 +03:00
}
ChannelsRequest struct {
2018-08-30 13:58:37 +03:00
ID uint64 `url:"id,omitempty"`
Types []string `url:"types,omitempty"`
Active uint8 `url:"active,omitempty"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
2019-05-23 13:45:06 +03:00
Limit int `url:"int,omitempty"`
2018-08-29 02:44:06 +03:00
}
UsersRequest struct {
ID uint64 `url:"id,omitempty"`
ExternalID string `url:"external_id,omitempty" json:"external_id"`
Online uint8 `url:"online,omitempty"`
Active uint8 `url:"active,omitempty"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
2019-05-23 13:45:06 +03:00
Limit int `url:"int,omitempty"`
2018-08-29 02:44:06 +03:00
}
CustomersRequest struct {
ID uint64 `url:"id,omitempty"`
ExternalID string `url:"external_id,omitempty" json:"external_id"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
2019-05-23 13:45:06 +03:00
Limit int `url:"int,omitempty"`
2018-08-29 02:44:06 +03:00
}
ChatsRequest struct {
ID uint64 `url:"id,omitempty"`
ChannelID uint64 `url:"channel_id,omitempty" json:"channel_id"`
ChannelType string `url:"channel_type,omitempty" json:"channel_type"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
2019-05-23 13:45:06 +03:00
Limit int `url:"int,omitempty"`
2018-08-29 02:44:06 +03:00
}
MembersRequest struct {
2018-08-30 13:35:11 +03:00
ChatID uint64 `url:"chat_id,omitempty" json:"chat_id"`
UserID string `url:"user_id,omitempty" json:"user_id"`
State string `url:"state,omitempty"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
2019-05-23 13:45:06 +03:00
Limit int `url:"int,omitempty"`
2018-08-29 02:44:06 +03:00
}
DialogsRequest struct {
2018-09-18 16:12:59 +03:00
ID uint64 `url:"id,omitempty"`
ChatID string `url:"chat_id,omitempty" json:"chat_id"`
UserID string `url:"user_id,omitempty" json:"user_id"`
BotID string `url:"bot_id,omitempty" json:"bot_id"`
Assign uint8 `url:"assign,omitempty"`
Active uint8 `url:"active,omitempty"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
2019-05-23 13:45:06 +03:00
Limit int `url:"int,omitempty"`
2018-08-29 02:44:06 +03:00
}
DialogAssignRequest struct {
2018-09-18 16:12:59 +03:00
DialogID uint64 `url:"dialog_id,omitempty" json:"dialog_id"`
UserID uint64 `url:"user_id,omitempty" json:"user_id"`
BotID uint64 `url:"bot_id,omitempty" json:"bot_id"`
2018-08-29 02:44:06 +03:00
}
MessagesRequest struct {
2019-03-01 15:11:41 +03:00
ID []int `url:"id,omitempty"`
2018-08-29 02:44:06 +03:00
ChatID uint64 `url:"chat_id,omitempty" json:"chat_id"`
DialogID uint64 `url:"dialog_id,omitempty" json:"dialog_id"`
2018-09-18 16:12:59 +03:00
UserID uint64 `url:"user_id,omitempty" json:"user_id"`
2018-08-29 02:44:06 +03:00
CustomerID uint64 `url:"customer_id,omitempty" json:"customer_id"`
BotID uint64 `url:"bot_id,omitempty" json:"bot_id"`
ChannelID uint64 `url:"channel_id,omitempty" json:"channel_id"`
ChannelType string `url:"channel_type,omitempty" json:"channel_type"`
Scope string `url:"scope,omitempty"`
2018-08-30 13:35:11 +03:00
Type string `url:"type,omitempty"`
2018-08-29 02:44:06 +03:00
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
2019-05-23 13:45:06 +03:00
Limit int `url:"int,omitempty"`
2018-08-29 02:44:06 +03:00
}
MessageSendRequest struct {
Type string `url:"type,omitempty" json:"type"`
Content string `url:"content,omitempty" json:"content"`
Product *MessageProduct `url:"product,omitempty" json:"product"`
Order *MessageOrder `url:"order,omitempty" json:"order"`
Items []Item `url:"order,omitempty" json:"items"`
Scope string `url:"scope,omitempty" json:"scope"`
ChatID uint64 `url:"chat_id,omitempty" json:"chat_id"`
QuoteMessageId uint64 `url:"quote_message_id,omitempty" json:"quote_message_id"`
TransportAttachments *TransportAttachments `url:"transport_attachments,omitempty" json:"transport_attachments"`
}
TransportAttachments struct {
Suggestions []Suggestion `url:"suggestions,omitempty" json:"suggestions"`
}
Suggestion struct {
Type string `url:"type,omitempty" json:"type"`
Title string `url:"title,omitempty" json:"title"`
2018-08-29 02:44:06 +03:00
}
MessageEditRequest struct {
ID uint64 `url:"id,omitempty"`
Content string `url:"content,omitempty" json:"content"`
}
InfoRequest struct {
2018-09-08 01:21:41 +03:00
Name string `url:"name,omitempty" json:"name"`
Avatar string `url:"avatar_url,omitempty" json:"avatar_url,omitempty"`
2018-09-08 01:21:41 +03:00
Roles []string `url:"roles,omitempty" json:"roles"`
2018-08-29 02:44:06 +03:00
}
CommandsRequest struct {
ID uint64 `url:"id,omitempty"`
Name string `url:"name,omitempty"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
2019-05-23 13:45:06 +03:00
Limit int `url:"int,omitempty"`
2018-08-29 02:44:06 +03:00
}
CommandEditRequest struct {
Name string `url:"name,omitempty" json:"name"`
Description string `url:"description,omitempty" json:"description"`
}
2018-12-26 17:38:41 +03:00
UploadFileByUrlRequest struct {
Url string `json:"url"`
}
2018-08-29 02:44:06 +03:00
)
2018-08-03 18:11:37 +03:00
2018-08-29 02:44:06 +03:00
// Response types
type (
BotsResponseItem struct {
2018-09-08 01:21:41 +03:00
ID uint64 `json:"id"`
Name string `json:"name"`
ClientID string `json:"client_id,omitempty"`
AvatarUrl string `json:"avatar_url,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
DeactivatedAt string `json:"deactivated_at,omitempty"`
IsActive bool `json:"is_active"`
IsSelf bool `json:"is_self"`
Roles []string `json:"roles,omitempty"`
2018-08-29 02:44:06 +03:00
}
ChannelResponseItem struct {
2018-08-30 13:35:11 +03:00
ID uint64 `json:"id"`
Type string `json:"type"`
2018-09-10 15:31:37 +03:00
Name string `json:"name"`
2018-08-30 13:35:11 +03:00
Settings ChannelSettings `json:"settings"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
ActivatedAt string `json:"activated_at"`
DeactivatedAt string `json:"deactivated_at"`
IsActive bool `json:"is_active"`
2018-08-29 02:44:06 +03:00
}
UsersResponseItem struct {
ID uint64 `json:"id"`
ExternalID string `json:"external_id,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at,omitempty"`
RevokedAt string `json:"revoked_at,omitempty"`
IsOnline bool `json:"is_online"`
IsActive bool `json:"is_active"`
Avatar string `json:"avatar_url,omitempty"`
}
CustomersResponseItem struct {
ID uint64 `json:"id"`
ExternalID string `json:"external_id,omitempty"`
ChannelId uint64 `json:"channel_id,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at,omitempty"`
RevokedAt string `json:"revoked_at,omitempty"`
Avatar string `json:"avatar_url,omitempty"`
ProfileURL string `json:"profile_url,omitempty"`
Country string `json:"country,omitempty"`
Language string `json:"language,omitempty"`
Phone string `json:"phone,omitempty"`
2018-08-30 13:35:11 +03:00
Email string `json:"email,omitempty"`
2018-08-29 02:44:06 +03:00
}
ChatResponseItem struct {
ID uint64 `json:"id"`
Avatar string `json:"avatar"`
Name string `json:"name"`
Channel Channel `json:"channel,omitempty"`
Customer UserRef `json:"customer"`
AuthorID uint64 `json:"author_id"`
LastMessage Message `json:"last_message"`
LastActivity string `json:"last_activity"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
MemberResponseItem struct {
ID uint64 `json:"id"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at,omitempty"`
IsAuthor bool `json:"is_author"`
State string `json:"state"`
ChatID uint64 `json:"chat_id"`
UserID uint64 `json:"user_id"`
}
DialogResponseItem struct {
ID uint64 `json:"id"`
ChatID uint64 `json:"chat_id"`
BeginMessageID uint64 `json:"begin_message_id,omitempty"`
EndingMessageID uint64 `json:"ending_message_id,omitempty"`
BotID uint64 `json:"bot_id,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at,omitempty"`
ClosedAt string `json:"closed_at,omitempty"`
IsAssigned bool `json:"is_assigned"`
Responsible Responsible `json:"responsible,omitempty"`
IsActive bool `json:"is_active"`
}
DialogAssignResponse struct {
Responsible Responsible `json:"responsible"`
PreviousResponsible Responsible `json:"previous_responsible,omitempty"`
2018-09-18 16:12:59 +03:00
LeftUserID uint64 `json:"left_user_id,omitempty"`
2018-08-29 02:44:06 +03:00
IsReAssign bool `json:"is_reassign"`
}
2020-07-14 14:37:46 +03:00
DialogUnassignResponse struct {
PreviousResponsible Responsible `json:"previous_responsible,omitempty"`
}
2018-08-29 02:44:06 +03:00
MessagesResponseItem struct {
Message
ChannelID uint64 `json:"channel_id,omitempty"`
ChannelSentAt string `json:"channel_sent_at,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
MessageSendResponse struct {
MessageID uint64 `json:"message_id"`
Time string `json:"time"`
}
CommandsResponseItem struct {
ID uint64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at,omitempty"`
}
2018-12-26 17:38:41 +03:00
FullFileResponse struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Size int `json:"size,omitempty"`
Url string `json:"url,omitempty"`
}
UploadFileResponse struct {
ID string `json:"id"`
Hash string `json:"hash"`
Type string `json:"type"`
Meta FileMeta `json:"meta"`
MimeType string `json:"mime_type"`
Size int `json:"size"`
Url *string `json:"source_url"`
CreatedAt time.Time `json:"created_at"`
}
2018-08-29 02:44:06 +03:00
)
2018-08-03 18:11:37 +03:00
// WS event types
type (
WsEvent struct {
2018-09-04 11:30:00 +03:00
Type string `json:"type"`
Meta EventMeta `json:"meta"`
AppID uint `json:"app_id"`
Data json.RawMessage `json:"data"`
}
EventMeta struct {
Timestamp int64 `json:"timestamp"`
}
)
2018-08-29 02:44:06 +03:00
// Single entity types
type (
Message struct {
2018-09-12 00:33:51 +03:00
ID uint64 `json:"id"`
Time string `json:"time"`
Type string `json:"type"`
Scope string `json:"scope"`
ChatID uint64 `json:"chat_id"`
IsRead bool `json:"is_read"`
IsEdit bool `json:"is_edit"`
Status string `json:"status"`
2019-04-16 17:58:16 +03:00
Chat *Chat `json:"chat"`
2018-09-12 00:33:51 +03:00
From *UserRef `json:"from"`
Product *MessageProduct `json:"product,omitempty"`
Order *MessageOrder `json:"order,omitempty"`
*TextMessage
*SystemMessage
*AttachmentList
2018-08-29 02:44:06 +03:00
}
TextMessage struct {
2018-09-12 00:33:51 +03:00
Content string `json:"content"`
Quote *QuoteMessage `json:"quote"`
Actions []string `json:"actions"`
2018-08-29 02:44:06 +03:00
}
SystemMessage struct {
Action string `json:"action"`
Dialog *SystemMessageDialog `json:"dialog,omitempty"`
User *UserRef `json:"user,omitempty"`
Responsible *UserRef `json:"responsible,omitempty"`
2018-08-29 02:44:06 +03:00
}
SystemMessageDialog struct {
ID uint64 `json:"id"`
}
QuoteMessage struct {
2018-09-12 00:33:51 +03:00
ID uint64 `json:"id"`
Content string `json:"content"`
Time string `json:"time"`
From *UserRef `json:"from"`
}
AttachmentList struct {
Items []Attachment `json:"items"`
}
Attachment struct {
2022-04-11 10:53:07 +03:00
ID string `json:"id"`
Mime string `json:"type"`
Caption string `json:"caption"`
Size uint64 `json:"size"`
PreviewURL *string `json:"preview_url,omitempty"`
Height *uint64 `json:"height,omitempty"`
Width *uint64 `json:"width,omitempty"`
}
2018-09-12 00:33:51 +03:00
MessageProduct struct {
2018-09-12 10:36:19 +03:00
ID uint64 `json:"id"`
Name string `json:"name"`
Article string `json:"article,omitempty"`
Url string `json:"url,omitempty"`
Img string `json:"img,omitempty"`
Cost *MessageOrderCost `json:"cost,omitempty"`
Quantity *MessageOrderQuantity `json:"quantity,omitempty"`
2018-09-12 00:33:51 +03:00
}
MessageOrder struct {
2018-09-20 11:41:20 +03:00
Number string `json:"number"`
Url string `json:"url,omitempty"`
Date string `json:"date,omitempty"`
Cost *MessageOrderCost `json:"cost,omitempty"`
Status *MessageOrderStatus `json:"status,omitempty"`
Delivery *MessageOrderDelivery `json:"delivery"`
Payments []MessageOrderPayment `json:"payment"`
Items []MessageOrderItem `json:"items,omitempty"`
2018-09-12 00:33:51 +03:00
}
MessageOrderStatus struct {
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
}
MessageOrderItem struct {
2018-09-13 22:33:43 +03:00
Name string `json:"name,omitempty"`
Url string `json:"url,omitempty"`
Img string `json:"img,omitempty"`
2018-09-13 22:33:43 +03:00
Quantity *MessageOrderQuantity `json:"quantity,omitempty"`
Price *MessageOrderCost `json:"price,omitempty"`
2018-08-29 02:44:06 +03:00
}
2018-09-12 10:36:19 +03:00
MessageOrderCost struct {
Value float32 `json:"value,omitempty"`
Currency string `json:"currency"`
}
MessageOrderQuantity struct {
Value float32 `json:"value"`
Unit string `json:"unit"`
}
2018-09-20 11:41:20 +03:00
MessageOrderPayment struct {
Name string `json:"name"`
Status *MessageOrderPaymentStatus `json:"status"`
Amount *MessageOrderCost `json:"amount"`
}
MessageOrderPaymentStatus struct {
Name string `json:"name"`
Payed bool `json:"payed"`
}
MessageOrderDelivery struct {
Name string `json:"name"`
Price *MessageOrderCost `json:"price"`
2018-09-20 11:41:20 +03:00
Address string `json:"address"`
Comment string `json:"comment,omitempty"`
2018-09-20 11:41:20 +03:00
}
2018-08-29 02:44:06 +03:00
UserRef struct {
2018-09-12 00:33:51 +03:00
ID uint64 `json:"id"`
Avatar string `json:"avatar"`
Type string `json:"type"`
2018-09-13 11:38:13 +03:00
Name string `json:"name"`
2018-09-12 00:33:51 +03:00
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
2019-03-01 15:11:41 +03:00
IsAdmin bool `json:"is_admin"`
Available bool `json:"available"`
2018-08-29 02:44:06 +03:00
}
Channel struct {
ID uint64 `json:"id"`
TransportID uint64 `json:"transport_id"`
Type string `json:"type"`
2018-09-10 15:31:37 +03:00
Name string `json:"name"`
2018-08-29 02:44:06 +03:00
Supports ChannelSupports `json:"supports"`
}
ChannelSupports struct {
Messages []string `json:"messages"`
Statuses []string `json:"statuses"`
}
Responsible struct {
ID int64 `json:"id"`
Type string `json:"type"`
AssignAt string `json:"assigned_at"`
}
Command struct {
ID uint64
BotID uint64
Name string
Description string
CreatedAt string
UpdatedAt string
}
2018-09-04 11:30:00 +03:00
Chat struct {
ID uint64 `json:"id"`
Avatar string `json:"avatar"`
Name string `json:"name"`
Channel *Channel `json:"channel,omitempty"`
Members []Member `json:"members"`
Customer *UserRef `json:"customer"`
AuthorID uint64 `json:"author_id"`
LastMessage *Message `json:"last_message"`
LastActivity string `json:"last_activity"`
}
Member struct {
IsAuthor bool `json:"is_author"`
State string `json:"state"`
User *UserRef `json:"user"`
}
Dialog struct {
2018-09-11 12:32:36 +03:00
ID uint64 `json:"id"`
BeginMessageID *uint64 `json:"begin_message_id"`
EndingMessageID *uint64 `json:"ending_message_id"`
Chat *Chat `json:"chat"`
Responsible *Responsible `json:"responsible"`
CreatedAt string `json:"created_at"`
ClosedAt *string `json:"closed_at"`
2018-09-04 11:30:00 +03:00
}
2018-12-26 17:38:41 +03:00
FileMeta struct {
Width *int `json:"width,omitempty"`
Height *int `json:"height,omitempty"`
}
Item struct {
ID string `json:"id"`
Caption string `json:"caption"`
}
2018-08-29 02:44:06 +03:00
)
2018-08-30 13:35:11 +03:00
// Channel settings
type (
2021-02-03 14:27:53 +03:00
CRUDChannelSettings struct {
Creating string `json:"creating"` // none, receive, send, both
Editing string `json:"editing"` // none, receive, send, both
Deleting string `json:"deleting"` // none, receive, send, both
}
2018-08-30 13:35:11 +03:00
ChannelSettingsText struct {
2021-02-03 14:27:53 +03:00
CRUDChannelSettings
Quoting string `json:"quoting"` // none, receive, send, both
MaxCharsCount uint16 `json:"max_chars_count"`
2018-08-30 13:35:11 +03:00
}
ChannelSettings struct {
2021-02-03 14:27:53 +03:00
CustomerExternalID string `json:"customer_external_id"`
SendingPolicy struct {
NewCustomer string `json:"new_customer"`
AfterReplyTimeout string `json:"after_reply_timeout"`
} `json:"sending_policy"`
2018-08-30 13:35:11 +03:00
Status struct {
Delivered string `json:"delivered"`
Read string `json:"read"`
} `json:"status"`
Text ChannelSettingsText `json:"text"`
2021-02-03 14:27:53 +03:00
Product struct {
CRUDChannelSettings
} `json:"product"`
Order struct {
CRUDChannelSettings
} `json:"order"`
Image struct {
CRUDChannelSettings
Quoting string `json:"quoting"`
MaxItemsCount int `json:"max_items_count"`
NoteMaxCharsCount uint16 `json:"note_max_chars_count"`
} `json:"image"`
File struct {
CRUDChannelSettings
Quoting string `json:"quoting"`
MaxItemsCount int `json:"max_items_count"`
NoteMaxCharsCount uint16 `json:"note_max_chars_count"`
} `json:"file"`
Audio struct {
Creating string `json:"creating"`
Quoting string `json:"quoting"`
Deleting string `json:"deleting"`
MaxItemsCount int `json:"max_items_count"`
} `json:"audio"`
Suggestions struct {
Text string `json:"text"`
Phone string `json:"phone"`
Email string `json:"email"`
} `json:"suggestions"`
2018-08-30 13:35:11 +03:00
}
)
2018-09-04 11:30:00 +03:00
// Events
type (
WsEventMessageNewData struct {
Message *Message `json:"message"`
}
WsEventMessageUpdatedData struct {
Message *Message `json:"message"`
}
WsEventMessageDeletedData struct {
Message *Message `json:"message"`
}
WsEventChatCreatedData struct {
Chat *Chat `json:"chat"`
}
WsEventChatUpdatedData struct {
Chat *Chat `json:"chat"`
}
WsEventDialogOpenedData struct {
Dialog *Dialog `json:"dialog"`
}
WsEventDialogClosedData struct {
Dialog *Dialog `json:"dialog"`
}
WsEventUserLeaveData struct {
Reason string `json:"reason"`
Chat struct {
ID uint64 `json:"id"`
} `json:"chat"`
User struct {
ID uint64 `json:"id"`
} `json:"user"`
}
WsEventUserUpdatedData struct {
*UserRef
}
2018-10-03 11:30:52 +03:00
WsEventCustomerUpdatedData struct {
*UserRef
}
WsEventBotUpdatedData struct {
*UserRef
}
2018-09-04 11:30:00 +03:00
WsEventDialogAssignData struct {
Dialog *Dialog `json:"dialog"`
Chat *Chat `json:"chat"`
}
EventUserJoinedChatData struct {
Chat *Chat `json:"chat"`
User *UserRef `json:"user"`
}
2019-03-01 15:11:41 +03:00
WsEventUserOnlineUpdatedData struct {
User *UserRef `json:"user"`
Online bool `json:"online"`
2019-03-01 15:11:41 +03:00
}
2018-09-04 11:30:00 +03:00
)