Documentation
¶
Overview ¶
Package api has type definitions for kDrive
Converted from the API docs with help from https://mholt.github.io/json-to-go/
Index ¶
- type CancelResource
- type CancellableResponse
- type ChecksumFileResult
- type ChunkUploadResponse
- type CreateDirResult
- type FileCopyResponse
- type Item
- type ItemResult
- type PubLinkResult
- type PubLinkUpdateResult
- type QuotaInfo
- type ResultStatus
- type SearchResult
- type SessionCancelResponse
- type SessionFinishResponse
- type SessionStartResponse
- type Time
- type UploadFileResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancelResource ¶
type CancelResource struct {
CancelID string `json:"cancel_id"`
ValidUntil int `json:"valid_until"`
}
CancelResource is a kdrive resource that can be cancelled after some action
type CancellableResponse ¶
type CancellableResponse struct {
ResultStatus
Data CancelResource `json:"data"`
}
CancellableResponse is returned from kdrive when an action can be cancelled afterwards
type ChecksumFileResult ¶
type ChecksumFileResult struct {
ResultStatus
Data struct {
Hash string `json:"hash"`
} `json:"data"`
}
ChecksumFileResult is returned from kdrive after a call to Hash
type ChunkUploadResponse ¶
type ChunkUploadResponse struct {
ResultStatus
Data struct {
Hash string `json:"hash,omitempty"` // Only present when requested with with:'hash'
} `json:"data"`
}
ChunkUploadResponse is returned by kdrive after a chunk upload
type CreateDirResult ¶
type CreateDirResult struct {
ResultStatus
Data Item `json:"data"`
}
CreateDirResult is returned from kdrive after a call to MkDir
type FileCopyResponse ¶
type FileCopyResponse struct {
ResultStatus
Data Item `json:"data"`
}
FileCopyResponse is returned from kdrive after a call to Copy
type Item ¶
type Item struct {
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
FullPath string `json:"path"`
Status string `json:"status"`
Hash string `json:"hash"`
Size int64 `json:"size"`
Visibility string `json:"visibility"`
DriveID int `json:"drive_id"`
Depth int `json:"depth"`
CreatedBy int `json:"created_by"`
CreatedAt Time `json:"created_at"`
AddedAt int `json:"added_at"`
LastModifiedAt Time `json:"last_modified_at"`
LastModifiedBy int `json:"last_modified_by"`
RevisedAt int `json:"revised_at"`
UpdatedAt int `json:"updated_at"`
MimeType string `json:"mime_type"`
ParentID int `json:"parent_id"`
Color string `json:"color"`
}
Item describes a folder or a file as returned by Get Folder Items and others
type ItemResult ¶
type ItemResult struct {
ResultStatus
Data Item `json:"data"`
}
ItemResult is returned when an item is queried
type PubLinkResult ¶
type PubLinkResult struct {
ResultStatus
Data struct {
URL string `json:"url"`
FileID int `json:"file_id"`
Right string `json:"right"`
ValidUntil int `json:"valid_until"`
CreatedBy int `json:"created_by"`
CreatedAt int `json:"created_at"`
UpdatedAt int `json:"updated_at"`
Capabilities struct {
CanEdit bool `json:"can_edit"`
CanSeeStats bool `json:"can_see_stats"`
CanSeeInfo bool `json:"can_see_info"`
CanDownload bool `json:"can_download"`
CanComment bool `json:"can_comment"`
CanRequestAccess bool `json:"can_request_access"`
} `json:"capabilities"`
AccessBlocked bool `json:"access_blocked"`
} `json:"data"`
}
PubLinkResult is returned from kdrive after a call to public link API
type PubLinkUpdateResult ¶
type PubLinkUpdateResult struct {
ResultStatus
Data bool `json:"data"`
}
PubLinkUpdateResult is returned from kdrive after a updating a public link
type QuotaInfo ¶
type QuotaInfo struct {
ResultStatus
Data struct {
Size int64 `json:"size"`
UsedSize int64 `json:"used_size"`
} `json:"data"`
}
QuotaInfo is return from kdrive after a call get drive info
type ResultStatus ¶
type ResultStatus struct {
Status string `json:"result"`
ErrorDetail struct {
Result string `json:"code"`
ErrorString string `json:"description"`
Context struct {
Values []string `json:"values"`
} `json:"context"`
Errors []struct {
Result string `json:"code"`
ErrorString string `json:"description"`
} `json:"errors"`
} `json:"error"`
}
ResultStatus return error details from kdrive when things go wrong
If Status is "success" then everything is OK
func (*ResultStatus) Error ¶
func (e *ResultStatus) Error() string
Error returns a string for the error and satisfies the error interface
func (*ResultStatus) IsError ¶
func (e *ResultStatus) IsError() bool
IsError returns true if there is an error
func (*ResultStatus) Update ¶
func (e *ResultStatus) Update(err error) error
Update returns err directly if it was != nil, otherwise it returns an Error or nil if no error was detected
type SearchResult ¶
type SearchResult struct {
ResultStatus
Data []Item `json:"data"`
Cursor string `json:"cursor"`
HasMore bool `json:"has_more"`
ResponseAt int `json:"response_at"`
}
SearchResult is returned when a list of items is requested
type SessionCancelResponse ¶
type SessionCancelResponse struct {
ResultStatus
Data bool `json:"data"`
}
SessionCancelResponse is used to cancel a multichunk upload session
type SessionFinishResponse ¶
type SessionFinishResponse struct {
ResultStatus
Data struct {
Token string `json:"token"`
File Item `json:"file"`
Result bool `json:"result"`
Message string `json:"message"`
} `json:"data"`
}
SessionFinishResponse is used to end a multichunk upload session
type SessionStartResponse ¶
type SessionStartResponse struct {
ResultStatus
Data struct {
Token string `json:"token"`
UploadURL string `json:"upload_url"` // URL pour uploader les chunks
} `json:"data"`
}
SessionStartResponse is used to start a multichunk upload session
type Time ¶
Time represents unix timestamp date and time information for the kDrive API
func (*Time) UnmarshalJSON ¶
UnmarshalJSON turns JSON into a Time
type UploadFileResponse ¶
type UploadFileResponse struct {
ResultStatus
Data Item `json:"data"`
}
UploadFileResponse is returned from kdrive after a call to Upload