Documentation
¶
Index ¶
- Constants
- Variables
- func ActionValueName(name string) string
- func AddDraftPrefix(title string) string
- func Classify(err error, kind, key, scope string) error
- func CurrentAccount(ctx context.Context, client *transport.Client) (string, error)
- func IsForbidden(err error) bool
- func IsNotFound(err error) bool
- func IsUnauthorized(err error) bool
- func MatchAccount(selected, authenticated string) bool
- func MaxPageSize(ctx context.Context, client *transport.Client) (int, error)
- func OfficialApprovals(reviews []Review, skipStale bool) int64
- func OwnerExists(ctx context.Context, client *transport.Client, name string) error
- func RequestedReviewers(reviews []Review) (users, teams []string)
- func ReviewDecision(reviews []Review, requested bool) string
- func ServerVersion(ctx context.Context, client *transport.Client) (string, error)
- func StripDraftPrefix(title string) string
- func SuccessfulRun(run Run) bool
- func Tally(items []Check) (failing, pending, passed int)
- func TokenScopes(ctx context.Context, client *transport.Client) ([]string, error)
- func UnitAccess(unit string) []string
- func UnitPolicy(access string) map[string]string
- type API
- type APIOptions
- type AccountStatus
- type ActionScope
- type ActionSecret
- type ActionSecrets
- type ActionVariable
- type ActionVariables
- func (s ActionVariables) Delete(ctx context.Context, name string) error
- func (s ActionVariables) ListPage(ctx context.Context, limit, page int) (Page[ActionVariable], error)
- func (s ActionVariables) Set(ctx context.Context, name, value string, newDescription *string) (ActionVariable, error)
- func (s ActionVariables) View(ctx context.Context, name string) (ActionVariable, error)
- type Actions
- func (s Actions) AllArtifacts(ctx context.Context, run int64) ([]Artifact, error)
- func (s Actions) Artifacts(ctx context.Context, run int64, limit, page int) (Page[Artifact], error)
- func (s Actions) CancelRun(ctx context.Context, id int64, force bool) (Run, error)
- func (s Actions) DeleteRun(ctx context.Context, id int64) error
- func (s Actions) Dispatch(ctx context.Context, id, ref string, inputs map[string]string) (DispatchResult, error)
- func (s Actions) DownloadArtifact(ctx context.Context, id int64) (io.ReadCloser, error)
- func (s Actions) FindWorkflow(ctx context.Context, raw string) (Workflow, error)
- func (s Actions) FollowJobLogs(ctx context.Context, run, id int64, interval time.Duration, ...) error
- func (s Actions) JobLogs(ctx context.Context, id int64) (io.ReadCloser, error)
- func (s Actions) Jobs(ctx context.Context, run int64) ([]Job, error)
- func (s Actions) JobsPage(ctx context.Context, run int64, limit, page int) (Page[Job], error)
- func (s Actions) NameRun(ctx context.Context, run Run) Run
- func (s Actions) Rerun(ctx context.Context, id, job int64, failedOnly bool) error
- func (s Actions) Run(ctx context.Context, id int64) (Run, error)
- func (s Actions) RunDetails(ctx context.Context, id int64) (Run, error)
- func (s Actions) RunJob(ctx context.Context, run, id int64) (Job, error)
- func (s Actions) RunLogsArchive(ctx context.Context, run int64) (io.ReadCloser, error)
- func (s Actions) Runs(ctx context.Context, opts RunListOptions) ([]Run, error)
- func (s Actions) RunsPage(ctx context.Context, opts RunListOptions) (Page[Run], error)
- func (s Actions) SetWorkflowEnabled(ctx context.Context, id string, enabled bool) error
- func (s Actions) WaitForFirstJob(ctx context.Context, run int64, interval time.Duration) (Job, error)
- func (s Actions) Watch(ctx context.Context, id int64, interval time.Duration, update func(Run) error) (Run, error)
- func (s Actions) Workflow(ctx context.Context, id string) (Workflow, error)
- func (s Actions) WorkflowFile(ctx context.Context, workflow Workflow, ref string) ([]byte, error)
- func (s Actions) Workflows(ctx context.Context) ([]Workflow, error)
- type AdminUser
- type AdminUserOptions
- type AdminUsers
- func (s AdminUsers) Create(ctx context.Context, username string, opts AdminUserOptions) (AdminUser, error)
- func (s AdminUsers) Delete(ctx context.Context, username string, purge bool) error
- func (s AdminUsers) Edit(ctx context.Context, username string, opts AdminUserOptions) (AdminUser, error)
- func (s AdminUsers) List(ctx context.Context, query string, limit, page int) (Page[AdminUser], error)
- func (s AdminUsers) Search(ctx context.Context, query string, limit int) ([]AdminUser, error)
- func (s AdminUsers) View(ctx context.Context, username string) (AdminUser, error)
- type AmbiguousError
- type Artifact
- type Assignee
- type Board
- type Branch
- type Branches
- func (s Branches) Create(ctx context.Context, repo, branch, source string) (Branch, error)
- func (s Branches) Delete(ctx context.Context, repo, branch string) error
- func (s Branches) EditProtection(ctx context.Context, repo string, rule Protection, changes ProtectionChanges) error
- func (s Branches) Find(ctx context.Context, repo, branch string) (Branch, error)
- func (s Branches) ListPage(ctx context.Context, repo string, limit, page int) (Page[Branch], error)
- func (s Branches) Protect(ctx context.Context, repo string, rule Protection) (bool, error)
- func (s Branches) Rename(ctx context.Context, repo, oldName, newName string) error
- func (s Branches) RequireAll(ctx context.Context, repo string, branches []string) error
- func (s Branches) Unprotect(ctx context.Context, repo, rule string) (bool, error)
- func (s Branches) View(ctx context.Context, repo, branch string) (Branch, error)
- type CapabilityError
- type Check
- type Comment
- type Comments
- func (s Comments) Create(ctx context.Context, n int64, body string) (Comment, error)
- func (s Comments) Delete(ctx context.Context, id int64) error
- func (s Comments) Edit(ctx context.Context, id int64, body string) (Comment, error)
- func (s Comments) List(ctx context.Context, n int64) ([]Comment, error)
- func (s Comments) Page(ctx context.Context, n int64, limit, page int) (Page[Comment], error)
- func (s Comments) UploadAttachment(ctx context.Context, id int64, name string, input io.Reader) (IssueAttachment, error)
- func (s Comments) View(ctx context.Context, id int64) (Comment, error)
- type ConflictError
- type CreateSelectables
- type DeployKey
- type DeployKeys
- func (s DeployKeys) Create(ctx context.Context, title, key string, readOnly bool) (DeployKey, error)
- func (s DeployKeys) Delete(ctx context.Context, id int64) error
- func (s DeployKeys) List(ctx context.Context, limit, page int) (Page[DeployKey], error)
- func (s DeployKeys) View(ctx context.Context, id int64) (DeployKey, error)
- type DiscussionSearchOptions
- type DispatchResult
- type DroppedPushersError
- type ForkOptions
- type InlineComment
- type Issue
- type IssueAttachment
- type IssueCreateSelectables
- type IssueDependencies
- type IssueEdit
- type IssueLabelCatalog
- type IssueMilestone
- type IssueOptions
- type IssueReference
- type IssueTemplate
- type Issues
- func (s Issues) Attachment(ctx context.Context, number, id int64) (IssueAttachment, error)
- func (s Issues) Attachments(ctx context.Context, number int64, limit, page int) (Page[IssueAttachment], error)
- func (s Issues) Create(ctx context.Context, options IssueOptions) (Issue, error)
- func (s Issues) CreateSelectables(ctx context.Context) (IssueCreateSelectables, error)
- func (s Issues) DeleteAttachment(ctx context.Context, number, id int64) error
- func (s Issues) Dependencies(ctx context.Context, number int64) (IssueDependencies, error)
- func (s Issues) DownloadAttachment(ctx context.Context, number, id int64) (IssueAttachment, func() (io.ReadCloser, error), error)
- func (s Issues) Edit(ctx context.Context, n int64, opts IssueEdit) (Issue, error)
- func (s Issues) EditSelectables(ctx context.Context) (CreateSelectables, error)
- func (s Issues) IssueTemplates(ctx context.Context) ([]IssueTemplate, error)
- func (s Issues) Kind(ctx context.Context, number int64) (string, error)
- func (s Issues) List(ctx context.Context, opts ListOptions) ([]Issue, bool, error)
- func (s Issues) ListPage(ctx context.Context, opts ListOptions) (Page[Issue], error)
- func (s Issues) RemoveMilestone(ctx context.Context, n int64, milestone Milestone) (Issue, error)
- func (s Issues) RenameAttachment(ctx context.Context, number, id int64, name string) (IssueAttachment, error)
- func (s Issues) Search(ctx context.Context, opts DiscussionSearchOptions) ([]SearchItem, error)
- func (s Issues) SearchPage(ctx context.Context, opts DiscussionSearchOptions) (Page[SearchItem], error)
- func (s Issues) SetBlockedBy(ctx context.Context, n int64, blocker IssueReference, block bool) error
- func (s Issues) SetState(ctx context.Context, number int64, state string) (Issue, error)
- func (s Issues) Timeline(ctx context.Context, n int64, limit, page int) (Page[TimelineEvent], error)
- func (s Issues) UploadAttachment(ctx context.Context, number int64, name string, input io.Reader) (IssueAttachment, error)
- func (s Issues) View(ctx context.Context, number int64) (Issue, error)
- type Job
- type Label
- type LabelOptions
- type Labels
- func (s Labels) All(ctx context.Context) ([]Label, error)
- func (s Labels) Create(ctx context.Context, opts LabelOptions) (Label, error)
- func (s Labels) CreateUnique(ctx context.Context, existing []Label, opts LabelOptions, update bool) (Label, bool, error)
- func (s Labels) Delete(ctx context.Context, id int64) error
- func (s Labels) Edit(ctx context.Context, id int64, opts LabelOptions) (Label, error)
- func (s Labels) EditUnique(ctx context.Context, existing []Label, current Label, opts LabelOptions) (Label, error)
- func (s Labels) Find(ctx context.Context, raws []string, byName bool) ([]Label, error)
- func (s Labels) FindIn(items []Label, raw string, byName bool) (Label, error)
- func (s Labels) IssueCatalog(ctx context.Context) (IssueLabelCatalog, error)
- func (s Labels) List(ctx context.Context, limit, page int) ([]Label, error)
- func (s Labels) ListPage(ctx context.Context, limit, page int) (Page[Label], error)
- func (s Labels) RequireFilterNames(ctx context.Context, names []string) error
- func (s Labels) ResolveIssueNames(ctx context.Context, names []string) ([]int64, error)
- func (s Labels) Scope() string
- type ListOptions
- type MemberListOptions
- type MergeOptions
- type MergeSettings
- type MetadataChanges
- type Milestone
- type MilestoneOptions
- type Milestones
- func (s Milestones) All(ctx context.Context) ([]Milestone, error)
- func (s Milestones) AllIn(ctx context.Context, state string) ([]Milestone, error)
- func (s Milestones) Create(ctx context.Context, opts MilestoneOptions) (Milestone, error)
- func (s Milestones) CreateUnique(ctx context.Context, opts MilestoneOptions, update bool) (Milestone, bool, error)
- func (s Milestones) Delete(ctx context.Context, id int64) error
- func (s Milestones) Edit(ctx context.Context, id int64, opts MilestoneOptions) (Milestone, error)
- func (s Milestones) EditUnique(ctx context.Context, existing []Milestone, current Milestone, ...) (Milestone, error)
- func (s Milestones) FilterIDs(ctx context.Context, values []string) ([]string, error)
- func (s Milestones) FilterValue(ctx context.Context, item Milestone) (string, error)
- func (s Milestones) Find(ctx context.Context, raws []string, byName bool) ([]Milestone, error)
- func (s Milestones) FindIn(items []Milestone, raw string, byName bool) (Milestone, error)
- func (s Milestones) FindOne(ctx context.Context, raw string, byName bool) (Milestone, error)
- func (s Milestones) List(ctx context.Context, state string, limit, page int) ([]Milestone, error)
- type NameOrID
- type NotFoundError
- type NotInMilestoneError
- type NotPlainCommentError
- type NotPullError
- type Notification
- type NotificationOptions
- type Notifications
- func (s Notifications) LatestComment(ctx context.Context, item Notification) (*Comment, error)
- func (s Notifications) List(ctx context.Context, opts NotificationOptions) (Page[Notification], error)
- func (s Notifications) Mark(ctx context.Context, id int64, status string) (Notification, error)
- func (s Notifications) MarkAll(ctx context.Context, status string, filters []string, before time.Time) ([]Notification, error)
- func (s Notifications) View(ctx context.Context, id int64) (Notification, error)
- func (s Notifications) Watch(ctx context.Context, opts NotificationOptions, interval time.Duration, ...) error
- type Organization
- type OrganizationMember
- type OrganizationOptions
- type OrganizationSize
- type Organizations
- func (s Organizations) CanGrantTeamAccess(ctx context.Context, org string, team int64) (bool, error)
- func (s Organizations) Create(ctx context.Context, opts OrganizationOptions) (Organization, error)
- func (s Organizations) Delete(ctx context.Context, name string) error
- func (s Organizations) Edit(ctx context.Context, name string, opts OrganizationOptions) (Organization, error)
- func (s Organizations) IsMember(ctx context.Context, name, username string) (bool, error)
- func (s Organizations) IsPublicMember(ctx context.Context, name, username string) (bool, error)
- func (s Organizations) List(ctx context.Context, mine bool, username string, limit, page int) (Page[Organization], error)
- func (s Organizations) Members(ctx context.Context, name string, opts MemberListOptions) (Page[OrganizationMember], error)
- func (s Organizations) RemoveMember(ctx context.Context, name, username string) error
- func (s Organizations) RepositoryCount(ctx context.Context, name string) (*int, error)
- func (s Organizations) SetMemberPublic(ctx context.Context, name, username string, public bool) error
- func (s Organizations) Size(ctx context.Context, name string) (OrganizationSize, error)
- func (s Organizations) View(ctx context.Context, name string) (Organization, error)
- type Package
- type PackageFile
- type PackageListOptions
- type Packages
- func (s Packages) CheckGenericUpload(ctx context.Context, name, version string, files []string) error
- func (s Packages) Delete(ctx context.Context, kind, name, version string) error
- func (s Packages) Files(ctx context.Context, kind, name, version string) ([]PackageFile, error)
- func (s Packages) Link(ctx context.Context, kind, name, repository string) error
- func (s Packages) List(ctx context.Context, opts PackageListOptions) (Page[Package], error)
- func (s Packages) UploadGeneric(ctx context.Context, name, version, file string, input io.Reader) error
- func (s Packages) Versions(ctx context.Context, kind, name string, limit, page int) (Page[Package], error)
- func (s Packages) View(ctx context.Context, kind, name, version string) (Package, error)
- type Page
- type PartialEditError
- type Projects
- type Protection
- type ProtectionChanges
- type Pull
- type PullCreateChoices
- type PullEdit
- type PullListOptions
- type PullOptions
- type PullRepository
- type PullStatus
- type Pulls
- func (s Pulls) Base(ctx context.Context) (PullRepository, error)
- func (s Pulls) CheckUsers(ctx context.Context, assignees, reviewers []string) error
- func (s Pulls) Checks(ctx context.Context, n int64) ([]Check, error)
- func (s Pulls) CommitChecks(ctx context.Context, sha string) ([]Check, error)
- func (s Pulls) Create(ctx context.Context, opts PullOptions) (Pull, error)
- func (s Pulls) CreateChoices(ctx context.Context) (PullCreateChoices, error)
- func (s Pulls) DeleteHead(ctx context.Context, item Pull) error
- func (s Pulls) Detail(ctx context.Context, items []Pull, view, reviews bool) ([]Pull, error)
- func (s Pulls) Diff(ctx context.Context, n int64) (io.ReadCloser, error)
- func (s Pulls) Edit(ctx context.Context, n int64, opts PullEdit) (Pull, error)
- func (s Pulls) EditFrom(ctx context.Context, n int64, opts PullEdit, before *Pull) (Pull, error)
- func (s Pulls) Files(ctx context.Context, n int64) ([]string, error)
- func (s Pulls) List(ctx context.Context, options PullListOptions) ([]Pull, bool, error)
- func (s Pulls) ListOpen(ctx context.Context) ([]Pull, error)
- func (s Pulls) ListPage(ctx context.Context, options PullListOptions) (Page[Pull], error)
- func (s Pulls) Merge(ctx context.Context, n int64, opts MergeOptions) error
- func (s Pulls) MergeSettings(ctx context.Context) (MergeSettings, error)
- func (s Pulls) NewestClosed(ctx context.Context, keep func(Pull) bool) (Pull, bool, error)
- func (s Pulls) PushableFork(ctx context.Context, repo string) (bool, error)
- func (s Pulls) Template(ctx context.Context, ref string) (string, error)
- func (s Pulls) View(ctx context.Context, n int64) (Pull, error)
- func (s Pulls) WatchChecks(ctx context.Context, n int64, interval time.Duration, ...) ([]Check, error)
- func (s Pulls) WithReviews(ctx context.Context, p Pull, reviews []Review) Pull
- type RefusedError
- type Release
- type ReleaseAsset
- type ReleaseOptions
- type Releases
- func (s Releases) Archive(ctx context.Context, ref, format string) (io.ReadCloser, error)
- func (s Releases) Create(ctx context.Context, opts ReleaseOptions) (Release, error)
- func (s Releases) Delete(ctx context.Context, item Release, deleteTag bool) error
- func (s Releases) DeleteAsset(ctx context.Context, id, asset int64) error
- func (s Releases) DownloadAsset(ctx context.Context, id, asset int64) (io.ReadCloser, error)
- func (s Releases) Edit(ctx context.Context, id int64, opts ReleaseOptions) (Release, error)
- func (s Releases) Latest(ctx context.Context) (Release, error)
- func (s Releases) ListPage(ctx context.Context, limit, page int) (Page[Release], error)
- func (s Releases) RenameAsset(ctx context.Context, id, asset int64, name string) (ReleaseAsset, error)
- func (s Releases) TagExists(ctx context.Context, tag string) (bool, error)
- func (s Releases) UploadAsset(ctx context.Context, id int64, name string, input io.Reader) (ReleaseAsset, error)
- func (s Releases) View(ctx context.Context, tag string) (Release, error)
- type Repositories
- func (s Repositories) Assignees(ctx context.Context, repo string) ([]Assignee, error)
- func (s Repositories) Create(ctx context.Context, org string, opts RepositoryOptions) (Repository, error)
- func (s Repositories) CreateChoices(ctx context.Context) (RepositoryCreateChoices, error)
- func (s Repositories) Delete(ctx context.Context, repo string) error
- func (s Repositories) Edit(ctx context.Context, repo string, opts RepositoryEdit) (Repository, error)
- func (s Repositories) Fork(ctx context.Context, repo string, opts ForkOptions) (Repository, bool, error)
- func (s Repositories) Generate(ctx context.Context, source string, opts RepositoryTemplateOptions) (Repository, error)
- func (s Repositories) Gitignores(ctx context.Context) ([]string, error)
- func (s Repositories) LabelTemplates(ctx context.Context) ([]string, error)
- func (s Repositories) Licenses(ctx context.Context) ([]string, error)
- func (s Repositories) List(ctx context.Context, opts RepositoryListOptions) ([]Repository, bool, error)
- func (s Repositories) ListPage(ctx context.Context, opts RepositoryListOptions) (Page[Repository], error)
- func (s Repositories) MergeUpstream(ctx context.Context, repo, branch string) (string, error)
- func (s Repositories) Migrate(ctx context.Context, opts RepositoryMigrationOptions) (Repository, error)
- func (s Repositories) MirrorSync(ctx context.Context, repo string) error
- func (s Repositories) Readme(ctx context.Context, repo, ref string) (path, content string, err error)
- func (s Repositories) Search(ctx context.Context, opts RepositorySearchOptions) (Page[Repository], error)
- func (s Repositories) SetTopics(ctx context.Context, repo string, topics []string) error
- func (s Repositories) Tags(ctx context.Context, repo string, limit, page int) ([]string, error)
- func (s Repositories) Topics(ctx context.Context, repo string) ([]string, error)
- func (s Repositories) Transfer(ctx context.Context, repo, newOwner string, teams []int64) (RepositoryTransfer, error)
- func (s Repositories) View(ctx context.Context, repo string) (Repository, error)
- type Repository
- type RepositoryCreateChoices
- type RepositoryEdit
- type RepositoryListOptions
- type RepositoryMigrationOptions
- type RepositoryOptions
- type RepositoryPermissions
- type RepositorySearchOptions
- type RepositoryTemplateOptions
- type RepositoryTransfer
- type Review
- type ReviewComment
- type ReviewOptions
- type ReviewRequestChanges
- type ReviewRequestInput
- type ReviewSubmitOptions
- type Reviews
- func (s Reviews) All(ctx context.Context, n int64) ([]Review, error)
- func (s Reviews) ChangeRequests(ctx context.Context, n int64, changes ReviewRequestChanges) (Pull, error)
- func (s Reviews) CheckRequestTeams(ctx context.Context, names []string) error
- func (s Reviews) Comments(ctx context.Context, n, reviewID int64, limit, page int) (Page[ReviewComment], error)
- func (s Reviews) Create(ctx context.Context, n int64, opts ReviewOptions) (Review, error)
- func (s Reviews) Delete(ctx context.Context, n, id int64) error
- func (s Reviews) Dismiss(ctx context.Context, n, id int64, dismiss bool, message string) (Review, error)
- func (s Reviews) Inline(ctx context.Context, n int64, reviews []Review) ([]ReviewComment, error)
- func (s Reviews) List(ctx context.Context, n int64, limit, page int) ([]Review, error)
- func (s Reviews) ListPage(ctx context.Context, n int64, limit, page int) (Page[Review], error)
- func (s Reviews) Pending(ctx context.Context, n int64, login string) ([]Review, error)
- func (s Reviews) Reply(ctx context.Context, n, id int64, body string) (ReviewComment, error)
- func (s Reviews) Resolve(ctx context.Context, id int64, resolved bool) error
- func (s Reviews) Submit(ctx context.Context, n, id int64, opts ReviewSubmitOptions) (Review, error)
- func (s Reviews) View(ctx context.Context, n, id int64) (Review, error)
- type Run
- type RunListOptions
- type SSHKey
- type SSHKeys
- func (s SSHKeys) All(ctx context.Context) ([]SSHKey, error)
- func (s SSHKeys) Create(ctx context.Context, title, key string) (SSHKey, error)
- func (s SSHKeys) Delete(ctx context.Context, id int64) error
- func (s SSHKeys) List(ctx context.Context, limit, page int) (Page[SSHKey], error)
- func (s SSHKeys) View(ctx context.Context, id int64) (SSHKey, error)
- type SearchItem
- type Status
- type Step
- type Team
- type TeamMember
- type TeamOptions
- type TeamSize
- type Teams
- func (s Teams) ByName(ctx context.Context, org string) (map[string]Team, error)
- func (s Teams) Create(ctx context.Context, org string, opts TeamOptions) (Team, error)
- func (s Teams) Delete(ctx context.Context, id int64) error
- func (s Teams) Edit(ctx context.Context, id int64, opts TeamOptions) (Team, error)
- func (s Teams) Find(ctx context.Context, org, team string) (Team, error)
- func (s Teams) IsMember(ctx context.Context, id int64, username string) (bool, error)
- func (s Teams) List(ctx context.Context, org string, limit, page int) (Page[Team], error)
- func (s Teams) Members(ctx context.Context, id int64, limit, page int) (Page[TeamMember], error)
- func (s Teams) Repositories(ctx context.Context, id int64, limit, page int) (Page[Repository], error)
- func (s Teams) SetMember(ctx context.Context, id int64, username string, add bool) error
- func (s Teams) SetRepository(ctx context.Context, id int64, repository string, add bool) error
- func (s Teams) Sizes(ctx context.Context, teams []Team) ([]TeamSize, error)
- func (s Teams) View(ctx context.Context, id int64) (Team, error)
- type TimeOptions
- type TimelineEvent
- type Times
- func (s Times) Create(ctx context.Context, n, seconds int64) (TrackedTime, error)
- func (s Times) Delete(ctx context.Context, n, id int64) error
- func (s Times) Find(ctx context.Context, n, id int64) (TrackedTime, error)
- func (s Times) ListPage(ctx context.Context, opts TimeOptions) (Page[TrackedTime], error)
- func (s Times) Reset(ctx context.Context, n int64) (bool, error)
- type TrackedTime
- type UnitError
- type Webhook
- type WebhookOptions
- type WebhookScope
- type Webhooks
- func (s Webhooks) Create(ctx context.Context, opts WebhookOptions) (Webhook, error)
- func (s Webhooks) Delete(ctx context.Context, id int64) error
- func (s Webhooks) Edit(ctx context.Context, id int64, opts WebhookOptions) (Webhook, error)
- func (s Webhooks) List(ctx context.Context, limit, page int) (Page[Webhook], error)
- func (s Webhooks) View(ctx context.Context, id int64) (Webhook, error)
- type Wiki
- func (s Wiki) Create(ctx context.Context, opts WikiOptions) (WikiPage, error)
- func (s Wiki) Delete(ctx context.Context, name string) error
- func (s Wiki) Edit(ctx context.Context, name string, opts WikiOptions) (WikiPage, bool, error)
- func (s Wiki) ListPage(ctx context.Context, limit, page int) (Page[WikiPage], error)
- func (s Wiki) Revisions(ctx context.Context, name string, page int) (Page[WikiRevision], error)
- func (s Wiki) View(ctx context.Context, name string) (WikiPage, error)
- type WikiOptions
- type WikiPage
- type WikiRevision
- type Workflow
- type WorkflowInput
Constants ¶
const ( ReasonArchived = "archived" // the repository is archived and read-only ReasonExists = "exists" // a resource with the same identity already exists ReasonMerged = "merged" // the pull request is already merged ReasonClosed = "closed" // the pull request is closed ReasonDraft = "draft" // a draft pull request cannot be merged ReasonOwnReview = "own review" // authors cannot approve or reject their own pull request ReasonNoChanges = "no changes" // the head branch has no commits the base lacks ReasonDisabled = "disabled" // the workflow is disabled ReasonCompleted = "completed" // the run already finished ReasonNotDone = "not done" // the run has not finished yet ReasonKeyInUse = "key in use" // the SSH key is registered already ReasonOwnsRepos = "owns repositories" // the user still owns repositories ReasonOwnsOther = "owns other" // the user is still in organizations or owns packages )
Reasons a ConflictError gives for refusing a request.
const ( KindIssue = "issue" KindPull = "pull" )
Kinds of Issue: Gitea lists pull requests among issues.
const ( UnitIssues = "issues" UnitPulls = "pull requests" )
Repository units that Gitea answers with a bare 404 when they are turned off.
const ( MembershipPublic = "public" MembershipConcealed = "concealed" )
Membership visibilities.
Variables ¶
var ErrJobNotStarted = errors.New("job not started")
ErrJobNotStarted reports a job without logs because no runner has started it.
var ErrMaxPages = errors.New("API pagination exceeded the page limit")
ErrMaxPages reports a paginated request that has more pages than APIOptions.MaxPages allows.
var ErrNoDispatch = errors.New("workflow has no workflow_dispatch trigger")
ErrNoDispatch reports a workflow that has no workflow_dispatch trigger.
var ErrRunScanExhausted = fmt.Errorf("time filters scanned %d runs without exhausting the history", maxRunScanPages*100)
ErrRunScanExhausted reports time filters that matched too few of the runs a scan may read.
var ExternalTeamUnits = []string{"repo.ext_issues", "repo.ext_wiki"}
ExternalTeamUnits link to external trackers and wikis, which teams can at most read.
var RunStatuses = []string{"queued", "in_progress", "waiting", "requested", "pending", "action_required", "completed", "success", "failure", "cancelled", "skipped", "timed_out", "neutral"} //nolint:misspell // Gitea API spelling.
RunStatuses are the values Gitea accepts as run status filters.
var TeamUnits = []string{"repo.code", "repo.issues", "repo.pulls", "repo.releases", "repo.wiki", "repo.projects", "repo.packages", "repo.actions"}
TeamUnits are the repository units a team grants access to, in the order Gitea shows them.
var WebhookEventGroups = map[string][]string{
"issues": {"issue_assign", "issue_comment", "issue_label", "issue_milestone"},
"pull_request": {"pull_request_assign", "pull_request_comment", "pull_request_label", "pull_request_milestone", "pull_request_review", "pull_request_review_request", "pull_request_sync"},
}
WebhookEventGroups are the events that sending issues or pull_request enables besides that event.
var WebhookEvents = []string{
"create", "delete", "fork", "push",
"issues", "issues_only", "issue_assign", "issue_label", "issue_milestone", "issue_comment",
"pull_request", "pull_request_only", "pull_request_assign", "pull_request_label", "pull_request_milestone",
"pull_request_comment", "pull_request_review", "pull_request_sync", "pull_request_review_request",
"wiki", "repository", "release", "package", "status", "workflow_run", "workflow_job",
}
WebhookEvents are the events that webhooks accept. issues and pull_request select every event of their group; issues_only and pull_request_only select the events of the issue or pull request itself.
var WebhookTypes = []string{"gitea", "gogs", "slack", "discord", "dingtalk", "telegram", "msteams", "feishu", "matrix", "wechatwork", "packagist"}
WebhookTypes are the adapters that deliver webhooks.
Functions ¶
func ActionValueName ¶
ActionValueName is the name Gitea stores a secret or variable under: names are upper-cased.
func AddDraftPrefix ¶
AddDraftPrefix returns title with a "WIP: " prefix, or title unchanged if it already carries a recognized draft prefix.
func Classify ¶
Classify names the resource of a failed request: a 404 or an unknown user becomes a NotFoundError, a refusal Gitea explains a ConflictError. Other errors are returned unchanged.
func CurrentAccount ¶
CurrentAccount verifies the credential against the selected Gitea installation and returns the authenticated login. It asks the server once per client and Sudo user.
func IsForbidden ¶
IsForbidden reports whether err is a 403 response.
func IsUnauthorized ¶
IsUnauthorized reports whether err is a 401 response.
func MatchAccount ¶
MatchAccount reports whether selected matches the authenticated login. An empty selection accepts any account.
func MaxPageSize ¶
MaxPageSize returns the most items the instance returns for one page of a listing.
func OfficialApprovals ¶
OfficialApprovals counts the reviewers whose effective review is an official approval that was not dismissed, nor stale with skipStale.
func OwnerExists ¶
OwnerExists fails with a *NotFoundError when no user or organization is called name.
func RequestedReviewers ¶
RequestedReviewers returns the users and teams with an outstanding review request: each user whose latest review is a request, and each team with a request. Gitea's requested_reviewers also lists users who reviewed, even after their request was canceled, so the reviews decide.
func ReviewDecision ¶
ReviewDecision summarizes reviews like gh: changes_requested when a reviewer's effective review requests changes, else approved when one approves, else review_required while reviews are requested, else "". Dismissed reviews do not count.
func ServerVersion ¶
ServerVersion returns the Gitea version of the instance.
func StripDraftPrefix ¶
StripDraftPrefix returns title with any recognized leading draft prefix removed, or title unchanged if no prefix is present.
func SuccessfulRun ¶
SuccessfulRun recognizes a successful terminal run result.
func TokenScopes ¶
TokenScopes returns the scopes of the access token that client authenticates with, such as "all" or "write:repository". Gitea answers only for access tokens.
func UnitAccess ¶
UnitAccess lists the access levels a team can have to unit, or nil for an unknown unit.
func UnitPolicy ¶
UnitPolicy grants access, read or write, to every unit, and read to the external units.
Types ¶
type API ¶
API provides the raw escape hatch while keeping credentials scoped to one instance.
type APIOptions ¶
type APIOptions struct {
Endpoint string
Method string
Body io.Reader
Headers http.Header
Paginate bool
MaxPages int
}
APIOptions describes a raw request and its bounded pagination policy.
type AccountStatus ¶
type AccountStatus struct {
Host string `json:"host"`
User string `json:"user"`
// Repository is the repository the summary is scoped to, empty for all repositories.
Repository string `json:"repository"`
AssignedIssues []SearchItem `json:"assigned_issues"`
PullRequests PullStatus `json:"pull_requests"`
// Mentions are the open issues and pull requests that mention the account.
Mentions []SearchItem `json:"mentions"`
// RunsRepository is the repository whose failing runs are listed, when RunsIncluded.
RunsRepository string `json:"runs_repository"`
FailingRuns []Run `json:"failing_runs"`
RunsIncluded bool `json:"runs_included"`
}
AccountStatus is an account summary with optional repository Actions results.
type ActionScope ¶
ActionScope identifies exactly one repository, organization, or account scope.
func (ActionScope) String ¶
func (s ActionScope) String() string
String names the scope for people: "alice/project", "organization acme" or "your account".
type ActionSecret ¶
type ActionSecret struct {
Name string `json:"name"`
Description string `json:"description"`
CreatedAt string `json:"created_at"`
}
ActionSecret describes a secret without containing its value. CreatedAt is empty for a secret that was just set, as Gitea does not return it.
type ActionSecrets ¶
type ActionSecrets struct {
Client *transport.Client
Scope ActionScope
}
ActionSecrets manages scoped Actions secrets without returning secret data.
func (ActionSecrets) Delete ¶
func (s ActionSecrets) Delete(ctx context.Context, name string) error
Delete removes only the named secret in the selected scope.
func (ActionSecrets) ListPage ¶
func (s ActionSecrets) ListPage(ctx context.Context, limit, page int) (Page[ActionSecret], error)
ListPage lists a page of secrets, with what the server reports about the other pages.
func (ActionSecrets) Set ¶
func (s ActionSecrets) Set(ctx context.Context, name, value, description string) (ActionSecret, error)
Set creates or replaces a secret; the API's PUT operation defines upsert semantics. The result names the secret as Gitea stores it.
type ActionVariable ¶
type ActionVariable struct {
Name string `json:"name"`
Value string `json:"value"`
Description string `json:"description"`
}
ActionVariable contains one non-secret workflow variable.
type ActionVariables ¶
type ActionVariables struct {
Client *transport.Client
Scope ActionScope
}
ActionVariables manages scoped non-secret Actions variables.
func (ActionVariables) Delete ¶
func (s ActionVariables) Delete(ctx context.Context, name string) error
Delete removes only the named variable in the selected scope.
func (ActionVariables) ListPage ¶
func (s ActionVariables) ListPage(ctx context.Context, limit, page int) (Page[ActionVariable], error)
ListPage lists a page of variables, with what the server reports about the other pages.
func (ActionVariables) Set ¶
func (s ActionVariables) Set(ctx context.Context, name, value string, newDescription *string) (ActionVariable, error)
Set chooses create or update from an authoritative read. A nil description keeps the one of an existing variable, as Gitea replaces it on every update.
func (ActionVariables) View ¶
func (s ActionVariables) View(ctx context.Context, name string) (ActionVariable, error)
View retrieves one variable.
type Actions ¶
Actions implements repository workflow and run operations.
func (Actions) AllArtifacts ¶
AllArtifacts lists every artifact belonging to a run.
func (Actions) Artifacts ¶
Artifacts lists one page of artifacts belonging to a run, with their total number.
func (Actions) CancelRun ¶
CancelRun requests cancellation without deleting the run or its history. Force cancellation is an explicit operation for unresponsive runners.
func (Actions) Dispatch ¶
func (s Actions) Dispatch(ctx context.Context, id, ref string, inputs map[string]string) (DispatchResult, error)
Dispatch triggers a workflow and reports the run it created.
func (Actions) DownloadArtifact ¶
DownloadArtifact streams an artifact ZIP, accepting a scoped signed redirect.
func (Actions) FindWorkflow ¶
FindWorkflow returns the workflow that raw names in the repository: its file name, path, file name without extension, or name, matched exactly and then case-insensitively.
func (Actions) FollowJobLogs ¶
func (s Actions) FollowJobLogs(ctx context.Context, run, id int64, interval time.Duration, emit func([]byte) error) error
FollowJobLogs emits only newly appended bytes and stops when the job completes. A shorter snapshot fails rather than silently mixing logs from different attempts.
func (Actions) JobLogs ¶
JobLogs streams a job's plain-text logs within the selected instance. A job that has not started fails with ErrJobNotStarted.
func (Actions) NameRun ¶
NameRun names a run that a mutation returned after its workflow; it stays as is when the workflows cannot be listed.
func (Actions) Rerun ¶
Rerun schedules another attempt of a run, restricted to its failed jobs with failedOnly, or of one job when job is not 0.
func (Actions) RunDetails ¶
RunDetails retrieves one run with its jobs, named after its workflow.
func (Actions) RunJob ¶
RunJob retrieves the job id of run, including a job of an earlier attempt, which Jobs no longer lists after a rerun.
func (Actions) RunLogsArchive ¶
RunLogsArchive streams the server's ZIP archive without extracting its entries. A run without logs, such as one that never started, is reported as not found. TODO(sdk): GetRepoRunLogsReader cannot follow the redirect to object storage that serves logs directly.
func (Actions) RunsPage ¶
RunsPage lists a page of runs like Runs, named after their workflows, with the number of runs the filters match when the server counts them.
func (Actions) SetWorkflowEnabled ¶
SetWorkflowEnabled updates whether a workflow can run.
func (Actions) WaitForFirstJob ¶
func (s Actions) WaitForFirstJob(ctx context.Context, run int64, interval time.Duration) (Job, error)
WaitForFirstJob polls a freshly dispatched run until the server has created its first job.
func (Actions) Watch ¶
func (s Actions) Watch(ctx context.Context, id int64, interval time.Duration, update func(Run) error) (Run, error)
Watch polls a run with its jobs every interval until it completes, reporting each poll to update, and returns the completed run. When it fails, such as when ctx expires, it returns the run as last polled.
func (Actions) WorkflowFile ¶
WorkflowFile returns the workflow's YAML definition at ref, a branch, tag or commit, or on the default branch when ref is empty.
type AdminUser ¶
type AdminUser struct {
ID int64 `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
FullName string `json:"full_name"`
Description string `json:"description"`
Website string `json:"website"`
Location string `json:"location"`
URL string `json:"url"`
Admin bool `json:"admin"`
Active bool `json:"active"`
Restricted bool `json:"restricted"`
ProhibitLogin bool `json:"prohibit_login"`
Visibility string `json:"visibility"`
CreatedAt string `json:"created_at"`
}
AdminUser is the explicit account-management result, without authentication secrets.
type AdminUserOptions ¶
type AdminUserOptions struct {
Email *string `json:"email,omitempty"`
FullName *string `json:"full_name,omitempty"`
Description *string `json:"description,omitempty"`
Website *string `json:"website,omitempty"`
Location *string `json:"location,omitempty"`
Visibility *string `json:"visibility,omitempty"`
Password string `json:"password,omitempty"`
Admin *bool `json:"admin,omitempty"`
Active *bool `json:"active,omitempty"`
Restricted *bool `json:"restricted,omitempty"`
ProhibitLogin *bool `json:"prohibit_login,omitempty"`
MustChangePassword *bool `json:"must_change_password,omitempty"`
AllowGitHook *bool `json:"allow_git_hook,omitempty"`
AllowImportLocal *bool `json:"allow_import_local,omitempty"`
AllowCreateOrganization *bool `json:"allow_create_organization,omitempty"`
MaxRepoCreation *int `json:"max_repo_creation,omitempty"`
}
AdminUserOptions distinguishes omitted fields from explicit empty or false values.
type AdminUsers ¶
AdminUsers provides administrator account operations.
func (AdminUsers) Create ¶
func (s AdminUsers) Create(ctx context.Context, username string, opts AdminUserOptions) (AdminUser, error)
Create creates an account, then applies administrative fields unavailable during creation.
func (AdminUsers) Delete ¶
Delete removes an account. Gitea refuses to delete users who own repositories or organizations unless purge also deletes what they own.
func (AdminUsers) Edit ¶
func (s AdminUsers) Edit(ctx context.Context, username string, opts AdminUserOptions) (AdminUser, error)
Edit preserves the authentication identity while updating account properties.
func (AdminUsers) List ¶
func (s AdminUsers) List(ctx context.Context, query string, limit, page int) (Page[AdminUser], error)
List returns a page of the users whose username, full name or email contains query, or of every user without one.
type AmbiguousError ¶
type AmbiguousError struct {
Kind, Key, Scope string
IDs []int64
// Hint replaces the advice to pass an ID where IDs do not select the resource.
Hint string
}
AmbiguousError reports a name that matches several resources.
func (*AmbiguousError) Error ¶
func (e *AmbiguousError) Error() string
type Artifact ¶
type Artifact struct {
ID int64 `json:"id"`
Name string `json:"name"`
Size int64 `json:"size_in_bytes"`
URL string `json:"url"`
Expired bool `json:"expired"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
ExpiresAt *string `json:"expires_at"`
}
Artifact is the stable metadata for a downloadable Actions artifact.
type Board ¶
Board is a project with its default column and the column that holds each issue on it, by the issue's global ID.
type Branch ¶
type Branch struct {
Name string `json:"name"`
SHA string `json:"sha"`
Message string `json:"message"`
UpdatedAt string `json:"updated_at"`
Protected bool `json:"protected"`
RequiredApprovals int64 `json:"required_approvals"`
CanPush bool `json:"can_push"`
CanMerge bool `json:"can_merge"`
}
Branch describes a remote branch, its last commit and its protection.
type Branches ¶
Branches operates on remote branches and protection rules.
func (Branches) Create ¶
Create creates a branch from source, a branch, tag or commit, or from the default branch.
func (Branches) EditProtection ¶
func (s Branches) EditProtection(ctx context.Context, repo string, rule Protection, changes ProtectionChanges) error
EditProtection changes the settings of the existing rule named rule.Rule that changes selects, and keeps the others. Pushers replace those who may push directly. It fails with a *DroppedPushersError when the rule leaves out some of its pushers.
func (Branches) Find ¶
Find retrieves a remote branch, naming repo instead when that is what is missing.
func (Branches) ListPage ¶
ListPage lists a page of branches, with whether more follow and how many there are.
func (Branches) Protect ¶
Protect adds a protection rule. It reports false without a change when the rule exists already, and a *DroppedPushersError when the rule leaves out some of its pushers.
func (Branches) RequireAll ¶
RequireAll fails unless every branch exists in repo, naming each one that does not, or repo when that is what is missing.
type CapabilityError ¶
type CapabilityError struct{ Feature, Reason string }
CapabilityError reports an operation absent from the Gitea REST contract.
func (*CapabilityError) Error ¶
func (e *CapabilityError) Error() string
type Check ¶
type Check struct {
SHA string `json:"sha"`
ID int64 `json:"id"`
Name string `json:"name"`
State string `json:"state"`
Description string `json:"description"`
URL string `json:"url"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Check represents the latest status of one commit context.
type Comment ¶
type Comment struct {
ID int64 `json:"id"`
Body string `json:"body"`
URL string `json:"url"`
Author string `json:"author"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
// IssueNumber is the issue or pull request the comment is on.
IssueNumber int64 `json:"issue_number"`
// Pull reports a comment on a pull request rather than an issue.
Pull bool `json:"-"`
}
Comment is the public representation shared by issue and pull request comments.
type Comments ¶
Comments implements discussion comments under their owning repository resource.
func (Comments) List ¶
List returns every discussion comment; the API does not paginate this collection.
type ConflictError ¶
type ConflictError struct {
// Reason is one of the Reason constants.
Reason string
// Kind, Key and Scope name the refused resource like NotFoundError; any may be empty.
Kind, Key, Scope string
// Hint is the next step, such as "use gt release edit v1.0"; callers add it.
Hint string
// Err is the underlying *transport.APIError.
Err error
}
ConflictError reports a request the current state of a resource refuses, such as closing a merged pull request or writing to an archived repository.
func (*ConflictError) Error ¶
func (e *ConflictError) Error() string
func (*ConflictError) Unwrap ¶
func (e *ConflictError) Unwrap() error
type CreateSelectables ¶
type CreateSelectables struct {
CanPush bool
Assignees []string
Milestones []Milestone
Labels []Label
}
CreateSelectables are the metadata choices offered by forms. Where they depend on push access, the lists stay empty unless CanPush.
type DeployKey ¶
type DeployKey struct {
ID int64 `json:"id"`
Title string `json:"title"`
Key string `json:"key"`
Fingerprint string `json:"fingerprint"`
ReadOnly bool `json:"read_only"`
CreatedAt string `json:"created_at"`
}
DeployKey is an SSH key that grants access to one repository.
type DeployKeys ¶
DeployKeys manages the deploy keys of a repository.
func (DeployKeys) Create ¶
func (s DeployKeys) Create(ctx context.Context, title, key string, readOnly bool) (DeployKey, error)
Create adds a deploy key, which can push unless readOnly.
func (DeployKeys) Delete ¶
func (s DeployKeys) Delete(ctx context.Context, id int64) error
Delete removes one deploy key.
type DiscussionSearchOptions ¶
type DiscussionSearchOptions struct {
Query, State, Owner, Team, Author, Labels, Milestones string
Since, Before *time.Time
Pulls, Assigned, Authored, Mentioned, ReviewRequested, Reviewed bool
Limit, Page int
}
DiscussionSearchOptions specifies issue or pull request filters.
type DispatchResult ¶
DispatchResult identifies a workflow run created by dispatch when the server returns details.
type DroppedPushersError ¶
type DroppedPushersError struct {
Repository, Rule string
Users, Teams []string
// Nobody is set when Gitea dropped every pusher: the rule then lets nobody push.
Nobody bool
// Updated is set when an existing rule was changed rather than a new one created.
Updated bool
}
DroppedPushersError reports the users and teams that Gitea left out of a new protection rule, which it does for those that cannot write to the repository.
func (*DroppedPushersError) Error ¶
func (e *DroppedPushersError) Error() string
type ForkOptions ¶
type ForkOptions struct{ Organization, Name string }
ForkOptions places a fork: under Organization instead of the account, and named Name instead of the forked repository's name.
type InlineComment ¶
type InlineComment struct {
Path string `json:"path"`
Body string `json:"body"`
OldLine int64 `json:"old_position"`
NewLine int64 `json:"new_position"`
}
InlineComment supplies an explicit file position for review creation.
func (InlineComment) Validate ¶
func (c InlineComment) Validate() error
Validate requires a path, a body, and exactly one positive line position.
type Issue ¶
type Issue struct {
Author string `json:"author"`
Labels []Label `json:"labels"`
Ref string `json:"ref"`
ID int64 `json:"id"`
Number int64 `json:"number"`
Kind string `json:"kind"`
Title string `json:"title"`
Body string `json:"body"`
URL string `json:"url"`
State string `json:"state"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Deadline *string `json:"due_date"`
Assignees []string `json:"assignees"`
Milestone *IssueMilestone `json:"milestone"`
Comments int64 `json:"comments"`
}
Issue is the stable command representation of an issue.
type IssueAttachment ¶
type IssueAttachment ReleaseAsset
IssueAttachment describes an attachment owned by an issue or pull request.
type IssueCreateSelectables ¶
type IssueCreateSelectables struct {
CreateSelectables
Templates []IssueTemplate
}
IssueCreateSelectables adds repository issue templates to the create form choices.
type IssueDependencies ¶
type IssueDependencies struct {
BlockedBy, Blocks []IssueReference
}
IssueDependencies lists the issues blocking one issue and the issues it blocks.
type IssueEdit ¶
type IssueEdit struct {
Labels *[]int64 `json:"-"`
Ref *string `json:"ref,omitempty"`
Title *string `json:"title,omitempty"`
Body *string `json:"body,omitempty"`
Assignees *[]string `json:"assignees,omitempty"`
Milestone *int64 `json:"milestone,omitempty"`
Deadline *time.Time `json:"due_date,omitempty"`
RemoveDeadline *bool `json:"unset_due_date,omitempty"`
Changes *MetadataChanges `json:"-"`
}
IssueEdit distinguishes omitted fields from explicit clears.
type IssueLabelCatalog ¶
type IssueLabelCatalog struct {
// contains filtered or unexported fields
}
IssueLabelCatalog resolves the label names of issue flags against the repository's labels and those its organization shares.
type IssueMilestone ¶
IssueMilestone identifies the milestone associated with an issue or pull request.
type IssueOptions ¶
type IssueOptions struct {
Ref string `json:"ref,omitempty"`
Title string `json:"title"`
Body string `json:"body"`
Assignees []string `json:"assignees,omitempty"`
Labels []int64 `json:"labels,omitempty"`
Milestone int64 `json:"milestone,omitempty"`
Deadline *time.Time `json:"due_date,omitempty"`
}
IssueOptions supplies issue creation input.
type IssueReference ¶
IssueReference identifies an issue that may live in another repository. Number is zero for issues the account cannot read.
type IssueTemplate ¶
type IssueTemplate struct {
Name, About, Title, Content string
Labels []string
Form bool
// Ref is the branch or tag the template sets on new issues.
Ref string
// FileName is the path of the template in the repository, which the new-issue page takes.
FileName string
}
IssueTemplate is a repository issue template used to seed create forms.
type Issues ¶
type Issues struct {
Client *transport.Client
Repository string
// Pulls is set when the numbers name pull requests, which Gitea serves through the issue
// endpoints also when issues are turned off: failures then name the pull request.
Pulls bool
}
Issues implements repository issue operations.
func (Issues) Attachment ¶
Attachment retrieves metadata for one attachment in its owning issue.
func (Issues) Attachments ¶
func (s Issues) Attachments(ctx context.Context, number int64, limit, page int) (Page[IssueAttachment], error)
Attachments paginates the server's unpaginated attachment collection locally.
func (Issues) CreateSelectables ¶
func (s Issues) CreateSelectables(ctx context.Context) (IssueCreateSelectables, error)
CreateSelectables concurrently loads templates, assignees, milestones and labels. The metadata choices do not depend on push access, which is all the permissions of a repository tell: people who can write to the issues set metadata without it, and issue create names what Gitea left out for others. CanPush stays false.
func (Issues) DeleteAttachment ¶
DeleteAttachment removes one attachment from its owning issue.
func (Issues) Dependencies ¶
Dependencies reads both dependency directions; servers or repositories without dependency support report none.
func (Issues) DownloadAttachment ¶
func (s Issues) DownloadAttachment(ctx context.Context, number, id int64) (IssueAttachment, func() (io.ReadCloser, error), error)
DownloadAttachment retrieves an attachment's metadata and returns a function that opens its content, scoped to its instance and issue. Nothing is downloaded until that function is called, so callers can refuse or skip the download first.
func (Issues) EditSelectables ¶
func (s Issues) EditSelectables(ctx context.Context) (CreateSelectables, error)
EditSelectables loads the assignees, milestones and labels the edit form offers. Like those of CreateSelectables, they do not depend on push access, and issue edit names what Gitea left out for people who cannot write to the issues. CanPush stays false.
func (Issues) IssueTemplates ¶
func (s Issues) IssueTemplates(ctx context.Context) ([]IssueTemplate, error)
IssueTemplates lists repository issue templates; null responses become an empty list.
func (Issues) Kind ¶
Kind returns whether number is an issue or a pull request, KindIssue or KindPull, in one request. It is "" for a number Gitea does not show, such as an issue of a repository that uses an external tracker.
func (Issues) List ¶
List returns a page of issues, even when the server caps its page size below the limit, and reports whether more issues follow.
func (Issues) ListPage ¶
ListPage is List with the number of issues that match, as the server counts them.
func (Issues) RemoveMilestone ¶
RemoveMilestone clears the milestone of issue n when it is milestone. It refuses to clear an issue belonging to another milestone or to none, returning it with a *NotInMilestoneError.
func (Issues) RenameAttachment ¶
func (s Issues) RenameAttachment(ctx context.Context, number, id int64, name string) (IssueAttachment, error)
RenameAttachment changes the filename without replacing its content.
func (Issues) Search ¶
func (s Issues) Search(ctx context.Context, opts DiscussionSearchOptions) ([]SearchItem, error)
Search searches one repository or accessible repositories across the selected instance.
func (Issues) SearchPage ¶
func (s Issues) SearchPage(ctx context.Context, opts DiscussionSearchOptions) (Page[SearchItem], error)
SearchPage is Search with what the server reports about further results.
func (Issues) SetBlockedBy ¶
func (s Issues) SetBlockedBy(ctx context.Context, n int64, blocker IssueReference, block bool) error
SetBlockedBy makes issue n blocked by issue blocker, which may belong to another repository where the instance allows that, or with block false lifts that dependency. Like other additions and removals, adding a dependency that exists or removing one that does not changes nothing.
func (Issues) Timeline ¶
func (s Issues) Timeline(ctx context.Context, n int64, limit, page int) (Page[TimelineEvent], error)
Timeline returns a page of the timeline of issue or pull request n, oldest first. Gitea sends no Link header for the timeline and counts only the returned page in X-Total-Count, so a page that may continue asks for the one event after it.
type Job ¶
type Job struct {
RunAttempt int64 `json:"run_attempt"`
ID int64 `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
URL string `json:"url"`
Labels []string `json:"labels"`
CreatedAt string `json:"created_at"`
StartedAt *string `json:"started_at"`
CompletedAt *string `json:"completed_at"`
Steps []Step `json:"steps"`
}
Job identifies one workflow job without exposing server-specific metadata. StartedAt and CompletedAt are nil until the job starts and completes.
type Label ¶
type Label struct {
ID int64 `json:"id"`
Name string `json:"name"`
Color string `json:"color"`
Description string `json:"description"`
Exclusive bool `json:"exclusive"`
Archived bool `json:"is_archived"`
}
Label is a repository or organization label.
type LabelOptions ¶
type LabelOptions struct {
Name *string `json:"name,omitempty"`
Color *string `json:"color,omitempty"`
Description *string `json:"description,omitempty"`
Exclusive *bool `json:"exclusive,omitempty"`
Archived *bool `json:"is_archived,omitempty"`
}
LabelOptions distinguishes omitted label fields during edits.
func (LabelOptions) KeepArchived ¶
func (opts LabelOptions) KeepArchived(current Label) LabelOptions
KeepArchived returns opts with the archived state of current unless opts sets one: Gitea unarchives a label whose edit leaves is_archived out.
type Labels ¶
Labels implements explicitly scoped label operations.
func (Labels) CreateUnique ¶
func (s Labels) CreateUnique(ctx context.Context, existing []Label, opts LabelOptions, update bool) (Label, bool, error)
CreateUnique creates a label unless existing has one with its name, ignoring case: Gitea would create a second label that name filters cannot tell apart. Then update edits that label, keeping its name, or CreateUnique fails. It reports whether it updated a label.
func (Labels) EditUnique ¶
func (s Labels) EditUnique(ctx context.Context, existing []Label, current Label, opts LabelOptions) (Label, error)
EditUnique edits current like Edit, keeping its archived state, but refuses to rename it to the name of another label among existing, the labels of the scope, ignoring case, which CreateUnique refuses too: names would no longer address either label.
func (Labels) Find ¶
Find returns the labels of the scope that raws address, each by ID or name; byName matches numeric values as names only.
func (Labels) FindIn ¶
FindIn returns the label among items, the labels of the scope, that raw addresses like Find.
func (Labels) IssueCatalog ¶
func (s Labels) IssueCatalog(ctx context.Context) (IssueLabelCatalog, error)
IssueCatalog loads the labels that issue label names can select.
func (Labels) ListPage ¶
ListPage is List with the number of labels in the scope, as the server counts them.
func (Labels) RequireFilterNames ¶
RequireFilterNames rejects names Gitea's repository issue filter cannot match: it matches repository labels by exact name and silently ignores every other name.
func (Labels) ResolveIssueNames ¶
ResolveIssueNames resolves names through the repository's IssueCatalog.
type ListOptions ¶
type ListOptions struct {
State string
Limit, Page int
Search string
Assignee, Labels, Milestones, Kind string
Author, Mentions string
Since, Before *time.Time
// NoAssignee keeps only issues without assignees. Gitea has no such filter, so ListPage
// applies it to every issue it reads.
NoAssignee bool
}
ListOptions supplies explicit issue pagination and filters.
type MemberListOptions ¶
type MemberListOptions struct {
// Public lists only public memberships, and Visibility reports the visibility of each one.
// Gitea lists concealed members as public to administrators, so for them both check each
// membership on its own, and Public drops the server's total, which counts concealed members
// too.
Public, Visibility bool
Limit, Page int
}
MemberListOptions selects a page of organization members.
type MergeOptions ¶
type MergeOptions struct {
Method, Title, Message string
DeleteBranch, Auto bool
// HeadSHA is the head commit the user chose to merge; Gitea refuses the merge once the head
// moved past it. Empty merges the current head.
HeadSHA string
// Commit is the commit that merged the pull request outside Gitea, for the manually-merged method.
Commit string
}
MergeOptions supplies merge strategy and optional commit text. Auto merges once the required checks succeed instead of now.
type MergeSettings ¶
MergeSettings are the merge styles a repository allows, in Gitea's order, and its merge defaults.
type MetadataChanges ¶
type MetadataChanges struct {
AddLabels, RemoveLabels []int64
AddAssignees, RemoveAssignees []string
}
MetadataChanges adds and removes labels and assignees relative to an issue's current state.
type Milestone ¶
type Milestone struct {
ID int64 `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
State string `json:"state"`
Deadline *string `json:"due_on"`
OpenIssues int `json:"open_issues"`
ClosedIssues int `json:"closed_issues"`
}
Milestone is a stable milestone result.
type MilestoneOptions ¶
type MilestoneOptions struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
State *string `json:"state,omitempty"`
Deadline *string `json:"due_on,omitempty"`
}
MilestoneOptions allows explicit state, description and deadline updates.
type Milestones ¶
Milestones implements repository milestone operations.
func (Milestones) All ¶
func (s Milestones) All(ctx context.Context) ([]Milestone, error)
All returns the open and closed milestones of the repository.
func (Milestones) Create ¶
func (s Milestones) Create(ctx context.Context, opts MilestoneOptions) (Milestone, error)
Create creates one milestone.
func (Milestones) CreateUnique ¶
func (s Milestones) CreateUnique(ctx context.Context, opts MilestoneOptions, update bool) (Milestone, bool, error)
CreateUnique creates a milestone unless one has its title, ignoring case, which titles would then no longer address. With update it edits that milestone instead and reports true.
func (Milestones) Delete ¶
func (s Milestones) Delete(ctx context.Context, id int64) error
Delete deletes one milestone.
func (Milestones) Edit ¶
func (s Milestones) Edit(ctx context.Context, id int64, opts MilestoneOptions) (Milestone, error)
Edit updates a milestone.
func (Milestones) EditUnique ¶
func (s Milestones) EditUnique(ctx context.Context, existing []Milestone, current Milestone, opts MilestoneOptions) (Milestone, error)
EditUnique edits current like Edit but refuses to retitle it to the title of another milestone among existing, the milestones of the repository, ignoring case, which CreateUnique refuses too: titles would no longer address either milestone.
func (Milestones) FilterIDs ¶
FilterIDs resolves the milestones that filter an issue listing, each an ID or a title, to the values the issues API reads back as the same milestones: Gitea matches a filter value by title first and by ID only then, so a unique title without a comma is sent as is, and an ID only when no title reads like it. Gitea drops filter values that name no milestone and lists every issue when none is left, so an unknown milestone is an error here.
func (Milestones) FilterValue ¶
FilterValue is the value that filters an issue listing by item, as FilterIDs resolves it.
func (Milestones) Find ¶
Find returns the milestones that raws address among the open and closed milestones, each by ID or title; byName matches numeric values as titles only.
func (Milestones) FindIn ¶
FindIn returns the milestone among items, the milestones of the repository, that raw addresses like Find.
type NameOrID ¶
type NameOrID[T any] struct { // Kind and Scope name the resources in errors, such as "label" in "alice/project". Kind, Scope string ID func(T) int64 Name func(T) string // ByName matches numeric values as names only, for --by-name. ByName bool // Exact matches names case-sensitively only, for resources such as release assets whose // names may differ only in case. Exact bool }
NameOrID addresses one kind of resource by name or ID: a numeric value is an ID first, then a name; any other value is an exact name, then a unique case-insensitive name unless Exact is set.
type NotFoundError ¶
type NotFoundError struct {
// Kind names the resource, such as "issue" or "label".
Kind string
// Key identifies the resource as the user wrote it, such as "#999", "v1.0" or `"bug"`.
Key string
// Scope is the repository or organization that was searched; empty for instance-wide resources.
Scope string
// Err is the underlying failure, usually a 404 *transport.APIError.
Err error
}
NotFoundError reports a missing resource by the name the user gave it, such as "issue #999 not found in alice/project".
func NotFound ¶
func NotFound(kind, key, scope string) *NotFoundError
NotFound reports that no kind named key exists in scope.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
func (*NotFoundError) Unwrap ¶
func (e *NotFoundError) Unwrap() error
type NotInMilestoneError ¶
NotInMilestoneError reports an issue that RemoveMilestone left unchanged, as it is not in the milestone.
func (*NotInMilestoneError) Error ¶
func (e *NotInMilestoneError) Error() string
type NotPlainCommentError ¶
NotPlainCommentError reports a comment that the single-comment endpoint answers with no body, such as an inline review comment. Such comments can still be edited and deleted by ID.
func (NotPlainCommentError) Error ¶
func (e NotPlainCommentError) Error() string
type NotPullError ¶
type NotPullError struct {
Number int64
Repository string
// Err is the *NotFoundError of the pull request.
Err error
}
NotPullError reports that the number a pull request was asked for is an issue's.
func (*NotPullError) Error ¶
func (e *NotPullError) Error() string
func (*NotPullError) Unwrap ¶
func (e *NotPullError) Unwrap() error
type Notification ¶
type Notification struct {
ID int64 `json:"id"`
Repository string `json:"repository"`
// Number is the issue or pull request number of the subject, when it is one.
Number int64 `json:"number,omitempty"`
Title string `json:"title"`
URL string `json:"url"`
Type string `json:"type"`
State string `json:"state"`
Unread bool `json:"unread"`
Pinned bool `json:"pinned"`
UpdatedAt string `json:"updated_at"`
// contains filtered or unexported fields
}
Notification is the stable representation of an account notification thread.
type NotificationOptions ¶
type NotificationOptions struct {
Limit, Page int
Statuses, Types []string
Since, Before *time.Time
}
NotificationOptions supplies pagination and server-supported filters.
type Notifications ¶
Notifications manages account threads, optionally scoped to one repository.
func (Notifications) LatestComment ¶
func (s Notifications) LatestComment(ctx context.Context, item Notification) (*Comment, error)
LatestComment returns the latest comment on the subject of a notification, or nil without one.
func (Notifications) List ¶
func (s Notifications) List(ctx context.Context, opts NotificationOptions) (Page[Notification], error)
List returns a non-nil page of notifications and what the server reported about the rest.
func (Notifications) Mark ¶
func (s Notifications) Mark(ctx context.Context, id int64, status string) (Notification, error)
Mark changes the selected notification status.
func (Notifications) MarkAll ¶
func (s Notifications) MarkAll(ctx context.Context, status string, filters []string, before time.Time) ([]Notification, error)
MarkAll applies a status to all matching notifications within the selected scope.
func (Notifications) View ¶
func (s Notifications) View(ctx context.Context, id int64) (Notification, error)
View retrieves an account-owned notification thread.
func (Notifications) Watch ¶
func (s Notifications) Watch(ctx context.Context, opts NotificationOptions, interval time.Duration, onChange func([]Notification) error) error
Watch reports new or changed threads and propagates cancellation and callback errors. It polls on through an outage of the instance of up to pollOutage once a poll succeeded. The first poll reports the page opts selects; later polls read on past it while every thread on a page is new, so a burst of more than a page of notifications between two polls is reported whole.
type Organization ¶
type Organization struct {
ID int64 `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Description string `json:"description"`
Website string `json:"website"`
Location string `json:"location"`
Visibility string `json:"visibility"`
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
}
Organization is the public command representation of a Gitea organization.
type OrganizationMember ¶
type OrganizationMember struct {
ID int64 `json:"id"`
Username string `json:"username"`
FullName string `json:"full_name"`
// Visibility of an organization membership is public or concealed; team members have none.
Visibility string `json:"visibility,omitempty"`
}
OrganizationMember identifies a member without exposing private profile fields.
type OrganizationOptions ¶
type OrganizationOptions struct {
Name *string `json:"username,omitempty"`
FullName *string `json:"full_name,omitempty"`
Description *string `json:"description,omitempty"`
Website *string `json:"website,omitempty"`
Location *string `json:"location,omitempty"`
Visibility *string `json:"visibility,omitempty"`
RepoAdminChangeTeamAccess *bool `json:"repo_admin_change_team_access,omitempty"`
}
OrganizationOptions permits explicit empty and false preference updates.
type OrganizationSize ¶
type OrganizationSize struct {
Members, Teams, Repositories *int
}
OrganizationSize counts what an organization holds; a count the account cannot read is nil.
type Organizations ¶
Organizations implements instance-scoped organization workflows.
func (Organizations) CanGrantTeamAccess ¶
func (s Organizations) CanGrantTeamAccess(ctx context.Context, org string, team int64) (bool, error)
CanGrantTeamAccess reports whether the account may grant team of org access to a repository it creates. Gitea allows site administrators and owners of org, and members of the team when org lets repository administrators change team access.
func (Organizations) Create ¶
func (s Organizations) Create(ctx context.Context, opts OrganizationOptions) (Organization, error)
Create creates an organization owned by the selected account.
func (Organizations) Delete ¶
func (s Organizations) Delete(ctx context.Context, name string) error
Delete deletes the named organization.
func (Organizations) Edit ¶
func (s Organizations) Edit(ctx context.Context, name string, opts OrganizationOptions) (Organization, error)
Edit changes only supplied organization preferences.
func (Organizations) IsMember ¶
IsMember reports whether username belongs to the organization. It fails with a *NotFoundError when the organization or the user does not exist.
func (Organizations) IsPublicMember ¶
IsPublicMember reports whether username's membership of the organization is public.
func (Organizations) List ¶
func (s Organizations) List(ctx context.Context, mine bool, username string, limit, page int) (Page[Organization], error)
List selects public organizations, your organizations, or a named user's organizations.
func (Organizations) Members ¶
func (s Organizations) Members(ctx context.Context, name string, opts MemberListOptions) (Page[OrganizationMember], error)
Members lists the members of an organization.
func (Organizations) RemoveMember ¶
func (s Organizations) RemoveMember(ctx context.Context, name, username string) error
RemoveMember removes an organization member and their organization access.
func (Organizations) RepositoryCount ¶
RepositoryCount counts the repositories of an organization, or returns nil when the account cannot read the count.
func (Organizations) SetMemberPublic ¶
func (s Organizations) SetMemberPublic(ctx context.Context, name, username string, public bool) error
SetMemberPublic changes public visibility of an existing membership.
func (Organizations) Size ¶
func (s Organizations) Size(ctx context.Context, name string) (OrganizationSize, error)
Size counts the members, teams and repositories of an organization; a count the account cannot read is nil.
func (Organizations) View ¶
func (s Organizations) View(ctx context.Context, name string) (Organization, error)
View retrieves a named organization.
type Package ¶
type Package struct {
ID int64 `json:"id"`
Owner string `json:"owner"`
Type string `json:"type"`
Name string `json:"name"`
Version string `json:"version"`
Repository string `json:"repository"`
Creator string `json:"creator"`
URL string `json:"url"`
CreatedAt string `json:"created_at"`
}
Package is one version of a package in an owner's package registry.
type PackageFile ¶
type PackageFile struct {
ID int64 `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
}
PackageFile is one file of a package version.
type PackageListOptions ¶
PackageListOptions selects packages by type and name.
type Packages ¶
Packages manages the package registry of a user or organization.
func (Packages) CheckGenericUpload ¶
func (s Packages) CheckGenericUpload(ctx context.Context, name, version string, files []string) error
CheckGenericUpload refuses to upload files to a version of a generic package that holds a file of the same name already, ignoring case as Gitea does; a new version holds none.
func (Packages) Delete ¶
Delete deletes one version of a package, or every version when version is empty.
func (Packages) Link ¶
Link links a package to a repository of its owner, or with repository empty unlinks it.
func (Packages) UploadGeneric ¶
func (s Packages) UploadGeneric(ctx context.Context, name, version, file string, input io.Reader) error
UploadGeneric streams one file into a version of a generic package, creating either as needed. TODO(sdk): the SDK has no client for the package registries' upload endpoints.
type Page ¶
type Page[T any] struct { Items []T // More reports whether the collection continues past Items. More bool // Total is the size of the whole collection when Counted, from X-Total-Count. Total int Counted bool }
Page is one window of a collection and what the server reported about the rest of it.
type PartialEditError ¶
PartialEditError reports an edit that Gitea took only in part: the changes that Saved names were saved, and those that Failed names were not. Errs are the errors of the requests that failed; one that names its change, as that of a request which sent only it, keeps the change out of Failed. ReadErr is set when pull request Number could not be read back after the failure: the changes besides Saved and Failed may or may not have been saved then.
func (*PartialEditError) Error ¶
func (e *PartialEditError) Error() string
func (*PartialEditError) Unwrap ¶
func (e *PartialEditError) Unwrap() []error
type Projects ¶
Projects places the issues and pull requests of a repository on its project boards, or on those of the organization or user that owns it.
func (Projects) Add ¶
Add puts the issue with the global ID issueID in the default column of board, and reports whether it sent the request: an issue already on the board keeps its column. A board without columns first gets the default column Gitea creates for it on the web.
func (Projects) Boards ¶
Boards resolves the open projects that refs name by ID or title: a number is an ID before it is a title, and a title's case matters only to tell two projects apart. Titles are looked up in the repository's projects, else its owner's. It loads each board once, however many issues are then put on it or taken off; withIssues also reads which issues each holds, which issues that are not new need.
type Protection ¶
type Protection struct {
// Rule is the branch name, or a glob pattern such as release/*, that the rule protects.
Rule string `json:"rule"`
RequiredApprovals int64 `json:"required_approvals"`
// PushUsers and PushTeams may push directly; without them nobody can.
PushUsers []string `json:"push_users"`
PushTeams []string `json:"push_teams"`
// StatusChecks must pass before pull requests merge.
StatusChecks []string `json:"status_checks"`
BlockOnRejected bool `json:"block_on_rejected_reviews"`
DismissStaleApprovals bool `json:"dismiss_stale_approvals"`
}
Protection is a branch protection rule.
type ProtectionChanges ¶
type ProtectionChanges struct {
RequiredApprovals, Pushers, StatusChecks, BlockOnRejected, DismissStaleApprovals bool
}
ProtectionChanges selects the settings of a Protection that EditProtection changes.
type Pull ¶
type Pull struct {
Author string `json:"author"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Assignees []string `json:"assignees"`
Milestone *IssueMilestone `json:"milestone"`
Labels []Label `json:"labels"`
Deadline *string `json:"due_date"`
ID int64 `json:"id"`
Number int64 `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
URL string `json:"url"`
State string `json:"state"`
Merged bool `json:"merged"`
MergedAt *string `json:"merged_at"`
// MergedBy is only in responses for one pull request; lists leave it out.
MergedBy string `json:"merged_by"`
// MergeCommitSHA is the commit the merge created on the base branch, or null.
MergeCommitSHA *string `json:"merge_commit_sha"`
Mergeable bool `json:"mergeable"`
Draft bool `json:"draft"`
// ReviewDecision summarizes the reviews like gh: approved, changes_requested, review_required
// or "". Only commands that read the reviews fill it.
ReviewDecision string `json:"review_decision"`
Base string `json:"base"`
Head string `json:"head"`
HeadSHA string `json:"head_sha"`
HeadRepo string `json:"head_repo"`
HeadRemoteDeleted bool `json:"head_remote_deleted"`
HeadCanPush bool `json:"-"`
HeadCloneURL string `json:"-"`
HeadSSHURL string `json:"-"`
// AllowMaintainerEdit tells whether maintainers can push to the head branch.
AllowMaintainerEdit bool `json:"-"`
// Reviewers and ReviewerTeams are the outstanding review requests. Gitea's own list also
// names users who already reviewed, so commands that read the reviews replace them with
// WithReviews.
Reviewers []string `json:"reviewers"`
ReviewerTeams []string `json:"reviewer_teams"`
// Reviews are the submitted reviews, oldest first, filled by WithReviews and otherwise empty.
Reviews []Review `json:"reviews"`
Comments int64 `json:"comments"`
}
Pull is the stable command representation of a pull request.
type PullCreateChoices ¶
type PullCreateChoices struct {
Repository Repository
Base PullRepository
Template string
CreateSelectables
}
PullCreateChoices seed the interactive create form: the repository, its pull request template on the default branch, and the metadata selectables.
type PullEdit ¶
type PullEdit struct {
Labels *[]int64 `json:"-"`
Title *string `json:"title,omitempty"`
Body *string `json:"body,omitempty"`
State *string `json:"state,omitempty"`
Base *string `json:"base,omitempty"`
AllowMaintainerEdit *bool `json:"allow_maintainer_edit,omitempty"`
Assignees *[]string `json:"assignees,omitempty"`
Milestone *int64 `json:"-"`
ReviewerChanges *ReviewRequestChanges `json:"-"`
Deadline *time.Time `json:"due_date,omitempty"`
RemoveDeadline *bool `json:"unset_due_date,omitempty"`
Changes *MetadataChanges `json:"-"`
}
PullEdit distinguishes omitted fields from explicit empty values.
type PullListOptions ¶
type PullListOptions struct {
State, Sort, Author, Base string
Limit, Page int
Milestone int64
Labels []int64
// Draft, Head (BRANCH or OWNER:BRANCH), Assignee, NoAssignee, Search (text in the title or
// body) and the merged state have no server filter; List applies them to every pull request
// it reads.
Draft, NoAssignee bool
Head, Assignee, Search string
}
PullListOptions filters pull requests. State is open, closed, merged or all.
type PullOptions ¶
type PullOptions struct {
Assignees []string `json:"assignees,omitempty"`
Labels []int64 `json:"labels,omitempty"`
Milestone int64 `json:"milestone,omitempty"`
Deadline *time.Time `json:"due_date,omitempty"`
Title string `json:"title"`
Body string `json:"body"`
Base string `json:"base"`
Head string `json:"head"`
AllowMaintainerEdit *bool `json:"allow_maintainer_edit,omitempty"`
}
PullOptions supplies validated branch and content input for creation.
type PullRepository ¶
type PullRepository struct {
Repository string
DefaultBranch string
PullsEnabled bool
// CanPush is whether the account may push branches to it. A response without permissions, as
// for an anonymous request, leaves it to the push.
CanPush bool
}
PullRepository is what creating a pull request needs to know about the repository it goes into.
func (PullRepository) CheckEnabled ¶
func (r PullRepository) CheckEnabled() error
CheckEnabled returns the UnitError of a repository with its pull requests turned off, so that a command can refuse before it prompts or pushes a branch.
type PullStatus ¶
type PullStatus struct {
CurrentBranch *Pull `json:"current_branch"`
Authored []SearchItem `json:"authored"`
Assigned []SearchItem `json:"assigned"`
ReviewRequested []SearchItem `json:"review_requested"`
}
PullStatus groups open pull requests by the selected account's participation. CurrentBranch is the pull request of the checked-out branch, which commands fill when they know it.
type Pulls ¶
Pulls implements repository pull request operations.
func (Pulls) Base ¶
func (s Pulls) Base(ctx context.Context) (PullRepository, error)
Base reads the repository of the pull requests, for a new one.
func (Pulls) CheckUsers ¶
CheckUsers verifies that the named assignees and reviewers, such as those of a pull request about to be created, exist, so that an unknown name fails before a branch is pushed or the pull request exists. A user the account may not see is left for Gitea to refuse, and so is a reviewer named by email address, which Gitea looks up by email; assignees are taken by name only.
func (Pulls) Checks ¶
Checks returns latest contexts for the PR head in its base repository, as Gitea does.
func (Pulls) CommitChecks ¶
CommitChecks returns the latest status of each check context of a commit.
func (Pulls) CreateChoices ¶
func (s Pulls) CreateChoices(ctx context.Context) (PullCreateChoices, error)
CreateChoices fetches the repository once for its default branch and permissions, refusing one with its pull requests turned off, then loads the pull request template and the selectables concurrently.
func (Pulls) DeleteHead ¶
DeleteHead deletes the head branch of a pull request in its head repository.
func (Pulls) Detail ¶
Detail reads, a few pull requests at a time, what a listing leaves out: with view, each pull request again, for merged_by; with reviews, its reviews, for WithReviews.
func (Pulls) EditFrom ¶
EditFrom is Edit for pull request n as before holds it just ahead of the edit, or nil when it was not read. When an edit of several fields fails, the pull request read back is compared with before to tell what was saved; without before, such an edit reads it first.
func (Pulls) List ¶
List returns a page of pull requests, even when the server caps its page size below the limit, and reports whether more pull requests follow.
func (Pulls) ListPage ¶
ListPage is List that also reports how many pull requests match, when the server counts them or every pull request was read for a filter without a server equivalent. Such a filter reads pages only until one pull request past the requested page matches.
func (Pulls) Merge ¶
Merge merges the pull request's head opts.HeadSHA, else its current head, with the selected strategy. When Gitea refuses the merge, the error names the reason derived from the pull request, since Gitea reports conflicts only as "try again later". Gitea answers the same while it checks the pull request again after its base branch moved, so such a refusal of an open pull request is retried once after a short delay.
func (Pulls) MergeSettings ¶
func (s Pulls) MergeSettings(ctx context.Context) (MergeSettings, error)
MergeSettings reads the merge styles the repository allows and its default style and branch deletion. A default style that is not allowed falls back to the first allowed one.
func (Pulls) NewestClosed ¶
NewestClosed returns the most recently updated closed or merged pull request that keep accepts, and whether there is one. It reads pages newest first and stops at the first match.
func (Pulls) PushableFork ¶
PushableFork reports whether repo is a fork of the pull requests' repository that the account may push to, so that it can hold the head branch of a new pull request.
func (Pulls) Template ¶
Template returns the first pull request template found at ref, or "" when the repository has none. All paths are probed concurrently; the result is decided in priority order, so a failure is reported only when every higher-priority path is missing.
func (Pulls) WatchChecks ¶
func (s Pulls) WatchChecks(ctx context.Context, n int64, interval time.Duration, changed func([]Check) error) ([]Check, error)
WatchChecks follows the current PR head until contexts finish or a check fails. An empty status set waits for checks to be registered instead of claiming success.
func (Pulls) WithReviews ¶
WithReviews returns p with its reviewers, reviewer teams, reviews and review decision taken from reviews, all of its reviews. While the protection of the base branch requires approvals, the decision is approved only with as many official ones as Gitea counts for merging, and review_required with fewer.
type RefusedError ¶
RefusedError words a refusal that Gitea answers without naming what it refused, such as a 403 "write permission is required".
func (*RefusedError) Error ¶
func (e *RefusedError) Error() string
func (*RefusedError) Unwrap ¶
func (e *RefusedError) Unwrap() error
type Release ¶
type Release struct {
ID int64 `json:"id"`
Tag string `json:"tag"`
Target string `json:"target"`
Title string `json:"title"`
Body string `json:"body"`
URL string `json:"url"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
Author string `json:"author"`
Assets []ReleaseAsset `json:"assets"`
CreatedAt string `json:"created_at"`
PublishedAt *string `json:"published_at"`
}
Release describes a repository release.
type ReleaseAsset ¶
type ReleaseAsset struct {
ID int64 `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
URL string `json:"url"`
CreatedAt string `json:"created_at"`
DownloadCount int64 `json:"download_count"`
}
ReleaseAsset is the public metadata of a release attachment.
type ReleaseOptions ¶
type ReleaseOptions struct {
Tag *string `json:"tag_name,omitempty"`
Target *string `json:"target_commitish,omitempty"`
Title *string `json:"name,omitempty"`
Body *string `json:"body,omitempty"`
Draft *bool `json:"draft,omitempty"`
Prerelease *bool `json:"prerelease,omitempty"`
}
ReleaseOptions distinguishes omitted fields from explicit empty or false values.
type Releases ¶
Releases implements repository release workflows.
func (Releases) Archive ¶
Archive opens the source archive of the repository at ref; format is zip or tar.gz. TODO(sdk): GetArchiveReader cannot follow the redirect to object storage that serves archives directly.
func (Releases) Create ¶
Create creates a release and lets Gitea create a missing tag at the supplied target.
func (Releases) Delete ¶
Delete removes a release and optionally its tag; partial failures identify the completed step.
func (Releases) DeleteAsset ¶
DeleteAsset removes one asset from the selected release.
func (Releases) DownloadAsset ¶
DownloadAsset opens a repository-validated attachment stream at its direct instance URL.
func (Releases) Latest ¶
Latest retrieves the most recent release that is neither a draft nor a prerelease.
func (Releases) ListPage ¶
ListPage lists a page of releases, with whether more follow and how many there are.
func (Releases) RenameAsset ¶
func (s Releases) RenameAsset(ctx context.Context, id, asset int64, name string) (ReleaseAsset, error)
RenameAsset changes only an attachment's display name.
type Repositories ¶
Repositories implements Gitea repository operations.
func (Repositories) Assignees ¶
Assignees lists the users that can be assigned on repository issues.
func (Repositories) Create ¶
func (s Repositories) Create(ctx context.Context, org string, opts RepositoryOptions) (Repository, error)
Create creates a repository for the account or the named organization.
func (Repositories) CreateChoices ¶ added in v0.2.0
func (s Repositories) CreateChoices(ctx context.Context) (RepositoryCreateChoices, error)
CreateChoices loads the choices of interactive repository creation.
func (Repositories) Delete ¶
func (s Repositories) Delete(ctx context.Context, repo string) error
Delete removes the selected repository.
func (Repositories) Edit ¶
func (s Repositories) Edit(ctx context.Context, repo string, opts RepositoryEdit) (Repository, error)
Edit updates only explicitly supplied resource fields.
func (Repositories) Fork ¶
func (s Repositories) Fork(ctx context.Context, repo string, opts ForkOptions) (Repository, bool, error)
Fork forks repo for the account or the organization. When that owner already has a fork of repo, Fork returns it and reports that it existed.
func (Repositories) Generate ¶
func (s Repositories) Generate(ctx context.Context, source string, opts RepositoryTemplateOptions) (Repository, error)
Generate creates a repository from a template on the selected instance.
func (Repositories) Gitignores ¶
func (s Repositories) Gitignores(ctx context.Context) ([]string, error)
Gitignores lists the .gitignore templates that repository creation accepts.
func (Repositories) LabelTemplates ¶
func (s Repositories) LabelTemplates(ctx context.Context) ([]string, error)
LabelTemplates lists the label sets that repository creation accepts.
func (Repositories) Licenses ¶
func (s Repositories) Licenses(ctx context.Context) ([]string, error)
Licenses lists the license templates that repository creation accepts.
func (Repositories) List ¶
func (s Repositories) List(ctx context.Context, opts RepositoryListOptions) ([]Repository, bool, error)
List returns repositories accessible to the account, or its selected collection. It reports whether more repositories follow the selected page.
func (Repositories) ListPage ¶
func (s Repositories) ListPage(ctx context.Context, opts RepositoryListOptions) (Page[Repository], error)
ListPage is List that also reports the size of the collection when the server counts it. The server has no kind filter, so a kind is filtered on the client, reading pages until the requested one is full.
func (Repositories) MergeUpstream ¶
MergeUpstream fast-forwards branch of the fork repo to its parent's branch on the server. It returns how Gitea updated the branch: "fast-forward", or "up-to-date" when there was nothing to do.
func (Repositories) Migrate ¶
func (s Repositories) Migrate(ctx context.Context, opts RepositoryMigrationOptions) (Repository, error)
Migrate imports a remote repository through Gitea's migration API.
func (Repositories) MirrorSync ¶
func (s Repositories) MirrorSync(ctx context.Context, repo string) error
MirrorSync asks the server to update the pull mirror repo from its source; the update runs in the background.
func (Repositories) Readme ¶
func (s Repositories) Readme(ctx context.Context, repo, ref string) (path, content string, err error)
Readme returns the README of the repository at ref as Gitea's web view finds it, searching .gitea, .github, the root and docs: its path and its content, or "" when there is none. An explicit ref that does not exist is an error.
func (Repositories) Search ¶
func (s Repositories) Search(ctx context.Context, opts RepositorySearchOptions) (Page[Repository], error)
Search searches repository names, descriptions or topics within one instance.
func (Repositories) Topics ¶
Topics lists the topics of the repository. Gitea allows at most 25, so one page holds them all.
func (Repositories) Transfer ¶
func (s Repositories) Transfer(ctx context.Context, repo, newOwner string, teams []int64) (RepositoryTransfer, error)
Transfer moves repo to newOwner and grants the teams of an organization access to it. Gitea makes the transfer wait for the new owner when the account may not create repositories there.
func (Repositories) View ¶
func (s Repositories) View(ctx context.Context, repo string) (Repository, error)
View retrieves one repository.
type Repository ¶
type Repository struct {
ActionsEnabled bool `json:"actions_enabled"`
Website string `json:"website"`
ID int64 `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
Description string `json:"description"`
URL string `json:"url"`
Private bool `json:"private"`
DefaultBranch string `json:"default_branch"`
CloneURL string `json:"clone_url"`
SSHURL string `json:"ssh_url"`
Archived bool `json:"archived"`
Template bool `json:"template"`
Fork bool `json:"fork"`
Mirror bool `json:"mirror"`
Empty bool `json:"empty"`
Stars int `json:"stars_count"`
Forks int `json:"forks_count"`
OpenIssues int `json:"open_issues_count"`
OpenPulls int `json:"open_pr_count"`
Topics []string `json:"topics"`
UpdatedAt string `json:"updated_at"`
Parent *Repository `json:"parent"`
// OriginalURL stays out of JSON output: migration sources may embed credentials.
OriginalURL string `json:"-"`
// Source is OriginalURL without credentials.
Source string `json:"original_url"`
MirrorInterval string `json:"mirror_interval"`
}
Repository is the stable command representation of a repository.
type RepositoryCreateChoices ¶ added in v0.2.0
type RepositoryCreateChoices struct {
Organizations, Licenses, Gitignores []string
}
RepositoryCreateChoices are what interactive repository creation offers: the organizations of the account and the server's license and .gitignore templates.
type RepositoryEdit ¶
type RepositoryEdit struct {
ActionsEnabled *bool `json:"has_actions,omitempty"`
Name *string `json:"name,omitempty"`
Website *string `json:"website,omitempty"`
DefaultBranch *string `json:"default_branch,omitempty"`
Description *string `json:"description,omitempty"`
Private *bool `json:"private,omitempty"`
Archived *bool `json:"archived,omitempty"`
Template *bool `json:"template,omitempty"`
Issues *bool `json:"has_issues,omitempty"`
Wiki *bool `json:"has_wiki,omitempty"`
PullRequests *bool `json:"has_pull_requests,omitempty"`
Projects *bool `json:"has_projects,omitempty"`
MergeCommits *bool `json:"allow_merge_commits,omitempty"`
Squash *bool `json:"allow_squash_merge,omitempty"`
Rebase *bool `json:"allow_rebase,omitempty"`
ManualMerge *bool `json:"allow_manual_merge,omitempty"`
DetectMerge *bool `json:"autodetect_manual_merge,omitempty"`
MergeStyle *string `json:"default_merge_style,omitempty"`
DeleteBranch *bool `json:"default_delete_branch_after_merge,omitempty"`
}
RepositoryEdit distinguishes omitted settings from explicit false values.
type RepositoryListOptions ¶
RepositoryListOptions selects a repository collection and page.
type RepositoryMigrationOptions ¶
type RepositoryMigrationOptions struct {
Name string `json:"repo_name"`
Owner string `json:"repo_owner,omitempty"`
CloneURL string `json:"clone_addr"`
Service string `json:"service"`
AuthUser string `json:"auth_username,omitempty"`
AuthPassword string `json:"auth_password,omitempty"`
AuthToken string `json:"auth_token,omitempty"`
Mirror bool `json:"mirror"`
Private bool `json:"private"`
Description string `json:"description,omitempty"`
Wiki bool `json:"wiki"`
Milestones bool `json:"milestones"`
Labels bool `json:"labels"`
Issues bool `json:"issues"`
PullRequests bool `json:"pull_requests"`
Releases bool `json:"releases"`
MirrorInterval string `json:"mirror_interval,omitempty"`
LFS bool `json:"lfs"`
LFSEndpoint string `json:"lfs_endpoint,omitempty"`
Timeout time.Duration `json:"-"`
}
RepositoryMigrationOptions is explicit server-side import input. Credentials stay in request bodies.
type RepositoryOptions ¶
type RepositoryOptions struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Private bool `json:"private"`
AutoInit bool `json:"auto_init"`
DefaultBranch string `json:"default_branch,omitempty"`
Labels string `json:"issue_labels,omitempty"`
Gitignores string `json:"gitignores,omitempty"`
License string `json:"license,omitempty"`
Readme string `json:"readme,omitempty"`
Template bool `json:"template"`
TrustModel string `json:"trust_model,omitempty"`
ObjectFormat string `json:"object_format_name,omitempty"`
}
RepositoryOptions supplies repository creation input.
type RepositoryPermissions ¶
type RepositoryPermissions struct {
Admin bool `json:"admin"`
Push bool `json:"push"`
Pull bool `json:"pull"`
}
RepositoryPermissions holds server-side access flags used only for local decisions. It is intentionally omitted from the stable Repository JSON schema.
type RepositorySearchOptions ¶
type RepositorySearchOptions struct {
Query, Owner, Kind, Sort, Order string
Topic bool
Private, Archived *bool
Limit, Page int
}
RepositorySearchOptions supplies explicit repository search filters.
type RepositoryTemplateOptions ¶
type RepositoryTemplateOptions struct {
Name string `json:"name"`
Owner string `json:"owner"`
Description string `json:"description"`
DefaultBranch string `json:"default_branch,omitempty"`
Private bool `json:"private"`
Content bool `json:"git_content"`
GitHooks bool `json:"git_hooks"`
Avatar bool `json:"avatar"`
Labels bool `json:"labels"`
Topics bool `json:"topics"`
Webhooks bool `json:"webhooks"`
}
RepositoryTemplateOptions controls copying from a template repository.
type RepositoryTransfer ¶
type RepositoryTransfer struct {
Repository
Pending bool `json:"transfer_pending"`
}
RepositoryTransfer is a repository whose transfer was requested. A pending transfer waits for the new owner to accept it, and the repository keeps its owner until then.
type Review ¶
type Review struct {
ID int64 `json:"id"`
Body string `json:"body"`
State string `json:"state"`
Author string `json:"author"`
Team string `json:"team"`
URL string `json:"url"`
Commit string `json:"commit"`
SubmittedAt string `json:"submitted_at"`
CommentsCount int `json:"comments_count"`
Dismissed bool `json:"dismissed"`
// Stale tells whether the pull request changed since the review.
Stale bool `json:"stale"`
// Official tells whether the review counts towards the approvals the base branch requires.
Official bool `json:"official"`
}
Review is a stable review result.
func EffectiveReviews ¶ added in v0.2.0
EffectiveReviews returns each reviewer's review in effect, in the order of their first review: their latest, except that a comment review leaves an earlier one of another state in effect, as in Gitea, where only an approval or a dismissal lifts a request for changes.
func LatestReviews ¶
LatestReviews returns each reviewer's latest review, in the order of their first review. Pending reviews, which only their author sees, are left out; a later request for a review replaces a review.
type ReviewComment ¶
type ReviewComment struct {
ID int64 `json:"id"`
ReviewID int64 `json:"review_id"`
Body string `json:"body"`
Author string `json:"author"`
Resolver string `json:"resolver"`
URL string `json:"url"`
Path string `json:"path"`
Line int64 `json:"line"`
OldLine int64 `json:"old_line"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
ReviewComment describes an inline review conversation.
func (ReviewComment) Location ¶
func (c ReviewComment) Location() string
Location names the file and line a comment is on: "app.go:8", or "app.go:4 (old)" for a removed line, which has only an old position.
type ReviewOptions ¶
type ReviewOptions struct {
Event string `json:"event"`
Body string `json:"body"`
Commit string `json:"commit_id,omitempty"`
Comments []InlineComment `json:"comments,omitempty"`
}
ReviewOptions supplies collected review text and inline comments.
type ReviewRequestChanges ¶
type ReviewRequestChanges struct {
Add, Remove ReviewRequestInput
}
ReviewRequestChanges adds and removes explicitly named review requests.
func (ReviewRequestChanges) Validate ¶
func (c ReviewRequestChanges) Validate() error
Validate rejects empty, duplicated, and conflicting names before any request.
type ReviewRequestInput ¶
type ReviewRequestInput struct {
Users []string `json:"reviewers,omitempty"`
Teams []string `json:"team_reviewers,omitempty"`
}
ReviewRequestInput names users and teams within the repository's organization.
type ReviewSubmitOptions ¶
ReviewSubmitOptions preserves existing draft text when Body is omitted.
type Reviews ¶
Reviews manages pull request reviews.
func (Reviews) ChangeRequests ¶
func (s Reviews) ChangeRequests(ctx context.Context, n int64, changes ReviewRequestChanges) (Pull, error)
ChangeRequests returns the PR after changes and reports partial mutation failures.
func (Reviews) CheckRequestTeams ¶
CheckRequestTeams verifies that every named team exists in the repository's organization. Gitea lets only organization members list teams, though outside collaborators and the pull request author may request reviews; when the lookup is forbidden, or the organization is hidden from the caller (a private organization answers 404 to non-members), the server checks the names, as for gh.
func (Reviews) Comments ¶
func (s Reviews) Comments(ctx context.Context, n, reviewID int64, limit, page int) (Page[ReviewComment], error)
Comments flattens the API's unpaginated per-review collections in ID order.
func (Reviews) Dismiss ¶
func (s Reviews) Dismiss(ctx context.Context, n, id int64, dismiss bool, message string) (Review, error)
Dismiss changes a review's contribution to approval requirements and returns the review.
func (Reviews) ListPage ¶
ListPage lists a window of reviews of pull request n. It reaches past the server's smaller page size, which List would silently take as the whole window.
func (Reviews) Pending ¶
Pending returns the reviews that login started on pull request n and has not submitted yet.
type Run ¶
type Run struct {
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
StartedAt *string `json:"started_at"`
CompletedAt *string `json:"completed_at"`
ID int64 `json:"id"`
RunNumber int64 `json:"run_number"`
Title string `json:"title"`
Workflow string `json:"workflow"`
WorkflowPath string `json:"workflow_path"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
URL string `json:"url"`
Branch string `json:"branch"`
Event string `json:"event"`
Actor string `json:"actor"`
Commit string `json:"commit"`
Attempt int64 `json:"attempt"`
Jobs []Job `json:"jobs,omitzero"`
}
Run is the stable command representation of an Actions run. StartedAt and CompletedAt are nil until the run starts and completes. Workflow is the workflow's name and WorkflowPath its file name; Jobs is only filled where commands show a single run, and JSON leaves it out elsewhere.
type RunListOptions ¶
type RunListOptions struct {
Since, Until *time.Time
Limit, Page int
Branch, Event, Actor, Commit, Workflow string
Statuses []string
}
RunListOptions supplies server-side run filters and pagination. Workflow is a workflow file name.
func (RunListOptions) Validate ¶
func (o RunListOptions) Validate() error
Validate rejects unsupported status filters before performing API requests.
type SSHKey ¶
type SSHKey struct {
ID int64 `json:"id"`
Title string `json:"title"`
Key string `json:"key"`
Fingerprint string `json:"fingerprint"`
CreatedAt string `json:"created_at"`
ReadOnly bool `json:"read_only"`
}
SSHKey describes a public key attached to the selected account.
type SSHKeys ¶
SSHKeys manages public keys for the authenticated account.
type SearchItem ¶
type SearchItem struct {
ID int64 `json:"id"`
Number int64 `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
URL string `json:"url"`
State string `json:"state"`
Type string `json:"type"`
Repository string `json:"repository"`
Author string `json:"author"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
SearchItem is shared issue/PR search metadata; ID is Gitea's issue-tracker record ID, including for PRs. Repository and Number identify the resource across search and pull endpoints, which use different internal IDs.
type Status ¶
Status reuses search and Actions workflows.
func (Status) Pulls ¶
Pulls collects each category independently; limit applies after repository filtering.
func (Status) Summary ¶
func (s Status) Summary(ctx context.Context, limit int, runsRepository string, discovered bool) (AccountStatus, error)
Summary reports open assigned issues and pull requests and mentions. Failing Actions runs of runsRepository are included when it is set and has Actions enabled. A runsRepository that was only discovered from a clone is left out when the account cannot read it, instead of failing.
type Step ¶
type Step struct {
Number int64 `json:"number"`
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
StartedAt *string `json:"started_at"`
CompletedAt *string `json:"completed_at"`
}
Step is one step of a job. StartedAt and CompletedAt are nil until the step starts and completes.
type Team ¶
type Team struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Organization string `json:"organization"`
// Permission is the team-wide level Gitea reports: owner, admin, read, write, or none for a
// team that grants its access per unit.
Permission string `json:"permission"`
// Access is the team's effective access, as EffectiveAccess summarizes it.
Access string `json:"access"`
CanCreateRepo bool `json:"can_create_repo"`
AllRepositories bool `json:"all_repositories"`
Units map[string]string `json:"units"`
}
Team is an organization's access group and its permission policy.
func (Team) EffectiveAccess ¶
EffectiveAccess summarizes what the team may do in its repositories: owner or admin; the one level it grants, such as write, followed by the units when it does not grant all of them, as in "write (code, issues, pulls)"; none; or custom when it grants different levels.
type TeamMember ¶
type TeamMember struct {
ID int64 `json:"id"`
Username string `json:"username"`
FullName string `json:"full_name"`
}
TeamMember identifies a team member without exposing private profile fields.
type TeamOptions ¶
type TeamOptions struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Permission *string `json:"permission,omitempty"`
CanCreateRepo *bool `json:"can_create_org_repo,omitempty"`
AllRepositories *bool `json:"includes_all_repositories,omitempty"`
Units map[string]string `json:"units_map,omitempty"`
// ReplaceUnits makes Edit replace the unit policy with Units instead of merging Units into it.
ReplaceUnits bool `json:"-"`
}
TeamOptions preserves omitted fields when changing a team.
type TeamSize ¶
type TeamSize struct {
Members, Repositories *int
}
TeamSize counts the members and repositories of a team; a count the server omits is nil.
type Teams ¶
Teams implements team, member and repository access operations.
func (Teams) ByName ¶
ByName indexes every team of an organization by lower-case name, which Gitea keeps unique.
func (Teams) Edit ¶
Edit merges Units into the current unit policy unless ReplaceUnits is set, and preserves unit permissions when changing access to all repositories. Gitea replaces the whole policy on edit.
func (Teams) Find ¶
Find returns the team of org that team addresses by name or ID, as NameOrID matches them.
func (Teams) Repositories ¶
func (s Teams) Repositories(ctx context.Context, id int64, limit, page int) (Page[Repository], error)
Repositories lists repositories accessible to a team.
func (Teams) SetRepository ¶
SetRepository adds or removes team access to a repository.
type TimeOptions ¶
type TimeOptions struct {
Mine bool
Issue int64
Username string
Limit, Page int
Since, Before *time.Time
}
TimeOptions supplies an explicit scope, pagination and date filters.
type TimelineEvent ¶
type TimelineEvent struct {
ID int64 `json:"id"`
Type string `json:"type"`
Author string `json:"author"`
URL string `json:"url"`
CreatedAt string `json:"created_at"`
// Body is the text of comments and reviews.
Body *string `json:"body"`
Label *string `json:"label"`
LabelAdded *bool `json:"label_added"`
Milestone *string `json:"milestone"`
OldMilestone *string `json:"old_milestone"`
OldTitle *string `json:"old_title"`
NewTitle *string `json:"new_title"`
// Assignee is the user an "assignees" event assigned, or the user a "review_request" event
// asked for a review; RemovedAssignee tells that it unassigned them or withdrew the request.
Assignee *string `json:"assignee"`
RemovedAssignee *bool `json:"removed_assignee"`
// DependentIssue is the issue a dependency event added or removed, as OWNER/REPO#NUMBER.
DependentIssue *string `json:"dependent_issue"`
// Deadline is the due date, as YYYY-MM-DD, that an "added_deadline" or "modified_deadline"
// event set; OldDeadline is the one a "modified_deadline" or "removed_deadline" event replaced.
Deadline *string `json:"deadline"`
OldDeadline *string `json:"old_deadline"`
}
TimelineEvent is one entry of an issue's or pull request's timeline: a comment, or a change such as a label, milestone, title or state change, named by Type as Gitea does. Fields an event does not use are nil, so every key is always present in JSON.
type Times ¶
Times implements repository and account time tracking.
func (Times) ListPage ¶
func (s Times) ListPage(ctx context.Context, opts TimeOptions) (Page[TrackedTime], error)
ListPage returns a non-nil page of tracked time records with their number, as the server counts them.
type TrackedTime ¶
type TrackedTime struct {
ID int64 `json:"id"`
Seconds int64 `json:"seconds"`
CreatedAt string `json:"created_at"`
User string `json:"user"`
Repository string `json:"repository"`
IssueNumber int64 `json:"issue_number"`
IssueTitle string `json:"issue_title"`
IssueURL string `json:"issue_url"`
}
TrackedTime is a stable record of seconds spent on an issue or pull request.
type UnitError ¶
type UnitError struct {
Repository string
// Unit is UnitIssues, UnitPulls, or both.
Unit string
// Tracker is the URL of the external issue tracker, if the repository uses one.
Tracker string
// Instance is the URL of the repository's instance, when known.
Instance string
// NamesInstance makes the hint name Instance, which commands do not find on their own.
NamesInstance bool
}
UnitError reports a request to issues or pull requests of a repository that has them turned off, or that keeps its issues in an external tracker.
type Webhook ¶
type Webhook struct {
ID int64 `json:"id"`
Type string `json:"type"`
URL string `json:"url"`
ContentType string `json:"content_type"`
Active bool `json:"active"`
Events []string `json:"events"`
BranchFilter string `json:"branch_filter"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Webhook is webhook metadata. Its delivery URL omits credentials unless revealed; signing secrets and authorization headers are never returned.
type WebhookOptions ¶
type WebhookOptions struct {
Type string `json:"type,omitempty"`
Config map[string]string `json:"config,omitempty"`
Events *[]string `json:"events,omitempty"`
Active *bool `json:"active,omitempty"`
BranchFilter *string `json:"branch_filter,omitempty"`
Authorization *string `json:"authorization_header,omitempty"`
}
WebhookOptions distinguishes omitted input from explicit empty or false values.
type WebhookScope ¶
WebhookScope selects one repository, organization, account or system scope.
type Webhooks ¶
type Webhooks struct {
Client *transport.Client
Scope WebhookScope
// RevealURL returns delivery URLs whole, with the credentials they may carry.
RevealURL bool
}
Webhooks manages hooks without returning delivery credentials.
func (Webhooks) Edit ¶
Edit preserves settings that Gitea replaces rather than patching individually.
type Wiki ¶
Wiki implements repository wiki operations.
func (Wiki) Edit ¶
Edit replaces page content and optionally changes its title. It reports whether the title changed. Gitea's edit creates a page that does not exist and overwrites one the new title names, so both are checked first.
func (Wiki) ListPage ¶
ListPage lists a page of wiki pages, with whether more follow and, when the whole wiki was read, how many there are. Gitea windows the wiki's files, not its pages: a window holds fewer pages than its size, or none, while later windows still hold pages. The windows are read in order while the server links a next one, until one page past the requested page is found.
type WikiOptions ¶
type WikiOptions struct{ Title, Body, Message string }
WikiOptions supplies title, decoded content and a commit message.
type WikiPage ¶
type WikiPage struct {
Title string `json:"title"`
Body string `json:"body"`
URL string `json:"url"`
SHA string `json:"sha"`
Author string `json:"author"`
UpdatedAt string `json:"updated_at"`
CommitCount int64 `json:"commit_count"`
Sidebar string `json:"sidebar"`
// contains filtered or unexported fields
}
WikiPage exposes decoded page content and revision metadata. Gitea lists pages without their content, so the JSON of a listed page leaves out body, commit_count, sidebar and footer rather than report them empty.
func (WikiPage) MarshalJSON ¶
MarshalJSON leaves the content fields out of a listed page.
type WikiRevision ¶
type WikiRevision struct {
SHA string `json:"sha"`
Message string `json:"message"`
Author string `json:"author"`
CreatedAt string `json:"created_at"`
}
WikiRevision represents a wiki commit without exposing author email addresses.
type Workflow ¶
type Workflow struct {
ID string `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
State string `json:"state"`
URL string `json:"url"`
}
Workflow is the stable command representation of an Actions workflow. ID is its file name, such as ci.yml.
func FindWorkflow ¶
FindWorkflow returns the workflow among items that raw names, like Actions.FindWorkflow. It fails with a *NotFoundError when none matches and lists the files when several names match.
type WorkflowInput ¶
type WorkflowInput struct {
Name, Description string
// Type is string, choice, boolean, number or environment; empty means string.
Type, Default string
Required bool
Options []string
}
WorkflowInput is one input that a workflow's workflow_dispatch trigger declares.
func DispatchInputs ¶
func DispatchInputs(definition []byte) ([]WorkflowInput, error)
DispatchInputs parses the inputs that the workflow_dispatch trigger of a workflow definition declares, in their order. It fails with ErrNoDispatch when the workflow cannot be dispatched.
Source Files
¶
- action_logs.go
- action_runs.go
- action_values.go
- actions.go
- admin_users.go
- api.go
- artifacts.go
- attachments.go
- branches.go
- checks.go
- comments.go
- convert.go
- deploy_keys.go
- draft.go
- errors.go
- helpers.go
- identity.go
- issue_attachments.go
- issue_create_selectables.go
- issue_dependencies.go
- issues.go
- label_selection.go
- metadata.go
- milestone_selection.go
- notifications.go
- organizations.go
- packages.go
- poll.go
- projects.go
- pull_create_selectables.go
- pulls.go
- raw.go
- releases.go
- repositories.go
- repository_search.go
- repository_setup.go
- review_requests.go
- reviews.go
- sdk.go
- search.go
- ssh_keys.go
- status.go
- teams.go
- time.go
- timeline.go
- webhooks.go
- wiki.go