smugmug

package module
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 17 Imported by: 2

README

smugmug

build codecov

A functional approach to the SmugMug API.

Design Philosophy

The design of this library (smugmug) is to separate the interactions with the SmugMug API as much as possible from the handling of the results. smugmug provides both low-level connectivity as well as higher-level abstractions for building applications. smugmug ships with no executable but a feature-rich application, ma, has been developed leveraging most of the library's APIs.

The APIs returning scalars and iterators are the most likely candidates for use but the lower-level functionality required to build the iterators, pages, is available if the need arises.

Expansions

A note on expansions. SmugMug's API provides an optimization to return some attributes of a request in a single call versus multiple. smugmug needs to explicitly support expansions and at this time not all are handled (though the primary use cases have been implemented). The expansions returning paged results will not be supported because it complicates the design and the number of results is limited so paging is almost always required anyway.

Singles

The methods User, Node, Album, and Image all return a single object by the primary key.

Pages

The plural methods of the above (eg, Nodes or Images) will return a page of results as well as the metadata required to page through all possible responses. These methods are provided as a building block for the iterators.

Iterators

The methods ending in Iter (eg, NodesIter or ImagesIter) use the paging methods to handle the iteration of all results and accept a typed callback function to provide a flexible mechanism for application-specific logic.

In addition to the Iter functions, the NodeService also supports iteration of parent and children nodes as well as providing Walk which allows the complete traversal of the node tree.

Documentation

Index

Constants

View Source
const (
	TypeAlbum  = "Album"
	TypeFolder = "Folder"
)

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(consumerKey, consumerSecret, accessToken, accessTokenSecret string) (*http.Client, error)

NewHTTPClient is a convenience function for creating an OAUTH1-compatible http client

func URLName

func URLName(name string, tags ...language.Tag) string

URLName returns `name` as a suitable URL name for a folder or album

Types

type APIEndpoint

type APIEndpoint struct {
	URI            string `json:"Uri"`
	Locator        string `json:"Locator"`
	LocatorType    string `json:"LocatorType"`
	URIDescription string `json:"UriDescription"`
	EndpointType   string `json:"EndpointType"`
}

type APIOption

type APIOption func(url.Values) error

APIOption for configuring API requests

func WithExpansions

func WithExpansions(expansions ...string) APIOption

WithExpansions requests expansions for single-entity queries

func WithFilters

func WithFilters(filters ...string) APIOption

WithFilters queries SmugMug for only the attributes in the filter list

func WithPagination

func WithPagination(start, count int) APIOption

WithPagination enables paging results for albums, nodes, and images

func WithSearch

func WithSearch(scope, text string) APIOption

WithSearch queries Smugmug for the text within the given scope The scope is a URI representing a user, album, node, or folder

func WithSorting

func WithSorting(direction, method string) APIOption

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"`
	Share                  bool       `json:"Share"`
	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"`
	CanShare               bool       `json:"CanShare"`
	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

type AlbumIterFunc func(*Album) (bool, error)

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]interface{}, options ...APIOption) (*Album, error)

Patch updates the metadata for `albumKey`

func (*AlbumService) Search

func (s *AlbumService) Search(ctx context.Context, options ...APIOption) ([]*Album, *Pages, error)

Search returns a single page of search results

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"`
	AlbumShareUris             *APIEndpoint `json:"AlbumShareUris"`
	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 Client

type Client struct {
	User   *UserService
	Node   *NodeService
	Album  *AlbumService
	Image  *ImageService
	Upload *UploadService
	// contains filtered or unexported fields
}

Client provides SmugMug connectivity

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient creates a new client and applies all provided Options

type Coordinate

type Coordinate float64

func (*Coordinate) UnmarshalJSON

func (c *Coordinate) UnmarshalJSON(b []byte) error

UnmarshalJSON converts the json value to a coordinate

type Fault

type Fault struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*Fault) Error

func (f *Fault) Error() string

type FormattedValue

type FormattedValue struct {
	HTML string `json:"html"`
	Text string `json:"text"`
}

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"`
	CanShare         bool             `json:"CanShare"`
	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"`
}

type ImageIterFunc

type ImageIterFunc func(*Image) (bool, error)

ImageIterFunc is called for iteration of images results

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

func (*ImageService) Patch

func (s *ImageService) Patch(
	ctx context.Context, imageKey string, data map[string]interface{}, options ...APIOption) (*Image, error)

Patch updates the metadata for `imageKey` The image is not updated; to update the image use the `Upload` service

type ImageSize

type ImageSize struct {
	URL    string `json:"Url,omitempty"`
	Ext    string `json:",omitempty"`
	Height int    `json:",omitempty"`
	Width  int    `json:",omitempty"`
	Size   int64  `json:",omitempty"`
}

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"`
	AlbumImageShareURIs           *APIEndpoint `json:"AlbumImageShareUris"`
	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

type NodeIterFunc func(*Node) (bool, error)

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) (*Node, error)

Create creates a node for the nodelet under the `parentID`

func (*NodeService) Node

func (s *NodeService) Node(ctx context.Context, nodeID string, options ...APIOption) (*Node, error)

Node returns the node with id `nodeID`

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) Search

func (s *NodeService) Search(
	ctx context.Context, options ...APIOption) ([]*Node, *Pages, error)

Search returns a single page of search results (does not traverse)

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 Nodelet

type Nodelet struct {
	Type    string `json:"Type"`
	Name    string `json:"Name"`
	URLName string `json:"UrlName"`
	Privacy string `json:"Privacy"`
}

type Option

type Option func(*Client) error

Option provides a configuration mechanism for a Client

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL specifies the base url

func WithConcurrency

func WithConcurrency(concurrency int) Option

WithConcurrency configures the number of concurrent upload goroutines

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets the underlying http client.

func WithHTTPTracing

func WithHTTPTracing(debug bool) Option

WithHTTPTracing enables tracing http calls.

func WithPretty

func WithPretty(pretty bool) Option

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

func WithUploadURL(uploadURL string) Option

WithUploadURL specifies the upload url

type Pages

type Pages struct {
	Total          int    `json:"Total"`
	Start          int    `json:"Start"`
	Count          int    `json:"Count"`
	RequestedCount int    `json:"RequestedCount"`
	FirstPage      string `json:"FirstPage"`
	LastPage       string `json:"LastPage"`
	NextPage       string `json:"NextPage"`
}

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"`
	QuickShare     bool     `json:"QuickShare"`
	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 UserService

type UserService service

UserService is the API for user endpoints

func (*UserService) AuthUser

func (s *UserService) AuthUser(ctx context.Context, options ...APIOption) (*User, error)

AuthUser returns the authorized user

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"`
}

Directories

Path Synopsis
uploadable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL