2017-06-02 06:51:38 +00:00
|
|
|
package opendrive
|
|
|
|
|
2017-07-17 05:36:45 +00:00
|
|
|
import (
|
|
|
|
"encoding/json"
|
2018-04-26 21:02:31 +00:00
|
|
|
"fmt"
|
2017-07-17 05:36:45 +00:00
|
|
|
)
|
|
|
|
|
2018-04-26 21:02:31 +00:00
|
|
|
// Error describes an openDRIVE error response
|
|
|
|
type Error struct {
|
|
|
|
Info struct {
|
|
|
|
Code int `json:"code"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
} `json:"error"`
|
|
|
|
}
|
|
|
|
|
2019-02-07 17:41:17 +00:00
|
|
|
// Error satisfies the error interface
|
2018-04-26 21:02:31 +00:00
|
|
|
func (e *Error) Error() string {
|
|
|
|
return fmt.Sprintf("%s (Error %d)", e.Info.Message, e.Info.Code)
|
|
|
|
}
|
|
|
|
|
2020-05-20 10:39:20 +00:00
|
|
|
// Account describes an OpenDRIVE account
|
2017-06-02 06:51:38 +00:00
|
|
|
type Account struct {
|
|
|
|
Username string `json:"username"`
|
|
|
|
Password string `json:"passwd"`
|
|
|
|
}
|
|
|
|
|
2020-05-20 10:39:20 +00:00
|
|
|
// UserSessionInfo describes an OpenDRIVE session
|
2017-06-02 06:51:38 +00:00
|
|
|
type UserSessionInfo struct {
|
|
|
|
Username string `json:"username"`
|
|
|
|
Password string `json:"passwd"`
|
|
|
|
|
2017-07-17 05:36:45 +00:00
|
|
|
SessionID string `json:"SessionID"`
|
|
|
|
UserName string `json:"UserName"`
|
|
|
|
UserFirstName string `json:"UserFirstName"`
|
|
|
|
UserLastName string `json:"UserLastName"`
|
|
|
|
AccType string `json:"AccType"`
|
|
|
|
UserLang string `json:"UserLang"`
|
|
|
|
UserID string `json:"UserID"`
|
|
|
|
IsAccountUser json.RawMessage `json:"IsAccountUser"`
|
|
|
|
DriveName string `json:"DriveName"`
|
|
|
|
UserLevel string `json:"UserLevel"`
|
|
|
|
UserPlan string `json:"UserPlan"`
|
|
|
|
FVersioning string `json:"FVersioning"`
|
|
|
|
UserDomain string `json:"UserDomain"`
|
|
|
|
PartnerUsersDomain string `json:"PartnerUsersDomain"`
|
2017-06-02 06:51:38 +00:00
|
|
|
}
|
|
|
|
|
2020-05-20 10:39:20 +00:00
|
|
|
// FolderList describes an OpenDRIVE listing
|
2017-06-02 06:51:38 +00:00
|
|
|
type FolderList struct {
|
|
|
|
// DirUpdateTime string `json:"DirUpdateTime,string"`
|
|
|
|
Name string `json:"Name"`
|
|
|
|
ParentFolderID string `json:"ParentFolderID"`
|
|
|
|
DirectFolderLink string `json:"DirectFolderLink"`
|
|
|
|
ResponseType int `json:"ResponseType"`
|
|
|
|
Folders []Folder `json:"Folders"`
|
|
|
|
Files []File `json:"Files"`
|
|
|
|
}
|
|
|
|
|
2020-05-20 10:39:20 +00:00
|
|
|
// Folder describes an OpenDRIVE folder
|
2017-06-02 06:51:38 +00:00
|
|
|
type Folder struct {
|
|
|
|
FolderID string `json:"FolderID"`
|
|
|
|
Name string `json:"Name"`
|
|
|
|
DateCreated int `json:"DateCreated"`
|
|
|
|
DirUpdateTime int `json:"DirUpdateTime"`
|
|
|
|
Access int `json:"Access"`
|
|
|
|
DateModified int64 `json:"DateModified"`
|
|
|
|
Shared string `json:"Shared"`
|
|
|
|
ChildFolders int `json:"ChildFolders"`
|
|
|
|
Link string `json:"Link"`
|
|
|
|
Encrypted string `json:"Encrypted"`
|
|
|
|
}
|
|
|
|
|
2017-07-17 05:36:45 +00:00
|
|
|
type createFolder struct {
|
2018-04-26 21:02:31 +00:00
|
|
|
SessionID string `json:"session_id"`
|
2017-07-17 05:36:45 +00:00
|
|
|
FolderName string `json:"folder_name"`
|
|
|
|
FolderSubParent string `json:"folder_sub_parent"`
|
2018-04-26 21:02:31 +00:00
|
|
|
FolderIsPublic int64 `json:"folder_is_public"` // (0 = private, 1 = public, 2 = hidden)
|
|
|
|
FolderPublicUpl int64 `json:"folder_public_upl"` // (0 = disabled, 1 = enabled)
|
|
|
|
FolderPublicDisplay int64 `json:"folder_public_display"` // (0 = disabled, 1 = enabled)
|
|
|
|
FolderPublicDnl int64 `json:"folder_public_dnl"` // (0 = disabled, 1 = enabled).
|
2017-07-17 05:36:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type createFolderResponse struct {
|
|
|
|
FolderID string `json:"FolderID"`
|
|
|
|
Name string `json:"Name"`
|
|
|
|
DateCreated int `json:"DateCreated"`
|
|
|
|
DirUpdateTime int `json:"DirUpdateTime"`
|
|
|
|
Access int `json:"Access"`
|
|
|
|
DateModified int `json:"DateModified"`
|
|
|
|
Shared string `json:"Shared"`
|
|
|
|
Description string `json:"Description"`
|
|
|
|
Link string `json:"Link"`
|
|
|
|
}
|
|
|
|
|
2018-04-26 21:02:31 +00:00
|
|
|
type moveCopyFolder struct {
|
|
|
|
SessionID string `json:"session_id"`
|
|
|
|
FolderID string `json:"folder_id"`
|
|
|
|
DstFolderID string `json:"dst_folder_id"`
|
|
|
|
Move string `json:"move"`
|
|
|
|
NewFolderName string `json:"new_folder_name"` // New name for destination folder.
|
2017-07-17 05:36:45 +00:00
|
|
|
}
|
|
|
|
|
2024-02-18 10:03:39 +00:00
|
|
|
type renameFolder struct {
|
|
|
|
SessionID string `json:"session_id"`
|
|
|
|
FolderID string `json:"folder_id"`
|
|
|
|
FolderName string `json:"folder_name"` // New name for destination folder (max 255).
|
|
|
|
SharingID string `json:"sharing_id"`
|
|
|
|
}
|
|
|
|
|
2018-04-26 21:02:31 +00:00
|
|
|
type moveCopyFolderResponse struct {
|
2017-07-17 05:36:45 +00:00
|
|
|
FolderID string `json:"FolderID"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type removeFolder struct {
|
2018-04-26 21:02:31 +00:00
|
|
|
SessionID string `json:"session_id"`
|
2017-07-17 05:36:45 +00:00
|
|
|
FolderID string `json:"folder_id"`
|
|
|
|
}
|
|
|
|
|
2020-05-20 10:39:20 +00:00
|
|
|
// File describes an OpenDRIVE file
|
2017-06-02 06:51:38 +00:00
|
|
|
type File struct {
|
|
|
|
FileID string `json:"FileId"`
|
2017-07-17 05:36:45 +00:00
|
|
|
FileHash string `json:"FileHash"`
|
2017-06-02 06:51:38 +00:00
|
|
|
Name string `json:"Name"`
|
|
|
|
GroupID int `json:"GroupID"`
|
|
|
|
Extension string `json:"Extension"`
|
|
|
|
Size int64 `json:"Size,string"`
|
|
|
|
Views string `json:"Views"`
|
|
|
|
Version string `json:"Version"`
|
|
|
|
Downloads string `json:"Downloads"`
|
|
|
|
DateModified int64 `json:"DateModified,string"`
|
|
|
|
Access string `json:"Access"`
|
|
|
|
Link string `json:"Link"`
|
|
|
|
DownloadLink string `json:"DownloadLink"`
|
|
|
|
StreamingLink string `json:"StreamingLink"`
|
|
|
|
TempStreamingLink string `json:"TempStreamingLink"`
|
|
|
|
EditLink string `json:"EditLink"`
|
|
|
|
ThumbLink string `json:"ThumbLink"`
|
|
|
|
Password string `json:"Password"`
|
|
|
|
EditOnline int `json:"EditOnline"`
|
|
|
|
}
|
|
|
|
|
2018-04-26 21:02:31 +00:00
|
|
|
type moveCopyFile struct {
|
2017-07-17 05:36:45 +00:00
|
|
|
SessionID string `json:"session_id"`
|
|
|
|
SrcFileID string `json:"src_file_id"`
|
|
|
|
DstFolderID string `json:"dst_folder_id"`
|
|
|
|
Move string `json:"move"`
|
|
|
|
OverwriteIfExists string `json:"overwrite_if_exists"`
|
2018-04-26 21:02:31 +00:00
|
|
|
NewFileName string `json:"new_file_name"` // New name for destination file.
|
2017-07-17 05:36:45 +00:00
|
|
|
}
|
|
|
|
|
2018-04-26 21:02:31 +00:00
|
|
|
type moveCopyFileResponse struct {
|
2017-07-17 05:36:45 +00:00
|
|
|
FileID string `json:"FileID"`
|
|
|
|
Size string `json:"Size"`
|
|
|
|
}
|
|
|
|
|
2024-02-18 10:03:39 +00:00
|
|
|
type renameFile struct {
|
|
|
|
SessionID string `json:"session_id"`
|
|
|
|
NewFileName string `json:"new_file_name"` // New name for destination file.
|
|
|
|
FileID string `json:"file_id"`
|
|
|
|
AccessFolderID string `json:"access_folder_id"`
|
|
|
|
SharingID string `json:"sharing_id"`
|
|
|
|
}
|
|
|
|
|
2017-06-02 06:51:38 +00:00
|
|
|
type createFile struct {
|
|
|
|
SessionID string `json:"session_id"`
|
|
|
|
FolderID string `json:"folder_id"`
|
|
|
|
Name string `json:"file_name"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type createFileResponse struct {
|
|
|
|
FileID string `json:"FileId"`
|
|
|
|
Name string `json:"Name"`
|
|
|
|
GroupID int `json:"GroupID"`
|
|
|
|
Extension string `json:"Extension"`
|
|
|
|
Size string `json:"Size"`
|
|
|
|
Views string `json:"Views"`
|
|
|
|
Downloads string `json:"Downloads"`
|
|
|
|
DateModified string `json:"DateModified"`
|
|
|
|
Access string `json:"Access"`
|
|
|
|
Link string `json:"Link"`
|
|
|
|
DownloadLink string `json:"DownloadLink"`
|
|
|
|
StreamingLink string `json:"StreamingLink"`
|
|
|
|
TempStreamingLink string `json:"TempStreamingLink"`
|
|
|
|
DirUpdateTime int `json:"DirUpdateTime"`
|
|
|
|
TempLocation string `json:"TempLocation"`
|
|
|
|
SpeedLimit int `json:"SpeedLimit"`
|
|
|
|
RequireCompression int `json:"RequireCompression"`
|
|
|
|
RequireHash int `json:"RequireHash"`
|
|
|
|
RequireHashOnly int `json:"RequireHashOnly"`
|
|
|
|
}
|
|
|
|
|
2017-07-17 05:36:45 +00:00
|
|
|
type modTimeFile struct {
|
|
|
|
SessionID string `json:"session_id"`
|
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileModificationTime string `json:"file_modification_time"`
|
|
|
|
}
|
|
|
|
|
2017-06-02 06:51:38 +00:00
|
|
|
type openUpload struct {
|
|
|
|
SessionID string `json:"session_id"`
|
|
|
|
FileID string `json:"file_id"`
|
|
|
|
Size int64 `json:"file_size"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type openUploadResponse struct {
|
|
|
|
TempLocation string `json:"TempLocation"`
|
|
|
|
RequireCompression bool `json:"RequireCompression"`
|
|
|
|
RequireHash bool `json:"RequireHash"`
|
|
|
|
RequireHashOnly bool `json:"RequireHashOnly"`
|
|
|
|
SpeedLimit int `json:"SpeedLimit"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type closeUpload struct {
|
|
|
|
SessionID string `json:"session_id"`
|
|
|
|
FileID string `json:"file_id"`
|
|
|
|
Size int64 `json:"file_size"`
|
|
|
|
TempLocation string `json:"temp_location"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type closeUploadResponse struct {
|
2017-07-17 05:36:45 +00:00
|
|
|
FileID string `json:"FileID"`
|
2017-06-02 06:51:38 +00:00
|
|
|
FileHash string `json:"FileHash"`
|
|
|
|
Size int64 `json:"Size"`
|
|
|
|
}
|
2017-07-17 05:36:45 +00:00
|
|
|
|
|
|
|
type permissions struct {
|
|
|
|
SessionID string `json:"session_id"`
|
|
|
|
FileID string `json:"file_id"`
|
|
|
|
FileIsPublic int64 `json:"file_ispublic"`
|
|
|
|
}
|
2019-07-23 13:20:51 +00:00
|
|
|
|
|
|
|
type uploadFileChunkReply struct {
|
|
|
|
TotalWritten int64 `json:"TotalWritten"`
|
|
|
|
}
|