v2api

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnauthorized represents a 401 error on API
	ErrUnauthorized = errors.New("401: API Error")
	// ErrNotFound represents a 404 error on API
	ErrNotFound = errors.New("404: API Error")
)

Functions

This section is empty.

Types

type Client

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

Client 3Play Media API client

func NewClient

func NewClient(apiKey, apiSecret string) *Client

NewClient returns a 3Play Media client

func NewClientWithHTTPClient

func NewClientWithHTTPClient(apiKey, apiSecret string, client *http.Client) *Client

NewClientWithHTTPClient returns a 3Play Media client with a custom http client

func (*Client) AddTag

func (c *Client) AddTag(fileID uint, tag string) ([]string, error)

AddTag adds a tag to a file

func (*Client) GetCaptions

func (c *Client) GetCaptions(opts GetCaptionsOptions) ([]byte, error)

GetCaptions retrieves caption files according to the given options.

func (*Client) GetCaptionsByVideoID

func (c *Client) GetCaptionsByVideoID(id string, format types.CaptionsFormat) ([]byte, error)

GetCaptionsByVideoID get captions by video ID with specific format current supported formats are srt, dfxp, smi, stl, qt, qtxml, cptxml, adbe

func (*Client) GetFile

func (c *Client) GetFile(id uint) (*File, error)

GetFile gets a single file by id

func (*Client) GetFiles

func (c *Client) GetFiles(params, filters url.Values) (*FilesPage, error)

GetFiles returns a list of files, supports pagination through params and filters. For a full list of supported filtering parameters check http://support.3playmedia.com/hc/en-us/articles/227729828-Files-API-Methods

func (*Client) GetTags

func (c *Client) GetTags(fileID uint) ([]string, error)

GetTags gets the list of tags of a file

func (*Client) GetTranscript

func (c *Client) GetTranscript(fileID uint) (*Transcript, error)

GetTranscript get json transcript by file ID

func (*Client) GetTranscriptByVideoID

func (c *Client) GetTranscriptByVideoID(videoID string) (*Transcript, error)

GetTranscriptByVideoID get json transcript by video ID

func (*Client) GetTranscriptByVideoIDWithFormat

func (c *Client) GetTranscriptByVideoIDWithFormat(id string, format TranscriptFormat) ([]byte, error)

GetTranscriptByVideoIDWithFormat get transcript by video ID with specific format current supported formats are json, text and html

func (*Client) GetTranscriptWithFormat

func (c *Client) GetTranscriptWithFormat(id uint, format TranscriptFormat) ([]byte, error)

GetTranscriptWithFormat get transcript by file ID with supported formats current supported formats are json, text and html

func (*Client) RemoveTag

func (c *Client) RemoveTag(fileID uint, tag string) ([]string, error)

RemoveTag removes a tag of a file

func (*Client) UpdateFile

func (c *Client) UpdateFile(fileID uint, data url.Values) error

UpdateFile updates a File metadata

func (*Client) UploadFileFromURL

func (c *Client) UploadFileFromURL(fileURL string, options url.Values) (uint, error)

UploadFileFromURL uploads a file to threeplay using the file's URL and returns the file ID.

type Error

type Error struct {
	IsError bool              `json:"iserror"`
	Errors  map[string]string `json:"errors"`
}

Error representation of 3Play API error

type File

type File struct {
	ID                   uint   `json:"id"`
	ProjectID            uint   `json:"project_id"`
	BatchID              uint   `json:"batch_id"`
	Duration             uint   `json:"duration"`
	Attribute1           string `json:"attribute1"`
	Attribute2           string `json:"attribute2"`
	Attribute3           string `json:"attribute3"`
	VideoID              string `json:"video_id"`
	Name                 string `json:"name"`
	CallbackURL          string `json:"callback_url"`
	Description          string `json:"description"`
	CreatedAt            string `json:"created_at"`
	UpdatedAt            string `json:"updated_at"`
	WordCount            uint   `json:"word_count"`
	ThumbnailURL         string `json:"thumbnail_url"`
	LanguageID           int    `json:"language_id"`
	DefaultServiceTypeID int    `json:"default_service_type_id"`
	Downloaded           bool   `json:"downloaded"`
	State                string `json:"state"`
	TurnaroundLevelID    int    `json:"turnaround_level_id"`
	Deadline             string `json:"deadline"`
	BatchName            string `json:"batch_name"`
	ErrorDescription     string `json:"error_description"`
}

File representation

type FilesPage

type FilesPage struct {
	Files   []File `json:"files"`
	Summary `json:"summary"`
}

FilesPage representation

type GetCaptionsOptions

type GetCaptionsOptions struct {
	// FileID should be specified to download the captions file by its ID.
	// This option is mutually exclusive with VideoID.
	FileID uint

	// VideoID should be specified to download the captions file specifying
	// the video ID. This option is mutually exclusive with FileID.
	VideoID string

	// Format specifies the standard format that should be used. Please
	// refer to the constants exported by this package to see the available
	// formats. This option is mutually exclusive with Outputformat.
	Format types.CaptionsFormat

	// OutputFormat specifies the custom format that should be used.
	// This option is mutually exclusive with Format.
	OutputFormat string
}

GetCaptionsOptions represents the set of options that can be provided when obtaining a captions file.

type Summary

type Summary struct {
	CurrentPage  json.Number `json:"current_page"`
	PerPage      json.Number `json:"per_page"`
	TotalEntries json.Number `json:"total_entries"`
	TotalPages   json.Number `json:"total_pages"`
}

Summary representation

type Transcript

type Transcript struct {
	Words      []Word            `json:"words"`
	Paragraphs []int             `json:"paragraphs"`
	Speakers   map[string]string `json:"speakers"`
}

Transcript video transcript

type TranscriptFormat

type TranscriptFormat string

TranscriptFormat supported output formats for transcripts

const (
	// JSON format for transcripted file
	JSON TranscriptFormat = "json"
	// TXT format output for transcripted file
	TXT TranscriptFormat = "txt"
	// HTML format output for transcripted file
	HTML TranscriptFormat = "html"
)

type Word

type Word [2]string

Word words

Jump to

Keyboard shortcuts

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