gyan

package module
v0.0.0-...-4b2a440 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 12 Imported by: 0

README

gyan

🚧 work in progress 🚧

Gyazo API client

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token string) *Client

func (*Client) SetHttpClient

func (c *Client) SetHttpClient(hc *http.Client)

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, request *UploadRequest) (*UploadedImage, error)

type ErrorResponse

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

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type InternalClient

type InternalClient struct {
	// contains filtered or unexported fields
}

func NewInternalClient

func NewInternalClient(session string) *InternalClient

func (*InternalClient) Search

func (c *InternalClient) Search(ctx context.Context, query string, page int) ([]*SearchedImage, error)

func (*InternalClient) Update

func (c *InternalClient) Update(ctx context.Context, ureq *UpdateImageRequest) error

type SearchImageMetadata

type SearchImageMetadata struct {
	App        string `json:"app,omitempty"`
	Desc       string `json:"desc,omitempty"`
	OCRStarted bool   `json:"ocr_started,omitempty"`
	Title      string `json:"title,omitempty"`
	URL        string `json:"url,omitempty"`
}

type SearchedImage

type SearchedImage struct {
	ID           string               `json:"image_id"`
	PermalinkURL string               `json:"permalink_url"`
	ThumbURL     string               `json:"thumb_url"`
	URL          string               `json:"url"`
	Metadata     *SearchImageMetadata `json:"metadata"`
	Owned        bool                 `json:"owned"`
	AccessPolicy string               `json:"access_policy"`
	Accessible   bool                 `json:"accessible"`
	CreatedAt    time.Time            `json:"created_at"`
	Desc         string               `json:"desc"`
}

type UpdateImageRequest

type UpdateImageRequest struct {
	ImageID          string `json:"-"`
	Desc             string `json:"desc,omitempty"`
	MetadataIsPublic bool   `json:"metadata_is_public"`
}

type UploadRequest

type UploadRequest struct {
	Filename         string
	ImageData        io.Reader `json:"imagedata"`
	MetadataIsPublic bool      `json:"metadata_is_public"`
	RefererURL       string    `json:"referer_url"`
	Title            string    `json:"title"`
	Desc             string    `json:"desc"`
	CreatedAt        time.Time `json:"created_at"`
	CollectionID     string    `json:"collection_id"`
}

type UploadedImage

type UploadedImage struct {
	ID           string `json:"image_id"`
	PermalinkURL string `json:"permalink_url"`
	ThumbURL     string `json:"thumb_url"`
	URL          string `json:"url"`
	Type         string `json:"type"`
}

Jump to

Keyboard shortcuts

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