v2

package
v3.1.17 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 50 Imported by: 0

Documentation

Overview

Package v2 Gitea API v2

This is the v2 API with improved error handling, batch operations, and AI-friendly endpoints. It uses structured error codes for machine-readable error handling.

Schemes: https, http
License: MIT http://opensource.org/licenses/MIT

Consumes:
- application/json

Produces:
- application/json
- application/x-ndjson

swagger:meta

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchGetFiles

func BatchGetFiles(ctx *context.APIContext)

BatchGetFiles retrieves multiple files in a single request This is optimized for AI tools that need to fetch multiple files at once

func BatchGetRepos

func BatchGetRepos(ctx *context.APIContext)

BatchGetRepos retrieves information about multiple repositories

func CancelOperation

func CancelOperation(ctx *context.APIContext)

CancelOperation cancels a running operation @Summary Cancel operation @Description Cancels a long-running operation if possible @Tags operations @Produce json @Param id path string true "Operation ID" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Router /operations/{id} [delete]

func CheckAppUpdate

func CheckAppUpdate(ctx *context.APIContext)

CheckAppUpdate checks if an update is available for an app This endpoint is designed for Electron apps using autoUpdater GET /api/v2/repos/{owner}/{repo}/releases/update?version=1.0.0&platform=darwin&arch=arm64

func ComponentHealthCheck

func ComponentHealthCheck(ctx *context.APIContext)

ComponentHealthCheck checks a specific component @Summary Component health check @Description Returns the health status of a specific component @Tags health @Produce json @Param component path string true "Component name" @Success 200 {object} ComponentStatus @Failure 404 {object} map[string]any @Router /health/component/{component} [get]

func CreateReleaseAttachmentV2

func CreateReleaseAttachmentV2(ctx *context.APIContext)

CreateReleaseAttachmentV2 creates a release attachment with enhanced error handling POST /api/v2/repos/{owner}/{repo}/releases/{id}/assets

func CreateWikiPageV2

func CreateWikiPageV2(ctx *context.APIContext)

CreateWikiPageV2 creates a new wiki page

func DeleteReleaseAttachmentV2

func DeleteReleaseAttachmentV2(ctx *context.APIContext)

DeleteReleaseAttachmentV2 deletes a release attachment DELETE /api/v2/repos/{owner}/{repo}/releases/{id}/assets/{asset_id}

func DeleteWikiPageV2

func DeleteWikiPageV2(ctx *context.APIContext)

DeleteWikiPageV2 deletes a wiki page

func DocsScalar

func DocsScalar(ctx *context.APIContext)

DocsScalar serves the Scalar API documentation UI for v2

func GetAIIssueContext

func GetAIIssueContext(ctx *context.APIContext)

GetAIIssueContext returns rich context about an issue for AI tools

func GetAINavigation

func GetAINavigation(ctx *context.APIContext)

GetAINavigation returns navigation hints for AI tools

func GetAIRepoSummary

func GetAIRepoSummary(ctx *context.APIContext)

GetAIRepoSummary returns a comprehensive AI-friendly summary of a repository

func GetActionsCapabilities

func GetActionsCapabilities(ctx *context.APIContext)

GetActionsCapabilities returns structured capability information for AI consumption @Summary Get runner capabilities for AI workflow generation @Description Returns detailed runner capabilities, platform info, and action compatibility @Tags actions @Accept json @Produce json @Param owner path string true "owner of the repo" @Param repo path string true "name of the repo" @Success 200 {object} api.ActionsCapabilitiesResponse @Router /repos/{owner}/{repo}/actions/runners/capabilities [get]

func GetAdminRunnerStatus

func GetAdminRunnerStatus(ctx *context.APIContext)

GetAdminRunnerStatus returns the current status of a runner (admin endpoint) @Summary Get runner status (admin) @Description Returns current runner status for admin panel AJAX polling @Tags admin @Accept json @Produce json @Param runner_id path int64 true "runner ID" @Success 200 {object} RunnerStatusResponse @Router /admin/actions/runners/{runner_id}/status [get]

func GetAuthenticatedUser

func GetAuthenticatedUser(ctx *context.APIContext)

GetAuthenticatedUser returns the authenticated user

func GetLatestReleaseV2

func GetLatestReleaseV2(ctx *context.APIContext)

