Documentation
¶
Index ¶
- Variables
- func Bool(b bool) *bool
- func Byte(b byte) *byte
- func Bytes(b []byte) *[]byte
- func Complex64(c complex64) *complex64
- func Complex128(c complex128) *complex128
- func Float32(f float32) *float32
- func Float64(f float64) *float64
- func Int(i int) *int
- func Int8(i int8) *int8
- func Int16(i int16) *int16
- func Int32(i int32) *int32
- func Int64(i int64) *int64
- func MustParseDate(date string) time.Time
- func MustParseDateTime(datetime string) time.Time
- func Null[T any]() *param.Nullable[T]
- func Nullable[T any](v T) *param.Nullable[T]
- func Ptr[T any](v T) *T
- func Rune(r rune) *rune
- func String(s string) *string
- func Time(t time.Time) *time.Time
- func UUID(u uuid.UUID) *uuid.UUID
- func Uint(u uint) *uint
- func Uint8(u uint8) *uint8
- func Uint16(u uint16) *uint16
- func Uint32(u uint32) *uint32
- func Uint64(u uint64) *uint64
- func Uintptr(u uintptr) *uintptr
- type ApiError
- type ApiErrorMetadata
- type ApiResponse
- type ApiResponseMetadata
- type BadRequestError
- type Config
- type ConflictError
- type FileParam
- type FileParamOption
- type ForbiddenError
- type NotFoundError
- type RequestOption
- type RetryConfig
- type TooEarlyError
- type UnauthorizedError
- type UnprocessableEntityError
Constants ¶
This section is empty.
Variables ¶
var Environments = struct { Production string ProductionUs string ProductionEu string ProductionIndia string ProductionSingapore string }{ Production: "https://api.elevenlabs.io", ProductionUs: "https://api.us.elevenlabs.io", ProductionEu: "https://api.eu.residency.elevenlabs.io", ProductionIndia: "https://api.in.residency.elevenlabs.io", ProductionSingapore: "https://api.sg.residency.elevenlabs.io", }
Environments defines all of the API environments. These values can be used with the WithBaseURL RequestOption to override the client's default environment, if any.
var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{ 400: func(apiError *core.APIError) error { return &BadRequestError{ APIError: apiError, } }, 401: func(apiError *core.APIError) error { return &UnauthorizedError{ APIError: apiError, } }, 403: func(apiError *core.APIError) error { return &ForbiddenError{ APIError: apiError, } }, 404: func(apiError *core.APIError) error { return &NotFoundError{ APIError: apiError, } }, 409: func(apiError *core.APIError) error { return &ConflictError{ APIError: apiError, } }, 422: func(apiError *core.APIError) error { return &UnprocessableEntityError{ APIError: apiError, } }, 425: func(apiError *core.APIError) error { return &TooEarlyError{ APIError: apiError, } }, }
var NewConfig = apiconfig.NewConfig
NewConfig creates a Config with spec-derived defaults.
var NewRetryConfig = apiconfig.NewRetryConfig
NewRetryConfig returns a RetryConfig initialized with spec-derived defaults.
var WithBaseURL = apiconfig.WithBaseURL
WithBaseURL returns a RequestOption that overrides BaseURL for a single request.
var WithRetryConfig = apiconfig.WithRetryConfig
WithRetryConfig returns a RequestOption that overrides the RetryConfig for a single request.
var WithTimeout = apiconfig.WithTimeout
WithTimeout returns a RequestOption that overrides Timeout for a single request.
Functions ¶
func Complex128 ¶
func Complex128(c complex128) *complex128
Complex128 returns a pointer to the given complex128 value.
func MustParseDate ¶
MustParseDate attempts to parse the given string as a date time.Time, and panics upon failure.
func MustParseDateTime ¶
MustParseDateTime attempts to parse the given string as a datetime time.Time, and panics upon failure.
func Null ¶
Null returns a *param.Nullable[T] with IsNull set to true, signalling an explicit JSON null.
func Nullable ¶
Nullable returns a *param.Nullable[T] set to v — use for nullable fields with a value.
Types ¶
type ApiError ¶
type ApiError[T any] struct { Err error Data *T Body []byte Raw *http.Response Metadata ApiErrorMetadata }
ApiError wraps API errors with detailed metadata including status code, headers, and raw response. It implements the error interface and provides structured access to error information.
func NewApiError ¶
func NewApiError[T any](transportError *httptransport.ErrorResponse[T]) *ApiError[T]
NewApiError creates a new ApiError from an internal transport error. It extracts error details, body, status code, and headers into a user-facing error structure.
func (*ApiError[T]) Error ¶
Error implements the error interface, returning the error message string.
func (*ApiError[T]) GetBody ¶
GetBody returns the raw response body bytes from the error response. Returns nil if no response body was received.
type ApiErrorMetadata ¶
ApiErrorMetadata contains HTTP metadata associated with an error response.
type ApiResponse ¶
type ApiResponse[T any] struct { Data T Raw *http.Response Metadata ApiResponseMetadata }
ApiResponse is the user-facing wrapper for API responses. It contains the deserialized data, raw HTTP response, and metadata like headers and status code.
func NewApiResponse ¶
func NewApiResponse[T any](resp *httptransport.Response[T]) *ApiResponse[T]
NewApiResponse creates a new response wrapper from an internal transport response. Extracts data and metadata into a user-facing structure.
func (*ApiResponse[T]) GetData ¶
func (r *ApiResponse[T]) GetData() T
GetData returns the deserialized response data.
func (ApiResponse[T]) String ¶
func (r ApiResponse[T]) String() string
String returns a JSON representation of the response for debugging. Returns an error message if JSON marshaling fails.
type ApiResponseMetadata ¶
ApiResponseMetadata contains HTTP metadata from the API response. Includes status code and headers for inspection and debugging.
type BadRequestError ¶
Invalid request
func (*BadRequestError) GetBody ¶
func (b *BadRequestError) GetBody() any
func (*BadRequestError) MarshalJSON ¶
func (b *BadRequestError) MarshalJSON() ([]byte, error)
func (*BadRequestError) UnmarshalJSON ¶
func (b *BadRequestError) UnmarshalJSON(data []byte) error
func (*BadRequestError) Unwrap ¶
func (b *BadRequestError) Unwrap() error
type ConflictError ¶
A generation for this preview is already in progress. Retry the request.
func (*ConflictError) GetBody ¶
func (c *ConflictError) GetBody() any
func (*ConflictError) MarshalJSON ¶
func (c *ConflictError) MarshalJSON() ([]byte, error)
func (*ConflictError) UnmarshalJSON ¶
func (c *ConflictError) UnmarshalJSON(data []byte) error
func (*ConflictError) Unwrap ¶
func (c *ConflictError) Unwrap() error
type FileParam ¶
FileParam is a file type suitable for multipart/form-data uploads.
func NewFileParam ¶
func NewFileParam( reader io.Reader, filename string, contentType string, opts ...FileParamOption, ) *FileParam
NewFileParam returns a *FileParam type suitable for multipart/form-data uploads. All file upload endpoints accept a simple io.Reader, which is usually created by opening a file via os.Open.
However, some endpoints require additional metadata about the file such as a specific Content-Type or custom filename. FileParam makes it easier to create the correct type signature for these endpoints.
func (*FileParam) ContentType ¶
type FileParamOption ¶
type FileParamOption interface {
// contains filtered or unexported methods
}
FileParamOption adapts the behavior of the FileParam. No options are implemented yet, but this interface allows for future extensibility.
type ForbiddenError ¶
Permission denied
func (*ForbiddenError) GetBody ¶
func (f *ForbiddenError) GetBody() any
func (*ForbiddenError) MarshalJSON ¶
func (f *ForbiddenError) MarshalJSON() ([]byte, error)
func (*ForbiddenError) UnmarshalJSON ¶
func (f *ForbiddenError) UnmarshalJSON(data []byte) error
func (*ForbiddenError) Unwrap ¶
func (f *ForbiddenError) Unwrap() error
type NotFoundError ¶
Dubbing not found
func (*NotFoundError) GetBody ¶
func (n *NotFoundError) GetBody() any
func (*NotFoundError) MarshalJSON ¶
func (n *NotFoundError) MarshalJSON() ([]byte, error)
func (*NotFoundError) UnmarshalJSON ¶
func (n *NotFoundError) UnmarshalJSON(data []byte) error
func (*NotFoundError) Unwrap ¶
func (n *NotFoundError) Unwrap() error
type RequestOption ¶
type RequestOption = apiconfig.RequestOption
RequestOption is a function that configures a single request.
type RetryConfig ¶
type RetryConfig = apiconfig.RetryConfig
RetryConfig holds all runtime-configurable retry parameters.
type TooEarlyError ¶
Dubbing not ready
func (*TooEarlyError) GetBody ¶
func (t *TooEarlyError) GetBody() any
func (*TooEarlyError) MarshalJSON ¶
func (t *TooEarlyError) MarshalJSON() ([]byte, error)
func (*TooEarlyError) UnmarshalJSON ¶
func (t *TooEarlyError) UnmarshalJSON(data []byte) error
func (*TooEarlyError) Unwrap ¶
func (t *TooEarlyError) Unwrap() error
type UnauthorizedError ¶
type UnauthorizedError struct {
}
Authentication required
func (*UnauthorizedError) GetBody ¶
func (u *UnauthorizedError) GetBody() any
func (*UnauthorizedError) MarshalJSON ¶
func (u *UnauthorizedError) MarshalJSON() ([]byte, error)
func (*UnauthorizedError) UnmarshalJSON ¶
func (u *UnauthorizedError) UnmarshalJSON(data []byte) error
func (*UnauthorizedError) Unwrap ¶
func (u *UnauthorizedError) Unwrap() error
type UnprocessableEntityError ¶
type UnprocessableEntityError struct {
*core.APIError
Body *types.HttpValidationError
}
Validation Error
func (*UnprocessableEntityError) GetBody ¶
func (u *UnprocessableEntityError) GetBody() *types.HttpValidationError
func (*UnprocessableEntityError) MarshalJSON ¶
func (u *UnprocessableEntityError) MarshalJSON() ([]byte, error)
func (*UnprocessableEntityError) UnmarshalJSON ¶
func (u *UnprocessableEntityError) UnmarshalJSON(data []byte) error
func (*UnprocessableEntityError) Unwrap ¶
func (u *UnprocessableEntityError) Unwrap() error