Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct { Created time.Time `json:"created"` Title string `json:"title"` Body *string `json:"body"` HTMLBody *template.HTML `json:"html_body"` Alias string `json:"alias"` Views int64 `json:"views"` Photos []Photo `json:"photos"` }
Album represents a Snap.as photo album / gallery.
type Client ¶
Client is used to interact with the Snap.as API.
func NewClient ¶
NewClient creates a new API client. All requests must be authenticated, so you should supply a user access token returned from the Write.as API library (github.com/writeas/go-writeas/v2)
wc := writeas.NewClient() u, err := wc.LogIn("username", "password") if err != nil { // Handle error... } sc := snapas.NewClient(u.AccessToken)
func NewClientWith ¶
func NewClientWith(cfg *as.ClientConfig, token string) *Client
NewClientWith builds a new API client with the provided configuration.
func NewDevClient ¶
NewDevClient creates a new API client for development and testing. It will communicate with our development servers, and SHOULD NOT be used in production.
func (*Client) UploadPhoto ¶
func (c *Client) UploadPhoto(sp *PhotoParams) (*Photo, error)
UploadPhoto uploads a photo, and returns a Snap.as Photo. See: https://developers.snap.as/docs/api/#upload-a-photo
type Photo ¶
type Photo struct { ID string `json:"id"` Created time.Time `json:"created"` Body *string `json:"body"` Filename string `json:"filename"` Size int64 `json:"size"` URL string `json:"url"` Album *Album `json:"album"` }
Photo represents a photo on Snap.as.
type PhotoParams ¶
type PhotoParams struct {
FileName string
}
PhotoParams holds valid values for uploading photos.