client

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 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 Account added in v0.0.4

type Account struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
	Test bool      `json:"test"`

	Identifier AccountIdentifier `json:"identifier"`
}

type AccountIdentifier added in v0.0.4

type AccountIdentifier struct {
	DSNPrefix  string     `json:"dsnPrefix"`
	Domain     *string    `json:"domain"`
	VerifiedAt *time.Time `json:"verifiedAt"`
}

type Action

type Action struct {
	DSN     string
	Name    string
	Tagline string
	Latest  *ActionVersion
}

type ActionVersion

type ActionVersion struct {
	VersionMajor int
	VersionMinor int
	ValidFrom    *time.Time
	ValidTo      *time.Time
	Runtime      string
}

type ActionVersionQualifier

type ActionVersionQualifier struct {
	DSN          string `json:"dsn"`
	VersionMajor int    `json:"versionMajor"`
	VersionMinor int    `json:"versionMinor"`
}

type Client

type Client interface {
	Credentials() []byte

	Login(ctx context.Context, email, password string) ([]byte, error)
	Account(ctx context.Context) (*Account, error)
	Workspaces(ctx context.Context) ([]Workspace, error)

	// Workflows lists all workflows in a given workspace
	Workflows(ctx context.Context, workspaceID uuid.UUID) ([]Workflow, error)
	// Workflow returns a specific workflow by ID
	Workflow(ctx context.Context, workspaceID, workflowID uuid.UUID) (*Workflow, error)
	// WorkflowVersion returns a specific workflow version for a given workflow
	WorkflowVersion(ctx context.Context, workspaceID, workflowID uuid.UUID, version int) (*WorkflowVersion, error)
	// LatestWorkflowVersion returns the latest workflow version by modification date for a given workflow
	LatestWorkflowVersion(ctx context.Context, workspaceID, workflowID uuid.UUID) (*WorkflowVersion, error)
	// DeployWorflow idempotently deploys a workflow, by default as a draft.  Set live to true to deploy as the live version.
	DeployWorkflow(ctx context.Context, workspaceID uuid.UUID, config string, live bool) (*WorkflowVersion, error)

	Actions(ctx context.Context, includePublic bool) ([]*Action, error)
	UpdateActionVersion(ctx context.Context, v ActionVersionQualifier, enabled bool) (*ActionVersion, error)
	CreateAction(ctx context.Context, config string) (*Action, error)
}

Client implements all functionality necessary to communicate with the inngest server.

func New

func New(opts ...ClientOpt) Client

type ClientOpt

type ClientOpt func(Client) Client

func WithAPI

func WithAPI(api string) ClientOpt

WithCredentials is used to configure a client with a given API host.

func WithCredentials

func WithCredentials(creds []byte) ClientOpt

WithCredentials is used to configure a client with a given JWT.

type Error

type Error struct {
	Message string   `json:"message"`
	Path    []string `json:"path,omitempty"`
}

func (Error) Error

func (e Error) Error() string

type ErrorList

type ErrorList []*Error

func (ErrorList) Error

func (e ErrorList) Error() string

type Params

type Params struct {
	Query         string                 `json:"query"`
	OperationName string                 `json:"operationName"`
	Variables     map[string]interface{} `json:"variables"`
}

type Response

type Response struct {
	Data   json.RawMessage `json:"data"`
	Errors ErrorList       `json:"errors,omitempty"`
}

type Usage added in v0.0.4

type Usage struct {
	Period string      `json:"period"`
	Range  string      `json:"range"`
	Total  int         `json:"total"`
	Data   []UsageSlot `json:"data"`
}

type UsageSlot added in v0.0.4

type UsageSlot struct {
	Slot  time.Time `json:"slot"`
	Count int64     `json:"count"`
}

type Workflow added in v0.0.4

type Workflow struct {
	ID uuid.UUID `json:"id"`

	// Slug represents the human ID for a workflow, used as the "ID"
	// within a workflow version's configuration.
	Slug string `json:"slug"`
	Name string `json:"name"`

	Usage Usage `json:"usage"`

	Current  *WorkflowVersion  `json:"current"`
	Drafts   []WorkflowVersion `json:"drafts"`
	Previous []WorkflowVersion `json:"previous"`
}

Workflow represents all versions of a single workflow in a workspace.

type WorkflowTrigger added in v0.0.4

type WorkflowTrigger struct {
	EventName *string `json:"eventName"`
	Schedule  *string `json:"schedule"`
}

func (WorkflowTrigger) String added in v0.0.4

func (w WorkflowTrigger) String() string

type WorkflowVersion added in v0.0.4

type WorkflowVersion struct {
	Version     int    `json:"version"`
	Description string `json:"description"`
	Config      string `json:"config"`

	ValidFrom *time.Time `json:"validFrom"`
	ValidTo   *time.Time `json:"validTo"`

	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`

	Triggers []WorkflowTrigger `json:"triggers"`
}

type Workspace

type Workspace struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
	Test bool      `json:"test"`
}

Workspace represents a single workspace within an Inngest account. The pertinent fields for the active workspace are marshalled into State.

Jump to

Keyboard shortcuts

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