-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_types.go
322 lines (287 loc) · 13.4 KB
/
event_types.go
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
/*
GVK
Copyright (C) 2023-2024 The GVK Devs
GVK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
GVK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package gvk
import "github.com/vildan-valeev/gvk/objects"
// ClientInfo struct.
type ClientInfo struct {
ButtonActions []string `json:"button_actions"`
Keyboard bool `json:"keyboard"`
InlineKeyboard bool `json:"inline_keyboard"`
Carousel bool `json:"carousel"`
LangID int `json:"lang_id"`
}
// Messages struct.
type Message struct {
ID int `json:"id"` // Message ID
Date int `json:"date"`
PeerID int64 `json:"peer_id"` // Peer ID
FromID int64 `json:"from_id"`
Text string `json:"text"` // Message text
RandomID int `json:"random_id"`
Ref string `json:"ref"`
RefSource string `json:"ref_source"`
Attachments []Attachment `json:"attachments"`
Important bool `json:"important"` // Is it an important message
Geo BaseMessageGeo `json:"geo"`
Payload string `json:"payload"`
Keyboard Keyboard `json:"keyboard"`
FwdMessages []Message `json:"fwd_Messages"`
ReplyMessage *Message `json:"reply_message"`
Action MessageAction `json:"action"`
AdminAuthorID int `json:"admin_author_id"`
ConversationMessageID int `json:"conversation_message_id"`
IsCropped bool `json:"is_cropped"`
MembersCount int `json:"members_count"` // Members number
UpdateTime int `json:"update_time"` // Date when the message has been updated in Unixtime
WasListened bool `json:"was_listened,omitempty"`
PinnedAt int `json:"pinned_at,omitempty"`
MessageTag string `json:"message_tag"` // for https://notify.mail.ru/
IsMentionedUser bool `json:"is_mentioned_user,omitempty"`
}
type MessageAction struct {
ConversationMessageID int `json:"conversation_message_id"` // Message ID
Email string `json:"email"`
MemberID int `json:"member_id"` // User or email peer ID
Message string `json:"message"` // Message body of related message
Photo MessageActionPhoto `json:"photo"`
Text string `json:"text"`
Type string `json:"type"`
}
type MessageActionPhoto struct {
Photo100 string `json:"photo_100"` // URL of the preview image with 100px in width
Photo200 string `json:"photo_200"` // URL of the preview image with 200px in width
Photo50 string `json:"photo_50"` // URL of the preview image with 50px in width
}
type Attachment struct {
//Audio AudioAudio `json:"audio"`
//Doc DocsDoc `json:"doc"`
//Gift GiftsLayout `json:"gift"`
//Link BaseLink `json:"link"`
//Market MarketMarketItem `json:"market"`
//MarketMarketAlbum MarketMarketAlbum `json:"market_market_album"`
//Photo PhotosPhoto `json:"photo"`
//Sticker BaseSticker `json:"sticker"`
Type string `json:"type"`
//Video VideoVideo `json:"video"`
//Wall WallWallpost `json:"wall"`
//WallReply WallWallComment `json:"wall_reply"`
//AudioMessage DocsDoc `json:"audio_message"`
//Graffiti DocsDoc `json:"graffiti"`
//Poll PollsPoll `json:"poll"`
//Call MessageCall `json:"call"`
//Story StoriesStory `json:"story"`
//Podcast PodcastsEpisode `json:"podcast"`
}
type Keyboard struct {
AuthorID int `json:"author_id,omitempty"` // Community or bot, which set this keyboard
Buttons [][]Button `json:"buttons"`
OneTime bool `json:"one_time,omitempty"` // Should this keyboard disappear on first use
Inline bool `json:"inline,omitempty"`
}
type Button struct {
Action ButtonAction `json:"action"`
Color ButtonColor `json:"color,omitempty"` // Button color
}
type ButtonColor string
const (
ButtonColorPrimary ButtonColor = "primary"
ButtonColorSecondary ButtonColor = "secondary"
ButtonColorNegative ButtonColor = "negative"
ButtonColorPositive ButtonColor = "positive"
)
type ButtonAction struct {
Type ButtonType `json:"type"` // Button type
Label string `json:"label,omitempty"` // Label for button
Payload string `json:"payload,omitempty"` // Additional data sent along with message for developer convenience
AppID int `json:"app_id,omitempty"` // Fragment value in app link like vk.com/app{app_id}_-654321#hash
Hash string `json:"hash,omitempty"` // Fragment value in app link like vk.com/app123456_-654321#{hash}
OwnerID int `json:"owner_id,omitempty"` // Fragment value in app link like vk.com/app123456_{owner_id}#hash
Link string `json:"link,omitempty"` // Link URL
}
type ButtonType string
const (
ButtonTypeText ButtonType = "text"
ButtonTypeOpenLink ButtonType = "open_link"
ButtonTypeLocation ButtonType = "location"
ButtonTypeVkPay ButtonType = "vkpay"
ButtonTypeOpenApp ButtonType = "open_app"
ButtonTypeCallBack ButtonType = "callback"
)
// BaseMessageGeo struct.
type BaseMessageGeo struct {
Coordinates BaseGeoCoordinates `json:"coordinates"`
Place Place `json:"place"`
Showmap int `json:"showmap"`
Type string `json:"type"`
}
// BaseGeoCoordinates struct.
type BaseGeoCoordinates struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
}
// BasePlace struct.
type Place struct {
ID int `json:"id"`
Title string `json:"title"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Created int `json:"created"`
Icon string `json:"icon"`
Checkins int `json:"checkins"`
Updated int `json:"updated"`
Type string `json:"type"`
Country int `json:"country"`
City int `json:"city"`
Address string `json:"address"`
}
type WallPost struct {
ID int `json:"id"` // Post ID
OwnerID int64 `json:"owner_id"` // Wall owner's ID
FromID int64 `json:"from_id"` // Post author ID
CreatedBy int `json:"created_by"`
Date int `json:"date"` // Date of publishing in Unixtime
Text string `json:"text"` // Post text
ReplyOwnerID int `json:"reply_owner_id"`
ReplyPostID int `json:"reply_post_id"`
FriendsOnly int `json:"friends_only"` // 1, если запись была создана с опцией «Только для друзей».
Comments Comments `json:"comments"`
Copyright Copyright `json:"copyright"`
Likes Likes `json:"likes"` // Count of likes
Reposts Reposts `json:"reposts"` // Count of reposts
Views Views `json:"views"` // Count of views
PostType string `json:"post_type"`
PostSource PostSource `json:"post_source"`
Attachments []WallPostAttachment `json:"attachments"`
Geo Geo `json:"geo"`
SignerID int `json:"signer_id"` // Post signer ID
CopyHistory []WallPost `json:"copy_history"`
CanPin int `json:"can_pin"`
CanDelete int `json:"can_delete"`
CanEdit int `json:"can_edit"`
IsPinned int `json:"is_pinned"`
IsFavorite bool `json:"is_favorite"` // true, если объект добавлен в закладки у текущего пользователя.
MarkedAsAds int `json:"marked_as_ads"`
PostponedID int `json:"postponed_id"` // ID from scheduled posts
}
// Comments struct.
type Comments struct {
Count int `json:"count"`
CanPost int `json:"can_post"` // информация о том, может ли текущий пользователь комментировать запись (1 — может, 0 — не может);
GroupsCanPost int `json:"groups_can_post"`
CanClose int `json:"can_close"`
CanOpen int `json:"can_open"`
}
// Copyright information about the source of the post.
type Copyright struct {
ID int `json:"id,omitempty"`
Link string `json:"link"`
Type string `json:"type"`
Name string `json:"name"`
}
// Likes struct.
type Likes struct {
CanLike int `json:"can_like"` // Information whether current user can like the post
CanPublish int `json:"can_publish"` // Information whether current user can repost
UserLikes int `json:"user_likes"` // Information whether current uer has liked the post
Count int `json:"count"`
}
// Reposts struct.
type Reposts struct {
Count int `json:"count"`
UserReposted int `json:"user_reposted"`
}
// Views struct.
type Views struct {
Count int `json:"count"` // Count
}
type PostSource struct {
Data string `json:"data"` // Additional data
Platform string `json:"platform"` // Platform name
Type string `json:"type"`
URL string `json:"url"` // URL to an external site used to publish the post
}
// BaseGeo struct.
type Geo struct {
Coordinates string `json:"coordinates"`
Place Place `json:"place"`
Type string `json:"type"`
}
// WallPostAttachment struct.
type WallPostAttachment struct {
Type string `json:"type"`
Photo objects.Photo `json:"photo"`
//Deprecated
PostedPhoto PostedPhoto `json:"posted_photo"`
Video objects.Video `json:"video"`
Audio objects.Audio `json:"audio"`
Doc objects.Doc `json:"doc"`
//Deprecated
Graffiti WallGraffiti `json:"graffiti"`
Link objects.Link `json:"link"`
Note objects.Note `json:"note"`
Poll objects.Poll `json:"poll"`
Page objects.WikiPage `json:"page"`
Album PhotoAlbum `json:"album"`
PhotosList []string `json:"photos_list"`
Market objects.MarketItem `json:"market"`
MarketAlbum objects.MarketAlbum `json:"market_market_album"`
Sticker objects.Sticker `json:"sticker"`
Event EventAttach `json:"event"`
PrettyCards []PrettyCard `json:"podcast"`
}
type PostedPhoto struct {
ID int `json:"id"` // Photo ID
OwnerID int `json:"owner_id"` // Photo owner's ID
Photo130 string `json:"photo_130"` // URL of the preview image with 130 px in width
Photo604 string `json:"photo_604"` // URL of the preview image with 604 px in width
}
// WallGraffiti struct.
type WallGraffiti struct {
ID int `json:"id"` // Graffiti ID
OwnerID int `json:"owner_id"` // Graffiti owner's ID
Photo130 string `json:"photo_200"` // URL of the preview image with 130 px in width
Photo604 string `json:"photo_586"` // URL of the preview image with 604 px in width
}
// PhotoAlbum struct.
type PhotoAlbum struct {
ID int `json:"id"` // Photo album ID
Thumb objects.Photo `json:"thumb"`
OwnerID int `json:"owner_id"` // Album owner's ID
Title string `json:"title"` // Photo album title
Description string `json:"description"` // Photo album description
Created int `json:"created"` // Date when the album has been created in Unixtime
Updated int `json:"updated"` // Date when the album has been updated last time in Unixtime
Size int `json:"size"` // Photos number
}
// EventAttach struct.
type EventAttach struct {
ID int `json:"id"` // event ID
Time int `json:"time,omitempty"` // event start time
MemberStatus int `json:"member_status,omitempty"` // Идёт ли текущий пользователь на встречу. Возможные значения: 1 — точно идёт; 2 — возможно пойдёт; 3 — не идёт.
Address string `json:"address,omitempty"` // address of event
ButtonText string `json:"button_text"` // text of attach
Friends []int `json:"friends"` // array of friends ids
IsFavorite bool `json:"is_favorite"` // is favorite
Text string `json:"text"` // text of attach
}
type PrettyCard struct {
CardID string `json:"card_id"`
LinkURL string `json:"link_url"`
Title string `json:"title"`
Images []objects.Photo `json:"images"`
Button objects.Button `json:"button"`
Price string `json:"price"`
PriceOld string `json:"price_old"`
}