GetLatestReleaseV2 gets the latest release GET /api/v2/repos/{owner}/{repo}/releases/latest

func GetOperation

func GetOperation(ctx *context.APIContext)

GetOperation retrieves the current state of an operation @Summary Get operation status @Description Returns the current status of a long-running operation @Tags operations @Produce json @Param id path string true "Operation ID" @Success 200 {object} OperationProgressResponse @Failure 404 {object} map[string]any @Router /operations/{id} [get]

func GetPagesConfig

func GetPagesConfig(ctx *context.APIContext)

GetPagesConfig returns the pages configuration for a repository GET /api/v2/repos/{owner}/{repo}/pages/config

func GetPagesContent

func GetPagesContent(ctx *context.APIContext)

GetPagesContent returns the rendered content for a repository's landing page GET /api/v2/repos/{owner}/{repo}/pages/content

func GetReleaseV2

func GetReleaseV2(ctx *context.APIContext)

GetReleaseV2 gets a specific release by tag or ID GET /api/v2/repos/{owner}/{repo}/releases/{tag}

func GetRunnerStatus

func GetRunnerStatus(ctx *context.APIContext)

GetRunnerStatus returns the current status of a runner @Summary Get runner status @Description Returns current runner status including online state, capabilities, disk, and bandwidth @Tags actions @Accept json @Produce json @Param owner path string true "owner of the repo" @Param repo path string true "name of the repo" @Param runner_id path int64 true "runner ID" @Success 200 {object} RunnerStatusResponse @Router /repos/{owner}/{repo}/actions/runners/{runner_id}/status [get]

func GetUploadInstructions

func GetUploadInstructions(ctx *context.APIContext)

GetUploadInstructions returns recommended upload settings GET /api/v2/upload/instructions

func GetWikiGraphV2

func GetWikiGraphV2(ctx *context.APIContext)

GetWikiGraphV2 returns the wiki link graph

func GetWikiPageRevisionsV2

func GetWikiPageRevisionsV2(ctx *context.APIContext)

GetWikiPageRevisionsV2 returns revision history for a wiki page

func GetWikiPageV2

func GetWikiPageV2(ctx *context.APIContext)

GetWikiPageV2 gets a single wiki page with full content and metadata

func GetWikiStatsV2

func GetWikiStatsV2(ctx *context.APIContext)

GetWikiStatsV2 returns wiki statistics

func HealthCheck

func HealthCheck(ctx *context.APIContext)

HealthCheck performs a comprehensive health check @Summary Health check @Description Returns the health status of all components @Tags health @Produce json @Param detailed query bool false "Include system information" @Success 200 {object} HealthCheckResponse @Router /health [get]

func ListReleaseAttachmentsV2

func ListReleaseAttachmentsV2(ctx *context.APIContext)

ListReleaseAttachmentsV2 lists attachments for a release GET /api/v2/repos/{owner}/{repo}/releases/{id}/assets

func ListReleasesV2

func ListReleasesV2(ctx *context.APIContext)

ListReleasesV2 lists releases with enhanced filtering GET /api/v2/repos/{owner}/{repo}/releases

func ListRunnersStatus

func ListRunnersStatus(ctx *context.APIContext)

ListRunnersStatus returns status for all runners accessible to the repo @Summary List runner statuses @Description Returns status for all runners available to the repository @Tags actions @Accept json @Produce json @Param owner path string true "owner of the repo" @Param repo path string true "name of the repo" @Success 200 {array} RunnerStatusResponse @Router /repos/{owner}/{repo}/actions/runners/status [get]

func ListWikiPagesV2

func ListWikiPagesV2(ctx *context.APIContext)

ListWikiPagesV2 lists all wiki pages with enhanced metadata

func LivenessCheck

func LivenessCheck(ctx *context.APIContext)

LivenessCheck performs a simple liveness check @Summary Liveness probe @Description Returns OK if the service is running @Tags health @Produce json @Success 200 {object} map[string]any @Router /health/live [get]

func MCPHandler

func MCPHandler(ctx *context.APIContext)

MCPHandler handles MCP protocol requests @Summary MCP Protocol Endpoint @Description Handles Model Context Protocol requests for AI tool integration @Tags mcp @Accept json @Produce json @Success 200 {object} MCPResponse @Router /mcp [post]

