Skip to content

amikofalvy/revai-go

 
 

Repository files navigation

Go Rev.ai (WIP)

Go Report Card GoDoc

A Rev.ai Go client library.

Installation

Install revai-go with:

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

Then, import it using:

import (
    "github.com/oriiolabs/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{
    URL: 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)

About

Rev.ai golang client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%