From 16813f13e8133296f101b50adf7951e6a4c91b23 Mon Sep 17 00:00:00 2001 From: Suvorov Daniil Date: Tue, 13 Oct 2020 17:10:46 +0300 Subject: [PATCH 1/5] docs: up version --- doc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc.go b/doc.go index fc7d9408..a6e446fa 100644 --- a/doc.go +++ b/doc.go @@ -7,6 +7,6 @@ package vksdk // Module constants. const ( - Version = "2.5.0" + Version = "2.6.0" API = "5.124" ) From d1c469ec6e3c64a1f4de2b4d5c61b42100fd54d8 Mon Sep 17 00:00:00 2001 From: Suvorov Daniil Date: Mon, 19 Oct 2020 18:01:46 +0300 Subject: [PATCH 2/5] feat: MessagesSendPeerIDs --- api/messages.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/messages.go b/api/messages.go index 6cdba86c..da22550f 100644 --- a/api/messages.go +++ b/api/messages.go @@ -522,6 +522,16 @@ type MessagesSendUserIDsResponse []struct { Error Error `json:"error"` } +// MessagesSendPeerIDs sends a message. +// +// need peer_ids; +// +// https://vk.com/dev/messages.send +func (vk *VK) MessagesSendPeerIDs(params Params) (response MessagesSendUserIDsResponse, err error) { + err = vk.RequestUnmarshal("messages.send", &response, params) + return +} + // MessagesSendUserIDs sends a message. // // need user_ids or peer_ids; From 85f5af5792def2027f738a57ce982ef7752e6682 Mon Sep 17 00:00:00 2001 From: Suvorov Daniil Date: Mon, 19 Oct 2020 18:02:33 +0300 Subject: [PATCH 3/5] docs: MessagesSendUserIDs deprecated --- api/messages.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/messages.go b/api/messages.go index da22550f..b8399a35 100644 --- a/api/messages.go +++ b/api/messages.go @@ -515,6 +515,8 @@ func (vk *VK) MessagesSend(params Params) (response int, err error) { } // MessagesSendUserIDsResponse struct. +// +// TODO: v3 rename MessagesSendPeerIDsResponse - user_ids outdated. type MessagesSendUserIDsResponse []struct { PeerID int `json:"peer_id"` MessageID int `json:"message_id"` @@ -537,9 +539,10 @@ func (vk *VK) MessagesSendPeerIDs(params Params) (response MessagesSendUserIDsRe // need user_ids or peer_ids; // // https://vk.com/dev/messages.send +// +// Deprecated: user_ids outdated, use MessagesSendPeerIDs. func (vk *VK) MessagesSendUserIDs(params Params) (response MessagesSendUserIDsResponse, err error) { - err = vk.RequestUnmarshal("messages.send", &response, params) - return + return vk.MessagesSendPeerIDs(params) } // MessagesSendMessageEventAnswer method. From 4ac24427a435e57712635d9969ee279e7a8a1b0f Mon Sep 17 00:00:00 2001 From: Suvorov Daniil Date: Tue, 20 Oct 2020 14:37:23 +0300 Subject: [PATCH 4/5] feat: add ErrReactionCantApplied --- api/errors.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/errors.go b/api/errors.go index 044b3556..b41ff59e 100644 --- a/api/errors.go +++ b/api/errors.go @@ -290,6 +290,9 @@ const ( // Donut is disabled. ErrDonutDisabled ErrorType = 225 + // Reaction can not be applied to the object. + ErrReactionCantApplied ErrorType = 232 + // Access to poll denied. ErrPollsAccess ErrorType = 250 From 706dfe612163a2a48e4fc457f023efdcf9384f1e Mon Sep 17 00:00:00 2001 From: Suvorov Daniil Date: Sat, 24 Oct 2020 20:28:37 +0300 Subject: [PATCH 5/5] feat: add podcast attachment --- object/messages.go | 1 + object/podcasts.go | 31 +++++++++++++++++-------------- object/wall.go | 2 ++ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/object/messages.go b/object/messages.go index 59dec72f..f36b2505 100644 --- a/object/messages.go +++ b/object/messages.go @@ -675,6 +675,7 @@ type MessagesMessageAttachment struct { Poll PollsPoll `json:"poll"` Call MessageCall `json:"call"` Story StoriesStory `json:"story"` + Podcast PodcastsEpisode `json:"podcast"` } // MessageCall struct. diff --git a/object/podcasts.go b/object/podcasts.go index 782b91c7..a332da43 100644 --- a/object/podcasts.go +++ b/object/podcasts.go @@ -14,20 +14,23 @@ type PodcastsCategory struct { // PodcastsEpisode struct. type PodcastsEpisode struct { - ID int `json:"id"` - OwnerID int `json:"owner_id"` - Artist string `json:"artist"` - Title string `json:"title"` - Duration int `json:"duration"` - Date int `json:"date"` - URL string `json:"url"` - LyricsID int `json:"lyrics_id"` - NoSearch int `json:"no_search"` - TrackCode string `json:"track_code"` - IsHq BaseBoolInt `json:"is_hq"` - IsFocusTrack BaseBoolInt `json:"is_focus_track"` - IsExplicit BaseBoolInt `json:"is_explicit"` - PodcastInfo PodcastsPodcastInfo `json:"podcast_info"` + ID int `json:"id"` + OwnerID int `json:"owner_id"` + Artist string `json:"artist"` + Title string `json:"title"` + Duration int `json:"duration"` + Date int `json:"date"` + URL string `json:"url"` + LyricsID int `json:"lyrics_id"` + NoSearch int `json:"no_search"` + TrackCode string `json:"track_code"` + IsHq BaseBoolInt `json:"is_hq"` + IsFocusTrack BaseBoolInt `json:"is_focus_track"` + IsExplicit BaseBoolInt `json:"is_explicit"` + ShortVideosAllowed BaseBoolInt `json:"short_videos_allowed"` + StoriesAllowed BaseBoolInt `json:"stories_allowed"` + StoriesCoverAllowed BaseBoolInt `json:"stories_cover_allowed"` + PodcastInfo PodcastsPodcastInfo `json:"podcast_info"` } // PodcastsPodcastInfo struct. diff --git a/object/wall.go b/object/wall.go index f34e6635..6a51d0f5 100644 --- a/object/wall.go +++ b/object/wall.go @@ -178,6 +178,7 @@ const ( AttachmentTypeEvent = "event" AttachmentTypeWall = "wall" AttachmentTypeStory = "story" + AttachmentTypePodcast = "podcast" ) // WallWallpostAttachment struct. @@ -200,6 +201,7 @@ type WallWallpostAttachment struct { PostedPhoto WallPostedPhoto `json:"posted_photo"` Type string `json:"type"` Video VideoVideo `json:"video"` + Podcast PodcastsEpisode `json:"podcast"` } // WallWallpostToID struct.