summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/SevereCloud/vksdk/v2/api/execute.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/SevereCloud/vksdk/v2/api/execute.go')
-rw-r--r--vendor/github.com/SevereCloud/vksdk/v2/api/execute.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/vendor/github.com/SevereCloud/vksdk/v2/api/execute.go b/vendor/github.com/SevereCloud/vksdk/v2/api/execute.go
index cc52cd0d..1ee04cee 100644
--- a/vendor/github.com/SevereCloud/vksdk/v2/api/execute.go
+++ b/vendor/github.com/SevereCloud/vksdk/v2/api/execute.go
@@ -1,6 +1,11 @@
package api
-import "encoding/json"
+import (
+ "bytes"
+ "encoding/json"
+
+ "github.com/vmihailenco/msgpack/v5"
+)
// ExecuteWithArgs a universal method for calling a sequence of other methods
// while saving and filtering interim results.
@@ -26,9 +31,19 @@ func (vk *VK) ExecuteWithArgs(code string, params Params, obj interface{}) error
return err
}
- jsonErr := json.Unmarshal(resp.Response, &obj)
- if jsonErr != nil {
- return jsonErr
+ var decoderErr error
+
+ if vk.msgpack {
+ dec := msgpack.NewDecoder(bytes.NewReader(resp.Response))
+ dec.SetCustomStructTag("json")
+
+ decoderErr = dec.Decode(&obj)
+ } else {
+ decoderErr = json.Unmarshal(resp.Response, &obj)
+ }
+
+ if decoderErr != nil {
+ return decoderErr
}
if resp.ExecuteErrors != nil {