types

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package types contains request and response types for the Spooled API.

Package types provides request and response types for the Spooled API.

All types in this package are designed to be serialized to/from JSON with snake_case field names as expected by the Spooled API.

Optional Fields

Optional fields are represented as pointers. Helper functions are provided to create pointers to values:

req := &types.CreateJobRequest{
	QueueName: "emails",
	Payload:   payload,
	Priority:  types.Int(100),     // optional priority
	MaxRetries: types.Int(5),      // optional max retries
}

A nil pointer means the field is left out of the request body entirely, so the server keeps whatever value it already has. Where the API distinguishes "leave alone" from "clear this" - the outgoing webhook signing secret is the one such field - the type carries an explicit companion flag, because a nil pointer alone cannot express an explicit JSON null. See types.UpdateOutgoingWebhookRequest.ClearSecret.

Enums

Enums are represented as string type aliases with constants for known values:

status := types.JobStatusPending

Unknown values returned by the API will be preserved and can be compared as strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to a bool.

func Int

func Int(v int) *int

Int returns a pointer to an int.

func String

func String(v string) *string

String returns a pointer to a string.

func Time

func Time(v time.Time) *time.Time

Time returns a pointer to a time.Time.

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 is coarse: the server records it at most once per key per five
	// minutes, not once per request, so it can trail real usage by that much
	// and stays nil for a key first used moments ago. Do not treat it as a
	// live timestamp or use it to confirm an individual request.
	LastUsed  *time.Time `json:"last_used,omitempty"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

APIKey represents an API key.

type APIKeySummary

type APIKeySummary struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Queues    []string  `json:"queues,omitempty"`
	RateLimit *int      `json:"rate_limit,omitempty"`
	IsActive  bool      `json:"is_active"`
	CreatedAt time.Time `json:"created_at"`
	// LastUsed is coarse: the server records it at most once per key per five
	// minutes, not once per request, so it can trail real usage by that much
	// and stays nil for a key first used moments ago. Do not treat it as a
	// live timestamp or use it to confirm an individual request.
	LastUsed  *time.Time `json:"last_used,omitempty"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

APIKeySummary is a summary of 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 {
	DependenciesAdded int      `json:"dependencies_added"`
	DependenciesMet   bool     `json:"dependencies_met"`
	Success           bool     `json:"success"`
	Dependencies      []string `json:"dependencies,omitempty"`
}

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"`
}

AdminCreateAPIKeyRequest 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 *JsonObject `json:"custom_limits,omitempty"`
}

AdminCreateOrganizationRequest is the admin request to create an organization.

type AdminDeleteOrganizationParams

type AdminDeleteOrganizationParams struct {
	Hard bool `json:"hard"` // If true, performs hard delete
}

AdminDeleteOrganizationParams are parameters for admin deleting an organization.

type AdminJobStats added in v1.3.0

type AdminJobStats struct {
	TotalActive  int `json:"total_active"`
	Pending      int `json:"pending"`
	Processing   int `json:"processing"`
	Completed24h int `json:"completed_24h"`
	Failed24h    int `json:"failed_24h"`
}

AdminJobStats is job counts from GET /admin/stats.

type AdminListOrganizationsParams

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

AdminListOrganizationsParams are parameters for admin listing organizations.

type AdminOrgStats added in v1.3.0

type AdminOrgStats struct {
	Total           int              `json:"total"`
	ByPlan          []AdminPlanCount `json:"by_plan"`
	CreatedToday    int              `json:"created_today"`
	CreatedThisWeek int              `json:"created_this_week"`
}

AdminOrgStats is organization counts from GET /admin/stats.

type AdminPlanCount added in v1.3.0

type AdminPlanCount struct {
	Plan  string `json:"plan"`
	Count int    `json:"count"`
}

AdminPlanCount is one plan's organization count from GET /admin/stats.

type AdminStats

