github.com/Files-com/files-sdk-go/v3@v3.1.81/historyexportresult.go (about)

     1  package files_sdk
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	lib "github.com/Files-com/files-sdk-go/v3/lib"
     7  )
     8  
     9  type HistoryExportResult struct {
    10  	Id                     int64  `json:"id,omitempty" path:"id,omitempty" url:"id,omitempty"`
    11  	CreatedAt              int64  `json:"created_at,omitempty" path:"created_at,omitempty" url:"created_at,omitempty"`
    12  	CreatedAtIso8601       string `json:"created_at_iso8601,omitempty" path:"created_at_iso8601,omitempty" url:"created_at_iso8601,omitempty"`
    13  	UserId                 int64  `json:"user_id,omitempty" path:"user_id,omitempty" url:"user_id,omitempty"`
    14  	FileId                 int64  `json:"file_id,omitempty" path:"file_id,omitempty" url:"file_id,omitempty"`
    15  	ParentId               int64  `json:"parent_id,omitempty" path:"parent_id,omitempty" url:"parent_id,omitempty"`
    16  	Path                   string `json:"path,omitempty" path:"path,omitempty" url:"path,omitempty"`
    17  	Folder                 string `json:"folder,omitempty" path:"folder,omitempty" url:"folder,omitempty"`
    18  	Src                    string `json:"src,omitempty" path:"src,omitempty" url:"src,omitempty"`
    19  	Destination            string `json:"destination,omitempty" path:"destination,omitempty" url:"destination,omitempty"`
    20  	Ip                     string `json:"ip,omitempty" path:"ip,omitempty" url:"ip,omitempty"`
    21  	Username               string `json:"username,omitempty" path:"username,omitempty" url:"username,omitempty"`
    22  	Action                 string `json:"action,omitempty" path:"action,omitempty" url:"action,omitempty"`
    23  	FailureType            string `json:"failure_type,omitempty" path:"failure_type,omitempty" url:"failure_type,omitempty"`
    24  	Interface              string `json:"interface,omitempty" path:"interface,omitempty" url:"interface,omitempty"`
    25  	TargetId               int64  `json:"target_id,omitempty" path:"target_id,omitempty" url:"target_id,omitempty"`
    26  	TargetName             string `json:"target_name,omitempty" path:"target_name,omitempty" url:"target_name,omitempty"`
    27  	TargetPermission       string `json:"target_permission,omitempty" path:"target_permission,omitempty" url:"target_permission,omitempty"`
    28  	TargetRecursive        *bool  `json:"target_recursive,omitempty" path:"target_recursive,omitempty" url:"target_recursive,omitempty"`
    29  	TargetExpiresAt        int64  `json:"target_expires_at,omitempty" path:"target_expires_at,omitempty" url:"target_expires_at,omitempty"`
    30  	TargetExpiresAtIso8601 string `json:"target_expires_at_iso8601,omitempty" path:"target_expires_at_iso8601,omitempty" url:"target_expires_at_iso8601,omitempty"`
    31  	TargetPermissionSet    string `json:"target_permission_set,omitempty" path:"target_permission_set,omitempty" url:"target_permission_set,omitempty"`
    32  	TargetPlatform         string `json:"target_platform,omitempty" path:"target_platform,omitempty" url:"target_platform,omitempty"`
    33  	TargetUsername         string `json:"target_username,omitempty" path:"target_username,omitempty" url:"target_username,omitempty"`
    34  	TargetUserId           int64  `json:"target_user_id,omitempty" path:"target_user_id,omitempty" url:"target_user_id,omitempty"`
    35  }
    36  
    37  func (h HistoryExportResult) Identifier() interface{} {
    38  	return h.Id
    39  }
    40  
    41  type HistoryExportResultCollection []HistoryExportResult
    42  
    43  type HistoryExportResultListParams struct {
    44  	UserId          int64 `url:"user_id,omitempty" required:"false" json:"user_id,omitempty" path:"user_id"`
    45  	HistoryExportId int64 `url:"history_export_id,omitempty" required:"true" json:"history_export_id,omitempty" path:"history_export_id"`
    46  	ListParams
    47  }
    48  
    49  func (h *HistoryExportResult) UnmarshalJSON(data []byte) error {
    50  	type historyExportResult HistoryExportResult
    51  	var v historyExportResult
    52  	if err := json.Unmarshal(data, &v); err != nil {
    53  		return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
    54  	}
    55  
    56  	*h = HistoryExportResult(v)
    57  	return nil
    58  }
    59  
    60  func (h *HistoryExportResultCollection) UnmarshalJSON(data []byte) error {
    61  	type historyExportResults HistoryExportResultCollection
    62  	var v historyExportResults
    63  	if err := json.Unmarshal(data, &v); err != nil {
    64  		return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
    65  	}
    66  
    67  	*h = HistoryExportResultCollection(v)
    68  	return nil
    69  }
    70  
    71  func (h *HistoryExportResultCollection) ToSlice() *[]interface{} {
    72  	ret := make([]interface{}, len(*h))
    73  	for i, v := range *h {
    74  		ret[i] = v
    75  	}
    76  
    77  	return &ret
    78  }