Help us shape the future of Go! Take the 2026 Go Developer Survey

forgejo

package
v0.74.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package forgejo implements the Forgejo Provider for the go-git-platform.

It builds on top of the official codeberg.org/mvdkleijn/forgejo-sdk/forgejo/v3 SDK and adds transport-layer cross-cutting behavior (auth, retry, hooks, logging) provided by the parent project's transport package. All Provider methods are split across the per-responsibility files in this package:

  • forgejo.go: constructor + identity (Platform, TestConnection, Capabilities)
  • init.go: provider registration with the global registry
  • repos.go: ListRepos, GetRepo, CreateRepo, DeleteRepo, UpdateRepo, ForkRepo
  • crs.go: Change requests (PRs): Create/Get/List/Merge/Close/Reopen/Update/UpdateLabels/Comments/Commits
  • webhooks.go: webhook CRUD + signature validation + event parsing
  • branches.go: ListBranches, CreateBranch, DeleteBranch
  • diffs.go: GetCRDiff, GetCRFiles, CreateNote/DeleteNote, CreateDiscussion
  • commits.go: GetCommit, ListCommits, CompareCommits, CreateCommitStatus
  • files.go: GetFileContent, CreateFile, UpdateFile, DeleteFile
  • releases.go: ListTags, ListReleases, CreateRelease, GetArchive
  • labels.go: repository label CRUD (LabelManager)
  • issues.go: issue CRUD, comments, and issue labels (IssueManager)
  • reviews.go: pull-request code reviews (ReviewManager)
  • milestones.go: repository milestone CRUD (MilestoneManager)
  • search.go: global repo/issue/user search (SearchManager)
  • types.go: internal Forgejo-API types and conversion helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Divergences

func Divergences() []provider.Divergence

Divergences returns the registered divergence ledger for the Forgejo backend.

func New

New builds a Forgejo Provider from the given config.

Types

type Provider

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

Provider is the Forgejo implementation of provider.Provider.

func (*Provider) AddCRCommentReaction

func (p *Provider) AddCRCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)

AddCRCommentReaction implements provider.ReactionManager.

func (*Provider) AddCollaborator

func (p *Provider) AddCollaborator(ctx context.Context, owner, repo, username string, opts provider.AddCollaboratorOptions) error

AddCollaborator implements provider.CollaboratorManager.

func (*Provider) AddDeployKey

func (p *Provider) AddDeployKey(ctx context.Context, owner, repo string, opts provider.AddDeployKeyOptions) (*provider.DeployKey, error)

AddDeployKey implements provider.DeploymentKeyManager.

func (*Provider) AddIssueCommentReaction

func (p *Provider) AddIssueCommentReaction(ctx context.Context, owner, repo string, commentID int64, emoji string) (*provider.Reaction, error)

AddIssueCommentReaction implements provider.ReactionManager.

func (*Provider) AddIssueLabels

func (p *Provider) AddIssueLabels(ctx context.Context, owner, repo, number string, labels []string) error

AddIssueLabels implements provider.IssueManager.

func (*Provider) AddIssueReaction

func (p *Provider) AddIssueReaction(ctx context.Context, owner, repo, number, emoji string) (*provider.Reaction, error)

AddIssueReaction implements provider.ReactionManager.

func (*Provider) Capabilities

func (p *Provider) Capabilities() provider.CapabilitySet

Capabilities implements provider.Provider. Forgejo implements the optional LabelManager (see labels.go), IssueManager (see issues.go), ReviewManager (see reviews.go), and SearchManager (see search.go) interfaces.

func (*Provider) CloseCR

func (p *Provider) CloseCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)

CloseCR implements provider.ChangeRequestManager.

func (*Provider) CloseIssue

func (p *Provider) CloseIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)

CloseIssue implements provider.IssueManager.

func (*Provider) CompareCommits

func (p *Provider) CompareCommits(ctx context.Context, owner, repo, base, head string) (*provider.CompareResult, error)

CompareCommits implements provider.CommitManager.

func (*Provider) CreateBranch

func (p *Provider) CreateBranch(ctx context.Context, owner, repo, branch, ref string) (*provider.PlatformBranch, error)