type AdminStats struct {
	Organizations AdminOrgStats    `json:"organizations"`
	Jobs          AdminJobStats    `json:"jobs"`
	Workers       AdminWorkerStats `json:"workers"`
	System        AdminSystemStats `json:"system"`
}

AdminStats is GET /admin/stats — nested org/job/worker/system counts, not flat totals.

type AdminSystemStats added in v1.3.0

type AdminSystemStats struct {
	APIVersion    string `json:"api_version"`
	UptimeSeconds int64  `json:"uptime_seconds"`
}

AdminSystemStats is process info from GET /admin/stats.

type AdminUpdateOrganizationRequest

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

AdminUpdateOrganizationRequest is the admin request to update an organization.

type AdminWorkerStats added in v1.3.0

type AdminWorkerStats struct {
	Total    int `json:"total"`
	Healthy  int `json:"healthy"`
	Degraded int `json:"degraded"`
}

AdminWorkerStats is worker counts from GET /admin/stats.

type BatchJobStatus

type BatchJobStatus struct {
	ID          string     `json:"id"`
	Status      JobStatus  `json:"status"`
	QueueName   string     `json:"queue_name"`
	RetryCount  int        `json:"retry_count"`
	CreatedAt   time.Time  `json:"created_at"`
	CompletedAt *time.Time `json:"completed_at,omitempty"`
}

BatchJobStatus is the status of a job in a batch. GET /jobs/status sends retry_count, not attempt, and has no max_retries.

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        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.

Payload is `any` for the same reason as CreateJobRequest.Payload: the API field is `serde_json::Value`, not an object.

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 {
	Available     bool `json:"available"`
	Exists        bool `json:"exists"`
	SignupEnabled bool `json:"signup_enabled"`
}

CheckEmailResponse is GET /auth/check-email.

type CheckSlugResponse

type CheckSlugResponse struct {
	Available  bool    `json:"available"`
	Valid      bool    `json:"valid"`
	Error      *string `json:"error,omitempty"`
	Suggestion *string `json:"suggestion,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"`
	// Any JSON, matching resources.ClaimedJob and the API's serde_json::Value.
	Payload        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"`
	// LeaseID is the lease fencing token for this claim. Complete, fail and
	// heartbeat require it.
	LeaseID *string `json:"lease_id,omitempty"`
}

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

type CompleteJobRequest

type CompleteJobRequest struct {
	WorkerID string `json:"worker_id"`
	Result   any    `json:"result,omitempty"`
	// LeaseID is the claimed job's lease fencing token. It is required: the
	// API answers a complete without it with 422 VALIDATION_ERROR.
	LeaseID *string `json:"lease_id,omitempty"`
}

CompleteJobRequest is the request to complete a job.

type CompleteJobResponse

type CompleteJobResponse struct {
	Success bool `json:"success"`
}

CompleteJobResponse is the response from completing 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           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              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.

Payload and Tags are `any`, not `map[string]any`: the API stores both as `serde_json::Value`, so a JSON array, string, number or boolean is a valid payload, and a map type could neither send nor round-trip one.

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"`
	// Format is the delivery body; nil means json.
	Format *WebhookFormat `json:"format,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 any     `json:"payload_template"`
	Priority        *int    `json:"priority,omitempty"`
	MaxRetries      *int    `json:"max_retries,omitempty"`
	TimeoutSeconds  *int    `json:"timeout_seconds,omitempty"`
	Tags            any     `json:"tags,omitempty"`
	Metadata        any     `json:"metadata,omitempty"`
}

CreateScheduleRequest is the request to create a schedule.

type CreateScheduleResponse

type CreateScheduleResponse struct {
	ID             string     `json:"id"`
	Name           string     `json:"name"`
	CronExpression string     `json:"cron_expression"`
	NextRunAt      *time.Time `json:"next_run_at,omitempty"`
}

CreateScheduleResponse is the response from creating a schedule.

type CreateWorkflowRequest

type CreateWorkflowRequest struct {
	Name        string                  `json:"name"`
	Description *string                 `json:"description,omitempty"`
	Jobs        []WorkflowJobDefinition `json:"jobs"`
	Metadata    *JsonObject             `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        JsonObject `json:"payload"`
	IdempotencyKey *string    `json:"idempotency_key,omitempty"`
	Priority       *int       `json:"priority,omitempty"`
}

