api

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitSuccess  = 0
	ExitError    = 1
	ExitUsage    = 2
	ExitAuth     = 3
	ExitNetwork  = 4
	ExitNotFound = 5
)

Exit codes

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

ExitCode returns the appropriate exit code for the error

Types

type APIError

type APIError struct {
	StatusCode int    `json:"-"`
	Code       int    `json:"code"`
	Message    string `json:"message"`
	Data       any    `json:"data"`
}

APIError represents an error from the API

func (*APIError) Error

func (e *APIError) Error() string

type Client

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

Client is the API client for Certimate

func NewClient

func NewClient(cfg *config.Config) *Client

NewClient creates a new API client

func (*Client) CancelWorkflowRun

func (c *Client) CancelWorkflowRun(ctx context.Context, workflowID, runID string) error

CancelWorkflowRun cancels a running workflow

func (*Client) CreateAccess

func (c *Client) CreateAccess(ctx context.Context, access *models.Access) (*models.Access, error)

CreateAccess creates a new access credential

func (*Client) CreateWorkflow

func (c *Client) CreateWorkflow(ctx context.Context, workflow *models.Workflow) (*models.Workflow, error)

CreateWorkflow creates a new workflow

func (*Client) DeleteAccess

func (c *Client) DeleteAccess(ctx context.Context, id string) error

DeleteAccess deletes an access credential

func (*Client) DeleteWorkflow

func (c *Client) DeleteWorkflow(ctx context.Context, id string) error

DeleteWorkflow deletes a workflow

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, body interface{}, result interface{}) error

Do performs an HTTP request

func (*Client) DownloadCertificate

func (c *Client) DownloadCertificate(ctx context.Context, certificateID, format string) ([]byte, error)

DownloadCertificate downloads a certificate in the specified format

func (*Client) GetAccess

func (c *Client) GetAccess(ctx context.Context, id string) (*models.Access, error)

GetAccess fetches a single access by ID

func (*Client) GetCertificate

func (c *Client) GetCertificate(ctx context.Context, id string) (*models.Certificate, error)

GetCertificate fetches a single certificate by ID

func (*Client) GetWorkflow

func (c *Client) GetWorkflow(ctx context.Context, id string) (*models.Workflow, error)

GetWorkflow fetches a single workflow by ID

func (*Client) GetWorkflowRun

func (c *Client) GetWorkflowRun(ctx context.Context, runID string) (*models.WorkflowRun, error)

GetWorkflowRun fetches a single workflow run by ID

func (*Client) ListAccess

func (c *Client) ListAccess(ctx context.Context, filter, sort string, page, perPage int) (*ListResponse[models.Access], error)

ListAccess fetches all access credentials with optional filtering

func (*Client) ListCertificates

func (c *Client) ListCertificates(ctx context.Context, filter, sort string, page, perPage int) (*ListResponse[models.Certificate], error)

ListCertificates fetches all certificates with optional filtering

func (*Client) ListWorkflowRuns

func (c *Client) ListWorkflowRuns(ctx context.Context, workflowID string, page, perPage int) (*ListResponse[models.WorkflowRun], error)

ListWorkflowRuns fetches workflow execution history

func (*Client) ListWorkflows

func (c *Client) ListWorkflows(ctx context.Context, filter, sort string, page, perPage int) (*ListResponse[models.Workflow], error)

ListWorkflows fetches all workflows with optional filtering

func (*Client) RunWorkflow

func (c *Client) RunWorkflow(ctx context.Context, workflowID string) (string, error)

RunWorkflow executes a workflow via custom API

func (*Client) SetInsecure

func (c *Client) SetInsecure(insecure bool)

SetInsecure skips TLS verification

func (*Client) UpdateAccess

func (c *Client) UpdateAccess(ctx context.Context, id string, access *models.Access) (*models.Access, error)

UpdateAccess updates an existing access credential

func (*Client) UpdateWorkflow

func (c *Client) UpdateWorkflow(ctx context.Context, id string, workflow *models.Workflow) (*models.Workflow, error)

UpdateWorkflow updates an existing workflow

func (*Client) ValidateConnection

func (c *Client) ValidateConnection(ctx context.Context) error

ValidateConnection tests if the connection is valid

type ListResponse

type ListResponse[T any] struct {
	Page       int `json:"page"`
	PerPage    int `json:"perPage"`
	TotalItems int `json:"totalItems"`
	TotalPages int `json:"totalPages"`
	Items      []T `json:"items"`
}

ListResponse is the standard PocketBase response for list queries

type NetworkError

type NetworkError struct {
	Err error
}

NetworkError represents a network connectivity error

func (*NetworkError) Error

func (e *NetworkError) Error() string

func (*NetworkError) Unwrap

func (e *NetworkError) Unwrap() error

Jump to

Keyboard shortcuts

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