-
Notifications
You must be signed in to change notification settings - Fork 2
/
inboxrecipient.go
69 lines (56 loc) · 2.81 KB
/
inboxrecipient.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package files_sdk
import (
"encoding/json"
"time"
lib "github.com/Files-com/files-sdk-go/v3/lib"
)
type InboxRecipient struct {
Company string `json:"company,omitempty" path:"company,omitempty" url:"company,omitempty"`
Name string `json:"name,omitempty" path:"name,omitempty" url:"name,omitempty"`
Note string `json:"note,omitempty" path:"note,omitempty" url:"note,omitempty"`
Recipient string `json:"recipient,omitempty" path:"recipient,omitempty" url:"recipient,omitempty"`
SentAt *time.Time `json:"sent_at,omitempty" path:"sent_at,omitempty" url:"sent_at,omitempty"`
InboxId int64 `json:"inbox_id,omitempty" path:"inbox_id,omitempty" url:"inbox_id,omitempty"`
ShareAfterCreate *bool `json:"share_after_create,omitempty" path:"share_after_create,omitempty" url:"share_after_create,omitempty"`
}
// Identifier no path or id
type InboxRecipientCollection []InboxRecipient
type InboxRecipientListParams struct {
SortBy map[string]interface{} `url:"sort_by,omitempty" required:"false" json:"sort_by,omitempty" path:"sort_by"`
Filter InboxRecipient `url:"filter,omitempty" required:"false" json:"filter,omitempty" path:"filter"`
InboxId int64 `url:"inbox_id,omitempty" required:"true" json:"inbox_id,omitempty" path:"inbox_id"`
ListParams
}
type InboxRecipientCreateParams struct {
InboxId int64 `url:"inbox_id,omitempty" required:"true" json:"inbox_id,omitempty" path:"inbox_id"`
Recipient string `url:"recipient,omitempty" required:"true" json:"recipient,omitempty" path:"recipient"`
Name string `url:"name,omitempty" required:"false" json:"name,omitempty" path:"name"`
Company string `url:"company,omitempty" required:"false" json:"company,omitempty" path:"company"`
Note string `url:"note,omitempty" required:"false" json:"note,omitempty" path:"note"`
ShareAfterCreate *bool `url:"share_after_create,omitempty" required:"false" json:"share_after_create,omitempty" path:"share_after_create"`
}
func (i *InboxRecipient) UnmarshalJSON(data []byte) error {
type inboxRecipient InboxRecipient
var v inboxRecipient
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*i = InboxRecipient(v)
return nil
}
func (i *InboxRecipientCollection) UnmarshalJSON(data []byte) error {
type inboxRecipients InboxRecipientCollection
var v inboxRecipients
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*i = InboxRecipientCollection(v)
return nil
}
func (i *InboxRecipientCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*i))
for i, v := range *i {
ret[i] = v
}
return &ret
}