rendobar

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 26 Imported by: 0

README

Rendobar

Rendobar Go SDK

github.com/rendobar/rendobar-go

The official Go client for Rendobar's media processing and AI generation API.

Docs  ·  Guide  ·  API reference  ·  pkg.go.dev  ·  Get an API key  ·  Discord

Go reference Version Go version License

The official Go client for Rendobar's media processing and AI generation API. Submit an FFmpeg command, a caption burn or an image generation as a job, wait for it, and get back a hosted URL. Each job type has a params struct generated from the API's schema, so a misspelt field fails to compile. The client retries rate limits and server errors without creating a second job, and it covers the whole API: jobs, uploads and assets, webhooks, storage, billing, API keys, workspaces, notifications and realtime events.

Install

go get github.com/rendobar/rendobar-go

Requires Go 1.23 or newer. Set RENDOBAR_API_KEY to a key from app.rendobar.com.

Quickstart

Set RENDOBAR_API_KEY, save this as main.go and run go run .:

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/rendobar/rendobar-go"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
	defer cancel()

	rb := rendobar.New() // reads RENDOBAR_API_KEY

	job, err := rb.Jobs.Run(ctx, rendobar.CreateParams{
		Params: rendobar.FfmpegParams{
			Command: "ffmpeg -i https://cdn.rendobar.com/assets/examples/sample.mp4 -vf scale=1280:-2 out.mp4",
		},
	}, nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(job.Complete.Output.File.URL)
}

Jobs.Run submits the job and waits until it completes, fails or is cancelled. A failed or cancelled job returns *rendobar.JobFailedError with the job attached.

An ffmpeg job writes files, so Output.File is the file it wrote and Output.Files lists all of them. A data job such as ffprobe writes no file, and Output.File is nil. JobComplete.Ffprobe reads its result as the FfprobeResult the API's spec describes:

job, err := rb.Jobs.Run(ctx, rendobar.CreateParams{
	Params: rendobar.FfprobeParams{Command: "https://cdn.rendobar.com/assets/examples/sample.mp4"},
}, nil)
if err != nil {
	log.Fatal(err)
}
probe, err := job.Complete.Ffprobe()
if err != nil {
	log.Fatal(err)
}
if s := probe.Summary; s != nil && s.Video != nil {
	fmt.Println(*s.Video.DurationSec, *s.Video.Video.Width, *s.Video.Video.Height)
}

FfprobeSummary holds one variant per kind of media (Video, Audio, Image, Other), matching Kind. A number ffprobe could not read is a nil pointer.

Let your AI assistant do it

Paste this one line into Claude, ChatGPT, or Cursor and the assistant reads the full integration playbook, detects your stack, and wires Rendobar into your codebase. Your API key stays in your env file, never in the chat.

Add Rendobar to my app: read and follow https://rendobar.com/prompts/integrate.md

Jobs

A rendobar.Job has one field set per status: Waiting, Dispatched, Running, Complete, Failed or Cancelled. Its methods read what every status shares, so listing jobs needs no type switch:

for job, err := range rb.Jobs.All(ctx, rendobar.ListParams{Status: rendobar.StatusFailed}) {
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(job.ID(), job.Type(), job.Status(), job.CreatedAt())
}

job.Info() returns the rest of the shared fields, such as Label, Cost and WebURL. A status newer than this SDK leaves all six fields nil, and the methods still answer. job.IsTerminal() reports whether a job has finished. For a status newer than this SDK it reads the API's terminal flag, so Jobs.Wait stops on a final status it does not know.

Jobs.List returns one page. ListParams.Limit goes up to 100, and the API treats a larger value as 100. Jobs.All fetches every page for you, 100 jobs at a time. A negative Limit or Offset returns an INVALID_ARGUMENT error before any request, and so does a job ID that is not letters, digits, ., _ and -.

Jobs.Types lists every live job type, and Jobs.Schema returns one type's params.

Jobs.Logs returns a job's log entries, Jobs.Timings how long each stage took, and Jobs.Stats the workspace's job counts, success rate and spend over a StatsWindow. Jobs.RetryDeliveries sends a completed job's output again to the destinations that missed it. Jobs.CreateShare, Jobs.GetShare and Jobs.DeleteShare manage a public link to the output.

Downloads

Jobs.Download streams a job's output file. Close the body when you are done:

d, err := rb.Jobs.Download(ctx, jobID)
if err != nil {
	log.Fatal(err)
}
defer d.Body.Close()
_, err = io.Copy(file, d.Body)

WithTimeout bounds only the wait for the response headers. Your ctx bounds the body, so a large file takes as long as it needs. Download.Size is the length in bytes, or -1 when the API does not say. Download.Filename is the suggested name without any directory part, so it is safe to join to your own directory. The file's SHA-256 is OutputFile.SHA256 on the complete job.

Waiting

Jobs.Wait returns a failed or cancelled job with a nil error. Only Jobs.Run turns those into *rendobar.JobFailedError, whose Code is the job's error code, or JOB_CANCELLED. After Wait, check the status before you read the output, because job.Complete is nil unless the job completed:

job, err := rb.Jobs.Wait(ctx, id, nil)
if err != nil {
	log.Fatal(err)
}
if job.Status() != rendobar.StatusComplete {
	log.Fatalf("job %s ended %s", job.ID(), job.Status())
}
fmt.Println(job.Complete.Output.File.URL)

Jobs.Wait gives up after 5 minutes until the job reports its own time limit from your plan. It then waits that limit plus 2 minutes from the moment the job reported it. On a timeout it returns *rendobar.WaitTimeoutError with the job ID, the last status and the last job read. The job may still finish. WaitOptions sets your own Timeout, the poll interval and an OnProgress callback.

Job params

Each job type has its own params struct, generated from the API's published schema: FfmpegParams, FfprobeParams, CompressTargetParams, CaptionBurnParams, CaptionsAnimateParams, ImageUpscaleParams, and one struct per model for image generation and editing, such as ImageGenerateFlux2DevParams. The struct sets the job type, so a misspelt param or a wrong value type fails to compile.

  • A field with a fixed set of values has its own type and constants, such as FfmpegComputeGPU.
  • A field that takes one of several shapes is an interface. Set it to a value of one of the types its godoc lists, such as an ImageUpscaleSizingHeight struct or the constant CompressTargetTargetPresetBalanced, whose type CompressTargetTargetPreset is one of the shapes Target takes.
  • Every number and boolean is a pointer, required or not, so the Go type never changes when the API makes a field optional. rendobar.Ptr makes one: Timeout: rendobar.Ptr[int64](600). Integers are always int64. Strings and enums are values, and "" means unset.
rendobar.CreateParams{
	Params: rendobar.ImageUpscaleParams{
		Model:  rendobar.ImageUpscaleModelSeedvr27b,
		Sizing: rendobar.ImageUpscaleSizingHeight{Height: rendobar.Ptr[int64](2160)},
	},
	Inputs: map[string]rendobar.Input{"source": rendobar.URL("https://example.com/photo.jpg")},
}

Jobs.Create checks the params against the schema before it sends anything, and refuses them with an *rendobar.Error whose code is INVALID_ARGUMENT, one Problem per mistake. Params.Validate() runs the same check on its own.

Inputs maps an input name to its value. Jobs.Schema lists the names a type takes. ffmpeg and ffprobe accept any file name, and the command refers to the file by it. A value is one of:

  • rendobar.URL("https://..."): one file the API fetches. An uploaded asset's content URL works too.
  • rendobar.URLs{...}: a list of files, such as image.edit's "images", one to four pictures to edit.
  • rendobar.Content("..."): a small text file sent inline, up to 64 KiB, such as an ffmpeg concat list.
  • rendobar.FromJob("job_..."): a completed job's output, to chain ffmpeg jobs.
  • rendobar.Fonts{{Family: "Display", Src: "https://..."}}: font files for text, under names the params use.
rendobar.CreateParams{
	Params: rendobar.ImageEditQwenImageEdit2511Params{Prompt: "make the sky purple"},
	Inputs: map[string]rendobar.Input{"images": rendobar.URLs{"https://example.com/photo.jpg"}},
}

rendobar.CustomParams{Type: ..., Fields: map[string]any{...}} is the one unchecked path. It takes any job type: one this SDK predates, or a typed one when you need a param or value the API added after this release. The SDK checks only the type name, and the API checks the rest. rendobar.JobTypeFfmpeg and the other JobType constants name the types this SDK has structs for.

Compose jobs also go through CustomParams. The API keeps compose out of the typed submit schema on purpose, because its nested timeline objects have no stable names to generate from. Jobs.Schema("compose") describes its params.

CreateParams.Callback asks the API to POST the job's result to your URL when the job ends. It carries the same envelope as a webhook, so webhooks.Parse reads it.

Uploads and assets

Uploads.Create sends a local file and returns the ready *rendobar.Asset. It takes an io.ReaderAt and the size, so an *os.File works. A large file goes up in parts, five at a time by default, and each part is retried up to 3 times:

f, err := os.Open("clip.mp4")
if err != nil {
	log.Fatal(err)
}
defer f.Close()
info, err := f.Stat()
if err != nil {
	log.Fatal(err)
}
asset, err := rb.Uploads.Create(ctx, f, info.Size(), rendobar.UploadParams{
	Filename:   "clip.mp4",
	OnProgress: func(p rendobar.UploadProgress) { fmt.Println(p.Loaded, "of", p.Total) },
})
if err != nil {
	log.Fatal(err)
}
job, err := rb.Jobs.Run(ctx, rendobar.CreateParams{
	Params: rendobar.FfmpegParams{Command: "ffmpeg -i clip.mp4 -t 1 out.mp4"},
	Inputs: map[string]rendobar.Input{"clip.mp4": rendobar.URL("asset://" + asset.ID)},
}, nil)
if err != nil {
	log.Fatal(err)
}
fmt.Println(job.Complete.Output.File.URL)

An upload expires after 24 hours unless UploadParams.Persist is set. ctx bounds the whole upload. WithTimeout does not apply to the file transfer: each attempt gets a budget that grows with the file size. Assets.List, Assets.Get, Assets.Delete and Assets.Templates manage what the workspace holds, and Assets.Download returns a short-lived download URL.

The rest of the API

Every resource of the API has its own field on the client, under the names @rendobar/sdk uses:

Field Calls
Billing State, Usage, UsageByClient, Transactions, History, CheckoutCredits, CheckoutPlan, CancelSubscription, ReactivateSubscription, CancelCreditSchedule, PaymentMethods, DeletePaymentMethod, SetDefaultPaymentMethod, PortalURL
Webhooks Create, List, Get, Update, Delete, RotateSecret, Test, ListDeliveries, RetryDelivery
Storage Create, List, Get, Update, Delete, Test, Stats, ListObjects, PrepareAWS, ListAccountBuckets, LookUpS3Bucket, StartSupabase, ListSupabaseProjects, ListSupabaseBuckets, FinishSupabase
APIKeys Create, List, Update, Revoke
Orgs List, Current, Create, Update, Delete, GetSettings, UpdateSettings
Orgs.Members Invite, ChangeRole, Remove
Orgs.Invitations Revoke
Account Capabilities
Compose Effects, EngineEffects, Validate
Notifications List, MarkRead

Every call takes a ctx. A call that sends a body takes a params struct, such as CreateWebhookParams, generated from the API's spec with the same rules as job params. The SDK checks it before sending and refuses a missing field or a value outside a fixed list with an INVALID_ARGUMENT *Error, one Problem each. In an update, a field you leave zero stays as it is:

endpoint, err := rb.Webhooks.Create(ctx, rendobar.CreateWebhookParams{
	Name:             "orders",
	URL:              "https://example.com/rendobar-webhook",
	SubscribedEvents: []rendobar.WebhookEvent{webhooks.JobCompleted, webhooks.JobFailed},
})
if err != nil {
	log.Fatal(err)
}
fmt.Println(endpoint.SigningSecret) // shown in full here and by RotateSecret only

_, err = rb.Webhooks.Update(ctx, endpoint.ID, rendobar.UpdateWebhookParams{Active: rendobar.Ptr(false)})

Storage.Create takes one of CreateStorageS3Params, CreateStorageR2Params, CreateStorageS3CompatibleParams or CreateStorageSupabaseParams, and its credentials are one of StorageKeys, StorageAWSRole, StorageCloudflareToken or StorageSupabaseSession, whichever the provider takes.

Responses are their own types, such as *rendobar.BillingState or *rendobar.WebhookDelivery, also generated from the spec. A field with a fixed set of values has its own type and constants, such as WebhookDeliveryStatusFailed. The API may add values, so keep a default branch. Integers are int64 and numbers float64, as the spec types them. A field's doc gives its unit where the spec states one, such as nanodollars or dollars. Timestamps are rendobar.UnixMillis. A list comes back as a page with its total, such as *rendobar.AssetPage with Assets and Meta.

Some calls need more than an API key. An API key cannot create API keys, and a key holds only the scopes it was created with, so a call outside them returns a 403 *Error with code INSUFFICIENT_SCOPE.

Errors

Check an error with errors.As and compare its Code with the rendobar.Code... constants:

var apiErr *rendobar.Error
if errors.As(err, &apiErr) {
	switch apiErr.Code {
	case rendobar.CodeNotFound:
		// the job does not exist
	case rendobar.CodeRateLimited:
		time.Sleep(apiErr.RetryAfter)
	default:
		log.Println(apiErr.Code, apiErr.StatusCode, apiErr.RequestID) // quote RequestID to support
	}
}

The API may add codes. An unknown one arrives as its own string, so keep a default branch. When a refusal lists what was wrong, Error.Problems has each one, with a Path, a Message and, for a plan limit, the UpgradeTo plan. Error.Details is the raw detail as JSON.

Some calls fail before anything is sent, with StatusCode 0:

  • CodeMissingAPIKey: the client has no key. Set RENDOBAR_API_KEY or pass rendobar.WithAPIKey. Jobs.Types and Jobs.Schema need no key.
  • CodeInvalidAPIKey: the key does not start with rb_.
  • CodeInvalidArgument: params or a request body that fail their schema, a malformed ID or job type, or a negative Limit, Offset or Page.

Failed submits

When a submit fails in a way that may have left a job behind, Jobs.Create and Jobs.Run return *rendobar.SubmitError. That covers your ctx ending, a connection error, an attempt that ran out its timeout, and a 429 or 5xx after the last retry. The API may have created the job and billed it. IdempotencyKey is the key the SDK sent, yours or the one it generated. Submit again with it to get that job instead of a second one. SubmitError unwraps to the cause, so errors.As(err, &apiErr) and errors.Is(err, context.DeadlineExceeded) still work. A plain refusal, such as a 400 or a 402, returns *rendobar.Error and created nothing.

created, err := rb.Jobs.Create(ctx, params)
var cutOff *rendobar.SubmitError
if errors.As(err, &cutOff) {
	params.IdempotencyKey = cutOff.IdempotencyKey
	created, err = rb.Jobs.Create(ctx, params) // the same job, never a second one
}

Cancelled waits

When your ctx is cancelled or its deadline passes after the submit, Jobs.Run and Jobs.Wait return *rendobar.ContextError. The job keeps running. JobID names it and Job is the last state read, so you can call Jobs.Get, Jobs.Wait or Jobs.Cancel later. errors.Is(err, context.DeadlineExceeded) and errors.Is(err, context.Canceled) work on it.

Retries and idempotency

A retried submit never creates a second job. Each Jobs.Create call sends one idempotency key on every retry. Pass IdempotencyKey yourself, or one from rendobar.GenerateIdempotencyKey, to make separate calls safe to repeat. Repeating a key with the same params returns the job it created, with Created.Replayed set. Reusing a key with different params returns a 409 error with code CONFLICT.

A 429 is retried twice on every call, because the API did nothing with the request. A 500, 502, 503 or 504 and a connection error are retried twice on a read (GET) and on a job submit, which carries its idempotency key. A create, update or delete that fails that way returns the error at once, because the API may have acted on it: read the state back before you send it again. Retries back off from half a second and honour a Retry-After of up to 60 seconds. Nothing else is retried. A 408, a 409, a 501 or any other 4xx fails at once, and so does an attempt that ran out its timeout. When Retry-After is longer than 60 seconds, or the wait would outlast your ctx deadline, the client returns the error at once with Error.RetryAfter set. rendobar.WithMaxRetries(0) sends each request once.

Webhooks

Import github.com/rendobar/rendobar-go/webhooks. webhooks.Parse verifies a delivery against the raw body and reads it:

body, _ := io.ReadAll(r.Body) // the exact bytes the signature covers
event, err := webhooks.Parse(body, r.Header, secret)
if err != nil {
	w.WriteHeader(http.StatusUnauthorized) // errors.Is(err, webhooks.ErrSignature) and the like name why
	return
}
payload, err := event.Payload()
if err != nil {
	w.WriteHeader(http.StatusBadRequest)
	return
}
switch data := payload.(type) {
case *webhooks.JobCompletedData:
	if data.Output != nil && data.Output.File != nil { // a data job, such as ffprobe, has no file
		log.Println(data.JobID, data.Output.File.URL)
	}
case *webhooks.JobFailedData:
	log.Println(data.JobID, data.Error.Code)
default:
	// an event this handler ignores, or one newer than this SDK
}

Every delivery is a JSON envelope:

{"version": "1", "event": "job.completed", "deliveryId": "whd_...", "timestamp": 1763700000000, "orgId": "org_...", "data": {}}

An envelope whose version is not "1" gives *UnknownPayload, because its data may have another shape. Event carries Version, Type, ID (the delivery ID, the same on every retry of one delivery), OrgID, SentAt and the raw Data. Type is a rendobar.WebhookEvent, the type CreateWebhookParams.SubscribedEvents takes. event.Payload() reads Data as the type the spec defines for the event, such as *JobCompletedData or *BalanceLowData, one per event the webhooks.Job..., webhooks.Balance... and webhooks.Test constants name. An event newer than this SDK gives *UnknownPayload with its Type and raw Data. Timestamps in event data are rendobar.UnixMillis, and .Time() turns one into a time.Time.

Each delivery carries two headers:

  • X-Rendobar-Timestamp is the send time in Unix seconds.
  • X-Rendobar-Signature is sha256= followed by the hex HMAC-SHA256 of <timestamp>.<raw body>, keyed with your endpoint's signing secret. A signature without the sha256= prefix is refused.

While you rotate the secret, deliveries also carry X-Rendobar-Signature-Previous, signed with the old secret. Parse accepts either header, so your handler keeps working until you switch secrets. It refuses deliveries more than 5 minutes old or ahead (ErrTimestamp), a signature that does not match (ErrSignature), an empty or whitespace-only secret (ErrNoSecret) and a body that is not an event (ErrPayload). webhooks.Verify runs only the check and returns a bool. ParseWith and VerifyWith take your own tolerance and clock.

Realtime

Import github.com/rendobar/rendobar-go/realtime to stream events as they happen. It is its own package, so programs that do not import it do not build in its WebSocket library. Client.Job follows one job and returns after its final status:

rt := realtime.New() // reads RENDOBAR_API_KEY, like rendobar.New
for ev, err := range rt.Job(ctx, created.ID) {
	if err != nil {
		log.Fatal(err)
	}
	switch e := ev.(type) {
	case *realtime.JobProgress:
		if e.Progress != nil {
			fmt.Printf("%s %.0f%%\n", e.Phase, *e.Progress*100)
		}
	case *realtime.JobLog:
		fmt.Println(e.Level, e.Message)
	case *realtime.JobStatusChanged:
		fmt.Println("status", e.Status)
	default:
		// another event, or *realtime.Unknown for one newer than this SDK
	}
}

Client.Events streams every event of the workspace, such as *realtime.BalanceUpdated and *realtime.Notification, until your ctx ends. It yields *realtime.Connected on each connection, the events the workspace kept, *realtime.ReplayDone, then live events. The stream reconnects with backoff and resumes after the last event it yielded, so you never see one twice. To resume in a later process, store ev.EventID() and pass it as EventsParams.LastEventID. *realtime.Resync says events were lost: read your state again. A refusal no reconnect fixes, such as a revoked key or one without the jobs:read scope, ends the stream with a *rendobar.Error. The key travels in the Authorization header, never in the URL.

Configuration

rb := rendobar.New(
	rendobar.WithAPIKey(os.Getenv("MY_RENDOBAR_KEY")),
	rendobar.WithBaseURL("http://localhost:8787"),
	rendobar.WithTimeout(time.Minute),
)
  • WithAPIKey sets the key. Without it the client reads RENDOBAR_API_KEY. With neither, calls that need a key fail with CodeMissingAPIKey.
  • WithBaseURL sends every request to another API host, such as a test server or another Rendobar environment. The default is https://api.rendobar.com.
  • WithTimeout bounds each attempt, 30 seconds by default, including reading the body. For Jobs.Download it bounds only the wait for the response headers. It wins over the Timeout of a WithHTTPClient client in either order.
  • WithHTTPClient sets the HTTP client. The client you pass is copied and never changed.
  • WithMaxRetries sets how many times a 429, 500, 502, 503, 504 or a connection error is retried. The default is 2.
  • WithApp names your application in requests, 1 to 32 letters, digits or . _ + -. Another name makes every call return an INVALID_ARGUMENT error.
  • WithDeprecationHandler is called once per deprecated endpoint you use. The default logs to stderr.

Examples

examples/ has small programs that use the SDK the way your code would. CI runs each one against a mock on every pull request.

  • quickstart: probes a public video and prints its duration, resolution and codecs.
  • upload-process-download: uploads a clip, trims it, streams the output to disk and checks it, then shares and deletes it.
  • batch-worker: submits keyed jobs, triggers each error type, pages through jobs and cancels one.
  • webhook-receiver: manages its own webhook endpoint and verifies typed deliveries in a net/http server.
  • account-admin: reads the plan, billing, usage, API keys, the workspace and its settings, and checks a compose timeline.

examples/README.md explains how to run them.

Other Rendobar SDKs

Versioning and support

This module follows semantic versioning. While it is at 0.x, a minor release may tighten types, and the changelog says so when it does. Rendobar announces a deprecation before it removes anything. A deprecated endpoint keeps working until then, and WithDeprecationHandler reports each one you call. See the versioning policy and the changelog.

This module supports Go 1.23 and newer, as its go.mod states. CI tests Go 1.23 and the two newest Go releases. It runs the shared Rendobar conformance scenarios from rendobar/openapi.

License

MIT, see LICENSE. Rendobar is a product of Craftobar LLC.

Documentation

Overview

Package rendobar is the official Go client for Rendobar's media processing and AI generation API. Submit a job, wait for it, and read the hosted URL of its output.

Each job type has a typed params struct generated from the API's schema. An ffmpeg job writes files, and Output.File is the one it wrote:

rb := rendobar.New() // reads RENDOBAR_API_KEY
job, err := rb.Jobs.Run(ctx, rendobar.CreateParams{
	Params: rendobar.FfmpegParams{Command: "ffmpeg -i https://cdn.rendobar.com/assets/examples/sample.mp4 -vf scale=1280:-2 out.mp4"},
}, nil)
if err != nil {
	return err
}
fmt.Println(job.Complete.Output.File.URL)

An ffprobe job reads a file and returns data, not a file, so Output.File is nil. JobComplete.Ffprobe reads the data:

job, err := rb.Jobs.Run(ctx, rendobar.CreateParams{
	Params: rendobar.FfprobeParams{Command: "https://cdn.rendobar.com/assets/examples/sample.mp4"},
}, nil)
if err != nil {
	return err
}
probe, err := job.Complete.Ffprobe()

The Client has one field per resource of the API, such as Jobs, Uploads, Assets, Webhooks, Storage, Billing, APIKeys and Orgs. Errors are *Error values: check them with errors.As and compare Code with the Code constants.

Two subpackages cover the rest. Package github.com/rendobar/rendobar-go/webhooks verifies and reads webhook deliveries and per-job callbacks. Package github.com/rendobar/rendobar-go/realtime streams a workspace's events over a WebSocket, and only programs that import it build in its WebSocket library.

Docs: https://rendobar.com/docs/sdk/go

Example

Run an ffmpeg job and read the URL of the file it wrote.

package main

import (
	"context"
	"errors"
	"fmt"

	"github.com/rendobar/rendobar-go"
)

const sample = "https://cdn.rendobar.com/assets/examples/sample.mp4"

func main() {
	rb := rendobar.New() // reads RENDOBAR_API_KEY
	job, err := rb.Jobs.Run(context.Background(), rendobar.CreateParams{
		Params: rendobar.FfmpegParams{Command: "ffmpeg -i " + sample + " -vf scale=1280:-2 out.mp4"},
	}, nil)
	if err != nil {
		var failed *rendobar.JobFailedError
		if errors.As(err, &failed) {
			fmt.Println("job failed:", failed.Code)
		}
		return
	}
	fmt.Println(job.Complete.Output.File.URL)
}
Example (Probe)

Probe a file. ffprobe returns data and writes no file, so read it with Ffprobe.

package main

import (
	"context"
	"fmt"

	"github.com/rendobar/rendobar-go"
)

const sample = "https://cdn.rendobar.com/assets/examples/sample.mp4"

func main() {
	rb := rendobar.New()
	job, err := rb.Jobs.Run(context.Background(), rendobar.CreateParams{
		Params: rendobar.FfprobeParams{Command: sample},
	}, nil)
	if err != nil {
		fmt.Println(err)
		return
	}
	probe, err := job.Complete.Ffprobe()
	if err != nil {
		fmt.Println(err)
		return
	}
	// The summary holds one variant per kind of media. A kind newer than this
	// SDK sets Kind and leaves every variant nil.
	if s := probe.Summary; s != nil && s.Video != nil && s.Video.Video != nil {
		v := s.Video.Video
		fmt.Println(v.Codec, *v.Width, *v.Height)
	}
}
Example (Webhook)

Verify and read a webhook delivery in a net/http handler.

package main

import (
	"fmt"
	"io"
	"net/http"
	"os"

	"github.com/rendobar/rendobar-go/webhooks"
)

func main() {
	secret := os.Getenv("RENDOBAR_WEBHOOK_SECRET")
	http.HandleFunc("/rendobar-webhook", func(w http.ResponseWriter, r *http.Request) {
		body, _ := io.ReadAll(r.Body) // the exact bytes the signature covers
		event, err := webhooks.Parse(body, r.Header, secret)
		if err != nil {
			w.WriteHeader(http.StatusUnauthorized)
			return
		}
		payload, err := event.Payload()
		if err != nil {
			w.WriteHeader(http.StatusBadRequest)
			return
		}
		switch data := payload.(type) {
		case *webhooks.JobCompletedData:
			if data.Output != nil && data.Output.File != nil { // a data job has no file
				fmt.Println(data.JobID, data.Output.File.URL)
			}
		case *webhooks.JobFailedData:
			fmt.Println(data.JobID, data.Error.Code)
		default:
			// An event this handler ignores, or one newer than this SDK.
		}
		w.WriteHeader(http.StatusNoContent)
	})
}

Index

Examples

Constants

View Source
const DefaultBaseURL = "https://api.rendobar.com"

DefaultBaseURL is the production API.

View Source
const Version = "0.1.0" // x-release-please-version

Version is this SDK's release, sent in X-Rendobar-Client.

Variables

This section is empty.

Functions

func GenerateIdempotencyKey

func GenerateIdempotencyKey() string

