sdk-go: github.com/machinebox/sdk-go/tagbox Index | Files

package tagbox

import "github.com/machinebox/sdk-go/tagbox"

Package tagbox provides a client for accessing Tagbox services.

Index

Package Files

tagbox.go tagbox_check.go tagbox_rename.go tagbox_similar.go tagbox_state.go tagbox_teach.go

type CheckResponse Uses

type CheckResponse struct {
    // Tags are the standard tags returned
    Tags []Tag `json:"tags"`
    // CustomTags are the custom tags (previously teach) that match
    CustomTags []Tag `json:"custom_tags"`
}

CheckResponse is all the data from /check request to tagbox

type Client Uses

type Client struct {

    // HTTPClient is the http.Client that will be used to
    // make requests.
    HTTPClient *http.Client
    // contains filtered or unexported fields
}

Client is an HTTP client that can make requests to the box.

func New Uses

func New(addr string) *Client

New makes a new Client for the box at the specified address.

func (*Client) Check Uses

func (c *Client) Check(image io.Reader) (CheckResponse, error)

Check gets the tags for the image data provided.

func (*Client) CheckBase64 Uses

func (c *Client) CheckBase64(data string) (CheckResponse, error)

CheckBase64 gets the tags for the image in the encoded Base64 data string.

func (*Client) CheckURL Uses

func (c *Client) CheckURL(imageURL *url.URL) (CheckResponse, error)

CheckURL gets the tags for the image at the specified URL.

func (*Client) Info Uses

func (c *Client) Info() (*boxutil.Info, error)

Info gets the details about the box.

func (*Client) OpenState Uses

func (c *Client) OpenState() (io.ReadCloser, error)

OpenState opens the state file for reading. Clients must call Close.

func (*Client) PostState Uses

func (c *Client) PostState(r io.Reader) error

PostState uploads new state data.

func (*Client) PostStateURL Uses

func (c *Client) PostStateURL(stateURL *url.URL) error

PostStateURL tells tagbox to download the state file specified by the URL.

func (*Client) Remove Uses

func (c *Client) Remove(id string) error

Remove makes tagbox to forget an image

func (*Client) Rename Uses

func (c *Client) Rename(id, tag string) error

Rename allows to change the custom tag for a given image by id

func (*Client) RenameAll Uses

func (c *Client) RenameAll(oldTag, newTag string) error

RenameAll changes the tag for all the images

func (*Client) Similar Uses

func (c *Client) Similar(image io.Reader) ([]Tag, error)

Similar checks the image in the io.Reader for similar images based on tags previously taught.

func (*Client) SimilarBase64 Uses

func (c *Client) SimilarBase64(data string) ([]Tag, error)

SimilarBase64 checks the image at the specified URL for similar images based on tags previously taught.

func (*Client) SimilarID Uses

func (c *Client) SimilarID(id string) ([]Tag, error)

SimilarID returns similar images based on the ID provided

func (*Client) SimilarURL Uses

func (c *Client) SimilarURL(imageURL *url.URL) ([]Tag, error)

SimilarURL checks the image at the specified URL for similar images based on tags previously taught.

func (*Client) Teach Uses

func (c *Client) Teach(image io.Reader, id, tag string) error

Teach teaches tagbox the image with a custom tag in the io.Reader. The tag is the string representation of the main thing on the image. The id should be a unique identifier for the image, usually the filename.

func (*Client) TeachBase64 Uses

func (c *Client) TeachBase64(data, id, tag string) error

TeachBase64 teaches tagbox the Base64 encoded image with a custom tag. See Teach for more information.

func (*Client) TeachURL Uses

func (c *Client) TeachURL(imageURL *url.URL, id, tag string) error

TeachURL teaches tagbox the image with a custom tag at the specified URL. See Teach for more information.

type ErrTagbox Uses

type ErrTagbox string

ErrTagbox represents an error from Tagbox.

func (ErrTagbox) Error Uses

func (e ErrTagbox) Error() string

type Tag Uses

type Tag struct {
    // Tag is the tag string.
    Tag string
    // Confidence is a probability number between 0 and 1.
    Confidence float64
    // ID is unique identifier of the image, previosly teach
    ID  string
}

Tag represents a single tag that describes an image.

Package tagbox imports 11 packages (graph). Updated 2018-02-01. Refresh now. Tools for package owners.