Documentation
¶
Overview ¶
Package resources provides REST resource implementations for the Spooled API.
Index ¶
- func AddPaginationParams(v url.Values, limit, offset *int)
- type APIKey
- type APIKeysResource
- func (r *APIKeysResource) Create(ctx context.Context, req *CreateAPIKeyRequest) (*CreateAPIKeyResponse, error)
- func (r *APIKeysResource) Delete(ctx context.Context, id string) error
- func (r *APIKeysResource) Get(ctx context.Context, id string) (*APIKey, error)
- func (r *APIKeysResource) List(ctx context.Context) ([]APIKey, error)
- func (r *APIKeysResource) Update(ctx context.Context, id string, req *UpdateAPIKeyRequest) (*APIKey, error)
- type AddDependenciesRequest
- type AddDependenciesResponse
- type AdminCreateAPIKeyRequest
- type AdminCreateOrganizationRequest
- type AdminOrganizationList
- type AdminResource
- func (r *AdminResource) CreateAPIKey(ctx context.Context, orgID string, req *AdminCreateAPIKeyRequest) (*CreateAPIKeyResponse, error)
- func (r *AdminResource) CreateOrganization(ctx context.Context, req *AdminCreateOrganizationRequest) (*CreateOrganizationResponse, error)
- func (r *AdminResource) DeleteOrganization(ctx context.Context, id string, hard bool) error
- func (r *AdminResource) GetOrganization(ctx context.Context, id string) (*Organization, error)
- func (r *AdminResource) GetPlans(ctx context.Context) ([]PlanInfo, error)
- func (r *AdminResource) GetStats(ctx context.Context) (*AdminStats, error)
- func (r *AdminResource) ListOrganizations(ctx context.Context, params *ListOrganizationsParams) (*AdminOrganizationList, error)
- func (r *AdminResource) ResetUsage(ctx context.Context, orgID string) error
- func (r *AdminResource) UpdateOrganization(ctx context.Context, id string, req *AdminUpdateOrganizationRequest) (*Organization, error)
- type AdminStats
- type AdminUpdateOrganizationRequest
- type AuthResource
- func (r *AuthResource) CheckEmail(ctx context.Context, email string) (*CheckEmailResponse, error)
- func (r *AuthResource) Login(ctx context.Context, req *LoginRequest) (*LoginResponse, error)
- func (r *AuthResource) Logout(ctx context.Context) error
- func (r *AuthResource) Me(ctx context.Context) (*MeResponse, error)
- func (r *AuthResource) Refresh(ctx context.Context, req *RefreshRequest) (*RefreshResponse, error)
- func (r *AuthResource) StartEmailLogin(ctx context.Context, req *StartEmailLoginRequest) (*StartEmailLoginResponse, error)
- func (r *AuthResource) Validate(ctx context.Context, req *ValidateRequest) (*ValidateResponse, error)
- func (r *AuthResource) VerifyEmail(ctx context.Context, req *VerifyEmailRequest) (*VerifyEmailResponse, error)
- type Base
- func (b *Base) AdminDelete(ctx context.Context, path string) error
- func (b *Base) AdminGet(ctx context.Context, path string, result any) error
- func (b *Base) AdminPost(ctx context.Context, path string, body any, result any) error
- func (b *Base) AdminPut(ctx context.Context, path string, body any, result any) error
- func (b *Base) Delete(ctx context.Context, path string) error
- func (b *Base) DeleteWithBody(ctx context.Context, path string, body any, result any) error
- func (b *Base) Get(ctx context.Context, path string, result any) error
- func (b *Base) GetWithQuery(ctx context.Context, path string, query url.Values, result any) error
- func (b *Base) Patch(ctx context.Context, path string, body any, result any) error
- func (b *Base) Post(ctx context.Context, path string, body any, result any) error
- func (b *Base) PostIdempotent(ctx context.Context, path string, body any, result any) error
- func (b *Base) Put(ctx context.Context, path string, body any, result any) error
- type BatchJobStatus
- type BillingResource
- type BillingStatus
- type BoostPriorityRequest
- type BoostPriorityResponse
- type BulkEnqueueRequest
- type BulkEnqueueResponse
- type BulkJobFailure
- type BulkJobItem
- type BulkJobSuccess
- type CheckEmailResponse
- type CheckSlugResponse
- type ClaimJobsRequest
- type ClaimJobsResponse
- type ClaimedJob
- type CompleteJobRequest
- type CreateAPIKeyRequest
- type CreateAPIKeyResponse
- type CreateJobRequest
- type CreateJobResponse
- type CreateOrganizationRequest
- type CreateOrganizationResponse
- type CreateOutgoingWebhookRequest
- type CreatePortalRequest
- type CreatePortalResponse
- type CreateScheduleRequest
- type CreateWorkflowRequest
- type CreateWorkflowResponse
- type CustomWebhookRequest
- type CustomWebhookResponse
- type DLQResource
- type DashboardData
- type DashboardResource
- type DependencyMode
- type FailJobRequest
- type FailJobResponse
- type GenerateSlugResponse
- type GitHubIngestOptions
- type HealthResource
- type HealthResponse
- type HeartbeatRequest
- type IngestResource
- func (r *IngestResource) Custom(ctx context.Context, orgID string, req *CustomWebhookRequest) (*CustomWebhookResponse, error)
- func (r *IngestResource) CustomWithToken(ctx context.Context, orgID, webhookToken string, req *CustomWebhookRequest) (*CustomWebhookResponse, error)
- func (r *IngestResource) GitHub(ctx context.Context, orgID string, rawBody []byte, opts *GitHubIngestOptions) error
- func (r *IngestResource) Stripe(ctx context.Context, orgID string, rawBody []byte, opts *StripeIngestOptions) error
- type Job
- type JobMetrics
- type JobStats
- type JobStatus
- type JobSummaryStats
- type JobWithDependencies
- type JobsResource
- func (r *JobsResource) BatchStatus(ctx context.Context, ids []string) ([]BatchJobStatus, error)
- func (r *JobsResource) BoostPriority(ctx context.Context, id string, req *BoostPriorityRequest) (*BoostPriorityResponse, error)
- func (r *JobsResource) BulkEnqueue(ctx context.Context, req *BulkEnqueueRequest) (*BulkEnqueueResponse, error)
- func (r *JobsResource) Cancel(ctx context.Context, id string) error
- func (r *JobsResource) Claim(ctx context.Context, req *ClaimJobsRequest) (*ClaimJobsResponse, error)
- func (r *JobsResource) Complete(ctx context.Context, id string, req *CompleteJobRequest) error
- func (r *JobsResource) Create(ctx context.Context, req *CreateJobRequest) (*CreateJobResponse, error)
- func (r *JobsResource) CreateAndGet(ctx context.Context, req *CreateJobRequest) (*Job, error)
- func (r *JobsResource) DLQ() *DLQResource
- func (r *JobsResource) Fail(ctx context.Context, id string, req *FailJobRequest) error
- func (r *JobsResource) FailWithResponse(ctx context.Context, id string, req *FailJobRequest) (*FailJobResponse, error)
- func (r *JobsResource) Get(ctx context.Context, id string) (*Job, error)
- func (r *JobsResource) GetStats(ctx context.Context) (*JobStats, error)
- func (r *JobsResource) Heartbeat(ctx context.Context, id string, req *HeartbeatRequest) error
- func (r *JobsResource) List(ctx context.Context, params *ListJobsParams) ([]Job, error)
- func (r *JobsResource) RenewLease(ctx context.Context, id string, req *RenewLeaseRequest) (*RenewLeaseResponse, error)
- func (r *JobsResource) Retry(ctx context.Context, id string) (*Job, error)
- func (r *JobsResource) UpdateProgress(ctx context.Context, id string, req *UpdateProgressRequest) error
- type ListDLQParams
- type ListDeliveriesParams
- type ListJobsParams
- type ListOrganizationsParams
- type ListSchedulesParams
- type ListWorkflowsParams
- type LoginRequest
- type LoginResponse
- type MeResponse
- type Metrics
- type MetricsResource
- type Organization
- type OrganizationMember
- type OrganizationsResource
- func (r *OrganizationsResource) CheckSlug(ctx context.Context, slug string) (*CheckSlugResponse, error)
- func (r *OrganizationsResource) ClearWebhookToken(ctx context.Context, id string) error
- func (r *OrganizationsResource) Create(ctx context.Context, req *CreateOrganizationRequest) (*CreateOrganizationResponse, error)
- func (r *OrganizationsResource) Delete(ctx context.Context, id string) error
- func (r *OrganizationsResource) GenerateSlug(ctx context.Context, name string) (*GenerateSlugResponse, error)
- func (r *OrganizationsResource) Get(ctx context.Context, id string) (*Organization, error)
- func (r *OrganizationsResource) GetWebhookToken(ctx context.Context, id string) (*WebhookTokenResponse, error)
- func (r *OrganizationsResource) List(ctx context.Context) ([]Organization, error)
- func (r *OrganizationsResource) Members(ctx context.Context, id string) ([]OrganizationMember, error)
- func (r *OrganizationsResource) RegenerateWebhookToken(ctx context.Context, id string) (*WebhookTokenResponse, error)
- func (r *OrganizationsResource) Update(ctx context.Context, id string, req *UpdateOrganizationRequest) (*Organization, error)
- func (r *OrganizationsResource) Usage(ctx context.Context, id string) (*UsageInfo, error)
- type OutgoingWebhook
- type OutgoingWebhookDelivery
- type PauseQueueRequest
- type PauseQueueResponse
- type PlanInfo
- type PlanLimits
- type PlanPrice
- type PlanTier
- type PurgeDLQRequest
- type PurgeDLQResponse
- type QueueConfig
- type QueueListItem
- type QueueMetrics
- type QueueStats
- type QueueSummary
- type QueuesResource
- func (r *QueuesResource) Delete(ctx context.Context, name string) error
- func (r *QueuesResource) Get(ctx context.Context, name string) (*QueueConfig, error)
- func (r *QueuesResource) GetStats(ctx context.Context, name string) (*QueueStats, error)
- func (r *QueuesResource) List(ctx context.Context) ([]QueueListItem, error)
- func (r *QueuesResource) Pause(ctx context.Context, name string, req *PauseQueueRequest) (*PauseQueueResponse, error)
- func (r *QueuesResource) Resume(ctx context.Context, name string) (*ResumeQueueResponse, error)
- func (r *QueuesResource) UpdateConfig(ctx context.Context, name string, req *UpdateQueueConfigRequest) (*QueueConfig, error)
- type RecentActivity
- type RefreshRequest
- type RefreshResponse
- type RegisterWorkerRequest
- type RegisterWorkerResponse
- type RenewLeaseRequest
- type RenewLeaseResponse
- type ResourceUsage
- type ResumeQueueResponse
- type RetryDLQRequest
- type RetryDLQResponse
- type RetryDeliveryResponse
- type Schedule
- type ScheduleRun
- type ScheduleRunStatus
- type SchedulesResource
- func (r *SchedulesResource) Create(ctx context.Context, req *CreateScheduleRequest) (*Schedule, error)
- func (r *SchedulesResource) Delete(ctx context.Context, id string) error
- func (r *SchedulesResource) Get(ctx context.Context, id string) (*Schedule, error)
- func (r *SchedulesResource) History(ctx context.Context, id string, limit *int) ([]ScheduleRun, error)
- func (r *SchedulesResource) List(ctx context.Context, params *ListSchedulesParams) ([]Schedule, error)
- func (r *SchedulesResource) Pause(ctx context.Context, id string) (*Schedule, error)
- func (r *SchedulesResource) Resume(ctx context.Context, id string) (*Schedule, error)
- func (r *SchedulesResource) Trigger(ctx context.Context, id string) (*TriggerScheduleResponse, error)
- func (r *SchedulesResource) Update(ctx context.Context, id string, req *UpdateScheduleRequest) (*Schedule, error)
- type StartEmailLoginRequest
- type StartEmailLoginResponse
- type StripeIngestOptions
- type SystemInfo
- type SystemMetrics
- type TestWebhookResponse
- type TriggerScheduleResponse
- type UpdateAPIKeyRequest
- type UpdateOrganizationRequest
- type UpdateOutgoingWebhookRequest
- type UpdateProgressRequest
- type UpdateQueueConfigRequest
- type UpdateScheduleRequest
- type UsageInfo
- type UsageItem
- type UsageWarning
- type ValidateRequest
- type ValidateResponse
- type VerifyEmailRequest
- type VerifyEmailResponse
- type WebhookDeliveryStatus
- type WebhookEvent
- type WebhookTokenResponse
- type WebhooksResource
- func (r *WebhooksResource) Create(ctx context.Context, req *CreateOutgoingWebhookRequest) (*OutgoingWebhook, error)
- func (r *WebhooksResource) Delete(ctx context.Context, id string) error
- func (r *WebhooksResource) Deliveries(ctx context.Context, id string, params *ListDeliveriesParams) ([]OutgoingWebhookDelivery, error)
- func (r *WebhooksResource) Get(ctx context.Context, id string) (*OutgoingWebhook, error)
- func (r *WebhooksResource) List(ctx context.Context) ([]OutgoingWebhook, error)
- func (r *WebhooksResource) RetryDelivery(ctx context.Context, webhookID, deliveryID string) (*RetryDeliveryResponse, error)
- func (r *WebhooksResource) Test(ctx context.Context, id string) (*TestWebhookResponse, error)
- func (r *WebhooksResource) Update(ctx context.Context, id string, req *UpdateOutgoingWebhookRequest) (*OutgoingWebhook, error)
- type Worker
- type WorkerHeartbeatRequest
- type WorkerMetrics
- type WorkerStatus
- type WorkerSummary
- type WorkerSummaryInfo
- type WorkersResource
- func (r *WorkersResource) Deregister(ctx context.Context, id string) error
- func (r *WorkersResource) Get(ctx context.Context, id string) (*Worker, error)
- func (r *WorkersResource) Heartbeat(ctx context.Context, id string, req *WorkerHeartbeatRequest) error
- func (r *WorkersResource) List(ctx context.Context) ([]Worker, error)deprecated
- func (r *WorkersResource) ListSummaries(ctx context.Context) ([]WorkerSummary, error)
- func (r *WorkersResource) Register(ctx context.Context, req *RegisterWorkerRequest) (*RegisterWorkerResponse, error)
- type Workflow
- type WorkflowJob
- type WorkflowJobDefinition
- type WorkflowJobMapping
- type WorkflowJobStatus
- type WorkflowJobStatusResponse
- type WorkflowJobsResource
- func (r *WorkflowJobsResource) GetJob(ctx context.Context, workflowID, jobID string) (*WorkflowJob, error)
- func (r *WorkflowJobsResource) GetJobsStatus(ctx context.Context, workflowID string) (*WorkflowJobStatusResponse, error)
- func (r *WorkflowJobsResource) ListJobs(ctx context.Context, workflowID string) ([]WorkflowJob, error)
- type WorkflowStatus
- type WorkflowsResource
- func (r *WorkflowsResource) AddJobDependencies(ctx context.Context, jobID string, req *AddDependenciesRequest) (*AddDependenciesResponse, error)
- func (r *WorkflowsResource) Cancel(ctx context.Context, id string) error
- func (r *WorkflowsResource) Create(ctx context.Context, req *CreateWorkflowRequest) (*CreateWorkflowResponse, error)
- func (r *WorkflowsResource) Get(ctx context.Context, id string) (*Workflow, error)
- func (r *WorkflowsResource) GetJobDependencies(ctx context.Context, jobID string) (*JobWithDependencies, error)
- func (r *WorkflowsResource) Jobs() *WorkflowJobsResource
- func (r *WorkflowsResource) List(ctx context.Context, params *ListWorkflowsParams) ([]Workflow, error)
- func (r *WorkflowsResource) Retry(ctx context.Context, id string) (*Workflow, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPaginationParams ¶
AddPaginationParams adds pagination parameters to query values.
Types ¶
type APIKey ¶
type APIKey struct {
ID string `json:"id"`
OrganizationID *string `json:"organization_id,omitempty"`
Name string `json:"name"`
KeyPrefix *string `json:"key_prefix,omitempty"`
Queues []string `json:"queues,omitempty"`
RateLimit *int `json:"rate_limit,omitempty"`
IsActive bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"`
// LastUsed 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 APIKeysResource ¶
type APIKeysResource struct {
// contains filtered or unexported fields
}
APIKeysResource provides access to API key operations.
func NewAPIKeysResource ¶
func NewAPIKeysResource(transport *httpx.Transport) *APIKeysResource
NewAPIKeysResource creates a new APIKeysResource.
func (*APIKeysResource) Create ¶
func (r *APIKeysResource) Create(ctx context.Context, req *CreateAPIKeyRequest) (*CreateAPIKeyResponse, error)
Create creates a new API key.
func (*APIKeysResource) Delete ¶
func (r *APIKeysResource) Delete(ctx context.Context, id string) error
Delete deletes an API key.
func (*APIKeysResource) List ¶
func (r *APIKeysResource) List(ctx context.Context) ([]APIKey, error)
List retrieves all API keys.
func (*APIKeysResource) Update ¶
func (r *APIKeysResource) Update(ctx context.Context, id string, req *UpdateAPIKeyRequest) (*APIKey, error)
Update updates an API key.
type AddDependenciesRequest ¶
type AddDependenciesRequest struct {
DependsOn []string `json:"depends_on"`
DependencyMode *DependencyMode `json:"dependency_mode,omitempty"`
}
AddDependenciesRequest is the request to add job dependencies.
type AddDependenciesResponse ¶
type AddDependenciesResponse struct {
Success bool `json:"success"`
Dependencies []string `json:"dependencies"`
}
AddDependenciesResponse is the response from adding dependencies.
type AdminCreateAPIKeyRequest ¶
type AdminCreateAPIKeyRequest struct {
Name string `json:"name"`
Queues []string `json:"queues,omitempty"`
RateLimit *int `json:"rate_limit,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
CreateAPIKeyRequest is the admin request to create an API key for an org.
type AdminCreateOrganizationRequest ¶
type AdminCreateOrganizationRequest struct {
Name string `json:"name"`
Slug string `json:"slug"`
PlanTier *PlanTier `json:"plan_tier,omitempty"`
BillingEmail *string `json:"billing_email,omitempty"`
CustomLimits map[string]any `json:"custom_limits,omitempty"`
}
CreateOrganizationRequest is the admin request to create an organization.
type AdminOrganizationList ¶
type AdminOrganizationList struct {
Organizations []Organization `json:"organizations"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
AdminOrganizationList is the paginated response for admin list organizations.
type AdminResource ¶
type AdminResource struct {
// contains filtered or unexported fields
}
AdminResource provides access to admin operations. All operations require the X-Admin-Key header.
func NewAdminResource ¶
func NewAdminResource(transport *httpx.Transport) *AdminResource
NewAdminResource creates a new AdminResource.
func (*AdminResource) CreateAPIKey ¶
func (r *AdminResource) CreateAPIKey(ctx context.Context, orgID string, req *AdminCreateAPIKeyRequest) (*CreateAPIKeyResponse, error)
CreateAPIKey creates an API key for an organization (admin only).
func (*AdminResource) CreateOrganization ¶
func (r *AdminResource) CreateOrganization(ctx context.Context, req *AdminCreateOrganizationRequest) (*CreateOrganizationResponse, error)
CreateOrganization creates an organization (admin only).
func (*AdminResource) DeleteOrganization ¶
DeleteOrganization deletes an organization (admin only).
func (*AdminResource) GetOrganization ¶
func (r *AdminResource) GetOrganization(ctx context.Context, id string) (*Organization, error)
GetOrganization retrieves a specific organization (admin only).
func (*AdminResource) GetPlans ¶
func (r *AdminResource) GetPlans(ctx context.Context) ([]PlanInfo, error)
GetPlans retrieves all available subscription plans.
func (*AdminResource) GetStats ¶
func (r *AdminResource) GetStats(ctx context.Context) (*AdminStats, error)
GetStats retrieves platform-wide statistics.
func (*AdminResource) ListOrganizations ¶
func (r *AdminResource) ListOrganizations(ctx context.Context, params *ListOrganizationsParams) (*AdminOrganizationList, error)
ListOrganizations retrieves all organizations (admin only).
func (*AdminResource) ResetUsage ¶
func (r *AdminResource) ResetUsage(ctx context.Context, orgID string) error
ResetUsage resets usage counters for an organization.
func (*AdminResource) UpdateOrganization ¶
func (r *AdminResource) UpdateOrganization(ctx context.Context, id string, req *AdminUpdateOrganizationRequest) (*Organization, error)
UpdateOrganization updates an organization (admin only).
type AdminStats ¶
type AdminStats struct {
TotalOrganizations int `json:"total_organizations"`
TotalJobs int `json:"total_jobs"`
TotalWorkers int `json:"total_workers"`
TotalQueues int `json:"total_queues"`
TotalAPIKeys int `json:"total_api_keys"`
JobsByStatus map[string]int `json:"jobs_by_status"`
OrganizationsByPlan map[string]int `json:"organizations_by_plan"`
}
AdminStats contains platform-wide statistics.
type AdminUpdateOrganizationRequest ¶
type AdminUpdateOrganizationRequest struct {
Name *string `json:"name,omitempty"`
PlanTier *PlanTier `json:"plan_tier,omitempty"`
BillingEmail *string `json:"billing_email,omitempty"`
CustomLimits map[string]any `json:"custom_limits,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
}
UpdateOrganizationRequest is the admin request to update an organization.
type AuthResource ¶
type AuthResource struct {
// contains filtered or unexported fields
}
AuthResource provides access to authentication operations.
func NewAuthResource ¶
func NewAuthResource(transport *httpx.Transport) *AuthResource
NewAuthResource creates a new AuthResource.
func (*AuthResource) CheckEmail ¶
func (r *AuthResource) CheckEmail(ctx context.Context, email string) (*CheckEmailResponse, error)
CheckEmail checks if an email exists in the system.
func (*AuthResource) Login ¶
func (r *AuthResource) Login(ctx context.Context, req *LoginRequest) (*LoginResponse, error)
Login authenticates with an API key and returns JWT tokens.
func (*AuthResource) Logout ¶
func (r *AuthResource) Logout(ctx context.Context) error
Logout invalidates the current tokens.
func (*AuthResource) Me ¶
func (r *AuthResource) Me(ctx context.Context) (*MeResponse, error)
Me retrieves information about the current authenticated session.
func (*AuthResource) Refresh ¶
func (r *AuthResource) Refresh(ctx context.Context, req *RefreshRequest) (*RefreshResponse, error)
Refresh refreshes an access token using a refresh token.
func (*AuthResource) StartEmailLogin ¶
func (r *AuthResource) StartEmailLogin(ctx context.Context, req *StartEmailLoginRequest) (*StartEmailLoginResponse, error)
StartEmailLogin starts the email login flow by sending a login code.
func (*AuthResource) Validate ¶
func (r *AuthResource) Validate(ctx context.Context, req *ValidateRequest) (*ValidateResponse, error)
Validate validates a token.
func (*AuthResource) VerifyEmail ¶
func (r *AuthResource) VerifyEmail(ctx context.Context, req *VerifyEmailRequest) (*VerifyEmailResponse, error)
VerifyEmail verifies an email login code and returns tokens.
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base provides common functionality for all resources.
func (*Base) AdminDelete ¶
AdminDelete performs a DELETE request with admin key.
func (*Base) DeleteWithBody ¶
DeleteWithBody performs a DELETE request with a body.
func (*Base) GetWithQuery ¶
GetWithQuery performs a GET request with query parameters.
func (*Base) PostIdempotent ¶
PostIdempotent performs an idempotent POST request (can be retried).
type BatchJobStatus ¶
BatchJobStatus is the status of a job in a batch.
type BillingResource ¶
type BillingResource struct {
// contains filtered or unexported fields
}
BillingResource provides access to billing operations.
func NewBillingResource ¶
func NewBillingResource(transport *httpx.Transport) *BillingResource
NewBillingResource creates a new BillingResource.
func (*BillingResource) CreatePortalSession ¶
func (r *BillingResource) CreatePortalSession(ctx context.Context, req *CreatePortalRequest) (*CreatePortalResponse, error)
CreatePortalSession creates a Stripe billing portal session.
func (*BillingResource) GetStatus ¶
func (r *BillingResource) GetStatus(ctx context.Context) (*BillingStatus, error)
GetStatus retrieves billing status for the current organization.
type BillingStatus ¶
type BillingStatus struct {
PlanTier PlanTier `json:"plan_tier"`
StripeSubscriptionID *string `json:"stripe_subscription_id,omitempty"`
StripeSubscriptionStatus *string `json:"stripe_subscription_status,omitempty"`
StripeCurrentPeriodEnd *time.Time `json:"stripe_current_period_end,omitempty"`
StripeCancelAtPeriodEnd *bool `json:"stripe_cancel_at_period_end,omitempty"`
HasStripeCustomer bool `json:"has_stripe_customer"`
}
BillingStatus represents billing status information.
type BoostPriorityRequest ¶
type BoostPriorityRequest struct {
Priority int `json:"priority"`
}
BoostPriorityRequest is the request to boost a job's priority.
type BoostPriorityResponse ¶
type BoostPriorityResponse struct {
JobID string `json:"job_id"`
OldPriority int `json:"old_priority"`
NewPriority int `json:"new_priority"`
}
BoostPriorityResponse is the response from boosting a job's priority.
type BulkEnqueueRequest ¶
type BulkEnqueueRequest struct {
QueueName string `json:"queue_name"`
Jobs []BulkJobItem `json:"jobs"`
DefaultPriority *int `json:"default_priority,omitempty"`
DefaultMaxRetries *int `json:"default_max_retries,omitempty"`
DefaultTimeoutSeconds *int `json:"default_timeout_seconds,omitempty"`
}
BulkEnqueueRequest is the request to bulk enqueue jobs.
type BulkEnqueueResponse ¶
type BulkEnqueueResponse struct {
Succeeded []BulkJobSuccess `json:"succeeded"`
Failed []BulkJobFailure `json:"failed"`
Total int `json:"total"`
SuccessCount int `json:"success_count"`
FailureCount int `json:"failure_count"`
}
BulkEnqueueResponse is the response from bulk enqueueing jobs.
type BulkJobFailure ¶
BulkJobFailure represents a failed job in bulk enqueue.
type BulkJobItem ¶
type BulkJobItem struct {
Payload map[string]any `json:"payload"`
Priority *int `json:"priority,omitempty"`
IdempotencyKey *string `json:"idempotency_key,omitempty"`
ScheduledAt *time.Time `json:"scheduled_at,omitempty"`
}
BulkJobItem is an individual job in a bulk enqueue request.
type BulkJobSuccess ¶
type BulkJobSuccess struct {
Index int `json:"index"`
JobID string `json:"job_id"`
Created bool `json:"created"`
}
BulkJobSuccess represents a successfully enqueued job.
type CheckEmailResponse ¶
type CheckEmailResponse struct {
Exists bool `json:"exists"`
}
CheckEmailResponse is the response from checking if an email exists.
type CheckSlugResponse ¶
type CheckSlugResponse struct {
Available bool `json:"available"`
Slug string `json:"slug"`
Message *string `json:"message,omitempty"`
}
CheckSlugResponse is the response from checking slug availability.
type ClaimJobsRequest ¶
type ClaimJobsRequest struct {
QueueName string `json:"queue_name"`
WorkerID string `json:"worker_id"`
Limit *int `json:"limit,omitempty"`
LeaseDurationSec *int `json:"lease_duration_secs,omitempty"`
}
ClaimJobsRequest is the request to claim jobs.
type ClaimJobsResponse ¶
type ClaimJobsResponse struct {
Jobs []ClaimedJob `json:"jobs"`
}
ClaimJobsResponse is the response from claiming jobs.
type ClaimedJob ¶
type ClaimedJob struct {
ID string `json:"id"`
QueueName string `json:"queue_name"`
Payload map[string]any `json:"payload"`
RetryCount int `json:"retry_count"`
MaxRetries int `json:"max_retries"`
TimeoutSeconds int `json:"timeout_seconds"`
LeaseExpiresAt *time.Time `json:"lease_expires_at,omitempty"`
// LeaseID is the lease fencing token issued by the server for this claim.
// Echo it back on complete/fail/heartbeat so the operation applies only to
// the lease this worker actually holds (nil = legacy worker_id fence).
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 map[string]any `json:"result,omitempty"`
// LeaseID is the lease fencing token from the claimed job. When set, the
// completion succeeds only if it matches the job's current lease.
LeaseID *string `json:"lease_id,omitempty"`
}
CompleteJobRequest is the request to complete a job.
type CreateAPIKeyRequest ¶
type CreateAPIKeyRequest struct {
Name string `json:"name"`
Queues []string `json:"queues,omitempty"`
RateLimit *int `json:"rate_limit,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
CreateAPIKeyRequest is the request to create an API key.
type CreateAPIKeyResponse ¶
type CreateAPIKeyResponse struct {
ID string `json:"id"`
Key string `json:"key"` // Raw key - only shown once!
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
CreateAPIKeyResponse is the response from creating an API key.
type CreateJobRequest ¶
type CreateJobRequest struct {
QueueName string `json:"queue_name"`
Payload map[string]any `json:"payload"`
Priority *int `json:"priority,omitempty"`
MaxRetries *int `json:"max_retries,omitempty"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"`
ScheduledAt *time.Time `json:"scheduled_at,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
IdempotencyKey *string `json:"idempotency_key,omitempty"`
Tags map[string]any `json:"tags,omitempty"`
ParentJobID *string `json:"parent_job_id,omitempty"`
CompletionWebhook *string `json:"completion_webhook,omitempty"`
}
CreateJobRequest is the request to create a new job.
type CreateJobResponse ¶
CreateJobResponse is the response from creating a job.
type CreateOrganizationRequest ¶
type CreateOrganizationRequest struct {
Name string `json:"name"`
Slug string `json:"slug"`
BillingEmail *string `json:"billing_email,omitempty"`
}
CreateOrganizationRequest is the request to create an organization.
type CreateOrganizationResponse ¶
type CreateOrganizationResponse struct {
Organization Organization `json:"organization"`
APIKey CreateAPIKeyResponse `json:"api_key"`
}
CreateOrganizationResponse is the response from creating an organization.
type CreateOutgoingWebhookRequest ¶
type CreateOutgoingWebhookRequest struct {
Name string `json:"name"`
URL string `json:"url"`
Events []WebhookEvent `json:"events"`
Secret *string `json:"secret,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
CreateOutgoingWebhookRequest is the request to create an outgoing webhook.
type CreatePortalRequest ¶
type CreatePortalRequest struct {
ReturnURL string `json:"return_url"`
}
CreatePortalRequest is the request to create a billing portal session.
type CreatePortalResponse ¶
type CreatePortalResponse struct {
URL string `json:"url"`
}
CreatePortalResponse is the response from creating a billing portal session.
type CreateScheduleRequest ¶
type CreateScheduleRequest struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
CronExpression string `json:"cron_expression"`
Timezone *string `json:"timezone,omitempty"`
QueueName string `json:"queue_name"`
PayloadTemplate map[string]any `json:"payload_template"`
Priority *int `json:"priority,omitempty"`
MaxRetries *int `json:"max_retries,omitempty"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"`
Tags map[string]any `json:"tags,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
CreateScheduleRequest is the request to create a schedule.
type CreateWorkflowRequest ¶
type CreateWorkflowRequest struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Jobs []WorkflowJobDefinition `json:"jobs"`
Metadata map[string]any `json:"metadata,omitempty"`
}
CreateWorkflowRequest is the request to create a workflow.
type CreateWorkflowResponse ¶
type CreateWorkflowResponse struct {
WorkflowID string `json:"workflow_id"`
JobIDs []WorkflowJobMapping `json:"job_ids"`
}
CreateWorkflowResponse is the response from creating a workflow.
type CustomWebhookRequest ¶
type CustomWebhookRequest struct {
QueueName string `json:"queue_name"`
EventType *string `json:"event_type,omitempty"`
Payload map[string]any `json:"payload"`
IdempotencyKey *string `json:"idempotency_key,omitempty"`
Priority *int `json:"priority,omitempty"`
}
CustomWebhookRequest is the request to ingest a custom webhook.
type CustomWebhookResponse ¶
CustomWebhookResponse is the response from ingesting a custom webhook.
type DLQResource ¶
type DLQResource struct {
// contains filtered or unexported fields
}
DLQResource provides access to Dead Letter Queue operations.
func (*DLQResource) List ¶
func (r *DLQResource) List(ctx context.Context, params *ListDLQParams) ([]Job, error)
List retrieves dead letter queue jobs.
func (*DLQResource) Purge ¶
func (r *DLQResource) Purge(ctx context.Context, req *PurgeDLQRequest) (*PurgeDLQResponse, error)
Purge removes jobs from the dead letter queue.
func (*DLQResource) Retry ¶
func (r *DLQResource) Retry(ctx context.Context, req *RetryDLQRequest) (*RetryDLQResponse, error)
Retry retries jobs in the dead letter queue.
type DashboardData ¶
type DashboardData struct {
System SystemInfo `json:"system"`
Jobs JobSummaryStats `json:"jobs"`
Queues []QueueSummary `json:"queues"`
Workers WorkerSummaryInfo `json:"workers"`
RecentActivity RecentActivity `json:"recent_activity"`
}
DashboardData represents aggregated dashboard data.
type DashboardResource ¶
type DashboardResource struct {
// contains filtered or unexported fields
}
DashboardResource provides access to dashboard operations.
func NewDashboardResource ¶
func NewDashboardResource(transport *httpx.Transport) *DashboardResource
NewDashboardResource creates a new DashboardResource.
func (*DashboardResource) Get ¶
func (r *DashboardResource) Get(ctx context.Context) (*DashboardData, error)
Get retrieves the dashboard data.
type DependencyMode ¶
type DependencyMode string
DependencyMode specifies how job dependencies are evaluated.
const ( DependencyModeAll DependencyMode = "all" DependencyModeAny DependencyMode = "any" )
type FailJobRequest ¶
type FailJobRequest struct {
WorkerID string `json:"worker_id"`
Error string `json:"error"`
// LeaseID is the lease fencing token from the claimed job. When set, the
// failure succeeds only if it matches the job's current lease.
LeaseID *string `json:"lease_id,omitempty"`
}
FailJobRequest is the request to fail a job.
type FailJobResponse ¶ added in v1.0.20
type FailJobResponse struct {
Success bool `json:"success"`
// WillRetry is nil when an older backend omits retry disposition. Callers can
// then fall back to the retry state captured with the claimed job.
WillRetry *bool `json:"will_retry,omitempty"`
NextRetryDelaySec *int `json:"next_retry_delay_secs,omitempty"`
}
FailJobResponse is returned after the backend accepts a job failure.
type GenerateSlugResponse ¶
type GenerateSlugResponse struct {
Slug string `json:"slug"`
}
GenerateSlugResponse is the response from generating a slug.
type GitHubIngestOptions ¶
type GitHubIngestOptions struct {
// GitHubEvent is the GitHub event name (required), e.g. "push".
GitHubEvent string
// Signature is the full X-Hub-Signature-256 value (optional if Secret is provided).
Signature string
// Secret is used to compute the signature if Signature is not provided.
Secret string
// WebhookToken is optional and sent as X-Webhook-Token.
WebhookToken string
// ForwardedProto is optional and sent as X-Forwarded-Proto.
ForwardedProto string
}
GitHubIngestOptions configures GitHub webhook ingestion.
type HealthResource ¶
type HealthResource struct {
// contains filtered or unexported fields
}
HealthResource provides access to health check operations.
func NewHealthResource ¶
func NewHealthResource(transport *httpx.Transport) *HealthResource
NewHealthResource creates a new HealthResource.
func (*HealthResource) Get ¶
func (r *HealthResource) Get(ctx context.Context) (*HealthResponse, error)
Get performs a full health check.
func (*HealthResource) Liveness ¶
func (r *HealthResource) Liveness(ctx context.Context) (*HealthResponse, error)
Liveness checks if the service is alive.
func (*HealthResource) Readiness ¶
func (r *HealthResource) Readiness(ctx context.Context) (*HealthResponse, error)
Readiness checks if the service is ready to serve requests.
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
Database bool `json:"database"`
Cache bool `json:"cache"`
Timestamp string `json:"timestamp,omitempty"`
}
HealthResponse represents the health check response.
type HeartbeatRequest ¶
type HeartbeatRequest struct {
WorkerID string `json:"worker_id"`
LeaseDurationSec *int `json:"lease_duration_secs,omitempty"`
// LeaseID is the lease fencing token from the claimed job. When set, the
// heartbeat succeeds only if it matches the job's current lease.
LeaseID *string `json:"lease_id,omitempty"`
}
HeartbeatRequest is the request for a job heartbeat.
type IngestResource ¶
type IngestResource struct {
// contains filtered or unexported fields
}
IngestResource provides access to webhook ingestion operations.
func NewIngestResource ¶
func NewIngestResource(transport *httpx.Transport) *IngestResource
NewIngestResource creates a new IngestResource.
func (*IngestResource) Custom ¶
func (r *IngestResource) Custom(ctx context.Context, orgID string, req *CustomWebhookRequest) (*CustomWebhookResponse, error)
Custom ingests a custom webhook for an organization.
func (*IngestResource) CustomWithToken ¶
func (r *IngestResource) CustomWithToken(ctx context.Context, orgID, webhookToken string, req *CustomWebhookRequest) (*CustomWebhookResponse, error)
CustomWithToken ingests a custom webhook using a webhook token via the X-Webhook-Token header.
func (*IngestResource) GitHub ¶
func (r *IngestResource) GitHub(ctx context.Context, orgID string, rawBody []byte, opts *GitHubIngestOptions) error
GitHub ingests a GitHub webhook. The request body must be the exact raw bytes GitHub sent. POST /api/v1/webhooks/{org_id}/github
func (*IngestResource) Stripe ¶
func (r *IngestResource) Stripe(ctx context.Context, orgID string, rawBody []byte, opts *StripeIngestOptions) error
Stripe ingests a Stripe webhook. The request body must be the exact raw bytes Stripe sent. POST /api/v1/webhooks/{org_id}/stripe
type Job ¶
type Job struct {
ID string `json:"id"`
OrganizationID string `json:"organization_id"`
QueueName string `json:"queue_name"`
Status JobStatus `json:"status"`
Payload map[string]any `json:"payload"`
Result map[string]any `json:"result,omitempty"`
RetryCount int `json:"retry_count"`
MaxRetries int `json:"max_retries"`
LastError *string `json:"last_error,omitempty"`
CreatedAt time.Time `json:"created_at"`
ScheduledAt *time.Time `json:"scheduled_at,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
Priority int `json:"priority"`
Tags map[string]any `json:"tags,omitempty"`
TimeoutSeconds int `json:"timeout_seconds"`
ParentJobID *string `json:"parent_job_id,omitempty"`
CompletionWebhook *string `json:"completion_webhook,omitempty"`
AssignedWorkerID *string `json:"assigned_worker_id,omitempty"`
LeaseID *string `json:"lease_id,omitempty"`
LeaseExpiresAt *time.Time `json:"lease_expires_at,omitempty"`
IdempotencyKey *string `json:"idempotency_key,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
WorkflowID *string `json:"workflow_id,omitempty"`
DependencyMode *string `json:"dependency_mode,omitempty"`
DependenciesMet *bool `json:"dependencies_met,omitempty"`
}
Job represents a full job object.
type JobMetrics ¶
type JobMetrics struct {
TotalCreated int64 `json:"total_created"`
TotalCompleted int64 `json:"total_completed"`
TotalFailed int64 `json:"total_failed"`
AvgWaitTimeMs float64 `json:"avg_wait_time_ms"`
AvgProcessingMs float64 `json:"avg_processing_ms"`
}
JobMetrics contains job-related metrics.
type JobStats ¶
type JobStats struct {
Pending int `json:"pending"`
Scheduled int `json:"scheduled"`
Processing int `json:"processing"`
Completed int `json:"completed"`
Failed int `json:"failed"`
Deadletter int `json:"deadletter"`
Cancelled int `json:"cancelled"`
Total int `json:"total"`
}
JobStats represents job statistics.
type JobStatus ¶
type JobStatus string
JobStatus represents the status of a job.
const ( JobStatusPending JobStatus = "pending" JobStatusScheduled JobStatus = "scheduled" JobStatusProcessing JobStatus = "processing" JobStatusCompleted JobStatus = "completed" JobStatusFailed JobStatus = "failed" JobStatusDeadletter JobStatus = "deadletter" JobStatusCancelled JobStatus = "cancelled" )
type JobSummaryStats ¶
type JobSummaryStats struct {
Total int `json:"total"`
Pending int `json:"pending"`
Processing int `json:"processing"`
Completed24h int `json:"completed_24h"`
Failed24h int `json:"failed_24h"`
Deadletter int `json:"deadletter"`
AvgWaitTimeMs *float64 `json:"avg_wait_time_ms,omitempty"`
AvgProcessingTimeMs *float64 `json:"avg_processing_time_ms,omitempty"`
}
JobSummaryStats contains job statistics for the dashboard.
type JobWithDependencies ¶
type JobWithDependencies struct {
Job Job `json:"job"`
Dependencies []string `json:"dependencies"`
Dependents []string `json:"dependents"`
}
JobWithDependencies represents a job with its dependencies.
type JobsResource ¶
type JobsResource struct {
// contains filtered or unexported fields
}
JobsResource provides access to job operations.
func NewJobsResource ¶
func NewJobsResource(transport *httpx.Transport) *JobsResource
NewJobsResource creates a new JobsResource.
func (*JobsResource) BatchStatus ¶
func (r *JobsResource) BatchStatus(ctx context.Context, ids []string) ([]BatchJobStatus, error)
BatchStatus retrieves the status of multiple jobs.
func (*JobsResource) BoostPriority ¶
func (r *JobsResource) BoostPriority(ctx context.Context, id string, req *BoostPriorityRequest) (*BoostPriorityResponse, error)
BoostPriority boosts a job's priority.
func (*JobsResource) BulkEnqueue ¶
func (r *JobsResource) BulkEnqueue(ctx context.Context, req *BulkEnqueueRequest) (*BulkEnqueueResponse, error)
BulkEnqueue bulk enqueues multiple jobs.
func (*JobsResource) Cancel ¶
func (r *JobsResource) Cancel(ctx context.Context, id string) error
Cancel cancels a job.
func (*JobsResource) Claim ¶
func (r *JobsResource) Claim(ctx context.Context, req *ClaimJobsRequest) (*ClaimJobsResponse, error)
Claim claims jobs for a worker.
func (*JobsResource) Complete ¶
func (r *JobsResource) Complete(ctx context.Context, id string, req *CompleteJobRequest) error
Complete marks a job as completed.
func (*JobsResource) Create ¶
func (r *JobsResource) Create(ctx context.Context, req *CreateJobRequest) (*CreateJobResponse, error)
Create creates a new job.
func (*JobsResource) CreateAndGet ¶
func (r *JobsResource) CreateAndGet(ctx context.Context, req *CreateJobRequest) (*Job, error)
CreateAndGet creates a new job and returns the full job object.
func (*JobsResource) DLQ ¶
func (r *JobsResource) DLQ() *DLQResource
DLQ returns the Dead Letter Queue resource.
func (*JobsResource) Fail ¶
func (r *JobsResource) Fail(ctx context.Context, id string, req *FailJobRequest) error
Fail marks a job as failed.
func (*JobsResource) FailWithResponse ¶ added in v1.0.20
func (r *JobsResource) FailWithResponse(ctx context.Context, id string, req *FailJobRequest) (*FailJobResponse, error)
FailWithResponse marks a job as failed and returns the backend's retry disposition when available.
func (*JobsResource) GetStats ¶
func (r *JobsResource) GetStats(ctx context.Context) (*JobStats, error)
GetStats retrieves job statistics.
func (*JobsResource) Heartbeat ¶
func (r *JobsResource) Heartbeat(ctx context.Context, id string, req *HeartbeatRequest) error
Heartbeat sends a heartbeat for a job to extend its lease.
func (*JobsResource) List ¶
func (r *JobsResource) List(ctx context.Context, params *ListJobsParams) ([]Job, error)
List retrieves a list of jobs.
func (*JobsResource) RenewLease ¶
func (r *JobsResource) RenewLease(ctx context.Context, id string, req *RenewLeaseRequest) (*RenewLeaseResponse, error)
RenewLease extends the lease on a job.
func (*JobsResource) UpdateProgress ¶
func (r *JobsResource) UpdateProgress(ctx context.Context, id string, req *UpdateProgressRequest) error
UpdateProgress updates the progress of a job.
type ListDLQParams ¶
type ListDLQParams struct {
QueueName *string `json:"queue_name,omitempty"`
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
}
ListDLQParams are parameters for listing DLQ jobs.
type ListDeliveriesParams ¶
type ListDeliveriesParams struct {
Status *WebhookDeliveryStatus `json:"status,omitempty"`
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
}
ListDeliveriesParams are parameters for listing webhook deliveries.
type ListJobsParams ¶
type ListJobsParams struct {
QueueName *string `json:"queue_name,omitempty"`
Status *JobStatus `json:"status,omitempty"`
Tag *string `json:"tag,omitempty"` // Filter by a single tag
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
}
ListJobsParams are parameters for listing jobs.
type ListOrganizationsParams ¶
type ListOrganizationsParams struct {
PlanTier *PlanTier `json:"plan_tier,omitempty"`
Search *string `json:"search,omitempty"`
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
}
ListOrganizationsParams are parameters for admin listing organizations.
type ListSchedulesParams ¶
type ListSchedulesParams struct {
QueueName *string `json:"queue_name,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
}
ListSchedulesParams are parameters for listing schedules.
type ListWorkflowsParams ¶
type ListWorkflowsParams struct {
Status *WorkflowStatus `json:"status,omitempty"`
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
}
ListWorkflowsParams are parameters for listing workflows.
type LoginRequest ¶
type LoginRequest struct {
APIKey string `json:"api_key"`
}
LoginRequest is the request to login with an API key.
type LoginResponse ¶
type LoginResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
RefreshExpiresIn int `json:"refresh_expires_in"`
}
LoginResponse is the response from logging in.
type MeResponse ¶
type MeResponse struct {
OrganizationID string `json:"organization_id"`
APIKeyID string `json:"api_key_id"`
Queues []string `json:"queues"`
IssuedAt time.Time `json:"issued_at"`
ExpiresAt time.Time `json:"expires_at"`
}
MeResponse is the response from the /auth/me endpoint.
type Metrics ¶
type Metrics struct {
Jobs JobMetrics `json:"jobs"`
Workers WorkerMetrics `json:"workers"`
Queues QueueMetrics `json:"queues"`
System SystemMetrics `json:"system"`
}
Metrics represents system metrics.
type MetricsResource ¶
type MetricsResource struct {
// contains filtered or unexported fields
}
MetricsResource provides access to metrics operations.
func NewMetricsResource ¶
func NewMetricsResource(transport *httpx.Transport) *MetricsResource
NewMetricsResource creates a new MetricsResource.
func (*MetricsResource) Get ¶
func (r *MetricsResource) Get(ctx context.Context) (*Metrics, error)
Get retrieves system metrics.
func (*MetricsResource) Prometheus ¶
func (r *MetricsResource) Prometheus(ctx context.Context) (string, error)
Prometheus retrieves metrics in Prometheus format.
type Organization ¶
type Organization struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
PlanTier PlanTier `json:"plan_tier"`
BillingEmail *string `json:"billing_email,omitempty"`
Settings map[string]any `json:"settings"`
CustomLimits map[string]any `json:"custom_limits,omitempty"`
StripeCustomerID *string `json:"stripe_customer_id,omitempty"`
StripeSubscriptionID *string `json:"stripe_subscription_id,omitempty"`
StripeSubscriptionStatus *string `json:"stripe_subscription_status,omitempty"`
StripeCurrentPeriodEnd *time.Time `json:"stripe_current_period_end,omitempty"`
StripeCancelAtPeriodEnd *bool `json:"stripe_cancel_at_period_end,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Organization represents an organization.
type OrganizationMember ¶
type OrganizationMember struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Email string `json:"email"`
Name string `json:"name"`
Role string `json:"role"`
JoinedAt time.Time `json:"joined_at"`
InvitedBy *string `json:"invited_by,omitempty"`
}
OrganizationMember represents a member of an organization.
type OrganizationsResource ¶
type OrganizationsResource struct {
// contains filtered or unexported fields
}
OrganizationsResource provides access to organization operations.
func NewOrganizationsResource ¶
func NewOrganizationsResource(transport *httpx.Transport) *OrganizationsResource
NewOrganizationsResource creates a new OrganizationsResource.
func (*OrganizationsResource) CheckSlug ¶
func (r *OrganizationsResource) CheckSlug(ctx context.Context, slug string) (*CheckSlugResponse, error)
CheckSlug checks if a slug is available.
func (*OrganizationsResource) ClearWebhookToken ¶
func (r *OrganizationsResource) ClearWebhookToken(ctx context.Context, id string) error
ClearWebhookToken clears the webhook token for an organization.
func (*OrganizationsResource) Create ¶
func (r *OrganizationsResource) Create(ctx context.Context, req *CreateOrganizationRequest) (*CreateOrganizationResponse, error)
Create creates a new organization.
func (*OrganizationsResource) Delete ¶
func (r *OrganizationsResource) Delete(ctx context.Context, id string) error
Delete deletes an organization.
func (*OrganizationsResource) GenerateSlug ¶
func (r *OrganizationsResource) GenerateSlug(ctx context.Context, name string) (*GenerateSlugResponse, error)
GenerateSlug generates a slug from a name.
func (*OrganizationsResource) Get ¶
func (r *OrganizationsResource) Get(ctx context.Context, id string) (*Organization, error)
Get retrieves a specific organization.
func (*OrganizationsResource) GetWebhookToken ¶
func (r *OrganizationsResource) GetWebhookToken(ctx context.Context, id string) (*WebhookTokenResponse, error)
GetWebhookToken retrieves the webhook token for an organization.
func (*OrganizationsResource) List ¶
func (r *OrganizationsResource) List(ctx context.Context) ([]Organization, error)
List retrieves all organizations for the current user.
func (*OrganizationsResource) Members ¶
func (r *OrganizationsResource) Members(ctx context.Context, id string) ([]OrganizationMember, error)
Members retrieves members of an organization.
func (*OrganizationsResource) RegenerateWebhookToken ¶
func (r *OrganizationsResource) RegenerateWebhookToken(ctx context.Context, id string) (*WebhookTokenResponse, error)
RegenerateWebhookToken regenerates the webhook token for an organization.
func (*OrganizationsResource) Update ¶
func (r *OrganizationsResource) Update(ctx context.Context, id string, req *UpdateOrganizationRequest) (*Organization, error)
Update updates 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 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 Update and 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 RetryDelivery.
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 map[string]any `json:"payload"`
Status WebhookDeliveryStatus `json:"status"`
StatusCode *int `json:"status_code,omitempty"`
ResponseBody *string `json:"response_body,omitempty"`
Error *string `json:"error,omitempty"`
Attempts int `json:"attempts"`
CreatedAt time.Time `json:"created_at"`
DeliveredAt *time.Time `json:"delivered_at,omitempty"`
}
OutgoingWebhookDelivery represents a webhook delivery attempt.
type PauseQueueRequest ¶
type PauseQueueRequest struct {
Reason *string `json:"reason,omitempty"`
}
PauseQueueRequest is the request to pause a queue.
type PauseQueueResponse ¶
type PauseQueueResponse struct {
QueueName string `json:"queue_name"`
Paused bool `json:"paused"`
PausedAt time.Time `json:"paused_at"`
Reason *string `json:"reason,omitempty"`
}
PauseQueueResponse is the response from pausing a queue.
type PlanInfo ¶
type PlanInfo struct {
Tier PlanTier `json:"tier"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
Limits PlanLimits `json:"limits"`
Price *PlanPrice `json:"price,omitempty"`
}
PlanInfo contains information about a subscription plan.
type PlanLimits ¶
type PlanLimits struct {
Tier string `json:"tier"`
DisplayName string `json:"display_name"`
MaxJobsPerDay *int `json:"max_jobs_per_day,omitempty"`
MaxActiveJobs *int `json:"max_active_jobs,omitempty"`
MaxQueues *int `json:"max_queues,omitempty"`
MaxWorkers *int `json:"max_workers,omitempty"`
MaxAPIKeys *int `json:"max_api_keys,omitempty"`
MaxSchedules *int `json:"max_schedules,omitempty"`
MaxWorkflows *int `json:"max_workflows,omitempty"`
MaxWebhooks *int `json:"max_webhooks,omitempty"`
MaxPayloadSizeBytes int `json:"max_payload_size_bytes"`
RateLimitRequestsPerSecond int `json:"rate_limit_requests_per_second"`
RateLimitBurst int `json:"rate_limit_burst"`
JobRetentionDays int `json:"job_retention_days"`
HistoryRetentionDays int `json:"history_retention_days"`
}
PlanLimits represents the limits for a plan.
type PlanPrice ¶
type PlanPrice struct {
MonthlyUSD int `json:"monthly_usd"`
YearlyUSD int `json:"yearly_usd"`
Currency string `json:"currency"`
}
PlanPrice represents pricing information for a plan.
type PurgeDLQRequest ¶
type PurgeDLQRequest struct {
QueueName *string `json:"queue_name,omitempty"`
}
PurgeDLQRequest is the request to purge DLQ jobs.
type PurgeDLQResponse ¶
type PurgeDLQResponse struct {
PurgedCount int `json:"purged_count"`
}
PurgeDLQResponse is the response from purging DLQ jobs.
type QueueConfig ¶
type QueueConfig struct {
ID string `json:"id"`
OrganizationID string `json:"organization_id"`
QueueName string `json:"queue_name"`
MaxRetries int `json:"max_retries"`
DefaultTimeout int `json:"default_timeout"`
RateLimit *int `json:"rate_limit,omitempty"`
Enabled bool `json:"enabled"`
Settings map[string]any `json:"settings"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
QueueConfig represents full queue configuration (from Get).
type QueueListItem ¶
type QueueListItem struct {
QueueName string `json:"queue_name"`
MaxRetries int `json:"max_retries"`
DefaultTimeout int `json:"default_timeout"`
RateLimit *int `json:"rate_limit,omitempty"`
Enabled bool `json:"enabled"`
}
QueueListItem represents a queue in list responses (simplified).
type QueueMetrics ¶
type QueueMetrics struct {
TotalQueues int `json:"total_queues"`
TotalPaused int `json:"total_paused"`
TotalPending int `json:"total_pending"`
TotalProcessing int `json:"total_processing"`
}
QueueMetrics contains queue-related metrics.
type QueueStats ¶
type QueueStats struct {
QueueName string `json:"queue_name"`
PendingJobs int `json:"pending_jobs"`
ProcessingJobs int `json:"processing_jobs"`
CompletedJobs24h int `json:"completed_jobs_24h"`
FailedJobs24h int `json:"failed_jobs_24h"`
AvgProcessingTimeMs *int `json:"avg_processing_time_ms,omitempty"`
MaxJobAgeSeconds *int `json:"max_job_age_seconds,omitempty"`
ActiveWorkers int `json:"active_workers"`
}
QueueStats represents queue statistics.
type QueueSummary ¶
type QueueSummary struct {
Name string `json:"name"`
Pending int `json:"pending"`
Processing int `json:"processing"`
Paused bool `json:"paused"`
}
QueueSummary is a queue summary for the dashboard.
type QueuesResource ¶
type QueuesResource struct {
// contains filtered or unexported fields
}
QueuesResource provides access to queue operations.
func NewQueuesResource ¶
func NewQueuesResource(transport *httpx.Transport) *QueuesResource
NewQueuesResource creates a new QueuesResource.
func (*QueuesResource) Delete ¶
func (r *QueuesResource) Delete(ctx context.Context, name string) error
Delete deletes a queue configuration.
func (*QueuesResource) Get ¶
func (r *QueuesResource) Get(ctx context.Context, name string) (*QueueConfig, error)
Get retrieves a specific queue configuration.
func (*QueuesResource) GetStats ¶
func (r *QueuesResource) GetStats(ctx context.Context, name string) (*QueueStats, error)
GetStats retrieves statistics for a queue.
func (*QueuesResource) List ¶
func (r *QueuesResource) List(ctx context.Context) ([]QueueListItem, error)
List retrieves all queue configurations.
func (*QueuesResource) Pause ¶
func (r *QueuesResource) Pause(ctx context.Context, name string, req *PauseQueueRequest) (*PauseQueueResponse, error)
Pause pauses a queue.
func (*QueuesResource) Resume ¶
func (r *QueuesResource) Resume(ctx context.Context, name string) (*ResumeQueueResponse, error)
Resume resumes a paused queue.
func (*QueuesResource) UpdateConfig ¶
func (r *QueuesResource) UpdateConfig(ctx context.Context, name string, req *UpdateQueueConfigRequest) (*QueueConfig, error)
UpdateConfig updates a queue's configuration.
type RecentActivity ¶
type RecentActivity struct {
JobsCreated1h int `json:"jobs_created_1h"`
JobsCompleted1h int `json:"jobs_completed_1h"`
JobsFailed1h int `json:"jobs_failed_1h"`
}
RecentActivity contains recent activity information.
type RefreshRequest ¶
type RefreshRequest struct {
RefreshToken string `json:"refresh_token"`
}
RefreshRequest is the request to refresh a token.
type RefreshResponse ¶
type RefreshResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
}
RefreshResponse is the response from refreshing a token.
type RegisterWorkerRequest ¶
type RegisterWorkerRequest struct {
// 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 map[string]any `json:"metadata,omitempty"`
Version *string `json:"version,omitempty"`
}
RegisterWorkerRequest is the request to register a worker.
type RegisterWorkerResponse ¶
type RegisterWorkerResponse struct {
ID string `json:"id"`
QueueName string `json:"queue_name"`
LeaseDurationSecs int `json:"lease_duration_secs"`
HeartbeatIntervalSec int `json:"heartbeat_interval_secs"`
}
RegisterWorkerResponse is the response from registering a worker.
type RenewLeaseRequest ¶
type RenewLeaseRequest struct {
WorkerID string `json:"worker_id"`
LeaseDurationSec int `json:"lease_duration_secs,omitempty"`
// LeaseID is the lease fencing token from the claimed job. When set, the
// renewal succeeds only if it matches the job's current lease.
LeaseID *string `json:"lease_id,omitempty"`
}
RenewLeaseRequest is the request to renew a job's lease.
type RenewLeaseResponse ¶
type RenewLeaseResponse struct {
Success bool `json:"success"`
LeaseExpiresAt *time.Time `json:"lease_expires_at,omitempty"`
}
RenewLeaseResponse is the response from renewing a lease.
type ResourceUsage ¶
type ResourceUsage struct {
JobsToday UsageItem `json:"jobs_today"`
ActiveJobs UsageItem `json:"active_jobs"`
Queues UsageItem `json:"queues"`
Workers UsageItem `json:"workers"`
APIKeys UsageItem `json:"api_keys"`
Schedules UsageItem `json:"schedules"`
Workflows UsageItem `json:"workflows"`
Webhooks UsageItem `json:"webhooks"`
}
ResourceUsage represents current resource usage.
type ResumeQueueResponse ¶
type ResumeQueueResponse struct {
QueueName string `json:"queue_name"`
Resumed bool `json:"resumed"`
PausedDurationSecs int `json:"paused_duration_secs"`
}
ResumeQueueResponse is the response from resuming a queue.
type RetryDLQRequest ¶
type RetryDLQRequest struct {
QueueName *string `json:"queue_name,omitempty"`
JobIDs []string `json:"job_ids,omitempty"`
}
RetryDLQRequest is the request to retry DLQ jobs.
type RetryDLQResponse ¶
type RetryDLQResponse struct {
RetriedCount int `json:"retried_count"`
RetriedJobs []string `json:"retried_jobs,omitempty"`
}
RetryDLQResponse is the response from retrying DLQ jobs.
type RetryDeliveryResponse ¶
type RetryDeliveryResponse struct {
Success bool `json:"success"`
Message *string `json:"message,omitempty"`
Error *string `json:"error,omitempty"`
}
RetryDeliveryResponse is the response from retrying a webhook delivery.
type Schedule ¶
type Schedule struct {
ID string `json:"id"`
OrganizationID string `json:"organization_id"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
CronExpression string `json:"cron_expression"`
Timezone string `json:"timezone"`
QueueName string `json:"queue_name"`
PayloadTemplate map[string]any `json:"payload_template"`
Priority int `json:"priority"`
MaxRetries int `json:"max_retries"`
TimeoutSeconds int `json:"timeout_seconds"`
IsActive bool `json:"is_active"`
LastRunAt *time.Time `json:"last_run_at,omitempty"`
NextRunAt *time.Time `json:"next_run_at,omitempty"`
RunCount int `json:"run_count"`
Tags map[string]any `json:"tags,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Schedule represents a scheduled job.
type ScheduleRun ¶
type ScheduleRun struct {
ID string `json:"id"`
ScheduleID string `json:"schedule_id"`
JobID *string `json:"job_id,omitempty"`
Status ScheduleRunStatus `json:"status"`
ErrorMessage *string `json:"error_message,omitempty"`
StartedAt time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
ScheduleRun represents a schedule execution run.
type ScheduleRunStatus ¶
type ScheduleRunStatus string
ScheduleRunStatus represents the status of a schedule run.
const ( ScheduleRunStatusPending ScheduleRunStatus = "pending" ScheduleRunStatusRunning ScheduleRunStatus = "running" ScheduleRunStatusCompleted ScheduleRunStatus = "completed" ScheduleRunStatusFailed ScheduleRunStatus = "failed" )
type SchedulesResource ¶
type SchedulesResource struct {
// contains filtered or unexported fields
}
SchedulesResource provides access to schedule operations.
func NewSchedulesResource ¶
func NewSchedulesResource(transport *httpx.Transport) *SchedulesResource
NewSchedulesResource creates a new SchedulesResource.
func (*SchedulesResource) Create ¶
func (r *SchedulesResource) Create(ctx context.Context, req *CreateScheduleRequest) (*Schedule, error)
Create creates a new schedule.
func (*SchedulesResource) Delete ¶
func (r *SchedulesResource) Delete(ctx context.Context, id string) error
Delete deletes a schedule.
func (*SchedulesResource) History ¶
func (r *SchedulesResource) History(ctx context.Context, id string, limit *int) ([]ScheduleRun, error)
History retrieves the run history for a schedule.
func (*SchedulesResource) List ¶
func (r *SchedulesResource) List(ctx context.Context, params *ListSchedulesParams) ([]Schedule, error)
List retrieves all schedules.
func (*SchedulesResource) Trigger ¶
func (r *SchedulesResource) Trigger(ctx context.Context, id string) (*TriggerScheduleResponse, error)
Trigger manually triggers a schedule.
func (*SchedulesResource) Update ¶
func (r *SchedulesResource) Update(ctx context.Context, id string, req *UpdateScheduleRequest) (*Schedule, error)
Update updates a schedule.
type StartEmailLoginRequest ¶
type StartEmailLoginRequest struct {
Email string `json:"email"`
}
StartEmailLoginRequest is the request to start email login.
type StartEmailLoginResponse ¶
type StartEmailLoginResponse struct {
Success bool `json:"success"`
Message *string `json:"message,omitempty"`
}
StartEmailLoginResponse is the response from starting email login.
type StripeIngestOptions ¶
type StripeIngestOptions struct {
// Timestamp used for signature payload. If 0, current time is used.
Timestamp int64
// Signature is the full Stripe-Signature header value (optional if Secret is provided).
Signature string
// Secret is used to compute the signature if Signature is not provided.
Secret string
// WebhookToken is optional and sent as X-Webhook-Token.
WebhookToken string
// ForwardedProto is optional and sent as X-Forwarded-Proto.
ForwardedProto string
}
StripeIngestOptions configures Stripe webhook ingestion.
type SystemInfo ¶
type SystemInfo struct {
Version string `json:"version"`
UptimeSeconds int64 `json:"uptime_seconds"`
StartedAt string `json:"started_at"`
DatabaseStatus string `json:"database_status"`
CacheStatus string `json:"cache_status"`
Environment string `json:"environment"`
}
SystemInfo contains system information.
type SystemMetrics ¶
type SystemMetrics struct {
UptimeSeconds int64 `json:"uptime_seconds"`
RequestsPerSec float64 `json:"requests_per_sec"`
ErrorRate float64 `json:"error_rate"`
AvgLatencyMs float64 `json:"avg_latency_ms"`
}
SystemMetrics contains system-level metrics.
type TestWebhookResponse ¶
type TestWebhookResponse struct {
Success bool `json:"success"`
StatusCode *int `json:"status_code,omitempty"`
ResponseTimeMs int `json:"response_time_ms"`
Error *string `json:"error,omitempty"`
}
TestWebhookResponse is the response from testing a webhook.
type TriggerScheduleResponse ¶
type TriggerScheduleResponse struct {
JobID string `json:"job_id"`
TriggeredAt time.Time `json:"triggered_at"`
}
TriggerScheduleResponse is the response from triggering a schedule.
type UpdateAPIKeyRequest ¶
type UpdateAPIKeyRequest struct {
Name *string `json:"name,omitempty"`
Queues []string `json:"queues,omitempty"`
RateLimit *int `json:"rate_limit,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
}
UpdateAPIKeyRequest is the request to update an API key.
type UpdateOrganizationRequest ¶
type UpdateOrganizationRequest struct {
Name *string `json:"name,omitempty"`
BillingEmail *string `json:"billing_email,omitempty"`
Settings map[string]any `json:"settings,omitempty"`
}
UpdateOrganizationRequest is the request to update an organization.
type UpdateOutgoingWebhookRequest ¶
type UpdateOutgoingWebhookRequest struct {
Name *string `json:"name,omitempty"`
URL *string `json:"url,omitempty"`
Events *[]WebhookEvent `json:"events,omitempty"`
// Secret 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"`
}
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 UpdateProgressRequest ¶
type UpdateProgressRequest struct {
Progress float64 `json:"progress"`
Message string `json:"message,omitempty"`
}
UpdateProgressRequest is the request to update job progress.
type UpdateQueueConfigRequest ¶
type UpdateQueueConfigRequest struct {
MaxRetries *int `json:"max_retries,omitempty"`
DefaultTimeout *int `json:"default_timeout,omitempty"`
RateLimit *int `json:"rate_limit,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
UpdateQueueConfigRequest is the request to update queue configuration.
type UpdateScheduleRequest ¶
type UpdateScheduleRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
CronExpression *string `json:"cron_expression,omitempty"`
Timezone *string `json:"timezone,omitempty"`
QueueName *string `json:"queue_name,omitempty"`
PayloadTemplate map[string]any `json:"payload_template,omitempty"`
Priority *int `json:"priority,omitempty"`
MaxRetries *int `json:"max_retries,omitempty"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
Tags map[string]any `json:"tags,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
UpdateScheduleRequest is the request to update a schedule.
type UsageInfo ¶
type UsageInfo struct {
Plan string `json:"plan"`
PlanDisplayName string `json:"plan_display_name"`
Limits PlanLimits `json:"limits"`
Usage ResourceUsage `json:"usage"`
Warnings []UsageWarning `json:"warnings,omitempty"`
}
UsageInfo represents organization usage information.
type UsageItem ¶
type UsageItem struct {
Current int `json:"current"`
Limit *int `json:"limit,omitempty"`
Percentage *float64 `json:"percentage,omitempty"`
IsDisabled bool `json:"is_disabled"`
}
UsageItem represents usage for a single resource type.
type UsageWarning ¶
type UsageWarning struct {
Resource string `json:"resource"`
Message string `json:"message"`
Severity string `json:"severity"`
}
UsageWarning represents a usage warning.
type ValidateRequest ¶
type ValidateRequest struct {
Token string `json:"token"`
}
ValidateRequest is the request to validate a token.
type ValidateResponse ¶
type ValidateResponse struct {
Valid bool `json:"valid"`
OrganizationID *string `json:"organization_id,omitempty"`
APIKeyID *string `json:"api_key_id,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
ValidateResponse is the response from validating a token.
type VerifyEmailRequest ¶
VerifyEmailRequest is the request to verify an email login code.
type VerifyEmailResponse ¶
type VerifyEmailResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
RefreshExpiresIn int `json:"refresh_expires_in"`
}
VerifyEmailResponse is the response from verifying an email login.
type WebhookDeliveryStatus ¶
type WebhookDeliveryStatus string
WebhookDeliveryStatus represents the status of a webhook delivery.
const ( WebhookDeliveryStatusPending WebhookDeliveryStatus = "pending" WebhookDeliveryStatusSuccess WebhookDeliveryStatus = "success" WebhookDeliveryStatusFailed WebhookDeliveryStatus = "failed" )
type WebhookEvent ¶
type WebhookEvent string
WebhookEvent represents a webhook event type.
const ( WebhookEventJobCreated WebhookEvent = "job.created" WebhookEventJobStarted WebhookEvent = "job.started" WebhookEventJobCompleted WebhookEvent = "job.completed" WebhookEventJobFailed WebhookEvent = "job.failed" WebhookEventJobCancelled WebhookEvent = "job.cancelled" WebhookEventQueuePaused WebhookEvent = "queue.paused" WebhookEventQueueResumed WebhookEvent = "queue.resumed" WebhookEventWorkerRegistered WebhookEvent = "worker.registered" WebhookEventWorkerDeregistered WebhookEvent = "worker.deregistered" WebhookEventScheduleTriggered WebhookEvent = "schedule.triggered" )
type WebhookTokenResponse ¶
type WebhookTokenResponse struct {
WebhookToken *string `json:"webhook_token,omitempty"`
WebhookURL *string `json:"webhook_url,omitempty"`
}
WebhookTokenResponse is the response for webhook token operations.
type WebhooksResource ¶
type WebhooksResource struct {
// contains filtered or unexported fields
}
WebhooksResource provides access to outgoing webhook operations.
func NewWebhooksResource ¶
func NewWebhooksResource(transport *httpx.Transport) *WebhooksResource
NewWebhooksResource creates a new WebhooksResource.
func (*WebhooksResource) Create ¶
func (r *WebhooksResource) Create(ctx context.Context, req *CreateOutgoingWebhookRequest) (*OutgoingWebhook, error)
Create creates a new outgoing webhook.
func (*WebhooksResource) Delete ¶
func (r *WebhooksResource) Delete(ctx context.Context, id string) error
Delete deletes an outgoing webhook.
func (*WebhooksResource) Deliveries ¶
func (r *WebhooksResource) Deliveries(ctx context.Context, id string, params *ListDeliveriesParams) ([]OutgoingWebhookDelivery, error)
Deliveries retrieves delivery attempts for a webhook.
This is not a durable audit log. Only the newest 100 deliveries per webhook are readable, and rows are removed by the per-organization retention sweep once they pass the plan's history retention window: 1 day on free, 7 on starter, 30 on pro, 90 on enterprise. Copy anything you need to keep longer.
func (*WebhooksResource) Get ¶
func (r *WebhooksResource) Get(ctx context.Context, id string) (*OutgoingWebhook, error)
Get retrieves a specific outgoing webhook.
func (*WebhooksResource) List ¶
func (r *WebhooksResource) List(ctx context.Context) ([]OutgoingWebhook, error)
List retrieves all outgoing webhooks.
func (*WebhooksResource) RetryDelivery ¶
func (r *WebhooksResource) RetryDelivery(ctx context.Context, webhookID, deliveryID string) (*RetryDeliveryResponse, error)
RetryDelivery retries a failed webhook delivery. A retry that succeeds resets the webhook's FailureCount to 0.
func (*WebhooksResource) Test ¶
func (r *WebhooksResource) Test(ctx context.Context, id string) (*TestWebhookResponse, error)
Test sends a test request to a webhook.
func (*WebhooksResource) Update ¶
func (r *WebhooksResource) Update(ctx context.Context, id string, req *UpdateOutgoingWebhookRequest) (*OutgoingWebhook, error)
Update updates an outgoing webhook.
Re-enabling an auto-disabled webhook (Enabled set to true) is charged against the plan webhook cap and can fail with 429 QUOTA_EXCEEDED.
type Worker ¶
type Worker struct {
ID string `json:"id"`
OrganizationID string `json:"organization_id"`
QueueName string `json:"queue_name"`
QueueNames []string `json:"queue_names,omitempty"`
Hostname string `json:"hostname"`
WorkerType *string `json:"worker_type,omitempty"`
MaxConcurrency int `json:"max_concurrency"`
CurrentJobs int `json:"current_jobs"`
Status WorkerStatus `json:"status"`
LastHeartbeat time.Time `json:"last_heartbeat"`
Metadata map[string]any `json:"metadata"`
Version *string `json:"version,omitempty"`
RegisteredAt time.Time `json:"registered_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Worker represents a worker.
type WorkerHeartbeatRequest ¶
type WorkerHeartbeatRequest struct {
CurrentJobs int `json:"current_jobs"`
Status *string `json:"status,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
WorkerHeartbeatRequest is the request for a worker heartbeat.
type WorkerMetrics ¶
type WorkerMetrics struct {
TotalRegistered int `json:"total_registered"`
TotalActive int `json:"total_active"`
TotalIdle int `json:"total_idle"`
}
WorkerMetrics contains worker-related metrics.
type WorkerStatus ¶
type WorkerStatus string
WorkerStatus represents the status of a worker.
const ( WorkerStatusHealthy WorkerStatus = "healthy" WorkerStatusDegraded WorkerStatus = "degraded" WorkerStatusOffline WorkerStatus = "offline" WorkerStatusDraining WorkerStatus = "draining" )
type WorkerSummary ¶ added in v1.1.0
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 represents the summary payload returned by the worker list endpoint.
type WorkerSummaryInfo ¶
type WorkerSummaryInfo struct {
Total int `json:"total"`
Healthy int `json:"healthy"`
Unhealthy int `json:"unhealthy"`
}
WorkerSummaryInfo contains worker summary information.
type WorkersResource ¶
type WorkersResource struct {
// contains filtered or unexported fields
}
WorkersResource provides access to worker operations.
func NewWorkersResource ¶
func NewWorkersResource(transport *httpx.Transport) *WorkersResource
NewWorkersResource creates a new WorkersResource.
func (*WorkersResource) Deregister ¶
func (r *WorkersResource) Deregister(ctx context.Context, id string) error
Deregister removes a worker registration.
func (*WorkersResource) Heartbeat ¶
func (r *WorkersResource) Heartbeat(ctx context.Context, id string, req *WorkerHeartbeatRequest) error
Heartbeat sends a heartbeat for a worker.
func (*WorkersResource) ListSummaries ¶ added in v1.1.0
func (r *WorkersResource) ListSummaries(ctx context.Context) ([]WorkerSummary, error)
ListSummaries retrieves worker summaries.
func (*WorkersResource) Register ¶
func (r *WorkersResource) Register(ctx context.Context, req *RegisterWorkerRequest) (*RegisterWorkerResponse, error)
Register registers a new worker.
type Workflow ¶
type Workflow struct {
ID string `json:"id"`
OrganizationID string `json:"organization_id"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Status WorkflowStatus `json:"status"`
TotalJobs int `json:"total_jobs"`
CompletedJobs int `json:"completed_jobs"`
FailedJobs int `json:"failed_jobs"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Workflow represents a workflow.
type WorkflowJob ¶
type WorkflowJob struct {
ID string `json:"id"`
Key string `json:"key"`
QueueName string `json:"queue_name"`
Status JobStatus `json:"status"`
DependsOn []string `json:"depends_on,omitempty"`
DependencyMode *string `json:"dependency_mode,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
WorkflowJob represents a job within a workflow with dependencies info.
type WorkflowJobDefinition ¶
type WorkflowJobDefinition struct {
Key string `json:"key"`
QueueName string `json:"queue_name"`
Payload map[string]any `json:"payload"`
DependsOn []string `json:"depends_on,omitempty"`
DependencyMode *DependencyMode `json:"dependency_mode,omitempty"`
Priority *int `json:"priority,omitempty"`
MaxRetries *int `json:"max_retries,omitempty"`
TimeoutSeconds *int `json:"timeout_seconds,omitempty"`
}
WorkflowJobDefinition defines a job within a workflow.
type WorkflowJobMapping ¶
WorkflowJobMapping maps a workflow job key to its job ID.
type WorkflowJobStatus ¶
type WorkflowJobStatus struct {
Key string `json:"key"`
JobID string `json:"job_id"`
Status JobStatus `json:"status"`
DependsOn []string `json:"depends_on,omitempty"`
}
WorkflowJobStatus represents a job's status in a workflow.
type WorkflowJobStatusResponse ¶
type WorkflowJobStatusResponse struct {
Jobs []WorkflowJobStatus `json:"jobs"`
}
WorkflowJobStatus represents the status of jobs in a workflow.
type WorkflowJobsResource ¶
type WorkflowJobsResource struct {
// contains filtered or unexported fields
}
WorkflowJobsResource provides access to workflow job operations.
func (*WorkflowJobsResource) GetJob ¶
func (r *WorkflowJobsResource) GetJob(ctx context.Context, workflowID, jobID string) (*WorkflowJob, error)
GetJob retrieves a specific job in a workflow.
func (*WorkflowJobsResource) GetJobsStatus ¶
func (r *WorkflowJobsResource) GetJobsStatus(ctx context.Context, workflowID string) (*WorkflowJobStatusResponse, error)
GetJobsStatus retrieves the status of all jobs in a workflow.
func (*WorkflowJobsResource) ListJobs ¶
func (r *WorkflowJobsResource) ListJobs(ctx context.Context, workflowID string) ([]WorkflowJob, error)
ListJobs retrieves all jobs in a workflow.
type WorkflowStatus ¶
type WorkflowStatus string
WorkflowStatus represents the status of a workflow.
const ( WorkflowStatusPending WorkflowStatus = "pending" WorkflowStatusRunning WorkflowStatus = "running" WorkflowStatusCompleted WorkflowStatus = "completed" WorkflowStatusFailed WorkflowStatus = "failed" WorkflowStatusCancelled WorkflowStatus = "cancelled" )
type WorkflowsResource ¶
type WorkflowsResource struct {
// contains filtered or unexported fields
}
WorkflowsResource provides access to workflow operations.
func NewWorkflowsResource ¶
func NewWorkflowsResource(transport *httpx.Transport) *WorkflowsResource
NewWorkflowsResource creates a new WorkflowsResource.
func (*WorkflowsResource) AddJobDependencies ¶
func (r *WorkflowsResource) AddJobDependencies(ctx context.Context, jobID string, req *AddDependenciesRequest) (*AddDependenciesResponse, error)
AddJobDependencies adds dependencies to a job.
func (*WorkflowsResource) Cancel ¶
func (r *WorkflowsResource) Cancel(ctx context.Context, id string) error
Cancel cancels a workflow.
func (*WorkflowsResource) Create ¶
func (r *WorkflowsResource) Create(ctx context.Context, req *CreateWorkflowRequest) (*CreateWorkflowResponse, error)
Create creates a new workflow.
func (*WorkflowsResource) GetJobDependencies ¶
func (r *WorkflowsResource) GetJobDependencies(ctx context.Context, jobID string) (*JobWithDependencies, error)
GetJobDependencies retrieves dependencies for a job.
func (*WorkflowsResource) Jobs ¶
func (r *WorkflowsResource) Jobs() *WorkflowJobsResource
Jobs returns the workflow jobs sub-resource.
func (*WorkflowsResource) List ¶
func (r *WorkflowsResource) List(ctx context.Context, params *ListWorkflowsParams) ([]Workflow, error)
List retrieves all workflows.