A Rev.ai Go client library.
Install revai-go with:
go get -u github.com/oriiolabs/revai-go
Then, import it using:
import (
"github.com/oriiolabs/revai-go"
)
For details on all the functionality in this library, see the GoDoc documentation.
Below are a few simple examples:
// 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"),
)
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)
const mediaURL = "https://support.rev.com/hc/en-us/article_attachments/200043975/FTC_Sample_1_-_Single.mp3"
params := &revai.NewURLJobParams{
URL: mediaURL,
}
ctx := context.Background()
job, err := c.Job.SubmitURL(ctx, params)
// handle err
fmt.Println("status", job.Status)
params := &revai.GetCaptionParams{
JobID: "job-id"
}
ctx := context.Background()
caption, err := c.Caption.Get(ctx, params)
// error check
fmt.Println("srt caption", caption.Value)
ctx := context.Background()
account, err := c.Account.Get(ctx)
// error check
fmt.Println("balance", account.BalanceSeconds)