Documentation ¶
Index ¶
- Constants
- func BaseURL(u *url.URL) func(*Client)
- func HTTPClient(httpClient *http.Client) func(*Client)
- func IsRevError(code int) (bool, error)
- func UserAgent(userAgent string) func(*Client)
- type Account
- type AccountService
- type Caption
- type CaptionService
- type Client
- type ClientOption
- type Conn
- type CreateCustomVocabularyParams
- type CustomVocabulary
- type CustomVocabularyService
- func (s *CustomVocabularyService) Create(ctx context.Context, params *CreateCustomVocabularyParams) (*CustomVocabulary, error)
- func (s *CustomVocabularyService) Delete(ctx context.Context, params *DeleteCustomVocabularyParams) error
- func (s *CustomVocabularyService) Get(ctx context.Context, params *GetCustomVocabularyParams) (*CustomVocabulary, error)
- func (s *CustomVocabularyService) List(ctx context.Context, params *ListCustomVocabularyParams) ([]*CustomVocabulary, error)
- type DeleteCustomVocabularyParams
- type DeleteJobParams
- type DialStreamParams
- type Element
- type ErrBadStatusCode
- type GetCaptionParams
- type GetCustomVocabularyParams
- type GetJobParams
- type GetTranscriptParams
- type Job
- type JobOptionCustomVocabulary
- type JobOptions
- type JobService
- func (s *JobService) Delete(ctx context.Context, params *DeleteJobParams) error
- func (s *JobService) Get(ctx context.Context, params *GetJobParams) (*Job, error)
- func (s *JobService) List(ctx context.Context, params *ListJobParams) ([]*Job, error)
- func (s *JobService) SubmitFile(ctx context.Context, params *NewFileJobParams) (*Job, error)
- func (s *JobService) SubmitURL(ctx context.Context, params *NewURLJobParams) (*Job, error)
- type ListCustomVocabularyParams
- type ListJobParams
- type Monologue
- type NewFileJobParams
- type NewURLJobParams
- type Phrase
- type RetriableError
- type RevError
- type StreamMessage
- type StreamService
- type TextTranscript
- type Transcript
- type TranscriptService
Constants ¶
const ( XSubripHeader = "application/x-subrip" TextVTTHeader = "text/vtt" TextPlainHeader = "text/plain" RevTranscriptJSONHeader = "application/vnd.rev.transcript.v1.0+json" )
const ( StateConnected = iota StateDoneSent StateDone )
const ( ErrCloseBadRequest = 4002 ErrCloseInsufficientCredits = 4003 ErrCloseServerShuttingDown = 4010 ErrCloseNoInstanceAvailable = 4013 ErrCloseTooManyRequests = 4029 )
Error codes
Variables ¶
This section is empty.
Functions ¶
func HTTPClient ¶
HTTPClient sets the http client for the rev.ai client
func IsRevError ¶
IsRevError Check if the code is a Rev error if so return it.
Types ¶
type AccountService ¶
type AccountService service
AccountService provides access to the account related functions in the Rev.ai API.
func (*AccountService) Get ¶
func (s *AccountService) Get(ctx context.Context) (*Account, error)
Get the developer's account information https://www.rev.ai/docs#operation/GetAccount
type CaptionService ¶
type CaptionService service
CaptionService provides access to the caption related functions in the Rev.ai API.
func (*CaptionService) Get ¶
func (s *CaptionService) Get(ctx context.Context, params *GetCaptionParams) (*Caption, error)
Get returns the caption output for a transcription job. https://www.rev.ai/docs#tag/Captions
type Client ¶
type Client struct { HTTPClient *http.Client BaseURL *url.URL UserAgent string APIKey string // Services used for talking to different parts of the Rev.ai API. Job *JobService Account *AccountService Caption *CaptionService Transcript *TranscriptService CustomVocabulary *CustomVocabularyService Stream *StreamService // contains filtered or unexported fields }
A Client manages communication with the Rev.ai API.
func NewClient ¶
func NewClient(apiKey string, opts ...ClientOption) *Client
NewClient creates a new client and sets defaults. It then updates the client with any options passed in.
type ClientOption ¶
type ClientOption func(*Client)
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a websocket connection to the Rev.ai Api. It has certain helper methods to easily parse and communicate to the web socket connection
func (*Conn) WriteDone ¶
WriteDone sends EOS to let Rev know we are done. see https://www.rev.ai/docs/streaming#section/Client-to-Rev.ai-Input/Sending-Audio-to-Rev.ai
type CreateCustomVocabularyParams ¶
type CreateCustomVocabularyParams struct { CustomVocabularies []Phrase `json:"custom_vocabularies"` Metadata string `json:"metadata,omitempty"` CallbackURL string `json:"callback_url,omitempty"` }
CreateCustomVocabularyParams specifies the parameters to the CustomVocabularyService.Create method.
type CustomVocabulary ¶
type CustomVocabulary struct { ID string `json:"id"` Status string `json:"status"` CreatedOn time.Time `json:"created_on"` CompletedOn time.Time `json:"completed_on"` CallbackURL string `json:"callback_url"` Failure string `json:"failure"` FailureDetail string `json:"failure_detail"` }
CustomVocabulary represents a Rev.ai custom vocabulary
type CustomVocabularyService ¶
type CustomVocabularyService service
CustomVocabularyService provides access to the custom vocabulary related functions in the Rev.ai API.
func (*CustomVocabularyService) Create ¶
func (s *CustomVocabularyService) Create(ctx context.Context, params *CreateCustomVocabularyParams) (*CustomVocabulary, error)
Create submits a Custom Vocabulary for asynchronous processing. https://www.rev.ai/docs/streaming#operation/SubmitCustomVocabulary
func (*CustomVocabularyService) Delete ¶
func (s *CustomVocabularyService) Delete(ctx context.Context, params *DeleteCustomVocabularyParams) error
Delete deletes the custom vocabulary. https://www.rev.ai/docs/streaming#operation/DeleteCustomVocabulary
func (*CustomVocabularyService) Get ¶
func (s *CustomVocabularyService) Get(ctx context.Context, params *GetCustomVocabularyParams) (*CustomVocabulary, error)
Get gets the custom vocabulary processing information https://www.rev.ai/docs/streaming#operation/GetCustomVocabulary
func (*CustomVocabularyService) List ¶
func (s *CustomVocabularyService) List(ctx context.Context, params *ListCustomVocabularyParams) ([]*CustomVocabulary, error)
List gets a list of most recent custom vocabularies' processing information https://www.rev.ai/docs/streaming#operation/GetCustomVocabularies
type DeleteCustomVocabularyParams ¶
type DeleteCustomVocabularyParams struct {
ID string
}
DeleteCustomVocabularyParams specifies the parameters to the CustomVocabularyService.Delete method.
type DeleteJobParams ¶
type DeleteJobParams struct {
ID string
}
DeleteJobParams specifies the parameters to the JobService.Delete method.
type DialStreamParams ¶
type DialStreamParams struct { ContentType string Metadata string FilterProfanity bool RemoveDisfluencies bool CustomVocabularyID string }
DialStreamParams specifies the parameters to the StreamService.Dial method.
type Element ¶
type Element struct { Type string `json:"type"` Value string `json:"value"` Ts float64 `json:"ts"` EndTs float64 `json:"end_ts"` Confidence float64 `json:"confidence"` }
Element represents a Rev.ai element
type ErrBadStatusCode ¶
ErrBadStatusCode is returned when the API returns a non 2XX error code
func (*ErrBadStatusCode) Error ¶
func (e *ErrBadStatusCode) Error() string
type GetCaptionParams ¶
GetCaptionParams specifies the parameters to the CaptionService.Get method.
type GetCustomVocabularyParams ¶
type GetCustomVocabularyParams struct {
ID string
}
GetCustomVocabularyParams specifies the parameters to the CustomVocabularyService.Get method.
type GetJobParams ¶
type GetJobParams struct {
ID string
}
GetJobParams specifies the parameters to the JobService.Get method.
type GetTranscriptParams ¶
type GetTranscriptParams struct {
JobID string
}
GetTranscriptParams specifies the parameters to the TranscriptService.Get method.
type Job ¶
type Job struct { ID string `json:"id"` CreatedOn time.Time `json:"created_on"` Name string `json:"name"` Status string `json:"status"` Type string `json:"type"` Metadata string `json:"metadata,omitempty"` CompletedOn time.Time `json:"completed_on,omitempty"` CallbackURL string `json:"callback_url,omitempty"` DurationSeconds float32 `json:"duration_seconds,omitempty"` MediaURL string `json:"media_url,omitempty"` Failure string `json:"failure,omitempty"` FailureDetail string `json:"failure_detail,omitempty"` Language string `json:"language,omitempty"` DetectedLanguage string `json:"detected_language,omitempty"` }
Job represents a rev.ai async job.
type JobOptionCustomVocabulary ¶
type JobOptionCustomVocabulary struct {
Phrases []string `json:"phrases"`
}
type JobOptions ¶
type JobOptions struct { SkipDiarization bool `json:"skip_diarization,omitempty"` SkipPunctuation bool `json:"skip_punctuation,omitempty"` RemoveDisfluencies bool `json:"remove_disfluencies,omitempty"` FilterProfanity bool `json:"filter_profanity,omitempty"` SpeakerChannelsCount int `json:"speaker_channels_count,omitempty"` Metadata string `json:"metadata,omitempty"` CallbackURL string `json:"callback_url,omitempty"` CustomVocabularies []JobOptionCustomVocabulary `json:"custom_vocabularies,omitempty"` Transcriber string `json:"transcriber,omitempty"` CustomVocabularyId string `json:"custom_vocabulary_id,omitempty"` ForcedAlignment bool `json:"forced_alignment,omitempty"` RemoveAtmospherics bool `json:"remove_atmospherics,omitempty"` ApplyDurationPadding bool `json:"apply_duration_padding,omitempty"` EnableFusion bool `json:"enable_fusion,omitempty"` }
JobOptions specifies the options to the JobService.SubmitFile method.
type JobService ¶
type JobService service
JobService provides access to the jobs related functions in the Rev.ai API.
func (*JobService) Delete ¶
func (s *JobService) Delete(ctx context.Context, params *DeleteJobParams) error
Delete deletes a transcription job https://www.rev.ai/docs#operation/DeleteJobById
func (*JobService) Get ¶
func (s *JobService) Get(ctx context.Context, params *GetJobParams) (*Job, error)
Get returns information about a transcription job https://www.rev.ai/docs#operation/GetJobById
func (*JobService) List ¶
func (s *JobService) List(ctx context.Context, params *ListJobParams) ([]*Job, error)
List gets a list of transcription jobs submitted within the last 30 days in reverse chronological order up to the provided limit number of jobs per call. https://www.rev.ai/docs#operation/GetListOfJobs
func (*JobService) SubmitFile ¶
func (s *JobService) SubmitFile(ctx context.Context, params *NewFileJobParams) (*Job, error)
SubmitFile starts an asynchronous job to transcribe speech-to-text for a media file. https://www.rev.ai/docs#operation/SubmitTranscriptionJob
func (*JobService) SubmitURL ¶
func (s *JobService) SubmitURL(ctx context.Context, params *NewURLJobParams) (*Job, error)
SubmitURL starts an asynchronous job to transcribe speech-to-text for a media file. https://www.rev.ai/docs#operation/SubmitTranscriptionJob
type ListCustomVocabularyParams ¶
type ListCustomVocabularyParams struct {
Limit int `url:"limit,omitempty"`
}
ListCustomVocabularyParams specifies the parameters to the CustomVocabularyService.List method.
type ListJobParams ¶
type ListJobParams struct { Limit int `url:"limit,omitempty"` StartingAfter string `url:"starting_after,omitempty"` }
ListJobParams specifies the optional query parameters to the JobService.List method.
type NewFileJobParams ¶
type NewFileJobParams struct { Media io.Reader Filename string JobOptions *JobOptions }
NewFileJobParams specifies the parameters to the JobService.SubmitFile method.
type NewURLJobParams ¶
type NewURLJobParams struct { MediaURL string `json:"media_url"` SkipDiarization bool `json:"skip_diarization,omitempty"` SkipPunctuation bool `json:"skip_punctuation,omitempty"` RemoveDisfluencies bool `json:"remove_disfluencies,omitempty"` FilterProfanity bool `json:"filter_profanity,omitempty"` SpeakerChannelsCount int `json:"speaker_channels_count,omitempty"` Metadata string `json:"metadata,omitempty"` CallbackURL string `json:"callback_url,omitempty"` CustomVocabularies []JobOptionCustomVocabulary `json:"custom_vocabularies"` Language string `json:"language"` Transcriber string `json:"transcriber,omitempty"` CustomVocabularyId string `json:"custom_vocabulary_id,omitempty"` ForcedAlignment bool `json:"forced_alignment,omitempty"` RemoveAtmospherics bool `json:"remove_atmospherics,omitempty"` ApplyDurationPadding bool `json:"apply_duration_padding,omitempty"` EnableFusion bool `json:"enable_fusion,omitempty"` }
NewURLJobParams specifies the parameters to the JobService.SubmitURL method.
type RetriableError ¶
RetriableError represnts retriable stream error
func (RetriableError) Error ¶
func (e RetriableError) Error() string
type RevError ¶
RevError represents a close message from rev see https://www.rev.ai/docs/streaming#section/Error-Codes
type StreamMessage ¶
type StreamMessage struct { Type string `json:"type"` Ts float64 `json:"ts"` EndTs float64 `json:"end_ts"` Elements []Element `json:"elements"` }
StreamMessage represents a rev.ai websocket stream message.
type StreamService ¶
type StreamService service
StreamService provides access to the stream related functions in the Rev.ai API.
func (*StreamService) Dial ¶
func (s *StreamService) Dial(ctx context.Context, params *DialStreamParams) (*Conn, error)
Dial dials a WebSocket request to the Rev.ai Streaming api. https://www.rev.ai/docs/streaming#section/Overview
type TextTranscript ¶
type TextTranscript struct {
Value string
}
TextTranscript represents a Rev.ai job text transcript
type Transcript ¶
type Transcript struct {
Monologues []Monologue `json:"monologues"`
}
Transcript represents a Rev.ai job json transcript
type TranscriptService ¶
type TranscriptService service
TranscriptService provides access to the transcript related functions in the Rev.ai API.
func (*TranscriptService) Get ¶
func (s *TranscriptService) Get(ctx context.Context, params *GetTranscriptParams) (*Transcript, error)
Get returns the transcript for a completed transcription job in JSON format. https://www.rev.ai/docs#operation/GetTranscriptById
func (*TranscriptService) GetText ¶
func (s *TranscriptService) GetText(ctx context.Context, params *GetTranscriptParams) (*TextTranscript, error)
Get returns the transcript for a completed transcription job in text format. https://www.rev.ai/docs#operation/GetTranscriptById