sdk

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidResponse = errors.New("invalid response")

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(url string, opts ...ClientOption) *Client

func (*Client) AddRequest

func (c *Client) AddRequest(body types.AddRequestBodyType) (any, error)

func (*Client) Authorize

func (c *Client) Authorize() error

func (*Client) CompleteProcess

func (c *Client) CompleteProcess(id string, message string) error

CompleteProcess marks a process as completed

func (*Client) Create

func (c *Client) Create(collection string, body any) (types.ResponseCreate, error)

func (*Client) CreateCollection

func (c *Client) CreateCollection(body any) (any, error)

func (*Client) CreateProcess

func (c *Client) CreateProcess(req CreateProcessRequest) (string, error)

CreateProcess creates a new process in the _processes collection

func (*Client) Delete

func (c *Client) Delete(collection string, id string) error

func (*Client) FailProcess

func (c *Client) FailProcess(id string, errorMsg string) error

FailProcess marks a process as failed with an error message

func (*Client) KillProcess

func (c *Client) KillProcess(id string, message string) error

KillProcess marks a process as killed

func (*Client) LabelAttach

func (c *Client) LabelAttach(data types.Label) error

func (*Client) List

func (c *Client) List(collection string, params types.ParamsList) (types.ResponseList[map[string]any], error)

func (*Client) PauseProcess

func (c *Client) PauseProcess(id string, message string) error

PauseProcess marks a process as paused

func (*Client) PlaygroundAddChild

func (c *Client) PlaygroundAddChild(body types.PlaygroundAdd) (any, error)

func (*Client) PlaygroundNew

func (c *Client) PlaygroundNew(body types.PlaygroundNew) (any, error)

func (*Client) SitemapNew

func (c *Client) SitemapNew(data types.SitemapGet) error

Sitemap New using endpoint form APIEndpoints[SitemapNew]

func (*Client) Update

func (c *Client) Update(collection string, id string, body any) error

func (*Client) UpdateProcess

func (c *Client) UpdateProcess(id string, progress ProgressUpdate) error

UpdateProcess updates an existing process with progress information

type ClientOption

type ClientOption func(*Client)

func WithAdminEmailPassword

func WithAdminEmailPassword(email, password string) ClientOption

func WithDebug

func WithDebug() ClientOption

func WithUserEmailPassword

func WithUserEmailPassword(email, password string) ClientOption

type Collection

type Collection[T any] struct {
	*Client
	Name string
}

func CollectionSet

func CollectionSet[T any](client *Client, collection string) Collection[T]

func (Collection[T]) Create

func (c Collection[T]) Create(body T) (types.ResponseCreate, error)

func (Collection[T]) Delete

func (c Collection[T]) Delete(id string) error

func (Collection[T]) List

func (c Collection[T]) List(params types.ParamsList) (types.ResponseList[T], error)

func (Collection[T]) One

func (c Collection[T]) One(id string) (T, error)

func (Collection[T]) SitemapNew

func (c Collection[T]) SitemapNew(data types.SitemapGet) error

func (Collection[T]) Subscribe

func (c Collection[T]) Subscribe(targets ...string) (*Stream[T], error)

func (Collection[T]) SubscribeWith

func (c Collection[T]) SubscribeWith(opts SubscribeOptions, targets ...string) (*Stream[T], error)

func (Collection[T]) Update

func (c Collection[T]) Update(id string, body T) error

type CreateProcessRequest

type CreateProcessRequest struct {
	ID          string         `json:"id,omitempty"`
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Type        string         `json:"type"`
	State       string         `json:"state,omitempty"`
	Data        map[string]any `json:"data,omitempty"`
	Input       *ProcessInput  `json:"input,omitempty"`
	ParentID    string         `json:"parent_id,omitempty"`
	GeneratedBy string         `json:"generated_by,omitempty"`
	CreatedBy   string         `json:"created_by,omitempty"`
}

CreateProcessRequest represents the request to create a new process

type Event

type Event[T any] struct {
	Action string `json:"action"`
	Record T      `json:"record"`
	Error  error  `json:"-"`
}

type ProcessInput

type ProcessInput struct {
	Completed int    `json:"completed"`
	Total     int    `json:"total"`
	Progress  int    `json:"progress"`
	Message   string `json:"message"`
	Error     string `json:"error"`
}

ProcessInput represents the input field structure for a process

type ProgressUpdate

type ProgressUpdate struct {
	Completed int
	Total     int
	Message   string
	Error     string
	State     string
}

ProgressUpdate represents progress information for updating a process

type Stream

type Stream[T any] struct {
	// contains filtered or unexported fields
}

func (*Stream[T]) Events

func (s *Stream[T]) Events() <-chan Event[T]

func (*Stream[T]) Ready

func (s *Stream[T]) Ready() <-chan struct{}

func (*Stream[T]) Unsubscribe

func (s *Stream[T]) Unsubscribe()

func (*Stream[T]) WaitAuthReady deprecated

func (s *Stream[T]) WaitAuthReady() error

Deprecated: use <-stream.Ready() instead of

type SubscribeOptions

type SubscribeOptions struct {
	ReconnectStrategy backoff.BackOff
}

type SubscriptionsSet

type SubscriptionsSet struct {
	ClientID      string   `json:"clientId"`
	Subscriptions []string `json:"subscriptions"`
}

type UpdateProcessRequest

type UpdateProcessRequest struct {
	Input *ProcessInput `json:"input,omitempty"`
	State string        `json:"state,omitempty"`
}

UpdateProcessRequest represents the request to update a process

Jump to

Keyboard shortcuts

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