Documentation
¶
Overview ¶
Package api is the Filez CLI's HTTP client to a Filez server.
Index ¶
- Variables
- type Client
- func (c *Client) AuthCheck() (bool, error)
- func (c *Client) Info() (*Info, error)
- func (c *Client) LivePush(sessionID, path string) error
- func (c *Client) LiveStart() (*LiveSession, error)
- func (c *Client) LiveStop(sessionID string) error
- func (c *Client) SyncClose(code, ownerToken string) error
- func (c *Client) SyncCreate() (*SyncBucket, error)
- func (c *Client) SyncDownload(code, fileID, dest string) (int64, error)
- func (c *Client) SyncList(code string) ([]SyncFile, error)
- func (c *Client) SyncUpload(code, path string) error
- func (c *Client) Upload(path string, opts UploadOptions, progress func(sent, total int64)) (*UploadResult, error)
- type Info
- type LiveSession
- type SyncBucket
- type SyncFile
- type UploadOptions
- type UploadResult
Constants ¶
This section is empty.
Variables ¶
var ErrBucketGone = errors.New("closed or unknown")
ErrBucketGone means the sync bucket no longer exists (closed or expired).
var ErrLiveGone = errors.New("live session not found")
ErrLiveGone means the live session no longer exists on the server.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client talks to one Filez server.
func (*Client) AuthCheck ¶
AuthCheck reports whether the client's access key is accepted (or the instance is public).
func (*Client) LivePush ¶
LivePush replaces the current frame of a live session with the given file. It returns ErrLiveGone if the session has ended server-side.
func (*Client) LiveStart ¶
func (c *Client) LiveStart() (*LiveSession, error)
LiveStart creates a new live session on the server.
func (*Client) SyncCreate ¶
func (c *Client) SyncCreate() (*SyncBucket, error)
SyncCreate creates a new sync bucket on the server.
func (*Client) SyncDownload ¶
SyncDownload downloads one file from a bucket to dest.
func (*Client) SyncUpload ¶
SyncUpload adds a file to a sync bucket (anyone with the code may do this).
func (*Client) Upload ¶
func (c *Client) Upload(path string, opts UploadOptions, progress func(sent, total int64)) (*UploadResult, error)
Upload streams a file to the server, reporting progress (bytes of the file sent) via the optional callback.
type Info ¶
type Info struct {
Filez bool `json:"filez"`
Version string `json:"version"`
Public bool `json:"public"`
AdminEnabled bool `json:"admin_enabled"`
DefaultUpload string `json:"default_upload"`
MaxUploadSize int64 `json:"max_upload_size"`
}
Info is the /api/info response.
type LiveSession ¶
type LiveSession struct {
SessionID string `json:"session_id"`
ViewerURL string `json:"viewer_url"`
}
LiveSession is the /api/live start response.
type SyncBucket ¶
type SyncBucket struct {
Code string `json:"code"`
OwnerToken string `json:"owner_token"`
URL string `json:"url"`
}
SyncBucket is the /api/sync create response.
type SyncFile ¶
type SyncFile struct {
ID string `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
MIME string `json:"mime"`
}
SyncFile is one file listed in a bucket.
type UploadOptions ¶
type UploadOptions struct {
Mode string // permanent | temp | limited
TTL string // for temp, e.g. "2d20m"
Downloads int // for limited
Password string // optional, any mode
Keep bool // exempt from idle cleanup (needs permission on private)
}
UploadOptions describe an upload request.