CreateBranch implements provider.BranchManager.

func (*Provider) CreateBranchProtection

func (p *Provider) CreateBranchProtection(ctx context.Context, owner, repo string, opts provider.CreateBranchProtectionOptions) (*provider.BranchProtection, error)

CreateBranchProtection implements provider.BranchProtectionManager.

func (*Provider) CreateCR

CreateCR implements provider.ChangeRequestManager.

func (*Provider) CreateCommitStatus

func (p *Provider) CreateCommitStatus(ctx context.Context, owner, repo, sha string, opts provider.CommitStatusOptions) error

CreateCommitStatus implements provider.CommitStatusManager.

func (*Provider) CreateDiscussion

func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo, number string, opts provider.DiscussionOptions) (string, error)

CreateDiscussion implements provider.DiffManager.

Forgejo has no separate discussion endpoint; we approximate one by posting an issue comment (the same backing store Forgejo itself uses for PR discussions).

func (*Provider) CreateFile

func (p *Provider) CreateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)

CreateFile implements provider.FileManager.

func (*Provider) CreateIssue

func (p *Provider) CreateIssue(ctx context.Context, opts provider.CreateIssueOptions) (*provider.Issue, error)

CreateIssue implements provider.IssueManager. Forgejo's create endpoint takes label IDs, so names are resolved first (one list call per name; label counts are small).

func (*Provider) CreateIssueComment

func (p *Provider) CreateIssueComment(ctx context.Context, owner, repo, number, body string) (*provider.IssueComment, error)

CreateIssueComment implements provider.IssueManager.

func (*Provider) CreateLabel

func (p *Provider) CreateLabel(ctx context.Context, owner, repo string, opts provider.CreateLabelOptions) (*provider.Label, error)

CreateLabel implements provider.LabelManager. Forgejo accepts colors with or without a leading '#'; we send the '#'-prefixed form.

func (*Provider) CreateMilestone

func (p *Provider) CreateMilestone(ctx context.Context, owner, repo string, opts provider.CreateMilestoneOptions) (*provider.Milestone, error)

CreateMilestone implements provider.MilestoneManager.

func (*Provider) CreateNote

func (p *Provider) CreateNote(ctx context.Context, owner, repo, number, body string) (string, error)

CreateNote implements provider.DiffManager.

func (*Provider) CreateRelease

func (p *Provider) CreateRelease(ctx context.Context, owner, repo string, opts provider.CreateReleaseOptions) (*provider.ReleaseInfo, error)

CreateRelease implements provider.ReleaseManager. Registration: CreateReleaseOption.Target always serializes (target_commitish carries no omitempty), so a Target-less create sends `"target_commitish": ""`, which the server treats as unchanged (the default branch).

func (*Provider) CreateRepo

func (p *Provider) CreateRepo(ctx context.Context, owner string, opts provider.CreateRepoOptions) (*provider.PlatformRepo, error)

CreateRepo implements provider.RepoManager.

func (*Provider) CreateReview

func (p *Provider) CreateReview(ctx context.Context, owner, repo, number string, opts provider.CreateReviewOptions) (*provider.ReviewResult, error)

CreateReview implements provider.ReviewManager. It moved here from DiffManager; the change request number is now addressed as a string.

Forgejo's CreatePullReviewOptions carries the verdict under the event JSON key (the SDK's State field), and the server finalizes the review on create, so a single POST is enough — SubmitPullReview only exists for pending-draft workflows and would needlessly double the round trips (and its pending create path rejects empty-body, comment-less reviews that the direct submit accepts). The event mapping follows CreateReviewOptions's GitHub-style values: APPROVE and REQUEST_CHANGES map to the forgejo states of the same names; anything else (COMMENT included) becomes COMMENT.

func (*Provider) CreateWebhook

CreateWebhook implements provider.WebhookManager.

func (*Provider) DeleteBranch

func (p *Provider) DeleteBranch(ctx context.Context, owner, repo, branch string) error

DeleteBranch implements provider.BranchManager.

func (*Provider) DeleteBranchProtection

func (p *Provider) DeleteBranchProtection(ctx context.Context, owner, repo, branch string) error

