Documentation
¶
Overview ¶
Package client provides an HTTP client for the PicoShare API.
Index ¶
- type Client
- func (c *Client) CreateGuestLink(label, urlExpiration, fileLifetime string, maxFileBytes *uint64, ...) (*GuestLinkResponse, error)
- func (c *Client) DeleteFile(id string) error
- func (c *Client) DeleteGuestLink(id string) error
- func (c *Client) DisableGuestLink(id string) error
- func (c *Client) EnableGuestLink(id string) error
- func (c *Client) ListFiles() ([]FileEntry, error)
- func (c *Client) UploadFile(filePath, expiration, note string) (*UploadResponse, error)
- type FileEntry
- type GuestLinkResponse
- type UploadResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for the PicoShare API.
func (*Client) CreateGuestLink ¶
func (c *Client) CreateGuestLink(label, urlExpiration, fileLifetime string, maxFileBytes *uint64, maxUploads *int) (*GuestLinkResponse, error)
CreateGuestLink creates a new guest upload link.
func (*Client) DeleteFile ¶
DeleteFile deletes a file entry by ID.
func (*Client) DeleteGuestLink ¶
DeleteGuestLink deletes a guest link by ID.
func (*Client) DisableGuestLink ¶
DisableGuestLink disables a guest link.
func (*Client) EnableGuestLink ¶
EnableGuestLink enables a guest link.
func (*Client) ListFiles ¶
ListFiles retrieves the list of uploaded files by scraping the HTML file index page, since PicoShare has no JSON API for listing entries.
func (*Client) UploadFile ¶
func (c *Client) UploadFile(filePath, expiration, note string) (*UploadResponse, error)
UploadFile uploads a file to PicoShare.
type FileEntry ¶
type FileEntry struct {
ID string `json:"id"`
Filename string `json:"filename"`
Size string `json:"size"`
Uploaded string `json:"uploaded"`
Expires string `json:"expires"`
Note string `json:"note,omitempty"`
}
FileEntry represents a file entry in PicoShare.
type GuestLinkResponse ¶
type GuestLinkResponse struct {
ID string `json:"id"`
}
GuestLinkResponse holds the ID returned when creating a guest link.
type UploadResponse ¶
type UploadResponse struct {
ID string `json:"id"`
}
UploadResponse holds the ID returned after uploading a file.