github.com/Files-com/files-sdk-go/v3@v3.1.81/bundledownload.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 BundleDownload struct { 11 BundleRegistration BundleRegistration `json:"bundle_registration,omitempty" path:"bundle_registration,omitempty" url:"bundle_registration,omitempty"` 12 DownloadMethod string `json:"download_method,omitempty" path:"download_method,omitempty" url:"download_method,omitempty"` 13 Path string `json:"path,omitempty" path:"path,omitempty" url:"path,omitempty"` 14 CreatedAt *time.Time `json:"created_at,omitempty" path:"created_at,omitempty" url:"created_at,omitempty"` 15 } 16 17 func (b BundleDownload) Identifier() interface{} { 18 return b.Path 19 } 20 21 type BundleDownloadCollection []BundleDownload 22 23 type BundleDownloadListParams struct { 24 SortBy map[string]interface{} `url:"sort_by,omitempty" required:"false" json:"sort_by,omitempty" path:"sort_by"` 25 Filter BundleDownload `url:"filter,omitempty" required:"false" json:"filter,omitempty" path:"filter"` 26 FilterGt map[string]interface{} `url:"filter_gt,omitempty" required:"false" json:"filter_gt,omitempty" path:"filter_gt"` 27 FilterGteq map[string]interface{} `url:"filter_gteq,omitempty" required:"false" json:"filter_gteq,omitempty" path:"filter_gteq"` 28 FilterLt map[string]interface{} `url:"filter_lt,omitempty" required:"false" json:"filter_lt,omitempty" path:"filter_lt"` 29 FilterLteq map[string]interface{} `url:"filter_lteq,omitempty" required:"false" json:"filter_lteq,omitempty" path:"filter_lteq"` 30 BundleId int64 `url:"bundle_id,omitempty" required:"false" json:"bundle_id,omitempty" path:"bundle_id"` 31 BundleRegistrationId int64 `url:"bundle_registration_id,omitempty" required:"false" json:"bundle_registration_id,omitempty" path:"bundle_registration_id"` 32 ListParams 33 } 34 35 func (b *BundleDownload) UnmarshalJSON(data []byte) error { 36 type bundleDownload BundleDownload 37 var v bundleDownload 38 if err := json.Unmarshal(data, &v); err != nil { 39 return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{}) 40 } 41 42 *b = BundleDownload(v) 43 return nil 44 } 45 46 func (b *BundleDownloadCollection) UnmarshalJSON(data []byte) error { 47 type bundleDownloads BundleDownloadCollection 48 var v bundleDownloads 49 if err := json.Unmarshal(data, &v); err != nil { 50 return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{}) 51 } 52 53 *b = BundleDownloadCollection(v) 54 return nil 55 } 56 57 func (b *BundleDownloadCollection) ToSlice() *[]interface{} { 58 ret := make([]interface{}, len(*b)) 59 for i, v := range *b { 60 ret[i] = v 61 } 62 63 return &ret 64 }