DeleteBranchProtection implements provider.BranchProtectionManager.

func (*Provider) DeleteDeployKey

func (p *Provider) DeleteDeployKey(ctx context.Context, owner, repo string, keyID int64) error

DeleteDeployKey implements provider.DeploymentKeyManager.

func (*Provider) DeleteFile

func (p *Provider) DeleteFile(ctx context.Context, owner, repo string, opts provider.FileDeleteOptions) (*provider.FileResult, error)

DeleteFile implements provider.FileManager.

func (*Provider) DeleteLabel

func (p *Provider) DeleteLabel(ctx context.Context, owner, repo, name string) error

DeleteLabel implements provider.LabelManager.

func (*Provider) DeleteMilestone

func (p *Provider) DeleteMilestone(ctx context.Context, owner, repo, number string) error

DeleteMilestone implements provider.MilestoneManager.

func (*Provider) DeleteNote

func (p *Provider) DeleteNote(ctx context.Context, owner, repo, number, noteID string) error

DeleteNote implements provider.DiffManager. The note itself is addressed by its numeric platform ID; the change-request number is only validated, as Forgejo's delete-comment endpoint does not take it.

func (*Provider) DeleteRelease

func (p *Provider) DeleteRelease(ctx context.Context, owner, repo, tag string) error

DeleteRelease implements provider.ReleaseManager via Forgejo's tag-addressed delete (the SDK version-gates itself against the server). The release's tag is kept.

func (*Provider) DeleteRepo

func (p *Provider) DeleteRepo(ctx context.Context, owner, repo string) error

DeleteRepo implements provider.RepoManager.

func (*Provider) DeleteWebhook

func (p *Provider) DeleteWebhook(ctx context.Context, owner, repo string, webhookID int64) error

DeleteWebhook implements provider.WebhookManager.

func (*Provider) DismissReview

func (p *Provider) DismissReview(ctx context.Context, owner, repo, number string, reviewID int64, message string) error

DismissReview implements provider.ReviewManager via DismissPullReview (POST .../reviews/{id}/dismissals with the dismissal message).

func (*Provider) Divergences

func (p *Provider) Divergences() []provider.Divergence

Divergences implements provider.Provider.

func (*Provider) ForkRepo

func (p *Provider) ForkRepo(ctx context.Context, owner, repo string, opts provider.ForkRepoOptions) (*provider.PlatformRepo, error)

ForkRepo implements provider.RepoManager.

func (*Provider) GetArchive

func (p *Provider) GetArchive(ctx context.Context, owner, repo, ref, format string) ([]byte, error)

GetArchive implements provider.ReleaseManager.

func (*Provider) GetBranchProtection

func (p *Provider) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*provider.BranchProtection, error)

GetBranchProtection implements provider.BranchProtectionManager.

func (*Provider) GetCR

func (p *Provider) GetCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)

GetCR implements provider.ChangeRequestManager.

func (*Provider) GetCRDiff

func (p *Provider) GetCRDiff(ctx context.Context, owner, repo, number string) (*provider.MergeDiff, error)

GetCRDiff implements provider.DiffManager.

func (*Provider) GetCRFiles

func (p *Provider) GetCRFiles(ctx context.Context, owner, repo, number string) ([]*provider.ChangedFile, error)

GetCRFiles implements provider.DiffManager.

func (*Provider) GetCommit

func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*provider.CommitInfo, error)

GetCommit implements provider.CommitManager.

func (*Provider) GetFileContent

func (p *Provider) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)

GetFileContent implements provider.FileManager.

func (*Provider) GetIssue

func (p *Provider) GetIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)

GetIssue implements provider.IssueManager.

func (*Provider) GetMilestone

func (p *Provider) GetMilestone(ctx context.Context, owner, repo, number string) (*provider.Milestone, error)

GetMilestone implements provider.MilestoneManager.

func (*Provider) GetReleaseByTag

func (p *Provider) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*provider.ReleaseInfo, error)

GetReleaseByTag implements provider.ReleaseManager. Forgejo exposes a dedicated tag-addressed endpoint.

func (*Provider) GetRepo

