Documentation
¶
Overview ¶
Package acd represent an Amazon Cloud Drive client.
Index ¶
- type AccountInfo
- type AccountQuota
- type AccountUsage
- type Client
- func (c *Client) CheckResponse(res *http.Response) error
- func (c *Client) Close() error
- func (c *Client) Do(r *http.Request) (*http.Response, error)
- func (c *Client) Download(path string) (io.ReadCloser, error)
- func (c *Client) DownloadFolder(localPath, remotePath string, recursive bool) error
- func (c *Client) GetAccountInfo() (*AccountInfo, error)
- func (c *Client) GetAccountQuota() (*AccountQuota, error)
- func (c *Client) GetAccountUsage() (*AccountUsage, error)
- func (c *Client) GetContentURL(path string) string
- func (c *Client) GetMetadataURL(path string) string
- func (c *Client) GetNodeTree() *node.Tree
- func (c *Client) GetTrash() ([]*node.Node, error)
- func (c *Client) List(path string) (node.Nodes, error)
- func (c *Client) PurgeNodes(nodes []*node.Node) error
- func (c *Client) PurgeTrash() error
- func (c *Client) RefreshToken() error
- func (c *Client) Upload(filename string, overwrite bool, labels []string, properties node.Property, ...) (*node.Node, error)
- func (c *Client) UploadFolder(localPath, remotePath string, recursive, overwrite bool, labels []string, ...) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
AccountInfo represents information about an Amazon Cloud Drive account.
type AccountQuota ¶
type AccountQuota struct {
Quota uint64 `json:"quota"`
LastCalculated time.Time `json:"lastCalculated"`
Available uint64 `json:"available"`
}
AccountQuota represents information about the account quotas.
type AccountUsage ¶
type AccountUsage struct {
LastCalculated time.Time `json:"lastCalculated"`
Doc struct {
Billable struct {
Bytes uint64 `json:"bytes"`
Count uint64 `json:"count"`
} `json:"billable"`
Total struct {
Bytes uint64 `json:"bytes"`
Count uint64 `json:"count"`
} `json:"total"`
} `json:"doc"`
Other struct {
Billable struct {
Bytes uint64 `json:"bytes"`
Count uint64 `json:"count"`
} `json:"billable"`
Total struct {
Bytes uint64 `json:"bytes"`
Count uint64 `json:"count"`
} `json:"total"`
} `json:"other"`
Photo struct {
Billable struct {
Bytes uint64 `json:"bytes"`
Count uint64 `json:"count"`
} `json:"billable"`
Total struct {
Bytes uint64 `json:"bytes"`
Count uint64 `json:"count"`
} `json:"total"`
} `json:"photo"`
Video struct {
Billable struct {
Bytes uint64 `json:"bytes"`
Count uint64 `json:"count"`
} `json:"billable"`
Total struct {
Bytes uint64 `json:"bytes"`
Count uint64 `json:"count"`
} `json:"total"`
} `json:"video"`
}
AccountUsage represents information about the account usage.
func (*AccountUsage) Billable ¶
func (au *AccountUsage) Billable() (bytes uint64, count uint64)
func (*AccountUsage) Total ¶
func (au *AccountUsage) Total() (bytes uint64, count uint64)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a client for Amazon Cloud Drive.
func (*Client) CheckResponse ¶
CheckResponse validates the response from the Amazon Cloud Drive API. It does that by looking at the response's status code and it returns an error for any code lower than 200 or greater than 300
func (*Client) Do ¶
Do invokes net/http.Client.Do(). Refer to net/http.Client.Do() for documentation.
func (*Client) Download ¶
func (c *Client) Download(path string) (io.ReadCloser, error)
Download returns an io.ReadCloser for path. The caller is responsible for closing the body.
func (*Client) DownloadFolder ¶
DownloadFolder downloads an entire folder to a path, if recursive is true, it will also download all subfolders.
func (*Client) GetAccountInfo ¶
func (c *Client) GetAccountInfo() (*AccountInfo, error)
GetAccountInfo returns AccountInfo about the current account.
func (*Client) GetAccountQuota ¶
func (c *Client) GetAccountQuota() (*AccountQuota, error)
GetAccountQuota returns AccountQuota about the current account.
func (*Client) GetAccountUsage ¶
func (c *Client) GetAccountUsage() (*AccountUsage, error)
GetAccountUsage returns AccountUsage about the current account.
func (*Client) GetContentURL ¶
GetContentURL returns the content url.
func (*Client) GetMetadataURL ¶
GetMetadataURL returns the metadata url.
func (*Client) GetNodeTree ¶
GetNodeTree returns the nodeTree.
func (*Client) List ¶
List returns nodes.Nodes for all of the nodes underneath the path. It's up to the caller to differentiate between a file, a folder or an asset by using (*node.Node).IsFile(), (*node.Node).IsDir() and/or (*node.Node).IsAsset(). A dir has sub-nodes accessible via (*node.Node).Nodes, you do not need to call this this function for every sub-node.
func (*Client) PurgeNodes ¶
PurgeNodes will purge the provided nodes
func (*Client) PurgeTrash ¶
PurgeTrash will purge all nodes in the trash
func (*Client) RefreshToken ¶
func (*Client) Upload ¶
func (c *Client) Upload(filename string, overwrite bool, labels []string, properties node.Property, r io.Reader) (*node.Node, error)
Upload uploads io.Reader to the path defined by the filename. It will create any non-existing folders.
func (*Client) UploadFolder ¶
func (c *Client) UploadFolder(localPath, remotePath string, recursive, overwrite bool, labels []string, properties node.Property) error
UploadFolder uploads an entire folder. If recursive is true, it will recurse through the entire filetree under localPath. If overwrite is false and an existing file with the same md5 was found, an error will be returned.
type Config ¶
type Config struct {
// AppName is the name of the application to send to Amazon
AppName string `json:"appName"`
// AppVersion is the version of the application to send to Amazon
AppVersion string `json:"appVersion"`
// CacheFile represents the file used by the client to cache the NodeTree.
// This file is not assumed to be present and will be created on the first
// run. It is gob-encoded node.Node.
CacheFile string `json:"cacheFile"`
// Headers contains all the additional headers to pass on all requests made.
Headers map[string]string `json:"headers"`
// PurgeTrashInterval is how often to purge trash
PurgeTrashInterval string `json:"purgeTrashInterval"`
// RefreshToken is an Amazon API Refresh Token
// https://developer.amazon.com/docs/login-with-amazon/refresh-token.html
RefreshToken string `json:"refreshToken"`
// SyncChunkSize is the number of nodes to be returned within each Changes
// object in the response stream.
SyncChunkSize int `json:"syncChunkSize"`
// SyncInterval is how often to sync the Node Tree cache
SyncInterval string `json:"syncInterval"`
// Timeout configures the HTTP Client with a timeout after which the client
// will cancel the request and return. A timeout of 0 means no timeout.
// See http://godoc.org/net/http#Client for more information.
Timeout string `json:"timeout"`
// UserAgent is the value to use for the user agent header on all http requests
UserAgent string `json:"userAgent"`
// contains filtered or unexported fields
}
Config represents the clients configuration.