scheduler0_go_client

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 7 Imported by: 0

README

Scheduler0 Go Client

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, container)
    • 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

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(10, 0, "date_created", "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(
    "2024-01-01T00:00:00Z",  // Start date
    "2024-12-31T23:59:59Z",  // End date
    0,                       // Project ID (0 for all)
    0,                       // Job ID (0 for all)
    10,                      // Limit
    0,                       // Offset
)
Managing Executors
// List executors with pagination and ordering
executors, err := client.ListExecutors(10, 0, "date_created", "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
projects, err := client.ListProjects(10, 0)

// 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("project-id", 10, 0, "date_created", "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",
}

// 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)
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
  • "container" - Container 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.

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.

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 AccountCreateRequestBody

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

AccountCreateRequestBody represents the request body for creating an account

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 AccountResponse

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

AccountResponse represents the response for a single account

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

ArchiveCredential archives a credential by ID

func (*Client) BatchCreateJobs added in v1.2.0

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

BatchCreateJobs creates multiple jobs in a single request

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) (*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.

func (*Client) CreateJobFromPrompt added in v1.2.0

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

CreateJobFromPrompt creates job configurations from an AI prompt This endpoint requires credits and uses AI to generate job configurations

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

DeleteJob deletes a job by 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) 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) 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) (*JobResponse, error)

GetJob retrieves a single job by 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) ListCredentials

func (c *Client) ListCredentials(limit, offset int, orderBy, orderByDirection string) (*PaginatedCredentialsResponse, error)

func (*Client) ListExecutions

func (c *Client) ListExecutions(startDate, endDate string, projectID, jobID int64, limit, offset int) (*PaginatedExecutionsResponse, error)

ListExecutions retrieves job executions with query parameters

func (*Client) ListExecutors

func (c *Client) ListExecutors(limit, offset int, orderBy, orderByDirection string) (*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(projectID string, limit, offset int, orderBy, orderByDirection string) (*PaginatedJobsResponse, error)

ListJobs retrieves all jobs with optional query parameters projectID can be empty string to list all jobs for the account

func (*Client) ListProjects

func (c *Client) ListProjects(limit, offset int, orderBy, orderByDirection string) (*PaginatedProjectsResponse, error)

ListProjects retrieves all projects with optional query parameters

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) 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) (*JobResponse, error)

UpdateJob updates an existing job

func (*Client) UpdateProject

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

UpdateProject updates an existing project

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"`
	APISecret    string  `json:"apiSecret"`
	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"`
}

type CredentialArchiveRequestBody added in v1.2.0

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

CredentialArchiveRequestBody represents the request body for archiving a credential

type CredentialCreateRequestBody added in v1.2.0

type CredentialCreateRequestBody struct {
	Archived  bool   `json:"archived,omitempty"`
	CreatedBy string `json:"createdBy"`
}

CredentialCreateRequestBody represents the request body for creating a credential

type CredentialDeleteRequestBody added in v1.2.0

type CredentialDeleteRequestBody struct {
	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 {
	Archived   bool   `json:"archived,omitempty"`
	ModifiedBy string `json:"modifiedBy"`
}

CredentialUpdateRequestBody represents the request body for updating a credential

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

Execution represents a job execution log

type ExecutionResponse

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

ExecutionResponse represents the response for a single execution

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"`
	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 {
	DeletedBy string `json:"deletedBy"`
}

ExecutorDeleteRequestBody represents the request body for deleting an executor

type ExecutorRequestBody

type ExecutorRequestBody struct {
	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"`
	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 {
	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"`
	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 {
	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 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 {
	DeletedBy string `json:"deletedBy"`
}

JobDeleteRequestBody represents the request body for deleting a job

type JobRequestBody

type JobRequestBody struct {
	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 {
	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 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"`
}

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

PaginatedExecutionsResponse represents a paginated list of executions

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 {
	DeletedBy string `json:"deletedBy"`
}

ProjectDeleteRequestBody represents the request body for deleting a project

type ProjectRequestBody

type ProjectRequestBody struct {
	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 {
	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 job configuration generated from AI prompt

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

Jump to

Keyboard shortcuts

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