client

package module
v0.0.0-...-1d83cc6 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

README

Snickers Go Client

Snickers is an open source alternative to the existent cloud encoding services. It is a HTTP API that encode videos. Go client for snickers API



Build Status codecov Go Report Card

Download the dependencies:

$ make build

Running tests

$ make test

Contributing

  1. Fork it
  2. Create your feature branch: git checkout -b my-awesome-new-feature
  3. Commit your changes: git commit -m 'Add some awesome feature'
  4. Push to the branch: git push origin my-awesome-new-feature
  5. Submit a pull request

License

This code is under Apache 2.0 License.

Documentation

Overview

Package client provides types and methods for interacting with the Snickers API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Status int    `json:"status,omitempty"`
	Errors string `json:"errors,omitempty"`
}

APIError represents an error returned by the Snickers API.

func (*APIError) Error

func (apiErr *APIError) Error() string

Error converts the whole interlying information to a representative string.

It encodes the list of errors in JSON format.

type AudioPreset

type AudioPreset struct {
	Codec   string `json:"codec,omitempty"`
	Bitrate string `json:"bitrate,omitempty"`
}

AudioPreset define the set of parameters for audio on a given preset

type Client

type Client struct {
	Endpoint string
}

Client is the basic type for interacting with the API. It provides methods matching the available actions in the API.

func NewClient

func NewClient(endpoint string) (*Client, error)

NewClient creates a instance of the client type.

func (*Client) CreateJob

func (c *Client) CreateJob(jobInput JobInput) (*Job, error)

CreateJob sends a single job and send it for processing

func (*Client) CreatePreset

func (c *Client) CreatePreset(preset Preset) (*Preset, error)

CreatePreset creates a new preset

func (*Client) DeletePreset

func (c *Client) DeletePreset(presetName string) error

DeletePreset removes a preset based on its preset name

func (*Client) GetJob

func (c *Client) GetJob(jobID string) (*Job, error)

GetJob returns metadata on a single job

func (*Client) GetJobs

func (c *Client) GetJobs() ([]Job, error)

GetJobs returns a list of jobs

func (*Client) GetPreset

func (c *Client) GetPreset(presetName string) (*Preset, error)

GetPreset return details of a given preset name

func (*Client) GetPresets

func (c *Client) GetPresets() ([]Preset, error)

GetPresets returns a list of presets

func (*Client) StartJob

func (c *Client) StartJob(jobID string) (*Job, error)

StartJob start a job given a job id

type Job

type Job struct {
	ID               string    `json:"id"`
	Source           string    `json:"source"`
	Destination      string    `json:"destination"`
	Preset           Preset    `json:"preset"`
	Status           JobStatus `json:"status"`
	Details          string    `json:"progress"`
	LocalSource      string    `json:"-"`
	LocalDestination string    `json:"-"`
}

Job is the set of parameters of a given job

type JobInput

type JobInput struct {
	Source      string `json:"source"`
	Destination string `json:"destination"`
	PresetName  string `json:"preset"`
}

JobInput stores the information passed from the user when creating a job.

type JobStatus

type JobStatus string

JobStatus represents the status of a job

type Preset

type Preset struct {
	Name        string      `json:"name,omitempty"`
	Description string      `json:"description,omitempty"`
	Container   string      `json:"container,omitempty"`
	RateControl string      `json:"rateControl,omitempty"`
	Video       VideoPreset `json:"video"`
	Audio       AudioPreset `json:"audio"`
}

Preset define the set of parameters of a given preset

type VideoPreset

type VideoPreset struct {
	Width         string `json:"width,omitempty"`
	Height        string `json:"height,omitempty"`
	Codec         string `json:"codec,omitempty"`
	Bitrate       string `json:"bitrate,omitempty"`
	GopSize       string `json:"gopSize,omitempty"`
	GopMode       string `json:"gopMode,omitempty"`
	Profile       string `json:"profile,omitempty"`
	ProfileLevel  string `json:"profileLevel,omitempty"`
	InterlaceMode string `json:"interlaceMode,omitempty"`
}

VideoPreset define the set of parameters for video on a given preset

Source Files

  • client.go
  • job.go
  • preset.go

Jump to

Keyboard shortcuts

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