httpclient

package
v1.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
}

Client is a task HTTP client that wraps the base HTTP client

func New

func New(url string, opts ...client.ClientOpt) (*Client, error)

New creates a new task HTTP client with the given base URL and options. The url parameter should point to the task API endpoint, e.g. "http://localhost:8080/api".

func (*Client) CancelTask

func (c *Client) CancelTask(ctx context.Context, id uuid.UUID) (*schema.Status, error)

CancelTask cancels the task with the given uuid. It's a no-op if the task has already finished or was never started. Returns the task's status after the cancellation request.

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, id uuid.UUID) (*schema.Status, error)

GetTask returns the current status of the task with the given uuid.

func (*Client) ListTasks

func (c *Client) ListTasks(ctx context.Context, req schema.TaskListRequest) (*schema.TaskList, error)

ListTasks returns the tasks matching req, in the order they were added.

func (*Client) SubscribeEvents

func (c *Client) SubscribeEvents(ctx context.Context, req schema.TaskEventRequest, fn TaskEventFunc) error

SubscribeEvents streams task events matching req - see schema.TaskEventRequest for how uuid and event filter the stream. It blocks, calling fn for every event, until ctx is done, the server stops, or fn itself stops it (io.EOF to stop cleanly, any other error to stop and have SubscribeEvents return that error).

type TaskEventFunc

type TaskEventFunc func(*schema.Event) error

TaskEventFunc is called for every task event received from SubscribeEvents. Return io.EOF to stop the subscription cleanly, or any other error to stop it and have SubscribeEvents return that error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL