package tinify
import "codeberg.org/jlelse/tinify"
Index ¶
- Constants
- func SetKey(setKey string)
- type Client
- func GetClient() *Client
- func NewClient(key string) (c *Client, err error)
- func (c *Client) Request(method string, url string, body interface{}) (response *http.Response, err error)
- type ResizeMethod
- type ResizeOption
- type Result
- func NewResult(meta http.Header, data []byte) *Result
- func (r *Result) ContentType() string
- func (r *Result) Data() []byte
- func (r *Result) MediaType() string
- func (r *Result) Size() int64
- func (r *Result) ToBuffer() []byte
- func (r *Result) ToFile(path string) error
- type ResultMeta
- type Source
Constants ¶
const ( ResizeMethodScale = "scale" ResizeMethodFit = "fit" ResizeMethodCover = "cover" )
const ApiEndpoint = "https://api.tinify.com"
Functions ¶
func SetKey ¶
func SetKey(setKey string)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func GetClient ¶
func GetClient() *Client
func NewClient ¶
func (*Client) Request ¶
func (c *Client) Request(method string, url string, body interface{}) (response *http.Response, err error)
type ResizeMethod ¶
type ResizeMethod string
type ResizeOption ¶
type ResizeOption struct { Method ResizeMethod `json:"method"` Width int64 `json:"width,omitempty"` Height int64 `json:"height,omitempty"` }
type Result ¶
type Result struct { *ResultMeta // contains filtered or unexported fields }
func NewResult ¶
func (*Result) ContentType ¶
func (*Result) Data ¶
func (*Result) MediaType ¶
func (*Result) Size ¶
func (*Result) ToBuffer ¶
func (*Result) ToFile ¶
type ResultMeta ¶
type ResultMeta struct {
// contains filtered or unexported fields
}
func NewResultMeta ¶
func NewResultMeta(meta http.Header) *ResultMeta
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
func FromBuffer ¶
func FromFile ¶
func FromUrl ¶
func (*Source) Resize ¶
func (s *Source) Resize(option *ResizeOption) error
func (*Source) ToFile ¶
Source Files ¶
client.go result.go result_meta.go source.go tinify.go
- Version
- v0.0.0-20200123222407-7fc9c21822b0 (latest)
- Published
- Jan 23, 2020
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 2 months ago –
Tools for package owners.