GenerateIdempotencyKey returns "sdk_" plus 32 hex characters: unique per call, not secret.

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to v, for the optional numbers and booleans in params:

rendobar.FfmpegParams{Command: "...", Timeout: rendobar.Ptr[int64](600)}

Types

type APIKey

type APIKey struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// Key prefix (rb_xxx)
	Prefix string `json:"prefix"`
	// False when the key is disabled (soft-revoked)
	Enabled bool `json:"enabled"`
	// Unix ms
	CreatedAt  UnixMillis `json:"createdAt"`
	LastUsedAt UnixMillis `json:"lastUsedAt"`
	ExpiresAt  UnixMillis `json:"expiresAt"`
	// What the key may do, `write` including `read`. Set when the key is created and never changed by its creator's role. Never keys:write.
	Scopes []string `json:"scopes"`
	// Who created the key. Null when that account no longer exists.
	CreatedBy *APIKeyCreatedBy `json:"createdBy"`
	// Whether the caller may rename, disable or revoke this key.
	Manageable bool `json:"manageable"`
	// Who disabled the key. Null when it is enabled, or was disabled before this was recorded.
	DisabledBy *APIKeyDisabledBy `json:"disabledBy"`
	// Unix ms the key was disabled, when recorded.
	DisabledAt UnixMillis `json:"disabledAt"`
	// Full API key value (rb_xxx...). Only returned once!
	Key string `json:"key"`
}

APIKey is read from the API. Fields it does not send are zero.

type APIKeyCreatedBy

type APIKeyCreatedBy struct {
	Name string `json:"name"`
	// False once the creator has left the workspace. The key stays.
	InWorkspace bool `json:"inWorkspace"`
	// The creator's email, as the Team page shows it. Null once they have left, or when the caller cannot read the team.
	Email string `json:"email"`
	// The creator's role in this workspace now. Null once they have left, or when the caller cannot read the team.
	Role *MemberRole `json:"role"`
}

Who created the key. Null when that account no longer exists.

type APIKeyDisabledBy

type APIKeyDisabledBy struct {
	Name string `json:"name"`
}

Who disabled the key. Null when it is enabled, or was disabled before this was recorded.

type APIKeys

type APIKeys struct {
	// contains filtered or unexported fields
}

APIKeys creates, lists, updates and revokes the workspace's API keys.

func (*APIKeys) Create

func (k *APIKeys) Create(ctx context.Context, p CreateAPIKeyParams) (*APIKey, error)

Create makes an API key and returns it with its value in Key, the only time the value is shown. Scopes left empty give the key everything your role can grant. The key belongs to the workspace and keeps working if you leave.

An API key cannot create keys: called with one, Create returns a 403 *Error. Use a session or an OAuth connection that holds keys:write.

func (*APIKeys) List

func (k *APIKeys) List(ctx context.Context) ([]*APIKey, error)

List returns the workspace's API keys. Key is always "": a key's value is shown only when it is created.

func (*APIKeys) Revoke

func (k *APIKeys) Revoke(ctx context.Context, id string) error

Revoke deletes a key. Requests with it fail from then on.

func (*APIKeys) Update

func (k *APIKeys) Update(ctx context.Context, id string, p UpdateAPIKeyParams) (*APIKey, error)

Update renames a key, or disables or enables it. It needs the Admin or Owner role, for any key in the workspace.

type Account

type Account struct {
	// contains filtered or unexported fields
}

Account reads what this API key's workspace may do.

func (*Account) Capabilities

func (a *Account) Capabilities(ctx context.Context) (*AccountCapabilities, error)

Capabilities returns plan limits and enabled features. It contains no billing data.

type AccountBucketsParams

type AccountBucketsParams struct {
	// Provider is StorageProviderS3 or StorageProviderR2. "" is S3.
	Provider StorageProvider
}

AccountBucketsParams picks the provider Storage.ListAccountBuckets asks.

type AccountCapabilities

type AccountCapabilities struct {
	Plan     Plan     `json:"plan"`
	Limits   Limits   `json:"limits"`
	Features Features `json:"features"`
}

AccountCapabilities is what this API key's workspace may do.

type Asset

type Asset struct {
	// Asset ID (e.g., asset_abc123def456)
	ID string `json:"id"`
	// Stable content URL — pass this as a job input; resolves to a presigned GET at dispatch
	URL string `json:"url"`
	// Organization ID that owns this asset
	OrgID string `json:"orgId"`
	// User ID that created the asset
	CreatedBy string `json:"createdBy"`
	// ephemeral | persisted
	Lifecycle AssetLifecycle `json:"lifecycle"`
	// pending | uploading | ready | failed | expired
	Status AssetStatus `json:"status"`
	// upload | url | job_output
	Source string `json:"source"`
	// media | psd_template | font | other
	Kind AssetKind `json:"kind"`
	// org | system
	Scope AssetScope `json:"scope"`
	// auto | eu
	Region string `json:"region"`
	// R2 etag recorded at finalize
	Etag string `json:"etag"`
	// Client-declared sha256
	Checksum string `json:"checksum"`
	// Client-declared size at init
	DeclaredSize *int64 `json:"declaredSize"`
	// Measured size at finalize
	SizeBytes *int64 `json:"sizeBytes"`
	// MIME content type
	ContentType string `json:"contentType"`
	// video | image | audio | font | other
	MediaType string `json:"mediaType"`
	// Sanitized display filename
	Filename string `json:"filename"`
	// Ephemeral TTL (Unix ms)
	ExpiresAt UnixMillis `json:"expiresAt"`
	// JSON probe results
	Metadata string `json:"metadata"`
	// Creation timestamp (Unix ms)
	CreatedAt UnixMillis `json:"createdAt"`
	// Last update timestamp (Unix ms)
	UpdatedAt UnixMillis `json:"updatedAt"`
}

Asset is read from the API. Fields it does not send are zero.

type AssetDownload

type AssetDownload struct {
	// Presigned GET URL
	URL string `json:"url"`
	// Expiry timestamp (Unix ms)
	ExpiresAt UnixMillis `json:"expiresAt"`
}

AssetDownload is read from the API. Fields it does not send are zero.

type AssetKind

type AssetKind string

Filter by asset kind

The API may add values, so keep a default branch.

const (
	AssetKindMedia       AssetKind = "media"
	AssetKindPsdTemplate AssetKind = "psd_template"
	AssetKindFont        AssetKind = "font"
	AssetKindOther       AssetKind = "other"
)

The AssetKind values this SDK knows.

type AssetLifecycle

type AssetLifecycle string

Filter by lifecycle

The API may add values, so keep a default branch.

const (
	AssetLifecycleEphemeral AssetLifecycle = "ephemeral"
	AssetLifecyclePersisted AssetLifecycle = "persisted"
)

The AssetLifecycle values this SDK knows.

type AssetPage

type AssetPage struct {
	Assets []*Asset
	Meta   OffsetMeta
}

AssetPage is one page of assets.

type AssetScope

type AssetScope string

Filter by scope (defaults to org assets)

The API may add values, so keep a default branch.

const (
	AssetScopeOrg    AssetScope = "org"
	AssetScopeSystem AssetScope = "system"
)

The AssetScope values this SDK knows.

type AssetStatus

type AssetStatus string

Filter by status

The API may add values, so keep a default branch.

const (
	AssetStatusPending   AssetStatus = "pending"
	AssetStatusUploading AssetStatus = "uploading"
	AssetStatusReady     AssetStatus = "ready"
	AssetStatusFailed    AssetStatus = "failed"
	AssetStatusExpired   AssetStatus = "expired"
)

The AssetStatus values this SDK knows.

type Assets

type Assets struct {
	// contains filtered or unexported fields
}

Assets lists, reads and deletes the workspace's files: uploads, fetched URLs and job outputs. Uploads.Create adds one.

func (*Assets) Delete

func (a *Assets) Delete(ctx context.Context, id string) error

Delete deletes an asset and its file.

func (*Assets) Download

func (a *Assets) Download(ctx context.Context, id string) (*AssetDownload, error)

Download returns a short-lived URL that downloads the asset's file.

func (*Assets) Get

func (a *Assets) Get(ctx context.Context, id string) (*Asset, error)

Get returns one asset.

func (*Assets) List

func (a *Assets) List(ctx context.Context, p ListAssetsParams) (*AssetPage, error)

List returns one page of assets. A negative Limit or Offset is an INVALID_ARGUMENT *Error.

func (*Assets) Templates

func (a *Assets) Templates(ctx context.Context, p TemplatesParams) (*AssetPage, error)

Templates returns one page of the templates Rendobar provides to every workspace.

type Billing

type Billing struct {
	// contains filtered or unexported fields
}

Billing reads the workspace's balance, plan, usage and invoices, and starts checkouts and subscription changes.

func (*Billing) CancelCreditSchedule

func (b *Billing) CancelCreditSchedule(ctx context.Context) error

CancelCreditSchedule stops the recurring monthly credit top-up at the end of the current period. The plan is separate: CancelSubscription manages it.

func (*Billing) CancelSubscription

func (b *Billing) CancelSubscription(ctx context.Context) error

CancelSubscription cancels the plan at the end of the current period. Until then the plan stays, and ReactivateSubscription undoes the cancel.

func (*Billing) CheckoutCredits

func (b *Billing) CheckoutCredits(ctx context.Context, p CheckoutCreditsParams) (*Checkout, error)

CheckoutCredits starts a credit purchase and returns the checkout to open. Leave Interval empty for a one-time top-up.

func (*Billing) CheckoutPlan

func (b *Billing) CheckoutPlan(ctx context.Context, p CheckoutPlanParams) (*PlanCheckout, error)

CheckoutPlan starts a paid plan, such as PlanPro or PlanStudio. A workspace with no paid plan gets a checkout to open. One on another paid plan has its subscription moved, billed pro rata.

func (*Billing) DeletePaymentMethod

func (b *Billing) DeletePaymentMethod(ctx context.Context, id string) error

DeletePaymentMethod removes a saved payment method.

func (*Billing) History

func (b *Billing) History(ctx context.Context, p PageParams) (*InvoicePage, error)

History returns one page of invoices: plan charges and credit purchases.

func (*Billing) PaymentMethods

func (b *Billing) PaymentMethods(ctx context.Context) ([]*PaymentMethod, error)

PaymentMethods lists the workspace's saved payment methods.

func (*Billing) PortalURL

func (b *Billing) PortalURL(ctx context.Context) (string, error)

PortalURL returns a link to the payment provider's billing portal, where the workspace manages payment methods and invoices.

func (*Billing) ReactivateSubscription

func (b *Billing) ReactivateSubscription(ctx context.Context) error

ReactivateSubscription keeps a plan that CancelSubscription set to end.

func (*Billing) SetDefaultPaymentMethod

func (b *Billing) SetDefaultPaymentMethod(ctx context.Context, id string) error

SetDefaultPaymentMethod makes a saved payment method the one charged.

func (*Billing) State

func (b *Billing) State(ctx context.Context) (*BillingState, error)

State returns the balance, the plan and its limits, the subscription and this period's usage.

func (*Billing) Transactions

func (b *Billing) Transactions(ctx context.Context, p PageParams) (*TransactionPage, error)

Transactions returns one page of credits and debits to the balance.

func (*Billing) Usage

func (b *Billing) Usage(ctx context.Context, p UsageParams) (*Usage, error)

Usage returns jobs, spend and compute time over a range of days, in total, by job type and day by day.

func (*Billing) UsageByClient

func (b *Billing) UsageByClient(ctx context.Context, p UsageByClientParams) ([]*ClientUsage, error)

UsageByClient returns jobs and spend grouped by the client that submitted them, such as the dashboard, an SDK, the CLI, MCP or n8n.

type BillingState

type BillingState struct {
	Balance      *BillingStateBalance      `json:"balance"`
	Plan         *BillingStatePlan         `json:"plan"`
	Subscription *BillingStateSubscription `json:"subscription"`
	Usage        *BillingStateUsage        `json:"usage"`
	// True on any paid plan
	IsPro bool `json:"isPro"`
	// Bonus multiplier on credit purchases
	CreditBonusRate float64                   `json:"creditBonusRate"`
	CreditsAdded    *BillingStateCreditsAdded `json:"creditsAdded"`
	// Active recurring credit top-up, or null when the org has none
	CreditSchedule *BillingStateCreditSchedule `json:"creditSchedule"`
	// Next plan up for upgrade comparison. Null if on highest plan.
	UpgradePlan *BillingStateUpgradePlan `json:"upgradePlan"`
}

BillingState is read from the API. Fields it does not send are zero.

type BillingStateBalance

type BillingStateBalance struct {
	// Balance in dollars
	Amount float64 `json:"amount"`
}

BillingStateBalance is read from the API. Fields it does not send are zero.

type BillingStateCreditSchedule

type BillingStateCreditSchedule struct {
	// Amount added each month, in cents
	AmountCents int64 `json:"amountCents"`
	// Unix ms of the next charge
	CurrentPeriodEnd UnixMillis `json:"currentPeriodEnd"`
	// True when the schedule ends at the current period
	CancelAtPeriodEnd bool `json:"cancelAtPeriodEnd"`
}

Active recurring credit top-up, or null when the org has none

type BillingStateCreditsAdded

type BillingStateCreditsAdded struct {
	// Dollars bought, lifetime, net of any plan bonus
	Purchased float64 `json:"purchased"`
	// Dollars the plan added on top of purchases, lifetime
	Bonus float64 `json:"bonus"`
	// Dollars granted by a plan's monthly credits, lifetime
	Included float64 `json:"included"`
	// Dollars from the signup grant
	Granted float64 `json:"granted"`
}

BillingStateCreditsAdded is read from the API. Fields it does not send are zero.

type BillingStatePlan

type BillingStatePlan struct {
	// The plan id: free, pro, studio for a self-serve plan, or an enterprise plan's own id.
	Slug PlanSlug `json:"slug"`
	// Display name
	Name string `json:"name"`
	// Monthly price in dollars
	Price  float64                 `json:"price"`
	Limits *BillingStatePlanLimits `json:"limits"`
}

BillingStatePlan is read from the API. Fields it does not send are zero.

type BillingStatePlanLimits

type BillingStatePlanLimits struct {
	ConcurrentJobs       int64 `json:"concurrentJobs"`
	APIRequestsPerMinute int64 `json:"apiRequestsPerMinute"`
	MaxJobTimeout        int64 `json:"maxJobTimeout"`
	MaxInputFileSize     int64 `json:"maxInputFileSize"`
	// Members the organization may hold, pending invitations included
	TeamMembers int64 `json:"teamMembers"`
}

BillingStatePlanLimits is read from the API. Fields it does not send are zero.

type BillingStateSubscription

type BillingStateSubscription struct {
	Status             string     `json:"status"`
	CancelAtPeriodEnd  bool       `json:"cancelAtPeriodEnd"`
	CurrentPeriodEnd   UnixMillis `json:"currentPeriodEnd"`
	CurrentPeriodStart UnixMillis `json:"currentPeriodStart"`
	// True when a change to another paid plan moves this subscription, billed or credited pro rata. False when it opens a checkout.
	ChangesInPlace bool `json:"changesInPlace"`
}

BillingStateSubscription is read from the API. Fields it does not send are zero.

type BillingStateUpgradePlan

type BillingStateUpgradePlan struct {
	// Plan slug
	ID string `json:"id"`
	// Display name
	Name string `json:"name"`
	// Monthly price in dollars
	Price  float64                 `json:"price"`
	Limits *BillingStatePlanLimits `json:"limits"`
}

Next plan up for upgrade comparison. Null if on highest plan.

type BillingStateUsage

type BillingStateUsage struct {
	// Spend in dollars for the current period
	CurrentPeriodSpend float64 `json:"currentPeriodSpend"`
	// Jobs in the current period
	JobCount int64 `json:"jobCount"`
	// Milliseconds the org's jobs spent waiting for a concurrency slot over the reporting window: the last 30 days on Free, the current billing period on a paid plan. Counts only jobs whose wait passed the dispatch floor, so a job that never queued adds nothing.
	SlotWaitMs int64 `json:"slotWaitMs"`
	// Jobs that waited for a concurrency slot over the same window
	SlotWaitJobs int64 `json:"slotWaitJobs"`
	// Milliseconds the plan's extra concurrency slots saved the org's jobs over the same window: what the same jobs would have waited behind the free plan's single slot, beyond what they did. Counts only jobs whose saving passed the dispatch floor. Always 0 on Free.
	SlotWaitSavedMs int64 `json:"slotWaitSavedMs"`
	// Jobs whose saving passed the dispatch floor over the same window. Always 0 on Free.
	SlotWaitSavedJobs int64 `json:"slotWaitSavedJobs"`
}

BillingStateUsage is read from the API. Fields it does not send are zero.

type BootPhase

type BootPhase string

BootPhase is how far a runner is in starting up for a job. The API documents these values in prose, so the list is kept here. New values may appear.

const (
	BootScheduling   BootPhase = "scheduling"
	BootQueued       BootPhase = "queued"
	BootPullingImage BootPhase = "pulling-image"
	BootBooting      BootPhase = "booting"
	BootRestoring    BootPhase = "restoring"
)

The BootPhase values this SDK knows.

type BootState

type BootState struct {
	Phase BootPhase
	// Detail is a human-readable line, such as "waiting for GPU capacity".
	Detail  string
	Elapsed time.Duration // since dispatch
	Typical time.Duration // a typical start-up for this workload, or 0 when unknown
	ETA     time.Duration // estimated time left for the whole job, or 0 when unknown
}

BootState describes a runner starting up for a dispatched job.

type Callback

type Callback struct {
	URL string // an HTTPS URL
	// Headers are sent with the POST, such as an Authorization bearer for an
	// authenticated endpoint. X-Rendobar-* headers are reserved.
	Headers map[string]string
	// Verify signs the POST with X-Rendobar-Signature, the webhook scheme,
	// keyed with your workspace's callback signing secret. Unsigned by default.
	Verify bool
	// Events adds non-terminal events. The terminal ones always fire.
	Events []CallbackEvent
}

Callback is a per-job completion callback. When the job completes, fails or is cancelled, the API POSTs the standard webhook envelope to URL (see the webhooks package).

type CallbackEvent

type CallbackEvent string

CallbackEvent is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CallbackEventJobStarted CallbackEvent = "job.started"
)

The CallbackEvent values this SDK knows.

type CallbackStatus

type CallbackStatus string

Delivery state of the per-job completion callback.

The API may add values, so keep a default branch.

const (
	CallbackStatusPending   CallbackStatus = "pending"
	CallbackStatusDelivered CallbackStatus = "delivered"
	CallbackStatusFailed    CallbackStatus = "failed"
)

The CallbackStatus values this SDK knows.

type CaptionBurnAlignment

type CaptionBurnAlignment string

Horizontal alignment. Default: "center".

Validate refuses a value outside the list below.

const (
	CaptionBurnAlignmentLeft   CaptionBurnAlignment = "left"
	CaptionBurnAlignmentCenter CaptionBurnAlignment = "center"
	CaptionBurnAlignmentRight  CaptionBurnAlignment = "right"
)

The CaptionBurnAlignment values this SDK knows.

type CaptionBurnLanguage

type CaptionBurnLanguage string

Spoken language for auto-transcription as an ISO-639-1 code (e.g. en, es, ja), or 'auto' to detect. Ignored when a subtitle file is provided. Default: "auto".

Validate refuses a value outside the list below.

const (
	CaptionBurnLanguageAuto CaptionBurnLanguage = "auto"
	CaptionBurnLanguageEn   CaptionBurnLanguage = "en"
	CaptionBurnLanguageZh   CaptionBurnLanguage = "zh"
	CaptionBurnLanguageDe   CaptionBurnLanguage = "de"
	CaptionBurnLanguageEs   CaptionBurnLanguage = "es"
	CaptionBurnLanguageRu   CaptionBurnLanguage = "ru"
	CaptionBurnLanguageKo   CaptionBurnLanguage = "ko"
	CaptionBurnLanguageFr   CaptionBurnLanguage = "fr"
	CaptionBurnLanguageJa   CaptionBurnLanguage = "ja"
	CaptionBurnLanguagePt   CaptionBurnLanguage = "pt"
	CaptionBurnLanguageTr   CaptionBurnLanguage = "tr"
	CaptionBurnLanguagePl   CaptionBurnLanguage = "pl"
	CaptionBurnLanguageCa   CaptionBurnLanguage = "ca"
	CaptionBurnLanguageNl   CaptionBurnLanguage = "nl"
	CaptionBurnLanguageAr   CaptionBurnLanguage = "ar"
	CaptionBurnLanguageSv   CaptionBurnLanguage = "sv"
	CaptionBurnLanguageIt   CaptionBurnLanguage = "it"
	CaptionBurnLanguageID   CaptionBurnLanguage = "id"
	CaptionBurnLanguageHi   CaptionBurnLanguage = "hi"
	CaptionBurnLanguageFi   CaptionBurnLanguage = "fi"
	CaptionBurnLanguageVi   CaptionBurnLanguage = "vi"
	CaptionBurnLanguageHe   CaptionBurnLanguage = "he"
	CaptionBurnLanguageUk   CaptionBurnLanguage = "uk"
	CaptionBurnLanguageEl   CaptionBurnLanguage = "el"
	CaptionBurnLanguageMs   CaptionBurnLanguage = "ms"
	CaptionBurnLanguageCs   CaptionBurnLanguage = "cs"
	CaptionBurnLanguageRo   CaptionBurnLanguage = "ro"
	CaptionBurnLanguageDa   CaptionBurnLanguage = "da"
	CaptionBurnLanguageHu   CaptionBurnLanguage = "hu"
	CaptionBurnLanguageTa   CaptionBurnLanguage = "ta"
	CaptionBurnLanguageNo   CaptionBurnLanguage = "no"
	CaptionBurnLanguageTh   CaptionBurnLanguage = "th"
	CaptionBurnLanguageUr   CaptionBurnLanguage = "ur"
	CaptionBurnLanguageHr   CaptionBurnLanguage = "hr"
	CaptionBurnLanguageBg   CaptionBurnLanguage = "bg"
	CaptionBurnLanguageLt   CaptionBurnLanguage = "lt"
	CaptionBurnLanguageLa   CaptionBurnLanguage = "la"
	CaptionBurnLanguageMi   CaptionBurnLanguage = "mi"
	CaptionBurnLanguageMl   CaptionBurnLanguage = "ml"
	CaptionBurnLanguageCy   CaptionBurnLanguage = "cy"
	CaptionBurnLanguageSk   CaptionBurnLanguage = "sk"
	CaptionBurnLanguageTe   CaptionBurnLanguage = "te"
	CaptionBurnLanguageFa   CaptionBurnLanguage = "fa"
	CaptionBurnLanguageLv   CaptionBurnLanguage = "lv"
	CaptionBurnLanguageBn   CaptionBurnLanguage = "bn"
	CaptionBurnLanguageSr   CaptionBurnLanguage = "sr"
	CaptionBurnLanguageAz   CaptionBurnLanguage = "az"
	CaptionBurnLanguageSl   CaptionBurnLanguage = "sl"
	CaptionBurnLanguageKn   CaptionBurnLanguage = "kn"
	CaptionBurnLanguageEt   CaptionBurnLanguage = "et"
	CaptionBurnLanguageMk   CaptionBurnLanguage = "mk"
	CaptionBurnLanguageBr   CaptionBurnLanguage = "br"
	CaptionBurnLanguageEu   CaptionBurnLanguage = "eu"
	CaptionBurnLanguageIs   CaptionBurnLanguage = "is"
	CaptionBurnLanguageHy   CaptionBurnLanguage = "hy"
	CaptionBurnLanguageNe   CaptionBurnLanguage = "ne"
	CaptionBurnLanguageMn   CaptionBurnLanguage = "mn"
	CaptionBurnLanguageBs   CaptionBurnLanguage = "bs"
	CaptionBurnLanguageKk   CaptionBurnLanguage = "kk"
	CaptionBurnLanguageSq   CaptionBurnLanguage = "sq"
	CaptionBurnLanguageSw   CaptionBurnLanguage = "sw"
	CaptionBurnLanguageGl   CaptionBurnLanguage = "gl"
	CaptionBurnLanguageMr   CaptionBurnLanguage = "mr"
	CaptionBurnLanguagePa   CaptionBurnLanguage = "pa"
	CaptionBurnLanguageSi   CaptionBurnLanguage = "si"
	CaptionBurnLanguageKm   CaptionBurnLanguage = "km"
	CaptionBurnLanguageSn   CaptionBurnLanguage = "sn"
	CaptionBurnLanguageYo   CaptionBurnLanguage = "yo"
	CaptionBurnLanguageSo   CaptionBurnLanguage = "so"
	CaptionBurnLanguageAf   CaptionBurnLanguage = "af"
	CaptionBurnLanguageOc   CaptionBurnLanguage = "oc"
	CaptionBurnLanguageKa   CaptionBurnLanguage = "ka"
	CaptionBurnLanguageBe   CaptionBurnLanguage = "be"
	CaptionBurnLanguageTg   CaptionBurnLanguage = "tg"
	CaptionBurnLanguageSd   CaptionBurnLanguage = "sd"
	CaptionBurnLanguageGu   CaptionBurnLanguage = "gu"
	CaptionBurnLanguageAm   CaptionBurnLanguage = "am"
	CaptionBurnLanguageYi   CaptionBurnLanguage = "yi"
	CaptionBurnLanguageLo   CaptionBurnLanguage = "lo"
	CaptionBurnLanguageUz   CaptionBurnLanguage = "uz"
	CaptionBurnLanguageFo   CaptionBurnLanguage = "fo"
	CaptionBurnLanguageHt   CaptionBurnLanguage = "ht"
	CaptionBurnLanguagePs   CaptionBurnLanguage = "ps"
	CaptionBurnLanguageTk   CaptionBurnLanguage = "tk"
	CaptionBurnLanguageNn   CaptionBurnLanguage = "nn"
	CaptionBurnLanguageMt   CaptionBurnLanguage = "mt"
	CaptionBurnLanguageSa   CaptionBurnLanguage = "sa"
	CaptionBurnLanguageLb   CaptionBurnLanguage = "lb"
	CaptionBurnLanguageMy   CaptionBurnLanguage = "my"
	CaptionBurnLanguageBo   CaptionBurnLanguage = "bo"
	CaptionBurnLanguageTl   CaptionBurnLanguage = "tl"
	CaptionBurnLanguageMg   CaptionBurnLanguage = "mg"
	CaptionBurnLanguageAs   CaptionBurnLanguage = "as"
	CaptionBurnLanguageTt   CaptionBurnLanguage = "tt"
	CaptionBurnLanguageHaw  CaptionBurnLanguage = "haw"
	CaptionBurnLanguageLn   CaptionBurnLanguage = "ln"
	CaptionBurnLanguageHa   CaptionBurnLanguage = "ha"
	CaptionBurnLanguageBa   CaptionBurnLanguage = "ba"
	CaptionBurnLanguageJw   CaptionBurnLanguage = "jw"
	CaptionBurnLanguageSu   CaptionBurnLanguage = "su"
	CaptionBurnLanguageYue  CaptionBurnLanguage = "yue"
)

The CaptionBurnLanguage values this SDK knows.

type CaptionBurnParams

