resources

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package resources provides REST resource implementations for the Spooled API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPaginationParams

func AddPaginationParams(v url.Values, limit, offset *int)

AddPaginationParams adds pagination parameters to query values.

Types

type APIKey

type APIKey struct {
	ID             string     `json:"id"`
	OrganizationID *string    `json:"organization_id,omitempty"`
	Name           string     `json:"name"`
	KeyPrefix      *string    `json:"key_prefix,omitempty"`
	Queues         []string   `json:"queues,omitempty"`
	RateLimit      *int       `json:"rate_limit,omitempty"`
	IsActive       bool       `json:"is_active"`
	CreatedAt      time.Time  `json:"created_at"`
	LastUsed       *time.Time `json:"last_used,omitempty"`
	ExpiresAt      *time.Time `json:"expires_at,omitempty"`
}

APIKey represents an API key.

type APIKeysResource

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

APIKeysResource provides access to API key operations.

func NewAPIKeysResource

func NewAPIKeysResource(transport *httpx.Transport) *APIKeysResource

NewAPIKeysResource creates a new APIKeysResource.

func (*APIKeysResource) Create

Create creates a new API key.

func (*APIKeysResource) Delete

func (r *APIKeysResource) Delete(ctx context.Context, id string) error

Delete deletes an API key.

func (*APIKeysResource) Get

func (r *APIKeysResource) Get(ctx context.Context, id string) (*APIKey, error)

Get retrieves a specific API key.

func (*APIKeysResource) List

func (r *APIKeysResource) List(ctx context.Context) ([]APIKey, error)

List retrieves all API keys.

func (*APIKeysResource) Update

func (r *APIKeysResource) Update(ctx context.Context, id string, req *UpdateAPIKeyRequest) (*APIKey, error)

Update updates an API key.

type AddDependenciesRequest

type AddDependenciesRequest struct {
	DependsOn      []string        `json:"depends_on"`
	DependencyMode *DependencyMode `json:"dependency_mode,omitempty"`
}

AddDependenciesRequest is the request to add job dependencies.

type AddDependenciesResponse

type AddDependenciesResponse struct {
	Success      bool     `json:"success"`
	Dependencies []string `json:"dependencies"`
}

AddDependenciesResponse is the response from adding dependencies.

type AdminCreateAPIKeyRequest

