scheduler0_go_client

package module
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 8 Imported by: 0

README

Scheduler0 Go Client

Scheduler0 Logo

A Go client library for interacting with the Scheduler0 API. This client provides a convenient way to manage accounts, credentials, executions, executors, projects, jobs, features, create jobs from AI prompts, and monitor the health of your Scheduler0 cluster.

Features

  • Account Management

    • Create accounts
    • Get account details
    • Add/remove features from accounts
  • Feature Management

    • List available features
  • Credentials Management

    • List credentials with pagination and ordering
    • Create new credentials
    • Get credential details
    • Update credentials
    • Delete credentials
  • Executions Management

    • List job executions with date filtering
    • Filter by project ID and job ID
    • View execution details and logs
  • Executors Management

    • List executors with pagination and ordering
    • Create new executors (webhook, cloud function)
    • Get executor details
    • Update executors
    • Delete executors
  • Projects Management

    • List projects with pagination
    • Create new projects
    • Get project details
    • Update projects
    • Delete projects
  • Jobs Management

    • List jobs with pagination and ordering
    • Create new jobs with comprehensive scheduling options
    • Batch create multiple jobs in a single request
    • Get job details
    • Update jobs
    • Delete jobs
  • AI-Powered Job Creation

    • Create job configurations from natural language prompts
    • AI generates cron expressions, scheduling, and job metadata
    • Supports purposes, events, recipients, and channels
  • Async Tasks Management

    • Get async task status by request ID
  • Health Monitoring

    • Check cluster health
    • View raft statistics
    • Monitor leader status

Note: Account Management, Feature Management, and Async Tasks Management APIs are designed for users who run Scheduler0 in their own infrastructure and want granular control over team access and resource usage.

Installation

go get github.com/scheduler0/scheduler0-go-client

API Documentation

  • OpenAPI Specification: openapi.json - Complete API specification

Authentication

The Scheduler0 Go client supports multiple authentication methods:

1. API Key + Secret Authentication (Default)

Most endpoints require API Key and Secret authentication with an Account ID:

client, err := scheduler0_go_client.NewAPIClientWithAccount(
    "http://localhost:7070",  // Base URL
    "v1",                     // API Version
    "your-api-key",           // API Key
    "your-api-secret",        // API Secret
    "123",                    // Account ID
)
2. Basic Authentication (Peer Communication)

For peer-to-peer communication:

client, err := scheduler0_go_client.NewBasicAuthClient(
    "http://localhost:7070",  // Base URL
    "v1",                     // API Version
    "username",               // Username
    "password",               // Password
)
3. Options Pattern

For more flexibility, use the options pattern:

client, err := scheduler0_go_client.NewClient(
    "http://localhost:7070",  // Base URL
    "v1",                     // API Version
    scheduler0_go_client.WithAPIKey("api-key", "api-secret"),
    scheduler0_go_client.WithAccountID("123"),
)

Usage

Managing Accounts
// Create a new account
account := &scheduler0_go_client.AccountCreateRequestBody{
    Name: "My Account",
}
result, err := client.CreateAccount(account)

// Get account details
account, err := client.GetAccount("account-id")

// Add feature to account
feature := &scheduler0_go_client.FeatureRequest{
    FeatureID: 1,
}
result, err := client.AddFeatureToAccount("account-id", feature)

// Remove feature from account
err := client.RemoveFeatureFromAccount("account-id", feature)
Managing Features
// List all available features
features, err := client.ListFeatures()
Managing Credentials
// List credentials with pagination and ordering
credentials, err := client.ListCredentials(scheduler0_go_client.ListCredentialsParams{
    Limit:            10,
    Offset:           0,
    OrderBy:          "date_created",
    OrderByDirection: "desc",
})

// Create a new credential
credential, err := client.CreateCredential()

// Get a specific credential
credential, err := client.GetCredential("credential-id")

// Update a credential
credential, err := client.UpdateCredential("credential-id")

// Delete a credential
err := client.DeleteCredential("credential-id")
Managing Executions
// List executions with date filtering
executions, err := client.ListExecutions(scheduler0_go_client.ListExecutionsParams{
    StartDate: "2024-01-01T00:00:00Z",  // Required: Start date (RFC3339 format)
    EndDate:   "2024-12-31T23:59:59Z",  // Required: End date (RFC3339 format)
    ProjectID: 0,                       // Optional: Project ID (0 for all)
    JobID:     0,                       // Optional: Job ID (0 for all)
    AccountID: 0,                       // Optional: Account ID override (0 uses client default)
    Limit:     10,                      // Required: Maximum number of items
    Offset:    0,                       // Required: Number of items to skip
})
Managing Executors
// List executors with pagination and ordering
executors, err := client.ListExecutors(scheduler0_go_client.ListExecutorsParams{
    AccountID:        0,                // Optional: Account ID override (0 uses client default)
    Limit:            10,
    Offset:           0,
    OrderBy:          "date_created",
    OrderByDirection: "desc",
})

// Create a webhook executor
executor := &scheduler0_go_client.ExecutorRequestBody{
    Name:           "webhook-executor",
    Type:           "webhook_url",
    WebhookURL:     "https://example.com/webhook",
    WebhookMethod:  "POST",
    WebhookSecret:  "secret-key",
}

// Create a cloud function executor
executor := &scheduler0_go_client.ExecutorRequestBody{
    Name:             "cloud-function-executor",
    Type:             "cloud_function",
    Region:           "us-west-1",
    CloudProvider:    "aws",
    CloudResourceURL: "https://example.com/function",
    CloudAPIKey:      "api-key",
    CloudAPISecret:   "api-secret",
}

result, err := client.CreateExecutor(executor)

// Get a specific executor
executor, err := client.GetExecutor("executor-id")

// Update an executor
update := &scheduler0_go_client.ExecutorRequestBody{
    Name: "updated-executor",
    // ... other fields
}
result, err := client.UpdateExecutor("executor-id", update)

// Delete an executor
err := client.DeleteExecutor("executor-id")
Managing Projects
// List projects with pagination and ordering
projects, err := client.ListProjects(scheduler0_go_client.ListProjectsParams{
    AccountID:        0,                // Optional: Account ID override (0 uses client default)
    Limit:            10,
    Offset:           0,
    OrderBy:          "date_created",    // Optional: Field to order by
    OrderByDirection: "desc",            // Optional: Order direction ("asc" or "desc")
})

// Create a new project
project := &scheduler0_go_client.ProjectRequestBody{
    Name:        "My Project",
    Description: "Project description",
}
result, err := client.CreateProject(project)

// Get a specific project
project, err := client.GetProject("project-id")

// Update a project
update := &scheduler0_go_client.ProjectUpdateRequestBody{
    Description: "Updated description",
}
result, err := client.UpdateProject("project-id", update)

