aboutsummaryrefslogtreecommitdiff
path: root/types.go
blob: 1cd88af37f68aac2115e4c069dbabbdeccde9e5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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"`
}