4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-28 00:59:24 +00:00

Bump github.com/SevereCloud/vksdk/v2 from 2.11.0 to 2.13.0 (#1698)

Bumps [github.com/SevereCloud/vksdk/v2](https://github.com/SevereCloud/vksdk) from 2.11.0 to 2.13.0.
- [Release notes](https://github.com/SevereCloud/vksdk/releases)
- [Commits](https://github.com/SevereCloud/vksdk/compare/v2.11.0...v2.13.0)

---
updated-dependencies:
- dependency-name: github.com/SevereCloud/vksdk/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2022-01-28 23:48:40 +01:00
committed by GitHub
parent ac06a26809
commit 5a1fd7dadd
111 changed files with 21525 additions and 264 deletions

View File

@ -62,21 +62,24 @@ type AccountOffer struct {
// AccountAccountCounters struct.
type AccountAccountCounters struct {
AppRequests int `json:"app_requests"` // New app requests number
Events int `json:"events"` // New events number
Friends int `json:"friends"` // New friends requests number
FriendsRecommendations int `json:"friends_recommendations"` // New friends recommendations number
FriendsSuggestions int `json:"friends_suggestions"` // New friends suggestions number
Gifts int `json:"gifts"` // New gifts number
Groups int `json:"groups"` // New groups number
Messages int `json:"messages"` // New messages number
Notifications int `json:"notifications"` // New notifications number
Photos int `json:"photos"` // New photo tags number
SDK int `json:"sdk"` // New SDK number
MenuDiscoverBadge int `json:"menu_discover_badge"` // New menu discover badge number
MenuClipsBadge int `json:"menu_clips_badge"` // New menu clips badge number
Videos int `json:"videos"` // New video tags number
Faves int `json:"faves"` // New faves number
AppRequests int `json:"app_requests"` // New app requests number
Events int `json:"events"` // New events number
Friends int `json:"friends"` // New friends requests number
FriendsRecommendations int `json:"friends_recommendations"` // New friends recommendations number
FriendsSuggestions int `json:"friends_suggestions"` // New friends suggestions number
Gifts int `json:"gifts"` // New gifts number
Groups int `json:"groups"` // New groups number
Messages int `json:"messages"` // New messages number
Notifications int `json:"notifications"` // New notifications number
Photos int `json:"photos"` // New photo tags number
SDK int `json:"sdk"` // New SDK number
MenuDiscoverBadge int `json:"menu_discover_badge"` // New menu discover badge number
MenuClipsBadge int `json:"menu_clips_badge"` // New menu clips badge number
Videos int `json:"videos"` // New video tags number
Faves int `json:"faves"` // New faves number
Calls int `json:"calls"` // New calls number
MenuSuperappFriendsBadge int `json:"menu_superapp_friends_badge"`
MenuNewClipsBadge int `json:"menu_new_clips_badge"`
}
// AccountInfo struct.
@ -107,6 +110,7 @@ type AccountInfo struct {
IsLiveStreamingEnabled BaseBoolInt `json:"is_live_streaming_enabled"`
IsNewLiveStreamingEnabled BaseBoolInt `json:"is_new_live_streaming_enabled"`
LinkRedirects map[string]string `json:"link_redirects"`
VkPayEndpointV2 string `json:"vk_pay_endpoint_v2"`
}
// AccountPushSettings struct.

View File

@ -8,12 +8,13 @@ type AdsAccesses struct {
// AdsAccount struct.
type AdsAccount struct {
AccessRole string `json:"access_role"`
AccountID int `json:"account_id"` // Account ID
AccountName string `json:"account_name"`
AccountStatus BaseBoolInt `json:"account_status"` // Information whether account is active
CanViewBudget BaseBoolInt `json:"can_view_budget"`
AccountType string `json:"account_type"`
AccessRole string `json:"access_role"`
AccountID int `json:"account_id"` // Account ID
AccountName string `json:"account_name"`
AccountStatus BaseBoolInt `json:"account_status"` // Information whether account is active
CanViewBudget BaseBoolInt `json:"can_view_budget"`
AdNetworkAllowedPotentially BaseBoolInt `json:"ad_network_allowed_potentially"`
AccountType string `json:"account_type"`
}
// AdsAdLayout struct.
@ -318,3 +319,10 @@ type AdsPromotedPostReach struct {
VideoViews75p int `json:"video_views_75p"` // Video views for 75 percent
VideoViewsStart int `json:"video_views_start"` // Video starts
}
// AdsMusician struct.
type AdsMusician struct {
ID int `json:"id"` // Targeting music artist ID
Name string `json:"name"` // Music artist name
Avatar string `json:"avatar,omitempty"` // Music artist photo.
}

View File

@ -60,6 +60,7 @@ type AppsApp struct {
IsNew BaseBoolInt `json:"is_new"`
New BaseBoolInt `json:"new"`
IsInstalled BaseBoolInt `json:"is_installed"`
HasVkConnect BaseBoolInt `json:"has_vk_connect"`
LeaderboardType int `json:"leaderboard_type"`
MembersCount int `json:"members_count"` // Members number
PlatformID int `json:"platform_id"` // Application ID in store
@ -78,7 +79,7 @@ type AppsApp struct {
// mobile_controls_type = 0 - прозрачный элемент управления поверх области с игрой;
// mobile_controls_type = 1 - чёрная полоска над областью с игрой;
// mobile_controls_type = 2 - только для vk apps, без контроллов.
// mobile_controls_type = 2 - только для vk apps, без элементов управления'.
MobileControlsType int `json:"mobile_controls_type"`
// mobile_view_support_type = 0 - игра не использует нижнюю часть экрана на iPhoneX, черная полоса есть.

17
vendor/github.com/SevereCloud/vksdk/v2/object/auth.go generated vendored Normal file
View File

@ -0,0 +1,17 @@
package object // import "github.com/SevereCloud/vksdk/v2/object"
// AuthSilentTokenProfile struct.
type AuthSilentTokenProfile struct {
Token string `json:"token"`
Expires int `json:"expires"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Photo50 string `json:"photo_50"`
Photo100 string `json:"photo_100"`
Photo200 string `json:"photo_200"`
Phone string `json:"phone"`
PhoneValidated interface{} `json:"phone_validated"` // int | bool
UserID int `json:"user_id"`
IsPartial BaseBoolInt `json:"is_partial"`
IsService BaseBoolInt `json:"is_service"`
}

View File

@ -4,9 +4,9 @@ package object // import "github.com/SevereCloud/vksdk/v2/object"
type DatabaseCity struct {
ID int `json:"id"` // City ID
Title string `json:"title"` // City title
Area string `json:"area"`
Region string `json:"region"`
Important BaseBoolInt `json:"important"`
Area string `json:"area,omitempty"`
Region string `json:"region,omitempty"`
Important BaseBoolInt `json:"important,omitempty"`
}
// DatabaseMetroStation struct.

View File

@ -1,9 +1,13 @@
package object // import "github.com/SevereCloud/vksdk/v2/object"
import (
"bytes"
"encoding/json"
"fmt"
"reflect"
"github.com/vmihailenco/msgpack/v5"
"github.com/vmihailenco/msgpack/v5/msgpcode"
)
// GroupsAddress WorkInfoStatus of information about timetable.
@ -110,112 +114,113 @@ const (
// GroupsGroup struct.
type GroupsGroup struct {
AdminLevel int `json:"admin_level"`
Deactivated string `json:"deactivated"` // Information whether community is banned
FinishDate int `json:"finish_date"` // Finish date in Unixtime format
ID int `json:"id"` // Community ID
Name string `json:"name"` // Community name
Photo100 string `json:"photo_100"` // URL of square photo of the community with 100 pixels in width
Photo200 string `json:"photo_200"` // URL of square photo of the community with 200 pixels in width
Photo50 string `json:"photo_50"` // URL of square photo of the community with 50 pixels in width
ScreenName string `json:"screen_name"` // Domain of the community page
StartDate int `json:"start_date"` // Start date in Unixtime format
Type string `json:"type"`
Market GroupsMarketInfo `json:"market"`
MemberStatus int `json:"member_status"` // Current user's member status
IsClosed int `json:"is_closed"`
City BaseObject `json:"city"`
Country BaseCountry `json:"country"`
AdminLevel int `json:"admin_level,omitempty"`
Deactivated string `json:"deactivated,omitempty"` // Information whether community is banned
FinishDate int `json:"finish_date,omitempty"` // Finish date in Unixtime format
Photo100 string `json:"photo_100,omitempty"` // URL of square photo of the community with 100 pixels in width
Photo200 string `json:"photo_200,omitempty"` // URL of square photo of the community with 200 pixels in width
Photo50 string `json:"photo_50,omitempty"` // URL of square photo of the community with 50 pixels in width
StartDate int `json:"start_date,omitempty"` // Start date in Unixtime format
Market GroupsMarketInfo `json:"market,omitempty"`
MemberStatus int `json:"member_status,omitempty"` // Current user's member status
City BaseObject `json:"city,omitempty"`
Country BaseCountry `json:"country,omitempty"`
// Information whether current user is administrator.
IsAdmin BaseBoolInt `json:"is_admin"`
// Information whether current user is advertiser.
IsAdvertiser BaseBoolInt `json:"is_advertiser"`
IsAdvertiser BaseBoolInt `json:"is_advertiser,omitempty"`
// Information whether current user is member.
IsMember BaseBoolInt `json:"is_member"`
IsMember BaseBoolInt `json:"is_member,omitempty"`
// Information whether community is in faves.
IsFavorite BaseBoolInt `json:"is_favorite"`
IsFavorite BaseBoolInt `json:"is_favorite,omitempty"`
// Information whether community is adult.
IsAdult BaseBoolInt `json:"is_adult"`
IsAdult BaseBoolInt `json:"is_adult,omitempty"`
// Information whether current user is subscribed.
IsSubscribed BaseBoolInt `json:"is_subscribed"`
IsSubscribed BaseBoolInt `json:"is_subscribed,omitempty"`
// Information whether current user can post on community's wall.
CanPost BaseBoolInt `json:"can_post"`
CanPost BaseBoolInt `json:"can_post,omitempty"`
// Information whether current user can see all posts on community's wall.
CanSeeAllPosts BaseBoolInt `json:"can_see_all_posts"`
CanSeeAllPosts BaseBoolInt `json:"can_see_all_posts,omitempty"`
// Information whether current user can create topic.
CanCreateTopic BaseBoolInt `json:"can_create_topic"`
CanCreateTopic BaseBoolInt `json:"can_create_topic,omitempty"`
// Information whether current user can upload video.
CanUploadVideo BaseBoolInt `json:"can_upload_video"`
CanUploadVideo BaseBoolInt `json:"can_upload_video,omitempty"`
// Information whether current user can upload doc.
CanUploadDoc BaseBoolInt `json:"can_upload_doc"`
CanUploadDoc BaseBoolInt `json:"can_upload_doc,omitempty"`
// Information whether community has photo.
HasPhoto BaseBoolInt `json:"has_photo"`
HasPhoto BaseBoolInt `json:"has_photo,omitempty"`
// Information whether current user can send a message to community.
CanMessage BaseBoolInt `json:"can_message"`
CanMessage BaseBoolInt `json:"can_message,omitempty"`
// Information whether community can send a message to current user.
IsMessagesBlocked BaseBoolInt `json:"is_messages_blocked"`
IsMessagesBlocked BaseBoolInt `json:"is_messages_blocked,omitempty"`
// Information whether community can send notifications by phone number to current user.
CanSendNotify BaseBoolInt `json:"can_send_notify"`
CanSendNotify BaseBoolInt `json:"can_send_notify,omitempty"`
// Information whether current user is subscribed to podcasts.
IsSubscribedPodcasts BaseBoolInt `json:"is_subscribed_podcasts"`
IsSubscribedPodcasts BaseBoolInt `json:"is_subscribed_podcasts,omitempty"`
// Owner in whitelist or not.
CanSubscribePodcasts BaseBoolInt `json:"can_subscribe_podcasts"`
CanSubscribePodcasts BaseBoolInt `json:"can_subscribe_podcasts,omitempty"`
// Can subscribe to wall.
CanSubscribePosts BaseBoolInt `json:"can_subscribe_posts"`
CanSubscribePosts BaseBoolInt `json:"can_subscribe_posts,omitempty"`
// Information whether community has market app.
HasMarketApp BaseBoolInt `json:"has_market_app"`
IsHiddenFromFeed BaseBoolInt `json:"is_hidden_from_feed"`
IsMarketCartEnabled BaseBoolInt `json:"is_market_cart_enabled"`
Verified BaseBoolInt `json:"verified"` // Information whether community is verified
HasMarketApp BaseBoolInt `json:"has_market_app,omitempty"`
IsHiddenFromFeed BaseBoolInt `json:"is_hidden_from_feed,omitempty"`
IsMarketCartEnabled BaseBoolInt `json:"is_market_cart_enabled,omitempty"`
Verified BaseBoolInt `json:"verified,omitempty"` // Information whether community is verified
// Information whether the community has a fire pictogram.
Trending BaseBoolInt `json:"trending"`
Description string `json:"description"` // Community description
WikiPage string `json:"wiki_page"` // Community's main wiki page title
MembersCount int `json:"members_count"` // Community members number
Counters GroupsCountersGroup `json:"counters"`
Cover GroupsCover `json:"cover"`
Trending BaseBoolInt `json:"trending,omitempty"`
Description string `json:"description,omitempty"` // Community description
WikiPage string `json:"wiki_page,omitempty"` // Community's main wiki page title
MembersCount int `json:"members_count,omitempty"` // Community members number
Counters GroupsCountersGroup `json:"counters,omitempty"`
Cover GroupsCover `json:"cover,omitempty"`
// Type of group, start date of event or category of public page.
Activity string `json:"activity"`
FixedPost int `json:"fixed_post"` // Fixed post ID
Status string `json:"status"` // Community status
MainAlbumID int `json:"main_album_id"` // Community's main photo album ID
Links []GroupsLinksItem `json:"links"`
Contacts []GroupsContactsItem `json:"contacts"`
Site string `json:"site"` // Community's website
MainSection int `json:"main_section"`
OnlineStatus GroupsOnlineStatus `json:"online_status"` // Status of replies in community messages
AgeLimits int `json:"age_limits"` // Information whether age limit
BanInfo GroupsGroupBanInfo `json:"ban_info"` // User ban info
Addresses GroupsAddressesInfo `json:"addresses"` // Info about addresses in Groups
LiveCovers GroupsLiveCovers `json:"live_covers"`
CropPhoto UsersCropPhoto `json:"crop_photo"`
Wall int `json:"wall"`
ActionButton GroupsActionButton `json:"action_button"`
TrackCode string `json:"track_code"`
PublicDateLabel string `json:"public_date_label"`
AuthorID int `json:"author_id"`
Phone string `json:"phone"`
Activity string `json:"activity,omitempty"`
FixedPost int `json:"fixed_post,omitempty"` // Fixed post ID
Status string `json:"status,omitempty"` // Community status
MainAlbumID int `json:"main_album_id,omitempty"` // Community's main photo album ID
Links []GroupsLinksItem `json:"links,omitempty"`
Contacts []GroupsContactsItem `json:"contacts,omitempty"`
Site string `json:"site,omitempty"` // Community's website
MainSection int `json:"main_section,omitempty"`
OnlineStatus GroupsOnlineStatus `json:"online_status,omitempty"` // Status of replies in community messages
AgeLimits int `json:"age_limits,omitempty"` // Information whether age limit
BanInfo GroupsGroupBanInfo `json:"ban_info,omitempty"` // User ban info
Addresses GroupsAddressesInfo `json:"addresses,omitempty"` // Info about addresses in Groups
LiveCovers GroupsLiveCovers `json:"live_covers,omitempty"`
CropPhoto UsersCropPhoto `json:"crop_photo,omitempty"`
Wall int `json:"wall,omitempty"`
ActionButton GroupsActionButton `json:"action_button,omitempty"`
TrackCode string `json:"track_code,omitempty"`
PublicDateLabel string `json:"public_date_label,omitempty"`
AuthorID int `json:"author_id,omitempty"`
Phone string `json:"phone,omitempty"`
Like GroupsGroupLike `json:"like"`
}
// ToMention return mention.
@ -223,6 +228,18 @@ func (group GroupsGroup) ToMention() string {
return fmt.Sprintf("[club%d|%s]", group.ID, group.Name)
}
// GroupsGroupLike struct.
type GroupsGroupLike struct {
IsLiked BaseBoolInt `json:"is_liked"`
Friends GroupsGroupLikeFriends `json:"friends"`
}
// GroupsGroupLikeFriends struct.
type GroupsGroupLikeFriends struct {
Count int `json:"count"`
Preview []int `json:"preview"`
}
// GroupsLiveCovers struct.
type GroupsLiveCovers struct {
IsEnabled BaseBoolInt `json:"is_enabled"`
@ -275,16 +292,70 @@ type GroupsContactsItem struct {
// GroupsCountersGroup struct.
type GroupsCountersGroup struct {
Addresses int `json:"addresses"` // Addresses number
Albums int `json:"albums"` // Photo albums number
Articles int `json:"articles"` // Articles number
Audios int `json:"audios"` // Audios number
Docs int `json:"docs"` // Docs number
Market int `json:"market"` // Market items number
Photos int `json:"photos"` // Photos number
Topics int `json:"topics"` // Topics number
Videos int `json:"videos"` // Videos number
Narratives int `json:"narratives"` // Narratives number
Addresses int `json:"addresses"` // Addresses number
Albums int `json:"albums"` // Photo albums number
Articles int `json:"articles"` // Articles number
Audios int `json:"audios"` // Audios number
Docs int `json:"docs"` // Docs number
Market int `json:"market"` // Market items number
Photos int `json:"photos"` // Photos number
Topics int `json:"topics"` // Topics number
Videos int `json:"videos"` // Videos number
Narratives int `json:"narratives"` // Narratives number
Clips int `json:"clips"` // Clips number
ClipsFollowers int `json:"clips_followers"` // Clips followers number
}
// UnmarshalJSON GroupsCountersGroup.
//
// BUG(VK): GroupsCountersGroup return [].
func (personal *GroupsCountersGroup) UnmarshalJSON(data []byte) error {
if bytes.Equal(data, []byte("[]")) {
return nil
}
type renamedGroupsCountersGroup GroupsCountersGroup
var r renamedGroupsCountersGroup
err := json.Unmarshal(data, &r)
if err != nil {
return err
}
*personal = GroupsCountersGroup(r)
return nil
}
// DecodeMsgpack GroupsCountersGroup.
//
// BUG(VK): GroupsCountersGroup return [].
func (personal *GroupsCountersGroup) DecodeMsgpack(dec *msgpack.Decoder) error {
data, err := dec.DecodeRaw()
if err != nil {
return err
}
if bytes.Equal(data, []byte{msgpcode.FixedArrayLow}) {
return nil
}
type renamedGroupsCountersGroup GroupsCountersGroup
var r renamedGroupsCountersGroup
d := msgpack.NewDecoder(bytes.NewReader(data))
d.SetCustomStructTag("json")
err = d.Decode(&r)
if err != nil {
return err
}
*personal = GroupsCountersGroup(r)
return nil
}
// GroupsCover struct.
@ -479,6 +550,70 @@ type GroupsGroupSettings struct {
SecondarySection int `json:"secondary_section"`
ActionButton GroupsActionButton `json:"action_button"`
Phone string `json:"phone"`
RecognizePhoto int `json:"recognize_photo"`
MarketServices GroupsMarketServices `json:"market_services"`
Narratives int `json:"narratives"`
Clips int `json:"clips"`
Textlives int `json:"textlives"`
Youla GroupsYoula `json:"youla"`
}
// GroupsMarketServices struct.
type GroupsMarketServices struct {
Enabled BaseBoolInt `json:"enabled"`
CanMessage BaseBoolInt `json:"can_message"`
CommentsEnabled BaseBoolInt `json:"comments_enabled"`
ContactID int `json:"contact_id"`
Currency MarketCurrency `json:"currency"`
ViewType GroupsSelectedItems `json:"view_type"`
BlockName GroupsSelectedItems `json:"block_name"`
ButtonLabel GroupsSelectedItems `json:"button_label"`
}
// GroupsSelectedItems struct.
type GroupsSelectedItems struct {
SelectedItemID int64 `json:"selected_item_id"`
Items []BaseObjectWithName `json:"items"`
}
// GroupsYoula struct.
type GroupsYoula struct {
CategoryTree GroupsYoulaCategory `json:"category_tree"`
GroupSettings GroupsYoulaSettings `json:"group_settings"`
}
// GroupsYoulaCategory struct.
type GroupsYoulaCategory struct {
ID int `json:"id"`
Title string `json:"title"`
Subcategories []GroupsYoulaSubcategory `json:"subcategories"`
}
// GroupsYoulaSubcategory struct.
type GroupsYoulaSubcategory struct {
ID int `json:"id"`
Title string `json:"title"`
ParentID int `json:"parent_id"`
Subcategories []GroupsYoulaSubcategory `json:"subcategories"`
}
// GroupsYoulaSettings struct.
type GroupsYoulaSettings struct {
IsActive BaseBoolInt `json:"is_active"`
IsModerated BaseBoolInt `json:"is_moderated"`
ShowModerationSetting BaseBoolInt `json:"show_moderation_setting"`
ModerationStatus int `json:"moderation_status"`
DeclineReason string `json:"decline_reason"`
GroupMode int `json:"group_mode"`
SelectedCategoryIDS []int `json:"selected_category_ids"`
Lat float64 `json:"lat"`
Long float64 `json:"long"`
Radius float64 `json:"radius"`
RadiusArea string `json:"radius_area"`
Address string `json:"address"`
Radiuses []float64 `json:"radiuses"`
}
// GroupsSectionsList struct.
@ -532,6 +667,53 @@ func (g *GroupsSectionsList) UnmarshalJSON(data []byte) error {
return nil
}
// DecodeMsgpack need for decode dynamic array (Example: [1, "Фотографии"]) to struct.
func (g *GroupsSectionsList) DecodeMsgpack(dec *msgpack.Decoder) error {
data, err := dec.DecodeRaw()
if err != nil {
return err
}
var alias []interface{}
err = msgpack.Unmarshal(data, &alias)
if err != nil {
return err
}
if len(alias) != 2 {
return &json.UnmarshalTypeError{
Value: string(data),
Type: reflect.TypeOf((*GroupsSectionsList)(nil)),
}
}
id, ok := alias[0].(int8)
if !ok {
return &json.UnmarshalTypeError{
Value: string(data),
Type: reflect.TypeOf((*GroupsSectionsList)(nil)),
Struct: "GroupsSectionsList",
Field: "ID",
}
}
name, ok := alias[1].(string)
if !ok {
return &json.UnmarshalTypeError{
Value: string(data),
Type: reflect.TypeOf((*GroupsSectionsList)(nil)),
Struct: "GroupsSectionsList",
Field: "Name",
}
}
g.ID = int(id)
g.Name = name
return nil
}
// GroupsActionType for action_button in groups.
type GroupsActionType string
@ -685,7 +867,10 @@ type GroupsLongPollServer struct {
Ts string `json:"ts"` // Number of the last event
}
// TODO: func (g GroupsLongPollServer) GetURL() string {
// GetURL return link.
func (lp GroupsLongPollServer) GetURL(wait int) string {
return fmt.Sprintf("%s?act=a_check&key=%s&ts=%s&wait=%d", lp.Server, lp.Key, lp.Ts, wait)
}
// GroupsLongPollSettings struct.
type GroupsLongPollSettings struct {
@ -714,12 +899,14 @@ type GroupsMarketInfo struct {
Enabled BaseBoolInt `json:"enabled"` // Information whether the market is enabled
CommentsEnabled BaseBoolInt `json:"comments_enabled,omitempty"`
CanMessage BaseBoolInt `json:"can_message,omitempty"`
IsHsEnabled BaseBoolInt `json:"is_hs_enabled,omitempty"`
MainAlbumID int `json:"main_album_id,omitempty"` // Main market album ID
PriceMax string `json:"price_max,omitempty"` // Maximum price
PriceMin string `json:"price_min,omitempty"` // Minimum price
Wiki PagesWikipageFull `json:"wiki,omitempty"`
CityIDs []int `json:"city_ids"`
CountryIDs []int `json:"country_ids,omitempty"`
MinOrderPrice MarketPrice `json:"min_order_price,omitempty"`
}
// GroupsGroupRole Role type.

View File

@ -4,6 +4,9 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/vmihailenco/msgpack/v5"
"github.com/vmihailenco/msgpack/v5/msgpcode"
)
// Information whether the MarketMarketItem is available.
@ -100,6 +103,36 @@ func (market *MarketMarketItem) UnmarshalJSON(data []byte) error {
return nil
}
// DecodeMsgpack MarketMarketItem.
//
// BUG(VK): https://github.com/SevereCloud/vksdk/issues/147
func (market *MarketMarketItem) DecodeMsgpack(dec *msgpack.Decoder) error {
data, err := dec.DecodeRaw()
if err != nil {
return err
}
if bytes.Equal(data, []byte{msgpcode.False}) {
return nil
}
type renamedMarketMarketItem MarketMarketItem
var r renamedMarketMarketItem
d := msgpack.NewDecoder(bytes.NewReader(data))
d.SetCustomStructTag("json")
err = d.Decode(&r)
if err != nil {
return err
}
*market = MarketMarketItem(r)
return nil
}
// MarketMarketItemProperty struct.
type MarketMarketItemProperty struct {
VariantID int `json:"variant_id"`
@ -151,6 +184,36 @@ func (m *MarketPrice) UnmarshalJSON(data []byte) error {
return nil
}
// DecodeMsgpack MarketPrice.
//
// BUG(VK): unavailable product, in fave.get return [].
func (m *MarketPrice) DecodeMsgpack(dec *msgpack.Decoder) error {
data, err := dec.DecodeRaw()
if err != nil {
return err
}
if bytes.Equal(data, []byte{msgpcode.FixedArrayLow}) {
return nil
}
type renamedMarketPrice MarketPrice
var r renamedMarketPrice
d := msgpack.NewDecoder(bytes.NewReader(data))
d.SetCustomStructTag("json")
err = d.Decode(&r)
if err != nil {
return err
}
*m = MarketPrice(r)
return nil
}
// MarketSection struct.
type MarketSection struct {
ID int `json:"id"` // Section ID

View File

@ -79,6 +79,7 @@ type MessagesMessage struct {
UpdateTime int `json:"update_time"` // Date when the message has been updated in Unixtime
MembersCount int `json:"members_count"` // Members number
ExpireTTL int `json:"expire_ttl"`
MessageTag string `json:"message_tag"` // for https://notify.mail.ru/
}
// MessagesBasePayload struct.
@ -378,7 +379,8 @@ type MessagesTemplateElementCarousel struct {
Title string `json:"title,omitempty"`
Action MessagesTemplateElementCarouselAction `json:"action,omitempty"`
Description string `json:"description,omitempty"`
Photo *PhotosPhoto `json:"photo,omitempty"`
Photo *PhotosPhoto `json:"photo,omitempty"` // Only read
PhotoID string `json:"photo_id,omitempty"` // Only for send
Buttons []MessagesKeyboardButton `json:"buttons,omitempty"`
}
@ -474,20 +476,24 @@ type MessagesChatPushSettings struct {
// MessagesChatSettingsPhoto struct.
type MessagesChatSettingsPhoto struct {
Photo100 string `json:"photo_100"`
Photo200 string `json:"photo_200"`
Photo50 string `json:"photo_50"`
IsDefaultPhoto BaseBoolInt `json:"is_default_photo"`
Photo100 string `json:"photo_100"`
Photo200 string `json:"photo_200"`
Photo50 string `json:"photo_50"`
IsDefaultPhoto BaseBoolInt `json:"is_default_photo"`
IsDefaultCallPhoto bool `json:"is_default_call_photo"`
}
// MessagesConversation struct.
type MessagesConversation struct {
CanWrite MessagesConversationCanWrite `json:"can_write"`
ChatSettings MessagesConversationChatSettings `json:"chat_settings"`
InRead int `json:"in_read"` // Last message user have read
LastMessageID int `json:"last_message_id"` // ID of the last message in conversation
Mentions []int `json:"mentions"` // IDs of messages with mentions
MessageRequest string `json:"message_request"`
CanWrite MessagesConversationCanWrite `json:"can_write"`
ChatSettings MessagesConversationChatSettings `json:"chat_settings"`
InRead int `json:"in_read"` // Last message user have read
LastMessageID int `json:"last_message_id"` // ID of the last message in conversation
Mentions []int `json:"mentions"` // IDs of messages with mentions
MessageRequest string `json:"message_request"`
LastConversationMessageID int `json:"last_conversation_message_id"`
InReadCMID int `json:"in_read_cmid"`
OutReadCMID int `json:"out_read_cmid"`
// Last outcoming message have been read by the opponent.
OutRead int `json:"out_read"`
@ -496,6 +502,10 @@ type MessagesConversation struct {
Important BaseBoolInt `json:"important"`
Unanswered BaseBoolInt `json:"unanswered"`
IsMarkedUnread BaseBoolInt `json:"is_marked_unread"`
CanSendMoney BaseBoolInt `json:"can_send_money"`
CanReceiveMoney BaseBoolInt `json:"can_receive_money"`
IsNew BaseBoolInt `json:"is_new"`
IsArchived BaseBoolInt `json:"is_archived"`
UnreadCount int `json:"unread_count"` // Unread messages number
CurrentKeyboard MessagesKeyboard `json:"current_keyboard"`
SortID struct {
@ -531,6 +541,7 @@ type MessagesConversationChatSettings struct {
CanCall BaseBoolInt `json:"can_call"`
CanUseMassMentions BaseBoolInt `json:"can_use_mass_mentions"`
CanChangeServiceType BaseBoolInt `json:"can_change_service_type"`
CanChangeStyle BaseBoolInt `json:"can_change_style"`
} `json:"acl"`
IsGroupChannel BaseBoolInt `json:"is_group_channel"`
IsDisappearing BaseBoolInt `json:"is_disappearing"`
@ -560,6 +571,7 @@ type MessagesChatPermissions struct {
SeeInviteLink MessagesChatPermission `json:"see_invite_link"`
Call MessagesChatPermission `json:"call"`
ChangeAdmins MessagesChatPermission `json:"change_admins"`
ChangeStyle MessagesChatPermission `json:"change_style"`
}
// MessagesConversationPeer struct.
@ -571,9 +583,11 @@ type MessagesConversationPeer struct {
// MessagesConversationPushSettings struct.
type MessagesConversationPushSettings struct {
DisabledUntil int `json:"disabled_until"`
DisabledForever BaseBoolInt `json:"disabled_forever"`
NoSound BaseBoolInt `json:"no_sound"`
DisabledUntil int `json:"disabled_until"`
DisabledForever BaseBoolInt `json:"disabled_forever"`
NoSound BaseBoolInt `json:"no_sound"`
DisabledMentions BaseBoolInt `json:"disabled_mentions"`
DisabledMassMentions BaseBoolInt `json:"disabled_mass_mentions"`
}
// MessagesConversationWithMessage struct.

View File

@ -1,7 +1,5 @@
package object // import "github.com/SevereCloud/vksdk/v2/object"
import "encoding/json"
// NotificationsFeedback struct.
type NotificationsFeedback struct {
Attachments []WallWallpostAttachment `json:"attachments"`
@ -16,8 +14,8 @@ type NotificationsFeedback struct {
// NotificationsNotification struct.
type NotificationsNotification struct {
Date int `json:"date"` // Date when the event has been occurred
Feedback json.RawMessage `json:"feedback"`
Parent json.RawMessage `json:"parent"`
Feedback RawMessage `json:"feedback"`
Parent RawMessage `json:"parent"`
Reply NotificationsReply `json:"reply"`
Type string `json:"type"` // Notification type
}

View File

@ -9,6 +9,8 @@ import (
"bytes"
"encoding/json"
"reflect"
"github.com/vmihailenco/msgpack/v5"
)
// Attachment interface.
@ -42,6 +44,44 @@ func (b *BaseBoolInt) UnmarshalJSON(data []byte) (err error) {
return
}
// DecodeMsgpack func.
func (b *BaseBoolInt) DecodeMsgpack(dec *msgpack.Decoder) (err error) {
data, err := dec.DecodeRaw()
if err != nil {
return err
}
var (
valueInt int
valueBool bool
)
switch {
case msgpack.Unmarshal(data, &valueBool) == nil:
*b = BaseBoolInt(valueBool)
case msgpack.Unmarshal(data, &valueInt) == nil:
if valueInt == 1 {
*b = true
break
}
if valueInt == 0 {
*b = false
break
}
fallthrough
default:
// return msgpack error
err = &json.UnmarshalTypeError{
Value: string(data),
Type: reflect.TypeOf((*BaseBoolInt)(nil)),
}
}
return err
}
// BaseCountry struct.
type BaseCountry struct {
ID int `json:"id"`
@ -151,6 +191,33 @@ func (obj *BaseImage) UnmarshalJSON(data []byte) (err error) {
return err
}
// DecodeMsgpack is required to support images with `src` field.
func (obj *BaseImage) DecodeMsgpack(dec *msgpack.Decoder) (err error) {
type renamedBaseImage struct {
Height float64 `msgpack:"height"`
URL string `msgpack:"url"`
Src string `msgpack:"src"`
Width float64 `msgpack:"width"`
Type string `msgpack:"type"`
}
var renamedObj renamedBaseImage
err = dec.Decode(&renamedObj)
obj.Height = renamedObj.Height
obj.Width = renamedObj.Width
obj.Type = renamedObj.Type
if renamedObj.Src == "" {
obj.URL = renamedObj.URL
} else {
obj.URL = renamedObj.Src
}
return err
}
// BaseLikes struct.
type BaseLikes struct {
UserLikes BaseBoolInt `json:"user_likes"` // Information whether current user likes
@ -346,9 +413,11 @@ const (
type Privacy struct {
Category PrivacyCategory `json:"category,omitempty"`
Lists struct {
Allowed []int `json:"allowed"`
Allowed []int `json:"allowed"`
Excluded []int `json:"excluded"`
} `json:"lists,omitempty"`
Owners struct {
Allowed []int `json:"allowed"`
Excluded []int `json:"excluded"`
} `json:"owners,omitempty"`
}

View File

@ -239,6 +239,7 @@ type PhotosPhotoFull struct {
Photo1280 string `json:"photo_1280"` // URL of image with 1280 px width
Photo2560 string `json:"photo_2560"` // URL of image with 2560 px width
Sizes []PhotosPhotoSizes `json:"sizes"`
OrigPhoto PhotosPhotoSizes `json:"orig_photo"`
}
// ToAttachment return attachment format.

39
vendor/github.com/SevereCloud/vksdk/v2/object/raw.go generated vendored Normal file
View File

@ -0,0 +1,39 @@
package object // import "github.com/SevereCloud/vksdk/v2/object"
import "github.com/vmihailenco/msgpack/v5"
// RawMessage is a raw encoded JSON or MessagePack value.
type RawMessage []byte
// MarshalJSON returns m as the JSON encoding of m.
func (m RawMessage) MarshalJSON() ([]byte, error) {
if m == nil {
return []byte("null"), nil
}
return m, nil
}
// UnmarshalJSON sets *m to a copy of data.
func (m *RawMessage) UnmarshalJSON(data []byte) error {
*m = append((*m)[0:0], data...)
return nil
}
// EncodeMsgpack write m as the MessagePack encoding of m.
func (m RawMessage) EncodeMsgpack(enc *msgpack.Encoder) error {
_, err := enc.Writer().Write(m)
return err
}
// DecodeMsgpack sets *m to a copy of data.
func (m *RawMessage) DecodeMsgpack(dec *msgpack.Decoder) error {
msg, err := dec.DecodeRaw()
if err != nil {
return err
}
*m = RawMessage(msg)
return nil
}

View File

@ -127,6 +127,7 @@ type StoriesStory struct {
Seen BaseBoolInt `json:"seen"`
IsOwnerPinned BaseBoolInt `json:"is_owner_pinned"`
IsOneTime BaseBoolInt `json:"is_one_time"`
IsAdvice BaseBoolInt `json:"is_advice,omitempty"`
NeedMute BaseBoolInt `json:"need_mute"`
MuteReply BaseBoolInt `json:"mute_reply"`
CanLike BaseBoolInt `json:"can_like"`
@ -152,6 +153,7 @@ type StoriesStory struct {
NarrativesCount int `json:"narratives_count"`
FirstNarrativeTitle string `json:"first_narrative_title"`
Questions StoriesQuestions `json:"questions"`
ReactionSetID string `json:"reaction_set_id"`
}
// StoriesFeedItemType type.

View File

@ -4,6 +4,9 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/vmihailenco/msgpack/v5"
"github.com/vmihailenco/msgpack/v5/msgpcode"
)
// User relationship status.
@ -258,6 +261,36 @@ func (personal *UsersPersonal) UnmarshalJSON(data []byte) error {
return nil
}
// DecodeMsgpack UsersPersonal.
//
// BUG(VK): UsersPersonal return [].
func (personal *UsersPersonal) DecodeMsgpack(dec *msgpack.Decoder) error {
data, err := dec.DecodeRaw()
if err != nil {
return err
}
if bytes.Equal(data, []byte{msgpcode.FixedArrayLow}) {
return nil
}
type renamedUsersPersonal UsersPersonal
var r renamedUsersPersonal
d := msgpack.NewDecoder(bytes.NewReader(data))
d.SetCustomStructTag("json")
err = d.Decode(&r)
if err != nil {
return err
}
*personal = UsersPersonal(r)
return nil
}
// UsersRelative struct.
type UsersRelative struct {
BirthDate string `json:"birth_date"` // Date of child birthday (format dd.mm.yyyy)

View File

@ -1,5 +1,13 @@
package object // import "github.com/SevereCloud/vksdk/v2/object"
import (
"bytes"
"encoding/json"
"github.com/vmihailenco/msgpack/v5"
"github.com/vmihailenco/msgpack/v5/msgpcode"
)
// UtilsDomainResolvedType object type.
const (
UtilsDomainResolvedTypeUser = "user"
@ -15,6 +23,58 @@ type UtilsDomainResolved struct {
Type string `json:"type"`
}
// UnmarshalJSON UtilsDomainResolved.
//
// BUG(VK): UtilsDomainResolved return [].
func (link *UtilsDomainResolved) UnmarshalJSON(data []byte) error {
if bytes.Equal(data, []byte("[]")) {
return nil
}
type renamedUtilsDomainResolved UtilsDomainResolved
var r renamedUtilsDomainResolved
err := json.Unmarshal(data, &r)
if err != nil {
return err
}
*link = UtilsDomainResolved(r)
return nil
}
// DecodeMsgpack UtilsDomainResolved.
//
// BUG(VK): UtilsDomainResolved return [].
func (link *UtilsDomainResolved) DecodeMsgpack(dec *msgpack.Decoder) error {
data, err := dec.DecodeRaw()
if err != nil {
return err
}
if bytes.Equal(data, []byte{msgpcode.FixedArrayLow}) {
return nil
}
type renamedUtilsDomainResolved UtilsDomainResolved
var r renamedUtilsDomainResolved
d := msgpack.NewDecoder(bytes.NewReader(data))
d.SetCustomStructTag("json")
err = d.Decode(&r)
if err != nil {
return err
}
*link = UtilsDomainResolved(r)
return nil
}
// UtilsLastShortenedLink struct.
type UtilsLastShortenedLink struct {
AccessKey string `json:"access_key"` // Access key for private stats

View File

@ -12,6 +12,9 @@ type VideoVideo struct {
// Date when the video has been added in Unixtime.
AddingDate int `json:"adding_date"`
// Date when the video has been released in Unixtime.
ReleaseDate int `json:"release_date"`
// Information whether current user can add the video.
CanAdd BaseBoolInt `json:"can_add"`
@ -27,12 +30,17 @@ type VideoVideo struct {
// Information whether current user can like the video.
CanLike BaseBoolInt `json:"can_like"`
// Information whether current user can download the video.
CanDownload BaseBoolInt `json:"can_download"`
// Information whether current user can repost this video.
CanRepost BaseBoolInt `json:"can_repost"`
CanSubscribe BaseBoolInt `json:"can_subscribe"`
CanAttachLink BaseBoolInt `json:"can_attach_link"`
IsFavorite BaseBoolInt `json:"is_favorite"`
IsPrivate BaseBoolInt `json:"is_private"`
IsExplicit BaseBoolInt `json:"is_explicit"`
IsSubscribed BaseBoolInt `json:"is_subscribed"`
Added BaseBoolInt `json:"added"`
Repeat BaseBoolInt `json:"repeat"` // Information whether the video is repeated
ContentRestricted int `json:"content_restricted"`
@ -43,6 +51,7 @@ type VideoVideo struct {
Description string `json:"description"` // Video description
Duration int `json:"duration"` // Video duration in seconds
Files VideoVideoFiles `json:"files"`
Trailer VideoVideoFiles `json:"trailer,omitempty"`
FirstFrame []VideoVideoImage `json:"first_frame"`
Image []VideoVideoImage `json:"image"`
Height int `json:"height"` // Video height
@ -56,22 +65,27 @@ type VideoVideo struct {
Photo1280 string `json:"photo_1280"` // URL of the preview image with 1280 px in width
// URL of the page with a player that can be used to play the video in the browser.
Player string `json:"player"`
Processing int `json:"processing"` // Returns if the video is processing
Title string `json:"title"` // Video title
Type string `json:"type"`
Views int `json:"views"` // Number of views
Width int `json:"width"` // Video width
Platform string `json:"platform"`
LocalViews int `json:"local_views"`
Likes BaseLikesInfo `json:"likes"` // Count of likes
Reposts BaseRepostsInfo `json:"reposts"` // Count of views
TrackCode string `json:"track_code"`
PrivacyView Privacy `json:"privacy_view"`
PrivacyComment Privacy `json:"privacy_comment"`
ActionButton VideoActionButton `json:"action_button"`
Restriction VideoRestriction `json:"restriction"`
ContentRestrictedMessage string `json:"content_restricted_message"`
Player string `json:"player"`
Processing int `json:"processing"` // Returns if the video is processing
Title string `json:"title"` // Video title
Subtitle string `json:"subtitle"` // Video subtitle
Type string `json:"type"`
Views int `json:"views"` // Number of views
Width int `json:"width"` // Video width
Platform string `json:"platform"`
LocalViews int `json:"local_views"`
Likes BaseLikesInfo `json:"likes"` // Count of likes
Reposts BaseRepostsInfo `json:"reposts"` // Count of views
TrackCode string `json:"track_code"`
PrivacyView Privacy `json:"privacy_view"`
PrivacyComment Privacy `json:"privacy_comment"`
ActionButton VideoActionButton `json:"action_button"`
Restriction VideoRestriction `json:"restriction"`
ContentRestrictedMessage string `json:"content_restricted_message"`
MainArtists []AudioAudioArtist `json:"main_artists"`
FeaturedArtists []AudioAudioArtist `json:"featured_artists"`
Genres []BaseObjectWithName `json:"genres"`
OvID string `json:"ov_id,omitempty"`
}
// ToAttachment return attachment format.
@ -112,16 +126,20 @@ type VideoSnippet struct {
// VideoVideoFiles struct.
type VideoVideoFiles struct {
External string `json:"external"` // URL of the external player
Mp4_1080 string `json:"mp4_1080"` // URL of the mpeg4 file with 1080p quality
Mp4_1440 string `json:"mp4_1440"` // URL of the mpeg4 file with 2k quality
Mp4_2160 string `json:"mp4_2160"` // URL of the mpeg4 file with 4k quality
Mp4_240 string `json:"mp4_240"` // URL of the mpeg4 file with 240p quality
Mp4_360 string `json:"mp4_360"` // URL of the mpeg4 file with 360p quality
Mp4_480 string `json:"mp4_480"` // URL of the mpeg4 file with 480p quality
Mp4_720 string `json:"mp4_720"` // URL of the mpeg4 file with 720p quality
Live string `json:"live"`
HLS string `json:"hls"`
External string `json:"external,omitempty"` // URL of the external player
Mp4_1080 string `json:"mp4_1080,omitempty"` // URL of the mpeg4 file with 1080p quality
Mp4_1440 string `json:"mp4_1440,omitempty"` // URL of the mpeg4 file with 2k quality
Mp4_2160 string `json:"mp4_2160,omitempty"` // URL of the mpeg4 file with 4k quality
Mp4_240 string `json:"mp4_240,omitempty"` // URL of the mpeg4 file with 240p quality
Mp4_360 string `json:"mp4_360,omitempty"` // URL of the mpeg4 file with 360p quality
Mp4_480 string `json:"mp4_480,omitempty"` // URL of the mpeg4 file with 480p quality
Mp4_720 string `json:"mp4_720,omitempty"` // URL of the mpeg4 file with 720p quality
Live string `json:"live,omitempty"`
HLS string `json:"hls,omitempty"`
DashUni string `json:"dash_uni,omitempty"`
DashSep string `json:"dash_sep,omitempty"`
DashWebm string `json:"dash_webm,omitempty"`
FailoverHost string `json:"failover_host,omitempty"`
}
// VideoCatBlock struct.

View File

@ -128,7 +128,7 @@ const (
WallPostTypeSuggest = "suggest"
)
// WallWallpost struct.
// WallWallpost struct.
type WallWallpost struct {
AccessKey string `json:"access_key"` // Access key to private object
ID int `json:"id"` // Post ID
@ -156,14 +156,17 @@ type WallWallpost struct {
IsPinned BaseBoolInt `json:"is_pinned"`
IsFavorite BaseBoolInt `json:"is_favorite"` // Information whether the post in favorites list
IsArchived BaseBoolInt `json:"is_archived"` // Is post archived, only for post owners
IsDeleted BaseBoolInt `json:"is_deleted"`
MarkedAsAds BaseBoolInt `json:"marked_as_ads"`
Edited int `json:"edited"` // Date of editing in Unixtime
Copyright WallPostCopyright `json:"copyright"`
PostID int `json:"post_id"`
ParentsStack []int `json:"parents_stack"`
Donut WallWallpostDonut `json:"donut"` // need api v5.125
Donut WallWallpostDonut `json:"donut"`
ShortTextRate float64 `json:"short_text_rate"`
CarouselOffset int `json:"carousel_offset"`
Header WallWallpostHeader `json:"header"`
Hash string `json:"hash"`
}
// Attachment type.
@ -235,8 +238,10 @@ type WallWallpostToID struct {
IsFavorite BaseBoolInt `json:"is_favorite"` // Information whether the post in favorites list
MarkedAsAds BaseBoolInt `json:"marked_as_ads"`
ParentsStack []int `json:"parents_stack"`
Donut WallWallpostDonut `json:"donut"` // need api v5.125
Donut WallWallpostDonut `json:"donut"`
ShortTextRate float64 `json:"short_text_rate"`
Views WallViews `json:"views"` // Count of views
Header WallWallpostHeader `json:"header"`
}
// WallWallpostDonut info about VK Donut.
@ -255,3 +260,15 @@ type WallPostCopyright struct {
Type string `json:"type"`
Name string `json:"name"`
}
// WallWallpostHeader struct.
type WallWallpostHeader struct {
Type string `json:"type"`
CustomDescription WallWallpostHeaderCustomDescription `json:"custom_description"`
}
// WallWallpostHeaderCustomDescription struct.
type WallWallpostHeaderCustomDescription struct {
SourceID int `json:"source_id"`
Date int `json:"date"`
}

View File

@ -45,6 +45,9 @@ type WidgetsWidgetComment struct {
Views struct {
Count int `json:"count"`
} `json:"views"`
Donut WallWallpostDonut `json:"donut"`
ShortTextRate float64 `json:"short_text_rate"`
Header WallWallpostHeader `json:"header"`
}
// WidgetsWidgetLikes struct.