Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type AccountInfo
- type AccountQuota
- type AccountService
- type AccountUsage
- type CategoryUsage
- type Client
- type File
- type Folder
- func (f *Folder) GetAllChildren(opts *NodeListOptions) ([]*Node, *http.Response, error)
- func (f *Folder) GetChildren(opts *NodeListOptions) ([]*Node, *http.Response, error)
- func (f *Folder) GetFile(name string) (*File, *http.Response, error)
- func (f *Folder) GetFolder(name string) (*Folder, *http.Response, error)
- func (f *Folder) GetNode(name string) (*Node, *http.Response, error)
- func (f *Folder) Upload(path, name string) (*File, *http.Response, error)
- func (f *Folder) WalkNodes(names ...string) (*Node, []*http.Response, error)
- type Node
- type NodeListOptions
- type NodesService
- type UsageNumbers
Constants ¶
const (
LibraryVersion = "0.1.0"
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range.
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 AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService provides access to the account related functions in the Amazon Cloud Drive API.
See: https://developer.amazon.com/public/apis/experience/cloud-drive/content/account
func (*AccountService) GetInfo ¶
func (s *AccountService) GetInfo() (*AccountInfo, *http.Response, error)
Provides information about the current user account like the status and the accepted “Terms Of Use”.
func (*AccountService) GetQuota ¶
func (s *AccountService) GetQuota() (*AccountQuota, *http.Response, error)
Gets account quota and storage availability information.
func (*AccountService) GetUsage ¶
func (s *AccountService) GetUsage() (*AccountUsage, *http.Response, error)
Gets Account Usage information broken down by content category.
type AccountUsage ¶
type AccountUsage struct { LastCalculated *time.Time `json:"lastCalculated"` Other *CategoryUsage `json:"other"` Doc *CategoryUsage `json:"doc"` Photo *CategoryUsage `json:"photo"` Video *CategoryUsage `json:"video"` }
AccountUsage represents information about the account usage.
type CategoryUsage ¶
type CategoryUsage struct { Total *UsageNumbers `json:"total"` Billable *UsageNumbers `json:"billable"` }
type Client ¶
type Client struct { // Metadata URL for API requests. Defaults to the public Amazon Cloud Drive API. // MetadataURL should always be specified with a trailing slash. MetadataURL *url.URL // Content URL for API requests. Defaults to the public Amazon Cloud Drive API. // ContentURL should always be specified with a trailing slash. ContentURL *url.URL // User agent used when communicating with the API. UserAgent string // Services used for talking to different parts of the API. Account *AccountService Nodes *NodesService // contains filtered or unexported fields }
A Client manages communication with the Amazon Cloud Drive API.
func NewClient ¶
NewClient returns a new Amazon Cloud Drive API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library).
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) NewContentRequest ¶
NewContentRequest creates an API request for content. A relative URL can be provided in urlStr, in which case it is resolved relative to the ContentURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
func (*Client) NewMetadataRequest ¶
NewMetadataRequest creates an API request for metadata. A relative URL can be provided in urlStr, in which case it is resolved relative to the MetadataURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type Folder ¶
type Folder struct {
*Node
}
Folder represents a folder on the Amazon Cloud Drive.
func (*Folder) GetAllChildren ¶
Gets the list of all children.
func (*Folder) GetChildren ¶
Gets a list of children, up until the limit (either default or the one set in opts).
func (*Folder) GetFolder ¶
Gets the subfolder by name. It is an error if not exactly one subfolder is found.
type Node ¶
type Node struct { Id *string `json:"id"` Name *string `json:"name"` Kind *string `json:"kind"` ContentProperties *struct { Size *uint64 `json:"size"` } `json:"contentProperties"` // contains filtered or unexported fields }
Node represents a digital asset on the Amazon Cloud Drive, including files and folders, in a parent-child relationship. A node contains only metadata (e.g. folder) or it contains metadata and content (e.g. file).
func (*Node) GetMetadata ¶
GetMetadata return a pretty-printed JSON string of the node's metadata
type NodeListOptions ¶
type NodeListOptions struct { Limit uint `url:"limit,omitempty"` Filters string `url:"filters,omitempty"` Sort string `url:"sort,omitempty"` // Token where to start for next page (internal) StartToken string `url:"startToken,omitempty"` // contains filtered or unexported fields }
NodeListOptions holds the options when getting a list of nodes, such as the filter, sorting and pagination.
type NodesService ¶
type NodesService struct {
// contains filtered or unexported fields
}
NodesService provides access to the nodes in the Amazon Cloud Drive API.
See: https://developer.amazon.com/public/apis/experience/cloud-drive/content/nodes
func (*NodesService) GetAllNodes ¶
func (s *NodesService) GetAllNodes(opts *NodeListOptions) ([]*Node, *http.Response, error)
Gets the list of all nodes.
func (*NodesService) GetNodes ¶
func (s *NodesService) GetNodes(opts *NodeListOptions) ([]*Node, *http.Response, error)
Gets a list of nodes, up until the limit (either default or the one set in opts).