// Delete a project
err := client.DeleteProject("project-id")
Managing Jobs
// List jobs with pagination and ordering
jobs, err := client.ListJobs(scheduler0_go_client.ListJobsParams{
    ProjectID:        "",               // Optional: Project ID to filter by (empty string for all)
    Limit:            10,
    Offset:           0,
    OrderBy:          "date_created",
    OrderByDirection: "desc",
})

// Create a single job
job := &scheduler0_go_client.JobRequestBody{
    ProjectID:     123,                    // Required
    Timezone:      "UTC",                  // Required
    ExecutorID:    &executorID,            // Optional
    Data:          "job payload data",     // Optional
    Spec:          "0 30 * * * *",         // Optional
    StartDate:     "2024-01-01T00:00:00Z", // Optional
    EndDate:       "2024-12-31T23:59:59Z", // Optional
    TimezoneOffset: 0,                     // Optional
    RetryMax:      3,                      // Optional
    Status:        "active",               // Optional
}
result, err := client.CreateJob(job)

// Create multiple jobs in a single batch request
jobs := []scheduler0_go_client.JobRequestBody{
    {
        ProjectID:     123,
        Timezone:      "UTC",
        Data:          "job 1 payload",
        Spec:          "0 30 * * * *",
        StartDate:     "2024-01-01T00:00:00Z",
        RetryMax:      3,
    },
    {
        ProjectID:     123,
        Timezone:      "UTC",
        Data:          "job 2 payload",
        Spec:          "0 0 * * * *",
        StartDate:     "2024-01-01T00:00:00Z",
        RetryMax:      5,
    },
}
batchResult, err := client.BatchCreateJobs(jobs)

// Get a specific job
job, err := client.GetJob("job-id")

// Update a job
update := &scheduler0_go_client.JobUpdateRequestBody{
    Data:   "updated payload",
    Spec:   "0 0 * * * *",
    Status: "inactive",
}
result, err := client.UpdateJob("job-id", update)

// Delete a job
err := client.DeleteJob("job-id")
AI-Powered Job Creation

Create job configurations from natural language prompts using AI:

// Create job configurations from a natural language prompt
promptRequest := &scheduler0_go_client.PromptJobRequest{
    Prompt:     "Send weekly reports every Monday at 9 AM",
    Purposes:   []string{"reporting", "communication"},
    Events:     []string{"weekly_cycle"},
    Recipients: []string{"team@example.com", "manager@example.com"},
    Channels:   []string{"email"},
    Timezone:   "America/New_York", // Optional IANA timezone; defaults to "UTC" when omitted.
}

// Generate job configurations from the prompt
// Note: This endpoint requires credits and validates credentials
jobConfigs, err := client.CreateJobFromPrompt(promptRequest)
if err != nil {
    log.Fatal(err)
}

// jobConfigs is an array of PromptJobResponse with generated configurations
for _, config := range jobConfigs {
    fmt.Printf("Kind: %s\n", config.Kind)
    fmt.Printf("Cron Expression: %s\n", config.CronExpression)
    if config.NextRunAt != nil {
        fmt.Printf("Next Run At: %s\n", *config.NextRunAt)
    }
    fmt.Printf("Recipients: %v\n", config.Recipients)
    
    // Use the generated configuration to create actual jobs
    job := &scheduler0_go_client.JobRequestBody{
        ProjectID:  123,
        Timezone:   config.Timezone,
        Spec:       config.CronExpression,
        CreatedBy:  "ai-prompt",
    }
    
    // Set optional fields if available
    if config.StartDate != nil {
        job.StartDate = *config.StartDate
    }
    if config.EndDate != nil {
        job.EndDate = *config.EndDate
    }
    if config.Subject != "" {
        job.Data = fmt.Sprintf(`{"subject": "%s", "recipients": %v}`, config.Subject, config.Recipients)
    }
    
    result, err := client.CreateJob(job)
    if err != nil {
        log.Printf("Failed to create job: %v", err)
        continue
    }
    
    fmt.Printf("Job created with request ID: %s\n", result.Data)
}

Note: The AI prompt endpoint requires:

  • Valid API credentials (API Key + Secret)
  • Account ID header
  • Sufficient credits (1 credit per prompt execution)

The Timezone field is optional. When omitted, the AI assumes UTC. When set to an IANA name (e.g. "America/New_York"), the AI interprets relative phrases like "9am tomorrow" in that timezone and emits nextRunAt / startDate / endDate with the matching numeric offset. Invalid timezone strings are rejected by the API with 400 Bad Request.

Managing Async Tasks
// Get async task status
task, err := client.GetAsyncTask("request-id")
Health Monitoring
// Check cluster health (no authentication required)
health, err := client.Healthcheck()
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Leader: %s\n", health.Data.LeaderAddress)
fmt.Printf("Raft State: %s\n", health.Data.RaftStats.State)

Data Types

Job Status
  • "active" - Job is active and will be executed
  • "inactive" - Job is inactive and will not be executed
Executor Types
  • "webhook_url" - HTTP webhook executor
  • "cloud_function" - Cloud function executor
Webhook Methods
  • "GET", "POST", "PUT", "DELETE"
Job Creation Behavior
  • Single Job Creation: CreateJob() internally uses batch creation with a single job
  • Batch Job Creation: BatchCreateJobs() allows creating multiple jobs in one API call
  • Backend API: The /api/v1/jobs POST endpoint expects an array of jobs for batch processing
  • Response Format: Job creation returns BatchJobResponse with HTTP 202 Accepted status and a Data field containing the request ID (string) for async task tracking
  • Async Tracking: Use the request ID with GetAsyncTask() to track job creation status

Error Handling

The client returns Go errors for API errors. Check the error message for details:

result, err := client.CreateJob(job)
if err != nil {
    if strings.Contains(err.Error(), "API error: 400") {
        // Handle bad request
    } else if strings.Contains(err.Error(), "API error: 401") {
        // Handle unauthorized
    } else if strings.Contains(err.Error(), "API error: 403") {
        // Handle forbidden
    } else if strings.Contains(err.Error(), "API error: 404") {
        // Handle not found
    }
    log.Fatal(err)
}

Account ID Requirements

