Documentation
¶
Index ¶
- Constants
- type AllEvents
- type ImageVariant
- type JSONObject
- type MarshalJSON
- type MediaBase
- type MediaProvider
- type MediaType
- type PixAIClient
- func (p *PixAIClient) CancelGenerationTask(ctx context.Context, id string) (*TaskBase, error)
- func (p *PixAIClient) Close()
- func (p *PixAIClient) CreateGenerationTask(ctx context.Context, parameters JSONObject) (*TaskBase, error)
- func (p *PixAIClient) Do(req *http.Request) (*http.Response, error)
- func (p *PixAIClient) DownloadMedia(ctx context.Context, media *MediaBase) (file []byte, mimeType string, err error)
- func (p *PixAIClient) GenerateImage(ctx context.Context, parameters JSONObject, onUpdate func(*TaskBase)) (*TaskBase, error)
- func (p *PixAIClient) GetMediaById(ctx context.Context, id string) (*MediaBase, error)
- func (p *PixAIClient) GetMediaFromTask(ctx context.Context, task *TaskBase) ([]*MediaBase, error)
- func (p *PixAIClient) GetPublicUrl(media *MediaBase) string
- func (p *PixAIClient) GetTaskById(ctx context.Context, id string) (*TaskBase, error)
- func (p *PixAIClient) Init() *PixAIClient
- func (p *PixAIClient) ParseWebhookPayload(data []byte) (*WebhookEvent, error)
- func (p *PixAIClient) PersonalEvents() (*eventSource, error)
- func (p *PixAIClient) SetApiBaseUrl(apiBaseUrl string) *PixAIClient
- func (p *PixAIClient) SetApiKey(apiKey string) *PixAIClient
- func (p *PixAIClient) SetMarshalJSON(marshal MarshalJSON) *PixAIClient
- func (p *PixAIClient) SetUnmarshalJSON(unmarshal UnmarshalJSON) *PixAIClient
- func (p *PixAIClient) SetWebSocketBaseUrl(websocketBaseUrl string) *PixAIClient
- func (p *PixAIClient) UploadMediaFile(ctx context.Context, file io.Reader, mimeType string) (*MediaBase, error)
- func (p *PixAIClient) UploadMediaUrl(ctx context.Context, url string) (*MediaBase, error)
- type TaskBase
- type TaskStatus
- type UnmarshalJSON
- type UploadMediaInput
- type UploadMediaResult
- type WebhookEvent
- type WebhookEventType
Constants ¶
View Source
const ( ApiBaseUrl = "https://api.pixai.art" WebsocketBaseUrl = "wss://gw.pixai.art" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImageVariant ¶ added in v0.3.0
type ImageVariant string
const (
ImageVariant_Public ImageVariant = "PUBLIC"
)
type JSONObject ¶
func (*JSONObject) GetArray ¶ added in v0.3.0
func (o *JSONObject) GetArray(key string) []any
func (*JSONObject) GetGraphQLType ¶
func (o *JSONObject) GetGraphQLType() string
func (*JSONObject) GetObject ¶ added in v0.3.0
func (o *JSONObject) GetObject(key string) JSONObject
func (*JSONObject) GetString ¶ added in v0.3.0
func (o *JSONObject) GetString(key string) string
type MarshalJSON ¶
type MediaProvider ¶ added in v0.2.0
type MediaProvider string
const (
MediaProvider_S3 MediaProvider = "S3"
)
type MediaType ¶ added in v0.2.0
type MediaType string
const (
MediaType_Image MediaType = "IMAGE"
)
type PixAIClient ¶
type PixAIClient struct {
// contains filtered or unexported fields
}
func NewPixAIClient ¶
func NewPixAIClient() *PixAIClient
func (*PixAIClient) CancelGenerationTask ¶
func (*PixAIClient) Close ¶
func (p *PixAIClient) Close()
func (*PixAIClient) CreateGenerationTask ¶
func (p *PixAIClient) CreateGenerationTask(ctx context.Context, parameters JSONObject) (*TaskBase, error)
func (*PixAIClient) DownloadMedia ¶ added in v0.3.0
func (*PixAIClient) GenerateImage ¶
func (p *PixAIClient) GenerateImage(ctx context.Context, parameters JSONObject, onUpdate func(*TaskBase)) (*TaskBase, error)
func (*PixAIClient) GetMediaById ¶ added in v0.2.0
func (*PixAIClient) GetMediaFromTask ¶ added in v0.3.0
func (*PixAIClient) GetPublicUrl ¶ added in v0.3.0
func (p *PixAIClient) GetPublicUrl(media *MediaBase) string
func (*PixAIClient) GetTaskById ¶
func (*PixAIClient) Init ¶
func (p *PixAIClient) Init() *PixAIClient
func (*PixAIClient) ParseWebhookPayload ¶
func (p *PixAIClient) ParseWebhookPayload(data []byte) (*WebhookEvent, error)
func (*PixAIClient) PersonalEvents ¶
func (p *PixAIClient) PersonalEvents() (*eventSource, error)
func (*PixAIClient) SetApiBaseUrl ¶
func (p *PixAIClient) SetApiBaseUrl(apiBaseUrl string) *PixAIClient
func (*PixAIClient) SetApiKey ¶
func (p *PixAIClient) SetApiKey(apiKey string) *PixAIClient
func (*PixAIClient) SetMarshalJSON ¶
func (p *PixAIClient) SetMarshalJSON(marshal MarshalJSON) *PixAIClient
func (*PixAIClient) SetUnmarshalJSON ¶
func (p *PixAIClient) SetUnmarshalJSON(unmarshal UnmarshalJSON) *PixAIClient
func (*PixAIClient) SetWebSocketBaseUrl ¶
func (p *PixAIClient) SetWebSocketBaseUrl(websocketBaseUrl string) *PixAIClient
func (*PixAIClient) UploadMediaFile ¶ added in v0.2.0
func (*PixAIClient) UploadMediaUrl ¶ added in v0.2.0
type TaskBase ¶
type TaskBase struct { Id string `json:"id"` UserId string `json:"userId"` Parameters map[string]any `json:"parameters" scalar:"true"` Outputs map[string]any `json:"outputs" scalar:"true"` Status *string `json:"status"` StartedAt *time.Time `json:"startedAt"` EndAt *time.Time `json:"endAt"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Media *MediaBase `json:"media"` }
type TaskStatus ¶
type TaskStatus string
const ( TaskStatus_Waiting TaskStatus = "waiting" TaskStatus_Running TaskStatus = "running" TaskStatus_Completed TaskStatus = "completed" TaskStatus_Failed TaskStatus = "failed" TaskStatus_Cancelled TaskStatus = "cancelled" )
type UnmarshalJSON ¶
type UploadMediaInput ¶ added in v0.2.0
type UploadMediaInput struct { Type MediaType `json:"type"` Provider MediaProvider `json:"provider"` ExternalId *string `json:"externalId,omitempty"` ImageType *string `json:"imageType,omitempty"` }
type UploadMediaResult ¶ added in v0.2.0
type WebhookEvent ¶
type WebhookEventType ¶
type WebhookEventType string
const ( WebhookEventType_TaskUpdated WebhookEventType = "task_updated" WebhookEventType_TaskRunning WebhookEventType = "task_running" WebhookEventType_TaskCanceled WebhookEventType = "task_canceled" WebhookEventType_TaskCompleted WebhookEventType = "task_completed" WebhookEventType_TaskFailed WebhookEventType = "task_failed" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.