IngestRequest 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 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 DependencyInfo added in v1.3.0

type DependencyInfo struct {
	JobID     string `json:"job_id"`
	QueueName string `json:"queue_name"`
	Status    string `json:"status"`
}

DependencyInfo is one edge on GET /jobs/{id}/dependencies.

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"`
	// LeaseID is the claimed job's lease fencing token. It is required: the
	// API answers a fail without it with 422 VALIDATION_ERROR.
	LeaseID *string `json:"lease_id,omitempty"`
}

FailJobRequest is the request to fail a job.

type FailJobResponse

type FailJobResponse struct {
	Success bool `json:"success"`
}

FailJobResponse is the response from failing a job.

type GenerateSlugResponse

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

GenerateSlugResponse is the response from generating a slug.

type HealthResponse

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

HealthResponse represents the health check response.

type HeartbeatJobRequest

type HeartbeatJobRequest struct {
	WorkerID         string `json:"worker_id"`
	LeaseDurationSec *int   `json:"lease_duration_secs,omitempty"`
	// LeaseID is the claimed job's lease fencing token. It is required: the
	// API answers a heartbeat without it with 422 VALIDATION_ERROR.
	LeaseID *string `json:"lease_id,omitempty"`
}

HeartbeatJobRequest is the request for a job heartbeat.

type HeartbeatJobResponse

type HeartbeatJobResponse struct {
	Success bool `json:"success"`
}

HeartbeatJobResponse is the response from a job heartbeat.

type InboundWebhookDelivery added in v1.5.0

type InboundWebhookDelivery struct {
	ID           string  `json:"id"`
	Provider     string  `json:"provider"`
	EventType    string  `json:"event_type"`
	MatchedQueue *string `json:"matched_queue,omitempty"`
	JobID        *string `json:"job_id,omitempty"`
	// Status is "created" or "duplicate"; nil for entries before API 0.1.122.
	Status    *string   `json:"status,omitempty"`
	CreatedAt time.Time `json:"created_at"`
}

InboundWebhookDelivery is one entry of the inbound webhook log (GET /webhooks/deliveries): an accepted POST /webhooks/{org_id}/custom.

type Job

