tinify

package
v0.0.0-...-fe96420 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const API_ENDPOINT = "https://api.tinify.com"
View Source
const VERSION = "0.0.1"

Variables

This section is empty.

Functions

func GetComCount

func GetComCount() int

func GetKey

func GetKey() string

func GetProxy

func GetProxy() string

func SetClient

func SetClient(c *Client)

func SetKey

func SetKey(newKey string)

func SetMockClientFun

func SetMockClientFun(f func(*http.Client))

func SetProxy

func SetProxy(newProxy string)

Types

type Client

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

TODO 证书使用, 代理地址使用

func GetClient

func GetClient() *Client

client单例

func GetNewClient

func GetNewClient(key string, capath string, proxy string) *Client

func (*Client) Request

func (c *Client) Request(method string, requestUrl string, body interface{}) *http.Response

发起请求,返回 response

type ResizeParam

type ResizeParam struct {
	Method string `json:"method"`
	Width  int    `json:"width,omitempty"`
	Height int    `json:"height,omitempty"`
}

type Result

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

func NewResult

func NewResult(meta http.Header, data []byte) *Result

create a new result class

func (*Result) GetMeta

func (r *Result) GetMeta() http.Header

func (*Result) ToBuffer

func (r *Result) ToBuffer() []byte

func (*Result) ToFile

func (r *Result) ToFile(path string) error

write to file

type Source

type Source struct {
	Url      string                 // url
	Commands map[string]interface{} // 命令
}

func FromBuffer

func FromBuffer(buffer []byte) *Source

从buffer创建一个source

func FromFile

func FromFile(path string) *Source

从文件创建一个source

func FromUrl

func FromUrl(url string) *Source

从url创建一个source

func NewSource

func NewSource(url string, commands map[string]interface{}) *Source

创建一个新的source

func (*Source) Resize

func (s *Source) Resize(method string, width int, height int) *Source

重新调整大小

func (*Source) Result

func (s *Source) Result() *Result

获取结果

func (*Source) ToFile

func (s *Source) ToFile(path string)

保存到文件

Jump to

Keyboard shortcuts

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