Skip to content

revdotcom/revai-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

147b336 · Jun 16, 2022

History

86 Commits
Aug 3, 2021
Apr 28, 2020
May 18, 2020
May 4, 2021
May 10, 2022
May 18, 2020
Apr 29, 2020
May 17, 2020
Jun 28, 2020
Jun 28, 2020
Jun 28, 2020
Apr 28, 2020
May 10, 2022
May 18, 2020
May 16, 2022
Jun 28, 2020
Jun 28, 2020
Nov 23, 2020
Apr 28, 2020
Aug 3, 2021
Jun 11, 2022
Jun 28, 2020

Repository files navigation

Go Rev.ai

Go Report Card GoDoc

A Rev.ai Go client library.

Installation

Install revai-go with:

go get -u github.com/threeaccents/revai-go

Then, import it using:

import (
    "github.com/threeaccents/revai-go"
)

Documentation

For details on all the functionality in this library, see the GoDoc documentation.

Below are a few simple examples:

New Client

// default client
c := revai.NewClient("API-KEY")

New Client With Options

httpClient := &http.Client{
    Timeout: 30 * time.Second,
}

c := revai.NewClient(
    "API_KEY",
    revai.HTTPClient(httpClient),
    revai.UserAgent("my-user-agent"),
)

Submit Local File Job

params := &revai.NewFileJobParams{
	Media:    f, // some io.Reader
	Filename: f.Name(),
}

ctx := context.Background()

job, err := c.Job.SubmitFile(ctx, params)
// handle err

fmt.Println("status", job.Status)

Submit Url Job

const mediaURL = "https://support.rev.com/hc/en-us/article_attachments/200043975/FTC_Sample_1_-_Single.mp3"

params := &revai.NewURLJobParams{
    MediaURL: mediaURL, 
}

ctx := context.Background()

job, err := c.Job.SubmitURL(ctx, params)
// handle err

fmt.Println("status", job.Status)

Caption

params := &revai.GetCaptionParams{
	JobID: "job-id"
}

ctx := context.Background()

caption, err := c.Caption.Get(ctx, params)
// error check

fmt.Println("srt caption", caption.Value)

Account

ctx := context.Background()

account, err := c.Account.Get(ctx)
// error check

fmt.Println("balance", account.BalanceSeconds)

Stream

streaming example