lib

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 11 Imported by: 0

README

kotogif/lib

some helpers for kotogif

Documentation

Index

Constants

View Source
const (
	ErrStatusNotOK     = Error("got not-OK status code")
	ErrNilQueryPointer = Error("got nil query pointer")
	ErrNilNodesArray   = Error("got nil nodes array")
	ErrEmptyNodesArray = Error("got empty nodes array")
	ErrNilNodePointer  = Error("got nil node pointer")
	ErrNilAttrArray    = Error("got nil attr array")
	ErrEmptyAttrArray  = Error("got empty attr array")
	ErrSrcAttrNotFound = Error("attr 'src' not found")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient *http.Client
	BaseURL    string
	TempDir    string
	UserAgent  string
	Debug      bool
}

func NewClient

func NewClient(opts ...ClientOption) *Client

NewClient returns *Client

func (*Client) Convert

func (c *Client) Convert(from, to string, overwrite bool) error

Convert converts video

func (*Client) GetVideo

func (c *Client) GetVideo(ctx context.Context) ([]byte, error)

GetVideo gets video in WebM format Be careful: it uses the same context for both GetVideoURL and GetVideo

func (*Client) GetVideoURL

func (c *Client) GetVideoURL(ctx context.Context) (string, error)

GetVideoURL returns URL of video in WebM format

func (*Client) SaveVideoToTemp

func (c *Client) SaveVideoToTemp(dat []byte) (string, error)

SaveVideoToTemp saves video to Client's TempDir. Returns filename and error

type ClientOption

type ClientOption func(*Client)

func BaseURL

func BaseURL(url string) ClientOption

BaseURL sets BaseURL in Client

func HTTPClient

func HTTPClient(cl *http.Client) ClientOption

HTTPClient sets HTTPClient in Client

func TempDir

func TempDir(path string) ClientOption

TempDir sets TempDir in Client

func UserAgent

func UserAgent(ua string) ClientOption

UserAgent sets UserAgent in Client

type Error

type Error string

func (Error) Error

func (e Error) Error() string

Error is for implementing error interface

Jump to

Keyboard shortcuts

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