Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type Error
- type HealthCheckResponse
- type HealthCheckResponseStatus
- type HealthService
- type LipsyncGenerate
- type LipsyncGenerateParams
- type LipsyncGenerateParamsInput
- type LipsyncGenerateStatus
- type LipsyncGenerateWithMediaParams
- type LipsyncRequest
- type LipsyncRequestListParams
- type LipsyncRequestListResponse
- type LipsyncRequestListResponsePagination
- type LipsyncRequestService
- type LipsyncService
- type UserGetCurrentResponse
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (CHAMELAION_API_KEY, CHAMELAION_BEARER_TOKEN, CHAMELAION_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type Client ¶
type Client struct {
// Service health endpoint.
Health HealthService
// Endpoints for API token identity.
Users UserService
// Endpoints for creating and retrieving lip sync requests.
Lipsync LipsyncService
// contains filtered or unexported fields
}
Client creates a struct with services and top level methods that help with interacting with the chamelaion API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (CHAMELAION_API_KEY, CHAMELAION_BEARER_TOKEN, CHAMELAION_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type HealthCheckResponse ¶ added in v0.2.0
type HealthCheckResponse struct {
// Any of "ok".
Status HealthCheckResponseStatus `json:"status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (HealthCheckResponse) RawJSON ¶ added in v0.2.0
func (r HealthCheckResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*HealthCheckResponse) UnmarshalJSON ¶ added in v0.2.0
func (r *HealthCheckResponse) UnmarshalJSON(data []byte) error
type HealthCheckResponseStatus ¶ added in v0.2.0
type HealthCheckResponseStatus string
const (
HealthCheckResponseStatusOk HealthCheckResponseStatus = "ok"
)
type HealthService ¶
type HealthService struct {
// contains filtered or unexported fields
}
Service health endpoint.
HealthService contains methods and other services that help with interacting with the chamelaion API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewHealthService method instead.
func NewHealthService ¶
func NewHealthService(opts ...option.RequestOption) (r HealthService)
NewHealthService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*HealthService) Check ¶
func (r *HealthService) Check(ctx context.Context, opts ...option.RequestOption) (res *HealthCheckResponse, err error)
Returns HTTP 200 when the service is running. No authentication required.
type LipsyncGenerate ¶
type LipsyncGenerate struct {
// Identifier of the created lip sync request.
RequestID string `json:"request_id" api:"required" format:"uuid"`
// Current state of the newly created request.
//
// Any of "success".
Status LipsyncGenerateStatus `json:"status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
RequestID respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (LipsyncGenerate) RawJSON ¶
func (r LipsyncGenerate) RawJSON() string
Returns the unmodified JSON received from the API
func (*LipsyncGenerate) UnmarshalJSON ¶
func (r *LipsyncGenerate) UnmarshalJSON(data []byte) error
type LipsyncGenerateParams ¶
type LipsyncGenerateParams struct {
// Exactly one video input and one audio input (order does not matter).
Inputs []LipsyncGenerateParamsInput `json:"inputs,omitzero" api:"required"`
// Disable active speaker detection and use max-face lipsync preprocessing.
DisableActiveSpeakerDetection param.Opt[bool] `json:"disable_active_speaker_detection,omitzero"`
// Optional client-provided identifier for later retrieval.
ReferenceID param.Opt[string] `json:"reference_id,omitzero"`
// contains filtered or unexported fields
}
func (LipsyncGenerateParams) MarshalJSON ¶
func (r LipsyncGenerateParams) MarshalJSON() (data []byte, err error)
func (*LipsyncGenerateParams) UnmarshalJSON ¶
func (r *LipsyncGenerateParams) UnmarshalJSON(data []byte) error
type LipsyncGenerateParamsInput ¶
type LipsyncGenerateParamsInput struct {
// Type of input media.
//
// Any of "video", "audio".
Type string `json:"type,omitzero" api:"required"`
// URL of the media resource.
URL string `json:"url" api:"required" format:"uri"`
// contains filtered or unexported fields
}
The properties Type, URL are required.
func (LipsyncGenerateParamsInput) MarshalJSON ¶
func (r LipsyncGenerateParamsInput) MarshalJSON() (data []byte, err error)
func (*LipsyncGenerateParamsInput) UnmarshalJSON ¶
func (r *LipsyncGenerateParamsInput) UnmarshalJSON(data []byte) error
type LipsyncGenerateStatus ¶ added in v0.1.0
type LipsyncGenerateStatus string
Current state of the newly created request.
const (
LipsyncGenerateStatusSuccess LipsyncGenerateStatus = "success"
)
type LipsyncGenerateWithMediaParams ¶
type LipsyncGenerateWithMediaParams struct {
// Target audio file.
Audio io.Reader `json:"audio,omitzero" api:"required" format:"binary"`
// Source video file.
Video io.Reader `json:"video,omitzero" api:"required" format:"binary"`
// Disable active speaker detection and use max-face lipsync preprocessing.
DisableActiveSpeakerDetection param.Opt[bool] `json:"disable_active_speaker_detection,omitzero"`
// Optional client-provided identifier for later retrieval.
ReferenceID param.Opt[string] `json:"reference_id,omitzero"`
// contains filtered or unexported fields
}
func (LipsyncGenerateWithMediaParams) MarshalMultipart ¶
func (r LipsyncGenerateWithMediaParams) MarshalMultipart() (data []byte, contentType string, err error)
type LipsyncRequest ¶
type LipsyncRequest struct {
// Lip sync request ID.
ID string `json:"id" api:"required" format:"uuid"`
// Request creation time in UTC.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Current request status.
Status string `json:"status" api:"required"`
// Failure message when status is `failed`.
ErrorMessage string `json:"error_message"`
// Request processing completion time in UTC.
FinishedAt time.Time `json:"finished_at" format:"date-time"`
// URL to the generated output media, when available.
OutputURL string `json:"output_url" format:"uri"`
// Client-provided identifier for this request.
ReferenceID string `json:"reference_id"`
// Request processing start time in UTC.
StartedAt time.Time `json:"started_at" format:"date-time"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Status respjson.Field
ErrorMessage respjson.Field
FinishedAt respjson.Field
OutputURL respjson.Field
ReferenceID respjson.Field
StartedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (LipsyncRequest) RawJSON ¶
func (r LipsyncRequest) RawJSON() string
Returns the unmodified JSON received from the API
func (*LipsyncRequest) UnmarshalJSON ¶
func (r *LipsyncRequest) UnmarshalJSON(data []byte) error
type LipsyncRequestListParams ¶
type LipsyncRequestListParams struct {
// Maximum number of items to return.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Number of items to skip before returning results.
Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
// Filter requests by exact `reference_id`.
ReferenceID param.Opt[string] `query:"reference_id,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (LipsyncRequestListParams) URLQuery ¶
func (r LipsyncRequestListParams) URLQuery() (v url.Values, err error)
URLQuery serializes LipsyncRequestListParams's query parameters as `url.Values`.
type LipsyncRequestListResponse ¶
type LipsyncRequestListResponse struct {
Data []LipsyncRequest `json:"data" api:"required"`
Pagination LipsyncRequestListResponsePagination `json:"pagination" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Pagination respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (LipsyncRequestListResponse) RawJSON ¶
func (r LipsyncRequestListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*LipsyncRequestListResponse) UnmarshalJSON ¶
func (r *LipsyncRequestListResponse) UnmarshalJSON(data []byte) error
type LipsyncRequestListResponsePagination ¶
type LipsyncRequestListResponsePagination struct {
// Applied page size.
Limit int64 `json:"limit" api:"required"`
// Applied result offset.
Offset int64 `json:"offset" api:"required"`
// Total number of matching records.
Total int64 `json:"total" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Limit respjson.Field
Offset respjson.Field
Total respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (LipsyncRequestListResponsePagination) RawJSON ¶
func (r LipsyncRequestListResponsePagination) RawJSON() string
Returns the unmodified JSON received from the API
func (*LipsyncRequestListResponsePagination) UnmarshalJSON ¶
func (r *LipsyncRequestListResponsePagination) UnmarshalJSON(data []byte) error
type LipsyncRequestService ¶
type LipsyncRequestService struct {
// contains filtered or unexported fields
}
Endpoints for creating and retrieving lip sync requests.
LipsyncRequestService contains methods and other services that help with interacting with the chamelaion API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLipsyncRequestService method instead.
func NewLipsyncRequestService ¶
func NewLipsyncRequestService(opts ...option.RequestOption) (r LipsyncRequestService)
NewLipsyncRequestService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*LipsyncRequestService) Get ¶
func (r *LipsyncRequestService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *LipsyncRequest, err error)
Returns a single lip sync request by request UUID or `reference_id`.
func (*LipsyncRequestService) List ¶
func (r *LipsyncRequestService) List(ctx context.Context, query LipsyncRequestListParams, opts ...option.RequestOption) (res *LipsyncRequestListResponse, err error)
Returns a paginated list of lip sync requests for the authenticated account.
type LipsyncService ¶
type LipsyncService struct {
// Endpoints for creating and retrieving lip sync requests.
Requests LipsyncRequestService
// contains filtered or unexported fields
}
Endpoints for creating and retrieving lip sync requests.
LipsyncService contains methods and other services that help with interacting with the chamelaion API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLipsyncService method instead.
func NewLipsyncService ¶
func NewLipsyncService(opts ...option.RequestOption) (r LipsyncService)
NewLipsyncService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*LipsyncService) Generate ¶
func (r *LipsyncService) Generate(ctx context.Context, body LipsyncGenerateParams, opts ...option.RequestOption) (res *LipsyncGenerate, err error)
Starts a lip sync job from exactly one remote video URL and one remote audio URL. The response includes a request identifier to poll later.
func (*LipsyncService) GenerateWithMedia ¶
func (r *LipsyncService) GenerateWithMedia(ctx context.Context, body LipsyncGenerateWithMediaParams, opts ...option.RequestOption) (res *LipsyncGenerate, err error)
Starts a lip sync job by uploading one video file and one audio file as multipart form-data.
type UserGetCurrentResponse ¶
type UserGetCurrentResponse struct {
// Display name of the API token.
Name string `json:"name" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (UserGetCurrentResponse) RawJSON ¶
func (r UserGetCurrentResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*UserGetCurrentResponse) UnmarshalJSON ¶
func (r *UserGetCurrentResponse) UnmarshalJSON(data []byte) error
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
Endpoints for API token identity.
UserService contains methods and other services that help with interacting with the chamelaion API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewUserService method instead.
func NewUserService ¶
func NewUserService(opts ...option.RequestOption) (r UserService)
NewUserService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*UserService) GetCurrent ¶
func (r *UserService) GetCurrent(ctx context.Context, opts ...option.RequestOption) (res *UserGetCurrentResponse, err error)
Returns the identity associated with the authenticated API token.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|
|
shared
|
|