Documentation ¶
Index ¶
- Constants
- Variables
- func WithHTTPClient(httpClient *http.Client) option
- func WithUserAgent(userAgent string) option
- type Client
- type Error
- type GenerateRequest
- type GenerateRequestPrompt
- type Generation
- type GenerationData
- type Generations
- type HTTPClient
- func (c *HTTPClient) Download(ctx context.Context, generationID string) (io.ReadCloser, error)
- func (c *HTTPClient) Generate(ctx context.Context, caption string) (*Task, error)
- func (c *HTTPClient) GetTask(ctx context.Context, taskID string) (*Task, error)
- func (c *HTTPClient) ListTasks(ctx context.Context, req *ListTasksRequest) (*ListTasksResponse, error)
- func (c *HTTPClient) Share(ctx context.Context, generationID string) (string, error)
- type ListTasksRequest
- type ListTasksResponse
- type Prompt
- type Task
Constants ¶
View Source
const ( StatusPending = "pending" StatusRejected = "rejected" StatusSucceeded = "succeeded" TaskTypeText2Im = "text2im" )
Variables ¶
View Source
var Enabled bool
Functions ¶
func WithHTTPClient ¶
func WithUserAgent ¶
func WithUserAgent(userAgent string) option
Types ¶
type Client ¶
type Client interface { Generate(ctx context.Context, prompt string) (*Task, error) ListTasks(ctx context.Context, req *ListTasksRequest) (*ListTasksResponse, error) GetTask(ctx context.Context, taskID string) (*Task, error) Download(ctx context.Context, generationID string) (io.ReadCloser, error) }
type GenerateRequest ¶
type GenerateRequest struct { Prompt GenerateRequestPrompt `json:"prompt"` TaskType string `json:"task_type"` }
type GenerateRequestPrompt ¶
type Generation ¶
type Generation struct {
ImagePath string `json:"image_path"`
}
type GenerationData ¶
type GenerationData struct { Created int64 `json:"created"` Generation Generation `json:"generation"` GenerationType string `json:"generation_type"` ID string `json:"id"` }
type Generations ¶
type Generations struct { Data []GenerationData `json:"data"` Object string `json:"object"` }
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(apiKey string, opts ...option) (*HTTPClient, error)
func (*HTTPClient) Download ¶
func (c *HTTPClient) Download(ctx context.Context, generationID string) (io.ReadCloser, error)
func (*HTTPClient) ListTasks ¶
func (c *HTTPClient) ListTasks(ctx context.Context, req *ListTasksRequest) (*ListTasksResponse, error)
type ListTasksRequest ¶
type ListTasksRequest struct {
Limit int32 `json:"limit"`
}
type ListTasksResponse ¶
Click to show internal directories.
Click to hide internal directories.