type CaptionBurnParams struct {
	// Spoken language for auto-transcription as an ISO-639-1 code (e.g. en, es, ja), or 'auto' to detect. Ignored when a subtitle file is provided. Default: "auto".
	Language CaptionBurnLanguage `json:"language,omitempty"`
	// Font family, or a CSS fallback stack. Any Google Fonts family works by name. Bundled and instant: Inter, Bebas Neue, Anton, Montserrat, Poppins, Roboto, Oswald. A stack falls through in CSS order, so "Lato, Inter, sans-serif" tries each in turn.
	Font string `json:"font,omitempty"`
	// Font size in pixels. Default: 48.
	FontSize *int64 `json:"fontSize,omitempty"`
	// Text color, web hex (#RRGGBB). Default: "#FFFFFF".
	FontColor string `json:"fontColor,omitempty"`
	// Bold text. Default: true.
	Bold *bool `json:"bold,omitempty"`
	// Italic text. Default: false.
	Italic *bool `json:"italic,omitempty"`
	// Outline color, web hex. Default: "#000000".
	OutlineColor string `json:"outlineColor,omitempty"`
	// Outline thickness in pixels. Default: 2.
	OutlineWidth *float64 `json:"outlineWidth,omitempty"`
	// Drop shadow depth in pixels. Default: 1.
	Shadow *float64 `json:"shadow,omitempty"`
	// Draw a background box behind captions. Default: false.
	BoxEnabled *bool `json:"boxEnabled,omitempty"`
	// Background box color, web hex. Default: "#000000".
	BoxColor string `json:"boxColor,omitempty"`
	// Background box opacity (0-1). Default: 0.6.
	BoxOpacity *float64 `json:"boxOpacity,omitempty"`
	// Vertical position. Default: "bottom".
	Position CaptionBurnPosition `json:"position,omitempty"`
	// Horizontal alignment. Default: "center".
	Alignment CaptionBurnAlignment `json:"alignment,omitempty"`
	// Vertical margin in pixels. Default: 60.
	MarginV *int64 `json:"marginV,omitempty"`
	// Horizontal margin in pixels. Default: 40.
	MarginH *int64 `json:"marginH,omitempty"`
	// Max characters per line (auto-transcribe path)
	MaxCharsPerLine *int64 `json:"maxCharsPerLine,omitempty"`
}

CaptionBurnParams are the params of a caption.burn job.

func (CaptionBurnParams) JobType

func (CaptionBurnParams) JobType() JobType

JobType returns JobTypeCaptionBurn.

func (CaptionBurnParams) Validate

func (v CaptionBurnParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type CaptionBurnPosition

type CaptionBurnPosition string

Vertical position. Default: "bottom".

Validate refuses a value outside the list below.

const (
	CaptionBurnPositionBottom CaptionBurnPosition = "bottom"
	CaptionBurnPositionCenter CaptionBurnPosition = "center"
	CaptionBurnPositionTop    CaptionBurnPosition = "top"
)

The CaptionBurnPosition values this SDK knows.

type CaptionsAnimateLanguage

type CaptionsAnimateLanguage string

Language hint. Supported: en. Default: "en".

Validate refuses a value outside the list below.

const (
	CaptionsAnimateLanguageEn CaptionsAnimateLanguage = "en"
)

The CaptionsAnimateLanguage values this SDK knows.

type CaptionsAnimateMode

type CaptionsAnimateMode string

Speed-vs-accuracy tradeoff. fast=base.en (~3× faster). balanced=small.en (default). accurate=large-v3-turbo (~3× slower, ~3-4% WER). Default: "balanced".

Validate refuses a value outside the list below.

const (
	CaptionsAnimateModeFast     CaptionsAnimateMode = "fast"
	CaptionsAnimateModeBalanced CaptionsAnimateMode = "balanced"
	CaptionsAnimateModeAccurate CaptionsAnimateMode = "accurate"
)

The CaptionsAnimateMode values this SDK knows.

type CaptionsAnimateParams

type CaptionsAnimateParams struct {
	// Built-in caption style preset. Default: "hormozi".
	Preset CaptionsAnimatePreset `json:"preset,omitempty"`
	// Language hint. Supported: en. Default: "en".
	Language CaptionsAnimateLanguage `json:"language,omitempty"`
	// Speed-vs-accuracy tradeoff. fast=base.en (~3× faster). balanced=small.en (default). accurate=large-v3-turbo (~3× slower, ~3-4% WER). Default: "balanced".
	Mode CaptionsAnimateMode `json:"mode,omitempty"`
	// Style overrides layered on top of `preset`. Any field you set wins; everything you omit keeps the preset's value.
	Style *CaptionsAnimateStyle `json:"style,omitempty"`
	// Default: false.
	CaptionData *bool `json:"captionData,omitempty"`
	// Default: false.
	AutoEmphasis *bool                      `json:"autoEmphasis,omitempty"`
	TranslateTo  CaptionsAnimateTranslateTo `json:"translateTo,omitempty"`
}

CaptionsAnimateParams are the params of a captions.animate job.

func (CaptionsAnimateParams) JobType

func (CaptionsAnimateParams) JobType() JobType

JobType returns JobTypeCaptionsAnimate.

func (CaptionsAnimateParams) Validate

func (v CaptionsAnimateParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type CaptionsAnimatePreset

type CaptionsAnimatePreset string

Built-in caption style preset. Default: "hormozi".

Validate refuses a value outside the list below.

const (
	CaptionsAnimatePresetHormozi       CaptionsAnimatePreset = "hormozi"
	CaptionsAnimatePresetMrbeast       CaptionsAnimatePreset = "mrbeast"
	CaptionsAnimatePresetTiktok        CaptionsAnimatePreset = "tiktok"
	CaptionsAnimatePresetPill          CaptionsAnimatePreset = "pill"
	CaptionsAnimatePresetKaraoke       CaptionsAnimatePreset = "karaoke"
	CaptionsAnimatePresetWordPop       CaptionsAnimatePreset = "word-pop"
	CaptionsAnimatePresetMinimal       CaptionsAnimatePreset = "minimal"
	CaptionsAnimatePresetSubtitleBlock CaptionsAnimatePreset = "subtitle-block"
	CaptionsAnimatePresetNeon          CaptionsAnimatePreset = "neon"
	CaptionsAnimatePresetGold          CaptionsAnimatePreset = "gold"
	CaptionsAnimatePresetReveal        CaptionsAnimatePreset = "reveal"
)

The CaptionsAnimatePreset values this SDK knows.

type CaptionsAnimateStyle

type CaptionsAnimateStyle struct {
	// Font family, or a CSS fallback stack. Any Google Fonts family works by name. Bundled and instant: Inter, Bebas Neue, Anton, Montserrat, Poppins, Roboto, Oswald. A stack falls through in CSS order, so "Lato, Inter, sans-serif" tries each in turn. Supplying the `font` job input renders in that file instead.
	Font        string                          `json:"font,omitempty"`
	FontSize    *int64                          `json:"fontSize,omitempty"`
	Case        CaptionsAnimateStyleCase        `json:"case,omitempty"`
	Fill        string                          `json:"fill,omitempty"`
	Stroke      *CaptionsAnimateStyleStroke     `json:"stroke,omitempty"`
	Shadow      *float64                        `json:"shadow,omitempty"`
	Bold        *bool                           `json:"bold,omitempty"`
	MarginV     *int64                          `json:"marginV,omitempty"`
	Highlight   *CaptionsAnimateStyleHighlight  `json:"highlight,omitempty"`
	Punctuation CaptionsAnimateStylePunctuation `json:"punctuation,omitempty"`
	Position    CaptionsAnimateStylePosition    `json:"position,omitempty"`
	Emphasis    *CaptionsAnimateStyleEmphasis   `json:"emphasis,omitempty"`
	Entrance    CaptionsAnimateStyleEntrance    `json:"entrance,omitempty"`
	Layout      CaptionsAnimateStyleLayout      `json:"layout,omitempty"`
}

Style overrides layered on top of `preset`. Any field you set wins; everything you omit keeps the preset's value.

type CaptionsAnimateStyleCase

type CaptionsAnimateStyleCase string

CaptionsAnimateStyleCase is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CaptionsAnimateStyleCaseUpper  CaptionsAnimateStyleCase = "upper"
	CaptionsAnimateStyleCaseNormal CaptionsAnimateStyleCase = "normal"
)

The CaptionsAnimateStyleCase values this SDK knows.

type CaptionsAnimateStyleEmphasis

type CaptionsAnimateStyleEmphasis struct {
	Color string `json:"color,omitempty"`
}

type CaptionsAnimateStyleEntrance

type CaptionsAnimateStyleEntrance string

CaptionsAnimateStyleEntrance is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CaptionsAnimateStyleEntranceFade   CaptionsAnimateStyleEntrance = "fade"
	CaptionsAnimateStyleEntrancePop    CaptionsAnimateStyleEntrance = "pop"
	CaptionsAnimateStyleEntranceBounce CaptionsAnimateStyleEntrance = "bounce"
)

The CaptionsAnimateStyleEntrance values this SDK knows.

type CaptionsAnimateStyleHighlight

type CaptionsAnimateStyleHighlight struct {
	Mode      CaptionsAnimateStyleHighlightMode `json:"mode,omitempty"`
	Color     string                            `json:"color,omitempty"`
	TextColor string                            `json:"textColor,omitempty"`
	Scale     *float64                          `json:"scale,omitempty"`
}

type CaptionsAnimateStyleHighlightMode

type CaptionsAnimateStyleHighlightMode string

CaptionsAnimateStyleHighlightMode is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CaptionsAnimateStyleHighlightModeColor CaptionsAnimateStyleHighlightMode = "color"
	CaptionsAnimateStyleHighlightModeBox   CaptionsAnimateStyleHighlightMode = "box"
)

The CaptionsAnimateStyleHighlightMode values this SDK knows.

type CaptionsAnimateStyleLayout

type CaptionsAnimateStyleLayout string

CaptionsAnimateStyleLayout is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CaptionsAnimateStyleLayoutWord   CaptionsAnimateStyleLayout = "word"
	CaptionsAnimateStyleLayoutPhrase CaptionsAnimateStyleLayout = "phrase"
)

The CaptionsAnimateStyleLayout values this SDK knows.

type CaptionsAnimateStylePosition

type CaptionsAnimateStylePosition string

CaptionsAnimateStylePosition is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CaptionsAnimateStylePositionTop    CaptionsAnimateStylePosition = "top"
	CaptionsAnimateStylePositionCenter CaptionsAnimateStylePosition = "center"
	CaptionsAnimateStylePositionBottom CaptionsAnimateStylePosition = "bottom"
)

The CaptionsAnimateStylePosition values this SDK knows.

type CaptionsAnimateStylePunctuation

type CaptionsAnimateStylePunctuation string

CaptionsAnimateStylePunctuation is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CaptionsAnimateStylePunctuationStrip    CaptionsAnimateStylePunctuation = "strip"
	CaptionsAnimateStylePunctuationEmphatic CaptionsAnimateStylePunctuation = "emphatic"
	CaptionsAnimateStylePunctuationKeep     CaptionsAnimateStylePunctuation = "keep"
)

The CaptionsAnimateStylePunctuation values this SDK knows.

type CaptionsAnimateStyleStroke

type CaptionsAnimateStyleStroke struct {
	Color string   `json:"color,omitempty"`
	Width *float64 `json:"width,omitempty"`
}

type CaptionsAnimateTranslateTo

type CaptionsAnimateTranslateTo string

CaptionsAnimateTranslateTo is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CaptionsAnimateTranslateToEs CaptionsAnimateTranslateTo = "es"
	CaptionsAnimateTranslateToFr CaptionsAnimateTranslateTo = "fr"
	CaptionsAnimateTranslateToDe CaptionsAnimateTranslateTo = "de"
	CaptionsAnimateTranslateToPt CaptionsAnimateTranslateTo = "pt"
	CaptionsAnimateTranslateToIt CaptionsAnimateTranslateTo = "it"
	CaptionsAnimateTranslateToNl CaptionsAnimateTranslateTo = "nl"
)

The CaptionsAnimateTranslateTo values this SDK knows.

type ChangeRoleParams

type ChangeRoleParams struct {
	Role MemberRole `json:"role,omitempty"`
}

ChangeRoleParams is what Orgs.Members.ChangeRole sends. It is checked before anything is sent.

type Checkout

type Checkout struct {
	CheckoutURL string `json:"checkoutUrl"`
	CheckoutID  string `json:"checkoutId"`
}

Checkout is read from the API. Fields it does not send are zero.

type CheckoutCreditsInterval

type CheckoutCreditsInterval string

CheckoutCreditsParams is what Billing.CheckoutCredits sends. It is checked before anything is sent. Omit for a one-time purchase. "month" starts a recurring top-up of the same amount every month.

Validate refuses a value outside the list below.

const (
	CheckoutCreditsIntervalMonth CheckoutCreditsInterval = "month"
)

The CheckoutCreditsInterval values this SDK knows.

type CheckoutCreditsParams

type CheckoutCreditsParams struct {
	// Amount in dollars (minimum $10)
	Amount *float64 `json:"amount,omitempty"`
	// Omit for a one-time purchase. "month" starts a recurring top-up of the same amount every month.
	Interval CheckoutCreditsInterval `json:"interval,omitempty"`
}

type CheckoutPlanParams

type CheckoutPlanParams struct {
	Plan PlanSlug `json:"plan,omitempty"`
}

CheckoutPlanParams is what Billing.CheckoutPlan sends. It is checked before anything is sent.

type Client

type Client struct {
	Jobs          *Jobs
	Billing       *Billing
	Uploads       *Uploads
	Webhooks      *Webhooks
	Storage       *Storage
	APIKeys       *APIKeys
	Orgs          *Orgs
	Account       *Account
	Compose       *Compose
	Assets        *Assets
	Notifications *Notifications
	// contains filtered or unexported fields
}

Client is the Rendobar API client. Make one and reuse it: it is safe for concurrent use.

func New

func New(opts ...Option) *Client

New returns a client. With no WithAPIKey it reads RENDOBAR_API_KEY. A client with no key can still call Jobs.Types and Jobs.Schema. Every other call returns an *Error with code MISSING_API_KEY without sending a request, or INVALID_API_KEY when the key does not start with rb_.

type ClientUsage

type ClientUsage struct {
	// Originating client: dashboard|sdk|cli|mcp|n8n|api|<custom>
	Client   string `json:"client"`
	JobCount int64  `json:"jobCount"`
	// Nanodollars charged for this client's jobs
	AmountCharged   int64  `json:"amountCharged"`
	AmountFormatted string `json:"amountFormatted"`
}

ClientUsage is read from the API. Fields it does not send are zero.

type Compose

type Compose struct {
	// contains filtered or unexported fields
}

Compose answers questions about compose jobs without rendering anything.

func (*Compose) Effects

func (c *Compose) Effects(ctx context.Context) (*ComposeEffects, error)

Effects lists every built-in effect, with its params, ranges, units, defaults and which ones take keyframes.

func (*Compose) EngineEffects

func (c *Compose) EngineEffects(ctx context.Context) (*ComposeEngineEffects, error)

EngineEffects lists every filter and service an engine effect may name, with its params. A filter a built-in effect covers is not listed.

func (*Compose) Validate

Validate checks compose params without rendering them. It is free, and nothing is stored. Params that are not valid are not an error: Validate returns them with Valid false and the Problems.

type ComposeEffect

type ComposeEffect struct {
	// What goes in the entry's "type".
	Type  string             `json:"type"`
	Group ComposeEffectGroup `json:"group"`
	// What it changes.
	Medium  ComposeEffectMedium           `json:"medium"`
	Summary string                        `json:"summary"`
	Params  map[string]ComposeEffectParam `json:"params"`
	// Parameters the entry must give.
	Required []string `json:"required"`
	// At least one of these must be given, for an effect that does nothing when empty.
	NeedsOneOf []string `json:"needsOneOf"`
}

ComposeEffect is read from the API. Fields it does not send are zero.

type ComposeEffectGroup

type ComposeEffectGroup string

ComposeEffectGroup is a value the API sends.

The API may add values, so keep a default branch.

const (
	ComposeEffectGroupColor   ComposeEffectGroup = "color"
	ComposeEffectGroupStylize ComposeEffectGroup = "stylize"
	ComposeEffectGroupLayers  ComposeEffectGroup = "layers"
	ComposeEffectGroupSound   ComposeEffectGroup = "sound"
)

The ComposeEffectGroup values this SDK knows.

type ComposeEffectMedium

type ComposeEffectMedium string

What it changes.

The API may add values, so keep a default branch.

const (
	ComposeEffectMediumPicture ComposeEffectMedium = "picture"
	ComposeEffectMediumSound   ComposeEffectMedium = "sound"
)

The ComposeEffectMedium values this SDK knows.

type ComposeEffectParam

type ComposeEffectParam struct {
	// number, a hex colour, one of `values`, a length (pixels as a number, or a percent of the frame as a string like "50%"), or a file: the URL of one, like a clip's src.
	Kind        ComposeParamKind `json:"kind"`
	Description string           `json:"description"`
	Min         float64          `json:"min"`
	Max         float64          `json:"max"`
	// Used when the parameter is left out. A parameter with no default and not in `required` changes nothing when left out.
	Default json.RawMessage `json:"default"`
	// px, deg, K, dB, Hz, s, LUFS or semitones. Absent for a plain ratio.
	Unit string `json:"unit"`
	// True when the parameter also takes a keyframe list, [{time, value, easing}].
	Keyframes bool `json:"keyframes"`
	// Colours only: also takes "#RRGGBBAA".
	Alpha bool `json:"alpha"`
	// Enums only: the accepted words.
	Values []string `json:"values"`
	// Lengths only: the side of the frame a percent is a share of.
	MeasuredAgainst ComposeMeasuredAgainst `json:"measuredAgainst"`
	// Files only: the file's extension, like ".cube".
	Format string `json:"format"`
}

ComposeEffectParam is read from the API. Fields it does not send are zero.

type ComposeEffects

type ComposeEffects struct {
	Effects []ComposeEffect `json:"effects"`
}

ComposeEffects is read from the API. Fields it does not send are zero.

type ComposeEngineEffects

type ComposeEngineEffects struct {
	Filters []EngineFilter `json:"filters"`
}

ComposeEngineEffects is read from the API. Fields it does not send are zero.

type ComposeMeasuredAgainst

type ComposeMeasuredAgainst string

Lengths only: the side of the frame a percent is a share of.

The API may add values, so keep a default branch.

const (
	ComposeMeasuredAgainstWidth  ComposeMeasuredAgainst = "width"
	ComposeMeasuredAgainstHeight ComposeMeasuredAgainst = "height"
)

The ComposeMeasuredAgainst values this SDK knows.

type ComposeParamKind

type ComposeParamKind string

number, a hex colour, one of `values`, a length (pixels as a number, or a percent of the frame as a string like "50%"), or a file: the URL of one, like a clip's src.

The API may add values, so keep a default branch.

const (
	ComposeParamKindNumber ComposeParamKind = "number"
	ComposeParamKindColor  ComposeParamKind = "color"
	ComposeParamKindEnum   ComposeParamKind = "enum"
	ComposeParamKindLength ComposeParamKind = "length"
	ComposeParamKindFile   ComposeParamKind = "file"
)

The ComposeParamKind values this SDK knows.

type ComposePrice

type ComposePrice struct {
	PerMinuteUSD float64 // one minute of output, billed per second
	MinSeconds   int64   // the shortest length billed
}

ComposePrice is the price of a compose render.

type ComposeValidateParams

type ComposeValidateParams struct {
	// Params are exactly the compose params you would submit, the Fields of
	// CustomParams{Type: JobTypeCompose}.
	Params map[string]any
}

ComposeValidateParams is what Compose.Validate checks.

type ComposeValidation

type ComposeValidation struct {
	Valid bool
	// Params are the params as a render reads them: defaults filled in, and a
	// timeline in an older shape rewritten into the current one. Submit these.
	// nil when the API could not read the params at all.
	Params map[string]any
	// Upgraded names what was rewritten from an older shape.
	Upgraded []string
	// Warnings are things a render accepts but you may not mean.
	Warnings []Problem
	// Problems are why the params are not valid, at least one when Valid is
	// false. A video above the plan has a problem at "output" whose UpgradeTo
	// names the plan that renders it.
	Problems []Problem
	// Price is what a render costs, when Valid is true.
	Price *ComposePrice
}

ComposeValidation is what Compose.Validate found. Branch on Valid.

func (*ComposeValidation) UnmarshalJSON

func (v *ComposeValidation) UnmarshalJSON(b []byte) error

UnmarshalJSON reads either outcome, valid or not.

type CompressTargetAlpha

type CompressTargetAlpha interface {
	// contains filtered or unexported methods
}

Alpha: "preserve", "flatten" (onto white), or a "#RRGGBB" fill color. Default: "preserve".

Set it to one of: CompressTargetAlphaMode, CompressTargetAlphaColor.

type CompressTargetAlphaColor

type CompressTargetAlphaColor string

type CompressTargetAlphaMode

type CompressTargetAlphaMode string

CompressTargetAlphaMode is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CompressTargetAlphaModePreserve CompressTargetAlphaMode = "preserve"
	CompressTargetAlphaModeFlatten  CompressTargetAlphaMode = "flatten"
)

The CompressTargetAlphaMode values this SDK knows.

type CompressTargetAudio

type CompressTargetAudio struct {
	// Normalize to this integrated LUFS target (e.g. -14). null = off.
	LoudnessLufs *float64 `json:"loudnessLufs,omitempty"`
	// Keep the source channel layout, or downmix. Default: "preserve".
	Channels CompressTargetAudioChannels `json:"channels,omitempty"`
}

Audio handling: an optional integrated-loudness target, and whether to keep or downmix the channel layout.

type CompressTargetAudioChannels

type CompressTargetAudioChannels string

Keep the source channel layout, or downmix. Default: "preserve".

Validate refuses a value outside the list below.

const (
	CompressTargetAudioChannelsPreserve CompressTargetAudioChannels = "preserve"
	CompressTargetAudioChannelsMono     CompressTargetAudioChannels = "mono"
	CompressTargetAudioChannelsStereo   CompressTargetAudioChannels = "stereo"
)

The CompressTargetAudioChannels values this SDK knows.

type CompressTargetCodec

type CompressTargetCodec string

Output codec, or 'auto' to pick the best one allowed by compatibility. Default: "auto".

Validate refuses a value outside the list below.

const (
	CompressTargetCodecAuto   CompressTargetCodec = "auto"
	CompressTargetCodecAv1    CompressTargetCodec = "av1"
	CompressTargetCodecHevc   CompressTargetCodec = "hevc"
	CompressTargetCodecH264   CompressTargetCodec = "h264"
	CompressTargetCodecVp9    CompressTargetCodec = "vp9"
	CompressTargetCodecAvif   CompressTargetCodec = "avif"
	CompressTargetCodecJxl    CompressTargetCodec = "jxl"
	CompressTargetCodecJpegli CompressTargetCodec = "jpegli"
	CompressTargetCodecWebp   CompressTargetCodec = "webp"
	CompressTargetCodecPng    CompressTargetCodec = "png"
	CompressTargetCodecOpus   CompressTargetCodec = "opus"
	CompressTargetCodecAac    CompressTargetCodec = "aac"
	CompressTargetCodecMp3    CompressTargetCodec = "mp3"
	CompressTargetCodecFlac   CompressTargetCodec = "flac"
	CompressTargetCodecAlac   CompressTargetCodec = "alac"
)

The CompressTargetCodec values this SDK knows.

type CompressTargetColorspace

type CompressTargetColorspace string

Preserve the source gamut, or convert to sRGB for web display.

Validate refuses a value outside the list below.

const (
	CompressTargetColorspacePreserve CompressTargetColorspace = "preserve"
	CompressTargetColorspaceSrgb     CompressTargetColorspace = "srgb"
)

The CompressTargetColorspace values this SDK knows.

type CompressTargetCompatibility

type CompressTargetCompatibility string

Decode reach the output must guarantee: "modern" (~90%, best efficiency), "broad" (~99%, default), "legacy" (~100%, oldest decoders). Default: "broad".

Validate refuses a value outside the list below.

const (
	CompressTargetCompatibilityModern CompressTargetCompatibility = "modern"
	CompressTargetCompatibilityBroad  CompressTargetCompatibility = "broad"
	CompressTargetCompatibilityLegacy CompressTargetCompatibility = "legacy"
)

The CompressTargetCompatibility values this SDK knows.

type CompressTargetEffort

type CompressTargetEffort string

Encode effort — trades speed for compression. Default: "balanced".

Validate refuses a value outside the list below.

const (
	CompressTargetEffortFast     CompressTargetEffort = "fast"
	CompressTargetEffortBalanced CompressTargetEffort = "balanced"
	CompressTargetEffortThorough CompressTargetEffort = "thorough"
)

The CompressTargetEffort values this SDK knows.

type CompressTargetFor

type CompressTargetFor string

Delivery posture: "web" (small, modern, sRGB, stripped) or "archive" (lossless, preserve everything). Omit for raw defaults.

Validate refuses a value outside the list below.

const (
	CompressTargetForWeb     CompressTargetFor = "web"
	CompressTargetForArchive CompressTargetFor = "archive"
)

The CompressTargetFor values this SDK knows.

type CompressTargetMaxResolution

type CompressTargetMaxResolution interface {
	// contains filtered or unexported methods
}

Cap the longest edge — a pixel value or a rung like "1080p". null = no cap.

Set it to one of: CompressTargetMaxResolutionInt, CompressTargetMaxResolutionPreset.

type CompressTargetMaxResolutionInt

type CompressTargetMaxResolutionInt int64

type CompressTargetMaxResolutionPreset

type CompressTargetMaxResolutionPreset string

CompressTargetMaxResolutionPreset is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CompressTargetMaxResolutionPreset4320p CompressTargetMaxResolutionPreset = "4320p"
	CompressTargetMaxResolutionPreset2160p CompressTargetMaxResolutionPreset = "2160p"
	CompressTargetMaxResolutionPreset1440p CompressTargetMaxResolutionPreset = "1440p"
	CompressTargetMaxResolutionPreset1080p CompressTargetMaxResolutionPreset = "1080p"
	CompressTargetMaxResolutionPreset720p  CompressTargetMaxResolutionPreset = "720p"
	CompressTargetMaxResolutionPreset480p  CompressTargetMaxResolutionPreset = "480p"
	CompressTargetMaxResolutionPreset360p  CompressTargetMaxResolutionPreset = "360p"
)

The CompressTargetMaxResolutionPreset values this SDK knows.

type CompressTargetMetadata

type CompressTargetMetadata string

Metadata: "all" (keep everything), "colorOnly" (strip EXIF/GPS; ICC preservation is best-effort), "none" (strip all).

Validate refuses a value outside the list below.

const (
	CompressTargetMetadataAll       CompressTargetMetadata = "all"
	CompressTargetMetadataColorOnly CompressTargetMetadata = "colorOnly"
	CompressTargetMetadataNone      CompressTargetMetadata = "none"
)

The CompressTargetMetadata values this SDK knows.

type CompressTargetParams

