api

package
v1.3.142 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package api provides an HTTP client for the RepoSwarm API server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL    string
	Token      string
	HTTPClient *http.Client
}

Client talks to the RepoSwarm API server.

func New

func New(baseURL, token string) *Client

New creates an API client.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string, result any) error

Delete performs a DELETE request and unmarshals the response data.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, result any) error

Get performs a GET request and unmarshals the response data.

func (*Client) Health

func (c *Client) Health(ctx context.Context) (*HealthResponse, error)

Health checks the API connection.

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, body any, result any) error

Patch performs a PATCH request and unmarshals the response data.

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body any, result any) error

Post performs a POST request and unmarshals the response data.

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, body any, result any) error

Put performs a PUT request and unmarshals the response data.

type ConfigResponse

type ConfigResponse struct {
	DefaultModel       string `json:"defaultModel"`
	ChunkSize          int    `json:"chunkSize"`
	SleepDuration      int    `json:"sleepDuration"`
	ParallelLimit      int    `json:"parallelLimit"`
	TokenLimit         int    `json:"tokenLimit"`
	ScheduleExpression string `json:"scheduleExpression"`
}

ConfigResponse from GET /config.

type DiscoverResult

type DiscoverResult struct {
	Success      bool     `json:"success"`
	Discovered   int      `json:"discovered"`
	Added        int      `json:"added"`
	Skipped      int      `json:"skipped"`
	Total        int      `json:"total"`
	Repositories []string `json:"repositories"`
}

DiscoverResult from POST /repos/discover.

type HealthResponse

type HealthResponse struct {
	Status   string `json:"status"`
	Version  string `json:"version"`
	Temporal struct {
		Connected bool   `json:"connected"`
		Namespace string `json:"namespace"`
		TaskQueue string `json:"taskQueue"`
	} `json:"temporal"`
	DynamoDB struct {
		Connected bool `json:"connected"`
	} `json:"dynamodb"`
	Worker struct {
		Connected bool `json:"connected"`
		Count     int  `json:"count"`
	} `json:"worker"`
}

HealthResponse from GET /health.

type InvestigateDailyRequest

type InvestigateDailyRequest struct {
	Model         string `json:"model,omitempty"`
	ChunkSize     int    `json:"chunk_size,omitempty"`
	ParallelLimit int    `json:"parallel_limit,omitempty"`
}

InvestigateDailyRequest for POST /investigate/daily.

type InvestigateRequest

type InvestigateRequest struct {
	RepoName  string `json:"repo_name"`
	Model     string `json:"model"`
	ChunkSize int    `json:"chunk_size"`
}

InvestigateRequest for POST /investigate/single.

type Prompt

type Prompt struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Template    string `json:"template"`
	Enabled     bool   `json:"enabled"`
	Order       int    `json:"order"`
	Version     int    `json:"version"`
	Context     string `json:"context,omitempty"`
	CreatedAt   string `json:"createdAt,omitempty"`
	UpdatedAt   string `json:"updatedAt,omitempty"`
}

Prompt from GET /prompts.

type PromptType

type PromptType struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

PromptType from GET /prompts/types.

type PromptVersion

type PromptVersion struct {
	Version   int    `json:"version"`
	Template  string `json:"template"`
	CreatedAt string `json:"createdAt"`
	Author    string `json:"author,omitempty"`
}

PromptVersion from GET /prompts/:name/versions.

type Repository

type Repository struct {
	Name        string `json:"name"`
	URL         string `json:"url"`
	Source      string `json:"source"`
	Description string `json:"description"`
	Enabled     bool   `json:"enabled"`
	Status      string `json:"status"`
	HasDocs     bool   `json:"hasDocs"`
}

Repository from GET /repos.

type ServiceInfo

type ServiceInfo struct {
	Name    string `json:"name"`
	PID     int    `json:"pid"`
	Status  string `json:"status"`
	Uptime  string `json:"uptime,omitempty"`
	Port    int    `json:"port,omitempty"`
	Manager string `json:"manager,omitempty"`
}

ServiceInfo represents a running service.

type WikiContent

type WikiContent struct {
	Repo         string `json:"repo"`
	Section      string `json:"section"`
	Content      string `json:"content"`
	CreatedAt    string `json:"createdAt"`
	Timestamp    int64  `json:"timestamp"`
	ReferenceKey string `json:"referenceKey"`
}

WikiContent from GET /wiki/:repo/:section.

type WikiIndex

type WikiIndex struct {
	Repo     string        `json:"repo"`
	Sections []WikiSection `json:"sections"`
	HasDocs  bool          `json:"hasDocs"`
}

WikiIndex from GET /wiki/:repo.

type WikiRepoSummary

type WikiRepoSummary struct {
	Name         string   `json:"name"`
	SectionCount int      `json:"sectionCount"`
	LastUpdated  string   `json:"lastUpdated"`
	Highlights   []string `json:"highlights"`
}

WikiRepoSummary from GET /wiki.

type WikiReposResponse

type WikiReposResponse struct {
	Repos []WikiRepoSummary `json:"repos"`
}

WikiReposResponse from GET /wiki.

type WikiSection

type WikiSection struct {
	ID        string `json:"id"`
	StepName  string `json:"stepName"`
	Label     string `json:"label"`
	Timestamp int64  `json:"timestamp"`
	CreatedAt string `json:"createdAt"`
}

WikiSection from GET /wiki/:repo.

func (WikiSection) Name

func (s WikiSection) Name() string

Name returns the section identifier (prefers ID, falls back to StepName).

type WorkerInfo

type WorkerInfo struct {
	Name         string   `json:"name"`
	Identity     string   `json:"identity"`
	Status       string   `json:"status"`
	TaskQueue    string   `json:"taskQueue"`
	CurrentTask  string   `json:"currentTask,omitempty"`
	LastActivity string   `json:"lastActivity,omitempty"`
	EnvStatus    string   `json:"envStatus"`
	EnvErrors    []string `json:"envErrors,omitempty"`
	PID          int      `json:"pid,omitempty"`
	Uptime       string   `json:"uptime,omitempty"`
	Host         string   `json:"host,omitempty"`
	Model        string   `json:"model,omitempty"`
}

WorkerInfo represents a worker's status and health.

type WorkersResponse

type WorkersResponse struct {
	Workers []WorkerInfo `json:"workers"`
	Total   int          `json:"total"`
	Healthy int          `json:"healthy"`
}

WorkersResponse from GET /workers.

type WorkflowExecution

type WorkflowExecution struct {
	WorkflowID string `json:"workflowId"`
	RunID      string `json:"runId"`
	Status     string `json:"status"`
	Type       string `json:"type"`
	StartTime  string `json:"startTime"`
	CloseTime  string `json:"closeTime,omitempty"`
	TaskQueue  string `json:"taskQueue,omitempty"`
}

WorkflowExecution from GET /workflows.

type WorkflowHistory

type WorkflowHistory struct {
	Events []map[string]any `json:"events"`
}

WorkflowHistory from GET /workflows/:id/history.

type WorkflowsResponse

type WorkflowsResponse struct {
	Executions    []WorkflowExecution `json:"executions"`
	NextPageToken string              `json:"nextPageToken,omitempty"`
}

WorkflowsResponse from GET /workflows.

Jump to

Keyboard shortcuts

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