service

package
v0.0.0-...-7dcd076 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback struct {
	Code int          `json:"code"`
	Data CallbackData `json:"data"`
}

type CallbackData

type CallbackData struct {
	Cancellable         bool    `json:"cancellable"`
	Default             bool    `json:"default"`
	ID                  int     `json:"id"`
	BatchID             int     `json:"batch_id"`
	LanguageID          int     `json:"language_id"`
	MediaFileID         int     `json:"media_file_id"`
	LanguageIDs         []int   `json:"language_ids"`
	CancellationDetails string  `json:"cancellation_details"`
	CancellationReason  string  `json:"cancellation_reason"`
	ReferenceID         string  `json:"reference_id"`
	Status              string  `json:"status"`
	Type                string  `json:"type"`
	Duration            float64 `json:"duration"`
}

type CaptionsService

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

CaptionsService the service responsible to wrapping interactions with Providers

func NewCaptionsService

func NewCaptionsService(cfg *config.CaptionsServiceConfig, db database.DB) *CaptionsService

NewCaptionsService creates a CaptionsService

func (*CaptionsService) AddProvider

func (s *CaptionsService) AddProvider(provider providers.Provider)

AddProvider adds a Provider to the CaptionsService

func (*CaptionsService) CancelJob

func (s *CaptionsService) CancelJob(r *http.Request) (int, interface{}, error)

CancelJob cancels a given Job by its ID

func (*CaptionsService) CreateJob

func (s *CaptionsService) CreateJob(r *http.Request) (int, interface{}, error)

CreateJob create a Job

func (*CaptionsService) DownloadCaption

func (s *CaptionsService) DownloadCaption(w http.ResponseWriter, r *http.Request)

DownloadCaption downloads a caption in the specified format

func (*CaptionsService) Endpoints

func (s *CaptionsService) Endpoints() map[string]map[string]http.HandlerFunc

Endpoints returns CaptionsService API endpoints

func (*CaptionsService) GetJob

func (s *CaptionsService) GetJob(r *http.Request) (int, interface{}, error)

GetJob returns a Job given its ID

func (*CaptionsService) GetJobs

func (s *CaptionsService) GetJobs(r *http.Request) (int, interface{}, error)

GetJobs returns all the Jobs associated with a ParentID

func (*CaptionsService) GetTranscript

func (s *CaptionsService) GetTranscript(w http.ResponseWriter, r *http.Request)

GetTranscript returns a transcript of a given caption job

func (*CaptionsService) Middleware

func (s *CaptionsService) Middleware(h http.Handler) http.Handler

Middleware gizmo middleware hook

func (*CaptionsService) Prefix

func (s *CaptionsService) Prefix() string

Prefix CaptionsService API prefix

func (*CaptionsService) ProcessCallback

func (s *CaptionsService) ProcessCallback(r *http.Request) (int, interface{}, error)

type Client

type Client struct {
	Providers      map[string]providers.Provider
	DB             database.DB
	Logger         *log.Logger
	Storage        Storage
	CallbackURL    string
	CallbackAPIKey string
}

Client CaptionsService client

func (Client) CancelJob

func (c Client) CancelJob(jobID string) (bool, error)

CancelJob cancels a job by ID

func (Client) DispatchJob

func (c Client) DispatchJob(job *database.Job) error

DispatchJob dispatches a Job given an existing Provider

func (Client) DownloadCaption

func (c Client) DownloadCaption(jobID string, captionType string) ([]byte, error)

DownloadCaption downloads a caption of a given job in the specified format

func (Client) GenerateTranscript

func (c Client) GenerateTranscript(captionFile []byte, captionFormat string) (string, error)

GenerateTranscript generates a transcript from the provided caption file and format

func (Client) GetJob

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

GetJob gets a job by ID

func (Client) GetJobs

func (c Client) GetJobs(parentID string) ([]*database.JobSummary, error)

GetJobs gets all jobs associated with a ParentID

func (Client) ProcessCallback

func (c Client) ProcessCallback(callbackData CallbackData, jobID string) error

type GCSStorage

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

GCSStorage implements the Storage interface and stores files on GCS

func (*GCSStorage) Store

func (gs *GCSStorage) Store(data []byte, filename string) (string, error)

Store implements Storage interface for GCSStorage

type Storage

type Storage interface {
	Store(data []byte, filename string) (string, error)
}

Storage inferce for captions storage

func NewGCSStorage

func NewGCSStorage(bucketName string, logger *log.Logger) (Storage, error)

NewGCSStorage creates a GCSStorage instance

Jump to

Keyboard shortcuts

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