transcodely

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 16 Imported by: 0

README

Transcodely Go SDK

The official Go SDK for the Transcodely video transcoding API.

go get github.com/transcodely/transcodely-go

Requires Go 1.23+.

Quickstart

package main

import (
    "context"
    "log"
    "os"

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

func main() {
    client, err := transcodely.New(os.Getenv("TRANSCODELY_API_KEY"))
    if err != nil {
        log.Fatal(err)
    }

    job, err := client.Jobs.Create(context.Background(), &transcodely.JobCreateParams{
        InputUrl: "https://download.samplelib.com/mp4/sample-30s.mp4",
        Outputs: []*transcodely.OutputSpec{{
            Type: transcodely.OutputFormatHLS,
            Video: []*transcodely.VideoVariant{
                {Codec: transcodely.VideoCodecH264, Resolution: transcodely.Resolution1080P},
                {Codec: transcodely.VideoCodecH264, Resolution: transcodely.Resolution720P},
            },
        }},
    })
    if err != nil {
        log.Fatal(err)
    }
    log.Printf("created %s in status %s", job.GetId(), job.GetStatus())
}

Design

The SDK mirrors Stripe's Go conventions:

  • Functional options on transcodely.NewWithBaseURL, WithHTTPClient, WithMaxRetries, WithUserAgent, WithAPIVersion, WithAutoIdempotency.
  • Resource namespaces off the root client: client.Jobs, client.Videos, client.Presets, client.Origins, client.Apps, client.APIKeys, client.Organizations, client.Memberships, client.Users, client.Health.
  • Typed errors via errors.As. Concrete types implement the Error interface and expose ErrorCode() and RequestID(). Switch on *NotFoundError, *RateLimitError, *InvalidRequestError, etc.
  • Auto-pagination via *Iter[T]Next() / Current() / Err().
  • Auto-idempotencyCreate mutations get a UUIDv4 Idempotency-Key unless you set one yourself.
  • Streaming watches via *Stream[T] — heartbeats are filtered, network blips reconnect transparently.
  • Wire format is the same custom snake_case + lowercase-enum JSON the TypeScript and Python SDKs use, ported verbatim from the api repo's internal/connect/codec.go.

Watch a job

stream := client.Jobs.Watch(ctx, job.GetId())
defer stream.Close()
for stream.Next() {
    event := stream.Current()
    j := event.GetJob()
    log.Printf("[%s] progress=%d%%", j.GetStatus(), j.GetProgress())
    if j.GetStatus() == transcodely.JobStatusCompleted ||
        j.GetStatus() == transcodely.JobStatusFailed ||
        j.GetStatus() == transcodely.JobStatusCanceled {
        break
    }
}
if err := stream.Err(); err != nil {
    log.Fatal(err)
}

Iterate every job

iter := client.Jobs.List(ctx, &transcodely.JobListParams{
    Pagination: &transcodely.PaginationRequest{Limit: 50},
})
for iter.Next() {
    job := iter.Current()
    log.Printf("%s %s", job.GetId(), job.GetStatus())
}
if err := iter.Err(); err != nil {
    log.Fatal(err)
}

Typed error handling

job, err := client.Jobs.Get(ctx, "job_does_not_exist")
if err != nil {
    var notFound *transcodely.NotFoundError
    var invalid  *transcodely.InvalidRequestError
    var rate     *transcodely.RateLimitError
    switch {
    case errors.As(err, &notFound):
        log.Printf("not found, request id: %s", notFound.RequestID())
    case errors.As(err, &invalid):
        for _, v := range invalid.Errors() {
            log.Printf("%s: %s", v.Field, v.Description)
        }
    case errors.As(err, &rate):
        time.Sleep(rate.RetryAfter)
    default:
        log.Fatal(err)
    }
}

Configuration

Option Default Notes
WithBaseURL(url) https://api.transcodely.com Override for staging or self-hosted
WithHTTPClient(c) &http.Client{Timeout: 60s} Inject a custom transport
WithMaxRetries(n) 2 Network errors, 5xx, 429, 503 are retried with jitter
WithUserAgent(ua) Appended to the default transcodely-go/<version>
WithAPIVersion(v) calendar version baked at SDK build time Sent as Transcodely-Version header
WithAutoIdempotency(b) true Auto-generate UUIDv4 Idempotency-Key on Create mutations

Environment variables

The SDK does not read any environment variables itself. Pass os.Getenv(...) into New(...) so your callers stay in control.

Examples

See examples/ for ready-to-run programs:

  • 01_create_job — submit a job
  • 02_watch_job — stream a job to completion
  • 03_pagination — iterate every job
  • 04_error_handling — typed error matching

Generated code

internal/gen/ holds the protobuf-generated message and Connect-RPC client types. Treat it as opaque — the public API surface is everything in the root package; lift types you need via the re-exports in types.go.

License

MIT — see LICENSE.

Documentation

Overview

Package transcodely is the official Go SDK for the Transcodely video transcoding API.

Get an API key at https://transcodely.com and start transcoding:

import (
    "context"
    "log"
    "os"

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

func main() {
    client, err := transcodely.New(os.Getenv("TRANSCODELY_API_KEY"))
    if err != nil {
        log.Fatal(err)
    }
    job, err := client.Jobs.Create(context.Background(), &transcodely.JobCreateParams{
        InputURL: "https://example.com/in.mp4",
        Outputs: []*transcodely.OutputSpec{
            {Type: transcodely.OutputFormatHLS, Video: []*transcodely.VideoVariant{
                {Codec: transcodely.VideoCodecH264, Resolution: transcodely.Resolution1080P},
            }},
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    log.Printf("created %s in %s", job.GetId(), job.GetStatus())
}

All resources hang off the root Client: Jobs, Videos, Presets, Origins, Apps, APIKeys, Organizations, Memberships, Users, Health.

Errors are typed; switch on them with errors.As. See the Error interface for the common surface and APIConnectionError, APIError, AuthenticationError, PermissionError, NotFoundError, ConflictError, RateLimitError, InvalidRequestError, PreconditionError for the concrete classes.

Index

Constants

View Source
const (
	MembershipRoleOwner  = v1.MembershipRole_MEMBERSHIP_ROLE_OWNER
	MembershipRoleAdmin  = v1.MembershipRole_MEMBERSHIP_ROLE_ADMIN
	MembershipRoleMember = v1.MembershipRole_MEMBERSHIP_ROLE_MEMBER
	MembershipRoleViewer = v1.MembershipRole_MEMBERSHIP_ROLE_VIEWER
)
View Source
const (
	JobStatusUnspecified          = v1.JobStatus_JOB_STATUS_UNSPECIFIED
	JobStatusPending              = v1.JobStatus_JOB_STATUS_PENDING
	JobStatusProbing              = v1.JobStatus_JOB_STATUS_PROBING
	JobStatusProcessing           = v1.JobStatus_JOB_STATUS_PROCESSING
	JobStatusCompleted            = v1.JobStatus_JOB_STATUS_COMPLETED
	JobStatusFailed               = v1.JobStatus_JOB_STATUS_FAILED
	JobStatusCanceled             = v1.JobStatus_JOB_STATUS_CANCELED
	JobStatusPartial              = v1.JobStatus_JOB_STATUS_PARTIAL
	JobStatusAwaitingConfirmation = v1.JobStatus_JOB_STATUS_AWAITING_CONFIRMATION
)

JobStatus values.

View Source
const (
	JobPriorityEconomy  = v1.JobPriority_JOB_PRIORITY_ECONOMY
	JobPriorityStandard = v1.JobPriority_JOB_PRIORITY_STANDARD
	JobPriorityPremium  = v1.JobPriority_JOB_PRIORITY_PREMIUM
)

JobPriority values.

View Source
const (
	OutputStatusPending    = v1.OutputStatus_OUTPUT_STATUS_PENDING
	OutputStatusProcessing = v1.OutputStatus_OUTPUT_STATUS_PROCESSING
	OutputStatusCompleted  = v1.OutputStatus_OUTPUT_STATUS_COMPLETED
	OutputStatusFailed     = v1.OutputStatus_OUTPUT_STATUS_FAILED
	OutputStatusCanceled   = v1.OutputStatus_OUTPUT_STATUS_CANCELED
)

OutputStatus values.

OutputFormat values.

View Source
const (
	VideoCodecH264 = v1.VideoCodec_VIDEO_CODEC_H264
	VideoCodecH265 = v1.VideoCodec_VIDEO_CODEC_H265
	VideoCodecVP9  = v1.VideoCodec_VIDEO_CODEC_VP9
	VideoCodecAV1  = v1.VideoCodec_VIDEO_CODEC_AV1
)

VideoCodec values.

View Source
const (
	AudioCodecAAC  = v1.AudioCodec_AUDIO_CODEC_AAC
	AudioCodecOpus = v1.AudioCodec_AUDIO_CODEC_OPUS
	AudioCodecMP3  = v1.AudioCodec_AUDIO_CODEC_MP3
)

AudioCodec values.

View Source
const (
	ContainerMP4  = v1.Container_CONTAINER_MP4
	ContainerWebM = v1.Container_CONTAINER_WEBM
	ContainerMKV  = v1.Container_CONTAINER_MKV
	ContainerTS   = v1.Container_CONTAINER_TS
	ContainerMOV  = v1.Container_CONTAINER_MOV
)

Container values.

View Source
const (
	Resolution480P  = v1.Resolution_RESOLUTION_480P
	Resolution720P  = v1.Resolution_RESOLUTION_720P
	Resolution1080P = v1.Resolution_RESOLUTION_1080P
	Resolution1440P = v1.Resolution_RESOLUTION_1440P
	Resolution2160P = v1.Resolution_RESOLUTION_2160P
	Resolution4320P = v1.Resolution_RESOLUTION_4320P
)

Resolution values.

View Source
const (
	QualityTierEconomy  = v1.QualityTier_QUALITY_TIER_ECONOMY
	QualityTierStandard = v1.QualityTier_QUALITY_TIER_STANDARD
	QualityTierPremium  = v1.QualityTier_QUALITY_TIER_PREMIUM
)

QualityTier values.

View Source
const (
	ContentTypeFilm       = v1.ContentType_CONTENT_TYPE_FILM
	ContentTypeAnimation  = v1.ContentType_CONTENT_TYPE_ANIMATION
	ContentTypeGrain      = v1.ContentType_CONTENT_TYPE_GRAIN
	ContentTypeGaming     = v1.ContentType_CONTENT_TYPE_GAMING
	ContentTypeSports     = v1.ContentType_CONTENT_TYPE_SPORTS
	ContentTypeStillImage = v1.ContentType_CONTENT_TYPE_STILLIMAGE
)

ContentType values (encoder hint — what kind of source you're feeding it).

View Source
const (
	DeliveryFormatProgressive = v1.DeliveryFormat_DELIVERY_FORMAT_PROGRESSIVE
	DeliveryFormatHLS         = v1.DeliveryFormat_DELIVERY_FORMAT_HLS
	DeliveryFormatDASH        = v1.DeliveryFormat_DELIVERY_FORMAT_DASH
	DeliveryFormatCMAF        = v1.DeliveryFormat_DELIVERY_FORMAT_CMAF
)

DeliveryFormat values.

View Source
const (
	BitrateModeCRF = v1.BitrateMode_BITRATE_MODE_CRF
	BitrateModeCBR = v1.BitrateMode_BITRATE_MODE_CBR
	BitrateModeVBR = v1.BitrateMode_BITRATE_MODE_VBR
)

BitrateMode values.

WatchEventType values.

View Source
const (
	DRMSystemWidevine  = v1.DRMSystem_DRM_SYSTEM_WIDEVINE
	DRMSystemFairPlay  = v1.DRMSystem_DRM_SYSTEM_FAIRPLAY
	DRMSystemPlayReady = v1.DRMSystem_DRM_SYSTEM_PLAYREADY
)

DRMSystem values.

View Source
const (
	EncryptionSchemeCENC = v1.EncryptionScheme_ENCRYPTION_SCHEME_CENC
	EncryptionSchemeCBCS = v1.EncryptionScheme_ENCRYPTION_SCHEME_CBCS
)

EncryptionScheme values.

View Source
const (
	HDRFormatHDR10        = v1.HDRFormat_HDR_FORMAT_HDR10
	HDRFormatHDR10Plus    = v1.HDRFormat_HDR_FORMAT_HDR10_PLUS
	HDRFormatHLG          = v1.HDRFormat_HDR_FORMAT_HLG
	HDRFormatDolbyVision5 = v1.HDRFormat_HDR_FORMAT_DOLBY_VISION_5
	HDRFormatDolbyVision8 = v1.HDRFormat_HDR_FORMAT_DOLBY_VISION_8
)

HDRFormat values.

View Source
const (
	HDRModePassthrough = v1.HDRMode_HDR_MODE_PASSTHROUGH
	HDRModeTonemap     = v1.HDRMode_HDR_MODE_TONEMAP
	HDRModeForce       = v1.HDRMode_HDR_MODE_FORCE
)

HDRMode values.

View Source
const (
	ToneMappingReinhard = v1.ToneMapping_TONE_MAPPING_REINHARD
	ToneMappingHable    = v1.ToneMapping_TONE_MAPPING_HABLE
	ToneMappingBT2390   = v1.ToneMapping_TONE_MAPPING_BT2390
	ToneMappingMobius   = v1.ToneMapping_TONE_MAPPING_MOBIUS
)

ToneMapping values.

ContentAwareMode values.

SubtitleOperation values.

SubtitleFormat values.

View Source
const (
	ThumbnailModeSingle     = v1.ThumbnailMode_THUMBNAIL_MODE_SINGLE
	ThumbnailModeInterval   = v1.ThumbnailMode_THUMBNAIL_MODE_INTERVAL
	ThumbnailModeSprite     = v1.ThumbnailMode_THUMBNAIL_MODE_SPRITE
	ThumbnailModeTimestamps = v1.ThumbnailMode_THUMBNAIL_MODE_TIMESTAMPS
)

ThumbnailMode values.

ThumbnailFormat values.

HLSSegmentFormat values.

HLSPlaylistType values.

GOPAlignmentMode values.

OriginProvider values.

View Source
const (
	OriginPermissionRead  = v1.OriginPermission_ORIGIN_PERMISSION_READ
	OriginPermissionWrite = v1.OriginPermission_ORIGIN_PERMISSION_WRITE
)

OriginPermission values.

View Source
const (
	OriginStatusActive   = v1.OriginStatus_ORIGIN_STATUS_ACTIVE
	OriginStatusFailed   = v1.OriginStatus_ORIGIN_STATUS_FAILED
	OriginStatusArchived = v1.OriginStatus_ORIGIN_STATUS_ARCHIVED
)

OriginStatus values.

View Source
const (
	VideoStatusUploading  = v1.VideoStatus_VIDEO_STATUS_UPLOADING
	VideoStatusProcessing = v1.VideoStatus_VIDEO_STATUS_PROCESSING
	VideoStatusReady      = v1.VideoStatus_VIDEO_STATUS_READY
	VideoStatusError      = v1.VideoStatus_VIDEO_STATUS_ERROR
	VideoStatusArchived   = v1.VideoStatus_VIDEO_STATUS_ARCHIVED
	VideoStatusDeleted    = v1.VideoStatus_VIDEO_STATUS_DELETED
)

VideoStatus values.

View Source
const (
	VideoVisibilityPublic   = v1.VideoVisibility_VIDEO_VISIBILITY_PUBLIC
	VideoVisibilityUnlisted = v1.VideoVisibility_VIDEO_VISIBILITY_UNLISTED
	VideoVisibilityPrivate  = v1.VideoVisibility_VIDEO_VISIBILITY_PRIVATE
)

VideoVisibility values.

View Source
const APIVersion = "2026-05-03"

APIVersion is the calendar version of the Transcodely API the SDK targets. Sent as the `Transcodely-Version` header on every request.

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

DefaultBaseURL is the production API endpoint.

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

Version is the semantic version of the Transcodely Go SDK.

Variables

View Source
var ErrMissingAPIKey = errors.New("transcodely: api key is required")

ErrMissingAPIKey is returned by New when no API key is supplied.

Functions

This section is empty.

Types

type APIConnectionError

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

APIConnectionError indicates a network failure: DNS resolution, TLS handshake, connection refused, no HTTP response received.

func (*APIConnectionError) Error

func (e *APIConnectionError) Error() string

func (*APIConnectionError) ErrorCode

func (e *APIConnectionError) ErrorCode() string

func (*APIConnectionError) Errors

func (e *APIConnectionError) Errors() []FieldViolation

func (*APIConnectionError) HTTPStatus

func (e *APIConnectionError) HTTPStatus() int

func (*APIConnectionError) RequestID

func (e *APIConnectionError) RequestID() string

func (*APIConnectionError) Type

func (e *APIConnectionError) Type() string

func (*APIConnectionError) Unwrap

func (e *APIConnectionError) Unwrap() error

type APIError

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

APIError indicates a server-side internal error (5xx).

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) ErrorCode

func (e *APIError) ErrorCode() string

func (*APIError) Errors

func (e *APIError) Errors() []FieldViolation

func (*APIError) HTTPStatus

func (e *APIError) HTTPStatus() int

func (*APIError) RequestID

func (e *APIError) RequestID() string

func (*APIError) Type

func (e *APIError) Type() string

func (*APIError) Unwrap

func (e *APIError) Unwrap() error

type APIKey

type APIKey = v1.APIKey

type APIKeyCreateParams

type APIKeyCreateParams = v1.CreateAPIKeyRequest

type APIKeyListParams

type APIKeyListParams = v1.ListAPIKeysRequest

type APIKeys

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

APIKeys is the Stripe-style namespace for API keys.

func (*APIKeys) Create

func (a *APIKeys) Create(ctx context.Context, params *APIKeyCreateParams) (*CreatedAPIKey, error)

Create issues a new API key. The plaintext secret is only available once, in the returned CreatedAPIKey — store it immediately.

func (*APIKeys) Get

func (a *APIKeys) Get(ctx context.Context, id string) (*APIKey, error)

Get fetches an API key by ID. The plaintext is never returned again.

func (*APIKeys) List

func (a *APIKeys) List(ctx context.Context, params *APIKeyListParams) *Iter[*APIKey]

List returns an iterator over API keys.

func (*APIKeys) Revoke

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

Revoke immediately deactivates an API key.

type AV1Options

type AV1Options = v1.AV1Options

type App

type App = v1.App

type AppCreateParams

type AppCreateParams = v1.CreateAppRequest

type AppListParams

type AppListParams = v1.ListAppsRequest

type AppUpdateParams

type AppUpdateParams = v1.UpdateAppRequest

type Apps

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

Apps is the Stripe-style namespace for application scopes within an org.

func (*Apps) Archive

func (a *Apps) Archive(ctx context.Context, id string) error

Archive soft-deletes an app.

func (*Apps) Create

func (a *Apps) Create(ctx context.Context, params *AppCreateParams) (*App, error)

Create registers a new app.

func (*Apps) EnableHosting

func (a *Apps) EnableHosting(ctx context.Context, id string) (*App, error)

EnableHosting turns on the managed hosting experience for an app.

func (*Apps) Get

func (a *Apps) Get(ctx context.Context, id string) (*App, error)

Get fetches an app by ID (`app_*`).

func (*Apps) List

func (a *Apps) List(ctx context.Context, params *AppListParams) *Iter[*App]

List returns an iterator over apps the caller can see.

func (*Apps) Update

func (a *Apps) Update(ctx context.Context, params *AppUpdateParams) (*App, error)

Update mutates app metadata.

func (*Apps) UpdateHostingConfig

func (a *Apps) UpdateHostingConfig(ctx context.Context, params *v1.UpdateHostingConfigRequest) (*App, error)

UpdateHostingConfig mutates the managed-hosting configuration of an app.

type AudioCodec

type AudioCodec = v1.AudioCodec

type AudioSettings

type AudioSettings = v1.AudioSettings

type AudioStreamInfo

type AudioStreamInfo = v1.AudioStreamInfo

type AudioTrackConfig

type AudioTrackConfig = v1.AudioTrackConfig

type AuthenticationError

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

AuthenticationError indicates a 401: missing, invalid, revoked or expired API key.

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

func (*AuthenticationError) ErrorCode

func (e *AuthenticationError) ErrorCode() string

func (*AuthenticationError) Errors

func (e *AuthenticationError) Errors() []FieldViolation

func (*AuthenticationError) HTTPStatus

func (e *AuthenticationError) HTTPStatus() int

func (*AuthenticationError) RequestID

func (e *AuthenticationError) RequestID() string

func (*AuthenticationError) Type

func (e *AuthenticationError) Type() string

func (*AuthenticationError) Unwrap

func (e *AuthenticationError) Unwrap() error

type AutoABRConfig

type AutoABRConfig = v1.AutoABRConfig

type AutoProfileDefaults

type AutoProfileDefaults = v1.AutoProfileDefaults

type BYOKConfig

type BYOKConfig = v1.BYOKConfig

type BitrateMode

type BitrateMode = v1.BitrateMode

type BurnInStyle

type BurnInStyle = v1.BurnInStyle

type Client

type Client struct {
	Jobs          *Jobs
	Videos        *Videos
	Presets       *Presets
	Origins       *Origins
	Apps          *Apps
	APIKeys       *APIKeys
	Organizations *Organizations
	Memberships   *Memberships
	Users         *Users
	Health        *Health
	// contains filtered or unexported fields
}

Client is the root Transcodely API client. Construct one with New, then reach the resource you need via the typed namespace fields.

A *Client is safe for concurrent use by multiple goroutines and is meant to live for the lifetime of your process. The underlying *http.Client is shared across every RPC and connection-pools transparently.

func New

func New(apiKey string, opts ...Option) (*Client, error)

New constructs a Client. apiKey is required and should be a value like `ak_live_…` or `ak_test_…`. Pass any number of [Option]s to override defaults.

type CompletedPart

type CompletedPart = v1.CompletedPart

type ComponentHealth

type ComponentHealth = v1.ComponentHealth

type ConflictError

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

ConflictError indicates a 409: already exists, idempotency conflict, slug taken.

func (*ConflictError) Error

func (e *ConflictError) Error() string

func (*ConflictError) ErrorCode

func (e *ConflictError) ErrorCode() string

func (*ConflictError) Errors

func (e *ConflictError) Errors() []FieldViolation

func (*ConflictError) HTTPStatus

func (e *ConflictError) HTTPStatus() int

func (*ConflictError) RequestID

func (e *ConflictError) RequestID() string

func (*ConflictError) Type

func (e *ConflictError) Type() string

func (*ConflictError) Unwrap

func (e *ConflictError) Unwrap() error

type Container

type Container = v1.Container

type ContentAnalysis

type ContentAnalysis = v1.ContentAnalysis

type ContentAwareConfig

type ContentAwareConfig = v1.ContentAwareConfig

type ContentAwareMode

type ContentAwareMode = v1.ContentAwareMode

type ContentType

type ContentType = v1.ContentType

type CreateWebhookConfig

type CreateWebhookConfig = v1.CreateWebhookConfig

type CreatedAPIKey

type CreatedAPIKey struct {
	Key       *APIKey
	PlainText string
}

CreatedAPIKey wraps a freshly created key with its one-time-visible secret.

type DASHConfig

type DASHConfig = v1.DASHConfig

type DRMConfig

type DRMConfig = v1.DRMConfig

type DRMSystem

type DRMSystem = v1.DRMSystem

type DeliveryFormat

type DeliveryFormat = v1.DeliveryFormat

type EncryptionScheme

type EncryptionScheme = v1.EncryptionScheme

type Error

type Error interface {
	error
	// Code is the server-side machine-readable code (e.g. "JOB_NOT_FOUND").
	ErrorCode() string
	// RequestID is the `req_*` identifier the server returned in `X-Request-Id`,
	// or the empty string if absent.
	RequestID() string
}

Error is the base interface implemented by every typed error the SDK returns.

All concrete error types (*APIConnectionError, *APIError, *AuthenticationError, *PermissionError, *NotFoundError, *ConflictError, *RateLimitError, *InvalidRequestError, *PreconditionError) embed *baseError, so a single errors.As(err, &target) check is enough for typed handling.

type ErrorDetails

type ErrorDetails = v1.ErrorDetails

type ExecutionTiming

type ExecutionTiming = v1.ExecutionTiming

type FieldViolation

type FieldViolation struct {
	Field       string `json:"field"`
	Description string `json:"description"`
}

FieldViolation describes a single field-level validation failure.

type GOPAlignmentMode

type GOPAlignmentMode = v1.GOPAlignmentMode

type GcsCredentials

type GcsCredentials = v1.GcsCredentials

type GcsOriginConfig

type GcsOriginConfig = v1.GcsOriginConfig

type H264Options

type H264Options = v1.H264Options

type H265Options

type H265Options = v1.H265Options

type HDRConfig

type HDRConfig = v1.HDRConfig

type HDRFormat

type HDRFormat = v1.HDRFormat

type HDRMode

type HDRMode = v1.HDRMode

type HLSConfig

type HLSConfig = v1.HLSConfig

type HLSPlaylistType

type HLSPlaylistType = v1.HLSPlaylistType

type HLSSegmentFormat

type HLSSegmentFormat = v1.HLSSegmentFormat

type Health

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

Health is the Stripe-style namespace for liveness checks.

func (*Health) Check

func (h *Health) Check(ctx context.Context, service string) (*HealthCheckResponse, error)

Check pings the API. Pass an empty service string for an overall check.

type HealthCheckResponse

type HealthCheckResponse = v1.HealthCheckResponse

type HostingConfig

type HostingConfig = v1.HostingConfig

type HttpCredentials

type HttpCredentials = v1.HttpCredentials

type HttpOriginConfig

type HttpOriginConfig = v1.HttpOriginConfig

type InputMetadata

type InputMetadata = v1.InputMetadata

type InvalidRequestError

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

InvalidRequestError indicates a 400/422: request body or parameters invalid. Errors() returns the per-field violations from the server.

func (*InvalidRequestError) Error

func (e *InvalidRequestError) Error() string

func (*InvalidRequestError) ErrorCode

func (e *InvalidRequestError) ErrorCode() string

func (*InvalidRequestError) Errors

func (e *InvalidRequestError) Errors() []FieldViolation

func (*InvalidRequestError) HTTPStatus

func (e *InvalidRequestError) HTTPStatus() int

func (*InvalidRequestError) RequestID

func (e *InvalidRequestError) RequestID() string

func (*InvalidRequestError) Type

func (e *InvalidRequestError) Type() string

func (*InvalidRequestError) Unwrap

func (e *InvalidRequestError) Unwrap() error

type Iter

type Iter[T any] struct {
	// contains filtered or unexported fields
}

Iter is the iterator returned by every List* method. It transparently fetches further pages on demand so callers can write a single for-loop:

iter := client.Jobs.List(ctx, &transcodely.JobListParams{Limit: 50})
for iter.Next() {
    job := iter.Current()
    // ...
}
if err := iter.Err(); err != nil {
    // ...
}

To bound iteration, break out of the loop or call Close.

func (*Iter[T]) Close

func (it *Iter[T]) Close() error

Close releases iterator state. The current implementation is a no-op (HTTP connections close automatically), but you should still defer Close so the signature is stable across future versions.

func (*Iter[T]) Current

func (it *Iter[T]) Current() T

Current returns the most recent item produced by Next. Calling Current before Next has returned true is undefined.

func (*Iter[T]) Err

func (it *Iter[T]) Err() error

Err returns the first error encountered during iteration, or nil.

func (*Iter[T]) Next

func (it *Iter[T]) Next() bool

Next loads the next item, fetching another page if necessary. It returns false when there are no more items or when an error occurs (check Err()).

type Job

type Job = v1.Job

type JobCreateParams

type JobCreateParams = v1.CreateJobRequest

type JobListParams

type JobListParams = v1.ListJobsRequest

type JobOutput

type JobOutput = v1.JobOutput

type JobPriority

type JobPriority = v1.JobPriority

type JobStatus

type JobStatus = v1.JobStatus

type Jobs

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

Jobs is the Stripe-style namespace for transcoding jobs. Reach it via client.Jobs.

func (*Jobs) Cancel

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

Cancel stops a pending or running job.

func (*Jobs) Confirm

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

Confirm starts a job currently in AWAITING_CONFIRMATION (created with delay_start = true). Returns the job in PROCESSING state.

func (*Jobs) Create

func (j *Jobs) Create(ctx context.Context, params *JobCreateParams) (*Job, error)

Create submits a new transcoding job. If params.IdempotencyKey is empty, the SDK auto-generates one so retried calls are server-side deduped.

func (*Jobs) Get

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

Get fetches a single job by ID.

func (*Jobs) List

func (j *Jobs) List(ctx context.Context, params *JobListParams) *Iter[*Job]

List returns an auto-paging iterator over jobs. Mutate params.Pagination to override the page size or starting cursor.

func (*Jobs) Watch

func (j *Jobs) Watch(ctx context.Context, id string) *Stream[*WatchJobResponse]

Watch opens a server-stream that pushes job events until the job reaches a terminal state. Heartbeats are filtered transparently. Always defer Close().

type KeyServerConfig

type KeyServerConfig = v1.KeyServerConfig

type Membership

type Membership = v1.Membership

type MembershipListParams

type MembershipListParams = v1.ListMembershipsRequest

type MembershipRole

type MembershipRole = v1.MembershipRole

MembershipRole values (re-exported here for proximity).

type MembershipWithUser

type MembershipWithUser = v1.MembershipWithUser

type Memberships

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

Memberships is the Stripe-style namespace for org memberships.

func (*Memberships) Get

Get fetches a membership by ID (`mem_*`). The result includes the linked user.

func (*Memberships) List

List returns an iterator over memberships within the active organization. Items include the linked user via MembershipWithUser.

func (*Memberships) Remove

func (m *Memberships) Remove(ctx context.Context, id string) error

Remove deletes a membership.

func (*Memberships) UpdateRole

func (m *Memberships) UpdateRole(ctx context.Context, id string, role MembershipRole) (*Membership, error)

UpdateRole changes a member's role.

type MultipartAbortParams

type MultipartAbortParams = v1.AbortMultipartUploadRequest

type MultipartCompleteParams

type MultipartCompleteParams = v1.CompleteMultipartUploadRequest

type MultipartCreateParams

type MultipartCreateParams = v1.CreateMultipartUploadRequest

type MultipartPartURLsParams

type MultipartPartURLsParams = v1.GetUploadPartUrlsRequest

type NotFoundError

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

NotFoundError indicates a 404: the requested resource was not found.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) ErrorCode

func (e *NotFoundError) ErrorCode() string

func (*NotFoundError) Errors

func (e *NotFoundError) Errors() []FieldViolation

func (*NotFoundError) HTTPStatus

func (e *NotFoundError) HTTPStatus() int

func (*NotFoundError) RequestID

func (e *NotFoundError) RequestID() string

func (*NotFoundError) Type

func (e *NotFoundError) Type() string

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

type Option

type Option func(*config)

Option configures a Client. Options are applied in order; later options override earlier ones.

func WithAPIVersion

func WithAPIVersion(v string) Option

WithAPIVersion overrides the calendar API version sent in the Transcodely-Version header. You should rarely need this — the SDK pins a version known to be compatible with its types.

func WithAutoIdempotency

func WithAutoIdempotency(enabled bool) Option

WithAutoIdempotency toggles automatic Idempotency-Key generation on POST mutations. Defaults to true.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL overrides the API base URL. Defaults to DefaultBaseURL. Useful for staging, local docker-compose, or self-hosted deployments.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient supplies a custom *http.Client. Useful for injecting a shared transport, custom timeouts, proxy configuration, or test stubs.

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets how many times the SDK retries a transient failure (network errors, 5xx, 429, 503) before giving up. Defaults to 2. Set to 0 to disable retries.

func WithUserAgent

func WithUserAgent(ua string) Option

WithUserAgent appends a token to the default user-agent string. Use this to identify your application: WithUserAgent("acme-encoder/1.4.2").

type OrgCreateParams

type OrgCreateParams = v1.CreateOrganizationRequest

type OrgListParams

type OrgListParams = v1.ListOrganizationsRequest

type OrgUpdateParams

type OrgUpdateParams = v1.UpdateOrganizationRequest

type Organization

type Organization = v1.Organization

type Organizations

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

Organizations is the Stripe-style namespace for organizations.

func (*Organizations) CheckSlug

func (o *Organizations) CheckSlug(ctx context.Context, slug string) (*SlugCheckResult, error)

CheckSlug reports whether a candidate slug is free.

func (*Organizations) Create

func (o *Organizations) Create(ctx context.Context, params *OrgCreateParams) (*Organization, error)

Create provisions a new organization. The caller becomes its first owner.

func (*Organizations) Get

func (o *Organizations) Get(ctx context.Context, idOrSlug string) (*Organization, error)

Get fetches an organization by ID (`org_*`) or slug.

func (*Organizations) List

func (o *Organizations) List(ctx context.Context, params *OrgListParams) *Iter[*Organization]

List returns an iterator over organizations the caller can see.

func (*Organizations) Update

func (o *Organizations) Update(ctx context.Context, params *OrgUpdateParams) (*Organization, error)

Update mutates organization metadata.

type Origin

type Origin = v1.Origin

type OriginCreateParams

type OriginCreateParams = v1.CreateOriginRequest

type OriginListParams

type OriginListParams = v1.ListOriginsRequest

type OriginPermission

type OriginPermission = v1.OriginPermission

type OriginProvider

type OriginProvider = v1.OriginProvider

type OriginRef

type OriginRef = v1.OriginRef

type OriginStatus

type OriginStatus = v1.OriginStatus

type OriginUpdateParams

type OriginUpdateParams = v1.UpdateOriginRequest

type Origins

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

Origins is the Stripe-style namespace for storage origins (GCS, S3, HTTP).

func (*Origins) Archive

func (o *Origins) Archive(ctx context.Context, id string) error

Archive soft-deletes an origin.

func (*Origins) Create

func (o *Origins) Create(ctx context.Context, params *OriginCreateParams) (*Origin, error)

Create registers a new origin.

func (*Origins) Get

func (o *Origins) Get(ctx context.Context, id string) (*Origin, error)

Get fetches an origin by ID (`ori_*`).

func (*Origins) List

func (o *Origins) List(ctx context.Context, params *OriginListParams) *Iter[*Origin]

List returns an iterator over origins in the active app.

func (*Origins) Update

func (o *Origins) Update(ctx context.Context, params *OriginUpdateParams) (*Origin, error)

Update mutates an origin's metadata or credentials.

func (*Origins) Validate

func (o *Origins) Validate(ctx context.Context, id string) (*ValidationResult, error)

Validate runs a connectivity / permissions check against the origin.

type OutputFormat

type OutputFormat = v1.OutputFormat

type OutputSpec

type OutputSpec = v1.OutputSpec

type OutputStatus

type OutputStatus = v1.OutputStatus

type PaginationRequest

type PaginationRequest = v1.PaginationRequest

type PaginationResponse

type PaginationResponse = v1.PaginationResponse

type PermissionError

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

PermissionError indicates a 403: authenticated but lacking permission.

func (*PermissionError) Error

func (e *PermissionError) Error() string

func (*PermissionError) ErrorCode

func (e *PermissionError) ErrorCode() string

func (*PermissionError) Errors

func (e *PermissionError) Errors() []FieldViolation

func (*PermissionError) HTTPStatus

func (e *PermissionError) HTTPStatus() int

func (*PermissionError) RequestID

func (e *PermissionError) RequestID() string

func (*PermissionError) Type

func (e *PermissionError) Type() string

func (*PermissionError) Unwrap

func (e *PermissionError) Unwrap() error

type PreconditionError

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

PreconditionError indicates a 412: preconditions not met (e.g. job not cancelable in current state).

func (*PreconditionError) Error

func (e *PreconditionError) Error() string

func (*PreconditionError) ErrorCode

func (e *PreconditionError) ErrorCode() string

func (*PreconditionError) Errors

func (e *PreconditionError) Errors() []FieldViolation

func (*PreconditionError) HTTPStatus

func (e *PreconditionError) HTTPStatus() int

func (*PreconditionError) RequestID

func (e *PreconditionError) RequestID() string

func (*PreconditionError) Type

func (e *PreconditionError) Type() string

func (*PreconditionError) Unwrap

func (e *PreconditionError) Unwrap() error

type Preset

type Preset = v1.Preset

type PresetCreateParams

type PresetCreateParams = v1.CreatePresetRequest

type PresetListParams

type PresetListParams = v1.ListPresetsRequest

type PresetUpdateParams

type PresetUpdateParams = v1.UpdatePresetRequest

type PresetVariant

type PresetVariant = v1.PresetVariant

type Presets

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

Presets is the Stripe-style namespace for reusable transcoding presets.

func (*Presets) Archive

func (p *Presets) Archive(ctx context.Context, id string) error

Archive soft-deletes a preset. Existing jobs that reference it continue to run; future job creations are rejected.

func (*Presets) Create

func (p *Presets) Create(ctx context.Context, params *PresetCreateParams) (*Preset, error)

Create defines a new preset.

func (*Presets) Duplicate

func (p *Presets) Duplicate(ctx context.Context, sourceID, slug, name string) (*Preset, error)

Duplicate copies an existing preset under a new slug + name. Both are required.

func (*Presets) Get

func (p *Presets) Get(ctx context.Context, id string) (*Preset, error)

Get fetches a preset by ID (`pst_*`).

func (*Presets) GetBySlug

func (p *Presets) GetBySlug(ctx context.Context, slug string) (*Preset, error)

GetBySlug fetches a preset by human-friendly slug.

func (*Presets) List

func (p *Presets) List(ctx context.Context, params *PresetListParams) *Iter[*Preset]

List returns an iterator over presets in the active app.

func (*Presets) Update

func (p *Presets) Update(ctx context.Context, params *PresetUpdateParams) (*Preset, error)

Update mutates a preset.

type PricingSnapshot

type PricingSnapshot = v1.PricingSnapshot

type ProtoFieldViolation

type ProtoFieldViolation = v1.FieldViolation

type QualityTier

type QualityTier = v1.QualityTier

type RateLimitError

type RateLimitError struct {
	RetryAfter time.Duration
	// contains filtered or unexported fields
}

RateLimitError indicates a 429: quota or rate limit exceeded. RetryAfter reflects the `Retry-After` response header.

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

func (*RateLimitError) ErrorCode

func (e *RateLimitError) ErrorCode() string

func (*RateLimitError) Errors

func (e *RateLimitError) Errors() []FieldViolation

func (*RateLimitError) HTTPStatus

func (e *RateLimitError) HTTPStatus() int

func (*RateLimitError) RequestID

func (e *RateLimitError) RequestID() string

func (*RateLimitError) Type

func (e *RateLimitError) Type() string

func (*RateLimitError) Unwrap

func (e *RateLimitError) Unwrap() error

type Resolution

type Resolution = v1.Resolution

type S3Credentials

type S3Credentials = v1.S3Credentials

type S3OriginConfig

type S3OriginConfig = v1.S3OriginConfig

type SegmentConfig

type SegmentConfig = v1.SegmentConfig

type SlugCheckResult

type SlugCheckResult struct {
	Available bool
	Reason    string
}

SlugCheckResult describes the outcome of a slug availability check.

type Stream

type Stream[T any] struct {
	// contains filtered or unexported fields
}

Stream is the iterator returned by Watch RPCs. It auto-reconnects on transient network failures up to (max retries) times, transparently filters server heartbeats, and surfaces a single typed error via Err().

stream := client.Jobs.Watch(ctx, jobID)
defer stream.Close()
for stream.Next() {
    event := stream.Current()
    // ...
}
if err := stream.Err(); err != nil {
    // ...
}

func (*Stream[T]) Close

func (s *Stream[T]) Close() error

Close cancels the underlying request and releases resources. Safe to call multiple times.

func (*Stream[T]) Current

func (s *Stream[T]) Current() T

Current returns the most recently received event.

func (*Stream[T]) Err

func (s *Stream[T]) Err() error

Err returns the first non-EOF error the stream encountered, or nil.

func (*Stream[T]) Next

func (s *Stream[T]) Next() bool

Next reads the next non-heartbeat event. Returns false when the stream terminates cleanly, or when an unrecoverable error occurs (check Err()).

type StreamingConfig

type StreamingConfig = v1.StreamingConfig

type SubtitleFormat

type SubtitleFormat = v1.SubtitleFormat

type SubtitleOperation

type SubtitleOperation = v1.SubtitleOperation

type SubtitleStreamInfo

type SubtitleStreamInfo = v1.SubtitleStreamInfo

type SubtitleTrack

type SubtitleTrack = v1.SubtitleTrack

type ThumbnailFormat

type ThumbnailFormat = v1.ThumbnailFormat

type ThumbnailMode

type ThumbnailMode = v1.ThumbnailMode

type ThumbnailSpec

type ThumbnailSpec = v1.ThumbnailSpec

type ToneMapping

type ToneMapping = v1.ToneMapping

type UpdateWebhookConfig

type UpdateWebhookConfig = v1.UpdateWebhookConfig

type UploadCompleteParams

type UploadCompleteParams = v1.CompleteUploadRequest

type UploadCreateParams

type UploadCreateParams = v1.CreateUploadRequest

type UploadPart

type UploadPart = v1.UploadPart

type UsageSummary

type UsageSummary = v1.UsageSummary

type User

type User = v1.User

type UserListParams

type UserListParams = v1.ListUsersRequest

type UserOrganization

type UserOrganization = v1.UserOrganization

type UserUpdateMeParams

type UserUpdateMeParams = v1.UpdateMeRequest

type UserWithOrganizations

type UserWithOrganizations = v1.UserWithOrganizations

type Users

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

Users is the Stripe-style namespace for user accounts.

func (*Users) Get

func (u *Users) Get(ctx context.Context, id string) (*User, error)

Get fetches a user by ID (admin-only in most contexts).

func (*Users) GetMe

func (u *Users) GetMe(ctx context.Context) (*UserWithOrganizations, error)

GetMe returns the user identified by the current API key, including the organizations they belong to.

func (*Users) List

func (u *Users) List(ctx context.Context, params *UserListParams) *Iter[*User]

List returns an iterator over users (admin-only in most contexts).

func (*Users) UpdateMe

func (u *Users) UpdateMe(ctx context.Context, params *UserUpdateMeParams) (*User, error)

UpdateMe mutates the current user's profile.

type VP9Options

type VP9Options = v1.VP9Options

type ValidationResult

type ValidationResult = v1.ValidationResult

type VariantPricingSnapshot

type VariantPricingSnapshot = v1.VariantPricingSnapshot

type Video

type Video = v1.Video

type VideoCodec

type VideoCodec = v1.VideoCodec

type VideoListParams

type VideoListParams = v1.ListVideosRequest

type VideoRendition

type VideoRendition = v1.VideoRendition

type VideoSettings

type VideoSettings = v1.VideoSettings

type VideoStatus

type VideoStatus = v1.VideoStatus

type VideoStreamInfo

type VideoStreamInfo = v1.VideoStreamInfo

type VideoUpdateParams

type VideoUpdateParams = v1.UpdateVideoRequest

type VideoVariant

type VideoVariant = v1.VideoVariant

type VideoVisibility

type VideoVisibility = v1.VideoVisibility

type Videos

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

Videos is the Stripe-style namespace for hosted videos and uploads. Reach it via client.Videos.

func (*Videos) AbortMultipartUpload

func (v *Videos) AbortMultipartUpload(ctx context.Context, params *MultipartAbortParams) error

AbortMultipartUpload cancels an in-flight multipart upload and frees server-side state.

func (*Videos) CompleteMultipartUpload

func (v *Videos) CompleteMultipartUpload(ctx context.Context, params *MultipartCompleteParams) (*Video, error)

CompleteMultipartUpload finalises a multipart upload. Pass the etags returned by S3 / GCS for each part.

func (*Videos) CompleteUpload

func (v *Videos) CompleteUpload(ctx context.Context, params *UploadCompleteParams) (*Video, error)

CompleteUpload finalises a single-part upload. The video transitions to `processing` and a transcoding job is created automatically.

func (*Videos) CreateMultipartUpload

func (v *Videos) CreateMultipartUpload(ctx context.Context, params *MultipartCreateParams) (*v1.CreateMultipartUploadResponse, error)

CreateMultipartUpload begins a multipart upload session.

func (*Videos) CreateUpload

func (v *Videos) CreateUpload(ctx context.Context, params *UploadCreateParams) (*v1.CreateUploadResponse, error)

CreateUpload returns a presigned URL for uploading a single-part file. For files >100 MB, prefer CreateMultipartUpload instead.

func (*Videos) Delete

func (v *Videos) Delete(ctx context.Context, id string) error

Delete removes a video and its renditions. Storage cleanup is async.

func (*Videos) Get

func (v *Videos) Get(ctx context.Context, id string) (*Video, error)

Get fetches a video by ID.

func (*Videos) GetUploadPartURLs

func (v *Videos) GetUploadPartURLs(ctx context.Context, params *MultipartPartURLsParams) (*v1.GetUploadPartUrlsResponse, error)

GetUploadPartURLs requests presigned URLs for the given part numbers.

func (*Videos) GetUsage

func (v *Videos) GetUsage(ctx context.Context, billingMonth string) (*UsageSummary, error)

GetUsage returns the usage summary for a billing month.

func (*Videos) List

func (v *Videos) List(ctx context.Context, params *VideoListParams) *Iter[*Video]

List returns an iterator over videos. The Video service uses page-token pagination (PageSize / PageToken) rather than the cursor model.

func (*Videos) Update

func (v *Videos) Update(ctx context.Context, params *VideoUpdateParams) (*Video, error)

Update mutates a video's metadata (title, description, tags, …).

func (*Videos) Watch

func (v *Videos) Watch(ctx context.Context, id string) *Stream[*WatchVideoResponse]

Watch streams video lifecycle events until the video is ready or fails.

type WatchEventType

type WatchEventType = v1.WatchEventType

type WatchJobResponse

type WatchJobResponse = v1.WatchJobResponse

type WatchVideoResponse

type WatchVideoResponse = v1.WatchVideoResponse

type WebhookConfig

type WebhookConfig = v1.WebhookConfig

Directories

Path Synopsis
internal
codec
Package codec provides the Transcodely JSON wire codec.
Package codec provides the Transcodely JSON wire codec.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL