Documentation
¶
Index ¶
Constants ¶
const (
// BaseURI represents GFYCat's API URL
BaseURI = "https://api.gfycat.com/v1"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIResponse ¶
APIResponse represents an HTTP response from the GFYCat API
func (*APIResponse) ToType ¶
func (gfy *APIResponse) ToType(destination interface{}) error
ToType will unmarshal a GfyCat API response into the provided object
type Caption ¶
type Caption struct { Text string `json:"text"` StartSeconds int `json:"startSeconds"` Duration int `json:"duration"` FontHeight int `json:"fontHeight"` X int `json:"x"` Y int `json:"y"` FontHeightRelative float32 `json:"fontHeightRelative"` XRelatice float32 `json:"xRelative"` YRelative float32 `json:"yRelative"` }
Caption represents in-gif captions
type Cut ¶
Cut represents the total duration of the processed video, and where to start trimming from
type GFYAccessToken ¶
type GFYAccessToken struct { TokenType string `json:"token_type"` Scope string `json:"scope"` Expires int `json:"expires_in"` Token string `json:"access_token"` Created time.Time `json:"-"` }
GFYAccessToken represents an exchanged OAuth token
type GFYClient ¶
type GFYClient struct { Grant *GFYClientGrant Token *GFYAccessToken // contains filtered or unexported fields }
GFYClient represents an authenticated request dispatcher to the GFYCat API
func NewGFYClient ¶
func NewGFYClient(grant *GFYClientGrant) (*GFYClient, error)
NewGFYClient accepts a grant and returns an authenticated client
func (*GFYClient) LocalUpload ¶
func (gfy *GFYClient) LocalUpload(Filepath string, Upload *UploadFile) (*FileDrop, error)
LocalUpload uploads a local file to GFYCat
func (*GFYClient) UploadStatus ¶
func (gfy *GFYClient) UploadStatus(activeUpload *FileDrop) (*UploadStatus, error)
UploadStatus provides updates on the processing status of a file
type GFYClientGrant ¶
type GFYClientGrant struct { ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` GrantType string `json:"grant_type"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` }
GFYClientGrant represents the locally stored API OAuth client credentials
func NewClientGrantFromFile ¶
func NewClientGrantFromFile(path string) (*GFYClientGrant, error)
NewClientGrantFromFile loads a file and returns a GFYClientGrant
func (*GFYClientGrant) Exchange ¶
func (gfy *GFYClientGrant) Exchange() (*GFYAccessToken, error)
Exchange turns local credentials into an active token
type UploadError ¶
UploadError represents an upload error message
type UploadFile ¶
type UploadFile struct { FetchURL string `json:"fetchUrl,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Tags []string `json:"tags,omitempty"` NoMd5 bool `json:"noMd5,omitempty"` Private int `json:"private,omitempty"` Nsfw int `json:"nsfw,omitempty"` FetchSeconds int `json:"fetchSeconds,omitempty"` FetchMinutes int `json:"fetchMinutes,omitempty"` FetchHours int `json:"fetchHours,omitempty"` Captions []Caption `json:"captions,omitempty"` Cut []Cut `json:"cut,omitempty"` Crop []Crop `json:"crop,omitempty"` }
UploadFile represents the structure of an UploadFile request
type UploadStatus ¶
type UploadStatus struct { // While encoding or not found Task string `json:"task"` Time int `json:"time"` Progress float32 `json:"progress,string"` // When complete GfyName string `json:"gfyname"` // If Errored ErrorMessage UploadError `json:"errorMessage"` }
UploadStatus represents an inflight upload status response