github.com/10XDev/rclone@v1.52.3-0.20200626220027-16af9ab76b2a/backend/opendrive/types.go (about)

     1  package opendrive
     2  
     3  import (
     4  	"encoding/json"
     5  	"fmt"
     6  )
     7  
     8  // Error describes an openDRIVE error response
     9  type Error struct {
    10  	Info struct {
    11  		Code    int    `json:"code"`
    12  		Message string `json:"message"`
    13  	} `json:"error"`
    14  }
    15  
    16  // Error satisfies the error interface
    17  func (e *Error) Error() string {
    18  	return fmt.Sprintf("%s (Error %d)", e.Info.Message, e.Info.Code)
    19  }
    20  
    21  // Account describes an OpenDRIVE account
    22  type Account struct {
    23  	Username string `json:"username"`
    24  	Password string `json:"passwd"`
    25  }
    26  
    27  // UserSessionInfo describes an OpenDRIVE session
    28  type UserSessionInfo struct {
    29  	Username string `json:"username"`
    30  	Password string `json:"passwd"`
    31  
    32  	SessionID          string          `json:"SessionID"`
    33  	UserName           string          `json:"UserName"`
    34  	UserFirstName      string          `json:"UserFirstName"`
    35  	UserLastName       string          `json:"UserLastName"`
    36  	AccType            string          `json:"AccType"`
    37  	UserLang           string          `json:"UserLang"`
    38  	UserID             string          `json:"UserID"`
    39  	IsAccountUser      json.RawMessage `json:"IsAccountUser"`
    40  	DriveName          string          `json:"DriveName"`
    41  	UserLevel          string          `json:"UserLevel"`
    42  	UserPlan           string          `json:"UserPlan"`
    43  	FVersioning        string          `json:"FVersioning"`
    44  	UserDomain         string          `json:"UserDomain"`
    45  	PartnerUsersDomain string          `json:"PartnerUsersDomain"`
    46  }
    47  
    48  // FolderList describes an OpenDRIVE listing
    49  type FolderList struct {
    50  	// DirUpdateTime    string   `json:"DirUpdateTime,string"`
    51  	Name             string   `json:"Name"`
    52  	ParentFolderID   string   `json:"ParentFolderID"`
    53  	DirectFolderLink string   `json:"DirectFolderLink"`
    54  	ResponseType     int      `json:"ResponseType"`
    55  	Folders          []Folder `json:"Folders"`
    56  	Files            []File   `json:"Files"`
    57  }
    58  
    59  // Folder describes an OpenDRIVE folder
    60  type Folder struct {
    61  	FolderID      string `json:"FolderID"`
    62  	Name          string `json:"Name"`
    63  	DateCreated   int    `json:"DateCreated"`
    64  	DirUpdateTime int    `json:"DirUpdateTime"`
    65  	Access        int    `json:"Access"`
    66  	DateModified  int64  `json:"DateModified"`
    67  	Shared        string `json:"Shared"`
    68  	ChildFolders  int    `json:"ChildFolders"`
    69  	Link          string `json:"Link"`
    70  	Encrypted     string `json:"Encrypted"`
    71  }
    72  
    73  type createFolder struct {
    74  	SessionID           string `json:"session_id"`
    75  	FolderName          string `json:"folder_name"`
    76  	FolderSubParent     string `json:"folder_sub_parent"`
    77  	FolderIsPublic      int64  `json:"folder_is_public"`      // (0 = private, 1 = public, 2 = hidden)
    78  	FolderPublicUpl     int64  `json:"folder_public_upl"`     // (0 = disabled, 1 = enabled)
    79  	FolderPublicDisplay int64  `json:"folder_public_display"` // (0 = disabled, 1 = enabled)
    80  	FolderPublicDnl     int64  `json:"folder_public_dnl"`     // (0 = disabled, 1 = enabled).
    81  }
    82  
    83  type createFolderResponse struct {
    84  	FolderID      string `json:"FolderID"`
    85  	Name          string `json:"Name"`
    86  	DateCreated   int    `json:"DateCreated"`
    87  	DirUpdateTime int    `json:"DirUpdateTime"`
    88  	Access        int    `json:"Access"`
    89  	DateModified  int    `json:"DateModified"`
    90  	Shared        string `json:"Shared"`
    91  	Description   string `json:"Description"`
    92  	Link          string `json:"Link"`
    93  }
    94  
    95  type moveCopyFolder struct {
    96  	SessionID     string `json:"session_id"`
    97  	FolderID      string `json:"folder_id"`
    98  	DstFolderID   string `json:"dst_folder_id"`
    99  	Move          string `json:"move"`
   100  	NewFolderName string `json:"new_folder_name"` // New name for destination folder.
   101  }
   102  
   103  type moveCopyFolderResponse struct {
   104  	FolderID string `json:"FolderID"`
   105  }
   106  
   107  type removeFolder struct {
   108  	SessionID string `json:"session_id"`
   109  	FolderID  string `json:"folder_id"`
   110  }
   111  
   112  // File describes an OpenDRIVE file
   113  type File struct {
   114  	FileID            string `json:"FileId"`
   115  	FileHash          string `json:"FileHash"`
   116  	Name              string `json:"Name"`
   117  	GroupID           int    `json:"GroupID"`
   118  	Extension         string `json:"Extension"`
   119  	Size              int64  `json:"Size,string"`
   120  	Views             string `json:"Views"`
   121  	Version           string `json:"Version"`
   122  	Downloads         string `json:"Downloads"`
   123  	DateModified      int64  `json:"DateModified,string"`
   124  	Access            string `json:"Access"`
   125  	Link              string `json:"Link"`
   126  	DownloadLink      string `json:"DownloadLink"`
   127  	StreamingLink     string `json:"StreamingLink"`
   128  	TempStreamingLink string `json:"TempStreamingLink"`
   129  	EditLink          string `json:"EditLink"`
   130  	ThumbLink         string `json:"ThumbLink"`
   131  	Password          string `json:"Password"`
   132  	EditOnline        int    `json:"EditOnline"`
   133  }
   134  
   135  type moveCopyFile struct {
   136  	SessionID         string `json:"session_id"`
   137  	SrcFileID         string `json:"src_file_id"`
   138  	DstFolderID       string `json:"dst_folder_id"`
   139  	Move              string `json:"move"`
   140  	OverwriteIfExists string `json:"overwrite_if_exists"`
   141  	NewFileName       string `json:"new_file_name"` // New name for destination file.
   142  }
   143  
   144  type moveCopyFileResponse struct {
   145  	FileID string `json:"FileID"`
   146  	Size   string `json:"Size"`
   147  }
   148  
   149  type createFile struct {
   150  	SessionID string `json:"session_id"`
   151  	FolderID  string `json:"folder_id"`
   152  	Name      string `json:"file_name"`
   153  }
   154  
   155  type createFileResponse struct {
   156  	FileID             string `json:"FileId"`
   157  	Name               string `json:"Name"`
   158  	GroupID            int    `json:"GroupID"`
   159  	Extension          string `json:"Extension"`
   160  	Size               string `json:"Size"`
   161  	Views              string `json:"Views"`
   162  	Downloads          string `json:"Downloads"`
   163  	DateModified       string `json:"DateModified"`
   164  	Access             string `json:"Access"`
   165  	Link               string `json:"Link"`
   166  	DownloadLink       string `json:"DownloadLink"`
   167  	StreamingLink      string `json:"StreamingLink"`
   168  	TempStreamingLink  string `json:"TempStreamingLink"`
   169  	DirUpdateTime      int    `json:"DirUpdateTime"`
   170  	TempLocation       string `json:"TempLocation"`
   171  	SpeedLimit         int    `json:"SpeedLimit"`
   172  	RequireCompression int    `json:"RequireCompression"`
   173  	RequireHash        int    `json:"RequireHash"`
   174  	RequireHashOnly    int    `json:"RequireHashOnly"`
   175  }
   176  
   177  type modTimeFile struct {
   178  	SessionID            string `json:"session_id"`
   179  	FileID               string `json:"file_id"`
   180  	FileModificationTime string `json:"file_modification_time"`
   181  }
   182  
   183  type openUpload struct {
   184  	SessionID string `json:"session_id"`
   185  	FileID    string `json:"file_id"`
   186  	Size      int64  `json:"file_size"`
   187  }
   188  
   189  type openUploadResponse struct {
   190  	TempLocation       string `json:"TempLocation"`
   191  	RequireCompression bool   `json:"RequireCompression"`
   192  	RequireHash        bool   `json:"RequireHash"`
   193  	RequireHashOnly    bool   `json:"RequireHashOnly"`
   194  	SpeedLimit         int    `json:"SpeedLimit"`
   195  }
   196  
   197  type closeUpload struct {
   198  	SessionID    string `json:"session_id"`
   199  	FileID       string `json:"file_id"`
   200  	Size         int64  `json:"file_size"`
   201  	TempLocation string `json:"temp_location"`
   202  }
   203  
   204  type closeUploadResponse struct {
   205  	FileID   string `json:"FileID"`
   206  	FileHash string `json:"FileHash"`
   207  	Size     int64  `json:"Size"`
   208  }
   209  
   210  type permissions struct {
   211  	SessionID    string `json:"session_id"`
   212  	FileID       string `json:"file_id"`
   213  	FileIsPublic int64  `json:"file_ispublic"`
   214  }
   215  
   216  type uploadFileChunkReply struct {
   217  	TotalWritten int64 `json:"TotalWritten"`
   218  }