dispatchclient

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	// contains filtered or unexported fields
}

Batch is used to submit a batch of function calls to Dispatch.

func (*Batch) Add

func (b *Batch) Add(calls ...dispatchproto.Call)

Add adds calls to the batch.

func (*Batch) Dispatch

func (b *Batch) Dispatch(ctx context.Context) ([]dispatchproto.ID, error)

Dispatch dispatches the batch of function calls.

func (*Batch) Reset

func (b *Batch) Reset()

Reset resets the batch.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client for the Dispatch API.

The Client can be used to dispatch function calls.

func New

func New(opts ...Option) (*Client, error)

New creates a Client.

func (*Client) Batch

func (c *Client) Batch() Batch

Batch creates a Batch.

func (*Client) Dispatch

func (c *Client) Dispatch(ctx context.Context, call dispatchproto.Call) (dispatchproto.ID, error)

Dispatch dispatches a function call.

type Option

type Option func(*Client)

Option configures a Client.

func APIKey

func APIKey(apiKey string) Option

APIKey sets the Dispatch API key to use for authentication when dispatching function calls through a Client.

It defaults to the value of the DISPATCH_API_KEY environment variable.

func APIUrl

func APIUrl(apiUrl string) Option

APIUrl sets the URL of the Dispatch API.

It defaults to the value of the DISPATCH_API_URL environment variable, or the default API URL (https://api.dispatch.run) if DISPATCH_API_URL is unset.

func Env

func Env(env ...string) Option

Env sets the environment variables that a Client parses its default configuration from.

It defaults to os.Environ().

Jump to

Keyboard shortcuts

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