{"modulePath":"github.com/mutablelogic/go-pg","version":"v1.1.15","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package httpclient\n\nPackage httpclient provides a typed Go client for consuming the PostgreSQL queue management REST API.\n\nCreate a client with:\n\n\tclient, err := httpclient.New(\"http://localhost:8080/api/v1\")\n\tif err != nil {\n\t   panic(err)\n\t}\n\nThen use the client to query resources:\n\n\tqueues, err := client.ListQueues(ctx)\n\ttasks, err := client.ListTasks(ctx)\n\ttickers, err := client.ListTickers(ctx)\n\nRetain tasks with optional queue filtering:\n\n\t// From specific queue\n\ttask, err := client.RetainTask(ctx, \"worker-1\", \"emails\")\n\n\t// From any queue\n\ttask, err := client.RetainTask(ctx, \"worker-1\")\n\n## Types\n\n```go\ntype Client struct {\n\t*client.Client\n}\n```\n\n```go\nfunc New(url string, opts ...client.ClientOpt) (*Client, error)\n```\nNew creates a new HTTP client for the PostgreSQL queue API.\n\n```go\nfunc (c *Client) CreateQueue(ctx context.Context, queue schema.QueueMeta) (*schema.Queue, error)\n```\n\n```go\nfunc (c *Client) CreateTask(ctx context.Context, queue string, meta schema.TaskMeta) (*schema.Task, error)\n```\nCreateTask creates a new task in a queue (POST /task).\n\n```go\nfunc (c *Client) CreateTicker(ctx context.Context, ticker schema.TickerMeta) (*schema.Ticker, error)\n```\n\n```go\nfunc (c *Client) DeleteQueue(ctx context.Context, name string) (*schema.Queue, error)\n```\n\n```go\nfunc (c *Client) DeleteTicker(ctx context.Context, name string) (*schema.Ticker, error)\n```\n\n```go\nfunc (c *Client) GetQueue(ctx context.Context, name string) (*schema.Queue, error)\n```\n\n```go\nfunc (c *Client) GetTicker(ctx context.Context, name string) (*schema.Ticker, error)\n```\n\n```go\nfunc (c *Client) ListNamespaces(ctx context.Context) (*schema.NamespaceList, error)\n```\n\n```go\nfunc (c *Client) ListQueues(ctx context.Context, opts ...Opt) (*schema.QueueList, error)\n```\n\n```go\nfunc (c *Client) ListTasks(ctx context.Context, opts ...Opt) (*schema.TaskList, error)\n```\nListTasks returns all tasks with optional filtering by status (GET /task).\n\n```go\nfunc (c *Client) ListTickers(ctx context.Context, opts ...Opt) (*schema.TickerList, error)\n```\n\n```go\nfunc (c *Client) NextTicker(ctx context.Context, callback func(client.TextStreamEvent) error) error\n```\n\n```go\nfunc (c *Client) ReleaseTask(ctx context.Context, id uint64, result any) (*schema.TaskWithStatus, error)\n```\nReleaseTask releases a task (PATCH /task/{id}). If result is non-nil, marks the task as failed with result as the error payload. If result is nil, marks the task as completed successfully.\n\n```go\nfunc (c *Client) RetainTask(ctx context.Context, worker string, queue ...string) (*schema.TaskWithStatus, error)\n```\nRetainTask gets the next available task (PUT /task or PUT /task/{queue}?worker=XX). If queue is empty, tasks from any queue are considered.\n\n```go\nfunc (c *Client) UpdateQueue(ctx context.Context, name string, meta schema.QueueMeta) (*schema.Queue, error)\n```\n\n```go\nfunc (c *Client) UpdateTicker(ctx context.Context, name string, meta schema.TickerMeta) (*schema.Ticker, error)\n```\n\n```go\ntype Opt func(*opt) error\n```\nOpt is an option to set on the client request.\n\n```go\nfunc OptSet(key, value string) Opt\n```\nOptSet is a generic option to set a query parameter.\n\n```go\nfunc WithLimit(limit uint64) Opt\n```\nWithLimit sets the limit query parameter.\n\n```go\nfunc WithOffset(offset uint64) Opt\n```\nWithOffset sets the offset query parameter.\n\n```go\nfunc WithOffsetLimit(offset uint64, limit *uint64) Opt\n```\nWithOffsetLimit sets offset and limit query parameters.\n\n```go\nfunc WithQueue(queue string) Opt\n```\nWithQueue sets the queue query parameter.\n\n```go\nfunc WithStatus(status string) Opt\n```\nWithStatus sets the status query parameter for filtering tasks.\n\n```go\nfunc WithWorker(worker string) Opt\n```\nWithWorker sets the worker query parameter.\n\n","path":"github.com/mutablelogic/go-pg/pkg/queue/httpclient","name":"httpclient","synopsis":"Package httpclient provides a typed Go client for consuming the PostgreSQL queue management REST API.","isRedistributable":true}
