v2

package
v3.1.61 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT, MIT Imports: 58 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_service.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.