type Job struct {
	ID                string     `json:"id"`
	OrganizationID    string     `json:"organization_id"`
	QueueName         string     `json:"queue_name"`
	Status            JobStatus  `json:"status"`
	Payload           any        `json:"payload"`
	Result            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              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 JobHistoryEvent added in v1.5.0

type JobHistoryEvent struct {
	ID    string `json:"id"`
	JobID string `json:"job_id"`
	// EventType names the event; the API can add event types.
	EventType string    `json:"event_type"`
	WorkerID  *string   `json:"worker_id,omitempty"`
	Details   any       `json:"details,omitempty"`
	CreatedAt time.Time `json:"created_at"`
}

JobHistoryEvent is one recorded lifecycle event of a job (GET /jobs/{id}/history).

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 JobSummary

type JobSummary struct {
	ID          string     `json:"id"`
	QueueName   string     `json:"queue_name"`
	Status      JobStatus  `json:"status"`
	Priority    int        `json:"priority"`
	RetryCount  int        `json:"attempt"`
	MaxRetries  int        `json:"max_retries"`
	JobType     string     `json:"job_type,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"`
}

JobSummary is a summary of a job.

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 {
	JobID           string           `json:"job_id"`
	Dependencies    []DependencyInfo `json:"dependencies"`
	Dependents      []DependencyInfo `json:"dependents"`
	DependenciesMet bool             `json:"dependencies_met"`
}

JobWithDependencies is GET /jobs/{id}/dependencies.

type JsonObject

type JsonObject = map[string]any

JsonObject is a generic JSON object.

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"`
	Tag       *string    `json:"tag,omitempty"` // Filter by a single tag
	Limit     *int       `json:"limit,omitempty"`
	Offset    *int       `json:"offset,omitempty"`
	OrderBy   *string    `json:"order_by,omitempty"`
	OrderDir  *string    `json:"order_dir,omitempty"`
	// Statuses keeps jobs in any of these statuses (one comma-separated
	// status parameter on the wire).
	Statuses []JobStatus `json:"statuses,omitempty"`
	// Q matches a job whose ID starts with it, or whose queue name or payload
	// job_type contains it (case-insensitive).
	Q *string `json:"q,omitempty"`
	// JobType keeps jobs whose payload job_type is exactly this value.
	JobType *string `json:"job_type,omitempty"`
	// CreatedAfter keeps jobs created at or after this instant (RFC 3339).
	CreatedAfter *time.Time `json:"created_after,omitempty"`
	// CreatedBefore keeps jobs created before this instant (RFC 3339).
	CreatedBefore *time.Time `json:"created_before,omitempty"`
}

ListJobsParams are parameters for listing jobs. See resources.ListJobsParams, which sends them.

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 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                 JsonObject  `json:"settings"`
	CustomLimits             *JsonObject `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 OrganizationSummary

type OrganizationSummary struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Slug      string    `json:"slug"`
	PlanTier  PlanTier  `json:"plan_tier"`
	CreatedAt time.Time `json:"created_at"`
}

OrganizationSummary is a summary of 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"`
	// Format is the delivery body: json (default), slack, discord or teams.
	Format WebhookFormat `json:"format,omitempty"`
	// Enabled turns false on its own after 20 consecutive failed deliveries:
	// the server auto-disables the webhook and it stops receiving events.
	// Re-enable it with an update carrying Enabled set to true - that counts
	// against the plan webhook cap, so it can fail with 429 QUOTA_EXCEEDED.
	Enabled bool `json:"enabled"`
	// FailureCount counts consecutive failed deliveries, one per delivery
	// rather than one per retry attempt, so it is roughly five times smaller
	// than a per-attempt count for the same real-world failures. A successful
	// delivery resets it to 0, including a successful manual retry.
	FailureCount    int        `json:"failure_count"`
	LastTriggeredAt *time.Time `json:"last_triggered_at,omitempty"`
	// LastStatus is "success", "failed" or "auto_disabled". The last of those
	// means the webhook hit 20 consecutive failed deliveries and was disabled.
	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      JsonObject            `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 PaginationParams

type PaginationParams struct {
	Limit    *int    `json:"limit,omitempty"`
	Offset   *int    `json:"offset,omitempty"`
	OrderBy  *string `json:"order_by,omitempty"`
	OrderDir *string `json:"order_dir,omitempty"` // "asc" or "desc"
}

Pagination parameters for list operations.

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"`
	OlderThan *time.Time `json:"older_than,omitempty"`
	Limit     *int       `json:"limit,omitempty"`
	Confirm   bool       `json:"confirm"`
}

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       JsonObject `json:"settings"`
	CreatedAt      time.Time  `json:"created_at"`
	UpdatedAt      time.Time  `json:"updated_at"`
}

QueueConfig represents queue configuration.

type QueueConfigSummary

type QueueConfigSummary 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"`
}

