Documentation
¶
Overview ¶
Package api has type definitions for dosya.dev
Index ¶
- type CopyFileRequest
- type CopyFileResponse
- type CreateFolderRequest
- type CreateFolderResponse
- type DeleteFileResponse
- type DeleteFolderResponse
- type Error
- type FileItem
- type FolderItem
- type ListResponse
- type MoveFileRequest
- type MoveFolderRequest
- type MoveFolderResponse
- type Pagination
- type RenameFileRequest
- type RenameFileResponse
- type RenameFolderRequest
- type Response
- type ShareLinkRequest
- type ShareLinkResponse
- type UploadCompleteResponse
- type UploadInitRequest
- type UploadInitResponse
- type UploadPartResponse
- type Workspace
- type WorkspaceInfoResponse
- type WorkspaceListResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CopyFileRequest ¶
type CopyFileRequest struct {
FolderID *string `json:"folder_id"`
Name string `json:"name,omitempty"`
}
CopyFileRequest is the request body for POST /api/files/:id/copy
type CopyFileResponse ¶
CopyFileResponse is the response from POST /api/files/:id/copy
type CreateFolderRequest ¶
type CreateFolderRequest struct {
WorkspaceID string `json:"workspace_id"`
ParentID *string `json:"parent_id"`
Name string `json:"name"`
}
CreateFolderRequest is the request body for POST /api/folders
type CreateFolderResponse ¶
type CreateFolderResponse struct {
Response
Folder struct {
ID string `json:"id"`
Name string `json:"name"`
ParentID *string `json:"parent_id"`
Workspace string `json:"workspace_id"`
} `json:"folder"`
}
CreateFolderResponse is the response from POST /api/folders
type DeleteFileResponse ¶
DeleteFileResponse is the response from DELETE /api/files/:id
type DeleteFolderResponse ¶
type DeleteFolderResponse struct {
Response
Permanent bool `json:"permanent"`
Complete bool `json:"complete"`
Remaining int `json:"remaining"`
FilesAffected int `json:"files_affected"`
FoldersRemoved int `json:"folders_removed"`
}
DeleteFolderResponse is the response from DELETE /api/folders/:id
type Error ¶
type Error struct {
StatusCode int `json:"-"`
Status string `json:"-"`
OK bool `json:"ok"`
Message string `json:"error"`
ErrorCode string `json:"error_code,omitempty"`
MaxConcurrentUploads int `json:"max_concurrent_uploads,omitempty"`
}
Error is an error response from the API.
StatusCode and Status are filled in from the HTTP response. The API sets ErrorCode on the errors a client is expected to act on rather than just report, e.g. "concurrent_upload_limit".
type FileItem ¶
type FileItem struct {
ID string `json:"id"`
Name string `json:"name"`
SizeBytes int64 `json:"size_bytes"`
MimeType string `json:"mime_type"`
Extension string `json:"extension"`
Region string `json:"region"`
CreatedAt float64 `json:"created_at"`
UpdatedAt float64 `json:"updated_at"`
FolderID *string `json:"folder_id"`
IsSynced int `json:"is_synced"`
// ContentHash is the lowercase-hex SHA-256 of the file's bytes, or "" when
// the server has none (e.g. a file uploaded as an R2 multipart, whose parts
// are never re-read to hash the whole object - the same limitation S3 has).
ContentHash string `json:"content_hash"`
}
FileItem represents a file from the dosya API
type FolderItem ¶
type FolderItem struct {
ID string `json:"id"`
Name string `json:"name"`
ParentID *string `json:"parent_id"`
CreatedAt float64 `json:"created_at"`
FileCount int `json:"file_count"`
IsSynced int `json:"is_synced"`
}
FolderItem represents a folder from the dosya API
type ListResponse ¶
type ListResponse struct {
Response
Files []FileItem `json:"files"`
Folders []FolderItem `json:"folders"`
Pagination Pagination `json:"pagination"`
}
ListResponse is the response from GET /api/files
type MoveFileRequest ¶
type MoveFileRequest struct {
FolderID *string `json:"folder_id"`
Name *string `json:"name,omitempty"`
}
MoveFileRequest is the request body for PUT /api/files/:id/move
type MoveFolderRequest ¶
type MoveFolderRequest struct {
ParentID *string `json:"parent_id"`
Name string `json:"name,omitempty"`
}
MoveFolderRequest is the request body for PUT /api/folders/:id/move
type MoveFolderResponse ¶
MoveFolderResponse is the response from PUT /api/folders/:id/move
type Pagination ¶
type Pagination struct {
Page int `json:"page"`
PerPage int `json:"per_page"`
TotalFiles int `json:"total_files"`
TotalPages int `json:"total_pages"`
}
Pagination describes which page of files a ListResponse holds
type RenameFileRequest ¶
type RenameFileRequest struct {
Name string `json:"name"`
}
RenameFileRequest is the request body for PUT /api/files/:id/rename
type RenameFileResponse ¶
RenameFileResponse is the response from PUT /api/files/:id/rename
type RenameFolderRequest ¶
type RenameFolderRequest struct {
Name string `json:"name"`
}
RenameFolderRequest is the request body for PUT /api/folders/:id/rename
type ShareLinkRequest ¶
type ShareLinkRequest struct {
}
ShareLinkRequest is the request body for POST /api/files/:id/share
type ShareLinkResponse ¶
type ShareLinkResponse struct {
ID string `json:"id"`
Token string `json:"token"`
URL string `json:"url"`
ExpiresAt *int64 `json:"expires_at"`
CreatedAt float64 `json:"created_at"`
} `json:"link"`
}
ShareLinkResponse is the response from POST /api/files/:id/share
type UploadCompleteResponse ¶
type UploadCompleteResponse struct {
Response
File struct {
ID string `json:"id"`
Name string `json:"name"`
SizeBytes int64 `json:"size_bytes"`
MimeType string `json:"mime_type"`
Extension string `json:"extension"`
Region string `json:"region"`
Version int `json:"version"`
CreatedAt float64 `json:"created_at"`
// SHA-256 of the uploaded bytes for a single-shot (small-file) upload;
// "" for a multipart upload, which the server does not hash.
ContentHash string `json:"content_hash"`
} `json:"file"`
}
UploadCompleteResponse is the response from PUT /api/upload/:sessionId or POST /api/upload/:sessionId/complete
type UploadInitRequest ¶
type UploadInitRequest struct {
WorkspaceID string `json:"workspace_id"`
FileName string `json:"file_name"`
FileSize int64 `json:"file_size"`
MimeType string `json:"mime_type"`
Region string `json:"region,omitempty"`
FolderID *string `json:"folder_id"`
FileID *string `json:"file_id,omitempty"`
}
UploadInitRequest is the request body for POST /api/upload/init
type UploadInitResponse ¶
type UploadInitResponse struct {
Response
SessionID string `json:"session_id"`
UploadURL string `json:"upload_url"`
WorkspaceID string `json:"workspace_id"`
FileName string `json:"file_name"`
FileSize int64 `json:"file_size"`
MimeType string `json:"mime_type"`
Extension string `json:"extension"`
Region string `json:"region"`
Resumable *struct {
PartSize int64 `json:"part_size"`
TotalParts int `json:"total_parts"`
PartUploadURL string `json:"part_upload_url"`
CompleteURL string `json:"complete_url"`
StatusURL string `json:"status_url"`
} `json:"resumable"`
}
UploadInitResponse is the response from POST /api/upload/init
type UploadPartResponse ¶
type UploadPartResponse struct {
Response
PartNumber int `json:"part_number"`
ETag string `json:"etag"`
BytesUploaded int64 `json:"bytes_uploaded"`
PartsCompleted int `json:"parts_completed"`
TotalParts int `json:"total_parts"`
}
UploadPartResponse is the response from PUT /api/upload/:sessionId/part/:partNumber
type WorkspaceInfoResponse ¶
type WorkspaceInfoResponse struct {
Response
Storage struct {
Used int64 `json:"used"`
Total int64 `json:"total"`
Free int64 `json:"free"`
} `json:"storage"`
}
WorkspaceInfoResponse is the response from GET /api/workspaces/:id
type WorkspaceListResponse ¶
WorkspaceListResponse is the response from GET /api/workspaces