func (p *Provider) GetRepo(ctx context.Context, owner, repo string) (*provider.PlatformRepo, error)

GetRepo implements provider.RepoManager.

func (*Provider) GetReview

func (p *Provider) GetReview(ctx context.Context, owner, repo, number string, reviewID int64) (*provider.Review, error)

GetReview implements provider.ReviewManager.

func (*Provider) ListBranchProtections

func (p *Provider) ListBranchProtections(ctx context.Context, owner, repo string) ([]*provider.BranchProtection, error)

ListBranchProtections implements provider.BranchProtectionManager. The provider surface carries no pagination parameters and the SDK's ListBranchProtectionsOptions embeds ListOptions, so the full list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListBranches

func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, error)

ListBranches implements provider.BranchManager. The provider surface carries no pagination parameters, so the full branch list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListCRCommentReactions

func (p *Provider) ListCRCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)

ListCRCommentReactions implements provider.ReactionManager.

func (*Provider) ListCRComments

func (p *Provider) ListCRComments(ctx context.Context, owner, repo, number string) ([]*provider.CRComment, error)

ListCRComments implements provider.ChangeRequestManager. The provider surface carries no pagination parameters, so the full comment list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListCRCommits

func (p *Provider) ListCRCommits(ctx context.Context, owner, repo, number string) ([]*provider.CRCommit, error)

ListCRCommits implements provider.ChangeRequestManager. The provider surface carries no pagination parameters, so the full commit list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListCRReactions

func (p *Provider) ListCRReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)

ListCRReactions implements provider.ReactionManager. Forgejo does not have a dedicated PR-level reaction API; PR reactions are the same as issue reactions, but the SDK exposes them separately for consistency. This returns "not supported" for now.

func (*Provider) ListCRs

ListCRs implements provider.ChangeRequestManager.

func (*Provider) ListCollaborators

func (p *Provider) ListCollaborators(ctx context.Context, owner, repo string) ([]*provider.Collaborator, error)

ListCollaborators implements provider.CollaboratorManager. The provider surface carries no pagination parameters, so the full collaborator list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListCommitStatuses

func (p *Provider) ListCommitStatuses(ctx context.Context, owner, repo, sha string) ([]provider.CommitStatus, error)

ListCommitStatuses implements provider.CommitStatusManager.

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused here beyond signature conformance.

func (*Provider) ListCommits

func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*provider.CommitInfo, error)

ListCommits implements provider.CommitManager.

Dual-mode pagination: with opts.Page == 0 the full commit history is fetched by exhausting the endpoint's pagination (backendutil.AllPages); with opts.Page > 0 exactly one caller-driven page is fetched (the caller pages itself through NormalizePageOpts-normalized values).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListContributors

func (p *Provider) ListContributors(_ context.Context, _, _ string) ([]*provider.Contributor, error)

ListContributors implements provider.RepoStatsManager.

Forgejo does not expose a contributors list endpoint; this method always returns ErrNotImplemented.

func (*Provider) ListDeployKeys

func (p *Provider) ListDeployKeys(ctx context.Context, owner, repo string) ([]*provider.DeployKey, error)

ListDeployKeys implements provider.DeploymentKeyManager. The provider surface carries no pagination parameters, so the full key list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListForks

func (p *Provider) ListForks(ctx context.Context, owner, repo string) ([]*provider.PlatformRepo, error)

ListForks implements provider.RepoStatsManager. The provider surface carries no pagination parameters, so the full fork list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListIssueCommentReactions

func (p *Provider) ListIssueCommentReactions(ctx context.Context, owner, repo string, commentID int64) ([]*provider.Reaction, error)

ListIssueCommentReactions implements provider.ReactionManager. The forgejo SDK's GetIssueCommentReactions exposes no pagination parameters (the endpoint is served unpaginated through the SDK), so there is no page to advance and the single response is returned as-is.

func (*Provider) ListIssueComments

func (p *Provider) ListIssueComments(ctx context.Context, owner, repo, number string) ([]*provider.IssueComment, error)

ListIssueComments implements provider.IssueManager.

func (*Provider) ListIssueLabels