func OperationProgress

func OperationProgress(ctx *context.APIContext)

OperationProgress streams operation progress via SSE @Summary Stream operation progress @Description Streams real-time progress updates for a long-running operation via Server-Sent Events @Tags operations @Produce text/event-stream @Param id path string true "Operation ID" @Success 200 {object} OperationProgressResponse "SSE stream of progress updates" @Failure 404 {object} map[string]any @Router /operations/{id}/progress [get]

func ReadinessCheck

func ReadinessCheck(ctx *context.APIContext)

ReadinessCheck performs a readiness check @Summary Readiness probe @Description Returns OK if the service is ready to handle requests @Tags health @Produce json @Success 200 {object} map[string]any @Success 503 {object} map[string]any @Router /health/ready [get]

func Routes

func Routes() *web.Router

Routes registers all v2 API routes to web application.

func SearchWikiV2

func SearchWikiV2(ctx *context.APIContext)

SearchWikiV2 searches wiki pages

func StreamCommits

func StreamCommits(ctx *context.APIContext)

StreamCommits streams commit history as NDJSON

func StreamFiles

func StreamFiles(ctx *context.APIContext)

StreamFiles streams file contents as NDJSON This allows AI tools to process files as they arrive without waiting for all files

func StreamIssues

func StreamIssues(ctx *context.APIContext)

StreamIssues streams issues as NDJSON

func SwaggerJSON

func SwaggerJSON(ctx *context.APIContext)

SwaggerJSON serves the OpenAPI/Swagger JSON specification for v2

func UpdateWikiPageV2

func UpdateWikiPageV2(ctx *context.APIContext)

UpdateWikiPageV2 updates an existing wiki page

func ValidateWorkflow

func ValidateWorkflow(ctx *context.APIContext)

ValidateWorkflow validates a workflow YAML and returns compatibility warnings @Summary Validate a workflow for compatibility @Description Parses workflow YAML and returns warnings about unsupported features @Tags actions @Accept json @Produce json @Param owner path string true "owner of the repo" @Param repo path string true "name of the repo" @Param body body api.WorkflowValidationRequest true "Workflow content" @Success 200 {object} api.WorkflowValidationResponse @Router /repos/{owner}/{repo}/actions/workflows/validate [post]

func Version

func Version(ctx *context.APIContext)

Version returns the Gitea version

Types

type AIIssueContextRequest

type AIIssueContextRequest struct {
	Owner       string `json:"owner" binding:"Required"`
	Repo        string `json:"repo" binding:"Required"`
	IssueNumber int64  `json:"issue_number" binding:"Required"`
}

AIIssueContextRequest represents a request for issue context

type AIIssueContextResponse

type AIIssueContextResponse struct {
	// Issue details
	Number    int64    `json:"number"`
	Title     string   `json:"title"`
	Body      string   `json:"body"`
	State     string   `json:"state"`
	Labels    []string `json:"labels"`
	Author    string   `json:"author"`
	Assignees []string `json:"assignees"`
	CreatedAt string   `json:"created_at"`
	UpdatedAt string   `json:"updated_at"`

	// Comments
	Comments []struct {
		Author    string `json:"author"`
		Body      string `json:"body"`
		CreatedAt string `json:"created_at"`
	} `json:"comments"`

	// Related info
	RelatedIssues []struct {
		Number int64  `json:"number"`
		Title  string `json:"title"`
		State  string `json:"state"`
	} `json:"related_issues,omitempty"`

	// Code references (files mentioned in issue/comments)
	CodeReferences []string `json:"code_references,omitempty"`

	// AI hints
	AIHints struct {
		Category       string   `json:"category"`   // "bug", "feature", "question", etc.
		Complexity     string   `json:"complexity"` // "simple", "moderate", "complex"
		SuggestedFiles []string `json:"suggested_files,omitempty"`
	} `json:"ai_hints"`
}

AIIssueContextResponse provides rich context about an issue

type AINavigationRequest

type AINavigationRequest struct {
	Owner string `json:"owner" binding:"Required"`
	Repo  string `json:"repo" binding:"Required"`
	Ref   string `json:"ref"`
	Query string `json:"query"` // What the AI is looking for
}