Most endpoints require the X-Account-ID header. The following endpoints require account ID:

  • /api/v1/jobs/*
  • /api/v1/projects/*
  • /api/v1/credentials/*
  • /api/v1/executors/*
  • /api/v1/async-tasks/*
  • /api/v1/executions
  • /api/v1/prompt (AI prompt endpoint)

Account endpoints (/api/v1/accounts/*) and features (/api/v1/features) do not require account ID.

Per-Request Account ID Override

You can override the Account ID set during client initialization on a per-request basis by including it in the params struct for list methods:

// Override Account ID for a specific request
projects, err := client.ListProjects(scheduler0_go_client.ListProjectsParams{
    AccountID: 456,  // Overrides the client's default Account ID
    Limit:     10,
    Offset:    0,
})

For other methods, the Account ID can be set in the request body's AccountID field (which is excluded from JSON serialization but used for the X-Account-ID header).

Credits and AI Features

The AI prompt endpoint (/api/v1/prompt) requires:

  • Credits: 1 credit per prompt execution
  • Authentication: Valid API Key + Secret credentials
  • Account ID: Required header for credit deduction

Credits are automatically deducted when the prompt is successfully processed. If the prompt processing fails after credit deduction, credits are not refunded.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Development

Running Tests
# Run all tests
go test -v ./...

# Run tests with race detection
go test -v -race ./...

# Run tests with coverage
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
CI/CD

This project uses GitHub Actions for continuous integration. Tests are automatically run on:

  • Push to main, master, or develop branches
  • Pull requests to main, master, or develop branches

The CI pipeline tests against Go 1.23 and 1.24.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID           int64            `json:"id"`
	Name         string           `json:"name"`
	Features     []AccountFeature `json:"features"`
	DateCreated  string           `json:"dateCreated"`
	DateModified *string          `json:"dateModified"`
}

Account represents an account

type AccountAISettings added in v1.5.0

type AccountAISettings struct {
	AccountID          uint64 `json:"account_id,omitempty"`
	Provider           string `json:"provider,omitempty"`
	Model              string `json:"model,omitempty"`
	OpenAIAPIKey       string `json:"openai_api_key,omitempty"`
	AnthropicAPIKey    string `json:"anthropic_api_key,omitempty"`
	BedrockAccessKeyID string `json:"bedrock_access_key_id,omitempty"`
	BedrockSecretKey   string `json:"bedrock_secret_key,omitempty"`
	BedrockRegion      string `json:"bedrock_region,omitempty"`
}

AccountAISettings holds per-account AI provider credentials.

type AccountAISettingsResponse added in v1.5.0

type AccountAISettingsResponse struct {
	Success bool              `json:"success"`
	Data    AccountAISettings `json:"data"`
}

AccountAISettingsResponse wraps the standard API envelope for a single settings object.

type AccountCreateRequestBody

type AccountCreateRequestBody struct {
	Name string `json:"name"`
}

AccountCreateRequestBody represents the request body for creating an account

type AccountExecutionCountIncreaseResponse added in v1.3.2

type AccountExecutionCountIncreaseResponse struct {
	Success bool `json:"success"`
	Data    struct {
		NewExecutionCount uint64 `json:"newExecutionCount"`
	} `json:"data"`
}

AccountExecutionCountIncreaseResponse represents the response for increasing account execution count

type AccountExecutionCountResponse added in v1.3.1

type AccountExecutionCountResponse struct {
	Success bool                      `json:"success"`
	Data    AccountJobExecutionsCount `json:"data"`
}

AccountExecutionCountResponse represents the response for account execution count

type AccountFeature

type AccountFeature struct {
	AccountID int64  `json:"accountId"`
	FeatureID int64  `json:"featureId"`
	Feature   string `json:"feature"`
}

AccountFeature represents a feature associated with an account

type AccountJobExecutionsCount added in v1.3.1

type AccountJobExecutionsCount struct {
	ID             int64  `json:"id"`
	AccountID      int64  `json:"accountId"`
	ExecutionCount int64  `json:"executionCount"`
	Tokens         int64  `json:"tokens"`
	DateCreated    string `json:"dateCreated"`
	DateModified   string `json:"dateModified"`
	NextResetDate  string `json:"nextResetDate"`
}

AccountJobExecutionsCount represents the execution count for an account

type AccountResponse

type AccountResponse struct {
	Success bool    `json:"success"`
	Data    Account `json:"data"`
}

AccountResponse represents the response for a single account

type AccountTokensAddRequest added in v1.5.0

type AccountTokensAddRequest struct {
	Amount int64 `json:"amount"`
}

AccountTokensAddRequest represents the request body for adding tokens

type AccountTokensAddResponse added in v1.5.0

type AccountTokensAddResponse struct {
	Success bool `json:"success"`
	Data    struct {
		NewBalance int64 `json:"newBalance"`
	} `json:"data"`
}

AccountTokensAddResponse represents the response for adding tokens to an account

type AccountTokensResponse added in v1.5.0

type AccountTokensResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Tokens int64 `json:"tokens"`
	} `json:"data"`
}

AccountTokensResponse represents the response for getting account token balance

type AsyncTask

type AsyncTask struct {
	ID          int64  `json:"id"`
	RequestID   string `json:"requestId"`
	Input       string `json:"input"`
	Output      string `json:"output"`
	Service     string `json:"service"`
	State       int    `json:"state"`
	DateCreated string `json:"dateCreated"`
}

AsyncTask represents an async task

type AsyncTaskResponse

type AsyncTaskResponse struct {
	Success bool      `json:"success"`
	Data    AsyncTask `json:"data"`
}

AsyncTaskResponse represents the response for a single async task

type BackupRestoreResponse added in v1.4.0

type BackupRestoreResponse struct {
	Data    map[string]string `json:"data"`
	Success bool              `json:"success"`
}

BackupRestoreResponse is the response from backup/restore initiation

type BatchJobResponse added in v1.2.0

type BatchJobResponse struct {
	Success bool   `json:"success"`
	Data    string `json:"data"`
}

BatchJobResponse represents the response for batch job creation

type CleanupOldLogsRequestBody added in v1.3.1

type CleanupOldLogsRequestBody struct {
	AccountID       string `json:"accountId"`
	RetentionMonths int    `json:"retentionMonths"`
}

type CleanupOldLogsResponse added in v1.3.1

type CleanupOldLogsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Message string `json:"message"`
	} `json:"data"`
}

type Client

type Client struct {
	BaseURL    *url.URL
	HTTPClient *http.Client
	APIKey     string
	APISecret  string
	Version    string
	// Basic Auth for peer communication
	Username string
	Password string
	// Account ID for most endpoints
	AccountID string
}

func NewAPIClient

func NewAPIClient(baseURL, version, apiKey, apiSecret string) (*Client, error)

NewAPIClient creates a client with API key authentication

func NewAPIClientWithAccount

func NewAPIClientWithAccount(baseURL, version, apiKey, apiSecret, accountID string) (*Client, error)

NewAPIClientWithAccount creates a client with API key authentication and account ID

func NewBasicAuthClient

func NewBasicAuthClient(baseURL, version, username, password string) (*Client, error)

NewBasicAuthClient creates a client with basic authentication for peer communication

func NewClient

func NewClient(baseURL, version string, options ...ClientOption) (*Client, error)

func (*Client) AddAccountTokens added in v1.5.0

func (c *Client) AddAccountTokens(accountID string, amount int64) (*AccountTokensAddResponse, error)

AddAccountTokens adds the given number of tokens to an account's balance.

func (*Client) AddAllFeaturesToAccount added in v1.2.0

func (c *Client) AddAllFeaturesToAccount(accountID string) error

AddAllFeaturesToAccount adds all features to an account

func (*Client) AddFeatureToAccount

func (c *Client) AddFeatureToAccount(accountID string, body *FeatureRequest) (*FeatureRequestResponse, error)

AddFeatureToAccount adds a feature to an account

func (*Client) ArchiveCredential added in v1.2.0

func (c *Client) ArchiveCredential(id string, archivedBy string, accountIDOverride ...string) error

ArchiveCredential archives a credential by ID accountIDOverride is optional - if provided, overrides the client's default account ID

func (*Client) BackupDatabase added in v1.4.0

func (c *Client) BackupDatabase() (*BackupRestoreResponse, error)

BackupDatabase initiates an automatic timestamped backup

func (*Client) BatchCreateJobs added in v1.2.0

func (c *Client) BatchCreateJobs(jobs []JobRequestBody, accountIDOverride ...string) (*BatchJobResponse, error)

BatchCreateJobs creates multiple jobs in a single request accountIDOverride is optional - if provided, overrides the client's default account ID

func (*Client) CleanupOldExecutionLogs added in v1.3.1

func (c *Client) CleanupOldExecutionLogs(accountID string, retentionMonths int, accountIDOverride ...string) (*CleanupOldLogsResponse, error)

CleanupOldExecutionLogs cleans up old execution logs for an account based on retention period accountIDOverride is optional - if provided, overrides the client's default account ID

func (*Client) CreateAccount

func (c *Client) CreateAccount(body *AccountCreateRequestBody) (*AccountResponse, error)

CreateAccount creates a new account

func (*Client) CreateCredential

func (c *Client) CreateCredential(body *CredentialCreateRequestBody) (*CredentialResponse, error)

CreateCredential creates a new credential

func (*Client) CreateExecutor

func (c *Client) CreateExecutor(body *ExecutorRequestBody) (*ExecutorResponse, error)

CreateExecutor creates a new executor

func (*Client) CreateJob

func (c *Client) CreateJob(body *JobRequestBody, accountIDOverride ...string) (*BatchJobResponse, error)

CreateJob creates a new job Note: This is a convenience method that wraps a single job in an array. The API always expects an array and returns 202 Accepted with a request ID for async tracking. For better control, use BatchCreateJobs directly. accountIDOverride is optional - if provided, overrides the client's default account ID

func (*Client) CreateJobFromPrompt added in v1.2.0

func (c *Client) CreateJobFromPrompt(body *PromptJobRequest, accountIDOverride ...string) ([]PromptJobResponse, error)

CreateJobFromPrompt creates job configurations from an AI prompt. It returns the flattened list of jobs across all providers. An optional accountIDOverride can be supplied to set the X-Account-ID header.

func (*Client) CreateProject

func (c *Client) CreateProject(body *ProjectRequestBody) (*ProjectResponse, error)

CreateProject creates a new project

func (*Client) DeleteCredential

func (c *Client) DeleteCredential(id string, body *CredentialDeleteRequestBody) error

DeleteCredential deletes a credential by ID

func (*Client) DeleteExecutor

func (c *Client) DeleteExecutor(id string, body *ExecutorDeleteRequestBody) error

DeleteExecutor deletes an executor by ID

func (*Client) DeleteJob

func (c *Client) DeleteJob(id string, body *JobDeleteRequestBody, accountIDOverride ...string) error

DeleteJob deletes a job by ID accountIDOverride is optional - if provided, overrides the client's default account ID

func (*Client) DeleteProject

func (c *Client) DeleteProject(id int64, body *ProjectDeleteRequestBody) error

DeleteProject deletes a project by ID

func (*Client) GetAccount

func (c *Client) GetAccount(id string) (*AccountResponse, error)

GetAccount retrieves a single account by ID

func (*Client) GetAccountAISettings added in v1.5.0

func (c *Client) GetAccountAISettings(accountID string) (*AccountAISettingsResponse, error)

GetAccountAISettings retrieves the AI provider settings for a given account. accountID is passed as an override so the proxy can route to the right account.

func (*Client) GetAccountExecutionCount added in v1.3.1

func (c *Client) GetAccountExecutionCount(accountID string) (*AccountExecutionCountResponse, error)

GetAccountExecutionCount retrieves the execution count for an account accountID is used both in the URL path and as the X-Account-ID header for authentication

func (*Client) GetAccountTokens added in v1.5.0

func (c *Client) GetAccountTokens(accountID string) (*AccountTokensResponse, error)

GetAccountTokens retrieves the current token balance for an account.

func (*Client) GetAsyncTask

func (c *Client) GetAsyncTask(requestID string) (*AsyncTaskResponse, error)

GetAsyncTask retrieves an async task by request ID

func (*Client) GetCredential

func (c *Client) GetCredential(id string) (*CredentialResponse, error)

GetCredential retrieves a single credential by ID

func (*Client) GetDateRangeAnalytics added in v1.3.1

func (c *Client) GetDateRangeAnalytics(params GetDateRangeAnalyticsParams) (*DateRangeAnalyticsAPIResponse, error)

GetDateRangeAnalytics retrieves execution counts grouped by minute buckets for a date range All dates and times should be in UTC (timezone conversion should be done on frontend)

func (*Client) GetExecutionTotals added in v1.3.1

func (c *Client) GetExecutionTotals(accountID int64) (*ExecutionTotalsAPIResponse, error)

GetExecutionTotals retrieves total counts of scheduled, success, and failed executions for an account

func (*Client) GetExecutor

func (c *Client) GetExecutor(id string) (*ExecutorResponse, error)

GetExecutor retrieves a single executor by ID

func (*Client) GetJob

func (c *Client) GetJob(id string, accountIDOverride ...string) (*JobResponse, error)

GetJob retrieves a single job by ID accountIDOverride is optional - if provided, overrides the client's default account ID

func (*Client) GetProject

func (c *Client) GetProject(id int64) (*ProjectResponse, error)

GetProject retrieves a single project by ID

func (*Client) Healthcheck

func (c *Client) Healthcheck() (*HealthcheckResponse, error)

Healthcheck retrieves the current leader and raft stats (no authentication required)

func (*Client) IncreaseAccountExecutionCount added in v1.3.2

func (c *Client) IncreaseAccountExecutionCount(accountID string, count uint64) (*AccountExecutionCountIncreaseResponse, error)

IncreaseAccountExecutionCount increases the execution count for an account accountID is used both in the URL path and as the X-Account-ID header for authentication

func (*Client) ListCredentials

func (c *Client) ListCredentials(params ListCredentialsParams) (*PaginatedCredentialsResponse, error)

ListCredentials retrieves all credentials with optional query parameters

func (*Client) ListExecutions

func (c *Client) ListExecutions(params ListExecutionsParams) (*PaginatedExecutionsResponse, error)

ListExecutions retrieves job executions with query parameters

func (*Client) ListExecutors

func (c *Client) ListExecutors(params ListExecutorsParams) (*PaginatedExecutorsResponse, error)

ListExecutors retrieves all executors with optional query parameters

func (*Client) ListFeatures

func (c *Client) ListFeatures() (*FeaturesResponse, error)

ListFeatures retrieves all available features

func (*Client) ListJobs

func (c *Client) ListJobs(params ListJobsParams) (*PaginatedJobsResponse, error)

ListJobs retrieves all jobs with optional query parameters

func (*Client) ListProjects

func (c *Client) ListProjects(params ListProjectsParams) (*PaginatedProjectsResponse, error)

ListProjects retrieves all projects with optional query parameters

func (*Client) PullLocalExecutorJobs added in v1.6.0

func (c *Client) PullLocalExecutorJobs(executorID int64) (*LocalExecutorJobsResponse, error)

PullLocalExecutorJobs returns all active jobs assigned to the given local executor.

GET /api/v1/local-executors/{id}/jobs

func (*Client) RegisterLocalExecutor added in v1.6.0

func (c *Client) RegisterLocalExecutor(body *LocalExecutorRegisterRequest) (*LocalExecutorRegisterResponse, error)

RegisterLocalExecutor creates a new local-type executor on the server and returns its ID.

POST /api/v1/local-executors

func (*Client) RemoveAllFeaturesFromAccount added in v1.2.0

func (c *Client) RemoveAllFeaturesFromAccount(accountID string) error

RemoveAllFeaturesFromAccount removes all features from an account

func (*Client) RemoveFeatureFromAccount

func (c *Client) RemoveFeatureFromAccount(accountID string, body *FeatureRequest) error

RemoveFeatureFromAccount removes a feature from an account

func (*Client) ReportLocalExecutions added in v1.6.0

func (c *Client) ReportLocalExecutions(executorID int64, reports []LocalExecutionReport) (*ReportLocalExecutionsResponse, error)

ReportLocalExecutions sends a batch of execution events to the server to be committed.

POST /api/v1/local-executors/{id}/executions

func (*Client) RestoreDatabase added in v1.4.0

func (c *Client) RestoreDatabase(fileName string) (*BackupRestoreResponse, error)

RestoreDatabase initiates a restore from a backup file. fileName is the backup file name (S3 object key when S3 is configured, or local file path otherwise).

func (*Client) RotateCredentialSecret added in v1.6.0

func (c *Client) RotateCredentialSecret() (*RotateSecretResponse, error)

RotateCredentialSecret triggers a server-side re-encryption of all active, non-expired credentials from the old SecretKey to the new one.

This endpoint is self-hosting only and requires a BasicAuth client (NewBasicAuthClient). The operator must update SecretKey in the secrets source before calling this method. The operation is resumable — if it is interrupted, re-calling RotateCredentialSecret will pick up from where it left off.

func (*Client) UpdateCredential

func (c *Client) UpdateCredential(id string, body *CredentialUpdateRequestBody) (*CredentialResponse, error)

UpdateCredential updates an existing credential

func (*Client) UpdateExecutor

func (c *Client) UpdateExecutor(id string, body *ExecutorUpdateRequestBody) (*ExecutorResponse, error)

UpdateExecutor updates an existing executor

func (*Client) UpdateJob

func (c *Client) UpdateJob(id string, body *JobUpdateRequestBody, accountIDOverride ...string) (*JobResponse, error)

UpdateJob updates an existing job accountIDOverride is optional - if provided, overrides the client's default account ID

func (*Client) UpdateProject

func (c *Client) UpdateProject(id int64, body *ProjectUpdateRequestBody) (*ProjectResponse, error)

UpdateProject updates an existing project

func (*Client) UpsertAccountAISettings added in v1.5.0

func (c *Client) UpsertAccountAISettings(accountID string, settings *AccountAISettings) (*AccountAISettingsResponse, error)

UpsertAccountAISettings creates or updates the AI provider settings for a given account.

type ClientOption

type ClientOption func(*Client)

ClientOption is a function that configures a Client

func WithAPIKey

func WithAPIKey(apiKey, apiSecret string) ClientOption

WithAPIKey sets the API key and secret for authentication

func WithAccountID

func WithAccountID(accountID string) ClientOption

WithAccountID sets the account ID for requests

func WithBasicAuth

func WithBasicAuth(username, password string) ClientOption

WithBasicAuth sets the username and password for basic authentication

type Credential

type Credential struct {
	ID              int64    `json:"id"`
	AccountID       int64    `json:"accountId"`
	Archived        bool     `json:"archived"`
	APIKey          string   `json:"apiKey"`
	PlaintextSecret string   `json:"plaintextSecret,omitempty"` // Returned once on creation only
	DateCreated     string   `json:"dateCreated"`
	DateModified    *string  `json:"dateModified"`
	DateDeleted     *string  `json:"dateDeleted"`
	CreatedBy       string   `json:"createdBy"`
	ModifiedBy      *string  `json:"modifiedBy"`
	DeletedBy       *string  `json:"deletedBy"`
	ArchivedBy      *string  `json:"archivedBy"`
	ExpiresAt       *string  `json:"expiresAt,omitempty"`
	Scopes          []string `json:"scopes,omitempty"`
}

Credential represents a credential returned by the Scheduler0 API.

API key / secret model:

  • APIKey is a stable plaintext identifier stored as-is in the DB. It is always present in API responses.
  • APISecret (the AES-GCM encrypted form) is never included in API responses. Clients must send the original plaintext secret they received at creation.
  • PlaintextSecret is returned exactly once, in the 201 create response. It is never stored server-side and cannot be retrieved afterwards.

type CredentialArchiveRequestBody added in v1.2.0

type CredentialArchiveRequestBody struct {
	AccountID  int64  `json:"-"`
	ArchivedBy string `json:"archivedBy"`
}

CredentialArchiveRequestBody represents the request body for archiving a credential

type CredentialCreateRequestBody added in v1.2.0

type CredentialCreateRequestBody struct {
	AccountID int64    `json:"-"`
	Archived  bool     `json:"archived,omitempty"`
	CreatedBy string   `json:"createdBy"`
	Scopes    []string `json:"scopes"`
}

CredentialCreateRequestBody represents the request body for creating a credential. Scopes must be a subset of {"read","write","execute"} and is required by the API.

type CredentialDeleteRequestBody added in v1.2.0

type CredentialDeleteRequestBody struct {
	AccountID int64  `json:"-"`
	DeletedBy string `json:"deletedBy"`
}

CredentialDeleteRequestBody represents the request body for deleting a credential

type CredentialResponse

type CredentialResponse struct {
	Success bool       `json:"success"`
	Data    Credential `json:"data"`
}

CredentialResponse represents the response for a single credential

type CredentialUpdateRequestBody added in v1.2.0

type CredentialUpdateRequestBody struct {
	AccountID  int64  `json:"-"`
	Archived   bool   `json:"archived,omitempty"`
	ModifiedBy string `json:"modifiedBy"`
}

CredentialUpdateRequestBody represents the request body for updating a credential

type DateRangeAnalyticsAPIResponse added in v1.3.1

type DateRangeAnalyticsAPIResponse struct {
	Success bool                       `json:"success"`
	Data    DateRangeAnalyticsResponse `json:"data"`
}

type DateRangeAnalyticsPoint added in v1.3.1

type DateRangeAnalyticsPoint struct {
	Date      string `json:"date"`
	Time      string `json:"time"`
	Scheduled uint64 `json:"scheduled"`
	Success   uint64 `json:"success"`
	Failed    uint64 `json:"failed"`
}

type DateRangeAnalyticsResponse added in v1.3.1

type DateRangeAnalyticsResponse struct {
	AccountID uint64                    `json:"accountId"`
	Timezone  string                    `json:"timezone"`
	StartDate string                    `json:"startDate"`
	StartTime string                    `json:"startTime"`
	EndDate   string                    `json:"endDate"`
	EndTime   string                    `json:"endTime"`
	Points    []DateRangeAnalyticsPoint `json:"points"`
}

type Execution

type Execution struct {
	ID                    int64   `json:"id"`
	AccountID             int64   `json:"accountId"`
	UniqueID              string  `json:"uniqueId"`
	State                 int64   `json:"state"`
	NodeID                int64   `json:"nodeId"`
	JobID                 int64   `json:"jobId"`
	LastExecutionDatetime string  `json:"lastExecutionDatetime"`
	NextExecutionDatetime string  `json:"nextExecutionDatetime"`
	JobQueueVersion       int64   `json:"jobQueueVersion"`
	ExecutionVersion      int64   `json:"executionVersion"`
	DateCreated           string  `json:"dateCreated"`
	DateModified          *string `json:"dateModified"`
}

type ExecutionResponse

type ExecutionResponse struct {
	Success bool      `json:"success"`
	Data    Execution `json:"data"`
}

type ExecutionTotalsAPIResponse added in v1.3.1

type ExecutionTotalsAPIResponse struct {
	Success bool                    `json:"success"`
	Data    ExecutionTotalsResponse `json:"data"`
}

type ExecutionTotalsResponse added in v1.3.1

type ExecutionTotalsResponse struct {
	AccountID uint64 `json:"accountId"`
	Scheduled uint64 `json:"scheduled"`
	Success   uint64 `json:"success"`
	Failed    uint64 `json:"failed"`
}

type Executor

type Executor struct {
	ID               int64   `json:"id"`
	AccountID        int64   `json:"accountId"`
	Name             string  `json:"name"`
	Type             string  `json:"type"`
	Region           string  `json:"region"`
	CloudProvider    string  `json:"cloudProvider"`
	CloudResourceURL string  `json:"cloudResourceUrl"`
	CloudAPIKey      string  `json:"cloudApiKey"`
	CloudAPISecret   string  `json:"cloudApiSecret"`
	WebhookURL       string  `json:"webhookUrl"`
	WebhookSecret    string  `json:"webhookSecret"`
	WebhookMethod    string  `json:"webhookMethod"`
	Command          string  `json:"command,omitempty"`
	WorkingDir       string  `json:"workingDir,omitempty"`
	DateCreated      string  `json:"dateCreated"`
	DateModified     *string `json:"dateModified"`
	DateDeleted      *string `json:"dateDeleted"`
	CreatedBy        string  `json:"createdBy"`
	ModifiedBy       *string `json:"modifiedBy"`
	DeletedBy        *string `json:"deletedBy"`
}

Executor represents a job executor

type ExecutorDeleteRequestBody added in v1.2.0

type ExecutorDeleteRequestBody struct {
	AccountID int64  `json:"-"`
	DeletedBy string `json:"deletedBy"`
}

ExecutorDeleteRequestBody represents the request body for deleting an executor

type ExecutorRequestBody

type ExecutorRequestBody struct {
	AccountID        int64  `json:"-"`
	Name             string `json:"name"`
	Type             string `json:"type"`
	Region           string `json:"region"`
	CloudProvider    string `json:"cloudProvider"`
	CloudResourceURL string `json:"cloudResourceUrl"`
	CloudAPIKey      string `json:"cloudApiKey,omitempty"`
	CloudAPISecret   string `json:"cloudApiSecret,omitempty"`
	WebhookURL       string `json:"webhookUrl,omitempty"`
	WebhookSecret    string `json:"webhookSecret,omitempty"`
	WebhookMethod    string `json:"webhookMethod,omitempty"`
	Command          string `json:"command,omitempty"`
	WorkingDir       string `json:"workingDir,omitempty"`
	CreatedBy        string `json:"createdBy"`
}

ExecutorRequestBody represents the request body for creating an executor

type ExecutorResponse

type ExecutorResponse struct {
	Success bool     `json:"success"`
	Data    Executor `json:"data"`
}

ExecutorResponse represents the response for a single executor

type ExecutorUpdateRequestBody added in v1.2.0

type ExecutorUpdateRequestBody struct {
	AccountID        int64  `json:"-"`
	Name             string `json:"name"`
	Type             string `json:"type"`
	Region           string `json:"region"`
	CloudProvider    string `json:"cloudProvider"`
	CloudResourceURL string `json:"cloudResourceUrl"`
	CloudAPIKey      string `json:"cloudApiKey,omitempty"`
	CloudAPISecret   string `json:"cloudApiSecret,omitempty"`
	WebhookURL       string `json:"webhookUrl,omitempty"`
	WebhookSecret    string `json:"webhookSecret,omitempty"`
	WebhookMethod    string `json:"webhookMethod,omitempty"`
	Command          string `json:"command,omitempty"`
	WorkingDir       string `json:"workingDir,omitempty"`
	ModifiedBy       string `json:"modifiedBy"`
}

ExecutorUpdateRequestBody represents the request body for updating an executor

type Feature

type Feature struct {
	ID           int64   `json:"id"`
	Name         string  `json:"name"`
	DateCreated  string  `json:"dateCreated"`
	DateModified *string `json:"dateModified"`
}

Feature represents a feature

type FeatureRequest

type FeatureRequest struct {
	AccountID int64 `json:"-"`
	FeatureID int64 `json:"featureId"`
}

FeatureRequest represents a request to add/remove a feature

type FeatureRequestResponse

type FeatureRequestResponse struct {
	Success bool           `json:"success"`
	Data    FeatureRequest `json:"data"`
}

FeatureRequestResponse represents the response for feature operations

type FeaturesResponse

type FeaturesResponse struct {
	Success bool      `json:"success"`
	Data    []Feature `json:"data"`
}

FeaturesResponse represents the response for listing features

type GetDateRangeAnalyticsParams added in v1.3.1

type GetDateRangeAnalyticsParams struct {
	StartDate string `json:"startDate"`
	StartTime string `json:"startTime"`
	AccountID int64  `json:"accountId"`
}

type HealthcheckData

type HealthcheckData struct {
	LeaderAddress string    `json:"leaderAddress"`
	LeaderID      string    `json:"leaderId"`
	RaftStats     RaftStats `json:"raftStats"`
}

HealthcheckData represents the healthcheck response data

type HealthcheckResponse

type HealthcheckResponse struct {
	Success bool            `json:"success"`
	Data    HealthcheckData `json:"data"`
}

HealthcheckResponse represents the healthcheck response

type Job

type Job struct {
	ID                int64   `json:"id,omitempty"`
	AccountID         int64   `json:"accountId,omitempty"`
	ProjectID         int64   `json:"projectId,omitempty"`
	ExecutorID        *int64  `json:"executorId,omitempty"`
	Data              string  `json:"data,omitempty"`
	Spec              string  `json:"spec,omitempty"`
	StartDate         string  `json:"startDate,omitempty"`
	EndDate           string  `json:"endDate,omitempty"`
	LastExecutionDate string  `json:"lastExecutionDate,omitempty"`
	Timezone          string  `json:"timezone,omitempty"`
	TimezoneOffset    int64   `json:"timezoneOffset,omitempty"`
	RetryMax          int     `json:"retryMax,omitempty"`
	ExecutionID       string  `json:"executionId,omitempty"`
	Status            string  `json:"status,omitempty"`
	DateCreated       string  `json:"dateCreated,omitempty"`
	DateModified      *string `json:"dateModified,omitempty"`
	CreatedBy         string  `json:"createdBy,omitempty"`
	ModifiedBy        *string `json:"modifiedBy,omitempty"`
	DeletedBy         *string `json:"deletedBy,omitempty"`
}

Job represents a scheduled job

type JobDeleteRequestBody added in v1.2.0

type JobDeleteRequestBody struct {
	AccountID int64  `json:"-"`
	DeletedBy string `json:"deletedBy"`
}

JobDeleteRequestBody represents the request body for deleting a job

type JobRequestBody

type JobRequestBody struct {
	AccountID      int64  `json:"-"`
	ProjectID      int64  `json:"projectId"`
	Timezone       string `json:"timezone"`
	ExecutorID     *int64 `json:"executorId,omitempty"`
	Data           string `json:"data,omitempty"`
	Spec           string `json:"spec,omitempty"`
	StartDate      string `json:"startDate,omitempty"`
	EndDate        string `json:"endDate,omitempty"`
	TimezoneOffset int64  `json:"timezoneOffset,omitempty"`
	RetryMax       int    `json:"retryMax,omitempty"`
	Status         string `json:"status,omitempty"`
	CreatedBy      string `json:"createdBy"`
}

JobRequestBody represents the request body for creating a job

type JobResponse

type JobResponse struct {
	Success bool `json:"success"`
	Data    Job  `json:"data"`
}

JobResponse represents the response for a single job

type JobUpdateRequestBody

type JobUpdateRequestBody struct {
	AccountID      int64  `json:"-"`
	ProjectID      int64  `json:"projectId,omitempty"`
	ExecutorID     *int64 `json:"executorId,omitempty"`
	Data           string `json:"data,omitempty"`
	Spec           string `json:"spec,omitempty"`
	StartDate      string `json:"startDate,omitempty"`
	EndDate        string `json:"endDate,omitempty"`
	Timezone       string `json:"timezone,omitempty"`
	TimezoneOffset int64  `json:"timezoneOffset,omitempty"`
	RetryMax       int    `json:"retryMax,omitempty"`
	Status         string `json:"status,omitempty"`
	ModifiedBy     string `json:"modifiedBy"`
}

JobUpdateRequestBody represents the request body for updating a job

type ListCredentialsParams added in v1.2.2

type ListCredentialsParams struct {
	AccountID        int64  // Optional: Account ID override (0 uses client default)
	Limit            int    // Maximum number of items to return
	Offset           int    // Number of items to skip
	OrderBy          string // Field to order by (e.g., "date_created", "date_modified")
	OrderByDirection string // Direction to order ("asc" or "desc")
}

ListCredentialsParams represents parameters for listing credentials

type ListExecutionsParams added in v1.2.2

type ListExecutionsParams struct {
	StartDate      string
	EndDate        string
	ProjectID      int64
	JobID          int64
	AccountID      int64
	Limit          int
	Offset         int
	State          string
	OrderBy        string
	OrderDirection string
}

type ListExecutorsParams added in v1.2.2

type ListExecutorsParams struct {
	AccountID        int64  // Account ID override (0 to use client default)
	Limit            int    // Maximum number of items to return
	Offset           int    // Number of items to skip
	OrderBy          string // Field to order by (e.g., "date_created", "date_modified")
	OrderByDirection string // Direction to order ("asc" or "desc")
}

ListExecutorsParams represents parameters for listing executors

type ListJobsParams added in v1.2.2

type ListJobsParams struct {
	ProjectID        string // Project ID to filter by (empty string for all projects)
	AccountID        int64  // Account ID override (0 to use client default)
	Limit            int    // Maximum number of items to return
	Offset           int    // Number of items to skip
	OrderBy          string // Field to order by (e.g., "date_created", "date_modified")
	OrderByDirection string // Direction to order ("asc" or "desc")
}

ListJobsParams represents parameters for listing jobs

type ListProjectsParams added in v1.2.2

type ListProjectsParams struct {
	AccountID        int64  // Account ID override (0 to use client default)
	Limit            int    // Maximum number of items to return
	Offset           int    // Number of items to skip
	OrderBy          string // Field to order by (e.g., "date_created", "date_modified")
	OrderByDirection string // Direction to order ("asc" or "desc")
}

ListProjectsParams represents parameters for listing projects

type LocalExecutionReport added in v1.6.0

type LocalExecutionReport struct {
	JobID             int64  `json:"jobId"`
	UniqueID          string `json:"uniqueId"`
	State             int    `json:"state"`             // 0=scheduled, 1=success, 2=failed
	LastExecutionTime string `json:"lastExecutionTime"` // RFC3339
	NextExecutionTime string `json:"nextExecutionTime"` // RFC3339
	ExecutionVersion  uint64 `json:"executionVersion"`
	JobQueueVersion   uint64 `json:"jobQueueVersion"`
}

LocalExecutionReport is a single execution event sent to the server.

type LocalExecutorJobsResponse added in v1.6.0

type LocalExecutorJobsResponse struct {
	Success bool  `json:"success"`
	Data    []Job `json:"data"`
}

LocalExecutorJobsResponse is the server response for pulling assigned jobs.

type LocalExecutorRegisterRequest added in v1.6.0

type LocalExecutorRegisterRequest struct {
	Name       string `json:"name"`
	Command    string `json:"command"`
	WorkingDir string `json:"workingDir,omitempty"`
	CreatedBy  string `json:"createdBy,omitempty"`
}

LocalExecutorRegisterRequest is the body for POST /local-executors.

type LocalExecutorRegisterResponse added in v1.6.0

type LocalExecutorRegisterResponse struct {
	Success bool `json:"success"`
	Data    struct {
		ID int64 `json:"id"`
	} `json:"data"`
}

LocalExecutorRegisterResponse is the server response for executor registration.

type PaginatedCredentialsResponse

type PaginatedCredentialsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Total       int          `json:"total"`
		Offset      int          `json:"offset"`
		Limit       int          `json:"limit"`
		Credentials []Credential `json:"credentials"`
	} `json:"data"`
}

PaginatedCredentialsResponse represents a paginated list of credentials

type PaginatedExecutionsResponse

type PaginatedExecutionsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Total      int         `json:"total"`
		Offset     int         `json:"offset"`
		Limit      int         `json:"limit"`
		Executions []Execution `json:"executions"`
	} `json:"data"`
}

type PaginatedExecutorsResponse

type PaginatedExecutorsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Total     int        `json:"total"`
		Offset    int        `json:"offset"`
		Limit     int        `json:"limit"`
		Executors []Executor `json:"executors"`
	} `json:"data"`
}

PaginatedExecutorsResponse represents a paginated list of executors

type PaginatedJobsResponse

type PaginatedJobsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Total  int   `json:"total"`
		Offset int   `json:"offset"`
		Limit  int   `json:"limit"`
		Jobs   []Job `json:"jobs"`
	} `json:"data"`
}

PaginatedJobsResponse represents a paginated list of jobs

type PaginatedProjectsResponse

type PaginatedProjectsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Total    int       `json:"total"`
		Offset   int       `json:"offset"`
		Limit    int       `json:"limit"`
		Projects []Project `json:"projects"`
	} `json:"data"`
}

PaginatedProjectsResponse represents a paginated list of projects

type Project

type Project struct {
	ID           int64   `json:"id"`
	AccountID    int64   `json:"accountId"`
	Name         string  `json:"name"`
	Description  string  `json:"description"`
	DateCreated  string  `json:"dateCreated"`
	DateModified *string `json:"dateModified"`
	CreatedBy    string  `json:"createdBy"`
	ModifiedBy   *string `json:"modifiedBy"`
	DeletedBy    *string `json:"deletedBy"`
}

Project represents a project

type ProjectDeleteRequestBody added in v1.2.0

type ProjectDeleteRequestBody struct {
	AccountID int64  `json:"-"`
	DeletedBy string `json:"deletedBy"`
}

ProjectDeleteRequestBody represents the request body for deleting a project

type ProjectRequestBody

type ProjectRequestBody struct {
	AccountID   int64  `json:"-"`
	Name        string `json:"name"`
	Description string `json:"description"`
	CreatedBy   string `json:"createdBy"`
}

ProjectRequestBody represents the request body for creating a project

type ProjectResponse

type ProjectResponse struct {
	Success bool    `json:"success"`
	Data    Project `json:"data"`
}

ProjectResponse represents the response for a single project

type ProjectUpdateRequestBody

type ProjectUpdateRequestBody struct {
	AccountID   int64  `json:"-"`
	Description string `json:"description"`
	ModifiedBy  string `json:"modifiedBy"`
}

ProjectUpdateRequestBody represents the request body for updating a project

type PromptJobRequest added in v1.2.0

type PromptJobRequest struct {
	Prompt     string   `json:"prompt"`
	Purposes   []string `json:"purposes,omitempty"`
	Events     []string `json:"events,omitempty"`
	Recipients []string `json:"recipients,omitempty"`
	Channels   []string `json:"channels,omitempty"`
	Timezone   string   `json:"timezone,omitempty"`
}

PromptJobRequest represents the request body for creating jobs from AI prompt

type PromptJobResponse added in v1.2.0

type PromptJobResponse struct {
	Kind           string                 `json:"kind,omitempty"`
	Purpose        string                 `json:"purpose,omitempty"`
	Subject        string                 `json:"subject,omitempty"`
	NextRunAt      *string                `json:"nextRunAt,omitempty"`
	Recurrence     string                 `json:"recurrence,omitempty"`
	Event          string                 `json:"event,omitempty"`
	Delivery       string                 `json:"delivery,omitempty"`
	CronExpression string                 `json:"cronExpression,omitempty"`
	Channel        string                 `json:"channel,omitempty"`
	Recipients     []string               `json:"recipients,omitempty"`
	StartDate      *string                `json:"startDate,omitempty"`
	EndDate        *string                `json:"endDate,omitempty"`
	Timezone       string                 `json:"timezone,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
}

PromptJobResponse represents a single job configuration generated from AI prompt. It maps to the objects inside each provider result's "jobs" array.

type PromptProviderResult added in v1.5.0

type PromptProviderResult struct {
	Provider     string              `json:"provider"`
	Model        string              `json:"model"`
	Jobs         []PromptJobResponse `json:"jobs"`
	InputTokens  int                 `json:"inputTokens"`
	OutputTokens int                 `json:"outputTokens"`
	TotalTokens  int                 `json:"totalTokens"`
	DurationMs   int64               `json:"durationMs"`
}

PromptProviderResult wraps the per-provider metadata together with the jobs it produced. The API returns one entry per AI provider that was consulted.

type RaftStats

type RaftStats struct {
	AppliedIndex        string `json:"applied_index"`
	CommitIndex         string `json:"commit_index"`
	FSMPending          string `json:"fsm_pending"`
	LastContact         string `json:"last_contact"`
	LastLogIndex        string `json:"last_log_index"`
	LastLogTerm         string `json:"last_log_term"`
	LastSnapshotIndex   string `json:"last_snapshot_index"`
	LastSnapshotTerm    string `json:"last_snapshot_term"`
	LatestConfiguration string `json:"latest_configuration"`
	LatestConfigIndex   string `json:"latest_configuration_index"`
	NumPeers            string `json:"num_peers"`
	ProtocolVersion     string `json:"protocol_version"`
	ProtocolVersionMax  string `json:"protocol_version_max"`
	ProtocolVersionMin  string `json:"protocol_version_min"`
	SnapshotVersionMax  string `json:"snapshot_version_max"`
	SnapshotVersionMin  string `json:"snapshot_version_min"`
	State               string `json:"state"`
	Term                string `json:"term"`
}

RaftStats represents the Raft cluster statistics

type ReportLocalExecutionsResponse added in v1.6.0

type ReportLocalExecutionsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Committed int `json:"committed"`
	} `json:"data"`
}

ReportLocalExecutionsResponse is the server response for reporting executions.

type RestoreRequest added in v1.4.0

type RestoreRequest struct {
	FilePath string `json:"filePath"` // Backup file name (S3 object key when S3 configured, or local path)
}

RestoreRequest is the request body for restore endpoint

type RotateSecretResponse added in v1.6.0

type RotateSecretResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Rotated uint64 `json:"rotated"`
	} `json:"data"`
}

RotateSecretResponse is the response body returned by POST /credentials/rotate-secret. Rotated is the number of credentials that were re-encrypted with the new secret key.

Jump to

Keyboard shortcuts

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