QueueConfigSummary is a summary of queue configuration.

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 is fractional (the API averages in floating point,
	// e.g. 1523.456); decoding it into an int failed the whole response.
	AvgProcessingTimeMs *float64 `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 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 {
	// WorkerID is an optional stable worker identity: 1-128 characters from
	// [A-Za-z0-9._-]. Supplying the same value across restarts makes
	// registration an upsert, so the process reuses one worker row. Leave it
	// nil and the server mints a UUID instead, which means every restart
	// leaves the previous row counting against the plan worker cap until the
	// stale-worker reaper clears it (roughly two minutes) - enough for a
	// crash-looping worker on a tight plan to 429 itself out of registering.
	// Re-registering an ID this organization already owns is not charged
	// against the cap; an ID owned by a different organization returns 409.
	WorkerID       *string     `json:"worker_id,omitempty"`
	QueueName      string      `json:"queue_name"`
	Hostname       string      `json:"hostname"`
	WorkerType     *string     `json:"worker_type,omitempty"`
	MaxConcurrency *int        `json:"max_concurrency,omitempty"`
	Metadata       *JsonObject `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 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"`
	DeliveryID string  `json:"delivery_id"`
	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 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            any        `json:"tags,omitempty"`
	Metadata        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 StartEmailLoginRequest

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

StartEmailLoginRequest is the request to start email login.

type StartEmailLoginResponse

type StartEmailLoginResponse struct {
	Message     string `json:"message"`
	EmailSentTo string `json:"email_sent_to"`
}

StartEmailLoginResponse is POST /auth/email/start.

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 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     *JsonObject `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 replaces the HMAC signing secret. Leave it nil to keep whatever
	// secret the webhook already has.
	Secret *string `json:"secret,omitempty"`
	// ClearSecret sends an explicit null secret, which DELETES the signing
	// secret: deliveries then go out unsigned, with no X-Spooled-Signature
	// header for the receiver to verify. Nothing restores the old value, so
	// set a new Secret to sign again. Setting Secret and ClearSecret together
	// is an error.
	ClearSecret bool `json:"-"`
	// Enabled is how an auto-disabled webhook is brought back: send true after
	// the server disabled it for 20 consecutive failed deliveries. The
	// re-enable counts against the plan webhook cap and can fail with 429
	// QUOTA_EXCEEDED.
	Enabled *bool `json:"enabled,omitempty"`
	// Format changes the delivery body; nil keeps the current one.
	Format *WebhookFormat `json:"format,omitempty"`
}

UpdateOutgoingWebhookRequest is the request to update an outgoing webhook.

A nil field is left out of the request body and the server keeps the current value. The signing secret is the exception: it is three-state, so leaving Secret nil keeps it, setting Secret replaces it, and setting ClearSecret removes it.

func (UpdateOutgoingWebhookRequest) MarshalJSON added in v1.2.0

func (r UpdateOutgoingWebhookRequest) MarshalJSON() ([]byte, error)

MarshalJSON encodes the update request, turning ClearSecret into the explicit JSON null that removes the signing secret. Without it the secret field is omitted entirely, which is what keeps the current secret - a nil *string alone can never express "clear this".

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 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            any     `json:"tags,omitempty"`
	Metadata        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"` // "warning" or "critical"
}

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"`
	Error          *string    `json:"error,omitempty"`
	OrganizationID *string    `json:"organization_id,omitempty"`
	APIKeyID       *string    `json:"api_key_id,omitempty"`
	Queues         []string   `json:"queues,omitempty"`
	ExpiresAt      *time.Time `json:"expires_at,omitempty"`
}

ValidateResponse is POST /auth/validate — `{ valid, error?, claims? }`.

func (*ValidateResponse) UnmarshalJSON added in v1.3.0