func (p *Provider) ListIssueLabels(ctx context.Context, owner, repo string) ([]*provider.IssueLabel, error)

ListIssueLabels implements provider.IssueManager: repository-level labels, exhausting pagination (the loop advances until an empty page).

func (*Provider) ListIssueReactions

func (p *Provider) ListIssueReactions(ctx context.Context, owner, repo, number string) ([]*provider.Reaction, error)

ListIssueReactions implements provider.ReactionManager. The forgejo SDK's GetIssueReactions exposes no pagination parameters (the endpoint is served unpaginated through the SDK), so there is no page to advance and the single response is returned as-is.

func (*Provider) ListIssues

func (p *Provider) ListIssues(ctx context.Context, opts provider.ListIssuesOptions) ([]*provider.Issue, int, error)

ListIssues implements provider.IssueManager. The forgejo SDK accepts no context (same as its other services).

Dual-mode pagination: with opts.Page == 0 the full issue list is fetched by exhausting the endpoint's pagination (backendutil.AllPages); with opts.Page > 0 exactly one caller-driven page is fetched (the caller pages itself through NormalizePageOpts-normalized values).

func (*Provider) ListLabels

func (p *Provider) ListLabels(ctx context.Context, owner, repo string, opts provider.ListLabelsOptions) ([]*provider.Label, error)

ListLabels implements provider.LabelManager.

func (*Provider) ListMilestones

func (p *Provider) ListMilestones(ctx context.Context, owner, repo string, opts provider.ListMilestonesOptions) ([]provider.Milestone, error)

ListMilestones implements provider.MilestoneManager. State filters by "open"/"closed" (forgejo also accepts "all"); forgejo defaults to open.

Dual-mode pagination: with opts.Page == 0 the full milestone list is fetched by exhausting the endpoint's pagination (backendutil.AllPages); with opts.Page > 0 exactly one caller-driven page is fetched (the caller pages itself through NormalizePageOpts-normalized values).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListNotifications

func (p *Provider) ListNotifications(ctx context.Context, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)

ListNotifications implements provider.NotificationManager.

Dual-mode pagination: with opts.Page == 0 the full notification list is fetched by exhausting the endpoint's pagination (backendutil.AllPages); with opts.Page > 0 exactly one caller-driven page is fetched (the caller pages itself through NormalizePageOpts-normalized values).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListReleases

func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*provider.ReleaseInfo, error)

ListReleases implements provider.ReleaseManager. The provider surface carries no pagination parameters, so the full release list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListRepoNotifications

func (p *Provider) ListRepoNotifications(ctx context.Context, owner, repo string, opts provider.ListNotificationsOptions) ([]*provider.Notification, error)

ListRepoNotifications implements provider.NotificationManager.

Dual-mode pagination: with opts.Page == 0 the full notification list is fetched by exhausting the endpoint's pagination (backendutil.AllPages); with opts.Page > 0 exactly one caller-driven page is fetched (the caller pages itself through NormalizePageOpts-normalized values).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListRepos

ListRepos implements provider.RepoManager.

func (*Provider) ListReviews

func (p *Provider) ListReviews(ctx context.Context, owner, repo, number string) ([]provider.Review, error)

ListReviews implements provider.ReviewManager. The provider surface carries no pagination parameters, so the full review list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListStargazers

func (p *Provider) ListStargazers(ctx context.Context, owner, repo string) ([]*provider.CRUser, error)

ListStargazers implements provider.RepoStatsManager. The provider surface carries no pagination parameters, so the full stargazer list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListTags

func (p *Provider) ListTags(ctx context.Context, owner, repo string) ([]*provider.TagInfo, error)

ListTags implements provider.ReleaseManager. The provider surface carries no pagination parameters, so the full tag list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) ListWebhooks

func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*provider.PlatformWebhook, error)

ListWebhooks implements provider.WebhookManager. The provider surface carries no pagination parameters, so the full hook list is fetched by exhausting the endpoint's pagination (backendutil.AllPages).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) MarkNotificationRead

func (p *Provider) MarkNotificationRead(ctx context.Context, threadID string) error

MarkNotificationRead implements provider.NotificationManager.

func (*Provider) MarkNotificationsRead

