gyazo

package
v0.0.0-...-d7cadd1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// DefaultEndpint is the Gyazo API endpoint.
	DefaultEndpoint string

	// UploadEndpint is the Gyazo upload API endpoint.
	UploadEndpoint string
	// contains filtered or unexported fields
}

Client manages communication with the Gyazo API.

func NewClient

func NewClient(token string) (*Client, error)

NewClient returns a new Gyazo API client.

func (*Client) Delete

func (c *Client) Delete(id string) (*Image, error)

Delete an image.

func (*Client) List

func (c *Client) List(opts *ListOptions) (*List, error)

List lists the images the specified user.

func (*Client) Upload

func (c *Client) Upload(file io.Reader) (*Image, error)

Upload an image.

type ErrorResponse

type ErrorResponse struct {
	Status  string
	Message string `json:"message"`
}

ErrorResponse reports error caused by API request.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

Error returns the error response status and message.

type Image

type Image struct {
	ID           string `json:"image_id"`
	PermalinkURL string `json:"permalink_url"`
	ThumbURL     string `json:"thumb_url"`
	URL          string `json:"url"`
	Type         string `json:"type"`
	Star         bool   `json:"star"`
	CreatedAt    string `json:"created_at"`
}

Image represents an uploaded image.

Gyazo API docs: https://gyazo.com/api/docs/image

type List

type List struct {
	Meta   Meta
	Images *[]Image
}

List represents the returned images and http headers from an API request.

type ListOptions

type ListOptions struct {
	Page    int `url:"page,omitempty"`
	PerPage int `url:"per_page,omitempty"`
}

ListOptions specifies the optional parameters to an API request.

type Meta

type Meta struct {
	TotalCount  int
	CurrentPage int
	PerPage     int
	UserType    string
}

Meta represents the returned http headers from an API request.

Jump to

Keyboard shortcuts

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