type CompressTargetParams struct {
	// Delivery posture: "web" (small, modern, sRGB, stripped) or "archive" (lossless, preserve everything). Omit for raw defaults.
	For CompressTargetFor `json:"for,omitempty"`
	// Target quality/size: "visually-lossless" | "balanced" | "efficient", a 1-100 quality number, or { quality } | { maxBytes } | { maxSize } | { bitrate }.
	Target CompressTargetTarget `json:"target,omitempty"`
	// Decode reach the output must guarantee: "modern" (~90%, best efficiency), "broad" (~99%, default), "legacy" (~100%, oldest decoders). Default: "broad".
	Compatibility CompressTargetCompatibility `json:"compatibility,omitempty"`
	// Output codec, or 'auto' to pick the best one allowed by compatibility. Default: "auto".
	Codec CompressTargetCodec `json:"codec,omitempty"`
	// Cap the longest edge — a pixel value or a rung like "1080p". null = no cap.
	MaxResolution CompressTargetMaxResolution `json:"maxResolution,omitempty"`
	// Preserve the source gamut, or convert to sRGB for web display.
	Colorspace CompressTargetColorspace `json:"colorspace,omitempty"`
	// Alpha: "preserve", "flatten" (onto white), or a "#RRGGBB" fill color. Default: "preserve".
	Alpha CompressTargetAlpha `json:"alpha,omitempty"`
	// Metadata: "all" (keep everything), "colorOnly" (strip EXIF/GPS; ICC preservation is best-effort), "none" (strip all).
	Metadata CompressTargetMetadata `json:"metadata,omitempty"`
	// Encode effort — trades speed for compression. Default: "balanced".
	Effort CompressTargetEffort `json:"effort,omitempty"`
	// Re-encode even if the input already meets the target. Default: false.
	ForceReencode *bool `json:"forceReencode,omitempty"`
	// Return a predicted result (size, quality, cost) without encoding. Default: false.
	DryRun *bool `json:"dryRun,omitempty"`
	// Video stream handling: whether soft subtitle tracks survive the encode, and which audio tracks are kept.
	Video *CompressTargetVideo `json:"video,omitempty"`
	// Audio handling: an optional integrated-loudness target, and whether to keep or downmix the channel layout.
	Audio *CompressTargetAudio `json:"audio,omitempty"`
	// Expert overrides for the quality search: which metric verifies the result, and a hard quality floor it must never fall below.
	Tuning *CompressTargetTuning `json:"tuning,omitempty"`
	// Max execution time in seconds (defaults to your plan's max job timeout).
	Timeout *int64 `json:"timeout,omitempty"`
}

CompressTargetParams are the params of a compress.target job.

func (CompressTargetParams) JobType

func (CompressTargetParams) JobType() JobType

JobType returns JobTypeCompressTarget.

func (CompressTargetParams) Validate

