-
Notifications
You must be signed in to change notification settings - Fork 2
/
pairedapikey.go
50 lines (39 loc) · 1.45 KB
/
pairedapikey.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type PairedApiKey struct {
Server string `json:"server,omitempty" path:"server,omitempty" url:"server,omitempty"`
Username string `json:"username,omitempty" path:"username,omitempty" url:"username,omitempty"`
Password string `json:"password,omitempty" path:"password,omitempty" url:"password,omitempty"`
UserUsername string `json:"user_username,omitempty" path:"user_username,omitempty" url:"user_username,omitempty"`
Nickname string `json:"nickname,omitempty" path:"nickname,omitempty" url:"nickname,omitempty"`
}
// Identifier no path or id
type PairedApiKeyCollection []PairedApiKey
func (p *PairedApiKey) UnmarshalJSON(data []byte) error {
type pairedApiKey PairedApiKey
var v pairedApiKey
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*p = PairedApiKey(v)
return nil
}
func (p *PairedApiKeyCollection) UnmarshalJSON(data []byte) error {
type pairedApiKeys PairedApiKeyCollection
var v pairedApiKeys
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*p = PairedApiKeyCollection(v)
return nil
}
func (p *PairedApiKeyCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*p))
for i, v := range *p {
ret[i] = v
}
return &ret
}