A Rev.ai Go client library.
Install revai-go with:
go get -u github.com/threeaccents/revai-go
Then, import it using:
import (
"github.com/threeaccents/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")
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{
MediaURL: 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)