tenor

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaFilterBasic   = "basic"
	MediaFilterMinimal = "minimal"
	MediaFilterAll     = ""
)

Variables

View Source
var (
	BaseEndpoint = "https://api.tenor.com"
	Version      = "1"
	Path         = "/v" + Version
	Endpoint     = BaseEndpoint + Path + "/"
)

Functions

This section is empty.

Types

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string) *Client

func (*Client) GIFs

func (c *Client) GIFs(ids []string, filter MediaFilter, limit int) ([]GIF, error)

type Dimensions

type Dimensions struct {
	Width, Height int
}

func (*Dimensions) UnmarshalJSON

func (d *Dimensions) UnmarshalJSON(data []byte) error

type GIF

type GIF struct {
	Created    float64               `json:"created"`
	HasAudio   bool                  `json:"hasaudio"`
	ID         string                `json:"id"`
	Media      []map[GIFFormat]Media `json:"media"`
	Tags       []string              `json:"tags"`
	Title      string                `json:"title"`
	ItemURL    string                `json:"itemurl"`
	HasCaption bool                  `json:"hascaption"`
	URL        string                `json:"url"`
}

type GIFFormat

type GIFFormat string
const (
	FormatMP4       GIFFormat = "mp4"
	FormatLoopedMP4 GIFFormat = "loopedmp4"
	FormatTinyMP4   GIFFormat = "tinymp4"
	FormatNanoMP4   GIFFormat = "nanomp4"

	FormatGIF       GIFFormat = "gif"
	FormatMediumGIF GIFFormat = "mediumgif"
	FormatTinyGIF   GIFFormat = "tinygif"
	FormatNanoGIF   GIFFormat = "nanogif"

	FormatWebM     GIFFormat = "webm"
	FormatTinyWebM GIFFormat = "tinywebm"
	FormatNanoWebM GIFFormat = "nanowebm"
)

type HTTPError

type HTTPError struct {
	StatusCode int
	Body       []byte
}

func (HTTPError) Error

func (err HTTPError) Error() string

type Media

type Media struct {
	Preview    string     `json:"preview"`
	URL        string     `json:"url"`
	Dimensions Dimensions `json:"dims"`
	Size       int        `json:"size"`
}

type MediaFilter

type MediaFilter string

Jump to

Keyboard shortcuts

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