func (v *ValidateResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON maps claims.org_id / api_key_id / queues / exp onto the exported fields. A valid token otherwise unmarshals as empty IDs.

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 {
	Type             string `json:"type"`
	AccessToken      string `json:"access_token,omitempty"`
	RefreshToken     string `json:"refresh_token,omitempty"`
	TokenType        string `json:"token_type,omitempty"`
	ExpiresIn        int    `json:"expires_in,omitempty"`
	RefreshExpiresIn int    `json:"refresh_expires_in,omitempty"`
	SignupToken      string `json:"signup_token,omitempty"`
	Email            string `json:"email,omitempty"`
}

VerifyEmailResponse is POST /auth/email/verify — tagged `{type: login|signup, ...}`.

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"
	WebhookEventJobDeadlettered    WebhookEvent = "job.deadlettered"
	WebhookEventJobRetried         WebhookEvent = "job.retried"
	WebhookEventWorkflowCompleted  WebhookEvent = "workflow.completed"
	WebhookEventWorkflowFailed     WebhookEvent = "workflow.failed"
)

type WebhookFormat added in v1.5.0

type WebhookFormat string

WebhookFormat is the body an outgoing webhook is delivered as.

const (
	WebhookFormatJSON    WebhookFormat = "json"
	WebhookFormatSlack   WebhookFormat = "slack"
	WebhookFormatDiscord WebhookFormat = "discord"
	WebhookFormatTeams   WebhookFormat = "teams"
)

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 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       JsonObject   `json:"metadata"`
	Version        *string      `json:"version,omitempty"`
	RegisteredAt   time.Time    `json:"registered_at"`
	// JobsProcessed counts the jobs this worker completed (API 0.1.122+).
	JobsProcessed int64 `json:"jobs_processed"`
	// JobsFailed counts the failures this worker reported (API 0.1.122+).
	JobsFailed int64 `json:"jobs_failed"`
}

Worker represents a worker.

type WorkerHeartbeatRequest

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

WorkerHeartbeatRequest is the request for a worker heartbeat.

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 WorkerSummary

type WorkerSummary struct {
	ID             string       `json:"id"`
	QueueName      string       `json:"queue_name"`
	Hostname       string       `json:"hostname"`
	Status         WorkerStatus `json:"status"`
	CurrentJobs    int          `json:"current_jobs"`
	MaxConcurrency int          `json:"max_concurrency"`
	LastHeartbeat  time.Time    `json:"last_heartbeat"`
	// JobsProcessed counts the jobs this worker completed (API 0.1.122+).
	JobsProcessed int64 `json:"jobs_processed"`
	// JobsFailed counts the failures this worker reported (API 0.1.122+).
	JobsFailed int64 `json:"jobs_failed"`
}

WorkerSummary is a summary of a worker.

type WorkerSummaryInfo

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

WorkerSummaryInfo contains worker summary information.

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       *JsonObject    `json:"metadata,omitempty"`
}

Workflow represents a workflow.

type WorkflowJob

type WorkflowJob struct {
	ID string `json:"id"`
	// Key is empty when read from workflow details: the API returns job keys
	// only in the create response (CreateWorkflowResponse.JobIDs).
	Key            string     `json:"key,omitempty"`
	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        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.

Payload is `any`: `WorkflowJobDefinition.payload` on the API is `serde_json::Value`, so an array or scalar is a valid job payload.

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 is empty unless the API returns job keys (it currently does not).
	Key       string    `json:"key,omitempty"`
	JobID     string    `json:"job_id"`
	Status    JobStatus `json:"status"`
	DependsOn []string  `json:"depends_on,omitempty"`
}

WorkflowJobStatus represents the status of jobs in a workflow.

type WorkflowResponse

type WorkflowResponse struct {
	ID              string         `json:"id"`
	Name            string         `json:"name"`
	Status          WorkflowStatus `json:"status"`
	TotalJobs       int            `json:"total_jobs"`
	CompletedJobs   int            `json:"completed_jobs"`
	FailedJobs      int            `json:"failed_jobs"`
	ProgressPercent float64        `json:"progress_percent"`
	CreatedAt       time.Time      `json:"created_at"`
	CompletedAt     *time.Time     `json:"completed_at,omitempty"`
}

WorkflowResponse is the response for workflow operations.

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"
)

Jump to

Keyboard shortcuts

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