func (p *Provider) MarkNotificationsRead(ctx context.Context, opts provider.MarkNotificationsOptions) error

MarkNotificationsRead implements provider.NotificationManager.

func (*Provider) MarkRepoNotificationsRead

func (p *Provider) MarkRepoNotificationsRead(ctx context.Context, owner, repo string, opts provider.MarkNotificationsOptions) error

MarkRepoNotificationsRead implements provider.NotificationManager.

func (*Provider) MergeCR

func (p *Provider) MergeCR(ctx context.Context, owner, repo, number string, opts provider.MergeCROptions) (*provider.ChangeRequest, error)

MergeCR implements provider.ChangeRequestManager.

func (*Provider) ParseWebhookEvent

func (p *Provider) ParseWebhookEvent(r *http.Request, secret string) (*provider.NormalizedEvent, error)

ParseWebhookEvent implements provider.WebhookManager.

func (*Provider) Platform

func (p *Provider) Platform() provider.Platform

Platform implements provider.Provider.

func (*Provider) RemoveCRCommentReaction

func (p *Provider) RemoveCRCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error

RemoveCRCommentReaction implements provider.ReactionManager.

func (*Provider) RemoveCollaborator

func (p *Provider) RemoveCollaborator(ctx context.Context, owner, repo, username string) error

RemoveCollaborator implements provider.CollaboratorManager.

func (*Provider) RemoveIssueCommentReaction

func (p *Provider) RemoveIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) error

RemoveIssueCommentReaction implements provider.ReactionManager.

KNOWN N+1 COST: Same trade-off as RemoveIssueReaction — Forgejo reactions lack their own ID, so reactionID is the user's User.ID and we must list all comment reactions to find the content string for deletion.

func (*Provider) RemoveIssueLabel

func (p *Provider) RemoveIssueLabel(ctx context.Context, owner, repo, number, name string) error

RemoveIssueLabel implements provider.IssueManager.

func (*Provider) RemoveIssueReaction

func (p *Provider) RemoveIssueReaction(ctx context.Context, owner, repo, number string, reactionID int64) error

RemoveIssueReaction implements provider.ReactionManager.

KNOWN N+1 COST: Forgejo reactions do not have their own ID; the reactionID parameter is actually the reacting user's User.ID (set in convertReaction). Forgejo's DeleteIssueReaction API only accepts the reaction content string (emoji), not an ID, so we must GetIssueReactions to find the matching user's reaction content first. This is an O(reactions) scan per call and cannot be avoided given Forgejo's API design.

func (*Provider) ReopenCR

func (p *Provider) ReopenCR(ctx context.Context, owner, repo, number string) (*provider.ChangeRequest, error)

ReopenCR implements provider.ChangeRequestManager.

func (*Provider) ReopenIssue

func (p *Provider) ReopenIssue(ctx context.Context, owner, repo, number string) (*provider.Issue, error)

ReopenIssue implements provider.IssueManager.

func (*Provider) RequestReviewers

func (p *Provider) RequestReviewers(ctx context.Context, owner, repo, number string, reviewers []string) error

RequestReviewers implements provider.ReviewManager via CreateReviewRequests, which posts the reviewer logins under the same "reviewers" wire key as GitHub.

func (*Provider) SearchIssues

SearchIssues implements provider.SearchManager. Repo routes to the server-side repo-scoped listing (ListRepoIssues); without it the global keyword search runs.

Dual-mode pagination: with opts.Page == 0 the full result set is fetched by exhausting the endpoint's pagination (backendutil.AllPages); with opts.Page > 0 exactly one caller-driven page is fetched (the caller pages itself through NormalizePageOpts-normalized values).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) SearchRepos

SearchRepos implements provider.SearchManager.

Dual-mode pagination: with opts.Page == 0 the full result set is fetched by exhausting the endpoint's pagination (backendutil.AllPages); with opts.Page > 0 exactly one caller-driven page is fetched (the caller pages itself through NormalizePageOpts-normalized values).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) SearchUsers

SearchUsers implements provider.SearchManager.

