diff options
author | Alexander Kiryukhin <a.kiryukhin@corp.mail.ru> | 2019-03-28 17:51:39 +0300 |
---|---|---|
committer | Alexander Kiryukhin <a.kiryukhin@corp.mail.ru> | 2019-03-28 17:51:39 +0300 |
commit | a5f90182f76a279952f6cfd3dd7beab7391aaf56 (patch) | |
tree | c8c994f95592169f245ccaa52b3cd5392b7ba670 | |
parent | e4b27df1845b2ae5549a564573239d852cd69a45 (diff) |
Initial commit
Added types
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | api.go | 3 | ||||
-rw-r--r-- | go.mod | 3 | ||||
-rw-r--r-- | types.go | 107 |
4 files changed, 116 insertions, 0 deletions
@@ -10,3 +10,6 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out + +# IDEA +.idea
\ No newline at end of file @@ -0,0 +1,3 @@ +package tamtam + +// TODO methods @@ -0,0 +1,3 @@ +module github.com/neonxp/tamtam-go + +go 1.12 diff --git a/types.go b/types.go new file mode 100644 index 0000000..1cd88af --- /dev/null +++ b/types.go @@ -0,0 +1,107 @@ +package tamtam + +type BotInfo struct { + UserID int64 `json:"user_id"` + Name string `json:"name"` + Username string `json:"username,omitempty"` + AvatarURL string `json:"avatar_url"` + FullAvatarURL string `json:"full_avatar_url"` +} + +type ChatType string + +const ( + TypeDialog ChatType = "dialog" + TypeChat = "chat" + TypeChannel = "channel" +) + +type StatusType string + +const ( + StatusActive StatusType = "active" + StatusRemoved = "removed" + StatusLeft = "left" + StatusClosed = "closed" + StatusSuspended = "suspended" +) + +type Chat struct { + ChatID int64 `json:"chat_id"` + Type ChatType `json:"type"` + Status StatusType `json:"status"` + Title string `json:"title"` + Icon struct { + URL string `json:"url"` + } `json:"icon"` + LastEventTime int64 `json:"last_event_time"` + ParticipantsCount int32 `json:"participants_count"` + OwnerID int64 `json:"owner_id"` + Participants interface{} `json:"participants,omitempty"` + IsPublic bool `json:"is_public"` + Link string `json:"link,omitempty"` + Description string `json:"description,omitempty"` +} + +type Chats struct { + Chats []Chat `json:"chats"` + Marker int `json:"marker"` +} + +type Participant struct { + UserID int64 `json:"user_id"` + Name string `json:"name"` + Username string `json:"username,omitempty"` +} + +type Recipient struct { + ChatID int64 `json:"chat_id"` + ChatType ChatType `json:"chat_type"` + UserID int64 `json:"user_id,omitempty"` +} + +type LinkType string + +const ( + LinkForward = "forward" + LinkReply = "reply" +) + +type Message struct { + Sender Participant `json:"sender"` + Recipient Recipient `json:"recipient"` + Timestamp int64 `json:"timestamp"` + Link struct { + Type LinkType `json:"type"` + Sender Participant `json:"sender"` + ChatID int64 `json:"chat_id"` + Message MessageBody `json:"message"` + } `json:"link"` + Body MessageBody `json:"body"` +} + +type AttachmentType string + +const ( + AttachmentImage AttachmentType = "image" + AttachmentVideo = "video" + AttachmentAudio = "audio" + AttachmentFile = "file" + AttachmentContact = "contact" + AttachmentSticker = "sticker" + AttachmentShare = "share" + AttachmentLocation = "location" + AttachmentKeyboard = "inline_keyboard" +) + +type Attachment struct { + Type AttachmentType `json:"type"` + Payload interface{} `json:"payload"` +} + +type MessageBody struct { + MID string `json:"mid"` + Seq int64 `json:"seq"` + Text string `json:"text,omitempty"` + Attachments []Attachment `json:"attachments"` +} |