github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/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 renameFolder struct { 104 SessionID string `json:"session_id"` 105 FolderID string `json:"folder_id"` 106 FolderName string `json:"folder_name"` // New name for destination folder (max 255). 107 SharingID string `json:"sharing_id"` 108 } 109 110 type moveCopyFolderResponse struct { 111 FolderID string `json:"FolderID"` 112 } 113 114 type removeFolder struct { 115 SessionID string `json:"session_id"` 116 FolderID string `json:"folder_id"` 117 } 118 119 // File describes an OpenDRIVE file 120 type File struct { 121 FileID string `json:"FileId"` 122 FileHash string `json:"FileHash"` 123 Name string `json:"Name"` 124 GroupID int `json:"GroupID"` 125 Extension string `json:"Extension"` 126 Size int64 `json:"Size,string"` 127 Views string `json:"Views"` 128 Version string `json:"Version"` 129 Downloads string `json:"Downloads"` 130 DateModified int64 `json:"DateModified,string"` 131 Access string `json:"Access"` 132 Link string `json:"Link"` 133 DownloadLink string `json:"DownloadLink"` 134 StreamingLink string `json:"StreamingLink"` 135 TempStreamingLink string `json:"TempStreamingLink"` 136 EditLink string `json:"EditLink"` 137 ThumbLink string `json:"ThumbLink"` 138 Password string `json:"Password"` 139 EditOnline int `json:"EditOnline"` 140 } 141 142 type moveCopyFile struct { 143 SessionID string `json:"session_id"` 144 SrcFileID string `json:"src_file_id"` 145 DstFolderID string `json:"dst_folder_id"` 146 Move string `json:"move"` 147 OverwriteIfExists string `json:"overwrite_if_exists"` 148 NewFileName string `json:"new_file_name"` // New name for destination file. 149 } 150 151 type moveCopyFileResponse struct { 152 FileID string `json:"FileID"` 153 Size string `json:"Size"` 154 } 155 156 type renameFile struct { 157 SessionID string `json:"session_id"` 158 NewFileName string `json:"new_file_name"` // New name for destination file. 159 FileID string `json:"file_id"` 160 AccessFolderID string `json:"access_folder_id"` 161 SharingID string `json:"sharing_id"` 162 } 163 164 type createFile struct { 165 SessionID string `json:"session_id"` 166 FolderID string `json:"folder_id"` 167 Name string `json:"file_name"` 168 } 169 170 type createFileResponse struct { 171 FileID string `json:"FileId"` 172 Name string `json:"Name"` 173 GroupID int `json:"GroupID"` 174 Extension string `json:"Extension"` 175 Size string `json:"Size"` 176 Views string `json:"Views"` 177 Downloads string `json:"Downloads"` 178 DateModified string `json:"DateModified"` 179 Access string `json:"Access"` 180 Link string `json:"Link"` 181 DownloadLink string `json:"DownloadLink"` 182 StreamingLink string `json:"StreamingLink"` 183 TempStreamingLink string `json:"TempStreamingLink"` 184 DirUpdateTime int `json:"DirUpdateTime"` 185 TempLocation string `json:"TempLocation"` 186 SpeedLimit int `json:"SpeedLimit"` 187 RequireCompression int `json:"RequireCompression"` 188 RequireHash int `json:"RequireHash"` 189 RequireHashOnly int `json:"RequireHashOnly"` 190 } 191 192 type modTimeFile struct { 193 SessionID string `json:"session_id"` 194 FileID string `json:"file_id"` 195 FileModificationTime string `json:"file_modification_time"` 196 } 197 198 type openUpload struct { 199 SessionID string `json:"session_id"` 200 FileID string `json:"file_id"` 201 Size int64 `json:"file_size"` 202 } 203 204 type openUploadResponse struct { 205 TempLocation string `json:"TempLocation"` 206 RequireCompression bool `json:"RequireCompression"` 207 RequireHash bool `json:"RequireHash"` 208 RequireHashOnly bool `json:"RequireHashOnly"` 209 SpeedLimit int `json:"SpeedLimit"` 210 } 211 212 type closeUpload struct { 213 SessionID string `json:"session_id"` 214 FileID string `json:"file_id"` 215 Size int64 `json:"file_size"` 216 TempLocation string `json:"temp_location"` 217 } 218 219 type closeUploadResponse struct { 220 FileID string `json:"FileID"` 221 FileHash string `json:"FileHash"` 222 Size int64 `json:"Size"` 223 } 224 225 type permissions struct { 226 SessionID string `json:"session_id"` 227 FileID string `json:"file_id"` 228 FileIsPublic int64 `json:"file_ispublic"` 229 } 230 231 type uploadFileChunkReply struct { 232 TotalWritten int64 `json:"TotalWritten"` 233 }