AINavigationRequest represents a request to understand repo navigation

type AINavigationResponse

type AINavigationResponse struct {
	// Directory tree (limited depth)
	Tree []TreeNode `json:"tree"`

	// Important paths
	ImportantPaths struct {
		Entrypoints []PathInfo `json:"entrypoints"`
		Config      []PathInfo `json:"config"`
		Tests       []PathInfo `json:"tests"`
		Docs        []PathInfo `json:"docs"`
	} `json:"important_paths"`

	// File type summary
	FileTypes map[string]int `json:"file_types"` // extension -> count
}

AINavigationResponse provides navigation hints for AI

type AIRepoSummaryRequest

type AIRepoSummaryRequest struct {
	Owner string `json:"owner" binding:"Required"`
	Repo  string `json:"repo" binding:"Required"`
	Ref   string `json:"ref"`
}

AIRepoSummaryRequest represents a request for AI-friendly repo summary

type AIRepoSummaryResponse

type AIRepoSummaryResponse struct {
	// Basic info
	Owner       string `json:"owner"`
	Repo        string `json:"repo"`
	FullName    string `json:"full_name"`
	Description string `json:"description"`
	Website     string `json:"website,omitempty"`
	Language    string `json:"primary_language"`

	// Repository stats
	Stars       int   `json:"stars"`
	Forks       int   `json:"forks"`
	Watchers    int   `json:"watchers"`
	OpenIssues  int   `json:"open_issues"`
	OpenPRs     int   `json:"open_pull_requests"`
	Size        int64 `json:"size_kb"`
	IsPrivate   bool  `json:"is_private"`
	IsFork      bool  `json:"is_fork"`
	IsArchived  bool  `json:"is_archived"`
	IsTemplate  bool  `json:"is_template"`
	HasWiki     bool  `json:"has_wiki"`
	HasIssues   bool  `json:"has_issues"`
	HasProjects bool  `json:"has_projects"`

	// Git info
	DefaultBranch string   `json:"default_branch"`
	Branches      []string `json:"branches"`
	Tags          []string `json:"recent_tags"`
	LastCommit    struct {
		SHA       string `json:"sha"`
		Message   string `json:"message"`
		Author    string `json:"author"`
		Timestamp string `json:"timestamp"`
	} `json:"last_commit"`

	// Structure overview
	Structure struct {
		TopLevelDirs  []string         `json:"top_level_dirs"`
		TopLevelFiles []string         `json:"top_level_files"`
		FileCount     int              `json:"total_file_count"`
		Languages     map[string]int64 `json:"languages"` // language -> bytes
		HasReadme     bool             `json:"has_readme"`
		ReadmePath    string           `json:"readme_path,omitempty"`
		HasLicense    bool             `json:"has_license"`
		LicensePath   string           `json:"license_path,omitempty"`
		HasContrib    bool             `json:"has_contributing"`
		ContribPath   string           `json:"contributing_path,omitempty"`
		ConfigFiles   []string         `json:"config_files"` // package.json, go.mod, etc.
	} `json:"structure"`

	// Recent activity
	RecentActivity struct {
		CommitsLastWeek  int `json:"commits_last_week"`
		CommitsLastMonth int `json:"commits_last_month"`
		Contributors     int `json:"contributors"`
	} `json:"recent_activity"`

	// AI-specific hints
	AIHints struct {
		SuggestedEntryPoints []string `json:"suggested_entry_points"`
		ProjectType          string   `json:"project_type"` // "library", "application", "monorepo", etc.
		BuildSystem          string   `json:"build_system,omitempty"`
		TestFramework        string   `json:"test_framework,omitempty"`
	} `json:"ai_hints"`
}

AIRepoSummaryResponse contains comprehensive repo information for AI tools

type AppUpdateResponse

type AppUpdateResponse struct {
	// URL to download the update
	URL string `json:"url"`
	// Version name (semver)
	Name string `json:"name"`
	// Release notes (markdown)
	Notes string `json:"notes"`
	// Publication date (RFC3339)
	PubDate string `json:"pub_date"`
	// Whether this is a mandatory/priority update
	Mandatory bool `json:"mandatory,omitempty"`
	// Additional platform-specific info
	Platform *PlatformInfo `json:"platform,omitempty"`
}