type AdminCreateAPIKeyRequest struct {
	Name      string     `json:"name"`
	Queues    []string   `json:"queues,omitempty"`
	RateLimit *int       `json:"rate_limit,omitempty"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

CreateAPIKeyRequest is the admin request to create an API key for an org.

type AdminCreateOrganizationRequest

type AdminCreateOrganizationRequest struct {
	Name         string         `json:"name"`
	Slug         string         `json:"slug"`
	PlanTier     *PlanTier      `json:"plan_tier,omitempty"`
	BillingEmail *string        `json:"billing_email,omitempty"`
	CustomLimits map[string]any `json:"custom_limits,omitempty"`
}

CreateOrganizationRequest is the admin request to create an organization.

type AdminOrganizationList

type AdminOrganizationList struct {
	Organizations []Organization `json:"organizations"`
	Total         int            `json:"total"`
	Limit         int            `json:"limit"`
	Offset        int            `json:"offset"`
}

AdminOrganizationList is the paginated response for admin list organizations.

type AdminResource

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

AdminResource provides access to admin operations. All operations require the X-Admin-Key header.

func NewAdminResource

func NewAdminResource(transport *httpx.Transport) *AdminResource

NewAdminResource creates a new AdminResource.

func (*AdminResource) CreateAPIKey

CreateAPIKey creates an API key for an organization (admin only).

func (*AdminResource) CreateOrganization

CreateOrganization creates an organization (admin only).

func (*AdminResource) DeleteOrganization

func (r *AdminResource) DeleteOrganization(ctx context.Context, id string, hard bool) error

DeleteOrganization deletes an organization (admin only).

func (*AdminResource) GetOrganization

func (r *AdminResource) GetOrganization(ctx context.Context, id string) (*Organization, error)

GetOrganization retrieves a specific organization (admin only).

func (*AdminResource) GetPlans

func (r *AdminResource) GetPlans(ctx context.Context) ([]PlanInfo, error)

GetPlans retrieves all available subscription plans.

func (*AdminResource) GetStats

func (r *AdminResource) GetStats(ctx context.Context) (*AdminStats, error)

GetStats retrieves platform-wide statistics.

func (*AdminResource) ListOrganizations

func (r *AdminResource) ListOrganizations(ctx context.Context, params *ListOrganizationsParams) (*AdminOrganizationList, error)

ListOrganizations retrieves all organizations (admin only).

func (*AdminResource) ResetUsage

func (r *AdminResource) ResetUsage(ctx context.Context, orgID string) error

ResetUsage resets usage counters for an organization.

func (*AdminResource) UpdateOrganization

func (r *AdminResource) UpdateOrganization(ctx context.Context, id string, req *AdminUpdateOrganizationRequest) (*Organization, error)

UpdateOrganization updates an organization (admin only).

type AdminStats

type AdminStats struct {
	TotalOrganizations  int            `json:"total_organizations"`
	TotalJobs           int            `json:"total_jobs"`
	TotalWorkers        int            `json:"total_workers"`
	TotalQueues         int            `json:"total_queues"`
	TotalAPIKeys        int            `json:"total_api_keys"`
	JobsByStatus        map[string]int `json:"jobs_by_status"`
	OrganizationsByPlan map[string]int `json:"organizations_by_plan"`
}

AdminStats contains platform-wide statistics.

type AdminUpdateOrganizationRequest

type AdminUpdateOrganizationRequest struct {
	Name         *string        `json:"name,omitempty"`
	PlanTier     *PlanTier      `json:"plan_tier,omitempty"`
	BillingEmail *string        `json:"billing_email,omitempty"`
	CustomLimits map[string]any `json:"custom_limits,omitempty"`
	IsActive     *bool          `json:"is_active,omitempty"`
}

UpdateOrganizationRequest is the admin request to update an organization.

type AuthResource

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

AuthResource provides access to authentication operations.

func NewAuthResource

func NewAuthResource(transport *httpx.Transport) *AuthResource

NewAuthResource creates a new AuthResource.

func (*AuthResource) CheckEmail

func (r *AuthResource) CheckEmail(ctx context.Context, email string) (*CheckEmailResponse, error)

CheckEmail checks if an email exists in the system.

func (*AuthResource) Login

func (r *AuthResource) Login(ctx context.Context, req *LoginRequest) (*LoginResponse, error)

Login authenticates with an API key and returns JWT tokens.

func (*AuthResource) Logout

func (r *AuthResource) Logout(ctx context.Context) error

Logout invalidates the current tokens.

func (*AuthResource) Me

func (r *AuthResource) Me(ctx context.Context) (*MeResponse, error)

Me retrieves information about the current authenticated session.

func (*AuthResource) Refresh

func (r *AuthResource) Refresh(ctx context.Context, req *RefreshRequest) (*RefreshResponse, error)

Refresh refreshes an access token using a refresh token.

func (*AuthResource) StartEmailLogin

StartEmailLogin starts the email login flow by sending a login code.

func (*AuthResource) Validate

Validate validates a token.

func (*AuthResource) VerifyEmail

VerifyEmail verifies an email login code and returns tokens.

type Base

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

Base provides common functionality for all resources.

func NewBase

func NewBase(transport *httpx.Transport) *Base

NewBase creates a new Base resource.

func (*Base) AdminDelete

func (b *Base) AdminDelete(ctx context.Context, path string) error

AdminDelete performs a DELETE request with admin key.

func (*Base) AdminGet

func (b *Base) AdminGet(ctx context.Context, path string, result any) error

AdminGet performs a GET request with admin key.

func (*Base) AdminPost

func (b *Base) AdminPost(ctx context.Context, path string, body any, result any) error

AdminPost performs a POST request with admin key.

func (*Base) AdminPut

func (b *Base) AdminPut(ctx context.Context, path string, body any, result any) error

AdminPut performs a PUT request with admin key.

func (*Base) Delete

func (b *Base) Delete(ctx context.Context, path string) error

Delete performs a DELETE request.

func (*Base) DeleteWithBody

func (b *Base) DeleteWithBody(ctx context.Context, path string, body any, result any) error

DeleteWithBody performs a DELETE request with a body.

func (*Base) Get

func (b *Base) Get(ctx context.Context, path string, result any) error

Get performs a GET request.

func (*Base) GetWithQuery

func (b *Base) GetWithQuery(ctx context.Context, path string, query url.Values, result any) error

GetWithQuery performs a GET request with query parameters.

func (*Base) Patch

func (b *Base) Patch(ctx context.Context, path string, body any, result any) error

Patch performs a PATCH request.

func (*Base) Post

func (b *Base) Post(ctx context.Context, path string, body any, result any) error

Post performs a POST request.

func (*Base) PostIdempotent

func (b *Base) PostIdempotent(ctx context.Context, path string, body any, result any) error

PostIdempotent performs an idempotent POST request (can be retried).

func (*Base) Put

func (b *Base) Put(ctx context.Context, path string, body any, result any) error

Put performs a PUT request.

type BatchJobStatus

type BatchJobStatus struct {
	ID     string    `json:"id"`
	Status JobStatus `json:"status"`
}

BatchJobStatus is the status of a job in a batch.

type BillingResource

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

BillingResource provides access to billing operations.

func NewBillingResource

func NewBillingResource(transport *httpx.Transport) *BillingResource

NewBillingResource creates a new BillingResource.

func (*BillingResource) CreatePortalSession

func (r *BillingResource) CreatePortalSession(ctx context.Context, req *CreatePortalRequest) (*CreatePortalResponse, error)

CreatePortalSession creates a Stripe billing portal session.

func (*BillingResource) GetStatus

func (r *BillingResource) GetStatus(ctx context.Context) (*BillingStatus, error)

GetStatus retrieves billing status for the current organization.

type BillingStatus

type BillingStatus struct {
	PlanTier                 PlanTier   `json:"plan_tier"`
	StripeSubscriptionID     *string    `json:"stripe_subscription_id,omitempty"`
	StripeSubscriptionStatus *string    `json:"stripe_subscription_status,omitempty"`
	StripeCurrentPeriodEnd   *time.Time `json:"stripe_current_period_end,omitempty"`
	StripeCancelAtPeriodEnd  *bool      `json:"stripe_cancel_at_period_end,omitempty"`
	HasStripeCustomer        bool       `json:"has_stripe_customer"`
}

BillingStatus represents billing status information.

type BoostPriorityRequest

type BoostPriorityRequest struct {
	Priority int `json:"priority"`
}

BoostPriorityRequest is the request to boost a job's priority.

type BoostPriorityResponse

type BoostPriorityResponse struct {
	JobID       string `json:"job_id"`
	OldPriority int    `json:"old_priority"`
	NewPriority int    `json:"new_priority"`
}

BoostPriorityResponse is the response from boosting a job's priority.

type BulkEnqueueRequest

type BulkEnqueueRequest struct {
	QueueName             string        `json:"queue_name"`
	Jobs                  []BulkJobItem `json:"jobs"`
	DefaultPriority       *int          `json:"default_priority,omitempty"`
	DefaultMaxRetries     *int          `json:"default_max_retries,omitempty"`
	DefaultTimeoutSeconds *int          `json:"default_timeout_seconds,omitempty"`
}

BulkEnqueueRequest is the request to bulk enqueue jobs.

type BulkEnqueueResponse

type BulkEnqueueResponse struct {
	Succeeded    []BulkJobSuccess `json:"succeeded"`
	Failed       []BulkJobFailure `json:"failed"`
	Total        int              `json:"total"`
	SuccessCount int              `json:"success_count"`
	FailureCount int              `json:"failure_count"`
}

BulkEnqueueResponse is the response from bulk enqueueing jobs.

type BulkJobFailure

type BulkJobFailure struct {
	Index int    `json:"index"`
	Error string `json:"error"`
}

BulkJobFailure represents a failed job in bulk enqueue.

type BulkJobItem

type BulkJobItem struct {
	Payload        map[string]any `json:"payload"`
	Priority       *int           `json:"priority,omitempty"`
	IdempotencyKey *string        `json:"idempotency_key,omitempty"`
	ScheduledAt    *time.Time     `json:"scheduled_at,omitempty"`
}

BulkJobItem is an individual job in a bulk enqueue request.

type BulkJobSuccess

type BulkJobSuccess struct {
	Index   int    `json:"index"`
	JobID   string `json:"job_id"`
	Created bool   `json:"created"`
}

BulkJobSuccess represents a successfully enqueued job.

type CheckEmailResponse

type CheckEmailResponse struct {
	Exists bool `json:"exists"`
}

CheckEmailResponse is the response from checking if an email exists.

type CheckSlugResponse

type CheckSlugResponse struct {
	Available bool    `json:"available"`
	Slug      string  `json:"slug"`
	Message   *string `json:"message,omitempty"`
}

CheckSlugResponse is the response from checking slug availability.

type ClaimJobsRequest

type ClaimJobsRequest struct {
	QueueName        string `json:"queue_name"`
	WorkerID         string `json:"worker_id"`
	Limit            *int   `json:"limit,omitempty"`
	LeaseDurationSec *int   `json:"lease_duration_secs,omitempty"`
}

ClaimJobsRequest is the request to claim jobs.

type ClaimJobsResponse

type ClaimJobsResponse struct {
	Jobs []ClaimedJob `json:"jobs"`
}

ClaimJobsResponse is the response from claiming jobs.

type ClaimedJob

type ClaimedJob struct {
	ID             string         `json:"id"`
	QueueName      string         `json:"queue_name"`
	Payload        map[string]any `json:"payload"`
	RetryCount     int            `json:"retry_count"`
	MaxRetries     int            `json:"max_retries"`
	TimeoutSeconds int            `json:"timeout_seconds"`
	LeaseExpiresAt *time.Time     `json:"lease_expires_at,omitempty"`
}

ClaimedJob is a job that has been claimed by a worker.

type CompleteJobRequest

type CompleteJobRequest struct {
	WorkerID string         `json:"worker_id"`
	Result   map[string]any `json:"result,omitempty"`
}

CompleteJobRequest is the request to complete a job.

type CreateAPIKeyRequest

type CreateAPIKeyRequest struct {
	Name      string     `json:"name"`
	Queues    []string   `json:"queues,omitempty"`
	RateLimit *int       `json:"rate_limit,omitempty"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

CreateAPIKeyRequest is the request to create an API key.

type CreateAPIKeyResponse

type CreateAPIKeyResponse struct {
	ID        string     `json:"id"`
	Key       string     `json:"key"` // Raw key - only shown once!
	Name      string     `json:"name"`
	CreatedAt time.Time  `json:"created_at"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

CreateAPIKeyResponse is the response from creating an API key.

type CreateJobRequest

type CreateJobRequest struct {
	QueueName         string         `json:"queue_name"`
	Payload           map[string]any `json:"payload"`
	Priority          *int           `json:"priority,omitempty"`
	MaxRetries        *int           `json:"max_retries,omitempty"`
	TimeoutSeconds    *int           `json:"timeout_seconds,omitempty"`
	ScheduledAt       *time.Time     `json:"scheduled_at,omitempty"`
	ExpiresAt         *time.Time     `json:"expires_at,omitempty"`
	IdempotencyKey    *string        `json:"idempotency_key,omitempty"`
	Tags              map[string]any `json:"tags,omitempty"`
	ParentJobID       *string        `json:"parent_job_id,omitempty"`
	CompletionWebhook *string        `json:"completion_webhook,omitempty"`
}

CreateJobRequest is the request to create a new job.

type CreateJobResponse

type CreateJobResponse struct {
	ID      string `json:"id"`
	Created bool   `json:"created"`
}

CreateJobResponse is the response from creating a job.

type CreateOrganizationRequest

type CreateOrganizationRequest struct {
	Name         string  `json:"name"`
	Slug         string  `json:"slug"`
	BillingEmail *string `json:"billing_email,omitempty"`
}

CreateOrganizationRequest is the request to create an organization.

type CreateOrganizationResponse

type CreateOrganizationResponse struct {
	Organization Organization         `json:"organization"`
	APIKey       CreateAPIKeyResponse `json:"api_key"`
}

CreateOrganizationResponse is the response from creating an organization.

type CreateOutgoingWebhookRequest

type CreateOutgoingWebhookRequest struct {
	Name    string         `json:"name"`
	URL     string         `json:"url"`
	Events  []WebhookEvent `json:"events"`
	Secret  *string        `json:"secret,omitempty"`
	Enabled *bool          `json:"enabled,omitempty"`
}

CreateOutgoingWebhookRequest is the request to create an outgoing webhook.

type CreatePortalRequest

type CreatePortalRequest struct {
	ReturnURL string `json:"return_url"`
}

CreatePortalRequest is the request to create a billing portal session.

type CreatePortalResponse

type CreatePortalResponse struct {
	URL string `json:"url"`
}

CreatePortalResponse is the response from creating a billing portal session.

type CreateScheduleRequest

type CreateScheduleRequest struct {
	Name            string         `json:"name"`
	Description     *string        `json:"description,omitempty"`
	CronExpression  string         `json:"cron_expression"`
	Timezone        *string        `json:"timezone,omitempty"`
	QueueName       string         `json:"queue_name"`
	PayloadTemplate map[string]any `json:"payload_template"`
	Priority        *int           `json:"priority,omitempty"`
	MaxRetries      *int           `json:"max_retries,omitempty"`
	TimeoutSeconds  *int           `json:"timeout_seconds,omitempty"`
	Tags            map[string]any `json:"tags,omitempty"`
	Metadata        map[string]any `json:"metadata,omitempty"`
}

CreateScheduleRequest is the request to create a schedule.

type CreateWorkflowRequest

type CreateWorkflowRequest struct {
	Name        string                  `json:"name"`
	Description *string                 `json:"description,omitempty"`
	Jobs        []WorkflowJobDefinition `json:"jobs"`
	Metadata    map[string]any          `json:"metadata,omitempty"`
}

CreateWorkflowRequest is the request to create a workflow.

type CreateWorkflowResponse

type CreateWorkflowResponse struct {
	WorkflowID string               `json:"workflow_id"`
	JobIDs     []WorkflowJobMapping `json:"job_ids"`
}

CreateWorkflowResponse is the response from creating a workflow.

type CustomWebhookRequest

type CustomWebhookRequest struct {
	QueueName      string         `json:"queue_name"`
	EventType      *string        `json:"event_type,omitempty"`
	Payload        map[string]any `json:"payload"`
	IdempotencyKey *string        `json:"idempotency_key,omitempty"`
	Priority       *int           `json:"priority,omitempty"`
}

CustomWebhookRequest is the request to ingest a custom webhook.

type CustomWebhookResponse

type CustomWebhookResponse struct {
	JobID   string `json:"job_id"`
	Created bool   `json:"created"`
}

CustomWebhookResponse is the response from ingesting a custom webhook.

type DLQResource

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

DLQResource provides access to Dead Letter Queue operations.

func (*DLQResource) List

func (r *DLQResource) List(ctx context.Context, params *ListDLQParams) ([]Job, error)

List retrieves dead letter queue jobs.

func (*DLQResource) Purge

Purge removes jobs from the dead letter queue.

func (*DLQResource) Retry

Retry retries jobs in the dead letter queue.

type DashboardData

type DashboardData struct {
	System         SystemInfo        `json:"system"`
	Jobs           JobSummaryStats   `json:"jobs"`
	Queues         []QueueSummary    `json:"queues"`
	Workers        WorkerSummaryInfo `json:"workers"`
	RecentActivity RecentActivity    `json:"recent_activity"`
}

DashboardData represents aggregated dashboard data.

type DashboardResource

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

DashboardResource provides access to dashboard operations.

func NewDashboardResource

func NewDashboardResource(transport *httpx.Transport) *DashboardResource

NewDashboardResource creates a new DashboardResource.

func (*DashboardResource) Get

Get retrieves the dashboard data.

type DependencyMode

type DependencyMode string

DependencyMode specifies how job dependencies are evaluated.

const (
	DependencyModeAll DependencyMode = "all"
	DependencyModeAny DependencyMode = "any"
)

type FailJobRequest

type FailJobRequest struct {
	WorkerID string `json:"worker_id"`
	Error    string `json:"error"`
}

FailJobRequest is the request to fail a job.

type GenerateSlugResponse

type GenerateSlugResponse struct {
	Slug string `json:"slug"`
}

GenerateSlugResponse is the response from generating a slug.

type GitHubIngestOptions

type GitHubIngestOptions struct {
	// GitHubEvent is the GitHub event name (required), e.g. "push".
	GitHubEvent string
	// Signature is the full X-Hub-Signature-256 value (optional if Secret is provided).
	Signature string
	// Secret is used to compute the signature if Signature is not provided.
	Secret string
	// WebhookToken is optional and sent as X-Webhook-Token.
	WebhookToken string
	// ForwardedProto is optional and sent as X-Forwarded-Proto.
	ForwardedProto string
}

GitHubIngestOptions configures GitHub webhook ingestion.

type HealthResource

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

HealthResource provides access to health check operations.

func NewHealthResource

func NewHealthResource(transport *httpx.Transport) *HealthResource

NewHealthResource creates a new HealthResource.

func (*HealthResource) Get

Get performs a full health check.

func (*HealthResource) Liveness

func (r *HealthResource) Liveness(ctx context.Context) (*HealthResponse, error)

Liveness checks if the service is alive.

func (*HealthResource) Readiness

func (r *HealthResource) Readiness(ctx context.Context) (*HealthResponse, error)

Readiness checks if the service is ready to serve requests.

type HealthResponse

type HealthResponse struct {
	Status    string `json:"status"`
	Database  bool   `json:"database"`
	Cache     bool   `json:"cache"`
	Timestamp string `json:"timestamp,omitempty"`
}

HealthResponse represents the health check response.

type HeartbeatRequest

type HeartbeatRequest struct {
	WorkerID         string `json:"worker_id"`
	LeaseDurationSec *int   `json:"lease_duration_secs,omitempty"`
}

HeartbeatRequest is the request for a job heartbeat.

type IngestResource

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

IngestResource provides access to webhook ingestion operations.

func NewIngestResource

func NewIngestResource(transport *httpx.Transport) *IngestResource

NewIngestResource creates a new IngestResource.

func (*IngestResource) Custom

Custom ingests a custom webhook for an organization.

func (*IngestResource) CustomWithToken

func (r *IngestResource) CustomWithToken(ctx context.Context, orgID, webhookToken string, req *CustomWebhookRequest) (*CustomWebhookResponse, error)

CustomWithToken ingests a custom webhook using a webhook token via the X-Webhook-Token header.

func (*IngestResource) GitHub

func (r *IngestResource) GitHub(ctx context.Context, orgID string, rawBody []byte, opts *GitHubIngestOptions) error

GitHub ingests a GitHub webhook. The request body must be the exact raw bytes GitHub sent. POST /api/v1/webhooks/{org_id}/github

func (*IngestResource) Stripe

func (r *IngestResource) Stripe(ctx context.Context, orgID string, rawBody []byte, opts *StripeIngestOptions) error

Stripe ingests a Stripe webhook. The request body must be the exact raw bytes Stripe sent. POST /api/v1/webhooks/{org_id}/stripe

type Job

type Job struct {
	ID                string         `json:"id"`
	OrganizationID    string         `json:"organization_id"`
	QueueName         string         `json:"queue_name"`
	Status            JobStatus      `json:"status"`
	Payload           map[string]any `json:"payload"`
	Result            map[string]any `json:"result,omitempty"`
	RetryCount        int            `json:"retry_count"`
	MaxRetries        int            `json:"max_retries"`
	LastError         *string        `json:"last_error,omitempty"`
	CreatedAt         time.Time      `json:"created_at"`
	ScheduledAt       *time.Time     `json:"scheduled_at,omitempty"`
	StartedAt         *time.Time     `json:"started_at,omitempty"`
	CompletedAt       *time.Time     `json:"completed_at,omitempty"`
	ExpiresAt         *time.Time     `json:"expires_at,omitempty"`
	Priority          int            `json:"priority"`
	Tags              map[string]any `json:"tags,omitempty"`
	TimeoutSeconds    int            `json:"timeout_seconds"`
	ParentJobID       *string        `json:"parent_job_id,omitempty"`
	CompletionWebhook *string        `json:"completion_webhook,omitempty"`
	AssignedWorkerID  *string        `json:"assigned_worker_id,omitempty"`
	LeaseID           *string        `json:"lease_id,omitempty"`
	LeaseExpiresAt    *time.Time     `json:"lease_expires_at,omitempty"`
	IdempotencyKey    *string        `json:"idempotency_key,omitempty"`
	UpdatedAt         time.Time      `json:"updated_at"`
	WorkflowID        *string        `json:"workflow_id,omitempty"`
	DependencyMode    *string        `json:"dependency_mode,omitempty"`
	DependenciesMet   *bool          `json:"dependencies_met,omitempty"`
}

Job represents a full job object.

type JobMetrics

type JobMetrics struct {
	TotalCreated    int64   `json:"total_created"`
	TotalCompleted  int64   `json:"total_completed"`
	TotalFailed     int64   `json:"total_failed"`
	AvgWaitTimeMs   float64 `json:"avg_wait_time_ms"`
	AvgProcessingMs float64 `json:"avg_processing_ms"`
}

JobMetrics contains job-related metrics.

type JobStats

type JobStats struct {
	Pending    int `json:"pending"`
	Scheduled  int `json:"scheduled"`
	Processing int `json:"processing"`
	Completed  int `json:"completed"`
	Failed     int `json:"failed"`
	Deadletter int `json:"deadletter"`
	Cancelled  int `json:"cancelled"`
	Total      int `json:"total"`
}

JobStats represents job statistics.

type JobStatus

type JobStatus string

JobStatus represents the status of a job.

const (
	JobStatusPending    JobStatus = "pending"
	JobStatusScheduled  JobStatus = "scheduled"
	JobStatusProcessing JobStatus = "processing"
	JobStatusCompleted  JobStatus = "completed"
	JobStatusFailed     JobStatus = "failed"
	JobStatusDeadletter JobStatus = "deadletter"
	JobStatusCancelled  JobStatus = "cancelled"
)

type JobSummaryStats

type JobSummaryStats struct {
	Total               int      `json:"total"`
	Pending             int      `json:"pending"`
	Processing          int      `json:"processing"`
	Completed24h        int      `json:"completed_24h"`
	Failed24h           int      `json:"failed_24h"`
	Deadletter          int      `json:"deadletter"`
	AvgWaitTimeMs       *float64 `json:"avg_wait_time_ms,omitempty"`
	AvgProcessingTimeMs *float64 `json:"avg_processing_time_ms,omitempty"`
}

JobSummaryStats contains job statistics for the dashboard.

type JobWithDependencies

type JobWithDependencies struct {
	Job          Job      `json:"job"`
	Dependencies []string `json:"dependencies"`
	Dependents   []string `json:"dependents"`
}

JobWithDependencies represents a job with its dependencies.

type JobsResource

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

JobsResource provides access to job operations.

func NewJobsResource

func NewJobsResource(transport *httpx.Transport) *JobsResource

NewJobsResource creates a new JobsResource.

func (*JobsResource) BatchStatus

func (r *JobsResource) BatchStatus(ctx context.Context, ids []string) ([]BatchJobStatus, error)

BatchStatus retrieves the status of multiple jobs.

func (*JobsResource) BoostPriority

BoostPriority boosts a job's priority.

func (*JobsResource) BulkEnqueue

BulkEnqueue bulk enqueues multiple jobs.

func (*JobsResource) Cancel

func (r *JobsResource) Cancel(ctx context.Context, id string) error

Cancel cancels a job.

func (*JobsResource) Claim

Claim claims jobs for a worker.

func (*JobsResource) Complete

func (r *JobsResource) Complete(ctx context.Context, id string, req *CompleteJobRequest) error

Complete marks a job as completed.

func (*JobsResource) Create

Create creates a new job.

func (*JobsResource) CreateAndGet

func (r *JobsResource) CreateAndGet(ctx context.Context, req *CreateJobRequest) (*Job, error)

CreateAndGet creates a new job and returns the full job object.

func (*JobsResource) DLQ

func (r *JobsResource) DLQ() *DLQResource

DLQ returns the Dead Letter Queue resource.

func (*JobsResource) Fail

func (r *JobsResource) Fail(ctx context.Context, id string, req *FailJobRequest) error

Fail marks a job as failed.

func (*JobsResource) Get

func (r *JobsResource) Get(ctx context.Context, id string) (*Job, error)

Get retrieves a job by ID.

func (*JobsResource) GetStats

func (r *JobsResource) GetStats(ctx context.Context) (*JobStats, error)

GetStats retrieves job statistics.

func (*JobsResource) Heartbeat

func (r *JobsResource) Heartbeat(ctx context.Context, id string, req *HeartbeatRequest) error

Heartbeat sends a heartbeat for a job to extend its lease.

func (*JobsResource) List

func (r *JobsResource) List(ctx context.Context, params *ListJobsParams) ([]Job, error)

List retrieves a list of jobs.

func (*JobsResource) RenewLease

func (r *JobsResource) RenewLease(ctx context.Context, id string, req *RenewLeaseRequest) (*RenewLeaseResponse, error)

RenewLease extends the lease on a job.

func (*JobsResource) Retry

func (r *JobsResource) Retry(ctx context.Context, id string) (*Job, error)

Retry retries a failed job.

func (*JobsResource) UpdateProgress

func (r *JobsResource) UpdateProgress(ctx context.Context, id string, req *UpdateProgressRequest) error

UpdateProgress updates the progress of a job.

type ListDLQParams

type ListDLQParams struct {
	QueueName *string `json:"queue_name,omitempty"`
	Limit     *int    `json:"limit,omitempty"`
	Offset    *int    `json:"offset,omitempty"`
}

ListDLQParams are parameters for listing DLQ jobs.

type ListDeliveriesParams

type ListDeliveriesParams struct {
	Status *WebhookDeliveryStatus `json:"status,omitempty"`
	Limit  *int                   `json:"limit,omitempty"`
	Offset *int                   `json:"offset,omitempty"`
}

ListDeliveriesParams are parameters for listing webhook deliveries.

type ListJobsParams

type ListJobsParams struct {
	QueueName *string    `json:"queue_name,omitempty"`
	Status    *JobStatus `json:"status,omitempty"`
	Limit     *int       `json:"limit,omitempty"`
	Offset    *int       `json:"offset,omitempty"`
}

ListJobsParams are parameters for listing jobs.

type ListOrganizationsParams

type ListOrganizationsParams struct {
	PlanTier *PlanTier `json:"plan_tier,omitempty"`
	Search   *string   `json:"search,omitempty"`
	Limit    *int      `json:"limit,omitempty"`
	Offset   *int      `json:"offset,omitempty"`
}

ListOrganizationsParams are parameters for admin listing organizations.

type ListSchedulesParams

type ListSchedulesParams struct {
	QueueName *string `json:"queue_name,omitempty"`
	IsActive  *bool   `json:"is_active,omitempty"`
	Limit     *int    `json:"limit,omitempty"`
	Offset    *int    `json:"offset,omitempty"`
}

ListSchedulesParams are parameters for listing schedules.

type ListWorkflowsParams

type ListWorkflowsParams struct {
	Status *WorkflowStatus `json:"status,omitempty"`
	Limit  *int            `json:"limit,omitempty"`
	Offset *int            `json:"offset,omitempty"`
}

ListWorkflowsParams are parameters for listing workflows.

type LoginRequest

type LoginRequest struct {
	APIKey string `json:"api_key"`
}

LoginRequest is the request to login with an API key.

type LoginResponse

type LoginResponse struct {
	AccessToken      string `json:"access_token"`
	RefreshToken     string `json:"refresh_token"`
	TokenType        string `json:"token_type"`
	ExpiresIn        int    `json:"expires_in"`
	RefreshExpiresIn int    `json:"refresh_expires_in"`
}

LoginResponse is the response from logging in.

type MeResponse

type MeResponse struct {
	OrganizationID string    `json:"organization_id"`
	APIKeyID       string    `json:"api_key_id"`
	Queues         []string  `json:"queues"`
	IssuedAt       time.Time `json:"issued_at"`
	ExpiresAt      time.Time `json:"expires_at"`
}

MeResponse is the response from the /auth/me endpoint.

type Metrics

type Metrics struct {
	Jobs    JobMetrics    `json:"jobs"`
	Workers WorkerMetrics `json:"workers"`
	Queues  QueueMetrics  `json:"queues"`
	System  SystemMetrics `json:"system"`
}

Metrics represents system metrics.

type MetricsResource

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

MetricsResource provides access to metrics operations.

func NewMetricsResource

func NewMetricsResource(transport *httpx.Transport) *MetricsResource

NewMetricsResource creates a new MetricsResource.

func (*MetricsResource) Get

func (r *MetricsResource) Get(ctx context.Context) (*Metrics, error)

Get retrieves system metrics.

func (*MetricsResource) Prometheus

func (r *MetricsResource) Prometheus(ctx context.Context) (string, error)

Prometheus retrieves metrics in Prometheus format.

type Organization

type Organization struct {
	ID                       string         `json:"id"`
	Name                     string         `json:"name"`
	Slug                     string         `json:"slug"`
	PlanTier                 PlanTier       `json:"plan_tier"`
	BillingEmail             *string        `json:"billing_email,omitempty"`
	Settings                 map[string]any `json:"settings"`
	CustomLimits             map[string]any `json:"custom_limits,omitempty"`
	StripeCustomerID         *string        `json:"stripe_customer_id,omitempty"`
	StripeSubscriptionID     *string        `json:"stripe_subscription_id,omitempty"`
	StripeSubscriptionStatus *string        `json:"stripe_subscription_status,omitempty"`
	StripeCurrentPeriodEnd   *time.Time     `json:"stripe_current_period_end,omitempty"`
	StripeCancelAtPeriodEnd  *bool          `json:"stripe_cancel_at_period_end,omitempty"`
	CreatedAt                time.Time      `json:"created_at"`
	UpdatedAt                time.Time      `json:"updated_at"`
}

Organization represents an organization.

type OrganizationMember

type OrganizationMember struct {
	ID        string    `json:"id"`
	UserID    string    `json:"user_id"`
	Email     string    `json:"email"`
	Name      string    `json:"name"`
	Role      string    `json:"role"`
	JoinedAt  time.Time `json:"joined_at"`
	InvitedBy *string   `json:"invited_by,omitempty"`
}

OrganizationMember represents a member of an organization.

type OrganizationsResource

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

OrganizationsResource provides access to organization operations.

func NewOrganizationsResource

func NewOrganizationsResource(transport *httpx.Transport) *OrganizationsResource

NewOrganizationsResource creates a new OrganizationsResource.

func (*OrganizationsResource) CheckSlug

func (r *OrganizationsResource) CheckSlug(ctx context.Context, slug string) (*CheckSlugResponse, error)

CheckSlug checks if a slug is available.

func (*OrganizationsResource) ClearWebhookToken

func (r *OrganizationsResource) ClearWebhookToken(ctx context.Context, id string) error

ClearWebhookToken clears the webhook token for an organization.

func (*OrganizationsResource) Create

Create creates a new organization.

func (*OrganizationsResource) Delete

func (r *OrganizationsResource) Delete(ctx context.Context, id string) error

Delete deletes an organization.

func (*OrganizationsResource) GenerateSlug

func (r *OrganizationsResource) GenerateSlug(ctx context.Context, name string) (*GenerateSlugResponse, error)

GenerateSlug generates a slug from a name.

func (*OrganizationsResource) Get

Get retrieves a specific organization.

func (*OrganizationsResource) GetWebhookToken

func (r *OrganizationsResource) GetWebhookToken(ctx context.Context, id string) (*WebhookTokenResponse, error)

GetWebhookToken retrieves the webhook token for an organization.

func (*OrganizationsResource) List

List retrieves all organizations for the current user.

func (*OrganizationsResource) Members

Members retrieves members of an organization.

func (*OrganizationsResource) RegenerateWebhookToken

func (r *OrganizationsResource) RegenerateWebhookToken(ctx context.Context, id string) (*WebhookTokenResponse, error)

RegenerateWebhookToken regenerates the webhook token for an organization.

func (*OrganizationsResource) Update

Update updates an organization.

func (*OrganizationsResource) Usage

Usage retrieves usage information for an organization.

type OutgoingWebhook

type OutgoingWebhook struct {
	ID              string         `json:"id"`
	OrganizationID  string         `json:"organization_id"`
	Name            string         `json:"name"`
	URL             string         `json:"url"`
	Events          []WebhookEvent `json:"events"`
	Enabled         bool           `json:"enabled"`
	FailureCount    int            `json:"failure_count"`
	LastTriggeredAt *time.Time     `json:"last_triggered_at,omitempty"`
	LastStatus      *string        `json:"last_status,omitempty"`
	CreatedAt       time.Time      `json:"created_at"`
	UpdatedAt       time.Time      `json:"updated_at"`
}

OutgoingWebhook represents an outgoing webhook configuration.

type OutgoingWebhookDelivery

type OutgoingWebhookDelivery struct {
	ID           string                `json:"id"`
	WebhookID    string                `json:"webhook_id"`
	Event        WebhookEvent          `json:"event"`
	Payload      map[string]any        `json:"payload"`
	Status       WebhookDeliveryStatus `json:"status"`
	StatusCode   *int                  `json:"status_code,omitempty"`
	ResponseBody *string               `json:"response_body,omitempty"`
	Error        *string               `json:"error,omitempty"`
	Attempts     int                   `json:"attempts"`
	CreatedAt    time.Time             `json:"created_at"`
	DeliveredAt  *time.Time            `json:"delivered_at,omitempty"`
}

OutgoingWebhookDelivery represents a webhook delivery attempt.

type PauseQueueRequest

type PauseQueueRequest struct {
	Reason *string `json:"reason,omitempty"`
}

PauseQueueRequest is the request to pause a queue.

type PauseQueueResponse

type PauseQueueResponse struct {
	QueueName string    `json:"queue_name"`
	Paused    bool      `json:"paused"`
	PausedAt  time.Time `json:"paused_at"`
	Reason    *string   `json:"reason,omitempty"`
}

PauseQueueResponse is the response from pausing a queue.

type PlanInfo

type PlanInfo struct {
	Tier        PlanTier   `json:"tier"`
	DisplayName string     `json:"display_name"`
	Description string     `json:"description"`
	Limits      PlanLimits `json:"limits"`
	Price       *PlanPrice `json:"price,omitempty"`
}

PlanInfo contains information about a subscription plan.

type PlanLimits

type PlanLimits struct {
	Tier                       string `json:"tier"`
	DisplayName                string `json:"display_name"`
	MaxJobsPerDay              *int   `json:"max_jobs_per_day,omitempty"`
	MaxActiveJobs              *int   `json:"max_active_jobs,omitempty"`
	MaxQueues                  *int   `json:"max_queues,omitempty"`
	MaxWorkers                 *int   `json:"max_workers,omitempty"`
	MaxAPIKeys                 *int   `json:"max_api_keys,omitempty"`
	MaxSchedules               *int   `json:"max_schedules,omitempty"`
	MaxWorkflows               *int   `json:"max_workflows,omitempty"`
	MaxWebhooks                *int   `json:"max_webhooks,omitempty"`
	MaxPayloadSizeBytes        int    `json:"max_payload_size_bytes"`
	RateLimitRequestsPerSecond int    `json:"rate_limit_requests_per_second"`
	RateLimitBurst             int    `json:"rate_limit_burst"`
	JobRetentionDays           int    `json:"job_retention_days"`
	HistoryRetentionDays       int    `json:"history_retention_days"`
}

PlanLimits represents the limits for a plan.

type PlanPrice

type PlanPrice struct {
	MonthlyUSD int    `json:"monthly_usd"`
	YearlyUSD  int    `json:"yearly_usd"`
	Currency   string `json:"currency"`
}

PlanPrice represents pricing information for a plan.

type PlanTier

type PlanTier string

PlanTier represents a subscription plan tier.

const (
	PlanTierFree       PlanTier = "free"
	PlanTierStarter    PlanTier = "starter"
	PlanTierPro        PlanTier = "pro"
	PlanTierEnterprise PlanTier = "enterprise"
)

type PurgeDLQRequest

type PurgeDLQRequest struct {
	QueueName *string `json:"queue_name,omitempty"`
}

PurgeDLQRequest is the request to purge DLQ jobs.

type PurgeDLQResponse

type PurgeDLQResponse struct {
	PurgedCount int `json:"purged_count"`
}

PurgeDLQResponse is the response from purging DLQ jobs.

type QueueConfig

type QueueConfig struct {
	ID             string         `json:"id"`
	OrganizationID string         `json:"organization_id"`
	QueueName      string         `json:"queue_name"`
	MaxRetries     int            `json:"max_retries"`
	DefaultTimeout int            `json:"default_timeout"`
	RateLimit      *int           `json:"rate_limit,omitempty"`
	Enabled        bool           `json:"enabled"`
	Settings       map[string]any `json:"settings"`
	CreatedAt      time.Time      `json:"created_at"`
	UpdatedAt      time.Time      `json:"updated_at"`
}

QueueConfig represents full queue configuration (from Get).

type QueueListItem

type QueueListItem struct {
	QueueName      string `json:"queue_name"`
	MaxRetries     int    `json:"max_retries"`
	DefaultTimeout int    `json:"default_timeout"`
	RateLimit      *int   `json:"rate_limit,omitempty"`
	Enabled        bool   `json:"enabled"`
}

QueueListItem represents a queue in list responses (simplified).

type QueueMetrics

type QueueMetrics struct {
	TotalQueues     int `json:"total_queues"`
	TotalPaused     int `json:"total_paused"`
	TotalPending    int `json:"total_pending"`
	TotalProcessing int `json:"total_processing"`
}

QueueMetrics contains queue-related metrics.

type QueueStats

type QueueStats struct {
	QueueName           string `json:"queue_name"`
	PendingJobs         int    `json:"pending_jobs"`
	ProcessingJobs      int    `json:"processing_jobs"`
	CompletedJobs24h    int    `json:"completed_jobs_24h"`
	FailedJobs24h       int    `json:"failed_jobs_24h"`
	AvgProcessingTimeMs *int   `json:"avg_processing_time_ms,omitempty"`
	MaxJobAgeSeconds    *int   `json:"max_job_age_seconds,omitempty"`
	ActiveWorkers       int    `json:"active_workers"`
}

QueueStats represents queue statistics.

type QueueSummary

type QueueSummary struct {
	Name       string `json:"name"`
	Pending    int    `json:"pending"`
	Processing int    `json:"processing"`
	Paused     bool   `json:"paused"`
}

QueueSummary is a queue summary for the dashboard.

type QueuesResource

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

QueuesResource provides access to queue operations.

func NewQueuesResource

func NewQueuesResource(transport *httpx.Transport) *QueuesResource

NewQueuesResource creates a new QueuesResource.

func (*QueuesResource) Delete

func (r *QueuesResource) Delete(ctx context.Context, name string) error

Delete deletes a queue configuration.

func (*QueuesResource) Get

func (r *QueuesResource) Get(ctx context.Context, name string) (*QueueConfig, error)

Get retrieves a specific queue configuration.

func (*QueuesResource) GetStats

func (r *QueuesResource) GetStats(ctx context.Context, name string) (*QueueStats, error)

GetStats retrieves statistics for a queue.

func (*QueuesResource) List

func (r *QueuesResource) List(ctx context.Context) ([]QueueListItem, error)

List retrieves all queue configurations.

func (*QueuesResource) Pause

Pause pauses a queue.

func (*QueuesResource) Resume

func (r *QueuesResource) Resume(ctx context.Context, name string) (*ResumeQueueResponse, error)

Resume resumes a paused queue.

func (*QueuesResource) UpdateConfig

func (r *QueuesResource) UpdateConfig(ctx context.Context, name string, req *UpdateQueueConfigRequest) (*QueueConfig, error)

UpdateConfig updates a queue's configuration.

type RecentActivity

type RecentActivity struct {
	JobsCreated1h   int `json:"jobs_created_1h"`
	JobsCompleted1h int `json:"jobs_completed_1h"`
	JobsFailed1h    int `json:"jobs_failed_1h"`
}

RecentActivity contains recent activity information.

type RefreshRequest

type RefreshRequest struct {
	RefreshToken string `json:"refresh_token"`
}

RefreshRequest is the request to refresh a token.

type RefreshResponse

type RefreshResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
}

RefreshResponse is the response from refreshing a token.

type RegisterWorkerRequest

type RegisterWorkerRequest struct {
	QueueName      string         `json:"queue_name"`
	Hostname       string         `json:"hostname"`
	WorkerType     *string        `json:"worker_type,omitempty"`
	MaxConcurrency *int           `json:"max_concurrency,omitempty"`
	Metadata       map[string]any `json:"metadata,omitempty"`
	Version        *string        `json:"version,omitempty"`
}

RegisterWorkerRequest is the request to register a worker.

type RegisterWorkerResponse

type RegisterWorkerResponse struct {
	ID                   string `json:"id"`
	QueueName            string `json:"queue_name"`
	LeaseDurationSecs    int    `json:"lease_duration_secs"`
	HeartbeatIntervalSec int    `json:"heartbeat_interval_secs"`
}

RegisterWorkerResponse is the response from registering a worker.

type RenewLeaseRequest

type RenewLeaseRequest struct {
	WorkerID         string `json:"worker_id"`
	LeaseDurationSec int    `json:"lease_duration_secs,omitempty"`
}

RenewLeaseRequest is the request to renew a job's lease.

type RenewLeaseResponse

type RenewLeaseResponse struct {
	Success        bool       `json:"success"`
	LeaseExpiresAt *time.Time `json:"lease_expires_at,omitempty"`
}

RenewLeaseResponse is the response from renewing a lease.

type ResourceUsage

type ResourceUsage struct {
	JobsToday  UsageItem `json:"jobs_today"`
	ActiveJobs UsageItem `json:"active_jobs"`
	Queues     UsageItem `json:"queues"`
	Workers    UsageItem `json:"workers"`
	APIKeys    UsageItem `json:"api_keys"`
	Schedules  UsageItem `json:"schedules"`
	Workflows  UsageItem `json:"workflows"`
	Webhooks   UsageItem `json:"webhooks"`
}

ResourceUsage represents current resource usage.

type ResumeQueueResponse

type ResumeQueueResponse struct {
	QueueName          string `json:"queue_name"`
	Resumed            bool   `json:"resumed"`
	PausedDurationSecs int    `json:"paused_duration_secs"`
}

ResumeQueueResponse is the response from resuming a queue.

type RetryDLQRequest

type RetryDLQRequest struct {
	QueueName *string  `json:"queue_name,omitempty"`
	JobIDs    []string `json:"job_ids,omitempty"`
}

RetryDLQRequest is the request to retry DLQ jobs.

type RetryDLQResponse

type RetryDLQResponse struct {
	RetriedCount int      `json:"retried_count"`
	RetriedJobs  []string `json:"retried_jobs,omitempty"`
}

RetryDLQResponse is the response from retrying DLQ jobs.

type RetryDeliveryResponse

type RetryDeliveryResponse struct {
	Success bool    `json:"success"`
	Message *string `json:"message,omitempty"`
	Error   *string `json:"error,omitempty"`
}

RetryDeliveryResponse is the response from retrying a webhook delivery.

type Schedule

type Schedule struct {
	ID              string         `json:"id"`
	OrganizationID  string         `json:"organization_id"`
	Name            string         `json:"name"`
	Description     *string        `json:"description,omitempty"`
	CronExpression  string         `json:"cron_expression"`
	Timezone        string         `json:"timezone"`
	QueueName       string         `json:"queue_name"`
	PayloadTemplate map[string]any `json:"payload_template"`
	Priority        int            `json:"priority"`
	MaxRetries      int            `json:"max_retries"`
	TimeoutSeconds  int            `json:"timeout_seconds"`
	IsActive        bool           `json:"is_active"`
	LastRunAt       *time.Time     `json:"last_run_at,omitempty"`
	NextRunAt       *time.Time     `json:"next_run_at,omitempty"`
	RunCount        int            `json:"run_count"`
	Tags            map[string]any `json:"tags,omitempty"`
	Metadata        map[string]any `json:"metadata,omitempty"`
	CreatedAt       time.Time      `json:"created_at"`
	UpdatedAt       time.Time      `json:"updated_at"`
}

Schedule represents a scheduled job.

type ScheduleRun

type ScheduleRun struct {
	ID           string            `json:"id"`
	ScheduleID   string            `json:"schedule_id"`
	JobID        *string           `json:"job_id,omitempty"`
	Status       ScheduleRunStatus `json:"status"`
	ErrorMessage *string           `json:"error_message,omitempty"`
	StartedAt    time.Time         `json:"started_at"`
	CompletedAt  *time.Time        `json:"completed_at,omitempty"`
}

ScheduleRun represents a schedule execution run.

type ScheduleRunStatus

type ScheduleRunStatus string

ScheduleRunStatus represents the status of a schedule run.

const (
	ScheduleRunStatusPending   ScheduleRunStatus = "pending"
	ScheduleRunStatusRunning   ScheduleRunStatus = "running"
	ScheduleRunStatusCompleted ScheduleRunStatus = "completed"
	ScheduleRunStatusFailed    ScheduleRunStatus = "failed"
)

type SchedulesResource

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

SchedulesResource provides access to schedule operations.

func NewSchedulesResource

func NewSchedulesResource(transport *httpx.Transport) *SchedulesResource

NewSchedulesResource creates a new SchedulesResource.

func (*SchedulesResource) Create

Create creates a new schedule.

func (*SchedulesResource) Delete

func (r *SchedulesResource) Delete(ctx context.Context, id string) error

Delete deletes a schedule.

func (*SchedulesResource) Get

func (r *SchedulesResource) Get(ctx context.Context, id string) (*Schedule, error)

Get retrieves a specific schedule.

func (*SchedulesResource) History

func (r *SchedulesResource) History(ctx context.Context, id string, limit *int) ([]ScheduleRun, error)

History retrieves the run history for a schedule.

func (*SchedulesResource) List

List retrieves all schedules.

func (*SchedulesResource) Pause

func (r *SchedulesResource) Pause(ctx context.Context, id string) (*Schedule, error)

Pause pauses a schedule.

func (*SchedulesResource) Resume

func (r *SchedulesResource) Resume(ctx context.Context, id string) (*Schedule, error)

Resume resumes a paused schedule.

func (*SchedulesResource) Trigger

Trigger manually triggers a schedule.

func (*SchedulesResource) Update

Update updates a schedule.

type StartEmailLoginRequest

type StartEmailLoginRequest struct {
	Email string `json:"email"`
}

StartEmailLoginRequest is the request to start email login.

type StartEmailLoginResponse

type StartEmailLoginResponse struct {
	Success bool    `json:"success"`
	Message *string `json:"message,omitempty"`
}

StartEmailLoginResponse is the response from starting email login.

type StripeIngestOptions

type StripeIngestOptions struct {
	// Timestamp used for signature payload. If 0, current time is used.
	Timestamp int64
	// Signature is the full Stripe-Signature header value (optional if Secret is provided).
	Signature string
	// Secret is used to compute the signature if Signature is not provided.
	Secret string
	// WebhookToken is optional and sent as X-Webhook-Token.
	WebhookToken string
	// ForwardedProto is optional and sent as X-Forwarded-Proto.
	ForwardedProto string
}

StripeIngestOptions configures Stripe webhook ingestion.

type SystemInfo

type SystemInfo struct {
	Version        string `json:"version"`
	UptimeSeconds  int64  `json:"uptime_seconds"`
	StartedAt      string `json:"started_at"`
	DatabaseStatus string `json:"database_status"`
	CacheStatus    string `json:"cache_status"`
	Environment    string `json:"environment"`
}

SystemInfo contains system information.

type SystemMetrics

type SystemMetrics struct {
	UptimeSeconds  int64   `json:"uptime_seconds"`
	RequestsPerSec float64 `json:"requests_per_sec"`
	ErrorRate      float64 `json:"error_rate"`
	AvgLatencyMs   float64 `json:"avg_latency_ms"`
}

SystemMetrics contains system-level metrics.

type TestWebhookResponse

type TestWebhookResponse struct {
	Success        bool    `json:"success"`
	StatusCode     *int    `json:"status_code,omitempty"`
	ResponseTimeMs int     `json:"response_time_ms"`
	Error          *string `json:"error,omitempty"`
}

TestWebhookResponse is the response from testing a webhook.

type TriggerScheduleResponse

type TriggerScheduleResponse struct {
	JobID       string    `json:"job_id"`
	TriggeredAt time.Time `json:"triggered_at"`
}

TriggerScheduleResponse is the response from triggering a schedule.

type UpdateAPIKeyRequest

type UpdateAPIKeyRequest struct {
	Name      *string  `json:"name,omitempty"`
	Queues    []string `json:"queues,omitempty"`
	RateLimit *int     `json:"rate_limit,omitempty"`
	IsActive  *bool    `json:"is_active,omitempty"`
}

UpdateAPIKeyRequest is the request to update an API key.

type UpdateOrganizationRequest

type UpdateOrganizationRequest struct {
	Name         *string        `json:"name,omitempty"`
	BillingEmail *string        `json:"billing_email,omitempty"`
	Settings     map[string]any `json:"settings,omitempty"`
}

UpdateOrganizationRequest is the request to update an organization.

type UpdateOutgoingWebhookRequest

type UpdateOutgoingWebhookRequest struct {
	Name    *string         `json:"name,omitempty"`
	URL     *string         `json:"url,omitempty"`
	Events  *[]WebhookEvent `json:"events,omitempty"`
	Secret  *string         `json:"secret,omitempty"`
	Enabled *bool           `json:"enabled,omitempty"`
}

UpdateOutgoingWebhookRequest is the request to update an outgoing webhook.

type UpdateProgressRequest

type UpdateProgressRequest struct {
	Progress float64 `json:"progress"`
	Message  string  `json:"message,omitempty"`
}

UpdateProgressRequest is the request to update job progress.

type UpdateQueueConfigRequest

type UpdateQueueConfigRequest struct {
	MaxRetries     *int  `json:"max_retries,omitempty"`
	DefaultTimeout *int  `json:"default_timeout,omitempty"`
	RateLimit      *int  `json:"rate_limit,omitempty"`
	Enabled        *bool `json:"enabled,omitempty"`
}

UpdateQueueConfigRequest is the request to update queue configuration.

type UpdateScheduleRequest

type UpdateScheduleRequest struct {
	Name            *string        `json:"name,omitempty"`
	Description     *string        `json:"description,omitempty"`
	CronExpression  *string        `json:"cron_expression,omitempty"`
	Timezone        *string        `json:"timezone,omitempty"`
	QueueName       *string        `json:"queue_name,omitempty"`
	PayloadTemplate map[string]any `json:"payload_template,omitempty"`
	Priority        *int           `json:"priority,omitempty"`
	MaxRetries      *int           `json:"max_retries,omitempty"`
	TimeoutSeconds  *int           `json:"timeout_seconds,omitempty"`
	IsActive        *bool          `json:"is_active,omitempty"`
	Tags            map[string]any `json:"tags,omitempty"`
	Metadata        map[string]any `json:"metadata,omitempty"`
}

UpdateScheduleRequest is the request to update a schedule.

type UsageInfo

type UsageInfo struct {
	Plan            string         `json:"plan"`
	PlanDisplayName string         `json:"plan_display_name"`
	Limits          PlanLimits     `json:"limits"`
	Usage           ResourceUsage  `json:"usage"`
	Warnings        []UsageWarning `json:"warnings,omitempty"`
}

UsageInfo represents organization usage information.

type UsageItem

type UsageItem struct {
	Current    int      `json:"current"`
	Limit      *int     `json:"limit,omitempty"`
	Percentage *float64 `json:"percentage,omitempty"`
	IsDisabled bool     `json:"is_disabled"`
}

UsageItem represents usage for a single resource type.

type UsageWarning

type UsageWarning struct {
	Resource string `json:"resource"`
	Message  string `json:"message"`
	Severity string `json:"severity"`
}

UsageWarning represents a usage warning.

type ValidateRequest

type ValidateRequest struct {
	Token string `json:"token"`
}

ValidateRequest is the request to validate a token.

type ValidateResponse

type ValidateResponse struct {
	Valid          bool       `json:"valid"`
	OrganizationID *string    `json:"organization_id,omitempty"`
	APIKeyID       *string    `json:"api_key_id,omitempty"`
	ExpiresAt      *time.Time `json:"expires_at,omitempty"`
}

ValidateResponse is the response from validating a token.

type VerifyEmailRequest

type VerifyEmailRequest struct {
	Email string `json:"email"`
	Code  string `json:"code"`
}

VerifyEmailRequest is the request to verify an email login code.

type VerifyEmailResponse

type VerifyEmailResponse struct {
	AccessToken      string `json:"access_token"`
	RefreshToken     string `json:"refresh_token"`
	TokenType        string `json:"token_type"`
	ExpiresIn        int    `json:"expires_in"`
	RefreshExpiresIn int    `json:"refresh_expires_in"`
}

VerifyEmailResponse is the response from verifying an email login.

type WebhookDeliveryStatus

type WebhookDeliveryStatus string

WebhookDeliveryStatus represents the status of a webhook delivery.

const (
	WebhookDeliveryStatusPending WebhookDeliveryStatus = "pending"
	WebhookDeliveryStatusSuccess WebhookDeliveryStatus = "success"
	WebhookDeliveryStatusFailed  WebhookDeliveryStatus = "failed"
)

type WebhookEvent

type WebhookEvent string

WebhookEvent represents a webhook event type.

const (
	WebhookEventJobCreated         WebhookEvent = "job.created"
	WebhookEventJobStarted         WebhookEvent = "job.started"
	WebhookEventJobCompleted       WebhookEvent = "job.completed"
	WebhookEventJobFailed          WebhookEvent = "job.failed"
	WebhookEventJobCancelled       WebhookEvent = "job.cancelled"
	WebhookEventQueuePaused        WebhookEvent = "queue.paused"
	WebhookEventQueueResumed       WebhookEvent = "queue.resumed"
	WebhookEventWorkerRegistered   WebhookEvent = "worker.registered"
	WebhookEventWorkerDeregistered WebhookEvent = "worker.deregistered"
	WebhookEventScheduleTriggered  WebhookEvent = "schedule.triggered"
)

type WebhookTokenResponse

type WebhookTokenResponse struct {
	WebhookToken *string `json:"webhook_token,omitempty"`
	WebhookURL   *string `json:"webhook_url,omitempty"`
}

WebhookTokenResponse is the response for webhook token operations.

type WebhooksResource

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

WebhooksResource provides access to outgoing webhook operations.

func NewWebhooksResource

func NewWebhooksResource(transport *httpx.Transport) *WebhooksResource

NewWebhooksResource creates a new WebhooksResource.

func (*WebhooksResource) Create

Create creates a new outgoing webhook.

func (*WebhooksResource) Delete

func (r *WebhooksResource) Delete(ctx context.Context, id string) error

Delete deletes an outgoing webhook.

func (*WebhooksResource) Deliveries

Deliveries retrieves delivery attempts for a webhook.

func (*WebhooksResource) Get

Get retrieves a specific outgoing webhook.

func (*WebhooksResource) List

List retrieves all outgoing webhooks.

func (*WebhooksResource) RetryDelivery

func (r *WebhooksResource) RetryDelivery(ctx context.Context, webhookID, deliveryID string) (*RetryDeliveryResponse, error)

RetryDelivery retries a failed webhook delivery.

func (*WebhooksResource) Test

Test sends a test request to a webhook.

func (*WebhooksResource) Update

Update updates an outgoing webhook.

type Worker

type Worker struct {
	ID             string         `json:"id"`
	OrganizationID string         `json:"organization_id"`
	QueueName      string         `json:"queue_name"`
	Hostname       string         `json:"hostname"`
	WorkerType     *string        `json:"worker_type,omitempty"`
	MaxConcurrency int            `json:"max_concurrency"`
	CurrentJobs    int            `json:"current_jobs"`
	Status         WorkerStatus   `json:"status"`
	LastHeartbeat  time.Time      `json:"last_heartbeat"`
	Metadata       map[string]any `json:"metadata"`
	Version        *string        `json:"version,omitempty"`
	RegisteredAt   time.Time      `json:"registered_at"`
}

Worker represents a worker.

type WorkerHeartbeatRequest

type WorkerHeartbeatRequest struct {
	CurrentJobs int            `json:"current_jobs"`
	Status      *string        `json:"status,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

WorkerHeartbeatRequest is the request for a worker heartbeat.

type WorkerMetrics

type WorkerMetrics struct {
	TotalRegistered int `json:"total_registered"`
	TotalActive     int `json:"total_active"`
	TotalIdle       int `json:"total_idle"`
}

WorkerMetrics contains worker-related metrics.

type WorkerStatus

type WorkerStatus string

WorkerStatus represents the status of a worker.

const (
	WorkerStatusHealthy  WorkerStatus = "healthy"
	WorkerStatusDegraded WorkerStatus = "degraded"
	WorkerStatusOffline  WorkerStatus = "offline"
	WorkerStatusDraining WorkerStatus = "draining"
)

type WorkerSummaryInfo

type WorkerSummaryInfo struct {
	Total     int `json:"total"`
	Healthy   int `json:"healthy"`
	Unhealthy int `json:"unhealthy"`
}

WorkerSummaryInfo contains worker summary information.

type WorkersResource

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

WorkersResource provides access to worker operations.

func NewWorkersResource

func NewWorkersResource(transport *httpx.Transport) *WorkersResource

NewWorkersResource creates a new WorkersResource.

func (*WorkersResource) Deregister

func (r *WorkersResource) Deregister(ctx context.Context, id string) error

Deregister removes a worker registration.

func (*WorkersResource) Get

func (r *WorkersResource) Get(ctx context.Context, id string) (*Worker, error)

Get retrieves a specific worker.

func (*WorkersResource) Heartbeat

func (r *WorkersResource) Heartbeat(ctx context.Context, id string, req *WorkerHeartbeatRequest) error

Heartbeat sends a heartbeat for a worker.

func (*WorkersResource) List

func (r *WorkersResource) List(ctx context.Context) ([]Worker, error)

List retrieves all registered workers.

func (*WorkersResource) Register

Register registers a new worker.

type Workflow

type Workflow struct {
	ID             string         `json:"id"`
	OrganizationID string         `json:"organization_id"`
	Name           string         `json:"name"`
	Description    *string        `json:"description,omitempty"`
	Status         WorkflowStatus `json:"status"`
	TotalJobs      int            `json:"total_jobs"`
	CompletedJobs  int            `json:"completed_jobs"`
	FailedJobs     int            `json:"failed_jobs"`
	CreatedAt      time.Time      `json:"created_at"`
	StartedAt      *time.Time     `json:"started_at,omitempty"`
	CompletedAt    *time.Time     `json:"completed_at,omitempty"`
	Metadata       map[string]any `json:"metadata,omitempty"`
}

Workflow represents a workflow.

type WorkflowJob

type WorkflowJob struct {
	ID             string     `json:"id"`
	Key            string     `json:"key"`
	QueueName      string     `json:"queue_name"`
	Status         JobStatus  `json:"status"`
	DependsOn      []string   `json:"depends_on,omitempty"`
	DependencyMode *string    `json:"dependency_mode,omitempty"`
	CreatedAt      time.Time  `json:"created_at"`
	StartedAt      *time.Time `json:"started_at,omitempty"`
	CompletedAt    *time.Time `json:"completed_at,omitempty"`
}

WorkflowJob represents a job within a workflow with dependencies info.

type WorkflowJobDefinition

type WorkflowJobDefinition struct {
	Key            string          `json:"key"`
	QueueName      string          `json:"queue_name"`
	Payload        map[string]any  `json:"payload"`
	DependsOn      []string        `json:"depends_on,omitempty"`
	DependencyMode *DependencyMode `json:"dependency_mode,omitempty"`
	Priority       *int            `json:"priority,omitempty"`
	MaxRetries     *int            `json:"max_retries,omitempty"`
	TimeoutSeconds *int            `json:"timeout_seconds,omitempty"`
}

WorkflowJobDefinition defines a job within a workflow.

type WorkflowJobMapping

type WorkflowJobMapping struct {
	Key   string `json:"key"`
	JobID string `json:"job_id"`
}

WorkflowJobMapping maps a workflow job key to its job ID.

type WorkflowJobStatus

type WorkflowJobStatus struct {
	Key       string    `json:"key"`
	JobID     string    `json:"job_id"`
	Status    JobStatus `json:"status"`
	DependsOn []string  `json:"depends_on,omitempty"`
}

WorkflowJobStatus represents a job's status in a workflow.

type WorkflowJobStatusResponse

type WorkflowJobStatusResponse struct {
	Jobs []WorkflowJobStatus `json:"jobs"`
}

WorkflowJobStatus represents the status of jobs in a workflow.

type WorkflowJobsResource

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

WorkflowJobsResource provides access to workflow job operations.

func (*WorkflowJobsResource) GetJob

func (r *WorkflowJobsResource) GetJob(ctx context.Context, workflowID, jobID string) (*WorkflowJob, error)

GetJob retrieves a specific job in a workflow.

func (*WorkflowJobsResource) GetJobsStatus

func (r *WorkflowJobsResource) GetJobsStatus(ctx context.Context, workflowID string) (*WorkflowJobStatusResponse, error)

GetJobsStatus retrieves the status of all jobs in a workflow.

func (*WorkflowJobsResource) ListJobs

func (r *WorkflowJobsResource) ListJobs(ctx context.Context, workflowID string) ([]WorkflowJob, error)

ListJobs retrieves all jobs in a workflow.

type WorkflowStatus

type WorkflowStatus string

WorkflowStatus represents the status of a workflow.

const (
	WorkflowStatusPending   WorkflowStatus = "pending"
	WorkflowStatusRunning   WorkflowStatus = "running"
	WorkflowStatusCompleted WorkflowStatus = "completed"
	WorkflowStatusFailed    WorkflowStatus = "failed"
	WorkflowStatusCancelled WorkflowStatus = "cancelled"
)

type WorkflowsResource

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

WorkflowsResource provides access to workflow operations.

func NewWorkflowsResource

func NewWorkflowsResource(transport *httpx.Transport) *WorkflowsResource

NewWorkflowsResource creates a new WorkflowsResource.

func (*WorkflowsResource) AddJobDependencies

func (r *WorkflowsResource) AddJobDependencies(ctx context.Context, jobID string, req *AddDependenciesRequest) (*AddDependenciesResponse, error)

AddJobDependencies adds dependencies to a job.

func (*WorkflowsResource) Cancel

func (r *WorkflowsResource) Cancel(ctx context.Context, id string) error

Cancel cancels a workflow.

func (*WorkflowsResource) Create

Create creates a new workflow.

func (*WorkflowsResource) Get

func (r *WorkflowsResource) Get(ctx context.Context, id string) (*Workflow, error)

Get retrieves a specific workflow.

func (*WorkflowsResource) GetJobDependencies

func (r *WorkflowsResource) GetJobDependencies(ctx context.Context, jobID string) (*JobWithDependencies, error)

GetJobDependencies retrieves dependencies for a job.

func (*WorkflowsResource) Jobs

Jobs returns the workflow jobs sub-resource.

func (*WorkflowsResource) List

List retrieves all workflows.

func (*WorkflowsResource) Retry

func (r *WorkflowsResource) Retry(ctx context.Context, id string) (*Workflow, error)

Retry retries a failed workflow.

Jump to

Keyboard shortcuts

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