Dual-mode pagination: with opts.Page == 0 the full result set is fetched by exhausting the endpoint's pagination (backendutil.AllPages); with opts.Page > 0 exactly one caller-driven page is fetched (the caller pages itself through NormalizePageOpts-normalized values).

The forgejo SDK accepts no context parameter (registered platform limitation), so ctx is unused beyond signature conformance.

func (*Provider) TestConnection

func (p *Provider) TestConnection(ctx context.Context) (*provider.TestConnectionResult, error)

TestConnection implements provider.Provider.

func (*Provider) UpdateBranchProtection

func (p *Provider) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, opts provider.UpdateBranchProtectionOptions) (*provider.BranchProtection, error)

UpdateBranchProtection implements provider.BranchProtectionManager.

func (*Provider) UpdateCR

func (p *Provider) UpdateCR(ctx context.Context, owner, repo, number string, opts provider.UpdateCROptions) (*provider.ChangeRequest, error)

UpdateCR implements provider.ChangeRequestManager.

func (*Provider) UpdateCRLabels

func (p *Provider) UpdateCRLabels(ctx context.Context, owner, repo, number string, labels []string) error

UpdateCRLabels implements provider.ChangeRequestManager.

func (*Provider) UpdateFile

func (p *Provider) UpdateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)

UpdateFile implements provider.FileManager.

func (*Provider) UpdateIssue

func (p *Provider) UpdateIssue(ctx context.Context, owner, repo, number string, opts provider.UpdateIssueOptions) (*provider.Issue, error)

UpdateIssue implements provider.IssueManager. Forgejo's EditIssueOption always serializes Title (no omitempty), so a caller leaving fields empty would clear them; the current title is backfilled via one GET, and an all-empty update short-circuits to a plain GetIssue. opts.Labels replaces the issue's labels via the dedicated endpoint.

func (*Provider) UpdateIssueComment

func (p *Provider) UpdateIssueComment(ctx context.Context, owner, repo, number string, commentID int64, body string) (*provider.IssueComment, error)

UpdateIssueComment implements provider.IssueManager. The edit endpoint addresses the comment directly, so number is unused; the SDK accepts no context (see the forgejo standing limitation). The platform only lets the comment's author perform the edit.

func (*Provider) UpdateLabel

func (p *Provider) UpdateLabel(ctx context.Context, owner, repo, name string, opts provider.UpdateLabelOptions) (*provider.Label, error)

UpdateLabel implements provider.LabelManager. Forgejo addresses labels by numeric ID, so the label is resolved by name first.

func (*Provider) UpdateMilestone

func (p *Provider) UpdateMilestone(ctx context.Context, owner, repo, number string, opts provider.UpdateMilestoneOptions) (*provider.Milestone, error)

UpdateMilestone implements provider.MilestoneManager. Nil fields in opts stay unset on the edit option: Description/State/Deadline marshal as JSON null and the server leaves them unchanged. Title is the SDK's only non-pointer edit field, so an update that does not rename sends an empty title — Forgejo's API keeps the existing title for blank values (a title is required to be non-empty, so blank cannot be a legitimate rename).

func (*Provider) UpdateRelease

func (p *Provider) UpdateRelease(ctx context.Context, owner, repo, tag string, opts provider.UpdateReleaseOptions) (*provider.ReleaseInfo, error)

UpdateRelease implements provider.ReleaseManager. The edit endpoint is id-addressed, so the tag is resolved through the by-tag endpoint first (exact lookup, no list window). EditReleaseOption's name/note fields are plain strings that would clobber the release when sent empty, so the current values from the resolution fetch backfill every option the caller left nil; draft/prerelease are pointers that pass through untouched.

func (*Provider) UpdateRepo

func (p *Provider) UpdateRepo(ctx context.Context, owner, repo string, opts provider.UpdateRepoOptions) (*provider.PlatformRepo, error)

UpdateRepo implements provider.RepoManager.

func (*Provider) ValidateWebhookSignature

func (p *Provider) ValidateWebhookSignature(r *http.Request, secret string) error

ValidateWebhookSignature implements provider.WebhookManager. Forgejo uses HMAC-SHA256 over the raw body, sent in the X-Forgejo-Signature header.

Jump to

Keyboard shortcuts

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