types

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: Apache-2.0 Imports: 1 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
}

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

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

AdminUpdateOrganizationRequest is the admin request to update an organization.

type BatchJobStatus

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

BatchJobStatus is the status of a job in a batch.

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        JsonObject `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        JsonObject `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   *JsonObject `json:"result,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           JsonObject  `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              *JsonObject `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 JsonObject  `json:"payload_template"`
	Priority        *int        `json:"priority,omitempty"`
	MaxRetries      *int        `json:"max_retries,omitempty"`
	TimeoutSeconds  *int        `json:"timeout_seconds,omitempty"`
	Tags            *JsonObject `json:"tags,omitempty"`
	Metadata        *JsonObject `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 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 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"`
}

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 Job

type Job struct {
	ID                string      `json:"id"`
	OrganizationID    string      `json:"organization_id"`
	QueueName         string      `json:"queue_name"`
	Status            JobStatus   `json:"status"`
	Payload           JsonObject  `json:"payload"`
	Result            *JsonObject `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              *JsonObject `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 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:"retry_count"`
	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       *int `json:"avg_wait_time_ms,omitempty"`
	AvgProcessingTimeMs *int `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 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"`
}

ListJobsParams are parameters for listing jobs.

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

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 *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 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       *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 JsonObject  `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            *JsonObject `json:"tags,omitempty"`
	Metadata        *JsonObject `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 {
	Success bool    `json:"success"`
	Message *string `json:"message,omitempty"`
}

StartEmailLoginResponse is the response from starting email login.

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  *string         `json:"secret,omitempty"`
	Enabled *bool           `json:"enabled,omitempty"`
}

UpdateOutgoingWebhookRequest is the request to update an outgoing webhook.

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

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

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            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        JsonObject      `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 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