func (v CompressTargetParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type CompressTargetTarget

type CompressTargetTarget interface {
	// contains filtered or unexported methods
}

Target quality/size: "visually-lossless" | "balanced" | "efficient", a 1-100 quality number, or { quality } | { maxBytes } | { maxSize } | { bitrate }.

Set it to one of: CompressTargetTargetPreset, CompressTargetTargetInt, CompressTargetTargetQuality, CompressTargetTargetMaxBytes, CompressTargetTargetMaxSize, CompressTargetTargetBitrate.

type CompressTargetTargetBitrate

type CompressTargetTargetBitrate struct {
	Bitrate *int64 `json:"bitrate,omitempty"`
}

type CompressTargetTargetInt

type CompressTargetTargetInt int64

type CompressTargetTargetMaxBytes

type CompressTargetTargetMaxBytes struct {
	MaxBytes *int64 `json:"maxBytes,omitempty"`
}

type CompressTargetTargetMaxSize

type CompressTargetTargetMaxSize struct {
	MaxSize string `json:"maxSize,omitempty"`
}

type CompressTargetTargetPreset

type CompressTargetTargetPreset string

CompressTargetTargetPreset is a string from a fixed list. Validate refuses a value outside the list below.

const (
	CompressTargetTargetPresetVisuallyLossless CompressTargetTargetPreset = "visually-lossless"
	CompressTargetTargetPresetBalanced         CompressTargetTargetPreset = "balanced"
	CompressTargetTargetPresetEfficient        CompressTargetTargetPreset = "efficient"
)

The CompressTargetTargetPreset values this SDK knows.

type CompressTargetTargetQuality

type CompressTargetTargetQuality struct {
	Quality *int64 `json:"quality,omitempty"`
}

type CompressTargetTuning

type CompressTargetTuning struct {
	// Override the verification oracle. 'auto' picks per medium. Default: "auto".
	Metric CompressTargetTuningMetric `json:"metric,omitempty"`
	// Hard minimum quality the output must never drop below.
	Floor *float64 `json:"floor,omitempty"`
}

Expert overrides for the quality search: which metric verifies the result, and a hard quality floor it must never fall below.

type CompressTargetTuningMetric

type CompressTargetTuningMetric string

Override the verification oracle. 'auto' picks per medium. Default: "auto".

Validate refuses a value outside the list below.

const (
	CompressTargetTuningMetricAuto        CompressTargetTuningMetric = "auto"
	CompressTargetTuningMetricSsimulacra2 CompressTargetTuningMetric = "ssimulacra2"
	CompressTargetTuningMetricVMAF        CompressTargetTuningMetric = "vmaf"
)

The CompressTargetTuningMetric values this SDK knows.

type CompressTargetVideo

type CompressTargetVideo struct {
	// Soft subtitle tracks: "strip" (default) or "preserve" (best-effort copy; fails if the output container cannot hold the codec). Default: "strip".
	Subtitles CompressTargetVideoSubtitles `json:"subtitles,omitempty"`
	// Keep all audio tracks, only the primary, or drop audio entirely. Default: "all".
	AudioTracks CompressTargetVideoAudioTracks `json:"audioTracks,omitempty"`
}

Video stream handling: whether soft subtitle tracks survive the encode, and which audio tracks are kept.

type CompressTargetVideoAudioTracks

type CompressTargetVideoAudioTracks string

Keep all audio tracks, only the primary, or drop audio entirely. Default: "all".

Validate refuses a value outside the list below.

const (
	CompressTargetVideoAudioTracksAll     CompressTargetVideoAudioTracks = "all"
	CompressTargetVideoAudioTracksPrimary CompressTargetVideoAudioTracks = "primary"
	CompressTargetVideoAudioTracksNone    CompressTargetVideoAudioTracks = "none"
)

The CompressTargetVideoAudioTracks values this SDK knows.

type CompressTargetVideoSubtitles

type CompressTargetVideoSubtitles string

Soft subtitle tracks: "strip" (default) or "preserve" (best-effort copy; fails if the output container cannot hold the codec). Default: "strip".

Validate refuses a value outside the list below.

const (
	CompressTargetVideoSubtitlesPreserve CompressTargetVideoSubtitles = "preserve"
	CompressTargetVideoSubtitlesStrip    CompressTargetVideoSubtitles = "strip"
)

The CompressTargetVideoSubtitles values this SDK knows.

type Content

type Content string

Content is a small text file sent inline, up to 64 KiB, which ffmpeg reads under the input's name. It is sent as {"content": ...}.

func (Content) MarshalJSON

func (s Content) MarshalJSON() ([]byte, error)

MarshalJSON sends {"content": ...}.

type ContextError

type ContextError struct {
	JobID string
	// Job is the last state Wait read, or nil when ctx ended before the first read.
	Job *Job
	// Err is the error that ended the wait. It wraps the context's error.
	Err error
}

ContextError is returned by Jobs.Wait and Jobs.Run when ctx is cancelled or its deadline passes after the job was submitted. The job keeps running on the API. Use JobID with Jobs.Get, Jobs.Wait or Jobs.Cancel.

It unwraps to the context's error, so errors.Is(err, context.DeadlineExceeded) and errors.Is(err, context.Canceled) report the cause.

Example

Stop when ctx ends, and keep the job id or the idempotency key to pick the job up later.

package main

import (
	"context"
	"errors"
	"fmt"
	"time"

	"github.com/rendobar/rendobar-go"
)

const sample = "https://cdn.rendobar.com/assets/examples/sample.mp4"

func main() {
	rb := rendobar.New()
	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
	defer cancel()
	params := rendobar.CreateParams{Params: rendobar.FfprobeParams{Command: sample}}
	_, err := rb.Jobs.Run(ctx, params, nil)
	var stopped *rendobar.ContextError
	var cutOff *rendobar.SubmitError
	switch {
	case errors.As(err, &stopped):
		// Submitted: the job keeps running. Pick it up later by id.
		fmt.Println("still running:", stopped.JobID, errors.Is(err, context.DeadlineExceeded))
	case errors.As(err, &cutOff):
		// The submit itself was cut off. Resubmitting with the same key returns
		// the job the API may have created, never a second one.
		params.IdempotencyKey = cutOff.IdempotencyKey
		created, err := rb.Jobs.Create(context.Background(), params)
		fmt.Println(created, err)
	}
}

func (*ContextError) Error

func (e *ContextError) Error() string

func (*ContextError) Unwrap

func (e *ContextError) Unwrap() error

Unwrap returns Err.

type Cost

type Cost struct {
	Nanodollars int64    // the amount, where 1 USD is 1,000,000,000
	Currency    Currency // ISO 4217 code
	Formatted   string   // the amount for display, such as $0.50
}

Cost is what a job was charged.

func (*Cost) UnmarshalJSON

func (c *Cost) UnmarshalJSON(b []byte) error

UnmarshalJSON reads a cost as the API sends it.

type CreateAPIKeyParams

type CreateAPIKeyParams struct {
	// Descriptive name for the key (defaults to 'API Key')
	Name string `json:"name,omitempty"`
	// Expiration in seconds (e.g., 2592000 = 30 days). Omit for no expiry.
	ExpiresIn *int64 `json:"expiresIn,omitempty"`
	// What this key may do. Defaults to everything your role can grant. Never more than you can do yourself, and never keys:write, which a key can never hold. `write` includes `read` for the same resource.
	Scopes []string `json:"scopes,omitempty"`
}

CreateAPIKeyParams is what APIKeys.Create sends. It is checked before anything is sent.

type CreateOrgParams

type CreateOrgParams struct {
	Name string `json:"name,omitempty"`
	Slug string `json:"slug,omitempty"`
}

CreateOrgParams is what Orgs.Create sends. It is checked before anything is sent.

type CreateParams

type CreateParams struct {
	// Params are the job's params. Their JobType is the job type submitted.
	Params JobParams
	// Inputs maps an input name to its value: a URL, a list of URLs, inline
	// Content, a FromJob reference or Fonts (see Input). Jobs.Schema lists the
	// names a type takes, such as "source", or "images" for image.edit.
	// ffmpeg and ffprobe accept any file name, and the command refers to the
	// file by it. A command that names its input URLs needs no Inputs.
	Inputs map[string]Input
	// IdempotencyKey makes the submit safe to repeat. With none, the SDK
	// generates one per Create call, so its own retries cannot create a second job.
	// Reusing a key with different params is refused with a 409 *Error, code CodeConflict.
	IdempotencyKey string
	// Label is a short name for the job, up to 200 characters, such as "Trim
	// intro for episode 12". The dashboard shows it, and JobInfo.Label returns it.
	Label string
	// Destinations are your storage connections to deliver the output to once
	// the job completes, as "storage://<id>", "storage://<id>/<folder>" or
	// "storage://<id>/<path template>". A path template may use {job_id},
	// {ext}, {source_name} and {date}. JobInfo.Deliveries reports each one.
	Destinations []string
	// Callback asks the API to POST the job's result to a URL of yours when
	// the job ends, or nil.
	Callback *Callback
	// ForceAsync makes the submit return as soon as the job is queued, even
	// for a job type the API could finish within the submit request.
	ForceAsync bool
}

CreateParams is a job submit. Params is required: the typed params of one job type, such as FfmpegParams, or CustomParams for a type this SDK predates.

type CreateStorageParams

type CreateStorageParams interface {
	// contains filtered or unexported methods
}

CreateStorageParams is what Storage.Create sends. It is checked before anything is sent.

It is one of: CreateStorageR2Params, CreateStorageSupabaseParams, CreateStorageS3Params, CreateStorageS3CompatibleParams.

type CreateStorageR2Credentials

type CreateStorageR2Credentials interface {
	// contains filtered or unexported methods
}

Set it to one of: StorageKeys, StorageCloudflareToken.

type CreateStorageR2Params

type CreateStorageR2Params struct {
	AccountID     string                     `json:"accountId,omitempty"`
	Jurisdiction  R2Jurisdiction             `json:"jurisdiction,omitempty"`
	Credentials   CreateStorageR2Credentials `json:"credentials,omitempty"`
	ID            string                     `json:"id,omitempty"`
	Bucket        string                     `json:"bucket,omitempty"`
	PublicBaseURL string                     `json:"publicBaseUrl,omitempty"`
	CreateBucket  *bool                      `json:"createBucket,omitempty"`
}

func (CreateStorageR2Params) MarshalJSON

func (v CreateStorageR2Params) MarshalJSON() ([]byte, error)

MarshalJSON sends provider "r2" with the fields.

type CreateStorageS3CompatibleParams

type CreateStorageS3CompatibleParams struct {
	Endpoint      string       `json:"endpoint,omitempty"`
	Region        string       `json:"region,omitempty"`
	PathStyle     *bool        `json:"pathStyle,omitempty"`
	Credentials   *StorageKeys `json:"credentials,omitempty"`
	ID            string       `json:"id,omitempty"`
	Bucket        string       `json:"bucket,omitempty"`
	PublicBaseURL string       `json:"publicBaseUrl,omitempty"`
	CreateBucket  *bool        `json:"createBucket,omitempty"`
}

func (CreateStorageS3CompatibleParams) MarshalJSON

func (v CreateStorageS3CompatibleParams) MarshalJSON() ([]byte, error)

MarshalJSON sends provider "s3-compatible" with the fields.

type CreateStorageS3Credentials

type CreateStorageS3Credentials interface {
	// contains filtered or unexported methods
}

Set it to one of: StorageKeys, StorageAWSRole.

type CreateStorageS3Params

type CreateStorageS3Params struct {
	Region        string                     `json:"region,omitempty"`
	Credentials   CreateStorageS3Credentials `json:"credentials,omitempty"`
	ID            string                     `json:"id,omitempty"`
	Bucket        string                     `json:"bucket,omitempty"`
	PublicBaseURL string                     `json:"publicBaseUrl,omitempty"`
	CreateBucket  *bool                      `json:"createBucket,omitempty"`
}

func (CreateStorageS3Params) MarshalJSON

func (v CreateStorageS3Params) MarshalJSON() ([]byte, error)

MarshalJSON sends provider "s3" with the fields.

type CreateStorageSupabaseCredentials

type CreateStorageSupabaseCredentials interface {
	// contains filtered or unexported methods
}

Set it to one of: StorageKeys, StorageSupabaseSession.

type CreateStorageSupabaseParams

type CreateStorageSupabaseParams struct {
	ProjectRef    string                           `json:"projectRef,omitempty"`
	Endpoint      string                           `json:"endpoint,omitempty"`
	Region        string                           `json:"region,omitempty"`
	Credentials   CreateStorageSupabaseCredentials `json:"credentials,omitempty"`
	ID            string                           `json:"id,omitempty"`
	Bucket        string                           `json:"bucket,omitempty"`
	PublicBaseURL string                           `json:"publicBaseUrl,omitempty"`
	CreateBucket  *bool                            `json:"createBucket,omitempty"`
}

func (CreateStorageSupabaseParams) MarshalJSON

func (v CreateStorageSupabaseParams) MarshalJSON() ([]byte, error)

MarshalJSON sends provider "supabase" with the fields.

type CreateWebhookParams

type CreateWebhookParams struct {
	// Endpoint name (1-50 chars)
	Name string `json:"name,omitempty"`
	// Webhook endpoint URL (HTTPS only)
	URL string `json:"url,omitempty"`
	// Events to subscribe to
	SubscribedEvents []WebhookEvent `json:"subscribedEvents,omitempty"`
}

CreateWebhookParams is what Webhooks.Create sends. It is checked before anything is sent.

type Created

type Created struct {
	ID     string    `json:"id"`
	Status JobStatus `json:"status"`
	// Replayed reports that an earlier submit with the same idempotency key
	// already created this job, so this call created nothing new.
	Replayed bool `json:"idempotent"`
	// URL is the result as a data URL when the API finished the job within
	// the submit request (Status complete), else "".
	URL string `json:"url"`
}

Created is what a submit returns: the job id and its status at that moment.

type Currency

type Currency string

ISO-4217 currency code

The API may add values, so keep a default branch.

const (
	CurrencyUSD Currency = "USD"
)

The Currency values this SDK knows.

type CurrentOrg

type CurrentOrg struct {
	Org          *CurrentOrgDetails      `json:"org"`
	Subscription *CurrentOrgSubscription `json:"subscription"`
	Plan         *CurrentOrgPlan         `json:"plan"`
	Balance      *CurrentOrgBalance      `json:"balance"`
}

CurrentOrg is read from the API. Fields it does not send are zero.

type CurrentOrgBalance

type CurrentOrgBalance struct {
	// Current balance (nanodollars)
	Balance int64 `json:"balance"`
	// Human-readable balance (e.g., '$12.50')
	BalanceFormatted string `json:"balanceFormatted"`
}

CurrentOrgBalance is read from the API. Fields it does not send are zero.

type CurrentOrgDetails

type CurrentOrgDetails struct {
	// Organization ID
	ID string `json:"id"`
	// Organization name
	Name string `json:"name"`
	// Organization slug (URL-friendly)
	Slug string `json:"slug"`
	// Creation timestamp (Unix ms)
	CreatedAt UnixMillis `json:"createdAt"`
	// Current user's role in this org (owner|admin|member). For an API key, its creator's role: a key's own access is its scopes.
	MemberRole MemberRole `json:"memberRole"`
	// True for the shared marketplace-reviewer account, whose content resets daily
	IsDemo bool `json:"isDemo"`
}

CurrentOrgDetails is read from the API. Fields it does not send are zero.

type CurrentOrgPlan

type CurrentOrgPlan struct {
	ID       string                  `json:"id"`
	Name     string                  `json:"name"`
	Limits   *CurrentOrgPlanLimits   `json:"limits"`
	Features *CurrentOrgPlanFeatures `json:"features"`
}

CurrentOrgPlan is read from the API. Fields it does not send are zero.

type CurrentOrgPlanFeatures

type CurrentOrgPlanFeatures struct {
	RawFfmpeg     bool `json:"rawFfmpeg"`
	Mcp           bool `json:"mcp"`
	Webhooks      bool `json:"webhooks"`
	PriorityQueue bool `json:"priorityQueue"`
	CustomRunners bool `json:"customRunners"`
	GPU           bool `json:"gpu"`
}

CurrentOrgPlanFeatures is read from the API. Fields it does not send are zero.

type CurrentOrgPlanLimits

type CurrentOrgPlanLimits struct {
	ConcurrentJobs       int64 `json:"concurrentJobs"`
	APIRequestsPerMinute int64 `json:"apiRequestsPerMinute"`
	MaxJobTimeout        int64 `json:"maxJobTimeout"`
	MaxInputFileSize     int64 `json:"maxInputFileSize"`
}

CurrentOrgPlanLimits is read from the API. Fields it does not send are zero.

type CurrentOrgSubscription

type CurrentOrgSubscription struct {
	// Current plan ID (free|pro|studio)
	PlanID string `json:"planId"`
	// Subscription status (active|cancelled|past_due|trialing)
	Status string `json:"status"`
	// Payment provider (polar|manual)
	AdapterID string `json:"adapterId"`
	// Period start (Unix ms)
	CurrentPeriodStart UnixMillis `json:"currentPeriodStart"`
	// Period end (Unix ms)
	CurrentPeriodEnd UnixMillis `json:"currentPeriodEnd"`
}

CurrentOrgSubscription is read from the API. Fields it does not send are zero.

type CustomParams

type CustomParams struct {
	Type   JobType
	Fields map[string]any
}

CustomParams is the one unchecked way to submit a job: any job type, with its params as the API documents them (see Jobs.Schema). Use it for a job type this SDK predates, such as compose, or for a param or value the API added to a typed job after this release. The SDK checks only that Type is a job type name. The API checks Fields. Prefer the typed struct when it can say what you need, so its checks apply before sending.

Example

Submit a job type this SDK predates. CustomParams is the one way to do it.

package main

import (
	"context"
	"fmt"

	"github.com/rendobar/rendobar-go"
)

func main() {
	rb := rendobar.New()
	created, err := rb.Jobs.Create(context.Background(), rendobar.CreateParams{
		Params: rendobar.CustomParams{Type: "compose", Fields: map[string]any{"timeline": map[string]any{}}},
	})
	fmt.Println(created, err)
}

func (CustomParams) JobType

func (p CustomParams) JobType() JobType

JobType returns Type.

func (CustomParams) MarshalJSON

func (p CustomParams) MarshalJSON() ([]byte, error)

MarshalJSON sends Fields.

func (CustomParams) Validate

func (p CustomParams) Validate() error

Validate checks that Type is a job type name. The API checks Fields.

type DeliveriesRetried

type DeliveriesRetried struct {
	Retried int64 `json:"retried"`
}

DeliveriesRetried is read from the API. Fields it does not send are zero.

type Delivery

type Delivery struct {
	StorageID string // the storage connection
	Status    DeliveryStatus
	// Path is the object key in the bucket. A folder of files ends in /.
	Path string
	// URL is where to fetch the delivered file, or "" for a folder.
	URL string
	// Reason is why a delivery failed, or "".
	Reason DeliveryReason
	// Renamed reports that the name was taken, so the job id was appended.
	Renamed bool
}

Delivery is one destination a job's output goes to.

func (*Delivery) UnmarshalJSON

func (d *Delivery) UnmarshalJSON(b []byte) error

UnmarshalJSON reads a delivery as the API sends it.

type DeliveryPage

type DeliveryPage struct {
	Deliveries []*WebhookDelivery
	Meta       DeliveryPageMeta
}

DeliveryPage is one page of webhook deliveries, newest first.

type DeliveryPageMeta

type DeliveryPageMeta struct {
	// Total number of items
	Total int64 `json:"total"`
	// Current page number (1-indexed)
	Page int64 `json:"page"`
	// Items per page
	Limit int64 `json:"limit"`
	// Total number of pages
	Pages  int64 `json:"pages"`
	Offset int64 `json:"offset"`
}

DeliveryPageMeta is read from the API. Fields it does not send are zero.

type DeliveryReason

type DeliveryReason string

DeliveryReason is a string from a fixed list. The API may add values, so keep a default branch.

const (
	DeliveryReasonDestinationDenied      DeliveryReason = "destination_denied"
	DeliveryReasonSignatureMismatch      DeliveryReason = "signature_mismatch"
	DeliveryReasonBucketNotFound         DeliveryReason = "bucket_not_found"
	DeliveryReasonObjectTooLarge         DeliveryReason = "object_too_large"
	DeliveryReasonAlreadyExists          DeliveryReason = "already_exists"
	DeliveryReasonDestinationUnavailable DeliveryReason = "destination_unavailable"
	DeliveryReasonNotDeliverable         DeliveryReason = "not_deliverable"
)

The DeliveryReason values this SDK knows.

type DeliveryStatus

type DeliveryStatus string

DeliveryStatus is a string from a fixed list. The API may add values, so keep a default branch.

const (
	DeliveryStatusPending   DeliveryStatus = "pending"
	DeliveryStatusDelivered DeliveryStatus = "delivered"
	DeliveryStatusFailed    DeliveryStatus = "failed"
)

The DeliveryStatus values this SDK knows.

type DeprecationNotice

type DeprecationNotice struct {
	Method       string
	Path         string
	DeprecatedAt time.Time
}

DeprecationNotice reports that an endpoint the client called is deprecated. It keeps working until the next major release.

type Download

type Download struct {
	Body        io.ReadCloser
	Size        int64
	ContentType string
	// Filename is the name the API suggests for the file, without any
	// directory part, or "" when it suggests none that is safe to use.
	Filename string
}

Download is a job's output file, streamed. Read Body and close it. Size is the length in bytes, or -1 when the API did not say.

type EngineCheck

type EngineCheck string

What the engine's render check found. proven: its parameters visibly change the output. unproven: it renders, and the check could not show a parameter doing anything. nondeterministic: it renders differently every time, by design (noise, glitches).

The API may add values, so keep a default branch.

const (
	EngineCheckProven           EngineCheck = "proven"
	EngineCheckUnproven         EngineCheck = "unproven"
	EngineCheckNondeterministic EngineCheck = "nondeterministic"
)

The EngineCheck values this SDK knows.

type EngineEffectParam

type EngineEffectParam struct {
	// number, true or false, one of `values`, a hex colour, a rect "x y w h", a size "1280x720", or flag names joined by "+".
	Kind   EngineParamKind `json:"kind"`
	Min    float64         `json:"min"`
	Max    float64         `json:"max"`
	Values []string        `json:"values"`
}

EngineEffectParam is read from the API. Fields it does not send are zero.

type EngineFilter

type EngineFilter struct {
	// What goes in the entry's "filter".
	Filter string `json:"filter"`
	// What the engine's render check found. proven: its parameters visibly change the output. unproven: it renders, and the check could not show a parameter doing anything. nondeterministic: it renders differently every time, by design (noise, glitches).
	Checked EngineCheck `json:"checked"`
	// What goes in "params", by parameter name.
	Params map[string]EngineEffectParam `json:"params"`
}

EngineFilter is read from the API. Fields it does not send are zero.

type EngineParamKind

type EngineParamKind string

number, true or false, one of `values`, a hex colour, a rect "x y w h", a size "1280x720", or flag names joined by "+".

The API may add values, so keep a default branch.

const (
	EngineParamKindNumber EngineParamKind = "number"
	EngineParamKindSwitch EngineParamKind = "switch"
	EngineParamKindEnum   EngineParamKind = "enum"
	EngineParamKindColor  EngineParamKind = "color"
	EngineParamKindRect   EngineParamKind = "rect"
	EngineParamKindSize   EngineParamKind = "size"
	EngineParamKindFlags  EngineParamKind = "flags"
)

The EngineParamKind values this SDK knows.

type Error

type Error struct {
	Code ErrorCode
	// Message is the human-readable explanation.
	Message string
	// StatusCode is the HTTP status, or 0 when the SDK refused the call before sending it.
	StatusCode int
	// RequestID is the X-Request-Id of the failed request. Quote it to support.
	RequestID string
	// RetryAfter is how long the server asked the caller to wait (Retry-After), or 0.
	RetryAfter time.Duration
	// Problems lists what the request got wrong, one entry each, when the
	// API (or Validate) sent a list of problems.
	Problems []Problem
	// Details is the error's detail as the API sent it, or nil.
	Details json.RawMessage
}

Error is an error with a stable code: a refusal from the API (a 4xx or 5xx with Rendobar's error envelope), or a call the SDK refused before sending anything (StatusCode 0). Check it with errors.As and compare Code:

var apiErr *rendobar.Error
if errors.As(err, &apiErr) && apiErr.Code == rendobar.CodeNotFound { ... }
Example

Check an error by its code, and quote the request id to support.

package main

import (
	"context"
	"errors"
	"fmt"

	"github.com/rendobar/rendobar-go"
)

func main() {
	rb := rendobar.New()
	_, err := rb.Jobs.Get(context.Background(), "job_missing")
	var apiErr *rendobar.Error
	if errors.As(err, &apiErr) {
		switch apiErr.Code {
		case rendobar.CodeNotFound:
			fmt.Println("no such job")
		case rendobar.CodeRateLimited:
			fmt.Println("retry after", apiErr.RetryAfter)
		default:
			fmt.Println(apiErr.Code, apiErr.StatusCode, apiErr.RequestID)
		}
	}
}

func (*Error) Error

func (e *Error) Error() string

type ErrorCode

type ErrorCode string

ErrorCode is the stable machine-readable code of an *Error. The constants below are the codes this SDK knows. The API may add codes, and an unknown one arrives as its own string, so compare with == and keep a default branch.

const (
	CodeMissingAPIKey   ErrorCode = "MISSING_API_KEY"  // no key: set RENDOBAR_API_KEY or pass WithAPIKey
	CodeInvalidAPIKey   ErrorCode = "INVALID_API_KEY"  // the key does not start with rb_
	CodeInvalidArgument ErrorCode = "INVALID_ARGUMENT" // params, an id or paging the SDK refused
	CodeUnknown         ErrorCode = "UNKNOWN_ERROR"    // the API answered without its error envelope
	CodeUploadFailed    ErrorCode = "UPLOAD_FAILED"    // a file part did not reach storage (Uploads.Create)
)

Codes the SDK sets itself, before sending a request (StatusCode 0).

const (
	CodeUnauthorized         ErrorCode = "UNAUTHORIZED"
	CodeForbidden            ErrorCode = "FORBIDDEN"
	CodeInsufficientScope    ErrorCode = "INSUFFICIENT_SCOPE"
	CodeValidation           ErrorCode = "VALIDATION_ERROR"
	CodeInvalidJobType       ErrorCode = "INVALID_JOB_TYPE"
	CodeFeatureNotEnabled    ErrorCode = "FEATURE_NOT_ENABLED"
	CodeInsufficientCredits  ErrorCode = "INSUFFICIENT_CREDITS"
	CodePlanLimit            ErrorCode = "PLAN_LIMIT"
	CodeStorageQuotaExceeded ErrorCode = "STORAGE_QUOTA_EXCEEDED"
	CodeFileTooLarge         ErrorCode = "FILE_TOO_LARGE"
	CodeRateLimited          ErrorCode = "RATE_LIMITED"
	CodeQueueFull            ErrorCode = "QUEUE_FULL"
	CodeQueueExpired         ErrorCode = "QUEUE_EXPIRED"
	CodeNotFound             ErrorCode = "NOT_FOUND"
	CodeConflict             ErrorCode = "CONFLICT"
	CodeGone                 ErrorCode = "GONE"
	CodeOrgSuspended         ErrorCode = "ORG_SUSPENDED"
	CodeInputURLBlocked      ErrorCode = "INPUT_URL_BLOCKED"
	CodeInputNotMedia        ErrorCode = "INPUT_NOT_MEDIA"
	CodeInputUnsupported     ErrorCode = "INPUT_UNSUPPORTED"
	CodeInputFetchFailed     ErrorCode = "INPUT_FETCH_FAILED"
	CodeInputFetchStalled    ErrorCode = "INPUT_FETCH_STALLED"
	CodeProcessingFailed     ErrorCode = "PROCESSING_FAILED"
	CodeRunnerError          ErrorCode = "RUNNER_ERROR"
	CodeRunnerTimeout        ErrorCode = "RUNNER_TIMEOUT"
	CodeInternal             ErrorCode = "INTERNAL_ERROR"
	CodeNotImplemented       ErrorCode = "NOT_IMPLEMENTED"
	CodeUpstream             ErrorCode = "UPSTREAM_ERROR"
	CodeNotConfigured        ErrorCode = "NOT_CONFIGURED"
)

Codes the API sends.

type FailurePhase

type FailurePhase string

Which phase the job failed in, when known

The API may add values, so keep a default branch.

const (
	FailurePhasePreparing  FailurePhase = "preparing"
	FailurePhaseProcessing FailurePhase = "processing"
	FailurePhaseFinalizing FailurePhase = "finalizing"
)

The FailurePhase values this SDK knows.

type Features

type Features struct {
	RawFFmpeg       bool `json:"rawFfmpeg"`
	MCP             bool `json:"mcp"`
	Webhooks        bool `json:"webhooks"`
	PriorityQueue   bool `json:"priorityQueue"`
	CustomRunners   bool `json:"customRunners"`
	GPU             bool `json:"gpu"`
	PrioritySupport bool `json:"prioritySupport"` // support replies the same business day
	AuditLog        bool `json:"auditLog"`
	// FastOutputDelivery streams outputs of 512 MiB or more into destination
	// buckets while they upload.
	FastOutputDelivery bool `json:"fastOutputDelivery"`
}

Features are the features the workspace's plan turns on.

type FfmpegCompute

type FfmpegCompute string

Hardware target: auto (detect from command), cpu, or gpu (NVENC, Pro and Studio plans). Default: "auto".

Validate refuses a value outside the list below.

const (
	FfmpegComputeAuto FfmpegCompute = "auto"
	FfmpegComputeCPU  FfmpegCompute = "cpu"
	FfmpegComputeGPU  FfmpegCompute = "gpu"
)

The FfmpegCompute values this SDK knows.

type FfmpegParams

type FfmpegParams struct {
	// FFmpeg command string, such as "ffmpeg -i input.mp4 output.mp4". The leading "ffmpeg" is optional.
	Command string `json:"command,omitempty"`
	// Max execution time in seconds (defaults to your plan's max job timeout)
	Timeout *int64 `json:"timeout,omitempty"`
	// Hardware target: auto (detect from command), cpu, or gpu (NVENC, Pro and Studio plans). Default: "auto".
	Compute FfmpegCompute `json:"compute,omitempty"`
}

FfmpegParams are the params of a ffmpeg job.

func (FfmpegParams) JobType

func (FfmpegParams) JobType() JobType

JobType returns JobTypeFfmpeg.

func (FfmpegParams) Validate

func (v FfmpegParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type FfprobeAudioStream

type FfprobeAudioStream struct {
	Codec    string `json:"codec"`
	Profile  string `json:"profile"`
	Channels *int64 `json:"channels"`
	// Null even when channels is set: some containers (wav) never store it
	ChannelLayout string `json:"channelLayout"`
	SampleRate    *int64 `json:"sampleRate"`
	BitrateBps    *int64 `json:"bitrateBps"`
	Language      string `json:"language"`
}

FfprobeAudioStream is read from the API. Fields it does not send are zero.

type FfprobeAudioSummary

type FfprobeAudioSummary struct {
	// format_name, e.g. "mov,mp4,m4a,3gp,3g2,mj2"
	Container      string `json:"container"`
	FormatLongName string `json:"formatLongName"`
	// Duration in seconds
	DurationSec *float64 `json:"durationSec"`
	SizeBytes   *int64   `json:"sizeBytes"`
	// Container bitrate; null when the container omits it
	BitrateBps   *int64               `json:"bitrateBps"`
	StartTimeSec *float64             `json:"startTimeSec"`
	StreamCounts *FfprobeStreamCounts `json:"streamCounts"`
	// Container-level tags, {} when none
	Tags  map[string]string   `json:"tags"`
	Audio *FfprobeAudioStream `json:"audio"`
}

FfprobeAudioSummary is read from the API. Fields it does not send are zero.

type FfprobeChapter

type FfprobeChapter struct {
	ID        int64             `json:"id"`
	StartTime string            `json:"start_time"`
	EndTime   string            `json:"end_time"`
	Tags      map[string]string `json:"tags"`
}

FfprobeChapter is read from the API. Fields it does not send are zero.

type FfprobeFormat

type FfprobeFormat struct {
	// The probed source URL
	Filename       string            `json:"filename"`
	FormatName     string            `json:"format_name"`
	FormatLongName string            `json:"format_long_name"`
	NbStreams      int64             `json:"nb_streams"`
	NbPrograms     int64             `json:"nb_programs"`
	StartTime      string            `json:"start_time"`
	Duration       string            `json:"duration"`
	Size           string            `json:"size"`
	BitRate        string            `json:"bit_rate"`
	ProbeScore     int64             `json:"probe_score"`
	Tags           map[string]string `json:"tags"`
}

FfprobeFormat is read from the API. Fields it does not send are zero.

type FfprobeFrame

type FfprobeFrame struct {
	MediaType   string `json:"media_type"`
	StreamIndex int64  `json:"stream_index"`
}

FfprobeFrame is read from the API. Fields it does not send are zero.

type FfprobeImageStream

type FfprobeImageStream struct {
	Codec       string `json:"codec"`
	Width       *int64 `json:"width"`
	Height      *int64 `json:"height"`
	PixelFormat string `json:"pixelFormat"`
	BitDepth    *int64 `json:"bitDepth"`
}

FfprobeImageStream is read from the API. Fields it does not send are zero.

type FfprobeImageSummary

type FfprobeImageSummary struct {
	// format_name, e.g. "mov,mp4,m4a,3gp,3g2,mj2"
	Container      string `json:"container"`
	FormatLongName string `json:"formatLongName"`
	// Duration in seconds
	DurationSec *float64 `json:"durationSec"`
	SizeBytes   *int64   `json:"sizeBytes"`
	// Container bitrate; null when the container omits it
	BitrateBps   *int64               `json:"bitrateBps"`
	StartTimeSec *float64             `json:"startTimeSec"`
	StreamCounts *FfprobeStreamCounts `json:"streamCounts"`
	// Container-level tags, {} when none
	Tags  map[string]string   `json:"tags"`
	Image *FfprobeImageStream `json:"image"`
}

FfprobeImageSummary is read from the API. Fields it does not send are zero.

type FfprobeOtherSummary

type FfprobeOtherSummary struct {
	// format_name, e.g. "mov,mp4,m4a,3gp,3g2,mj2"
	Container      string `json:"container"`
	FormatLongName string `json:"formatLongName"`
	// Duration in seconds
	DurationSec *float64 `json:"durationSec"`
	SizeBytes   *int64   `json:"sizeBytes"`
	// Container bitrate; null when the container omits it
	BitrateBps   *int64               `json:"bitrateBps"`
	StartTimeSec *float64             `json:"startTimeSec"`
	StreamCounts *FfprobeStreamCounts `json:"streamCounts"`
	// Container-level tags, {} when none
	Tags map[string]string `json:"tags"`
}

FfprobeOtherSummary is read from the API. Fields it does not send are zero.

type FfprobePacket

type FfprobePacket struct {
	CodecType   string `json:"codec_type"`
	StreamIndex int64  `json:"stream_index"`
}

FfprobePacket is read from the API. Fields it does not send are zero.

type FfprobeParams

type FfprobeParams struct {
	// A raw ffprobe command, run essentially as written. Minimal form is just the input media URL. Sensible defaults (JSON output, format, streams, chapters) are auto-filled only for flags you did not specify. The "ffprobe" prefix is optional.
	Command string `json:"command,omitempty"`
	// Max execution time in seconds (defaults to your plan's max job timeout)
	Timeout *int64 `json:"timeout,omitempty"`
}

FfprobeParams are the params of a ffprobe job.

func (FfprobeParams) JobType

func (FfprobeParams) JobType() JobType

JobType returns JobTypeFfprobe.

func (FfprobeParams) Validate

func (v FfprobeParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type FfprobeProgram

type FfprobeProgram struct {
	ProgramID int64             `json:"program_id"`
	NbStreams int64             `json:"nb_streams"`
	Streams   []FfprobeStream   `json:"streams"`
	Tags      map[string]string `json:"tags"`
}

FfprobeProgram is read from the API. Fields it does not send are zero.

type FfprobeResult

type FfprobeResult struct {
	Summary  *FfprobeSummary  `json:"summary"`
	Format   *FfprobeFormat   `json:"format"`
	Streams  []FfprobeStream  `json:"streams"`
	Chapters []FfprobeChapter `json:"chapters"`
	// -show_programs (MPEG-TS)
	Programs []FfprobeProgram `json:"programs"`
	// -show_stream_groups
	StreamGroups []FfprobeStreamGroup `json:"stream_groups"`
	// -show_frames, inline when small
	Frames []FfprobeFrame `json:"frames"`
	// -show_packets, inline when small
	Packets []FfprobePacket `json:"packets"`
	// ffprobe's text output, verbatim, when the command chose a writer other than JSON
	Stdout   string           `json:"stdout"`
	Warnings []FfprobeWarning `json:"warnings"`
	// ffprobe diagnostics, when non-empty
	Stderr string `json:"stderr"`
	// The complete report, when a frame or packet dump was too big to inline
	ReportURL string `json:"reportUrl"`
}

`output.data` of a complete ffprobe job. Every section is present only when the run produced it.

type FfprobeStream

type FfprobeStream struct {
	Index              int64                  `json:"index"`
	CodecType          FfprobeStreamCodecType `json:"codec_type"`
	CodecName          string                 `json:"codec_name"`
	CodecLongName      string                 `json:"codec_long_name"`
	Profile            string                 `json:"profile"`
	Width              int64                  `json:"width"`
	Height             int64                  `json:"height"`
	CodedWidth         int64                  `json:"coded_width"`
	CodedHeight        int64                  `json:"coded_height"`
	SampleAspectRatio  string                 `json:"sample_aspect_ratio"`
	DisplayAspectRatio string                 `json:"display_aspect_ratio"`
	PixFmt             string                 `json:"pix_fmt"`
	FieldOrder         string                 `json:"field_order"`
	RFrameRate         string                 `json:"r_frame_rate"`
	AvgFrameRate       string                 `json:"avg_frame_rate"`
	SampleFmt          string                 `json:"sample_fmt"`
	SampleRate         string                 `json:"sample_rate"`
	Channels           int64                  `json:"channels"`
	ChannelLayout      string                 `json:"channel_layout"`
	BitRate            string                 `json:"bit_rate"`
	Duration           string                 `json:"duration"`
	NbFrames           string                 `json:"nb_frames"`
	NbReadFrames       string                 `json:"nb_read_frames"`
	Disposition        map[string]int64       `json:"disposition"`
	Tags               map[string]string      `json:"tags"`
}

FfprobeStream is read from the API. Fields it does not send are zero.

type FfprobeStreamCodecType

type FfprobeStreamCodecType string

The API may add values, so keep a default branch.

const (
	FfprobeStreamCodecTypeVideo      FfprobeStreamCodecType = "video"
	FfprobeStreamCodecTypeAudio      FfprobeStreamCodecType = "audio"
	FfprobeStreamCodecTypeSubtitle   FfprobeStreamCodecType = "subtitle"
	FfprobeStreamCodecTypeData       FfprobeStreamCodecType = "data"
	FfprobeStreamCodecTypeAttachment FfprobeStreamCodecType = "attachment"
)

The FfprobeStreamCodecType values this SDK knows.

type FfprobeStreamCounts

type FfprobeStreamCounts struct {
	Video      int64 `json:"video"`
	Audio      int64 `json:"audio"`
	Subtitle   int64 `json:"subtitle"`
	Data       int64 `json:"data"`
	Attachment int64 `json:"attachment"`
}

FfprobeStreamCounts is read from the API. Fields it does not send are zero.

type FfprobeStreamGroup

type FfprobeStreamGroup struct {
	Index     int64  `json:"index"`
	Type      string `json:"type"`
	NbStreams int64  `json:"nb_streams"`
}

FfprobeStreamGroup is read from the API. Fields it does not send are zero.

type FfprobeSummary

type FfprobeSummary struct {
	Kind  FfprobeSummaryKind
	Video *FfprobeVideoSummary
	Audio *FfprobeAudioSummary
	Image *FfprobeImageSummary
	Other *FfprobeOtherSummary
}

Normalized summary, present when the report is JSON with format and streams. Narrow on `kind` before reading `video`, `audio` or `image`.

FfprobeSummary holds one variant, matching Kind. A kind newer than this SDK sets Kind and leaves every variant nil.

func (*FfprobeSummary) UnmarshalJSON

func (u *FfprobeSummary) UnmarshalJSON(b []byte) error

UnmarshalJSON reads the variant kind names.

type FfprobeSummaryKind

type FfprobeSummaryKind string

Normalized summary, present when the report is JSON with format and streams. Narrow on `kind` before reading `video`, `audio` or `image`.

The API may add values, so keep a default branch.

const (
	FfprobeSummaryKindVideo FfprobeSummaryKind = "video"
	FfprobeSummaryKindAudio FfprobeSummaryKind = "audio"
	FfprobeSummaryKindImage FfprobeSummaryKind = "image"
	FfprobeSummaryKindOther FfprobeSummaryKind = "other"
)

The FfprobeSummaryKind values this SDK knows.

type FfprobeVideoStream

type FfprobeVideoStream struct {
	Codec              string `json:"codec"`
	Profile            string `json:"profile"`
	Width              *int64 `json:"width"`
	Height             *int64 `json:"height"`
	DisplayAspectRatio string `json:"displayAspectRatio"`
	PixelFormat        string `json:"pixelFormat"`
	BitDepth           *int64 `json:"bitDepth"`
	// avg_frame_rate as a number; null for a 0/0 rate
	FPS                 *float64 `json:"fps"`
	IsVariableFrameRate bool     `json:"isVariableFrameRate"`
	Rotation            int64    `json:"rotation"`
	// True for a PQ (smpte2084) or HLG (arib-std-b67) transfer
	IsHdr bool `json:"isHdr"`
	// Per-stream bitrate; null when the container omits it
	BitrateBps *int64 `json:"bitrateBps"`
	Language   string `json:"language"`
}

FfprobeVideoStream is read from the API. Fields it does not send are zero.

type FfprobeVideoSummary

type FfprobeVideoSummary struct {
	// format_name, e.g. "mov,mp4,m4a,3gp,3g2,mj2"
	Container      string `json:"container"`
	FormatLongName string `json:"formatLongName"`
	// Duration in seconds
	DurationSec *float64 `json:"durationSec"`
	SizeBytes   *int64   `json:"sizeBytes"`
	// Container bitrate; null when the container omits it
	BitrateBps   *int64               `json:"bitrateBps"`
	StartTimeSec *float64             `json:"startTimeSec"`
	StreamCounts *FfprobeStreamCounts `json:"streamCounts"`
	// Container-level tags, {} when none
	Tags  map[string]string   `json:"tags"`
	Video *FfprobeVideoStream `json:"video"`
	Audio *FfprobeAudioStream `json:"audio"`
}

FfprobeVideoSummary is read from the API. Fields it does not send are zero.

type FfprobeWarning

type FfprobeWarning struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

FfprobeWarning is read from the API. Fields it does not send are zero.

type FieldType

type FieldType string

FieldType is a string from a fixed list. The API may add values, so keep a default branch.

const (
	FieldTypeString  FieldType = "string"
	FieldTypeNumber  FieldType = "number"
	FieldTypeBoolean FieldType = "boolean"
	FieldTypeOptions FieldType = "options"
	FieldTypeJSON    FieldType = "json"
)

The FieldType values this SDK knows.

type FileType

type FileType string

File type, derived from the extension. OPEN enum — tolerate unknown future values.

The API may add values, so keep a default branch.

const (
	FileTypeVideo    FileType = "video"
	FileTypeImage    FileType = "image"
	FileTypeAudio    FileType = "audio"
	FileTypeCaptions FileType = "captions"
	FileTypePlaylist FileType = "playlist"
	FileTypeData     FileType = "data"
	FileTypeOther    FileType = "other"
)

The FileType values this SDK knows.

type FinishSupabaseParams

type FinishSupabaseParams struct {
	State         string `json:"state,omitempty"`
	ProjectRef    string `json:"projectRef,omitempty"`
	ID            string `json:"id,omitempty"`
	Bucket        string `json:"bucket,omitempty"`
	PublicBaseURL string `json:"publicBaseUrl,omitempty"`
	CreateBucket  *bool  `json:"createBucket,omitempty"`
}

FinishSupabaseParams is what Storage.FinishSupabase sends. It is checked before anything is sent.

type Font

type Font struct {
	// Family is the name the params use for this font, such as "Display".
	// "" uses the family name inside the file.
	Family string `json:"family,omitempty"`
	Src    string `json:"src"` // the font file's URL
}

Font is one font file.

type Fonts

type Fonts []Font

Fonts are font files (TTF, OTF, TTC, WOFF or WOFF2) for a job that renders text. Reference each by its Family in the job's style params.

type FromJob

type FromJob string

FromJob uses the output of a completed job, by its id, as the input. It is sent as {"job": ...}. The API resolves it when the job runs.

func (FromJob) MarshalJSON

func (j FromJob) MarshalJSON() ([]byte, error)

MarshalJSON sends {"job": ...}.

type ImageEditEconomyParams

type ImageEditEconomyParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
}

ImageEditEconomyParams are the params of an image.edit job.

It sends model "economy".

func (ImageEditEconomyParams) JobType

func (ImageEditEconomyParams) JobType() JobType

JobType returns JobTypeImageEdit.

func (ImageEditEconomyParams) MarshalJSON

func (v ImageEditEconomyParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "economy" with the fields.

func (ImageEditEconomyParams) Validate

func (v ImageEditEconomyParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageEditFlux2Klein4bParams

type ImageEditFlux2Klein4bParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
}

ImageEditFlux2Klein4bParams are the params of an image.edit job.

It sends model "flux-2-klein-4b".

func (ImageEditFlux2Klein4bParams) JobType

JobType returns JobTypeImageEdit.

func (ImageEditFlux2Klein4bParams) MarshalJSON

func (v ImageEditFlux2Klein4bParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "flux-2-klein-4b" with the fields.

func (ImageEditFlux2Klein4bParams) Validate

func (v ImageEditFlux2Klein4bParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageEditPremiumParams

type ImageEditPremiumParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
}

ImageEditPremiumParams are the params of an image.edit job.

It sends model "premium".

func (ImageEditPremiumParams) JobType

func (ImageEditPremiumParams) JobType() JobType

JobType returns JobTypeImageEdit.

func (ImageEditPremiumParams) MarshalJSON

func (v ImageEditPremiumParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "premium" with the fields.

func (ImageEditPremiumParams) Validate

func (v ImageEditPremiumParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageEditQwenImageEdit2511LightningParams

type ImageEditQwenImageEdit2511LightningParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
	// Denoise steps. More steps means more detail and more time.
	Steps *int64 `json:"steps,omitempty"`
}

ImageEditQwenImageEdit2511LightningParams are the params of an image.edit job.

It sends model "qwen-image-edit-2511-lightning".

func (ImageEditQwenImageEdit2511LightningParams) JobType

JobType returns JobTypeImageEdit.

func (ImageEditQwenImageEdit2511LightningParams) MarshalJSON

MarshalJSON sends model "qwen-image-edit-2511-lightning" with the fields.

func (ImageEditQwenImageEdit2511LightningParams) Validate

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageEditQwenImageEdit2511Params

type ImageEditQwenImageEdit2511Params struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
	// What to keep out of the edited image.
	NegativePrompt string `json:"negativePrompt,omitempty"`
	// How strictly to follow the instruction. Higher is stricter.
	Guidance *float64 `json:"guidance,omitempty"`
	// Denoise steps. More steps means more detail and more time.
	Steps *int64 `json:"steps,omitempty"`
}

ImageEditQwenImageEdit2511Params are the params of an image.edit job.

It sends model "qwen-image-edit-2511".

func (ImageEditQwenImageEdit2511Params) JobType

JobType returns JobTypeImageEdit.

func (ImageEditQwenImageEdit2511Params) MarshalJSON

func (v ImageEditQwenImageEdit2511Params) MarshalJSON() ([]byte, error)

MarshalJSON sends model "qwen-image-edit-2511" with the fields.

func (ImageEditQwenImageEdit2511Params) Validate

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageEditStandardParams

type ImageEditStandardParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
}

ImageEditStandardParams are the params of an image.edit job.

It sends model "standard".

func (ImageEditStandardParams) JobType

func (ImageEditStandardParams) JobType() JobType

JobType returns JobTypeImageEdit.

func (ImageEditStandardParams) MarshalJSON

func (v ImageEditStandardParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "standard" with the fields.

func (ImageEditStandardParams) Validate

func (v ImageEditStandardParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageGenerateEconomyParams

type ImageGenerateEconomyParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
}

ImageGenerateEconomyParams are the params of an image.generate job.

It sends model "economy".

func (ImageGenerateEconomyParams) JobType

JobType returns JobTypeImageGenerate.

func (ImageGenerateEconomyParams) MarshalJSON

func (v ImageGenerateEconomyParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "economy" with the fields.

func (ImageGenerateEconomyParams) Validate

func (v ImageGenerateEconomyParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageGenerateErnieImageTurboParams

type ImageGenerateErnieImageTurboParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
}

ImageGenerateErnieImageTurboParams are the params of an image.generate job.

It sends model "ernie-image-turbo".

func (ImageGenerateErnieImageTurboParams) JobType

JobType returns JobTypeImageGenerate.

func (ImageGenerateErnieImageTurboParams) MarshalJSON

func (v ImageGenerateErnieImageTurboParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "ernie-image-turbo" with the fields.

func (ImageGenerateErnieImageTurboParams) Validate

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageGenerateFlux2DevParams

type ImageGenerateFlux2DevParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
	// How strictly to follow the prompt. Higher is stricter.
	Guidance *float64 `json:"guidance,omitempty"`
	// Denoise steps. More steps means more detail and more time.
	Steps *int64 `json:"steps,omitempty"`
}

ImageGenerateFlux2DevParams are the params of an image.generate job.

It sends model "flux-2-dev".

func (ImageGenerateFlux2DevParams) JobType

JobType returns JobTypeImageGenerate.

func (ImageGenerateFlux2DevParams) MarshalJSON

func (v ImageGenerateFlux2DevParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "flux-2-dev" with the fields.

func (ImageGenerateFlux2DevParams) Validate

func (v ImageGenerateFlux2DevParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageGenerateFlux2Klein4bParams

type ImageGenerateFlux2Klein4bParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
}

ImageGenerateFlux2Klein4bParams are the params of an image.generate job.

It sends model "flux-2-klein-4b".

func (ImageGenerateFlux2Klein4bParams) JobType

JobType returns JobTypeImageGenerate.

func (ImageGenerateFlux2Klein4bParams) MarshalJSON

func (v ImageGenerateFlux2Klein4bParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "flux-2-klein-4b" with the fields.

func (ImageGenerateFlux2Klein4bParams) Validate

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageGeneratePremiumParams

type ImageGeneratePremiumParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
}

ImageGeneratePremiumParams are the params of an image.generate job.

It sends model "premium".

func (ImageGeneratePremiumParams) JobType

JobType returns JobTypeImageGenerate.

func (ImageGeneratePremiumParams) MarshalJSON

func (v ImageGeneratePremiumParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "premium" with the fields.

func (ImageGeneratePremiumParams) Validate

func (v ImageGeneratePremiumParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageGenerateQwenImage2512LightningParams

type ImageGenerateQwenImage2512LightningParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
	// Denoise steps. More steps means more detail and more time.
	Steps *int64 `json:"steps,omitempty"`
}

ImageGenerateQwenImage2512LightningParams are the params of an image.generate job.

It sends model "qwen-image-2512-lightning".

func (ImageGenerateQwenImage2512LightningParams) JobType

JobType returns JobTypeImageGenerate.

func (ImageGenerateQwenImage2512LightningParams) MarshalJSON

MarshalJSON sends model "qwen-image-2512-lightning" with the fields.

func (ImageGenerateQwenImage2512LightningParams) Validate

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageGenerateQwenImage2512Params

type ImageGenerateQwenImage2512Params struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
	// What to keep out of the image.
	NegativePrompt string `json:"negativePrompt,omitempty"`
	// How strictly to follow the prompt. Higher is stricter.
	Guidance *float64 `json:"guidance,omitempty"`
	// Denoise steps. More steps means more detail and more time.
	Steps *int64 `json:"steps,omitempty"`
}

ImageGenerateQwenImage2512Params are the params of an image.generate job.

It sends model "qwen-image-2512".

func (ImageGenerateQwenImage2512Params) JobType

JobType returns JobTypeImageGenerate.

func (ImageGenerateQwenImage2512Params) MarshalJSON

func (v ImageGenerateQwenImage2512Params) MarshalJSON() ([]byte, error)

MarshalJSON sends model "qwen-image-2512" with the fields.

func (ImageGenerateQwenImage2512Params) Validate

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageGenerateStandardParams

type ImageGenerateStandardParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
}

ImageGenerateStandardParams are the params of an image.generate job.

It sends model "standard".

func (ImageGenerateStandardParams) JobType

JobType returns JobTypeImageGenerate.

func (ImageGenerateStandardParams) MarshalJSON

func (v ImageGenerateStandardParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "standard" with the fields.

func (ImageGenerateStandardParams) Validate

func (v ImageGenerateStandardParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageGenerateZImageTurboParams

type ImageGenerateZImageTurboParams struct {
	// What you want. For image.edit, describe the change to make. Plain language, no special syntax.
	Prompt string `json:"prompt,omitempty"`
	// Requested output width in pixels. Snapped to what the model can render.
	Width *int64 `json:"width,omitempty"`
	// Requested output height in pixels. Snapped to what the model can render.
	Height *int64 `json:"height,omitempty"`
	// Fixed seed for a reproducible result. The seed used is echoed back.
	Seed *int64 `json:"seed,omitempty"`
	// Rewrite the prompt for the model before generating. Defaults per model; omit to keep the model's default.
	EnhancePrompt *bool `json:"enhancePrompt,omitempty"`
	// Denoise steps. More steps means more detail and more time.
	Steps *int64 `json:"steps,omitempty"`
}

ImageGenerateZImageTurboParams are the params of an image.generate job.

It sends model "z-image-turbo".

func (ImageGenerateZImageTurboParams) JobType

JobType returns JobTypeImageGenerate.

func (ImageGenerateZImageTurboParams) MarshalJSON

func (v ImageGenerateZImageTurboParams) MarshalJSON() ([]byte, error)

MarshalJSON sends model "z-image-turbo" with the fields.

func (ImageGenerateZImageTurboParams) Validate

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageUpscaleColorCorrection

type ImageUpscaleColorCorrection string

How colour is matched back to the source. lab is the default and the most faithful. The others exist for sources where it shifts colour.

Validate refuses a value outside the list below.

const (
	ImageUpscaleColorCorrectionLAB             ImageUpscaleColorCorrection = "lab"
	ImageUpscaleColorCorrectionWavelet         ImageUpscaleColorCorrection = "wavelet"
	ImageUpscaleColorCorrectionWaveletAdaptive ImageUpscaleColorCorrection = "wavelet_adaptive"
	ImageUpscaleColorCorrectionHSV             ImageUpscaleColorCorrection = "hsv"
	ImageUpscaleColorCorrectionAdain           ImageUpscaleColorCorrection = "adain"
	ImageUpscaleColorCorrectionNone            ImageUpscaleColorCorrection = "none"
)

The ImageUpscaleColorCorrection values this SDK knows.

type ImageUpscaleModel

type ImageUpscaleModel string

Which restoration model to run. seedvr2-3b is the default and the one most people prefer; seedvr2-7b is the larger checkpoint, offered as an option rather than an upgrade. Default: "seedvr2-3b".

Validate refuses a value outside the list below.

const (
	ImageUpscaleModelSeedvr23b ImageUpscaleModel = "seedvr2-3b"
	ImageUpscaleModelSeedvr27b ImageUpscaleModel = "seedvr2-7b"
)

The ImageUpscaleModel values this SDK knows.

type ImageUpscaleParams

type ImageUpscaleParams struct {
	// Which restoration model to run. seedvr2-3b is the default and the one most people prefer; seedvr2-7b is the larger checkpoint, offered as an option rather than an upgrade. Default: "seedvr2-3b".
	Model ImageUpscaleModel `json:"model,omitempty"`
	// How large the output should be. Defaults to twice the source. Default: {"mode":"factor","factor":2}.
	Sizing ImageUpscaleSizing `json:"sizing,omitempty"`
	// Artifact reduction, 0 to 1. Higher is smoother and reconstructs less. 0.1 to 0.3 is the useful band. Default: 0.1.
	InputNoise *float64 `json:"inputNoise,omitempty"`
	// Shrink the source before upscaling, 0.25 to 1. Below 1 gives the model less to preserve and more to rebuild. Lower it for a clean uncompressed source; leave it at 1 for anything saved as a JPEG, where the rebuild follows the compression artifacts instead of the subject. Default: 1.
	InputScale *float64 `json:"inputScale,omitempty"`
	// Softens excessive detail, 0 to 1. Reach for it when a result looks overcooked rather than soft. 0.05 to 0.15 is the useful band. Defaults to off.
	LatentNoise *float64 `json:"latentNoise,omitempty"`
	// How colour is matched back to the source. lab is the default and the most faithful. The others exist for sources where it shifts colour.
	ColorCorrection ImageUpscaleColorCorrection `json:"colorCorrection,omitempty"`
	// Fixed at 42 unless you set one. This model reconstructs detail rather than copying it, so a different seed is a different plausible result. Change it to reroll, keep it to reproduce.
	Seed *int64 `json:"seed,omitempty"`
	// Run the model repeatedly, each pass covering an equal share of the total scale factor. Leave it unset and the number of passes follows the factor, keeping every step near a doubling, which is where this model does its best work. Set it explicitly to override. Costs one full render per pass.
	Passes *int64 `json:"passes,omitempty"`
}

ImageUpscaleParams are the params of an image.upscale job.

func (ImageUpscaleParams) JobType

func (ImageUpscaleParams) JobType() JobType

JobType returns JobTypeImageUpscale.

func (ImageUpscaleParams) Validate

func (v ImageUpscaleParams) Validate() error

Validate checks the params against the job type's schema without sending anything. It returns an *Error with code INVALID_ARGUMENT listing each problem.

type ImageUpscaleSizing

type ImageUpscaleSizing interface {
	// contains filtered or unexported methods
}

How large the output should be. Defaults to twice the source. Default: {"mode":"factor","factor":2}.

Set it to one of: ImageUpscaleSizingFactor, ImageUpscaleSizingHeight.

type ImageUpscaleSizingFactor

type ImageUpscaleSizingFactor struct {
	// How many times larger to make the image, for example 2 or 4.
	Factor *float64 `json:"factor,omitempty"`
}

func (ImageUpscaleSizingFactor) MarshalJSON

func (v ImageUpscaleSizingFactor) MarshalJSON() ([]byte, error)

MarshalJSON sends mode "factor" with the fields.

type ImageUpscaleSizingHeight

type ImageUpscaleSizingHeight struct {
	// Target output height in pixels. Width follows the source aspect ratio.
	Height *int64 `json:"height,omitempty"`
}

func (ImageUpscaleSizingHeight) MarshalJSON

func (v ImageUpscaleSizingHeight) MarshalJSON() ([]byte, error)

MarshalJSON sends mode "height" with the fields.

type Input

type Input interface {
	// contains filtered or unexported methods
}

Input is one value in CreateParams.Inputs. Use the type that matches what the job type takes (see Jobs.Schema for its input names):

  • URL: one file the API fetches, such as {"source": rendobar.URL("https://...")}
  • URLs: a list of files, such as image.edit's {"images": rendobar.URLs{...}}
  • Content: a small text file sent inline, such as an ffmpeg concat list
  • FromJob: a completed job's output, for ffmpeg chains
  • Fonts: font files for text, under family names you choose

type Invitation

type Invitation struct {
	ID        string     `json:"id"`
	Email     string     `json:"email"`
	Role      MemberRole `json:"role"`
	ExpiresAt UnixMillis `json:"expiresAt"`
}

Invitation is read from the API. Fields it does not send are zero.

type Invitations

type Invitations struct {
	// contains filtered or unexported fields
}

Invitations manages the current workspace's pending invitations.

func (*Invitations) Revoke

func (i *Invitations) Revoke(ctx context.Context, invitationID string) error

Revoke cancels a pending invitation. Owner or admin only.

type InviteMemberParams

type InviteMemberParams struct {
	Email string     `json:"email,omitempty"`
	Role  MemberRole `json:"role,omitempty"`
}

type Invoice

type Invoice struct {
	ID string `json:"id"`
	// Amount in dollars
	Amount      float64 `json:"amount"`
	Currency    string  `json:"currency"`
	Status      string  `json:"status"`
	ProductName string  `json:"productName"`
	// ISO 8601 creation date
	CreatedAt string `json:"createdAt"`
}

Invoice is read from the API. Fields it does not send are zero.

type InvoicePage

type InvoicePage struct {
	Invoices []*Invoice
	Meta     PageMeta
}

InvoicePage is one page of invoices, newest first.

type Job

type Job struct {
	Waiting    *JobWaiting
	Dispatched *JobDispatched
	Running    *JobRunning
	Complete   *JobComplete
	Failed     *JobFailed
	Cancelled  *JobCancelled
	// contains filtered or unexported fields
}

Job is a job in any status. Exactly one of Waiting, Dispatched, Running, Complete, Failed or Cancelled is set, matching Status. A status newer than this SDK leaves all six nil, and the methods still answer.

The methods read the fields every status shares, so a list of jobs needs no type switch:

for job, err := range rb.Jobs.All(ctx, rendobar.ListParams{}) {
	if err != nil {
		return err
	}
	fmt.Println(job.ID(), job.Type(), job.Status(), job.CreatedAt())
}

func (*Job) CreatedAt

func (j *Job) CreatedAt() time.Time

CreatedAt is when the job was submitted.

func (*Job) ID

func (j *Job) ID() string

ID is the job id, such as job_abc123.

func (*Job) Info

func (j *Job) Info() JobInfo

Info returns every field the statuses share, such as Label, Cost and WebURL. Each status type embeds the same JobInfo.

func (*Job) IsTerminal

func (j *Job) IsTerminal() bool

IsTerminal reports whether the job has finished and will not change status again. For a status newer than this SDK it reads the terminal flag the API sends on every job, so Wait stops on a final status it does not know.

func (*Job) Status

func (j *Job) Status() JobStatus

Status is the job's status when it was read.

func (*Job) Type

func (j *Job) Type() JobType

Type is the job type, such as JobTypeFfmpeg.

func (*Job) UnmarshalJSON

func (j *Job) UnmarshalJSON(b []byte) error

UnmarshalJSON reads a job as the API sends it, the data of GET /jobs/{id}. Unknown fields are ignored and an unknown status sets no variant.

type JobActivity

type JobActivity struct {
	BucketStart UnixMillis `json:"bucketStart"`
	Succeeded   int64      `json:"succeeded"`
	Failed      int64      `json:"failed"`
	Other       int64      `json:"other"`
}

JobActivity is read from the API. Fields it does not send are zero.

type JobCancelled

type JobCancelled struct {
	JobInfo
}

JobCancelled is a job that was cancelled (Job.Cancelled).

type JobComplete

type JobComplete struct {
	JobInfo
	Output JobOutput
}

JobComplete is a finished job with its output (Job.Complete).

func (*JobComplete) Ffprobe

func (c *JobComplete) Ffprobe() (*FfprobeResult, error)

Ffprobe reads the output of a complete ffprobe job as the FfprobeResult the API's spec describes. It fails when the job is another type or its data is not an ffprobe result.

type JobDispatched

type JobDispatched struct {
	JobInfo
	// Progress is the completed fraction, 0 to 1, or nil when unknown.
	Progress *float64
	// ETA is the estimated time left, or 0 when unknown.
	ETA time.Duration
	// Boot describes the runner starting up, or nil.
	Boot *BootState
}

JobDispatched is a job handed to a runner that has not started (Job.Dispatched).

type JobError

type JobError struct {
	// Code is the job's error code, such as INPUT_UNREADABLE. Job codes are
	// their own open set, apart from the API's ErrorCode values.
	Code      string
	Message   string       // human-readable explanation
	Detail    string       // the tail of the tool's stderr, such as ffmpeg's, or ""
	Retryable bool         // true when running the same job again may succeed
	Phase     FailurePhase // the phase the job failed in, or "" when unknown
}

JobError is why a job failed (JobFailed.Error).

func (*JobError) UnmarshalJSON

func (e *JobError) UnmarshalJSON(b []byte) error

UnmarshalJSON reads a job error as the API sends it.

type JobFailed

type JobFailed struct {
	JobInfo
	Error JobError
}

JobFailed is a job that failed, with its error (Job.Failed).

type JobFailedError

type JobFailedError struct {
	// Code is the job's error code, such as INPUT_UNREADABLE, or
	// JOB_CANCELLED for a cancelled job. Job codes are their own open set.
	Code string
	Job  *Job
}

JobFailedError is returned by Jobs.Run when the job ends failed or cancelled.

func (*JobFailedError) Error

func (e *JobFailedError) Error() string

type JobInfo

type JobInfo struct {
	ID    string  // job id, such as job_abc123
	OrgID string  // the workspace that owns the job
	Type  JobType // job type, such as ffmpeg
	Label string  // the name given at submit, or ""

	Source         string          // how the job was created: api, dashboard, mcp and others
	Client         string          // the client that sent it, such as sdk, cli or n8n, or ""
	IdempotencyKey string          // the key the submit carried, or ""
	Params         json.RawMessage // the params as submitted, a JSON object
	Inputs         json.RawMessage // the input files as submitted, a JSON object

	// MediaType is the detected media of the input: video, image or audio, or "".
	MediaType string
	// OutputCategory is the kind of output the job makes.
	OutputCategory OutputCategory
	// Model is the generation model an image.generate or image.edit job resolved to, or "".
	Model string
	// Region is where the job runs, such as us-east-1, or "" until it is dispatched.
	Region string
	// Timeout is how long the job may run: the requested timeout capped by
	// your plan. 0 until the job is dispatched.
	Timeout time.Duration
	// Cost is what the job was charged, or nil until it is billed.
	Cost *Cost
	// RetryCount is how many times the job was retried.
	RetryCount int
	// Steps are the job's execution steps in order.
	Steps []JobStep
	// LogsAvailable reports whether execution logs are stored.
	LogsAvailable bool
	// ResourcesAvailable reports whether CPU and memory usage over time is stored.
	ResourcesAvailable bool
	// CallbackStatus is the delivery state of the callback set at submit, or
	// "" when the job has no callback.
	CallbackStatus CallbackStatus
	// Deliveries lists where the output was or will be delivered, one entry per
	// destination given at submit. Only Jobs.Get fills it.
	Deliveries []Delivery
	// WebURL is the job's page in the dashboard.
	WebURL string

	CreatedAt    time.Time // when the job was submitted
	DispatchedAt time.Time // when a runner took it
	StartedAt    time.Time // when it started running
	CompletedAt  time.Time // when it finished
	SettledAt    time.Time // when the API recorded its final status
	// RetentionExpiresAt is when the stored output files are deleted, set
	// once the job completes with stored output. Output.ExpiresAt is the much
	// earlier expiry of the download URLs.
	RetentionExpiresAt time.Time
}

JobInfo holds what a job carries in every status. Each status type embeds it, so job.Complete.ID and job.Failed.CreatedAt read it directly. A time the job has not reached yet is the zero time.Time.

type JobLogEntry

type JobLogEntry struct {
	Timestamp  UnixMillis      `json:"timestamp"`
	Level      string          `json:"level"`
	Step       string          `json:"step"`
	Event      string          `json:"event"`
	Message    string          `json:"message"`
	DurationMs int64           `json:"durationMs"`
	Meta       json.RawMessage `json:"meta"`
}

JobLogEntry is read from the API. Fields it does not send are zero.

type JobOutput

type JobOutput struct {
	// Data is the job type's computed result as JSON, or nil when the job
	// produced none. JobComplete has typed readers for known shapes, such as
	// JobComplete.Ffprobe.
	Data json.RawMessage
	// File is the single headline file: the one output file, or the stream
	// manifest (.m3u8 or .mpd). nil for data jobs and for plain sets of files.
	File *OutputFile
	// Files is every file the job produced. Empty for data jobs.
	Files []OutputFile
	// ExpiresAt is when the file URLs stop working. Zero when there are no files.
	ExpiresAt time.Time
}

JobOutput is what a completed job produced. A data job such as ffprobe fills Data and has no files. A file job such as ffmpeg fills Files, and File when it has one headline result.

func (*JobOutput) UnmarshalJSON

func (o *JobOutput) UnmarshalJSON(b []byte) error

UnmarshalJSON reads a job output as the API sends it.

type JobParams

type JobParams interface {
	// JobType is the job type these params belong to, such as JobTypeFfmpeg.
	JobType() JobType
	// Validate reports what is wrong with the params as an *Error with code
	// INVALID_ARGUMENT and one Problem each, or nil.
	Validate() error
	// contains filtered or unexported methods
}

JobParams are the params of one job type. Each job type the SDK knows has its own struct, such as FfmpegParams or ImageUpscaleParams, generated from the API's published schema, so a misspelt param or a wrong value type fails to compile. CustomParams is the one unchecked path, for anything the typed structs cannot say yet.

The job type to submit comes from JobType, so the type and its params can never disagree. Validate checks the params locally, and Jobs.Create calls it before sending.

type JobRunning

type JobRunning struct {
	JobInfo
	// Progress is the completed fraction, 0 to 1, or nil when unknown.
	Progress *float64
	// ETA is the estimated time left, or 0 when unknown.
	ETA time.Duration
}

JobRunning is a job in progress (Job.Running).

type JobShare

type JobShare struct {
	ShareID   string     `json:"shareId"`
	ShareURL  string     `json:"shareUrl"`
	CreatedAt UnixMillis `json:"createdAt"`
}

JobShare is read from the API. Fields it does not send are zero.

type JobStats

type JobStats struct {
	Window        *JobStatsWindow `json:"window"`
	Totals        *JobStatsTotals `json:"totals"`
	SuccessRate   *float64        `json:"successRate"`
	AvgDurationMs *int64          `json:"avgDurationMs"`
	Spend         *JobStatsSpend  `json:"spend"`
	Activity      []JobActivity   `json:"activity"`
}

JobStats is read from the API. Fields it does not send are zero.

type JobStatsSpend

type JobStatsSpend struct {
	Amount    int64  `json:"amount"`
	Formatted string `json:"formatted"`
}

JobStatsSpend is read from the API. Fields it does not send are zero.

type JobStatsTotals

type JobStatsTotals struct {
	Jobs      int64 `json:"jobs"`
	Succeeded int64 `json:"succeeded"`
	Failed    int64 `json:"failed"`
	Cancelled int64 `json:"cancelled"`
	Running   int64 `json:"running"`
}

JobStatsTotals is read from the API. Fields it does not send are zero.

type JobStatsWindow

type JobStatsWindow struct {
	From UnixMillis `json:"from"`
	To   UnixMillis `json:"to"`
}

JobStatsWindow is read from the API. Fields it does not send are zero.

type JobStatus

type JobStatus string

JobStatus is where a job is in its life. The API may add statuses, so keep a default branch, and ask Job.IsTerminal whether a job has finished.

const (
	StatusWaiting    JobStatus = "waiting"
	StatusDispatched JobStatus = "dispatched"
	StatusRunning    JobStatus = "running"
	StatusComplete   JobStatus = "complete"
	StatusFailed     JobStatus = "failed"
	StatusCancelled  JobStatus = "cancelled"
)

The job statuses this SDK knows.

type JobStep

type JobStep struct {
	ID     string
	Name   string
	Status StepStatus
	Error  string          // why the step failed, or ""
	Meta   json.RawMessage // step details as the API sent them, or nil

	StartedAt   time.Time
	CompletedAt time.Time
	Duration    time.Duration
}

JobStep is one execution step of a job.

func (*JobStep) UnmarshalJSON

func (s *JobStep) UnmarshalJSON(b []byte) error

UnmarshalJSON reads a step as the API sends it.

type JobTimings

type JobTimings struct {
	JobID           string `json:"jobId"`
	APITotalMs      *int64 `json:"apiTotalMs"`
	APIPrechecksMs  *int64 `json:"apiPrechecksMs"`
	APIValidationMs *int64 `json:"apiValidationMs"`
	APIDbInsertMs   *int64 `json:"apiDbInsertMs"`
	APIDispatchMs   *int64 `json:"apiDispatchMs"`
	ExecDownloadMs  *int64 `json:"execDownloadMs"`
	ExecExecuteMs   *int64 `json:"execExecuteMs"`
	ExecUploadMs    *int64 `json:"execUploadMs"`
	ExecTotalMs     *int64 `json:"execTotalMs"`
	QueueWaitMs     *int64 `json:"queueWaitMs"`
	ConsumerTotalMs *int64 `json:"consumerTotalMs"`
}

JobTimings is read from the API. Fields it does not send are zero.

type JobType

type JobType string

JobType names a job type, such as JobTypeFfmpeg. The constants in this package are the types with typed params. Jobs.Types lists every live type.

const (
	JobTypeCaptionBurn     JobType = "caption.burn"
	JobTypeCaptionsAnimate JobType = "captions.animate"
	JobTypeCompressTarget  JobType = "compress.target"
	JobTypeFfmpeg          JobType = "ffmpeg"
	JobTypeFfprobe         JobType = "ffprobe"
	JobTypeImageEdit       JobType = "image.edit"
	JobTypeImageGenerate   JobType = "image.generate"
	JobTypeImageUpscale    JobType = "image.upscale"
)

The job types with typed params in this SDK. Jobs.Types lists every live type, which may include ones newer than this list.

const JobTypeCompose JobType = "compose"

JobTypeCompose renders a timeline video. It has no typed params: the API keeps compose out of its typed submit schema, so it goes through CustomParams.

type JobTypeInfo

type JobTypeInfo struct {
	Type         JobType  `json:"type"`         // the name to submit, such as ffmpeg
	Tag          string   `json:"tag"`          // its category
	Summary      string   `json:"summary"`      // one line on what it does
	AcceptsMedia []string `json:"acceptsMedia"` // the media it reads, such as video or audio
	UseCases     []string `json:"useCases"`     // what it is typically used for
	ChainsWith   []string `json:"chainsWith"`   // job types whose output commonly feeds this one, or the other way round
}

JobTypeInfo is one live job type, from Jobs.Types.

type JobTypeSchema

type JobTypeSchema struct {
	Type JobType `json:"type"`
	// Fields are the params in display order.
	Fields []SchemaField `json:"fields"`
	// Inputs are the media files the job reads.
	Inputs SchemaInputs `json:"inputs"`
	// Discriminator names the field that picks a branch when the params are a
	// union of shapes, or "".
	Discriminator string `json:"discriminator"`
	// JSONSchema is the full JSON Schema of the params.
	JSONSchema json.RawMessage `json:"jsonSchema"`
}

JobTypeSchema is one job type's params, from Jobs.Schema.

type JobWaiting

type JobWaiting struct {
	JobInfo
}

JobWaiting is a job queued and not yet dispatched (Job.Waiting).

type Jobs

type Jobs struct {
	// contains filtered or unexported fields
}

Jobs submits jobs, follows them to the end, and reads their output.

func (*Jobs) All

func (j *Jobs) All(ctx context.Context, p ListParams) iter.Seq2[*Job, error]

All yields every matching job, fetching pages as you range over it.

for job, err := range rb.Jobs.All(ctx, rendobar.ListParams{Status: rendobar.StatusFailed}) { ... }
Example

List recent jobs. The accessors read what every status shares.

package main

import (
	"context"
	"fmt"
	"time"

	"github.com/rendobar/rendobar-go"
)

func main() {
	rb := rendobar.New()
	for job, err := range rb.Jobs.All(context.Background(), rendobar.ListParams{Limit: 20}) {
		if err != nil {
			fmt.Println(err)
			return
		}
		fmt.Println(job.ID(), job.Type(), job.Status(), job.CreatedAt().Format(time.RFC3339))
	}
}

func (*Jobs) Cancel

func (j *Jobs) Cancel(ctx context.Context, id string) error

Cancel cancels a job that has not finished.

func (*Jobs) Create

func (j *Jobs) Create(ctx context.Context, p CreateParams) (*Created, error)

Create submits a job and returns at once. Safe to retry: one key rides every retry of this call.

When the submit fails in a way that may have left a job behind (ctx ended, a connection error, a timed-out attempt, or a 429 or 5xx after the last retry), Create returns a *SubmitError with the idempotency key it sent. Submit again with that key to get the same job.

Create validates the params first (JobParams.Validate) and sends nothing when they are wrong.

func (*Jobs) CreateShare

func (j *Jobs) CreateShare(ctx context.Context, id string) (*JobShare, error)

CreateShare makes a public link to a completed job's output. A job that already has one keeps it.

func (*Jobs) DeleteShare

func (j *Jobs) DeleteShare(ctx context.Context, id string) error

DeleteShare removes a job's public link. The output stays.

func (*Jobs) Download

func (j *Jobs) Download(ctx context.Context, id string) (*Download, error)

Download streams the output file of a completed job. The caller must close Body. WithTimeout bounds only the wait for the response headers. ctx bounds the body, so a large file can take as long as it needs.

The request is retried like any other until the body starts, never after. A job with no output, such as an ffprobe job, gives a 400 *Error. Its data is in JobComplete.Output.Data instead.

Example

Stream an output file to disk. Close the body when done.

package main

import (
	"context"
	"fmt"
	"io"
	"os"

	"github.com/rendobar/rendobar-go"
)

func main() {
	rb := rendobar.New()
	d, err := rb.Jobs.Download(context.Background(), "job_abc123")
	if err != nil {
		fmt.Println(err)
		return
	}
	defer d.Body.Close()
	f, err := os.Create("out.mp4")
	if err != nil {
		fmt.Println(err)
		return
	}
	defer f.Close()
	n, err := io.Copy(f, d.Body)
	fmt.Println(n, err)
}

func (*Jobs) Get

func (j *Jobs) Get(ctx context.Context, id string) (*Job, error)

Get returns the job now.

func (*Jobs) GetShare

func (j *Jobs) GetShare(ctx context.Context, id string) (*JobShare, error)

GetShare returns a job's public link, or nil and no error when the job has none.

func (*Jobs) List

func (j *Jobs) List(ctx context.Context, p ListParams) (*Page, error)

List returns one page of jobs.

func (*Jobs) Logs

func (j *Jobs) Logs(ctx context.Context, id string) ([]*JobLogEntry, error)

Logs returns a job's log entries, oldest first.

func (*Jobs) RetryDeliveries

func (j *Jobs) RetryDeliveries(ctx context.Context, id string) (*DeliveriesRetried, error)

RetryDeliveries sends a completed job's output again to every destination that did not receive it, and reports how many it retried.

func (*Jobs) Run

func (j *Jobs) Run(ctx context.Context, p CreateParams, o *WaitOptions) (*Job, error)

Run submits a job and waits for it. A failed or cancelled job returns *JobFailedError with the job.

Once the job is submitted, every error Wait returns comes back with the last job Run read, or nil before the first read. A *ContextError or *WaitTimeoutError also names the job id, so you can call Jobs.Get, Jobs.Wait or Jobs.Cancel with it. A failed submit returns what Jobs.Create returns, such as a *SubmitError with the idempotency key.

func (*Jobs) Schema

func (j *Jobs) Schema(ctx context.Context, jobType JobType) (*JobTypeSchema, error)

Schema returns one job type's params: its fields, inputs and full JSON Schema. Public: needs no API key.

func (*Jobs) Stats

func (j *Jobs) Stats(ctx context.Context, p StatsParams) (*JobStats, error)

Stats counts the workspace's jobs over a window: totals by outcome, success rate, average duration, spend and activity over time.

func (*Jobs) Timings

func (j *Jobs) Timings(ctx context.Context, id string) (*JobTimings, error)

Timings returns how long each stage of a job took, from submit to output. A stage the job has not reached, or that it skipped, is nil.

func (*Jobs) Types

func (j *Jobs) Types(ctx context.Context) ([]JobTypeInfo, error)

Types returns every live job type. Public: needs no API key.

func (*Jobs) Wait

func (j *Jobs) Wait(ctx context.Context, id string, o *WaitOptions) (*Job, error)

Wait polls until the job completes, fails or is cancelled, and returns it.

A failed or cancelled job is not an error here. Wait returns it with a nil error, and only a complete job has job.Complete set. Check job.Status() before reading job.Complete.Output, or use Jobs.Run, which returns *JobFailedError for a failed or cancelled job.

When ctx is cancelled or its deadline passes, Wait returns a *ContextError with the job id and the last job it read. errors.Is(err, context.DeadlineExceeded) and errors.Is(err, context.Canceled) still work.

Example

Wait for a job you submitted earlier. Wait returns a failed or cancelled job with a nil error, so check its status before reading the output.

package main

import (
	"context"
	"fmt"

	"github.com/rendobar/rendobar-go"
)

func main() {
	rb := rendobar.New()
	job, err := rb.Jobs.Wait(context.Background(), "job_abc123", nil)
	if err != nil {
		fmt.Println(err)
		return
	}
	if job.Status() != rendobar.StatusComplete {
		fmt.Println("job ended", job.Status())
		return
	}
	fmt.Println(job.Complete.Output.File.URL)
}

type Limits

type Limits struct {
	ConcurrentJobs        int           `json:"concurrentJobs"`
	MaxQueuedJobs         int           `json:"maxQueuedJobs"`
	APIRequestsPerMinute  int           `json:"apiRequestsPerMinute"`
	MaxJobTimeout         time.Duration `json:"maxJobTimeout"`    // longest a job may run, sent as whole seconds
	MaxInputFileSize      int64         `json:"maxInputFileSize"` // bytes per input file, uploaded or fetched by URL
	StorageQuota          int64         `json:"storageQuota"`     // bytes
	OutputRetentionDays   int           `json:"outputRetentionDays"`
	MaxUploadSessionFiles int           `json:"maxUploadSessionFiles"`
	TeamMembers           int           `json:"teamMembers"` // members the workspace may hold, pending invitations included

	ComposeMaxPixels         int64 `json:"composeMaxPixels"` // largest compose frame, width times height
	ComposeMaxFPS            int   `json:"composeMaxFps"`
	ComposeAnimatedMaxPixels int64 `json:"composeAnimatedMaxPixels"` // largest compose frame with animated graphics
	ComposeAnimatedMaxFPS    int   `json:"composeAnimatedMaxFps"`
}

Limits are the workspace's plan limits.

func (Limits) MarshalJSON

func (l Limits) MarshalJSON() ([]byte, error)

MarshalJSON writes the limits as the API sends them, the timeout in whole seconds, so a decoded Limits encodes back to the same JSON.

func (*Limits) UnmarshalJSON

func (l *Limits) UnmarshalJSON(b []byte) error

UnmarshalJSON reads the limits, turning the timeout from seconds into a Duration.

type ListAssetsParams

type ListAssetsParams struct {
	Kind      AssetKind      // such as AssetKindMedia, or "" for all
	Scope     AssetScope     // AssetScopeOrg for the workspace's own, or "" for all
	Status    AssetStatus    // such as AssetStatusReady, or "" for all
	Lifecycle AssetLifecycle // AssetLifecycleEphemeral or AssetLifecyclePersisted, or "" for both
	// Limit is the page size. 0 is the API's default.
	Limit int
	// Offset skips that many matching assets.
	Offset int
}

ListAssetsParams filters Assets.List. The zero value lists every asset.

type ListDeliveriesParams

type ListDeliveriesParams struct {
	EndpointID string                // one endpoint's deliveries, or "" for all
	Event      WebhookEvent          // one event's, such as webhooks.JobCompleted, or "" for all
	Status     WebhookDeliveryStatus // such as WebhookDeliveryStatusFailed, or "" for all
	JobID      string                // one job's, or "" for all
	// Limit is the page size, up to 100. 0 is the API's default of 50.
	Limit int
	// Offset skips that many matching deliveries.
	Offset int
}

ListDeliveriesParams filters Webhooks.ListDeliveries. The zero value lists every delivery.

type ListObjectsParams

type ListObjectsParams struct {
	// Prefix is the folder to list: "" for the root, else a key ending in "/".
	Prefix string
	// Cursor is the previous page's Cursor, or "" for the first page.
	Cursor string
	// Limit is the page size, up to 1000. 0 is the API's default of 1000.
	Limit int
}

ListObjectsParams picks one page of Storage.ListObjects.

type ListParams

type ListParams struct {
	// Status keeps jobs in one status, such as StatusFailed. "" keeps all.
	Status JobStatus
	// Type keeps jobs of one type, such as JobTypeFfmpeg. "" keeps all.
	Type JobType
	// Limit is the page size, up to 100. The API treats a larger value as 100.
	// 0 uses the API's default of 50 for List. All always fetches pages of
	// 100 or of a smaller Limit you set. A negative Limit is an INVALID_ARGUMENT *Error.
	Limit int
	// Offset skips that many matching jobs. A negative Offset is an INVALID_ARGUMENT *Error.
	Offset int
}

ListParams filters Jobs.List and Jobs.All. The zero value lists every job.

type MarkReadParams

type MarkReadParams struct {
	IDs []string `json:"ids,omitempty"`
}

MarkReadParams is what Notifications.MarkRead sends. It is checked before anything is sent.

type MemberRole

type MemberRole string

InviteMemberParams is what Orgs.Members.Invite sends. It is checked before anything is sent. MemberRole is a string from a fixed list. Validate refuses a value outside the list below.

const (
	MemberRoleOwner  MemberRole = "owner"
	MemberRoleAdmin  MemberRole = "admin"
	MemberRoleMember MemberRole = "member"
)

The MemberRole values this SDK knows.

type Members

type Members struct {
	// contains filtered or unexported fields
}

Members invites people to the current workspace and manages its members.

func (*Members) ChangeRole

func (m *Members) ChangeRole(ctx context.Context, memberID string, p ChangeRoleParams) error

ChangeRole changes a member's role. Owner or admin only.

func (*Members) Invite

func (m *Members) Invite(ctx context.Context, p InviteMemberParams) (*Invitation, error)

Invite emails an invitation to join the current workspace. Owner or admin only.

func (*Members) Remove

func (m *Members) Remove(ctx context.Context, memberID string) error

Remove removes a member. Pass your own member id to leave the workspace.

type Notification

type Notification struct {
	ID       string               `json:"id"`
	Severity NotificationSeverity `json:"severity"`
	Title    string               `json:"title"`
	Body     string               `json:"body"`
	// Dashboard path this notification links to
	Href string `json:"href"`
	// Button text for the linked action, e.g. "Update payment"; null when there is nothing to do
	ActionLabel string `json:"actionLabel"`
	// Shown once in a modal until read
	RequiresAck bool `json:"requiresAck"`
	// Whether the calling user has read it
	Read bool `json:"read"`
	// Unix ms
	CreatedAt UnixMillis `json:"createdAt"`
}

Notification is read from the API. Fields it does not send are zero.

type NotificationList

type NotificationList struct {
	Notifications []*Notification
	// Unread counts the caller's unread notifications, which may be more than this list holds.
	Unread int64
}

NotificationList is the newest notifications, with the caller's unread count.

type NotificationSeverity

type NotificationSeverity string

NotificationSeverity is a value the API sends.

The API may add values, so keep a default branch.

const (
	NotificationSeverityInfo    NotificationSeverity = "info"
	NotificationSeveritySuccess NotificationSeverity = "success"
	NotificationSeverityWarning NotificationSeverity = "warning"
	NotificationSeverityError   NotificationSeverity = "error"
)

The NotificationSeverity values this SDK knows.

type Notifications

type Notifications struct {
	// contains filtered or unexported fields
}

Notifications reads the workspace's notifications and marks them read.

func (*Notifications) List

List returns the newest 50 notifications, each with the caller's read state.

func (*Notifications) MarkRead

MarkRead marks notifications read for the caller. Unknown ids are ignored.

type NotificationsRead

type NotificationsRead struct {
	Read int64 `json:"read"`
}

NotificationsRead is read from the API. Fields it does not send are zero.

type OffsetMeta

type OffsetMeta struct {
	// Total matching assets
	Total int64 `json:"total"`
	// Items per page
	Limit int64 `json:"limit"`
	// Current offset
	Offset int64 `json:"offset"`
}

OffsetMeta is read from the API. Fields it does not send are zero.

type Option

type Option func(*config)

Option configures a Client.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the API key. Without it, the client reads RENDOBAR_API_KEY.

func WithApp

func WithApp(name string) Option

WithApp names the application built on this client, sent as app/<name> in X-Rendobar-Client. The name is 1-32 letters, digits or . _ + -. Another name makes every call return an INVALID_ARGUMENT *Error.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL points the client at another API host, such as a test server or another Rendobar environment. The default is DefaultBaseURL.

func WithDeprecationHandler

func WithDeprecationHandler(fn func(DeprecationNotice)) Option

WithDeprecationHandler receives each deprecated endpoint once. The default logs to stderr.

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient sets the HTTP client. The client copies it, so the one you pass is never changed. Its Timeout bounds each attempt unless WithTimeout is also given.

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets how many times a 429, 500, 502, 503, 504 or a connection error is retried. The default is 2. 0 (or a negative number) sends each request once.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout bounds each request attempt, 30 seconds by default. For every call but Jobs.Download it includes reading the whole response body. For Jobs.Download it bounds only the wait for the response headers, and ctx bounds the body. It wins over the Timeout of a WithHTTPClient client, in either order, and never changes that client.

type Org

type Org struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	Slug      string     `json:"slug"`
	Role      MemberRole `json:"role"`
	CreatedAt UnixMillis `json:"createdAt"`
}

Org is read from the API. Fields it does not send are zero.

type OrgSettings

type OrgSettings struct {
	// Whether billing notification emails are enabled for this org
	BillingEmailsEnabled bool `json:"billingEmailsEnabled"`
	// Preferred execution region, or 'auto' for platform default
	DefaultRegion Region `json:"defaultRegion"`
	// When true, jobs MUST run in defaultRegion (residency); no cross-region failover
	RegionPinned bool `json:"regionPinned"`
	// Whether Rendobar may use this org's usage data for product analytics. Off stops analytics events, signup-source attribution and dashboard browser analytics; jobs, billing and security logs are unaffected
	ProductAnalyticsEnabled bool `json:"productAnalyticsEnabled"`
}

OrgSettings is read from the API. Fields it does not send are zero.

type Orgs

type Orgs struct {

	// Members invites people to the current workspace, changes their roles and removes them.
	Members *Members
	// Invitations manages the current workspace's pending invitations.
	Invitations *Invitations
	// contains filtered or unexported fields
}

Orgs manages workspaces (organizations): the one the API key belongs to, its settings, members and invitations.

func (*Orgs) Create

func (o *Orgs) Create(ctx context.Context, p CreateOrgParams) (*Org, error)

Create makes a workspace with the caller as its owner.

func (*Orgs) Current

func (o *Orgs) Current(ctx context.Context) (*CurrentOrg, error)

Current returns the current workspace with the caller's role, its subscription, plan and balance.

func (*Orgs) Delete

func (o *Orgs) Delete(ctx context.Context) error

Delete deletes the current workspace and everything in it. Owner only.

func (*Orgs) GetSettings

func (o *Orgs) GetSettings(ctx context.Context) (*OrgSettings, error)

GetSettings returns the current workspace's settings.

func (*Orgs) List

func (o *Orgs) List(ctx context.Context) ([]*Org, error)

List returns the workspaces the caller belongs to, with the caller's role in each.

func (*Orgs) Update

func (o *Orgs) Update(ctx context.Context, p UpdateOrgParams) (*Org, error)

Update renames the current workspace or changes its slug. Fields left "" stay as they are.

func (*Orgs) UpdateSettings

func (o *Orgs) UpdateSettings(ctx context.Context, p UpdateOrgSettingsParams) (*OrgSettings, error)

UpdateSettings changes the settings that are set and returns them all. Fields left zero stay as they are.

type OutputCategory

type OutputCategory string

Output category. Clients should tolerate unknown future values.

The API may add values, so keep a default branch.

const (
	OutputCategoryVideo    OutputCategory = "video"
	OutputCategoryImage    OutputCategory = "image"
	OutputCategoryAudio    OutputCategory = "audio"
	OutputCategoryJSON     OutputCategory = "json"
	OutputCategoryCaptions OutputCategory = "captions"
	OutputCategoryRaw      OutputCategory = "raw"
)

The OutputCategory values this SDK knows.

type OutputFile

type OutputFile struct {
	URL  string   // a ready-to-fetch URL that expires at JobOutput.ExpiresAt
	Path string   // the path within the job output, such as the name an ffmpeg command wrote
	Type FileType // the file type, from its extension
	Size int64    // bytes
	// SHA256 is the file's digest as 64 lowercase hex characters, or "" on
	// jobs completed before October 2026.
	SHA256 string

	// Media details, each zero when unknown.
	Format   string        // container format, from the extension
	Width    int           // pixels
	Height   int           // pixels
	Duration time.Duration // media duration
	Seed     int64         // the seed a generation used, for reproducing it
}

OutputFile is one file a job produced.

type Page

type Page struct {
	Jobs  []*Job
	Total int
}

Page is one page of jobs, newest first, and the total that matched.

type PageMeta

type PageMeta struct {
	// Total number of items
	Total int64 `json:"total"`
	// Current page number (1-indexed)
	Page int64 `json:"page"`
	// Items per page
	Limit int64 `json:"limit"`
	// Total number of pages
	Pages int64 `json:"pages"`
}

PageMeta is read from the API. Fields it does not send are zero.

type PageParams

type PageParams struct {
	// Page is the page number, from 1. 0 is the first page.
	Page int
	// Limit is the page size. 0 is the API's default.
	Limit int
}

PageParams picks one page of a list paged by number, such as Billing.Transactions.

type PaymentMethod

type PaymentMethod struct {
	ID string `json:"id"`
	// Payment method type (e.g., 'card')
	Type string `json:"type"`
	// Card brand (e.g., 'visa', 'mastercard')
	Brand string `json:"brand"`
	// Last 4 digits of card number
	Last4 string `json:"last4"`
	// Card expiration month
	ExpMonth *int64 `json:"expMonth"`
	// Card expiration year
	ExpYear *int64 `json:"expYear"`
	// Wallet type if applicable (e.g., 'apple_pay')
	Wallet string `json:"wallet"`
	// Whether this is the default payment method
	IsDefault bool `json:"isDefault"`
}

PaymentMethod is read from the API. Fields it does not send are zero.

type Plan

type Plan struct {
	Slug PlanSlug `json:"slug"`
	Name string   `json:"name"` // display name
}

Plan is the workspace's plan.

type PlanChange

type PlanChange struct {
	Plan PlanSlug `json:"plan"`
}

PlanChange is a paid plan moved to another, from Billing.CheckoutPlan.

type PlanCheckout

type PlanCheckout struct {
	Kind PlanCheckoutKind
	// Checkout is the checkout to open, when Kind is PlanCheckoutKindCheckout.
	Checkout *Checkout
	// Changed names the plan the workspace is on now, when Kind is PlanCheckoutKindChanged.
	Changed *PlanChange
}

PlanCheckout is what Billing.CheckoutPlan returns: one of Checkout or Changed is set, matching Kind. A kind newer than this SDK sets neither.

func (*PlanCheckout) UnmarshalJSON

func (p *PlanCheckout) UnmarshalJSON(b []byte) error

UnmarshalJSON reads the variant Kind names.

type PlanCheckoutKind

type PlanCheckoutKind string

PlanCheckoutKind says which way Billing.CheckoutPlan went. The API may add kinds, so keep a default branch.

const (
	// PlanCheckoutKindCheckout: the workspace had no paid plan. Open PlanCheckout.Checkout.
	PlanCheckoutKindCheckout PlanCheckoutKind = "checkout"
	// PlanCheckoutKindChanged: the workspace's paid plan was moved, billed pro rata.
	PlanCheckoutKindChanged PlanCheckoutKind = "changed"
)

The PlanCheckoutKind values this SDK knows.

type PlanSlug

type PlanSlug string

PlanSlug names a Rendobar plan. The API documents these values in prose, so the list is kept here. New plans may appear.

const (
	PlanFree   PlanSlug = "free"
	PlanPro    PlanSlug = "pro"
	PlanStudio PlanSlug = "studio"
)

The plans this SDK knows.

type PrepareAWSStorageParams

type PrepareAWSStorageParams struct {
	ID            string        `json:"id,omitempty"`
	Bucket        string        `json:"bucket,omitempty"`
	Region        string        `json:"region,omitempty"`
	PublicBaseURL string        `json:"publicBaseUrl,omitempty"`
	CreateBucket  *bool         `json:"createBucket,omitempty"`
	Access        StorageAccess `json:"access,omitempty"`
}

type PreparedAWSStorage

type PreparedAWSStorage struct {
	Bucket             string                            `json:"bucket"`
	PublicBaseURL      string                            `json:"publicBaseUrl"`
	Endpoint           string                            `json:"endpoint"`
	Region             string                            `json:"region"`
	PathStyle          bool                              `json:"pathStyle"`
	AccountID          string                            `json:"accountId"`
	Jurisdiction       R2Jurisdiction                    `json:"jurisdiction"`
	ProjectRef         string                            `json:"projectRef"`
	ExpiresOn          int64                             `json:"expiresOn"`
	Pending            bool                              `json:"pending"`
	Auth               StorageAuth                       `json:"auth"`
	Access             StorageAccess                     `json:"access"`
	Problem            *StorageConnectionProblem         `json:"problem"`
	PathTemplate       string                            `json:"pathTemplate"`
	OnConflict         StorageOnConflict                 `json:"onConflict"`
	DefaultDestination bool                              `json:"defaultDestination"`
	ConditionalWrites  bool                              `json:"conditionalWrites"`
	ID                 string                            `json:"id"`
	Provider           StorageProvider                   `json:"provider"`
	CreatedAt          UnixMillis                        `json:"createdAt"`
	UpdatedAt          UnixMillis                        `json:"updatedAt"`
	DeliverySummary    *StorageConnectionDeliverySummary `json:"deliverySummary"`
	Checks             []StorageCheck                    `json:"checks"`
	Subject            string                            `json:"subject"`
	Issuer             string                            `json:"issuer"`
	Audience           string                            `json:"audience"`
	QuickCreateURL     string                            `json:"quickCreateUrl"`
	TrustPolicy        string                            `json:"trustPolicy"`
	Terraform          string                            `json:"terraform"`
}

PreparedAWSStorage is read from the API. Fields it does not send are zero.

type Problem

type Problem struct {
	Path    string // where in the request, such as params.command, or ""
	Message string
	// UpgradeTo names the cheapest plan that allows the request, or "" when
	// no plan change helps or only an enterprise plan does.
	UpgradeTo PlanSlug
}

Problem is one thing a refusal found wrong with a request.

type R2Jurisdiction

type R2Jurisdiction string

R2Jurisdiction is a string from a fixed list. Validate refuses a value outside the list below.

const (
	R2JurisdictionEu      R2Jurisdiction = "eu"
	R2JurisdictionFedramp R2Jurisdiction = "fedramp"
	R2JurisdictionUs      R2Jurisdiction = "us"
)

The R2Jurisdiction values this SDK knows.

type Region

type Region string

UpdateOrgSettingsParams is what Orgs.UpdateSettings sends. It is checked before anything is sent. Region is a string from a fixed list. Validate refuses a value outside the list below.

const (
	RegionAuto       Region = "auto"
	RegionUsEast1    Region = "us-east-1"
	RegionEuCentral1 Region = "eu-central-1"
)

The Region values this SDK knows.

type RetriedDelivery

type RetriedDelivery struct {
	ID         string                `json:"id"`
	Status     WebhookDeliveryStatus `json:"status"`
	Event      WebhookEvent          `json:"event"`
	EndpointID string                `json:"endpointId"`
}

RetriedDelivery is read from the API. Fields it does not send are zero.

type S3BucketLookup

type S3BucketLookup struct {
	State  S3BucketLookupState `json:"state"`
	Region string              `json:"region"`
}

S3BucketLookup is read from the API. Fields it does not send are zero.

type S3BucketLookupState

type S3BucketLookupState string

S3BucketLookupState is a value the API sends.

The API may add values, so keep a default branch.

const (
	S3BucketLookupStateFound   S3BucketLookupState = "found"
	S3BucketLookupStateFree    S3BucketLookupState = "free"
	S3BucketLookupStateUnknown S3BucketLookupState = "unknown"
)

The S3BucketLookupState values this SDK knows.

type SchemaField

type SchemaField struct {
	// Key is unique within the job type. Name repeats when a union gives one
	// param several shapes, so use Key to tell fields apart.
	Key string `json:"key"`
	// Name is the param key to submit the value under.
	Name  string `json:"name"`
	Label string `json:"label"`
	// Type is string, number, boolean, options or json.
	Type        FieldType       `json:"type"`
	Description string          `json:"description"`
	Required    bool            `json:"required"`
	Nullable    bool            `json:"nullable"`
	Default     json.RawMessage `json:"default"`   // the default value as JSON, or nil
	Example     json.RawMessage `json:"example"`   // an example value as JSON, or nil
	Options     []SchemaOption  `json:"options"`   // the allowed values when Type is options
	Min         *float64        `json:"min"`       // smallest number, or nil
	Max         *float64        `json:"max"`       // largest number, or nil
	MinLength   *int64          `json:"minLength"` // shortest string, or nil
	MaxLength   *int64          `json:"maxLength"` // longest string, or nil
	// Advanced marks a field a form can tuck behind an Advanced section.
	Advanced bool `json:"advanced"`
	// ShowWhen is set on a field that belongs to one branch of a union, or nil.
	ShowWhen *ShowWhen `json:"showWhen"`
	// URL reports that an input takes the URL of a file. Inputs only.
	URL bool `json:"url"`
	// Multiple reports that an input takes a list of values. Inputs only.
	Multiple bool `json:"multiple"`
}

SchemaField describes one param or input of a job type.

type SchemaInputs

type SchemaInputs struct {
	Fields []SchemaField `json:"fields"`
	// Variadic reports that any file name may be an input key, as with ffmpeg
	// and ffprobe, whose commands name their inputs.
	Variadic bool `json:"variadic"`
}

SchemaInputs describes the input files of a job type.

type SchemaOption

type SchemaOption struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

SchemaOption is one allowed value of an options field.

type ShowWhen

type ShowWhen struct {
	Field  string   `json:"field"`  // the discriminator field
	Equals []string `json:"equals"` // the field applies when the discriminator holds one of these
}

ShowWhen ties a field to the branch of a union it belongs to.

type StatsParams

type StatsParams struct {
	// Window is how far back to count, such as StatsWindowWeek. "" is the API's default, 24 hours.
	Window StatsWindow
}

StatsParams picks the window Jobs.Stats counts. The zero value counts the last 24 hours.

type StatsWindow

type StatsWindow string

Window (default 24h). `all` covers the org's whole history. Default: "24h".

The API may add values, so keep a default branch.

const (
	StatsWindowDay     StatsWindow = "24h"
	StatsWindowWeek    StatsWindow = "7d"
	StatsWindowMonth   StatsWindow = "30d"
	StatsWindowQuarter StatsWindow = "90d"
	StatsWindowYear    StatsWindow = "365d"
	StatsWindowAll     StatsWindow = "all"
)

The StatsWindow values this SDK knows.

type StepStatus

type StepStatus string

StepStatus is where a job step is. The API documents these values in prose, not as a schema enum, so the list is kept here. New values may appear.

const (
	StepPending  StepStatus = "pending"
	StepRunning  StepStatus = "running"
	StepComplete StepStatus = "complete"
	StepSkipped  StepStatus = "skipped"
	StepError    StepStatus = "error"
)

The StepStatus values this SDK knows.

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage manages storage connections: buckets you own, connected once under an id you choose. A job delivers its output to one through CreateParams.Destinations, as "storage://<id>/...". Credentials are tested before they are stored and never come back in a response.

func (*Storage) Create

Create connects a bucket: one of CreateStorageR2Params, CreateStorageS3Params, CreateStorageS3CompatibleParams or CreateStorageSupabaseParams. Checks reports the probe that admitted it. A failed probe returns a VALIDATION_ERROR *Error, a taken id CONFLICT.

func (*Storage) Delete

func (s *Storage) Delete(ctx context.Context, id string) error

Delete removes a storage connection. The bucket and its files stay.

func (*Storage) FinishSupabase

func (s *Storage) FinishSupabase(ctx context.Context, p FinishSupabaseParams) (*StorageConnection, error)

FinishSupabase turns a Supabase sign-in into one connection. An expired sign-in or a failed probe gives a VALIDATION_ERROR *Error.

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, id string) (*StorageConnection, error)

Get returns one storage connection.

func (*Storage) List

func (s *Storage) List(ctx context.Context) (*StorageList, error)

List returns every storage connection.

func (*Storage) ListAccountBuckets

func (s *Storage) ListAccountBuckets(ctx context.Context, p AccountBucketsParams) ([]string, error)

ListAccountBuckets returns the names of the buckets a connection the workspace already has on that provider can see. It is empty when there is none, or when its credentials cannot list buckets.

func (*Storage) ListObjects

func (s *Storage) ListObjects(ctx context.Context, id string, p ListObjectsParams) (*StorageObjects, error)

ListObjects returns one page of the folders and files directly under Prefix. Follow Cursor for the next page. A key that cannot list gives a VALIDATION_ERROR *Error, a bucket that does not answer UPSTREAM_ERROR.

func (*Storage) ListSupabaseBuckets

func (s *Storage) ListSupabaseBuckets(ctx context.Context, state, projectRef string) (*SupabaseBuckets, error)

ListSupabaseBuckets returns the buckets one of those projects has.

func (*Storage) ListSupabaseProjects

func (s *Storage) ListSupabaseProjects(ctx context.Context, state string) (*SupabaseProjects, error)

ListSupabaseProjects returns the projects a Supabase sign-in can see.

func (*Storage) LookUpS3Bucket

func (s *Storage) LookUpS3Bucket(ctx context.Context, name string) (*S3BucketLookup, error)

LookUpS3Bucket says whether an S3 bucket name is taken, and in which region, before anyone has credentials for it. It cannot say whether the bucket is yours: S3 names are global.

func (*Storage) PrepareAWS

PrepareAWS starts connecting an S3 bucket with one click: a pending connection and a CloudFormation quick-create link. The stack reports back and the connection finishes on its own: poll Get until Pending is false.

func (*Storage) StartSupabase

func (s *Storage) StartSupabase(ctx context.Context) (*SupabaseSignIn, error)

StartSupabase starts a Supabase sign-in: send the person to URL. They come back to the dashboard with State, which the next calls take.

func (*Storage) Stats

func (s *Storage) Stats(ctx context.Context, id string) (*StorageStats, error)

Stats returns what a connection has been doing: deliveries a day, measured throughput, bytes written and the last test's round trip. Never an object name.

func (*Storage) Test

func (s *Storage) Test(ctx context.Context, id string) (*StorageTestResult, error)

Test writes, reads, lists and deletes a probe object. OK reflects the write check.

func (*Storage) Update

Update replaces a connection's credentials (tested first) or changes its public base URL, path template, conflict rule or default. Fields left zero stay as they are.

type StorageAWSRole

type StorageAWSRole struct {
	RoleARN string `json:"roleArn,omitempty"`
}

func (StorageAWSRole) MarshalJSON

func (v StorageAWSRole) MarshalJSON() ([]byte, error)

MarshalJSON sends type "aws-role" with the fields.

type StorageAccess

type StorageAccess string

PrepareAWSStorageParams is what Storage.PrepareAWS sends. It is checked before anything is sent. StorageAccess is a string from a fixed list. Validate refuses a value outside the list below.

const (
	StorageAccessDeliver StorageAccess = "deliver"
	StorageAccessRead    StorageAccess = "read"
)

The StorageAccess values this SDK knows.

type StorageAuth

type StorageAuth string

StorageAuth is a value the API sends.

The API may add values, so keep a default branch.

const (
	StorageAuthRole StorageAuth = "role"
)

The StorageAuth values this SDK knows.

type StorageCheck

type StorageCheck struct {
	Name    StorageCheckName      `json:"name"`
	Status  StorageCheckStatus    `json:"status"`
	Reason  StorageDeliveryReason `json:"reason"`
	Message string                `json:"message"`
}

StorageCheck is read from the API. Fields it does not send are zero.

type StorageCheckName

type StorageCheckName string

StorageCheckName is a value the API sends.

The API may add values, so keep a default branch.

const (
	StorageCheckNameWrite  StorageCheckName = "write"
	StorageCheckNameRead   StorageCheckName = "read"
	StorageCheckNameDelete StorageCheckName = "delete"
	StorageCheckNameList   StorageCheckName = "list"
)

The StorageCheckName values this SDK knows.

type StorageCheckStatus

type StorageCheckStatus string

StorageCheckStatus is a value the API sends.

The API may add values, so keep a default branch.

const (
	StorageCheckStatusPassed  StorageCheckStatus = "passed"
	StorageCheckStatusFailed  StorageCheckStatus = "failed"
	StorageCheckStatusSkipped StorageCheckStatus = "skipped"
)

The StorageCheckStatus values this SDK knows.

type StorageCloudflareToken

type StorageCloudflareToken struct {
	Token string `json:"token,omitempty"`
}

func (StorageCloudflareToken) MarshalJSON

func (v StorageCloudflareToken) MarshalJSON() ([]byte, error)

MarshalJSON sends type "cloudflare-token" with the fields.

type StorageConnection

type StorageConnection struct {
	Bucket             string                            `json:"bucket"`
	PublicBaseURL      string                            `json:"publicBaseUrl"`
	Endpoint           string                            `json:"endpoint"`
	Region             string                            `json:"region"`
	PathStyle          bool                              `json:"pathStyle"`
	AccountID          string                            `json:"accountId"`
	Jurisdiction       R2Jurisdiction                    `json:"jurisdiction"`
	ProjectRef         string                            `json:"projectRef"`
	ExpiresOn          int64                             `json:"expiresOn"`
	Pending            bool                              `json:"pending"`
	Auth               StorageAuth                       `json:"auth"`
	Access             StorageAccess                     `json:"access"`
	Problem            *StorageConnectionProblem         `json:"problem"`
	PathTemplate       string                            `json:"pathTemplate"`
	OnConflict         StorageOnConflict                 `json:"onConflict"`
	DefaultDestination bool                              `json:"defaultDestination"`
	ConditionalWrites  bool                              `json:"conditionalWrites"`
	ID                 string                            `json:"id"`
	Provider           StorageProvider                   `json:"provider"`
	CreatedAt          UnixMillis                        `json:"createdAt"`
	UpdatedAt          UnixMillis                        `json:"updatedAt"`
	DeliverySummary    *StorageConnectionDeliverySummary `json:"deliverySummary"`
	Checks             []StorageCheck                    `json:"checks"`
}

StorageConnection is read from the API. Fields it does not send are zero.

type StorageConnectionDeliverySummary

type StorageConnectionDeliverySummary struct {
	JobsLast30d  int64                  `json:"jobsLast30d"`
	BytesLast30d int64                  `json:"bytesLast30d"`
	LastAt       UnixMillis             `json:"lastAt"`
	LastStatus   *StorageDeliveryStatus `json:"lastStatus"`
	LastReason   *StorageDeliveryReason `json:"lastReason"`
}

StorageConnectionDeliverySummary is read from the API. Fields it does not send are zero.

type StorageConnectionProblem

type StorageConnectionProblem struct {
	At      int64  `json:"at"`
	Message string `json:"message"`
}

StorageConnectionProblem is read from the API. Fields it does not send are zero.

type StorageDeliveryReason

type StorageDeliveryReason string

StorageDeliveryReason is a value the API sends.

The API may add values, so keep a default branch.

const (
	StorageDeliveryReasonDestinationDenied      StorageDeliveryReason = "destination_denied"
	StorageDeliveryReasonSignatureMismatch      StorageDeliveryReason = "signature_mismatch"
	StorageDeliveryReasonBucketNotFound         StorageDeliveryReason = "bucket_not_found"
	StorageDeliveryReasonObjectTooLarge         StorageDeliveryReason = "object_too_large"
	StorageDeliveryReasonAlreadyExists          StorageDeliveryReason = "already_exists"
	StorageDeliveryReasonDestinationUnavailable StorageDeliveryReason = "destination_unavailable"
	StorageDeliveryReasonNotDeliverable         StorageDeliveryReason = "not_deliverable"
)

The StorageDeliveryReason values this SDK knows.

type StorageDeliveryStatus

type StorageDeliveryStatus string

StorageDeliveryStatus is a value the API sends.

The API may add values, so keep a default branch.

const (
	StorageDeliveryStatusDelivered StorageDeliveryStatus = "delivered"
	StorageDeliveryStatusFailed    StorageDeliveryStatus = "failed"
)

The StorageDeliveryStatus values this SDK knows.

type StorageKeys

type StorageKeys struct {
	AccessKeyID     string `json:"accessKeyId,omitempty"`
	SecretAccessKey string `json:"secretAccessKey,omitempty"`
}

func (StorageKeys) MarshalJSON

func (v StorageKeys) MarshalJSON() ([]byte, error)

MarshalJSON sends type "keys" with the fields.

type StorageList

type StorageList struct {
	Connections []*StorageConnection
	Total       int64
}

StorageList is every storage connection of the workspace.

type StorageObject

type StorageObject struct {
	Key          string     `json:"key"`
	Size         int64      `json:"size"`
	LastModified UnixMillis `json:"lastModified"`
}

StorageObject is read from the API. Fields it does not send are zero.

type StorageObjects

type StorageObjects struct {
	Folders []string        `json:"folders"`
	Objects []StorageObject `json:"objects"`
	Cursor  string          `json:"cursor"`
}

StorageObjects is read from the API. Fields it does not send are zero.

type StorageOnConflict

type StorageOnConflict string

StorageOnConflict is a string from a fixed list. Validate refuses a value outside the list below.

const (
	StorageOnConflictSuffix  StorageOnConflict = "suffix"
	StorageOnConflictReplace StorageOnConflict = "replace"
)

The StorageOnConflict values this SDK knows.

type StorageProvider

type StorageProvider string

StorageProvider names where a storage connection's bucket lives.

The API may add values, so keep a default branch.

const (
	StorageProviderR2           StorageProvider = "r2"
	StorageProviderSupabase     StorageProvider = "supabase"
	StorageProviderS3           StorageProvider = "s3"
	StorageProviderS3Compatible StorageProvider = "s3-compatible"
)

The StorageProvider values this SDK knows.

type StorageStats

type StorageStats struct {
	WindowDays   int64                   `json:"windowDays"`
	Deliveries   *StorageStatsDeliveries `json:"deliveries"`
	Throughput   *StorageStatsThroughput `json:"throughput"`
	Written      *StorageStatsWritten    `json:"written"`
	RoundTripMs  *int64                  `json:"roundTripMs"`
	MeasuredFrom string                  `json:"measuredFrom"`
}

StorageStats is read from the API. Fields it does not send are zero.

type StorageStatsDeliveries

type StorageStatsDeliveries struct {
	Delivered int64                             `json:"delivered"`
	Failed    int64                             `json:"failed"`
	Pending   int64                             `json:"pending"`
	Daily     []StorageStatsDeliveriesDailyItem `json:"daily"`
}

StorageStatsDeliveries is read from the API. Fields it does not send are zero.

type StorageStatsDeliveriesDailyItem

type StorageStatsDeliveriesDailyItem struct {
	Date      string                 `json:"date"`
	Delivered int64                  `json:"delivered"`
	Failed    int64                  `json:"failed"`
	Reason    *StorageDeliveryReason `json:"reason"`
}

StorageStatsDeliveriesDailyItem is read from the API. Fields it does not send are zero.

type StorageStatsThroughput

type StorageStatsThroughput struct {
	MedianBytesPerSec int64 `json:"medianBytesPerSec"`
	MinBytesPerSec    int64 `json:"minBytesPerSec"`
	MaxBytesPerSec    int64 `json:"maxBytesPerSec"`
	Samples           int64 `json:"samples"`
}

StorageStatsThroughput is read from the API. Fields it does not send are zero.

type StorageStatsWritten

type StorageStatsWritten struct {
	Bytes int64 `json:"bytes"`
	Files int64 `json:"files"`
}

StorageStatsWritten is read from the API. Fields it does not send are zero.

type StorageSupabaseSession

type StorageSupabaseSession struct {
	AnonKey      string `json:"anonKey,omitempty"`
	SessionToken string `json:"sessionToken,omitempty"`
}

func (StorageSupabaseSession) MarshalJSON

func (v StorageSupabaseSession) MarshalJSON() ([]byte, error)

MarshalJSON sends type "supabase-session" with the fields.

type StorageTestResult

type StorageTestResult struct {
	OK     bool           `json:"ok"`
	Checks []StorageCheck `json:"checks"`
}

StorageTestResult is read from the API. Fields it does not send are zero.

type SubmitError

type SubmitError struct {
	// IdempotencyKey is the key the submit sent, yours or the one the SDK generated.
	IdempotencyKey string
	// Err is the cause.
	Err error
}

SubmitError is returned by Jobs.Create and Jobs.Run when a submit fails in a way that may have left a job behind: ctx ended, the connection failed, the attempt timed out, or the API still answered 429 or 5xx after the last retry. Submit again with IdempotencyKey to get that job, or to create it if it does not exist. The API never creates a second job for one key.

It unwraps to the cause, so errors.As(err, &apiErr) reads a 429 or 5xx and errors.Is(err, context.DeadlineExceeded) reports a deadline.

func (*SubmitError) Error

func (e *SubmitError) Error() string

func (*SubmitError) Unwrap

func (e *SubmitError) Unwrap() error

Unwrap returns Err.

type SupabaseBucket

type SupabaseBucket struct {
	Name   string `json:"name"`
	Public bool   `json:"public"`
}

SupabaseBucket is read from the API. Fields it does not send are zero.

type SupabaseBuckets

type SupabaseBuckets struct {
	State      string           `json:"state"`
	ProjectRef string           `json:"projectRef"`
	Buckets    []SupabaseBucket `json:"buckets"`
}

SupabaseBuckets is read from the API. Fields it does not send are zero.

type SupabaseProject

type SupabaseProject struct {
	Ref    string `json:"ref"`
	Name   string `json:"name"`
	Region string `json:"region"`
}

SupabaseProject is read from the API. Fields it does not send are zero.

type SupabaseProjects

type SupabaseProjects struct {
	State    string            `json:"state"`
	Projects []SupabaseProject `json:"projects"`
}

SupabaseProjects is read from the API. Fields it does not send are zero.

type SupabaseSignIn

type SupabaseSignIn struct {
	URL   string `json:"url"`
	State string `json:"state"`
}

SupabaseSignIn is read from the API. Fields it does not send are zero.

type TemplatesParams

type TemplatesParams struct {
	Limit  int // the page size, or 0 for the API's default
	Offset int // how many templates to skip
}

TemplatesParams pages Assets.Templates.

type Transaction

type Transaction struct {
	ID   string `json:"id"`
	Type string `json:"type"`
	// Amount in dollars (positive = credit, negative = debit)
	Amount float64 `json:"amount"`
	// Real money paid in dollars
	PaidAmount float64 `json:"paidAmount"`
	// Bonus credits in dollars
	BonusAmount float64 `json:"bonusAmount"`
	JobID       string  `json:"jobId"`
	// Job type for job-linked rows (e.g. 'ffmpeg'); null otherwise
	JobType JobType `json:"jobType"`
	// Balance after transaction in dollars
	BalanceAfter float64 `json:"balanceAfter"`
	// Unix timestamp in milliseconds
	CreatedAt UnixMillis `json:"createdAt"`
}

Transaction is read from the API. Fields it does not send are zero.

type TransactionPage

type TransactionPage struct {
	Transactions []*Transaction
	Meta         PageMeta
}

TransactionPage is one page of balance transactions, newest first.

type URL

type URL string

URL is a file the API fetches. An uploaded asset's content URL works too.

type URLs

type URLs []string

URLs is a list of files the API fetches, for an input that takes several.

type UnixMillis

type UnixMillis int64

UnixMillis is a timestamp as the API sends it: milliseconds since the Unix epoch. 0 means the API did not send one.

func (UnixMillis) Time

func (u UnixMillis) Time() time.Time

Time returns the timestamp, or the zero time.Time for 0.

type UpdateAPIKeyParams

type UpdateAPIKeyParams struct {
	Name    string `json:"name,omitempty"`
	Enabled *bool  `json:"enabled,omitempty"`
}

UpdateAPIKeyParams is what APIKeys.Update sends. It is checked before anything is sent.

type UpdateOrgParams

type UpdateOrgParams struct {
	Name string `json:"name,omitempty"`
	Slug string `json:"slug,omitempty"`
}

UpdateOrgParams is what Orgs.Update sends. It is checked before anything is sent.

type UpdateOrgSettingsParams

type UpdateOrgSettingsParams struct {
	BillingEmailsEnabled    *bool  `json:"billingEmailsEnabled,omitempty"`
	DefaultRegion           Region `json:"defaultRegion,omitempty"`
	RegionPinned            *bool  `json:"regionPinned,omitempty"`
	ProductAnalyticsEnabled *bool  `json:"productAnalyticsEnabled,omitempty"`
}

type UpdateStorageCredentials

type UpdateStorageCredentials interface {
	// contains filtered or unexported methods
}

UpdateStorageParams is what Storage.Update sends. It is checked before anything is sent.

Set it to one of: StorageKeys, StorageCloudflareToken, StorageAWSRole, StorageSupabaseSession.

type UpdateStorageParams

type UpdateStorageParams struct {
	Credentials        UpdateStorageCredentials `json:"credentials,omitempty"`
	PublicBaseURL      string                   `json:"publicBaseUrl,omitempty"`
	PathTemplate       string                   `json:"pathTemplate,omitempty"`
	OnConflict         StorageOnConflict        `json:"onConflict,omitempty"`
	DefaultDestination *bool                    `json:"defaultDestination,omitempty"`
}

type UpdateWebhookParams

type UpdateWebhookParams struct {
	// Endpoint name (1-50 chars)
	Name string `json:"name,omitempty"`
	// Webhook endpoint URL (HTTPS only)
	URL string `json:"url,omitempty"`
	// Events to subscribe to
	SubscribedEvents []WebhookEvent `json:"subscribedEvents,omitempty"`
	// Enable or disable the endpoint
	Active *bool `json:"active,omitempty"`
}

UpdateWebhookParams is what Webhooks.Update sends. It is checked before anything is sent.

type UploadParams

type UploadParams struct {
	// Filename is the display name, also used when the file is downloaded.
	Filename string
	// ContentType is the MIME type, such as "video/mp4", or "" to let the API detect it.
	ContentType string
	// Checksum is the file's SHA-256 as hex, or "". With it, the API skips the
	// upload when the workspace already has the same file.
	Checksum string
	// Persist keeps the asset until you delete it. By default it is ephemeral
	// and expires after 24 hours.
	Persist bool
	// Concurrency is how many parts of a large file upload at once. 0 means 5.
	Concurrency int
	// OnProgress is called as bytes finish uploading, one call at a time, or nil.
	OnProgress func(UploadProgress)
}

UploadParams describes a file for Uploads.Create. Filename is required.

type UploadProgress

type UploadProgress struct {
	Loaded int64 // bytes uploaded so far
	Total  int64 // the file's size
}

UploadProgress is how much of an upload has finished.

type Uploads

type Uploads struct {
	// contains filtered or unexported fields
}

Uploads sends local files to Rendobar as assets that jobs can read.

func (*Uploads) Create

func (u *Uploads) Create(ctx context.Context, file io.ReaderAt, size int64, p UploadParams) (*Asset, error)

Create uploads a file and returns the ready asset. size is the file's length in bytes. Pass the asset to a job as rendobar.URL("asset://" + asset.ID) or as its URL.

A small file goes up in one request, a large one in parts, Concurrency at a time, read from file with ReadAt. An *os.File works, and so does a *bytes.Reader. Each part is retried up to 3 times. ctx bounds the whole upload.

type Usage

type Usage struct {
	TotalJobs int64 `json:"totalJobs"`
	// Total charged in nanodollars
	TotalAmountCharged int64 `json:"totalAmountCharged"`
	// Total formatted as dollars
	TotalAmountFormatted string                         `json:"totalAmountFormatted"`
	TotalComputeSeconds  int64                          `json:"totalComputeSeconds"`
	ByJobType            map[string]UsageByJobTypeValue `json:"byJobType"`
	Daily                []UsageDailyItem               `json:"daily"`
}

Usage is read from the API. Fields it does not send are zero.

type UsageByClientParams

type UsageByClientParams struct {
	// Days counts back from today. 0 is the API's default. A negative value is an INVALID_ARGUMENT *Error.
	Days int
}

UsageByClientParams bounds Billing.UsageByClient.

type UsageByJobTypeValue

type UsageByJobTypeValue struct {
	JobCount        int64  `json:"jobCount"`
	AmountCharged   int64  `json:"amountCharged"`
	AmountFormatted string `json:"amountFormatted"`
	ComputeSeconds  int64  `json:"computeSeconds"`
}

UsageByJobTypeValue is read from the API. Fields it does not send are zero.

type UsageDailyItem

type UsageDailyItem struct {
	Date           string  `json:"date"`
	JobType        JobType `json:"jobType"`
	JobCount       int64   `json:"jobCount"`
	AmountCharged  int64   `json:"amountCharged"`
	ComputeSeconds int64   `json:"computeSeconds"`
}

UsageDailyItem is read from the API. Fields it does not send are zero.

type UsageParams

type UsageParams struct {
	// Start is the first day counted, in UTC. The zero time leaves it to the API.
	Start time.Time
	// End is the last day counted, in UTC. The zero time leaves it to the API.
	End time.Time
}

UsageParams bounds Billing.Usage. The zero value is the API's default range.

type WaitOptions

type WaitOptions struct {
	// Timeout overrides the deadline. By default Wait gives up 5 minutes after it
	// starts, a job stuck in the queue included. When the job first reports its own
	// time limit, the deadline moves out to that limit plus 2 minutes, counted from
	// that poll, if that is later.
	Timeout     time.Duration
	Interval    time.Duration // first poll gap, default 2s
	MaxInterval time.Duration // longest poll gap, default 10s
	OnProgress  func(*Job)
}

WaitOptions tune Jobs.Wait and Jobs.Run. The zero value is fine.

type WaitTimeoutError

type WaitTimeoutError struct {
	JobID      string
	LastStatus JobStatus
	Waited     time.Duration // how long Wait actually waited
	Job        *Job          // the last state Wait read
}

WaitTimeoutError is returned by Jobs.Wait when its own deadline (see WaitOptions.Timeout) passes first. The job may still finish.

func (*WaitTimeoutError) Error

func (e *WaitTimeoutError) Error() string

type WebhookDelivery

type WebhookDelivery struct {
	ID            string                `json:"id"`
	EndpointID    string                `json:"endpointId"`
	EndpointName  string                `json:"endpointName"`
	JobID         string                `json:"jobId"`
	Event         WebhookEvent          `json:"event"`
	Payload       string                `json:"payload"`
	Status        WebhookDeliveryStatus `json:"status"`
	StatusCode    *int64                `json:"statusCode"`
	ResponseBody  string                `json:"responseBody"`
	Attempts      int64                 `json:"attempts"`
	LastAttemptAt UnixMillis            `json:"lastAttemptAt"`
	CreatedAt     UnixMillis            `json:"createdAt"`
}

WebhookDelivery is read from the API. Fields it does not send are zero.

type WebhookDeliveryStatus

type WebhookDeliveryStatus string

WebhookDeliveryStatus is a value the API sends.

The API may add values, so keep a default branch.

const (
	WebhookDeliveryStatusPending   WebhookDeliveryStatus = "pending"
	WebhookDeliveryStatusDelivered WebhookDeliveryStatus = "delivered"
	WebhookDeliveryStatusFailed    WebhookDeliveryStatus = "failed"
	WebhookDeliveryStatusCancelled WebhookDeliveryStatus = "cancelled"
)

The WebhookDeliveryStatus values this SDK knows.

type WebhookEndpoint

type WebhookEndpoint struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	URL  string `json:"url"`
	// Masked signing secret
	SigningSecret       string         `json:"signingSecret"`
	Active              bool           `json:"active"`
	DisabledReason      string         `json:"disabledReason"`
	ConsecutiveFailures int64          `json:"consecutiveFailures"`
	SubscribedEvents    []WebhookEvent `json:"subscribedEvents"`
	RotationActive      bool           `json:"rotationActive"`
	SecretExpiresAt     UnixMillis     `json:"secretExpiresAt"`
	CreatedAt           UnixMillis     `json:"createdAt"`
	UpdatedAt           UnixMillis     `json:"updatedAt"`
}

WebhookEndpoint is read from the API. Fields it does not send are zero.

type WebhookEndpointList

type WebhookEndpointList struct {
	Endpoints []*WebhookEndpoint
	Total     int64
}

WebhookEndpointList is every webhook endpoint of the workspace.

type WebhookEvent

type WebhookEvent string

WebhookEvent names a webhook event, such as "job.completed". The constants are in package webhooks, generated from the API's spec: webhooks.JobCompleted and the rest. The API may add events, so keep a default branch.

type WebhookTestResult

type WebhookTestResult struct {
	Delivered      bool   `json:"delivered"`
	StatusCode     *int64 `json:"statusCode"`
	ResponseTimeMs int64  `json:"responseTimeMs"`
}

WebhookTestResult is read from the API. Fields it does not send are zero.

type Webhooks

type Webhooks struct {
	// contains filtered or unexported fields
}

Webhooks manages webhook endpoints and their deliveries. To verify and read a delivery your server receives, use package webhooks.

func (*Webhooks) Create

Create adds an endpoint. Its SigningSecret is the secret webhooks.Parse verifies deliveries with, shown in full only here and by RotateSecret.

func (*Webhooks) Delete

func (w *Webhooks) Delete(ctx context.Context, id string) error

Delete removes an endpoint. Deliveries to it stop.

func (*Webhooks) Get

func (w *Webhooks) Get(ctx context.Context, id string) (*WebhookEndpoint, error)

Get returns one endpoint. SigningSecret is masked.

func (*Webhooks) List

List returns every endpoint. SigningSecret is masked.

func (*Webhooks) ListDeliveries

func (w *Webhooks) ListDeliveries(ctx context.Context, p ListDeliveriesParams) (*DeliveryPage, error)

ListDeliveries returns one page of deliveries. A negative Limit or Offset is an INVALID_ARGUMENT *Error.

func (*Webhooks) RetryDelivery

func (w *Webhooks) RetryDelivery(ctx context.Context, id string) (*RetriedDelivery, error)

RetryDelivery sends a delivery again, as a new attempt of the same delivery.

func (*Webhooks) RotateSecret

func (w *Webhooks) RotateSecret(ctx context.Context, id string) (*WebhookEndpoint, error)

RotateSecret gives an endpoint a new signing secret, returned in full in SigningSecret. For a while deliveries are signed with both, the old one in X-Rendobar-Signature-Previous, so a receiver keeps working while you switch.

func (*Webhooks) Test

func (w *Webhooks) Test(ctx context.Context, id string) (*WebhookTestResult, error)

Test sends the endpoint a test event and reports how it answered.

func (*Webhooks) Update

Update changes an endpoint's name, URL or events, or turns it off or on. Fields left zero stay as they are.

Directories

Path Synopsis
internal
api
api/account
Plan limits and enabled features for the authenticated account
Plan limits and enabled features for the authenticated account
api/billing
Check account balance and usage history
Check account balance and usage history
api/jobs
Job creation and management (submit, list, get, cancel, download)
Job creation and management (submit, list, get, cancel, download)
cmd/genparams command
Command genparams writes spec_gen.go and webhooks/events_gen.go from the published OpenAPI document: one typed params struct per job type, named string types with constants for every enum, sealed interfaces for unions, a Validate method per struct, and the closed sets and shapes the API's responses and webhooks use, such as the ffprobe result and each event's data.
Command genparams writes spec_gen.go and webhooks/events_gen.go from the published OpenAPI document: one typed params struct per job type, named string types with constants for every enum, sealed interfaces for unions, a Validate method per struct, and the closed sets and shapes the API's responses and webhooks use, such as the ffprobe result and each event's data.
Package realtime streams a Rendobar workspace's events as they happen: job progress, logs and status, balance and notification changes.
Package realtime streams a Rendobar workspace's events as they happen: job progress, logs and status, balance and notification changes.
Package webhooks verifies and reads Rendobar webhook deliveries and per-job callbacks.
Package webhooks verifies and reads Rendobar webhook deliveries and per-job callbacks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL