Versions in this module Expand all Collapse all v0 v0.3.1 Nov 5, 2026 v0.3.0 Nov 3, 2026 Changes in this version + const APIKeyEnv + const BaseURLEnv + const DefaultBaseURL + const DirectUploadMaxBytes + const Version + var ErrAPI = errors.New("pixlub: API error") + var ErrAuthentication = fmt.Errorf("%w: authentication failed", ErrAPI) + var ErrConfiguration = errors.New("pixlub: configuration error") + var ErrConnection = errors.New("pixlub: connection error") + var ErrFileTooLarge = errors.New("pixlub: file too large") + var ErrInsufficientCredits = fmt.Errorf("%w: insufficient credits", ErrAPI) + var ErrInvalidInput = errors.New("pixlub: invalid input") + var ErrInvalidRequest = fmt.Errorf("%w: invalid request", ErrAPI) + var ErrJobTimeout = fmt.Errorf("%w: the job did not finish in time", ErrTimeout) + var ErrNoData = errors.New("pixlub: the run produced no data output") + var ErrNotFound = fmt.Errorf("%w: not found", ErrAPI) + var ErrPermissionDenied = fmt.Errorf("%w: permission denied", ErrAPI) + var ErrRateLimited = fmt.Errorf("%w: rate limited", ErrAPI) + var ErrServer = fmt.Errorf("%w: server error", ErrAPI) + var ErrTimeout = fmt.Errorf("%w: timeout", ErrConnection) + var ErrUnexpectedResponse = errors.New("pixlub: unexpected response") + var ErrUnknownTool = fmt.Errorf("%w: unknown tool", ErrInvalidInput) + type APIError struct + Code string + Details any + HTTPStatus int + JobID string + Limit *int64 + MaxBytes *int64 + MaxPixels *int64 + Message string + RequiredCredits *int64 + ResetAt time.Time + RetryAfter time.Duration + func (e *APIError) Error() string + func (e *APIError) Is(target error) bool + func (e *APIError) Unwrap() error + type Client struct + Tools *Tools + func NewClient(opts ...Option) (*Client, error) + func (c Client) GoString() string + func (c Client) String() string + type ConnectionError struct + Message string + RequestSent bool + func (e *ConnectionError) Error() string + func (e *ConnectionError) Unwrap() error + type ListOptions struct + ExecutableOnly bool + type Option func(*settings) + func WithAPIKey(key string) Option + func WithBaseURL(baseURL string) Option + func WithHTTPClient(client *http.Client) Option + func WithJobTimeout(timeout time.Duration) Option + func WithMaxInputBytes(n int64) Option + func WithMaxRetries(n int) Option + func WithTimeout(timeout time.Duration) Option + type Output struct + Bytes int64 + Content []byte + ContentType string + Key string + Name string + URL string + func (o *Output) Extension() string + func (o *Output) Save(path string, overwrite bool) error + type Result struct + Cost *int64 + CreditsBalance *int64 + ExpiresAt time.Time + ID string + JobID string + Message string + Module string + Outputs []Output + func (r *Result) Data(v any) error + func (r *Result) Extension() string + func (r *Result) File() *Output + func (r *Result) Image() []byte + func (r *Result) Output(keyOrName string) *Output + func (r *Result) Save(path string, overwrite bool) error + type RunRequest struct + Image Source + InputLists map[string][]Source + Inputs map[string]Source + Params map[string]any + type Source struct + func FromBytes(name string, data []byte) Source + func FromPath(path string) Source + func FromReader(name string, reader io.Reader) Source + func FromReaderSize(name string, reader io.Reader, size int64) Source + func FromURL(rawURL string) Source + type Tool struct + Category string + Description string + Executable bool + Handler string + ID string + Inputs []ToolInput + Name string + Outputs []ToolOutput + type ToolInput struct + Accept []string + Description string + ID string + Label string + MaxFiles int + Multiple bool + PerFile bool + Required bool + Type string + type ToolOutput struct + ContentTypes []string + Description string + Key string + Kind string + Label string + Multiple bool + type Tools struct + func (t *Tools) List(ctx context.Context, opts ListOptions) ([]Tool, error) + func (t *Tools) Retrieve(ctx context.Context, id string) (*Tool, error) + func (t *Tools) Run(ctx context.Context, id string, req RunRequest) (*Result, error) + func (t *Tools) Schema(ctx context.Context, id string) (map[string]any, error)