github.com/Files-com/files-sdk-go/v3@v3.1.81/emaillog.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 EmailLog struct { 11 Timestamp *time.Time `json:"timestamp,omitempty" path:"timestamp,omitempty" url:"timestamp,omitempty"` 12 Message string `json:"message,omitempty" path:"message,omitempty" url:"message,omitempty"` 13 Status string `json:"status,omitempty" path:"status,omitempty" url:"status,omitempty"` 14 Subject string `json:"subject,omitempty" path:"subject,omitempty" url:"subject,omitempty"` 15 To string `json:"to,omitempty" path:"to,omitempty" url:"to,omitempty"` 16 Cc string `json:"cc,omitempty" path:"cc,omitempty" url:"cc,omitempty"` 17 DeliveryMethod string `json:"delivery_method,omitempty" path:"delivery_method,omitempty" url:"delivery_method,omitempty"` 18 SmtpHostname string `json:"smtp_hostname,omitempty" path:"smtp_hostname,omitempty" url:"smtp_hostname,omitempty"` 19 SmtpIp string `json:"smtp_ip,omitempty" path:"smtp_ip,omitempty" url:"smtp_ip,omitempty"` 20 } 21 22 // Identifier no path or id 23 24 type EmailLogCollection []EmailLog 25 26 type EmailLogListParams struct { 27 Filter EmailLog `url:"filter,omitempty" required:"false" json:"filter,omitempty" path:"filter"` 28 FilterPrefix map[string]interface{} `url:"filter_prefix,omitempty" required:"false" json:"filter_prefix,omitempty" path:"filter_prefix"` 29 ListParams 30 } 31 32 func (e *EmailLog) UnmarshalJSON(data []byte) error { 33 type emailLog EmailLog 34 var v emailLog 35 if err := json.Unmarshal(data, &v); err != nil { 36 return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{}) 37 } 38 39 *e = EmailLog(v) 40 return nil 41 } 42 43 func (e *EmailLogCollection) UnmarshalJSON(data []byte) error { 44 type emailLogs EmailLogCollection 45 var v emailLogs 46 if err := json.Unmarshal(data, &v); err != nil { 47 return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{}) 48 } 49 50 *e = EmailLogCollection(v) 51 return nil 52 } 53 54 func (e *EmailLogCollection) ToSlice() *[]interface{} { 55 ret := make([]interface{}, len(*e)) 56 for i, v := range *e { 57 ret[i] = v 58 } 59 60 return &ret 61 }