Documentation
¶
Index ¶
- Constants
- func NewHTTPClient(consumerKey, consumerSecret, accessToken, accessTokenSecret string) (*http.Client, error)
- func URLName(name string, tags ...language.Tag) string
- type APIEndpoint
- type APIOption
- type Album
- type AlbumIterFunc
- type AlbumService
- func (s *AlbumService) Album(ctx context.Context, albumKey string, options ...APIOption) (*Album, error)
- func (s *AlbumService) Albums(ctx context.Context, userID string, options ...APIOption) ([]*Album, *Pages, error)
- func (s *AlbumService) AlbumsIter(ctx context.Context, userID string, iter AlbumIterFunc, options ...APIOption) error
- func (s *AlbumService) Patch(ctx context.Context, albumKey string, data map[string]any, ...) (*Album, error)
- func (s *AlbumService) Search(ctx context.Context, options ...APIOption) ([]*Album, *Pages, error)
- func (s *AlbumService) SearchIter(ctx context.Context, iter AlbumIterFunc, options ...APIOption) error
- type AlbumURIs
- type Altitude
- type Client
- type Coordinate
- type Fault
- type FormattedValue
- type FormattedValues
- type ISO
- type Image
- type ImageExpandFunc
- type ImageIterFunc
- type ImageMetadata
- type ImageService
- func (s *ImageService) Delete(ctx context.Context, albumKey, imageKey string, options ...APIOption) (bool, error)
- func (s *ImageService) Image(ctx context.Context, imageKey string, options ...APIOption) (*Image, error)
- func (s *ImageService) Images(ctx context.Context, albumKey string, options ...APIOption) ([]*Image, *Pages, error)
- func (s *ImageService) ImagesIter(ctx context.Context, albumKey string, iter ImageIterFunc, options ...APIOption) error
- func (s *ImageService) Patch(ctx context.Context, imageKey string, data map[string]any, ...) (*Image, error)
- type ImageSize
- type ImageSizeDetails
- type ImageSizes
- type ImageURIs
- type Node
- type NodeIterFunc
- type NodeService
- func (s *NodeService) Children(ctx context.Context, nodeID string, options ...APIOption) ([]*Node, *Pages, error)
- func (s *NodeService) ChildrenIter(ctx context.Context, nodeID string, iter NodeIterFunc, options ...APIOption) error
- func (s *NodeService) Create(ctx context.Context, parentID string, nodelet *Nodelet, options ...APIOption) (*Node, error)
- func (s *NodeService) Node(ctx context.Context, nodeID string, options ...APIOption) (*Node, error)
- func (s *NodeService) Parent(ctx context.Context, nodeID string, options ...APIOption) (*Node, error)
- func (s *NodeService) Parents(ctx context.Context, nodeID string, options ...APIOption) ([]*Node, *Pages, error)
- func (s *NodeService) ParentsIter(ctx context.Context, nodeID string, iter NodeIterFunc, options ...APIOption) error
- func (s *NodeService) Search(ctx context.Context, options ...APIOption) ([]*Node, *Pages, error)
- func (s *NodeService) SearchIter(ctx context.Context, iter NodeIterFunc, options ...APIOption) error
- func (s *NodeService) Walk(ctx context.Context, nodeID string, fn NodeIterFunc, options ...APIOption) error
- func (s *NodeService) WalkN(ctx context.Context, nodeID string, fn NodeIterFunc, depth int, ...) error
- type NodeURIs
- type Nodelet
- type Option
- type Pages
- type Upload
- type UploadService
- type Uploadable
- type Uploadables
- type User
- type UserService
- type UserURIs
Constants ¶
const ( TypeAlbum = "Album" TypeFolder = "Folder" // MaxURLName is the longest URL name SmugMug accepts for a node MaxURLName = 60 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIEndpoint ¶
type APIOption ¶
APIOption for configuring API requests
func WithExpansions ¶
WithExpansions requests expansions for single-entity queries
func WithFilters ¶
WithFilters queries SmugMug for only the attributes in the filter list
func WithPagination ¶
WithPagination enables paging results for albums, nodes, and images
func WithSearch ¶
WithSearch queries Smugmug for the text within the given scope The scope is a URI representing a user, album, node, or folder
func WithSorting ¶
WithSorting specifies sorting direction and method The allowable values change with the context (eg albums, nodes, folders)
type Album ¶
type Album struct {
// NiceName string `json:"NiceName"` // deprecated, use URLName
// Title string `json:"Title"` // deprecated, use Name
URLName string `json:"UrlName"`
Name string `json:"Name"`
TemplateURI string `json:"TemplateUri"`
AllowDownloads bool `json:"AllowDownloads"`
Backprinting string `json:"Backprinting"`
BoutiquePackaging string `json:"BoutiquePackaging"`
CanRank bool `json:"CanRank"`
Clean bool `json:"Clean"`
Comments bool `json:"Comments"`
Description string `json:"Description"`
EXIF bool `json:"EXIF"`
External bool `json:"External"`
FamilyEdit bool `json:"FamilyEdit"`
Filenames bool `json:"Filenames"`
FriendEdit bool `json:"FriendEdit"`
Geography bool `json:"Geography"`
Header string `json:"Header"`
HideOwner bool `json:"HideOwner"`
InterceptShipping string `json:"InterceptShipping"`
Keywords string `json:"Keywords"`
LargestSize string `json:"LargestSize"`
PackagingBranding bool `json:"PackagingBranding"`
Password string `json:"Password"`
PasswordHint string `json:"PasswordHint"`
Printable bool `json:"Printable"`
Privacy string `json:"Privacy"`
ProofDays int `json:"ProofDays"`
ProofDigital bool `json:"ProofDigital"`
Protected bool `json:"Protected"`
Slideshow bool `json:"Slideshow"`
SmugSearchable string `json:"SmugSearchable"`
SortDirection string `json:"SortDirection"`
SortMethod string `json:"SortMethod"`
SquareThumbs bool `json:"SquareThumbs"`
Watermark bool `json:"Watermark"`
WorldSearchable bool `json:"WorldSearchable"`
SecurityType string `json:"SecurityType"`
CommerceLightbox bool `json:"CommerceLightbox"`
HighlightAlbumImageURI string `json:"HighlightAlbumImageUri"`
AlbumKey string `json:"AlbumKey"`
CanBuy bool `json:"CanBuy"`
CanFavorite bool `json:"CanFavorite"`
Date *time.Time `json:"Date"`
LastUpdated *time.Time `json:"LastUpdated"`
ImagesLastUpdated *time.Time `json:"ImagesLastUpdated"`
NodeID string `json:"NodeID"`
OriginalSizes int `json:"OriginalSizes"`
TotalSizes int `json:"TotalSizes"`
ImageCount int `json:"ImageCount"`
URLPath string `json:"UrlPath"`
HasDownloadPassword bool `json:"HasDownloadPassword"`
Packages bool `json:"Packages"`
URI string `json:"Uri"`
WebURI string `json:"WebUri"`
URIDescription string `json:"UriDescription"`
URIs AlbumURIs `json:"Uris"`
ResponseLevel string `json:"ResponseLevel"`
// expansions
User *User `json:"User"`
Node *Node `json:"Node"`
HighlightImage *Image `json:"HighlightImage"`
}
type AlbumIterFunc ¶
AlbumIterFunc is called for each album in the results
type AlbumService ¶
type AlbumService service
AlbumService is the API for album endpoints
func (*AlbumService) Album ¶
func (s *AlbumService) Album(ctx context.Context, albumKey string, options ...APIOption) (*Album, error)
Album returns the album with key `albumKey`
func (*AlbumService) Albums ¶
func (s *AlbumService) Albums(ctx context.Context, userID string, options ...APIOption) ([]*Album, *Pages, error)
Albums returns a single page of albums for the user
func (*AlbumService) AlbumsIter ¶
func (s *AlbumService) AlbumsIter(ctx context.Context, userID string, iter AlbumIterFunc, options ...APIOption) error
AlbumsIter iterates all albums for the user
func (*AlbumService) Patch ¶ added in v0.3.0
func (s *AlbumService) Patch( ctx context.Context, albumKey string, data map[string]any, options ...APIOption) (*Album, error)
Patch updates the metadata for `albumKey`
func (*AlbumService) SearchIter ¶
func (s *AlbumService) SearchIter(ctx context.Context, iter AlbumIterFunc, options ...APIOption) error
SearchIter iterates all search results The results of this query might be very large depending on the scope and query
type AlbumURIs ¶
type AlbumURIs struct {
// Folder *APIEndpoint `json:"Folder"`
// ParentFolders *APIEndpoint `json:"ParentFolders"`
Node *APIEndpoint `json:"Node"`
NodeCoverImage *APIEndpoint `json:"NodeCoverImage"`
User *APIEndpoint `json:"User"`
HighlightImage *APIEndpoint `json:"HighlightImage"`
AddSamplePhotos *APIEndpoint `json:"AddSamplePhotos"`
AlbumHighlightImage *APIEndpoint `json:"AlbumHighlightImage"`
AlbumImages *APIEndpoint `json:"AlbumImages"`
AlbumPopularMedia *APIEndpoint `json:"AlbumPopularMedia"`
AlbumGeoMedia *APIEndpoint `json:"AlbumGeoMedia"`
AlbumComments *APIEndpoint `json:"AlbumComments"`
MoveAlbumImages *APIEndpoint `json:"MoveAlbumImages"`
CollectImages *APIEndpoint `json:"CollectImages"`
ApplyAlbumTemplate *APIEndpoint `json:"ApplyAlbumTemplate"`
DeleteAlbumImages *APIEndpoint `json:"DeleteAlbumImages"`
UploadFromExternalResource *APIEndpoint `json:"UploadFromExternalResource"`
UploadFromURI *APIEndpoint `json:"UploadFromUri"`
AlbumGrants *APIEndpoint `json:"AlbumGrants"`
AlbumDownload *APIEndpoint `json:"AlbumDownload"`
AlbumPrices *APIEndpoint `json:"AlbumPrices"`
AlbumPricelistExclusions *APIEndpoint `json:"AlbumPricelistExclusions"`
}
type Altitude ¶ added in v0.8.0
type Altitude string
func (*Altitude) UnmarshalJSON ¶ added in v0.8.0
type Client ¶
type Client struct {
User *UserService
Node *NodeService
Album *AlbumService
Image *ImageService
Upload *UploadService
// contains filtered or unexported fields
}
Client provides SmugMug connectivity
type Coordinate ¶
type Coordinate float64
func (*Coordinate) UnmarshalJSON ¶
func (c *Coordinate) UnmarshalJSON(b []byte) error
UnmarshalJSON converts the json value to a coordinate
type FormattedValue ¶
type FormattedValues ¶
type FormattedValues struct {
Name *FormattedValue `json:"Name"`
Description *FormattedValue `json:"Description"`
}
type Image ¶
type Image struct {
// Date *time.Time `json:"Date"` // deprecated, use DateTimeUploaded
// Watermark string `json:"Watermark"` // deprecated
Title string `json:"Title"`
Caption string `json:"Caption"`
Keywords string `json:"Keywords"`
KeywordArray []string `json:"KeywordArray"`
Latitude Coordinate `json:"Latitude"`
Longitude Coordinate `json:"Longitude"`
Altitude int `json:"Altitude"`
Hidden bool `json:"Hidden"`
ThumbnailURL string `json:"ThumbnailUrl"`
FileName string `json:"FileName"`
Processing bool `json:"Processing"`
UploadKey string `json:"UploadKey"`
DateTimeUploaded *time.Time `json:"DateTimeUploaded"`
DateTimeOriginal *time.Time `json:"DateTimeOriginal"`
Format string `json:"Format"`
OriginalHeight int `json:"OriginalHeight"`
OriginalWidth int `json:"OriginalWidth"`
OriginalSize int `json:"OriginalSize"`
LastUpdated *time.Time `json:"LastUpdated"`
Collectable bool `json:"Collectable"`
IsArchive bool `json:"IsArchive"`
IsVideo bool `json:"IsVideo"`
CanEdit bool `json:"CanEdit"`
CanBuy bool `json:"CanBuy"`
Protected bool `json:"Protected"`
ImageKey string `json:"ImageKey"`
Serial int `json:"Serial"`
ArchivedURI string `json:"ArchivedUri"`
ArchivedSize int `json:"ArchivedSize"`
ArchivedMD5 string `json:"ArchivedMD5"`
Comments bool `json:"Comments"`
ShowKeywords bool `json:"ShowKeywords"`
FormattedValues *FormattedValues `json:"FormattedValues"`
URI string `json:"Uri"`
URIDescription string `json:"UriDescription"`
URIs ImageURIs `json:"Uris"`
Movable bool `json:"Movable"`
Origin string `json:"Origin"`
WebURI string `json:"WebUri"`
// expansions
Album *Album `json:"Album"`
ImageSizeDetails *ImageSizeDetails `json:"ImageSizeDetails"`
ImageMetadata *ImageMetadata `json:"ImageMetadata"`
}
type ImageExpandFunc ¶ added in v0.8.0
type ImageIterFunc ¶
ImageIterFunc is called for iteration of images results
type ImageMetadata ¶ added in v0.8.0
type ImageMetadata struct {
Title string `json:"Title"`
Caption string `json:"Caption"`
UserComment string `json:"UserComment"`
Keywords string `json:"Keywords"`
Author string `json:"Author"`
Copyright string `json:"Copyright"`
CopyrightURL string `json:"CopyrightUrl"`
CopyrightFlag string `json:"CopyrightFlag"`
UsageTerms string `json:"UsageTerms"`
Source string `json:"Source"`
Credit string `json:"Credit"`
City string `json:"City"`
State string `json:"State"`
Country string `json:"Country"`
Rating string `json:"Rating"`
Category string `json:"Category"`
SupplementalCategories string `json:"SupplementalCategories"`
SpecialInstructions string `json:"SpecialInstructions"`
AuthorTitle string `json:"AuthorTitle"`
CountryCode string `json:"CountryCode"`
TransmissionReference string `json:"TransmissionReference"`
Headline string `json:"Headline"`
WriterEditor string `json:"WriterEditor"`
Lens string `json:"Lens"`
Make string `json:"Make"`
Model string `json:"Model"`
Aperture string `json:"Aperture"`
DateTimeModified string `json:"DateTimeModified"`
DateTimeCreated string `json:"DateTimeCreated"`
DateCreated string `json:"DateCreated"`
TimeCreated string `json:"TimeCreated"`
MicroDateTimeCreated string `json:"MicroDateTimeCreated"`
MicroDateTimeDigitized string `json:"MicroDateTimeDigitized"`
DateDigitized string `json:"DateDigitized"`
Exposure string `json:"Exposure"`
ISO ISO `json:"ISO"`
FocalLength string `json:"FocalLength"`
FocalLength35Mm string `json:"FocalLength35mm"`
CompressedBitsPerPixel string `json:"CompressedBitsPerPixel"`
Flash string `json:"Flash"`
Metering string `json:"Metering"`
ExposureProgram string `json:"ExposureProgram"`
ExposureCompensation string `json:"ExposureCompensation"`
ExposureMode string `json:"ExposureMode"`
LightSource string `json:"LightSource"`
WhiteBalance string `json:"WhiteBalance"`
DigitalZoomRatio string `json:"DigitalZoomRatio"`
Contrast string `json:"Contrast"`
Saturation string `json:"Saturation"`
Sharpness string `json:"Sharpness"`
SubjectDistance string `json:"SubjectDistance"`
SubjectRange string `json:"SubjectRange"`
SensingMethod string `json:"SensingMethod"`
ColorSpace string `json:"ColorSpace"`
Brightness string `json:"Brightness"`
LatitudeReference string `json:"LatitudeReference"`
LongitudeReference string `json:"LongitudeReference"`
Latitude float64 `json:"Latitude"`
Longitude float64 `json:"Longitude"`
AltitudeReference string `json:"AltitudeReference"`
Altitude Altitude `json:"Altitude"`
SceneCaptureType string `json:"SceneCaptureType"`
GainControl string `json:"GainControl"`
ScaleFactor string `json:"ScaleFactor"`
CircleOfConfusion string `json:"CircleOfConfusion"`
FieldOfView string `json:"FieldOfView"`
DepthOfField string `json:"DepthOfField"`
HyperfocalDistance string `json:"HyperfocalDistance"`
NormalizedLightValue string `json:"NormalizedLightValue"`
Duration string `json:"Duration"`
AudioCodec string `json:"AudioCodec"`
VideoCodec string `json:"VideoCodec"`
Software string `json:"Software"`
SerialNumber string `json:"SerialNumber"`
LensSerialNumber string `json:"LensSerialNumber"`
URI string `json:"Uri"`
URIDescription string `json:"UriDescription"`
}
type ImageService ¶
type ImageService service
ImageService is the API for image endpoints
func (*ImageService) Delete ¶ added in v0.5.1
func (s *ImageService) Delete(ctx context.Context, albumKey, imageKey string, options ...APIOption) (bool, error)
Delete deletes the image for `imageKey` from `albumKey`
func (*ImageService) Image ¶
func (s *ImageService) Image(ctx context.Context, imageKey string, options ...APIOption) (*Image, error)
Image returns the image for `imageKey`
func (*ImageService) Images ¶
func (s *ImageService) Images( ctx context.Context, albumKey string, options ...APIOption) ([]*Image, *Pages, error)
Images returns a single page of image results for the album
func (*ImageService) ImagesIter ¶
func (s *ImageService) ImagesIter( ctx context.Context, albumKey string, iter ImageIterFunc, options ...APIOption) error
ImagesIter iterates all images in the album
type ImageSizeDetails ¶
type ImageSizeDetails struct {
ImageSizeLarge *ImageSize `json:",omitempty"`
ImageSizeMedium *ImageSize `json:",omitempty"`
ImageSizeOriginal *ImageSize `json:",omitempty"`
ImageSizeSmall *ImageSize `json:",omitempty"`
ImageSizeThumb *ImageSize `json:",omitempty"`
ImageSizeTiny *ImageSize `json:",omitempty"`
ImageSizeX2Large *ImageSize `json:",omitempty"`
ImageSizeX3Large *ImageSize `json:",omitempty"`
ImageSizeXLarge *ImageSize `json:",omitempty"`
ImageURLTemplate string `json:"ImageUrlTemplate,omitempty"`
UsableSizes []string `json:",omitempty"`
URI string `json:"Uri,omitempty"`
URIDescription string `json:"UriDescription,omitempty"`
}
type ImageSizes ¶
type ImageSizes struct {
LargeImageURL string `json:"LargeImageUrl,omitempty"`
LargestImageURL string `json:"LargestImageUrl,omitempty"`
MediumImageURL string `json:"MediumImageUrl,omitempty"`
OriginalImageURL string `json:"OriginalImageUrl,omitempty"`
SmallImageURL string `json:"SmallImageUrl,omitempty"`
ThumbImageURL string `json:"ThumbImageUrl,omitempty"`
TinyImageURL string `json:"TinyImageUrl,omitempty"`
X2LargeImageURL string `json:"X2LargeImageUrl,omitempty"`
X3LargeImageURL string `json:"X3LargeImageUrl,omitempty"`
XLargeImageURL string `json:"XLargeImageUrl,omitempty"`
URI string `json:"Uri,omitempty"`
URIDescription string `json:"UriDescription,omitempty"`
}
type ImageURIs ¶
type ImageURIs struct {
// Album and ImageAlbum are used in different context but should be identical
Album *APIEndpoint `json:"Album"`
AlbumImageMetadata *APIEndpoint `json:"AlbumImageMetadata"`
AlbumImagePricelistExclusions *APIEndpoint `json:"AlbumImagePricelistExclusions"`
Image *APIEndpoint `json:"Image"`
ImageAlbum *APIEndpoint `json:"ImageAlbum"`
ImageComments *APIEndpoint `json:"ImageComments"`
ImageMetadata *APIEndpoint `json:"ImageMetadata"`
ImagePricelistExclusions *APIEndpoint `json:"ImagePricelistExclusions"`
ImagePrices *APIEndpoint `json:"ImagePrices"`
ImageSizeDetails *APIEndpoint `json:"ImageSizeDetails"`
ImageSizes *APIEndpoint `json:"ImageSizes"`
LargestImage *APIEndpoint `json:"LargestImage"`
PointOfInterest *APIEndpoint `json:"PointOfInterest"`
PointOfInterestCrops *APIEndpoint `json:"PointOfInterestCrops"`
Regions *APIEndpoint `json:"Regions"`
}
type Node ¶
type Node struct {
Nodelet
CoverImageURI string `json:"CoverImageUri"`
Description string `json:"Description"`
HideOwner bool `json:"HideOwner"`
HighlightImageURI string `json:"HighlightImageUri"`
Keywords []string `json:"Keywords"`
Password string `json:"Password"`
PasswordHint string `json:"PasswordHint"`
SecurityType string `json:"SecurityType"`
ShowCoverImage bool `json:"ShowCoverImage"`
SmugSearchable string `json:"SmugSearchable"`
SortDirection string `json:"SortDirection"`
SortMethod string `json:"SortMethod"`
WorldSearchable string `json:"WorldSearchable"`
DateAdded *time.Time `json:"DateAdded"`
DateModified *time.Time `json:"DateModified"`
EffectivePrivacy string `json:"EffectivePrivacy"`
EffectiveSecurityType string `json:"EffectiveSecurityType"`
FormattedValues *FormattedValues `json:"FormattedValues"`
HasChildren bool `json:"HasChildren"`
IsRoot bool `json:"IsRoot"`
NodeID string `json:"NodeID"`
URLPath string `json:"UrlPath"`
URI string `json:"Uri"`
WebURI string `json:"WebUri"`
URIDescription string `json:"UriDescription"`
URIs NodeURIs `json:"Uris"`
ResponseLevel string `json:"ResponseLevel"`
// expansions
User *User `json:"User"`
Album *Album `json:"Album"`
Parent *Node `json:"Parent"`
HighlightImage *Image `json:"HighlightImage"`
}
type NodeIterFunc ¶
NodeIterFunc is called for each node in the results
type NodeService ¶
type NodeService service
NodeService is the API for node endpoints
func (*NodeService) Children ¶
func (s *NodeService) Children( ctx context.Context, nodeID string, options ...APIOption) ([]*Node, *Pages, error)
Children returns a single page of direct children of the node (does not traverse)
func (*NodeService) ChildrenIter ¶
func (s *NodeService) ChildrenIter( ctx context.Context, nodeID string, iter NodeIterFunc, options ...APIOption) error
ChildrenIter iterates all direct children of the node
func (*NodeService) Create ¶
func (s *NodeService) Create( ctx context.Context, parentID string, nodelet *Nodelet, options ...APIOption) (*Node, error)
Create creates a node for the nodelet under the `parentID`
Expansions are only populated when requested, e.g. `WithExpansions("Album")` to populate `Node.Album` for a newly created album
func (*NodeService) Parent ¶
func (s *NodeService) Parent( ctx context.Context, nodeID string, options ...APIOption) (*Node, error)
Parent returns the parent node
func (*NodeService) Parents ¶
func (s *NodeService) Parents( ctx context.Context, nodeID string, options ...APIOption) ([]*Node, *Pages, error)
Parents returns a single page of parent nodes (does not traverse)
func (*NodeService) ParentsIter ¶
func (s *NodeService) ParentsIter( ctx context.Context, nodeID string, iter NodeIterFunc, options ...APIOption) error
ParentsIter iterates all parental ancestors
func (*NodeService) SearchIter ¶
func (s *NodeService) SearchIter( ctx context.Context, iter NodeIterFunc, options ...APIOption) error
SearchIter iterates all search results
func (*NodeService) Walk ¶
func (s *NodeService) Walk( ctx context.Context, nodeID string, fn NodeIterFunc, options ...APIOption) error
Walk traverses all children of the node rooted at `nodeID`
func (*NodeService) WalkN ¶
func (s *NodeService) WalkN( ctx context.Context, nodeID string, fn NodeIterFunc, depth int, options ...APIOption) error
WalkN traverses all children of the node rooted at `nodeID` to the specified depth
type NodeURIs ¶
type NodeURIs struct {
// FolderByID *APIEndpoint `json:"FolderByID"`
Album *APIEndpoint `json:"Album"`
Children *APIEndpoint `json:"ChildNodes"`
HighlightImage *APIEndpoint `json:"HighlightImage"`
MoveNodes *APIEndpoint `json:"MoveNodes"`
NodeComments *APIEndpoint `json:"NodeComments"`
NodeCoverImage *APIEndpoint `json:"NodeCoverImage"`
NodeGrants *APIEndpoint `json:"NodeGrants"`
NodePageDesign *APIEndpoint `json:"NodePageDesign"`
Parent *APIEndpoint `json:"ParentNode"`
Parents *APIEndpoint `json:"ParentNodes"`
User *APIEndpoint `json:"User"`
}
type Option ¶
Option provides a configuration mechanism for a Client.
func WithConcurrency ¶
WithConcurrency configures the number of concurrent upload goroutines
func WithHTTPClient ¶
WithHTTPClient sets the underlying http client.
func WithHTTPTracing ¶
WithHTTPTracing enables tracing http calls.
func WithPretty ¶
WithPretty enable indention of the req/res from SmugMug (useful for debugging)
func WithTransport ¶
func WithTransport(t http.RoundTripper) Option
WithTransport sets the underlying http client transport.
func WithUploadURL ¶
WithUploadURL specifies the upload url
type Upload ¶
type Upload struct {
// Status of the request
Status string `json:"Status"`
// Method is action performed
Method string `json:"Method"`
// ImageURI is the uri of the object
ImageURI string `json:"ImageUri"`
// Elapsed time of the upload
Elapsed time.Duration `json:"Elapsed"`
// AlbumImageURI is the uri of the object in the album
AlbumImageURI string `json:"AlbumImageUri"`
// URL is the url of the uploaded object
URL string `json:"URL"`
// Uploadable is the object being uploaded
Uploadable *Uploadable `json:"Uploadable"`
}
Upload is the object details for the uploaded object
type UploadService ¶
type UploadService service
UploadService is the API for the upload endpoint
func (*UploadService) Upload ¶
func (s *UploadService) Upload(ctx context.Context, up *Uploadable) (*Upload, error)
Upload an image to an album
func (*UploadService) Uploads ¶
func (s *UploadService) Uploads(ctx context.Context, uploadables Uploadables) (<-chan *Upload, <-chan error)
Uploads consumes Uploadables from uploadables, uploads them to SmugMug returning status in Upload instances
type Uploadable ¶
type Uploadable struct {
// Name is the basename of the image (not the full path)
Name string `json:"Name"`
// Size is the size in bytes
Size int64 `json:"Size"`
// MD5 is the hash of the file contents
MD5 string `json:"MD5"`
// Replaces is the URI of an image to replace
Replaces string `json:"Replaces"`
// AlbumKey is the album into which the file will be uploaded
AlbumKey string `json:"AlbumKey"`
// Reader holds the image data for uploading
Reader io.Reader `json:"-"`
}
Uploadable holds the details about an image suitable for upload
type Uploadables ¶
type Uploadables interface {
// Uploadables returns a channel of Uploadable instances
Uploadables(context.Context) (<-chan *Uploadable, <-chan error)
}
Uploadables is a factory for Uploadable instances
type User ¶
type User struct {
NickName string `json:"NickName"`
ViewPassHint string `json:"ViewPassHint"`
RefTag string `json:"RefTag"`
Name string `json:"Name"`
URI string `json:"Uri"`
WebURI string `json:"WebUri"`
URIDescription string `json:"UriDescription"`
URIs UserURIs `json:"Uris"`
ResponseLevel string `json:"ResponseLevel"`
// expansions
Node *Node `json:"Node"`
}
type UserURIs ¶
type UserURIs struct {
// Folder *APIEndpoint `json:"Folder"`
BioImage *APIEndpoint `json:"BioImage"`
CoverImage *APIEndpoint `json:"CoverImage"`
Features *APIEndpoint `json:"Features"`
Node *APIEndpoint `json:"Node"`
SiteSettings *APIEndpoint `json:"SiteSettings"`
URLPathLookup *APIEndpoint `json:"UrlPathLookup"`
UserAlbums *APIEndpoint `json:"UserAlbums"`
UserFeaturedAlbums *APIEndpoint `json:"UserFeaturedAlbums"`
UserGeoMedia *APIEndpoint `json:"UserGeoMedia"`
UserImageSearch *APIEndpoint `json:"UserImageSearch"`
UserPopularMedia *APIEndpoint `json:"UserPopularMedia"`
UserProfile *APIEndpoint `json:"UserProfile"`
UserRecentImages *APIEndpoint `json:"UserRecentImages"`
UserTopKeywords *APIEndpoint `json:"UserTopKeywords"`
}