AppUpdateResponse represents the response for an app update check Compatible with Electron autoUpdater (Squirrel format)

type BatchFileRequest

type BatchFileRequest struct {
	Owner  string   `json:"owner" binding:"Required"`
	Repo   string   `json:"repo" binding:"Required"`
	Ref    string   `json:"ref"`
	Paths  []string `json:"paths" binding:"Required"`
	Format string   `json:"format"` // "content" or "metadata"
}

BatchFileRequest represents a request to get multiple files

type BatchFileResponse

type BatchFileResponse struct {
	Owner   string            `json:"owner"`
	Repo    string            `json:"repo"`
	Ref     string            `json:"ref"`
	Results []BatchFileResult `json:"results"`
}

BatchFileResponse represents the response for batch file retrieval

type BatchFileResult

type BatchFileResult struct {
	Path     string `json:"path"`
	Content  string `json:"content,omitempty"`
	Encoding string `json:"encoding,omitempty"`
	SHA      string `json:"sha,omitempty"`
	Size     int64  `json:"size,omitempty"`
	Type     string `json:"type,omitempty"`
	Error    string `json:"error,omitempty"`
}

BatchFileResult represents the result for a single file in batch

type BatchRepoRequest

type BatchRepoRequest struct {
	Repos []struct {
		Owner string `json:"owner"`
		Repo  string `json:"repo"`
	} `json:"repos" binding:"Required"`
	Fields []string `json:"fields"` // Which fields to include
}

BatchRepoRequest represents a request to get info about multiple repos

type BatchRepoResult

type BatchRepoResult struct {
	Owner       string `json:"owner"`
	Repo        string `json:"repo"`
	FullName    string `json:"full_name,omitempty"`
	Description string `json:"description,omitempty"`
	Private     bool   `json:"private,omitempty"`
	Fork        bool   `json:"fork,omitempty"`
	Stars       int    `json:"stars,omitempty"`
	Forks       int    `json:"forks,omitempty"`
	Language    string `json:"language,omitempty"`
	Error       string `json:"error,omitempty"`
}

BatchRepoResult represents the result for a single repo in batch

type ComponentStatus

type ComponentStatus struct {
	Name        string         `json:"name"`
	Status      string         `json:"status"`
	Message     string         `json:"message,omitempty"`
	DurationMs  float64        `json:"duration_ms"`
	LastChecked string         `json:"last_checked"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

ComponentStatus represents a component's health status

type HealthCheckResponse

type HealthCheckResponse struct {
	Status     string                      `json:"status"`
	Version    string                      `json:"version"`
	Uptime     float64                     `json:"uptime_seconds"`
	Timestamp  string                      `json:"timestamp"`
	Components map[string]*ComponentStatus `json:"components"`
	System     *health.SystemInfo          `json:"system,omitempty"`
}

HealthCheckResponse represents the health check response

type MCPContent

type MCPContent struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

type MCPError

type MCPError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

type MCPInitializeParams

type MCPInitializeParams struct {
	ProtocolVersion string            `json:"protocolVersion"`
	Capabilities    map[string]any    `json:"capabilities"`
	ClientInfo      map[string]string `json:"clientInfo"`
}

type MCPInitializeResult

type MCPInitializeResult struct {
	ProtocolVersion string            `json:"protocolVersion"`
	Capabilities    map[string]any    `json:"capabilities"`
	ServerInfo      map[string]string `json:"serverInfo"`
}

type MCPRequest

type MCPRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      any             `json:"id"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

type MCPResponse

type MCPResponse struct {
	JSONRPC string    `json:"jsonrpc"`
	ID      any       `json:"id"`
	Result  any       `json:"result,omitempty"`
	Error   *MCPError `json:"error,omitempty"`
}

type MCPTool

type MCPTool struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	InputSchema map[string]any `json:"inputSchema"`
}

MCP Tool definitions

type MCPToolCallParams

type MCPToolCallParams struct {
	Name      string         `json:"name"`
	Arguments map[string]any `json:"arguments"`
}

type MCPToolCallResult

type MCPToolCallResult struct {
	Content []MCPContent `json:"content"`
	IsError bool         `json:"isError,omitempty"`
}

type MCPToolsListResult

type MCPToolsListResult struct {
	Tools []MCPTool `json:"tools"`
}

