Documentation ¶
Index ¶
- Constants
- func ExtendRawFilesTinyURL(files []map[string]interface{}, tinyURLsMap map[string]string) ([]map[string]interface{}, error)
- func ExtractFileIDFromRawFiles(files []map[string]interface{}) ([]string, error)
- func ExtractRawFilesFromListResponse(listResponse map[string]interface{}) ([]map[string]interface{}, error)
- func GenerateDriveAPIActionToken(api *KozmoDriveRestAPI, action string) (string, error)
- func Validate(jwtToken string, teamID int, action string) (bool, error)
- type DeleteFileRequest
- type DriveAuthClaims
- type FileList
- type GenerateTinyURLRequest
- type KozmoDriveRestAPI
- func (r *KozmoDriveRestAPI) CloseDebug()
- func (r *KozmoDriveRestAPI) DeleteFile(fileID string) (map[string]interface{}, error)
- func (r *KozmoDriveRestAPI) DeleteMultipleFile(fileIDs []string) (map[string]interface{}, error)
- func (r *KozmoDriveRestAPI) GenerateAccessJWTToken(usage string) (map[string]interface{}, error)
- func (r *KozmoDriveRestAPI) GetDownloadAddress(fileID string) (map[string]interface{}, error)
- func (r *KozmoDriveRestAPI) GetMultipleDownloadAddres(fileIDs []string) ([]map[string]interface{}, error)
- func (r *KozmoDriveRestAPI) GetMultipleUploadAddress(overwriteDuplicate bool, path string, fileNames []string, fileSizes []int64, ...) ([]map[string]interface{}, error)
- func (r *KozmoDriveRestAPI) GetUploadAddres(overwriteDuplicate bool, path string, fileName string, fileSize int64, ...) (map[string]interface{}, error)
- func (r *KozmoDriveRestAPI) ListFiles(path string, page int, limit int, fileID string, search string, ...) (map[string]interface{}, error)
- func (r *KozmoDriveRestAPI) OpenDebug()
- func (r *KozmoDriveRestAPI) RenameFile(fileID string, fileName string) (map[string]interface{}, error)
- func (r *KozmoDriveRestAPI) UpdateFileStatus(fileID string, status string) (map[string]interface{}, error)
- type RenameFileRequest
- type UpdateFileStatusRequest
- type UploadFileRequest
- func (r *UploadFileRequest) ExportContentType() string
- func (r *UploadFileRequest) ExportDuplicationCover() bool
- func (r *UploadFileRequest) ExportDuplicationStrategy() string
- func (r *UploadFileRequest) ExportFileName() string
- func (r *UploadFileRequest) ExportFileType() string
- func (r *UploadFileRequest) ExportFileTypeInt() int
- func (r *UploadFileRequest) ExportFolderID() string
- func (r *UploadFileRequest) ExportMIMEType() string
- func (r *UploadFileRequest) ExportParentID() int
- func (r *UploadFileRequest) ExportResumable() bool
- func (r *UploadFileRequest) ExportSize() int64
- func (r *UploadFileRequest) GenerateNewFileName() string
- func (r *UploadFileRequest) SetDuplicationCover(cover bool)
- func (r *UploadFileRequest) SetNewFileName(newFileName string)
- func (r *UploadFileRequest) SetNewParentID(newParentID int)
Constants ¶
View Source
const ( DRIVE_API_ACTION_GENERATE_TINY_URLS = "GenerateTinyURLs" DRIVE_API_ACTION_GET_FOLDER_ID_BY_PATH = "GetFolderIDByPath" DRIVE_API_ACTION_LIST_FILES = "ListFiles" DRIVE_API_ACTION_GET_UPLOAD_ADDRESS = "GetUploadAddress" DRIVE_API_ACTION_UPDATE_FILE_STATUS = "UpdateFileStatus" DRIVE_API_ACTION_GET_MULTIPLE_UPLOAD_ADDRESS = "GetMultipleUploadAddress" DRIVE_API_ACTION_GET_DOWNLOAD_ADDRESS = "GetDownloadAddress" DRIVE_API_ACTION_GET_MULTIPLE_DOWNLOAD_ADDRESS = "GetMultipleDownloadAddress" DRIVE_API_ACTION_DELETE_FILES = "DeleteFiles" DRIVE_API_ACTION_DELETE_FILE = "DeleteFile" DRIVE_API_ACTION_DELETE_MULTIPLE_FILE = "DeleteMultipleFile" DRIVE_API_ACTION_RENAME_FILE = "RenameFile" )
View Source
const ( DRIVE_API_LIST_FILES = "/api/v1/teams/%s/kozmoAction/files?%s" DRIVE_API_GET_UPLOAD_ADDRESS = "/api/v1/teams/%s/kozmoAction/files" DRIVE_API_UPDATE_FILE_STATUS = "/api/v1/teams/%s/kozmoAction/files/%s/status" DRIVE_API_GET_DOWNLOAD_SIGNED_URL = "/api/v1/teams/%s/kozmoAction/files/%s/url" DRIVE_API_DELETE_FILES = "/api/v1/teams/%s/kozmoAction/files" DRIVE_API_RENAME_FILE = "/api/v1/teams/%s/kozmoAction/files/%s/name" )
View Source
const ( DUPLICATION_STRATEGY_COVER = "cover" DUPLICATION_STRATEGY_RENAME = "rename" DUPLICATION_STRATEGY_MANUAL = "manual" )
duplication strategies
View Source
const ( FILE_TINY_URL_PREFIX_TEST = "https://cloud-api-test.kozmoai.com/drive/f/%s" FILE_TINY_URL_PREFIX_BETA = "https://cloud-api-beta.kozmoai.com/drive/f/%s" FILE_TINY_URL_PREFIX_PRODUCTION = "https://cloud-api.kozmoai.com/drive/f/%s" )
View Source
const (
DRIVE_API_GENERATE_TINY_URL_BATCH = "/api/v1/teams/%s/kozmoAction/links/batch"
)
View Source
const (
DRIVE_API_GET_FOLDER_ID_BY_PATH = "/api/v1/teams/%s/kozmoAction/folder?%s"
)
View Source
const JWT_ISSUER = "KOZMO Cloud"
View Source
const JWT_TOKEN_DEFAULT_EXIPRED_PERIOD = time.Hour * 24
Variables ¶
This section is empty.
Functions ¶
func ExtendRawFilesTinyURL ¶
func GenerateDriveAPIActionToken ¶
func GenerateDriveAPIActionToken(api *KozmoDriveRestAPI, action string) (string, error)
Types ¶
type DeleteFileRequest ¶
type DeleteFileRequest struct {
IDs []string `json:"ids"`
}
func NewDeleteFileRequest ¶
func NewDeleteFileRequest() *DeleteFileRequest
func NewDeleteFileRequestByParam ¶
func NewDeleteFileRequestByParam(ids []string) *DeleteFileRequest
type DriveAuthClaims ¶
type FileList ¶
type FileList struct { Path string `json:"path"` CurrentFolderID string `json:"currentFolderID"` Files []map[string]interface{} `json:"files"` }
func NewFileList ¶
func NewFileList() *FileList
type GenerateTinyURLRequest ¶
type GenerateTinyURLRequest struct { IDs []string `json:"ids" validate:"required,gt=0,dive,required"` IntIDs []int `json:"-"` ExpirationType string `json:"expirationType" validate:"oneof=persistent custom"` Expiry string `json:"expiry" validate:"required_if=ExpirationType custom"` HotlinkProtection bool `json:"hotlinkProtection"` }
func NewGenerateTinyURLRequest ¶
func NewGenerateTinyURLRequest() *GenerateTinyURLRequest
func NewGenerateTinyURLRequestByParam ¶
func NewGenerateTinyURLRequestByParam(ids []string, expirationType string, expiry string, hotlinkProtection bool) *GenerateTinyURLRequest
func (*GenerateTinyURLRequest) ExportExpirationType ¶
func (g *GenerateTinyURLRequest) ExportExpirationType() int
func (*GenerateTinyURLRequest) ExportIDs ¶
func (g *GenerateTinyURLRequest) ExportIDs() []int
func (*GenerateTinyURLRequest) Preprocess ¶
func (g *GenerateTinyURLRequest) Preprocess()
func (*GenerateTinyURLRequest) ValidateExpiry ¶
func (g *GenerateTinyURLRequest) ValidateExpiry() bool
type KozmoDriveRestAPI ¶
type KozmoDriveRestAPI struct { Config *config.Config TeamID int `json:"teamID"` UserID int `json:"userID"` InstanceType int `json:"instanceType"` InstanceID int `json:"instanceID"` Debug bool `json:"-"` }
func NewKozmoDriveRestAPI ¶
func NewKozmoDriveRestAPI(teamID int, userID int, instanceType int, instanceID int) *KozmoDriveRestAPI
func (*KozmoDriveRestAPI) CloseDebug ¶
func (r *KozmoDriveRestAPI) CloseDebug()
func (*KozmoDriveRestAPI) DeleteFile ¶
func (r *KozmoDriveRestAPI) DeleteFile(fileID string) (map[string]interface{}, error)
func (*KozmoDriveRestAPI) DeleteMultipleFile ¶
func (r *KozmoDriveRestAPI) DeleteMultipleFile(fileIDs []string) (map[string]interface{}, error)
func (*KozmoDriveRestAPI) GenerateAccessJWTToken ¶
func (r *KozmoDriveRestAPI) GenerateAccessJWTToken(usage string) (map[string]interface{}, error)
func (*KozmoDriveRestAPI) GetDownloadAddress ¶
func (r *KozmoDriveRestAPI) GetDownloadAddress(fileID string) (map[string]interface{}, error)
func (*KozmoDriveRestAPI) GetMultipleDownloadAddres ¶
func (r *KozmoDriveRestAPI) GetMultipleDownloadAddres(fileIDs []string) ([]map[string]interface{}, error)
func (*KozmoDriveRestAPI) GetMultipleUploadAddress ¶
func (*KozmoDriveRestAPI) GetUploadAddres ¶
func (*KozmoDriveRestAPI) OpenDebug ¶
func (r *KozmoDriveRestAPI) OpenDebug()
func (*KozmoDriveRestAPI) RenameFile ¶
func (r *KozmoDriveRestAPI) RenameFile(fileID string, fileName string) (map[string]interface{}, error)
func (*KozmoDriveRestAPI) UpdateFileStatus ¶
func (r *KozmoDriveRestAPI) UpdateFileStatus(fileID string, status string) (map[string]interface{}, error)
type RenameFileRequest ¶
type RenameFileRequest struct {
Name string `json:"name"`
}
func NewRenameFileRequest ¶
func NewRenameFileRequest() *RenameFileRequest
func NewRenameFileRequestByParam ¶
func NewRenameFileRequestByParam(name string) *RenameFileRequest
type UpdateFileStatusRequest ¶
type UpdateFileStatusRequest struct {
Status string `json:"status"`
}
func NewUpdateFileStatusRequest ¶
func NewUpdateFileStatusRequest() *UpdateFileStatusRequest
func NewUpdateFileStatusRequestByParam ¶
func NewUpdateFileStatusRequestByParam(status string) *UpdateFileStatusRequest
type UploadFileRequest ¶
type UploadFileRequest struct { Name string `json:"name" validate:"required"` FolderID string `json:"folderID" validate:"required"` Type string `json:"type" validate:"oneof=file folder"` ContentType string `json:"contentType"` Resumable bool `json:"resumable"` Size int64 `json:"size"` DuplicationHandler string `json:"duplicationHandler" validate:"oneof=cover rename manual"` Cover bool `json:"-"` }
The request sample like: ```json {"resumable":true,"name":"lemmy.hjson","folderID":"ILAfx4p1C7cX","type":"file","size":590,"duplicationHandler":"manual","contentType":""} ```
func NewUploadFileRequest ¶
func NewUploadFileRequest() *UploadFileRequest
func (*UploadFileRequest) ExportContentType ¶
func (r *UploadFileRequest) ExportContentType() string
func (*UploadFileRequest) ExportDuplicationCover ¶
func (r *UploadFileRequest) ExportDuplicationCover() bool
func (*UploadFileRequest) ExportDuplicationStrategy ¶
func (r *UploadFileRequest) ExportDuplicationStrategy() string
func (*UploadFileRequest) ExportFileName ¶
func (r *UploadFileRequest) ExportFileName() string
func (*UploadFileRequest) ExportFileType ¶
func (r *UploadFileRequest) ExportFileType() string
func (*UploadFileRequest) ExportFileTypeInt ¶
func (r *UploadFileRequest) ExportFileTypeInt() int
func (*UploadFileRequest) ExportFolderID ¶
func (r *UploadFileRequest) ExportFolderID() string
func (*UploadFileRequest) ExportMIMEType ¶
func (r *UploadFileRequest) ExportMIMEType() string
func (*UploadFileRequest) ExportParentID ¶
func (r *UploadFileRequest) ExportParentID() int
func (*UploadFileRequest) ExportResumable ¶
func (r *UploadFileRequest) ExportResumable() bool
func (*UploadFileRequest) ExportSize ¶
func (r *UploadFileRequest) ExportSize() int64
func (*UploadFileRequest) GenerateNewFileName ¶
func (r *UploadFileRequest) GenerateNewFileName() string
func (*UploadFileRequest) SetDuplicationCover ¶
func (r *UploadFileRequest) SetDuplicationCover(cover bool)
func (*UploadFileRequest) SetNewFileName ¶
func (r *UploadFileRequest) SetNewFileName(newFileName string)
func (*UploadFileRequest) SetNewParentID ¶
func (r *UploadFileRequest) SetNewParentID(newParentID int)
Click to show internal directories.
Click to hide internal directories.