github.com/Files-com/files-sdk-go/v3@v3.1.81/inboxrecipient.go (about) 1 package files_sdk 2 3 import ( 4 "encoding/json" 5 "time" 6 7 lib "github.com/Files-com/files-sdk-go/v3/lib" 8 ) 9 10 type InboxRecipient struct { 11 Company string `json:"company,omitempty" path:"company,omitempty" url:"company,omitempty"` 12 Name string `json:"name,omitempty" path:"name,omitempty" url:"name,omitempty"` 13 Note string `json:"note,omitempty" path:"note,omitempty" url:"note,omitempty"` 14 Recipient string `json:"recipient,omitempty" path:"recipient,omitempty" url:"recipient,omitempty"` 15 SentAt *time.Time `json:"sent_at,omitempty" path:"sent_at,omitempty" url:"sent_at,omitempty"` 16 InboxId int64 `json:"inbox_id,omitempty" path:"inbox_id,omitempty" url:"inbox_id,omitempty"` 17 ShareAfterCreate *bool `json:"share_after_create,omitempty" path:"share_after_create,omitempty" url:"share_after_create,omitempty"` 18 } 19 20 // Identifier no path or id 21 22 type InboxRecipientCollection []InboxRecipient 23 24 type InboxRecipientListParams struct { 25 SortBy map[string]interface{} `url:"sort_by,omitempty" required:"false" json:"sort_by,omitempty" path:"sort_by"` 26 Filter InboxRecipient `url:"filter,omitempty" required:"false" json:"filter,omitempty" path:"filter"` 27 InboxId int64 `url:"inbox_id,omitempty" required:"true" json:"inbox_id,omitempty" path:"inbox_id"` 28 ListParams 29 } 30 31 type InboxRecipientCreateParams struct { 32 InboxId int64 `url:"inbox_id,omitempty" required:"true" json:"inbox_id,omitempty" path:"inbox_id"` 33 Recipient string `url:"recipient,omitempty" required:"true" json:"recipient,omitempty" path:"recipient"` 34 Name string `url:"name,omitempty" required:"false" json:"name,omitempty" path:"name"` 35 Company string `url:"company,omitempty" required:"false" json:"company,omitempty" path:"company"` 36 Note string `url:"note,omitempty" required:"false" json:"note,omitempty" path:"note"` 37 ShareAfterCreate *bool `url:"share_after_create,omitempty" required:"false" json:"share_after_create,omitempty" path:"share_after_create"` 38 } 39 40 func (i *InboxRecipient) UnmarshalJSON(data []byte) error { 41 type inboxRecipient InboxRecipient 42 var v inboxRecipient 43 if err := json.Unmarshal(data, &v); err != nil { 44 return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{}) 45 } 46 47 *i = InboxRecipient(v) 48 return nil 49 } 50 51 func (i *InboxRecipientCollection) UnmarshalJSON(data []byte) error { 52 type inboxRecipients InboxRecipientCollection 53 var v inboxRecipients 54 if err := json.Unmarshal(data, &v); err != nil { 55 return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{}) 56 } 57 58 *i = InboxRecipientCollection(v) 59 return nil 60 } 61 62 func (i *InboxRecipientCollection) ToSlice() *[]interface{} { 63 ret := make([]interface{}, len(*i)) 64 for i, v := range *i { 65 ret[i] = v 66 } 67 68 return &ret 69 }