type OperationProgressResponse

type OperationProgressResponse struct {
	OperationID  string  `json:"operation_id"`
	Type         string  `json:"type"`
	Status       string  `json:"status"`
	CurrentPhase string  `json:"current_phase,omitempty"`
	Phases       []Phase `json:"phases,omitempty"`
	Progress     int     `json:"progress"`
	BytesTotal   int64   `json:"bytes_total,omitempty"`
	BytesDone    int64   `json:"bytes_done,omitempty"`
	ItemsTotal   int     `json:"items_total,omitempty"`
	ItemsDone    int     `json:"items_done,omitempty"`
	Message      string  `json:"message,omitempty"`
	Error        string  `json:"error,omitempty"`
	StartedAt    string  `json:"started_at"`
	UpdatedAt    string  `json:"updated_at"`
	EstimatedETA string  `json:"estimated_eta,omitempty"`
	SpeedBPS     int64   `json:"speed_bps,omitempty"`
}

OperationProgressResponse represents an operation progress response

type PagesConfigResponse

type PagesConfigResponse struct {
	Enabled       bool                      `json:"enabled"`
	PublicLanding bool                      `json:"public_landing"`
	Template      string                    `json:"template"`
	Domain        string                    `json:"domain,omitempty"`
	Brand         pages_module.BrandConfig  `json:"brand"`
	Hero          pages_module.HeroConfig   `json:"hero"`
	SEO           pages_module.SEOConfig    `json:"seo"`
	Footer        pages_module.FooterConfig `json:"footer"`
}

PagesConfigResponse represents the pages configuration for a repository

type PagesContentResponse

type PagesContentResponse struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Readme      string `json:"readme,omitempty"`
}

PagesContentResponse represents the rendered content for a landing page

type PathInfo

type PathInfo struct {
	Path        string `json:"path"`
	Description string `json:"description"`
	Priority    int    `json:"priority"` // 1-10, higher is more important
}

PathInfo provides information about an important path

type Phase

type Phase struct {
	Name     string `json:"name"`
	Status   string `json:"status"`
	Progress int    `json:"progress"`
	Message  string `json:"message,omitempty"`
}

Phase represents a phase in an operation

type PlatformInfo

type PlatformInfo struct {
	// For Windows: URL to RELEASES file
	ReleasesURL string `json:"releases_url,omitempty"`
	// For Windows: URL to nupkg file
	NupkgURL string `json:"nupkg_url,omitempty"`
	// Signature/checksum for verification
	Signature string `json:"signature,omitempty"`
	// File size in bytes
	Size int64 `json:"size,omitempty"`
}

PlatformInfo contains platform-specific update information

type RunnerStatusResponse

type RunnerStatusResponse struct {
	ID           int64                 `json:"id"`
	Name         string                `json:"name"`
	IsOnline     bool                  `json:"is_online"`
	Status       string                `json:"status"`
	Version      string                `json:"version"`
	Labels       []string              `json:"labels"`
	LastOnline   *time.Time            `json:"last_online,omitempty"`
	Capabilities *api.RunnerCapability `json:"capabilities,omitempty"`
}

RunnerStatusResponse represents the runner status for API/polling

type StreamCommitItem

type StreamCommitItem struct {
	Type      string   `json:"type"` // "commit", "error", "done"
	SHA       string   `json:"sha,omitempty"`
	Message   string   `json:"message,omitempty"`
	Author    string   `json:"author,omitempty"`
	Email     string   `json:"email,omitempty"`
	Timestamp string   `json:"timestamp,omitempty"`
	Files     []string `json:"files,omitempty"`
	Error     string   `json:"error,omitempty"`
	Index     int      `json:"index,omitempty"`
	Total     int      `json:"total,omitempty"`
}

StreamCommitItem represents a single commit in the stream

type StreamCommitsRequest

type StreamCommitsRequest struct {
	Owner  string `json:"owner"`
	Repo   string `json:"repo"`
	Ref    string `json:"ref"`
	Path   string `json:"path"` // Optional: filter by path
	Limit  int    `json:"limit"`
	Offset int    `json:"offset"`
}

StreamCommitsRequest represents request for streaming commits

type StreamFileItem

