v3api

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: 9 Imported by: 1

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")
)
View Source
var TranscriptFormatToID = map[types.CaptionsFormat]int{
	types.WebVTT: 139,
	types.SRT:    7,
}

TranscriptFormatToID maps a caption format to their 3play code

Functions

This section is empty.

Types

type CallParams added in v0.3.2

type CallParams struct {
	APIKey string `json:"api_key"`
}

CallParams contains the call params the caller wants to override

type CancelObjectRepresentation

type CancelObjectRepresentation struct {
	Success bool `json:"success"`
}

CancelObjectRepresentation represents the content of a cancel response

type Client

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

Client 3Play Media API client

func NewClient

func NewClient(apiKey string) *Client

NewClient returns a 3Play Media client

func NewClientWithHTTPClient

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

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

func (*Client) CancelTranscript

func (c *Client) CancelTranscript(mediaFileID string, callParams CallParams) error

CancelTranscript cancels the transcript order if possible

func (c *Client) GetEditingLink(mediaFileID string, hoursUntilExpiration int, callParams CallParams) (string, error)

GetEditingLink gets an expiring editing link

func (*Client) GetTranscriptInfo

func (c *Client) GetTranscriptInfo(mediaFileID string, callParams CallParams) (*TranscriptObjectRepresentation, error)

GetTranscriptInfo gets the status of the transcript job

func (*Client) GetTranscriptText

func (c *Client) GetTranscriptText(mediaFileID, offset string, outputFormat types.CaptionsFormat, callParams CallParams) (string, error)

GetTranscriptText downloads the transcript in the specified format

func (*Client) OrderTranscript

func (c *Client) OrderTranscript(mediaFileID, callbackURL, turnaroundLevel string, callParams CallParams) (*TranscriptObjectRepresentation, error)

OrderTranscript orders a transcript generation job

func (*Client) UploadFileFromURL

func (c *Client) UploadFileFromURL(options url.Values, callParams CallParams) (int, 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 FileObjectRepresentation

type FileObjectRepresentation struct {
	ID          int     `json:"id"`
	Name        string  `json:"name"`
	Duration    float64 `json:"duration"`
	LanguageID  int     `json:"language_id"`
	LanguageIDs []int   `json:"language_ids"`
	BatchID     int     `json:"batch_id"`
	ReferenceID string  `json:"reference_id"`
}

type ThreePlayError

type ThreePlayError struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

ThreePlayError represents the content of a transcript error response

type ThreePlayFileResponse

type ThreePlayFileResponse struct {
	Code  int                      `json:"code"`
	Data  FileObjectRepresentation `json:"data"`
	Error ThreePlayError           `json:"error"`
}

type ThreePlayTranscriptCancelResponse

type ThreePlayTranscriptCancelResponse struct {
	Code  int                        `json:"code"`
	Data  CancelObjectRepresentation `json:"data"`
	Error ThreePlayError             `json:"error"`
}

ThreePlayTranscriptCancelResponse the cancel response object

type ThreePlayTranscriptResponse

type ThreePlayTranscriptResponse struct {
	Code  int                            `json:"code"`
	Data  TranscriptObjectRepresentation `json:"data"`
	Error ThreePlayError                 `json:"error"`
}

ThreePlayTranscriptResponse the info response object

type ThreePlayTranscriptTextResponse

type ThreePlayTranscriptTextResponse struct {
	Code  int            `json:"code"`
	Data  string         `json:"data"`
	Error ThreePlayError `json:"error"`
}

ThreePlayTranscriptTextResponse is the text of the transcript response

type TranscriptObjectRepresentation

type TranscriptObjectRepresentation struct {
	ID                  int     `json:"id"`
	MediaFileID         int     `json:"media_file_id"`
	Duration            float64 `json:"duration"`
	Type                string  `json:"type"`
	LanguageID          int     `json:"language_id"`
	Status              string  `json:"status"`
	Cancellable         bool    `json:"cancellable"`
	CancellationReason  string  `json:"cancellation_reason"`
	CancellationDetails string  `json:"cancellation_details"`
}

TranscriptObjectRepresentation represents the content of a transcript info response

Jump to

Keyboard shortcuts

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