github.com/Files-com/files-sdk-go/v3@v3.1.81/bundleregistration.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 BundleRegistration struct {
    11  	Code              string                 `json:"code,omitempty" path:"code,omitempty" url:"code,omitempty"`
    12  	Name              string                 `json:"name,omitempty" path:"name,omitempty" url:"name,omitempty"`
    13  	Company           string                 `json:"company,omitempty" path:"company,omitempty" url:"company,omitempty"`
    14  	Email             string                 `json:"email,omitempty" path:"email,omitempty" url:"email,omitempty"`
    15  	Ip                string                 `json:"ip,omitempty" path:"ip,omitempty" url:"ip,omitempty"`
    16  	InboxCode         string                 `json:"inbox_code,omitempty" path:"inbox_code,omitempty" url:"inbox_code,omitempty"`
    17  	ClickwrapBody     string                 `json:"clickwrap_body,omitempty" path:"clickwrap_body,omitempty" url:"clickwrap_body,omitempty"`
    18  	FormFieldSetId    int64                  `json:"form_field_set_id,omitempty" path:"form_field_set_id,omitempty" url:"form_field_set_id,omitempty"`
    19  	FormFieldData     map[string]interface{} `json:"form_field_data,omitempty" path:"form_field_data,omitempty" url:"form_field_data,omitempty"`
    20  	BundleCode        string                 `json:"bundle_code,omitempty" path:"bundle_code,omitempty" url:"bundle_code,omitempty"`
    21  	BundleId          int64                  `json:"bundle_id,omitempty" path:"bundle_id,omitempty" url:"bundle_id,omitempty"`
    22  	BundleRecipientId int64                  `json:"bundle_recipient_id,omitempty" path:"bundle_recipient_id,omitempty" url:"bundle_recipient_id,omitempty"`
    23  	CreatedAt         *time.Time             `json:"created_at,omitempty" path:"created_at,omitempty" url:"created_at,omitempty"`
    24  }
    25  
    26  // Identifier no path or id
    27  
    28  type BundleRegistrationCollection []BundleRegistration
    29  
    30  type BundleRegistrationListParams struct {
    31  	BundleId int64 `url:"bundle_id,omitempty" required:"false" json:"bundle_id,omitempty" path:"bundle_id"`
    32  	ListParams
    33  }
    34  
    35  func (b *BundleRegistration) UnmarshalJSON(data []byte) error {
    36  	type bundleRegistration BundleRegistration
    37  	var v bundleRegistration
    38  	if err := json.Unmarshal(data, &v); err != nil {
    39  		return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
    40  	}
    41  
    42  	*b = BundleRegistration(v)
    43  	return nil
    44  }
    45  
    46  func (b *BundleRegistrationCollection) UnmarshalJSON(data []byte) error {
    47  	type bundleRegistrations BundleRegistrationCollection
    48  	var v bundleRegistrations
    49  	if err := json.Unmarshal(data, &v); err != nil {
    50  		return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
    51  	}
    52  
    53  	*b = BundleRegistrationCollection(v)
    54  	return nil
    55  }
    56  
    57  func (b *BundleRegistrationCollection) ToSlice() *[]interface{} {
    58  	ret := make([]interface{}, len(*b))
    59  	for i, v := range *b {
    60  		ret[i] = v
    61  	}
    62  
    63  	return &ret
    64  }