type StreamFileItem struct {
	Type    string `json:"type"` // "file", "error", "done"
	Path    string `json:"path,omitempty"`
	Content string `json:"content,omitempty"`
	SHA     string `json:"sha,omitempty"`
	Size    int64  `json:"size,omitempty"`
	Error   string `json:"error,omitempty"`
	Index   int    `json:"index,omitempty"`
	Total   int    `json:"total,omitempty"`
}

StreamFileItem represents a single file in the stream

type StreamFilesRequest

type StreamFilesRequest struct {
	Owner string   `json:"owner"`
	Repo  string   `json:"repo"`
	Ref   string   `json:"ref"`
	Paths []string `json:"paths"`
}

StreamFilesRequest represents request for streaming file contents

type StreamIssueItem

type StreamIssueItem struct {
	Type      string   `json:"type"` // "issue", "error", "done"
	Number    int64    `json:"number,omitempty"`
	Title     string   `json:"title,omitempty"`
	Body      string   `json:"body,omitempty"`
	State     string   `json:"state,omitempty"`
	Labels    []string `json:"labels,omitempty"`
	Author    string   `json:"author,omitempty"`
	Assignees []string `json:"assignees,omitempty"`
	CreatedAt string   `json:"created_at,omitempty"`
	UpdatedAt string   `json:"updated_at,omitempty"`
	Comments  int      `json:"comments,omitempty"`
	Error     string   `json:"error,omitempty"`
	Index     int      `json:"index,omitempty"`
	Total     int      `json:"total,omitempty"`
}

StreamIssueItem represents a single issue in the stream

type StreamIssuesRequest

type StreamIssuesRequest struct {
	Owner  string   `json:"owner"`
	Repo   string   `json:"repo"`
	State  string   `json:"state"` // "open", "closed", "all"
	Labels []string `json:"labels"`
	Limit  int      `json:"limit"`
	Offset int      `json:"offset"`
}

StreamIssuesRequest represents request for streaming issues

type StreamWriter

type StreamWriter struct {
	// contains filtered or unexported fields
}

StreamWriter wraps response writer for NDJSON streaming

func NewStreamWriter

func NewStreamWriter(w http.ResponseWriter) *StreamWriter

NewStreamWriter creates a new NDJSON stream writer

func (*StreamWriter) WriteItem

func (sw *StreamWriter) WriteItem(item any) error

WriteItem writes a single item to the stream

type TreeNode

type TreeNode struct {
	Path     string     `json:"path"`
	Name     string     `json:"name"`
	Type     string     `json:"type"` // "file" or "dir"
	Size     int64      `json:"size,omitempty"`
	Children []TreeNode `json:"children,omitempty"`
}

TreeNode represents a node in the directory tree

type UploadInstructions

type UploadInstructions struct {
	MaxFileSize        int64    `json:"max_file_size"`
	RecommendedFlags   []string `json:"recommended_curl_flags"`
	SupportsResumable  bool     `json:"supports_resumable"`
	PreferHTTP11       bool     `json:"prefer_http11"`
	KeepaliveSeconds   int      `json:"keepalive_seconds"`
	ConnectTimeoutSecs int      `json:"connect_timeout_seconds"`
	MaxTimeoutSecs     int      `json:"max_timeout_seconds"`
	RetryCount         int      `json:"retry_count"`
	RetryDelaySeconds  int      `json:"retry_delay_seconds"`
}

UploadInstructions provides guidance for reliable uploads

type UploadResponse

type UploadResponse struct {
	ID            int64  `json:"id"`
	UUID          string `json:"uuid"`
	Name          string `json:"name"`
	Size          int64  `json:"size"`
	DownloadURL   string `json:"download_url"`
	DownloadCount int64  `json:"download_count"`
	Created       string `json:"created"`
}

UploadResponse is the response for a successful upload

type VersionResponse

type VersionResponse struct {
	Version string `json:"version"`
	API     string `json:"api"`
}

VersionResponse contains version information

Source Files

  • actions.go
  • ai_context.go
  • api.go
  • batch.go
  • docs.go
  • health.go
  • mcp.go
  • mcp_ai.go
  • misc.go
  • operations.go
  • pages_api.go
  • releases.go
  • runners.go
  • streaming.go
  • upload.go
  • wiki.go

Jump to

Keyboard shortcuts

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