feat: vendor gitea 1.16.2

This commit is contained in:
2026-06-02 08:36:01 +00:00
parent 247cd60f69
commit 54798b4615
2145 changed files with 162965 additions and 126447 deletions
@@ -12,7 +12,7 @@ type Activity struct {
UserID int64 `json:"user_id"` // Receiver user
// the type of action
//
// enum: create_repo,rename_repo,star_repo,watch_repo,commit_repo,create_issue,create_pull_request,transfer_repo,push_tag,comment_issue,merge_pull_request,close_issue,reopen_issue,close_pull_request,reopen_pull_request,delete_tag,delete_branch,mirror_sync_push,mirror_sync_create,mirror_sync_delete,approve_pull_request,reject_pull_request,comment_pull,publish_release,pull_review_dismissed,pull_request_ready_for_review,auto_merge_pull_request
// enum: ["create_repo","rename_repo","star_repo","watch_repo","commit_repo","create_issue","create_pull_request","transfer_repo","push_tag","comment_issue","merge_pull_request","close_issue","reopen_issue","close_pull_request","reopen_pull_request","delete_tag","delete_branch","mirror_sync_push","mirror_sync_create","mirror_sync_delete","approve_pull_request","reject_pull_request","comment_pull","publish_release","pull_review_dismissed","pull_request_ready_for_review","auto_merge_pull_request"]
OpType string `json:"op_type"`
// The ID of the user who performed the action
ActUserID int64 `json:"act_user_id"`
@@ -1,10 +0,0 @@
// Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
// ActivityPub type
type ActivityPub struct {
// Context defines the JSON-LD context for ActivityPub
Context string `json:"@context"`
}
+7 -1
View File
@@ -19,6 +19,8 @@ var ErrInvalidReceiveHook = errors.New("Invalid JSON payload received over webho
type Hook struct {
// The unique identifier of the webhook
ID int64 `json:"id"`
// Optional human-readable name for the webhook
Name string `json:"name"`
// The type of the webhook (e.g., gitea, slack, discord)
Type string `json:"type"`
// Branch filter pattern to determine which branches trigger the webhook
@@ -51,7 +53,7 @@ type CreateHookOptionConfig map[string]string
// CreateHookOption options when create a hook
type CreateHookOption struct {
// required: true
// enum: dingtalk,discord,gitea,gogs,msteams,slack,telegram,feishu,wechatwork,packagist
// enum: ["dingtalk","discord","gitea","gogs","msteams","slack","telegram","feishu","wechatwork","packagist"]
// The type of the webhook to create
Type string `json:"type" binding:"Required"`
// required: true
@@ -66,6 +68,8 @@ type CreateHookOption struct {
// default: false
// Whether the webhook should be active upon creation
Active bool `json:"active"`
// Optional human-readable name for the webhook
Name string `json:"name" binding:"MaxSize(255)"`
}
// EditHookOption options when modify one hook
@@ -80,6 +84,8 @@ type EditHookOption struct {
AuthorizationHeader string `json:"authorization_header"`
// Whether the webhook is active and will be triggered
Active *bool `json:"active"`
// Optional human-readable name
Name *string `json:"name,omitzero" binding:"MaxSize(255)"`
}
// Payloader payload is some part of one hook
+18 -12
View File
@@ -14,6 +14,8 @@ import (
)
// StateType issue state type
//
// swagger:enum StateType
type StateType string
const (
@@ -21,10 +23,11 @@ const (
StateOpen StateType = "open"
// StateClosed pr is closed
StateClosed StateType = "closed"
// StateAll is all
StateAll StateType = "all"
)
// StateAll is a query parameter filter value, not a valid object state.
const StateAll = "all"
// PullRequestMeta PR info if an issue is a PR
type PullRequestMeta struct {
HasMerged bool `json:"merged"`
@@ -58,15 +61,11 @@ type Issue struct {
Labels []*Label `json:"labels"`
Milestone *Milestone `json:"milestone"`
// deprecated
Assignee *User `json:"assignee"`
Assignees []*User `json:"assignees"`
// Whether the issue is open or closed
//
// type: string
// enum: open,closed
State StateType `json:"state"`
IsLocked bool `json:"is_locked"`
Comments int `json:"comments"`
Assignee *User `json:"assignee"`
Assignees []*User `json:"assignees"`
State StateType `json:"state"`
IsLocked bool `json:"is_locked"`
Comments int `json:"comments"`
// swagger:strfmt date-time
Created time.Time `json:"created_at"`
// swagger:strfmt date-time
@@ -82,6 +81,8 @@ type Issue struct {
Repo *RepositoryMeta `json:"repository"`
PinOrder int `json:"pin_order"`
// The version of the issue content for optimistic locking
ContentVersion int `json:"content_version"`
}
// CreateIssueOption options to create one issue
@@ -115,6 +116,8 @@ type EditIssueOption struct {
// swagger:strfmt date-time
Deadline *time.Time `json:"due_date"`
RemoveDeadline *bool `json:"unset_due_date"`
// The current version of the issue content to detect conflicts during editing
ContentVersion *int `json:"content_version"`
}
// EditDeadlineOption options for creating a deadline
@@ -132,6 +135,8 @@ type IssueDeadline struct {
}
// IssueFormFieldType defines issue form field type, can be "markdown", "textarea", "input", "dropdown" or "checkboxes"
//
// swagger:enum IssueFormFieldType
type IssueFormFieldType string
const (
@@ -168,7 +173,8 @@ func (iff IssueFormField) VisibleInContent() bool {
}
// IssueFormFieldVisible defines issue form field visible
// swagger:model
//
// swagger:enum IssueFormFieldVisible
type IssueFormFieldVisible string
const (
@@ -40,7 +40,7 @@ type CreateMilestoneOption struct {
// swagger:strfmt date-time
// Deadline is the due date for the milestone
Deadline *time.Time `json:"due_on"`
// enum: open,closed
// enum: ["open","closed"]
// State indicates the initial state of the milestone
State string `json:"state"`
}
@@ -52,6 +52,7 @@ type EditMilestoneOption struct {
// Description provides updated details about the milestone
Description *string `json:"description"`
// State indicates the updated state of the milestone
// enum: ["open","closed"]
State *string `json:"state"`
// Deadline is the updated due date for the milestone
Deadline *time.Time `json:"due_on"`
@@ -40,7 +40,7 @@ type NotificationSubject struct {
// Type indicates the type of the notification subject
Type NotifySubjectType `json:"type" binding:"In(Issue,Pull,Commit,Repository)"`
// State indicates the current state of the notification subject
State StateType `json:"state"`
State NotifySubjectStateType `json:"state"`
}
// NotificationCount number of unread notifications
@@ -49,7 +49,22 @@ type NotificationCount struct {
New int64 `json:"new"`
}
// NotifySubjectStateType represents the state of a notification subject
// swagger:enum NotifySubjectStateType
type NotifySubjectStateType string
const (
// NotifySubjectStateOpen is an open subject
NotifySubjectStateOpen NotifySubjectStateType = "open"
// NotifySubjectStateClosed is a closed subject
NotifySubjectStateClosed NotifySubjectStateType = "closed"
// NotifySubjectStateMerged is a merged pull request
NotifySubjectStateMerged NotifySubjectStateType = "merged"
)
// NotifySubjectType represent type of notification subject
//
// swagger:enum NotifySubjectType
type NotifySubjectType string
const (
+9 -11
View File
@@ -60,29 +60,27 @@ type CreateOrgOption struct {
// The location of the organization
Location string `json:"location" binding:"MaxSize(50)"`
// possible values are `public` (default), `limited` or `private`
// enum: public,limited,private
// enum: ["public","limited","private"]
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
// Whether repository administrators can change team access
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
}
// TODO: make EditOrgOption fields optional after https://gitea.com/go-chi/binding/pulls/5 got merged
// EditOrgOption options for editing an organization
type EditOrgOption struct {
// The full display name of the organization
FullName string `json:"full_name" binding:"MaxSize(100)"`
// The email address of the organization
Email string `json:"email" binding:"MaxSize(255)"`
FullName *string `json:"full_name" binding:"MaxSize(100)"`
// The email address of the organization; use empty string to clear
Email *string `json:"email" binding:"MaxSize(255)"`
// The description of the organization
Description string `json:"description" binding:"MaxSize(255)"`
Description *string `json:"description" binding:"MaxSize(255)"`
// The website URL of the organization
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
Website *string `json:"website" binding:"ValidUrl;MaxSize(255)"`
// The location of the organization
Location string `json:"location" binding:"MaxSize(50)"`
Location *string `json:"location" binding:"MaxSize(50)"`
// possible values are `public`, `limited` or `private`
// enum: public,limited,private
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
// enum: ["public","limited","private"]
Visibility *string `json:"visibility" binding:"In(,public,limited,private)"`
// Whether repository administrators can change team access
RepoAdminChangeTeamAccess *bool `json:"repo_admin_change_team_access"`
}
@@ -16,7 +16,7 @@ type Team struct {
Organization *Organization `json:"organization"`
// Whether the team has access to all repositories in the organization
IncludesAllRepositories bool `json:"includes_all_repositories"`
// enum: none,read,write,admin,owner
// enum: ["none","read","write","admin","owner"]
Permission string `json:"permission"`
// example: ["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.projects","repo.ext_wiki"]
// Deprecated: This variable should be replaced by UnitsMap and will be dropped in later versions.
@@ -35,7 +35,7 @@ type CreateTeamOption struct {
Description string `json:"description" binding:"MaxSize(255)"`
// Whether the team has access to all repositories in the organization
IncludesAllRepositories bool `json:"includes_all_repositories"`
// enum: read,write,admin
// enum: ["read","write","admin"]
Permission string `json:"permission"`
// example: ["repo.actions","repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.ext_wiki","repo.pulls","repo.releases","repo.projects","repo.ext_wiki"]
// Deprecated: This variable should be replaced by UnitsMap and will be dropped in later versions.
@@ -54,7 +54,7 @@ type EditTeamOption struct {
Description *string `json:"description" binding:"MaxSize(255)"`
// Whether the team has access to all repositories in the organization
IncludesAllRepositories *bool `json:"includes_all_repositories"`
// enum: read,write,admin
// enum: ["read","write","admin"]
Permission string `json:"permission"`
// example: ["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.projects","repo.ext_wiki"]
// Deprecated: This variable should be replaced by UnitsMap and will be dropped in later versions.
@@ -91,6 +91,8 @@ type PullRequest struct {
// The pin order for the pull request
PinOrder int `json:"pin_order"`
// The version of the pull request content for optimistic locking
ContentVersion int `json:"content_version"`
}
// PRBranchInfo information about a branch
@@ -140,6 +142,8 @@ type CreatePullRequestOption struct {
Reviewers []string `json:"reviewers"`
// The list of team reviewer names
TeamReviewers []string `json:"team_reviewers"`
// Whether maintainers can edit the pull request
AllowMaintainerEdit *bool `json:"allow_maintainer_edit"`
}
// EditPullRequestOption options when modify pull request
@@ -166,6 +170,8 @@ type EditPullRequestOption struct {
RemoveDeadline *bool `json:"unset_due_date"`
// Whether to allow maintainer edits
AllowMaintainerEdit *bool `json:"allow_maintainer_edit"`
// The current version of the pull request content to detect conflicts during editing
ContentVersion *int `json:"content_version"`
}
// ChangedFile store information about files affected by the pull request
@@ -8,6 +8,8 @@ import (
)
// ReviewStateType review state type
//
// swagger:enum ReviewStateType
type ReviewStateType string
const (
@@ -21,10 +23,11 @@ const (
ReviewStateRequestChanges ReviewStateType = "REQUEST_CHANGES"
// ReviewStateRequestReview review is requested from user
ReviewStateRequestReview ReviewStateType = "REQUEST_REVIEW"
// ReviewStateUnknown state of pr is unknown
ReviewStateUnknown ReviewStateType = ""
)
// ReviewStateUnknown is an internal sentinel for unknown review state, not a valid API value.
const ReviewStateUnknown = ""
// PullReview represents a pull request review
type PullReview struct {
ID int64 `json:"id"`
@@ -72,7 +75,7 @@ type PullReviewComment struct {
HTMLPullURL string `json:"pull_request_url"`
}
// CreatePullReviewOptions are options to create a pull review
// CreatePullReviewOptions are options to create a pull request review
type CreatePullReviewOptions struct {
Event ReviewStateType `json:"event"`
Body string `json:"body"`
@@ -91,19 +94,19 @@ type CreatePullReviewComment struct {
NewLineNum int64 `json:"new_position"`
}
// SubmitPullReviewOptions are options to submit a pending pull review
// SubmitPullReviewOptions are options to submit a pending pull request review
type SubmitPullReviewOptions struct {
Event ReviewStateType `json:"event"`
Body string `json:"body"`
}
// DismissPullReviewOptions are options to dismiss a pull review
// DismissPullReviewOptions are options to dismiss a pull request review
type DismissPullReviewOptions struct {
Message string `json:"message"`
Priors bool `json:"priors"`
}
// PullReviewRequestOptions are options to add or remove pull review requests
// PullReviewRequestOptions are options to add or remove pull request review requests
type PullReviewRequestOptions struct {
Reviewers []string `json:"reviewers"`
TeamReviewers []string `json:"team_reviewers"`
+45 -28
View File
@@ -58,26 +58,28 @@ type Repository struct {
Fork bool `json:"fork"`
Template bool `json:"template"`
// the original repository if this repository is a fork, otherwise null
Parent *Repository `json:"parent,omitempty"`
Mirror bool `json:"mirror"`
Size int `json:"size"`
Language string `json:"language"`
LanguagesURL string `json:"languages_url"`
HTMLURL string `json:"html_url"`
URL string `json:"url"`
Link string `json:"link"`
SSHURL string `json:"ssh_url"`
CloneURL string `json:"clone_url"`
OriginalURL string `json:"original_url"`
Website string `json:"website"`
Stars int `json:"stars_count"`
Forks int `json:"forks_count"`
Watchers int `json:"watchers_count"`
OpenIssues int `json:"open_issues_count"`
OpenPulls int `json:"open_pr_counter"`
Releases int `json:"release_counter"`
DefaultBranch string `json:"default_branch"`
Archived bool `json:"archived"`
Parent *Repository `json:"parent,omitempty"`
Mirror bool `json:"mirror"`
Size int `json:"size"`
Language string `json:"language"`
LanguagesURL string `json:"languages_url"`
HTMLURL string `json:"html_url"`
URL string `json:"url"`
Link string `json:"link"`
SSHURL string `json:"ssh_url"`
CloneURL string `json:"clone_url"`
OriginalURL string `json:"original_url"`
Website string `json:"website"`
Stars int `json:"stars_count"`
Forks int `json:"forks_count"`
Watchers int `json:"watchers_count"`
BranchCount int `json:"branch_count"`
OpenIssues int `json:"open_issues_count"`
OpenPulls int `json:"open_pr_counter"`
Releases int `json:"release_counter"`
DefaultBranch string `json:"default_branch"`
DefaultTargetBranch string `json:"default_target_branch,omitempty"`
Archived bool `json:"archived"`
// swagger:strfmt date-time
Created time.Time `json:"created_at"`
// swagger:strfmt date-time
@@ -112,7 +114,7 @@ type Repository struct {
Internal bool `json:"internal"`
MirrorInterval string `json:"mirror_interval"`
// ObjectFormatName of the underlying git repository
// enum: sha1,sha256
// enum: ["sha1","sha256"]
ObjectFormatName string `json:"object_format_name"`
// swagger:strfmt date-time
MirrorUpdated time.Time `json:"mirror_updated"`
@@ -134,7 +136,7 @@ type CreateRepoOption struct {
// Whether the repository is private
Private bool `json:"private"`
// Label-Set to use
IssueLabels string `json:"issue_labels"`
IssueLabels string `json:"issue_labels" binding:"MaxSize(255)"`
// Whether the repository should be auto-initialized?
AutoInit bool `json:"auto_init"`
// Whether the repository is template
@@ -142,16 +144,16 @@ type CreateRepoOption struct {
// Gitignores to use
Gitignores string `json:"gitignores"`
// License to use
License string `json:"license"`
License string `json:"license" binding:"MaxSize(100)"`
// Readme of the repository to create
Readme string `json:"readme"`
Readme string `json:"readme" binding:"MaxSize(255)"`
// DefaultBranch of the repository (used when initializes and in template)
DefaultBranch string `json:"default_branch" binding:"GitRefName;MaxSize(100)"`
// TrustModel of the repository
// enum: default,collaborator,committer,collaboratorcommitter
// enum: ["default","collaborator","committer","collaboratorcommitter"]
TrustModel string `json:"trust_model"`
// ObjectFormatName of the underlying git repository
// enum: sha1,sha256
// ObjectFormatName of the underlying git repository, empty string for default (sha1)
// enum: ["sha1","sha256"]
ObjectFormatName string `json:"object_format_name" binding:"MaxSize(6)"`
}
@@ -292,6 +294,21 @@ type RenameBranchRepoOption struct {
Name string `json:"name" binding:"Required;GitRefName;MaxSize(100)"`
}
// UpdateBranchRepoOption options when updating a branch reference in a repository
// swagger:model
type UpdateBranchRepoOption struct {
// New commit SHA (or any ref) the branch should point to
//
// required: true
NewCommitID string `json:"new_commit_id" binding:"Required"`
// Expected old commit SHA of the branch; if provided it must match the current tip
OldCommitID string `json:"old_commit_id"`
// Force update even if the change is not a fast-forward
Force bool `json:"force"`
}
// TransferRepoOption options when transfer a repository's ownership
// swagger:model
type TransferRepoOption struct {
@@ -361,7 +378,7 @@ type MigrateRepoOptions struct {
// required: true
RepoName string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
// enum: git,github,gitea,gitlab,gogs,onedev,gitbucket,codebase,codecommit
// enum: ["git","github","gitea","gitlab","gogs","onedev","gitbucket","codebase","codecommit"]
Service string `json:"service"`
AuthUsername string `json:"auth_username"`
AuthPassword string `json:"auth_password"`
@@ -196,12 +196,27 @@ type ActionRunner struct {
Name string `json:"name"`
Status string `json:"status"`
Busy bool `json:"busy"`
Disabled bool `json:"disabled"`
Ephemeral bool `json:"ephemeral"`
Labels []*ActionRunnerLabel `json:"labels"`
}
// EditActionRunnerOption represents the editable fields for a runner.
// swagger:model
type EditActionRunnerOption struct {
// required: true
Disabled *bool `json:"disabled"`
}
// ActionRunnersResponse returns Runners
type ActionRunnersResponse struct {
Entries []*ActionRunner `json:"runners"`
TotalCount int64 `json:"total_count"`
}
// RunDetails returns workflow_dispatch runid and url
type RunDetails struct {
WorkflowRunID int64 `json:"workflow_run_id"`
RunURL string `json:"run_url"`
HTMLURL string `json:"html_url"`
}
@@ -5,7 +5,7 @@ package structs
// AddCollaboratorOption options when adding a user as a collaborator of a repository
type AddCollaboratorOption struct {
// enum: read,write,admin
// enum: ["read","write","admin"]
// Permission level to grant the collaborator
Permission *string `json:"permission"`
}
@@ -8,12 +8,14 @@ import "time"
// FileOptions options for all file APIs
type FileOptions struct {
// message (optional) for the commit of this file. if not supplied, a default message will be used
// message (optional) is the commit message of the changes. If not supplied, a default message will be used
Message string `json:"message"`
// branch (optional) to base this file from. if not given, the default branch is used
// branch (optional) is the base branch for the changes. If not supplied, the default branch is used
BranchName string `json:"branch" binding:"GitRefName;MaxSize(100)"`
// new_branch (optional) will make a new branch from `branch` before creating the file
// new_branch (optional) will make a new branch from base branch for the changes. If not supplied, the changes will be committed to the base branch
NewBranchName string `json:"new_branch" binding:"GitRefName;MaxSize(100)"`
// force_push (optional) will do a force-push if the new branch already exists
ForcePush bool `json:"force_push"`
// `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
Author Identity `json:"author"`
Committer Identity `json:"committer"`
@@ -22,13 +24,6 @@ type FileOptions struct {
Signoff bool `json:"signoff"`
}
type FileOptionsWithSHA struct {
FileOptions
// the blob ID (SHA) for the file that already exists, it is required for changing existing files
// required: true
SHA string `json:"sha" binding:"Required"`
}
func (f *FileOptions) GetFileOptions() *FileOptions {
return f
}
@@ -39,7 +34,7 @@ type FileOptionsInterface interface {
var _ FileOptionsInterface = (*FileOptions)(nil)
// CreateFileOptions options for creating files
// CreateFileOptions options for creating a file
// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
type CreateFileOptions struct {
FileOptions
@@ -48,16 +43,21 @@ type CreateFileOptions struct {
ContentBase64 string `json:"content"`
}
// DeleteFileOptions options for deleting files (used for other File structs below)
// DeleteFileOptions options for deleting a file
// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
type DeleteFileOptions struct {
FileOptionsWithSHA
FileOptions
// the blob ID (SHA) for the file to delete
// required: true
SHA string `json:"sha" binding:"Required"`
}
// UpdateFileOptions options for updating files
// UpdateFileOptions options for updating or creating a file
// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
type UpdateFileOptions struct {
FileOptionsWithSHA
FileOptions
// the blob ID (SHA) for the file that already exists to update, or leave it empty to create a new file
SHA string `json:"sha"`
// content must be base64 encoded
// required: true
ContentBase64 string `json:"content"`
@@ -72,7 +72,7 @@ type ChangeFileOperation struct {
// indicates what to do with the file: "create" for creating a new file, "update" for updating an existing file,
// "upload" for creating or updating a file, "rename" for renaming a file, and "delete" for deleting an existing file.
// required: true
// enum: create,update,upload,rename,delete
// enum: ["create","update","upload","rename","delete"]
Operation string `json:"operation" binding:"Required"`
// path to the existing or new file
// required: true