summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/SevereCloud/vksdk/v2/api
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/SevereCloud/vksdk/v2/api')
-rw-r--r--vendor/github.com/SevereCloud/vksdk/v2/api/errors.go48
-rw-r--r--vendor/github.com/SevereCloud/vksdk/v2/api/execute.go3
-rw-r--r--vendor/github.com/SevereCloud/vksdk/v2/api/market.go16
-rw-r--r--vendor/github.com/SevereCloud/vksdk/v2/api/marusia.go103
-rw-r--r--vendor/github.com/SevereCloud/vksdk/v2/api/upload.go54
5 files changed, 224 insertions, 0 deletions
diff --git a/vendor/github.com/SevereCloud/vksdk/v2/api/errors.go b/vendor/github.com/SevereCloud/vksdk/v2/api/errors.go
index e9ea1310..03032aa6 100644
--- a/vendor/github.com/SevereCloud/vksdk/v2/api/errors.go
+++ b/vendor/github.com/SevereCloud/vksdk/v2/api/errors.go
@@ -159,6 +159,9 @@ const (
ErrRateLimit ErrorType = 29
ErrPrivateProfile ErrorType = 30 // This profile is private
+ // Client version deprecated.
+ ErrClientVersionDeprecated ErrorType = 34
+
// Method execution was interrupted due to timeout.
ErrExecutionTimeout ErrorType = 36
@@ -177,6 +180,9 @@ const (
// Additional signup required.
ErrAdditionalSignupRequired ErrorType = 41
+ // IP is not allowed.
+ ErrIPNotAllowed ErrorType = 42
+
// One of the parameters specified was missing or invalid
//
// Check the required parameters list and their format on a method
@@ -586,6 +592,12 @@ const (
// Can't send message, reply timed out.
ErrMessagesReplyTimedOut ErrorType = 950
+ // You can't access donut chat without subscription.
+ ErrMessagesAccessDonutChat ErrorType = 962
+
+ // This user can't be added to the work chat, as they aren't an employe.
+ ErrMessagesAccessWorkChat ErrorType = 967
+
// Invalid phone number.
ErrParamPhone ErrorType = 1000
@@ -598,6 +610,12 @@ const (
// Processing.. Try later.
ErrAuthDelay ErrorType = 1112
+ // Anonymous token has expired.
+ ErrAnonymousTokenExpired ErrorType = 1114
+
+ // Anonymous token is invalid.
+ ErrAnonymousTokenInvalid ErrorType = 1116
+
// Invalid document id.
ErrParamDocID ErrorType = 1150
@@ -724,6 +742,9 @@ const (
// Market was already disabled in this group.
ErrMarketAlreadyDisabled ErrorType = 1432
+ // Main album can not be hidden.
+ ErrMainAlbumCantHidden ErrorType = 1446
+
// Story has already expired.
ErrStoryExpired ErrorType = 1600
@@ -783,6 +804,33 @@ const (
// Can't set AliExpress tag to this type of object.
ErrAliExpressTag ErrorType = 3800
+
+ // Invalid upload response.
+ ErrInvalidUploadResponse ErrorType = 5701
+
+ // Invalid upload hash.
+ ErrInvalidUploadHash ErrorType = 5702
+
+ // Invalid upload user.
+ ErrInvalidUploadUser ErrorType = 5703
+
+ // Invalid upload group.
+ ErrInvalidUploadGroup ErrorType = 5704
+
+ // Invalid crop data.
+ ErrInvalidCropData ErrorType = 5705
+
+ // To small avatar.
+ ErrToSmallAvatar ErrorType = 5706
+
+ // Photo not found.
+ ErrPhotoNotFound ErrorType = 5708
+
+ // Invalid Photo.
+ ErrInvalidPhoto ErrorType = 5709
+
+ // Invalid hash.
+ ErrInvalidHash ErrorType = 5710
)
// ErrorSubtype is the subtype of an error.
diff --git a/vendor/github.com/SevereCloud/vksdk/v2/api/execute.go b/vendor/github.com/SevereCloud/vksdk/v2/api/execute.go
index 5bee205a..cc52cd0d 100644
--- a/vendor/github.com/SevereCloud/vksdk/v2/api/execute.go
+++ b/vendor/github.com/SevereCloud/vksdk/v2/api/execute.go
@@ -22,6 +22,9 @@ func (vk *VK) ExecuteWithArgs(code string, params Params, obj interface{}) error
}
resp, err := vk.Handler("execute", params, reqParams)
+ if err != nil {
+ return err
+ }
jsonErr := json.Unmarshal(resp.Response, &obj)
if jsonErr != nil {
diff --git a/vendor/github.com/SevereCloud/vksdk/v2/api/market.go b/vendor/github.com/SevereCloud/vksdk/v2/api/market.go
index f78a068d..0bb35687 100644
--- a/vendor/github.com/SevereCloud/vksdk/v2/api/market.go
+++ b/vendor/github.com/SevereCloud/vksdk/v2/api/market.go
@@ -318,3 +318,19 @@ func (vk *VK) MarketSearch(params Params) (response MarketSearchResponse, err er
err = vk.RequestUnmarshal("market.search", &response, params)
return
}
+
+// MarketSearchItemsResponse struct.
+type MarketSearchItemsResponse struct {
+ Count int `json:"count"`
+ ViewType int `json:"view_type"`
+ Items []object.MarketMarketItem `json:"items"`
+ Groups []object.GroupsGroup `json:"groups,omitempty"`
+}
+
+// MarketSearchItems method.
+//
+// https://vk.com/dev/market.searchItems
+func (vk *VK) MarketSearchItems(params Params) (response MarketSearchItemsResponse, err error) {
+ err = vk.RequestUnmarshal("market.searchItems", &response, params)
+ return
+}
diff --git a/vendor/github.com/SevereCloud/vksdk/v2/api/marusia.go b/vendor/github.com/SevereCloud/vksdk/v2/api/marusia.go
new file mode 100644
index 00000000..729dbc80
--- /dev/null
+++ b/vendor/github.com/SevereCloud/vksdk/v2/api/marusia.go
@@ -0,0 +1,103 @@
+package api // import "github.com/SevereCloud/vksdk/v2/api"
+
+import (
+ "github.com/SevereCloud/vksdk/v2/object"
+)
+
+// MarusiaGetPictureUploadLinkResponse struct.
+type MarusiaGetPictureUploadLinkResponse struct {
+ PictureUploadLink string `json:"picture_upload_link"` // Link
+}
+
+// MarusiaGetPictureUploadLink method.
+//
+// https://vk.com/dev/marusia_skill_docs10
+func (vk *VK) MarusiaGetPictureUploadLink(params Params) (response MarusiaGetPictureUploadLinkResponse, err error) {
+ err = vk.RequestUnmarshal("marusia.getPictureUploadLink", &response, params)
+ return
+}
+
+// MarusiaSavePictureResponse struct.
+type MarusiaSavePictureResponse struct {
+ AppID int `json:"app_id"`
+ PhotoID int `json:"photo_id"`
+}
+
+// MarusiaSavePicture method.
+//
+// https://vk.com/dev/marusia_skill_docs10
+func (vk *VK) MarusiaSavePicture(params Params) (response MarusiaSavePictureResponse, err error) {
+ err = vk.RequestUnmarshal("marusia.savePicture", &response, params)
+ return
+}
+
+// MarusiaGetPicturesResponse struct.
+type MarusiaGetPicturesResponse struct {
+ Count int `json:"count"`
+ Items []object.MarusiaPicture `json:"items"`
+}
+
+// MarusiaGetPictures method.
+//
+// https://vk.com/dev/marusia_skill_docs10
+func (vk *VK) MarusiaGetPictures(params Params) (response MarusiaGetPicturesResponse, err error) {
+ err = vk.RequestUnmarshal("marusia.getPictures", &response, params)
+ return
+}
+
+// MarusiaDeletePicture delete picture.
+//
+// https://vk.com/dev/marusia_skill_docs10
+func (vk *VK) MarusiaDeletePicture(params Params) (response int, err error) {
+ err = vk.RequestUnmarshal("marusia.deletePicture", &response, params)
+ return
+}
+
+// MarusiaGetAudioUploadLinkResponse struct.
+type MarusiaGetAudioUploadLinkResponse struct {
+ AudioUploadLink string `json:"audio_upload_link"` // Link
+}
+
+// MarusiaGetAudioUploadLink method.
+//
+// https://vk.com/dev/marusia_skill_docs10
+func (vk *VK) MarusiaGetAudioUploadLink(params Params) (response MarusiaGetAudioUploadLinkResponse, err error) {
+ err = vk.RequestUnmarshal("marusia.getAudioUploadLink", &response, params)
+ return
+}
+
+// MarusiaCreateAudioResponse struct.
+type MarusiaCreateAudioResponse struct {
+ ID int `json:"id"`
+ Title string `json:"title"`
+}
+
+// MarusiaCreateAudio method.
+//
+// https://vk.com/dev/marusia_skill_docs10
+func (vk *VK) MarusiaCreateAudio(params Params) (response MarusiaCreateAudioResponse, err error) {
+ err = vk.RequestUnmarshal("marusia.createAudio", &response, params)
+ return
+}
+
+// MarusiaGetAudiosResponse struct.
+type MarusiaGetAudiosResponse struct {
+ Count int `json:"count"`
+ Audios []object.MarusiaAudio `json:"audios"`
+}
+
+// MarusiaGetAudios method.
+//
+// https://vk.com/dev/marusia_skill_docs10
+func (vk *VK) MarusiaGetAudios(params Params) (response MarusiaGetAudiosResponse, err error) {
+ err = vk.RequestUnmarshal("marusia.getAudios", &response, params)
+ return
+}
+
+// MarusiaDeleteAudio delete audio.
+//
+// https://vk.com/dev/marusia_skill_docs10
+func (vk *VK) MarusiaDeleteAudio(params Params) (response int, err error) {
+ err = vk.RequestUnmarshal("marusia.deleteAudio", &response, params)
+ return
+}
diff --git a/vendor/github.com/SevereCloud/vksdk/v2/api/upload.go b/vendor/github.com/SevereCloud/vksdk/v2/api/upload.go
index 2c947c5d..59f65460 100644
--- a/vendor/github.com/SevereCloud/vksdk/v2/api/upload.go
+++ b/vendor/github.com/SevereCloud/vksdk/v2/api/upload.go
@@ -959,3 +959,57 @@ func (vk *VK) UploadGroupImage(imageType string, file io.Reader) (response objec
return
}
+
+// UploadMarusiaPicture uploading picture.
+//
+// Limits: height not more than 600 px,
+// aspect ratio of at least 2:1.
+func (vk *VK) UploadMarusiaPicture(file io.Reader) (response MarusiaSavePictureResponse, err error) {
+ uploadServer, err := vk.MarusiaGetPictureUploadLink(nil)
+ if err != nil {
+ return
+ }
+
+ bodyContent, err := vk.UploadFile(uploadServer.PictureUploadLink, file, "photo", "photo.jpg")
+ if err != nil {
+ return
+ }
+
+ var handler object.MarusiaPictureUploadResponse
+
+ err = json.Unmarshal(bodyContent, &handler)
+ if err != nil {
+ return
+ }
+
+ photo, _ := json.Marshal(handler.Photo)
+
+ response, err = vk.MarusiaSavePicture(Params{
+ "server": handler.Server,
+ "photo": string(photo),
+ "hash": handler.Hash,
+ })
+
+ return
+}
+
+// UploadMarusiaAudio uploading audio.
+//
+// https://vk.com/dev/marusia_skill_docs10
+func (vk *VK) UploadMarusiaAudio(file io.Reader) (response MarusiaCreateAudioResponse, err error) {
+ uploadServer, err := vk.MarusiaGetAudioUploadLink(nil)
+ if err != nil {
+ return
+ }
+
+ bodyContent, err := vk.UploadFile(uploadServer.AudioUploadLink, file, "file", "audio.mp3")
+ if err != nil {
+ return
+ }
+
+ response, err = vk.MarusiaCreateAudio(Params{
+ "audio_meta": string(bodyContent),
+ })
+
+ return
+}