summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/SevereCloud/vksdk/v2/object/users.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/SevereCloud/vksdk/v2/object/users.go')
-rw-r--r--vendor/github.com/SevereCloud/vksdk/v2/object/users.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/github.com/SevereCloud/vksdk/v2/object/users.go b/vendor/github.com/SevereCloud/vksdk/v2/object/users.go
index 24a08d63..7bf93b40 100644
--- a/vendor/github.com/SevereCloud/vksdk/v2/object/users.go
+++ b/vendor/github.com/SevereCloud/vksdk/v2/object/users.go
@@ -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)