forgejostructs

package
v0.42.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package forgejostructs contains Gitea webhook payload types. These types are copied from code.gitea.io/gitea/modules/structs v1.25.3. to avoid importing the entire Gitea codebase and its massive dependency tree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	ID            int64     `json:"id"`
	Name          string    `json:"name"`
	Size          int64     `json:"size"`
	DownloadCount int64     `json:"download_count"`
	Created       time.Time `json:"created_at"`
	UUID          string    `json:"uuid"`
	DownloadURL   string    `json:"browser_download_url"`
}

Attachment a generic attachment.

type ChangesFromPayload

type ChangesFromPayload struct {
	From string `json:"from"`
}

ChangesFromPayload represents the previous value before a change.

type ChangesPayload

type ChangesPayload struct {
	Title         *ChangesFromPayload `json:"title,omitempty"`
	Body          *ChangesFromPayload `json:"body,omitempty"`
	Ref           *ChangesFromPayload `json:"ref,omitempty"`
	AddedLabels   []*Label            `json:"added_labels"`
	RemovedLabels []*Label            `json:"removed_labels"`
}

ChangesPayload represents the payload information of issue change.

type Comment

type Comment struct {
	ID               int64         `json:"id"`
	HTMLURL          string        `json:"html_url"`
	PRURL            string        `json:"pull_request_url"`
	IssueURL         string        `json:"issue_url"`
	Poster           *User         `json:"user"`
	OriginalAuthor   string        `json:"original_author"`
	OriginalAuthorID int64         `json:"original_author_id"`
	Body             string        `json:"body"`
	Attachments      []*Attachment `json:"assets"`
	Created          time.Time     `json:"created_at"`
	Updated          time.Time     `json:"updated_at"`
}

Comment represents a comment on a commit or issue.

type CreatePayload

type CreatePayload struct {
	Sha     string      `json:"sha"`
	Ref     string      `json:"ref"`
	RefType string      `json:"ref_type"`
	Repo    *Repository `json:"repository"`
	Sender  *User       `json:"sender"`
}

CreatePayload represents a payload information of create event.

type DeletePayload

type DeletePayload struct {
	Ref        string      `json:"ref"`
	RefType    string      `json:"ref_type"`
	PusherType PusherType  `json:"pusher_type"`
	Repo       *Repository `json:"repository"`
	Sender     *User       `json:"sender"`
}

DeletePayload represents delete payload.

type ExternalTracker

type ExternalTracker struct {
	ExternalTrackerURL           string `json:"external_tracker_url"`
	ExternalTrackerFormat        string `json:"external_tracker_format"`
	ExternalTrackerStyle         string `json:"external_tracker_style"`
	ExternalTrackerRegexpPattern string `json:"external_tracker_regexp_pattern"`
}

ExternalTracker represents settings for external tracker.

type ExternalWiki

type ExternalWiki struct {
	ExternalWikiURL string `json:"external_wiki_url"`
}

ExternalWiki represents setting for external wiki.

type ForkPayload

type ForkPayload struct {
	Forkee *Repository `json:"forkee"`
	Repo   *Repository `json:"repository"`
	Sender *User       `json:"sender"`
}

ForkPayload represents fork payload.

type HookIssueAction

type HookIssueAction string

HookIssueAction defines hook issue action.

const (
	HookIssueOpened               HookIssueAction = "opened"
	HookIssueClosed               HookIssueAction = "closed"
	HookIssueReOpened             HookIssueAction = "reopened"
	HookIssueEdited               HookIssueAction = "edited"
	HookIssueDeleted              HookIssueAction = "deleted"
	HookIssueAssigned             HookIssueAction = "assigned"
	HookIssueUnassigned           HookIssueAction = "unassigned"
	HookIssueLabelUpdated         HookIssueAction = "label_updated"
	HookIssueLabelCleared         HookIssueAction = "label_cleared"
	HookIssueSynchronized         HookIssueAction = "synchronized"
	HookIssueMilestoned           HookIssueAction = "milestoned"
	HookIssueDemilestoned         HookIssueAction = "demilestoned"
	HookIssueReviewed             HookIssueAction = "reviewed"
	HookIssueReviewRequested      HookIssueAction = "review_requested"
	HookIssueReviewRequestRemoved HookIssueAction = "review_request_removed"
)

type HookIssueCommentAction

type HookIssueCommentAction string

HookIssueCommentAction defines hook issue comment action.

const (
	HookIssueCommentCreated HookIssueCommentAction = "created"
	HookIssueCommentEdited  HookIssueCommentAction = "edited"
	HookIssueCommentDeleted HookIssueCommentAction = "deleted"
)

type HookReleaseAction

type HookReleaseAction string

HookReleaseAction defines hook release action type.

const (
	HookReleasePublished HookReleaseAction = "published"
	HookReleaseUpdated   HookReleaseAction = "updated"
	HookReleaseDeleted   HookReleaseAction = "deleted"
)

type HookRepoAction

type HookRepoAction string

HookRepoAction defines hook repository action type.

const (
	HookRepoCreated HookRepoAction = "created"
	HookRepoDeleted HookRepoAction = "deleted"
)

type InternalTracker

type InternalTracker struct {
	EnableTimeTracker                bool `json:"enable_time_tracker"`
	AllowOnlyContributorsToTrackTime bool `json:"allow_only_contributors_to_track_time"`
	EnableIssueDependencies          bool `json:"enable_issue_dependencies"`
}

InternalTracker represents settings for internal tracker.

type Issue

type Issue struct {
	ID               int64            `json:"id"`
	URL              string           `json:"url"`
	HTMLURL          string           `json:"html_url"`
	Index            int64            `json:"number"`
	Poster           *User            `json:"user"`
	OriginalAuthor   string           `json:"original_author"`
	OriginalAuthorID int64            `json:"original_author_id"`
	Title            string           `json:"title"`
	Body             string           `json:"body"`
	Ref              string           `json:"ref"`
	Attachments      []*Attachment    `json:"assets"`
	Labels           []*Label         `json:"labels"`
	Milestone        *Milestone       `json:"milestone"`
	Assignee         *User            `json:"assignee"`
	Assignees        []*User          `json:"assignees"`
	State            StateType        `json:"state"`
	IsLocked         bool             `json:"is_locked"`
	Comments         int              `json:"comments"`
	Created          time.Time        `json:"created_at"`
	Updated          time.Time        `json:"updated_at"`
	Closed           *time.Time       `json:"closed_at"`
	Deadline         *time.Time       `json:"due_date"`
	TimeEstimate     int64            `json:"time_estimate"`
	PullRequest      *PullRequestMeta `json:"pull_request"`
	Repo             *RepositoryMeta  `json:"repository"`
	PinOrder         int              `json:"pin_order"`
}

Issue represents an issue in a repository.

type IssueCommentPayload

type IssueCommentPayload struct {
	Action      HookIssueCommentAction `json:"action"`
	Issue       *Issue                 `json:"issue"`
	PullRequest *PullRequest           `json:"pull_request,omitempty"`
	Comment     *Comment               `json:"comment"`
	Changes     *ChangesPayload        `json:"changes,omitempty"`
	Repository  *Repository            `json:"repository"`
	Sender      *User                  `json:"sender"`
	IsPull      bool                   `json:"is_pull"`
}

IssueCommentPayload represents a payload information of issue comment event.

type IssuePayload

type IssuePayload struct {
	Action     HookIssueAction `json:"action"`
	Index      int64           `json:"number"`
	Changes    *ChangesPayload `json:"changes,omitempty"`
	Issue      *Issue          `json:"issue"`
	Repository *Repository     `json:"repository"`
	Sender     *User           `json:"sender"`
	CommitID   string          `json:"commit_id"`
}

IssuePayload represents the payload information that is sent along with an issue event.

type Label

type Label struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Exclusive   bool   `json:"exclusive"`
	IsArchived  bool   `json:"is_archived"`
	Color       string `json:"color"`
	Description string `json:"description"`
	URL         string `json:"url"`
}

Label a label to an issue or a pr.

type Milestone

type Milestone struct {
	ID           int64      `json:"id"`
	Title        string     `json:"title"`
	Description  string     `json:"description"`
	State        StateType  `json:"state"`
	OpenIssues   int        `json:"open_issues"`
	ClosedIssues int        `json:"closed_issues"`
	Created      time.Time  `json:"created_at"`
	Updated      *time.Time `json:"updated_at"`
	Closed       *time.Time `json:"closed_at"`
	Deadline     *time.Time `json:"due_on"`
}

Milestone milestone is a collection of issues on one repository.

type Organization

type Organization struct {
	ID                        int64  `json:"id"`
	Name                      string `json:"name"`
	FullName                  string `json:"full_name"`
	Email                     string `json:"email"`
	AvatarURL                 string `json:"avatar_url"`
	Description               string `json:"description"`
	Website                   string `json:"website"`
	Location                  string `json:"location"`
	Visibility                string `json:"visibility"`
	RepoAdminChangeTeamAccess bool   `json:"repo_admin_change_team_access"`
	UserName                  string `json:"username"`
}

Organization represents an organization.

type PRBranchInfo

type PRBranchInfo struct {
	Name       string      `json:"label"`
	Ref        string      `json:"ref"`
	Sha        string      `json:"sha"`
	RepoID     int64       `json:"repo_id"`
	Repository *Repository `json:"repo"`
}

PRBranchInfo information about a branch.

type PayloadCommit

type PayloadCommit struct {
	ID           string                     `json:"id"`
	Message      string                     `json:"message"`
	URL          string                     `json:"url"`
	Author       *PayloadUser               `json:"author"`
	Committer    *PayloadUser               `json:"committer"`
	Verification *PayloadCommitVerification `json:"verification"`
	Timestamp    time.Time                  `json:"timestamp"`
	Added        []string                   `json:"added"`
	Removed      []string                   `json:"removed"`
	Modified     []string                   `json:"modified"`
}

PayloadCommit represents a commit.

type PayloadCommitVerification

type PayloadCommitVerification struct {
	Verified  bool         `json:"verified"`
	Reason    string       `json:"reason"`
	Signature string       `json:"signature"`
	Signer    *PayloadUser `json:"signer"`
	Payload   string       `json:"payload"`
}

PayloadCommitVerification represents the GPG verification of a commit.

type PayloadUser

type PayloadUser struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	UserName string `json:"username"`
}

PayloadUser represents the author or committer of a commit.

type Permission

type Permission struct {
	Admin bool `json:"admin"`
	Push  bool `json:"push"`
	Pull  bool `json:"pull"`
}

Permission represents a set of permissions.

type PullRequest

type PullRequest struct {
	ID                      int64         `json:"id"`
	URL                     string        `json:"url"`
	Index                   int64         `json:"number"`
	Poster                  *User         `json:"user"`
	Title                   string        `json:"title"`
	Body                    string        `json:"body"`
	Labels                  []*Label      `json:"labels"`
	Milestone               *Milestone    `json:"milestone"`
	Assignee                *User         `json:"assignee"`
	Assignees               []*User       `json:"assignees"`
	RequestedReviewers      []*User       `json:"requested_reviewers"`
	RequestedReviewersTeams []*Team       `json:"requested_reviewers_teams"`
	State                   StateType     `json:"state"`
	Draft                   bool          `json:"draft"`
	IsLocked                bool          `json:"is_locked"`
	Comments                int           `json:"comments"`
	ReviewComments          int           `json:"review_comments,omitempty"`
	Additions               *int          `json:"additions,omitempty"`
	Deletions               *int          `json:"deletions,omitempty"`
	ChangedFiles            *int          `json:"changed_files,omitempty"`
	HTMLURL                 string        `json:"html_url"`
	DiffURL                 string        `json:"diff_url"`
	PatchURL                string        `json:"patch_url"`
	Mergeable               bool          `json:"mergeable"`
	HasMerged               bool          `json:"merged"`
	Merged                  *time.Time    `json:"merged_at"`
	MergedCommitID          *string       `json:"merge_commit_sha"`
	MergedBy                *User         `json:"merged_by"`
	AllowMaintainerEdit     bool          `json:"allow_maintainer_edit"`
	Base                    *PRBranchInfo `json:"base"`
	Head                    *PRBranchInfo `json:"head"`
	MergeBase               string        `json:"merge_base"`
	Deadline                *time.Time    `json:"due_date"`
	Created                 *time.Time    `json:"created_at"`
	Updated                 *time.Time    `json:"updated_at"`
	Closed                  *time.Time    `json:"closed_at"`
	PinOrder                int           `json:"pin_order"`
}

PullRequest represents a pull request.

type PullRequestMeta

type PullRequestMeta struct {
	HasMerged        bool       `json:"merged"`
	Merged           *time.Time `json:"merged_at"`
	IsWorkInProgress bool       `json:"draft"`
	HTMLURL          string     `json:"html_url"`
}

PullRequestMeta PR info if an issue is a PR.

type PullRequestPayload

type PullRequestPayload struct {
	Action            HookIssueAction `json:"action"`
	Index             int64           `json:"number"`
	Changes           *ChangesPayload `json:"changes,omitempty"`
	PullRequest       *PullRequest    `json:"pull_request"`
	RequestedReviewer *User           `json:"requested_reviewer"`
	Repository        *Repository     `json:"repository"`
	Sender            *User           `json:"sender"`
	CommitID          string          `json:"commit_id"`
	Review            *ReviewPayload  `json:"review"`
}

PullRequestPayload represents a payload information of pull request event.

type PushPayload

type PushPayload struct {
	Ref          string           `json:"ref"`
	Before       string           `json:"before"`
	After        string           `json:"after"`
	CompareURL   string           `json:"compare_url"`
	Commits      []*PayloadCommit `json:"commits"`
	TotalCommits int              `json:"total_commits"`
	HeadCommit   *PayloadCommit   `json:"head_commit"`
	Repo         *Repository      `json:"repository"`
	Pusher       *User            `json:"pusher"`
	Sender       *User            `json:"sender"`
}

PushPayload represents a payload information of push event.

type PusherType

type PusherType string

PusherType define the type to push.

const (
	PusherTypeUser PusherType = "user"
)

type Release

type Release struct {
	ID           int64         `json:"id"`
	TagName      string        `json:"tag_name"`
	Target       string        `json:"target_commitish"`
	Title        string        `json:"name"`
	Note         string        `json:"body"`
	URL          string        `json:"url"`
	HTMLURL      string        `json:"html_url"`
	TarURL       string        `json:"tarball_url"`
	ZipURL       string        `json:"zipball_url"`
	UploadURL    string        `json:"upload_url"`
	IsDraft      bool          `json:"draft"`
	IsPrerelease bool          `json:"prerelease"`
	CreatedAt    time.Time     `json:"created_at"`
	PublishedAt  time.Time     `json:"published_at"`
	Publisher    *User         `json:"author"`
	Attachments  []*Attachment `json:"assets"`
}

Release represents a repository release.

type ReleasePayload

type ReleasePayload struct {
	Action     HookReleaseAction `json:"action"`
	Release    *Release          `json:"release"`
	Repository *Repository       `json:"repository"`
	Sender     *User             `json:"sender"`
}

ReleasePayload represents a payload information of release event.

type RepoTransfer

type RepoTransfer struct {
	Doer      *User   `json:"doer"`
	Recipient *User   `json:"recipient"`
	Teams     []*Team `json:"teams"`
}

RepoTransfer represents a pending repo transfer.

type Repository

type Repository struct {
	ID                            int64            `json:"id"`
	Owner                         *User            `json:"owner"`
	Name                          string           `json:"name"`
	FullName                      string           `json:"full_name"`
	Description                   string           `json:"description"`
	Empty                         bool             `json:"empty"`
	Private                       bool             `json:"private"`
	Fork                          bool             `json:"fork"`
	Template                      bool             `json:"template"`
	Parent                        *Repository      `json:"parent,omitempty"`
	Mirror                        bool             `json:"mirror"`
	Size                          int              `json:"size"`
	Language                      string           `json:"language"`
	LanguagesURL                  string           `json:"languages_url"`
	HTMLURL                       string           `json:"html_url"`
	URL                           string           `json:"url"`
	Link                          string           `json:"link"`
	SSHURL                        string           `json:"ssh_url"`
	CloneURL                      string           `json:"clone_url"`
	OriginalURL                   string           `json:"original_url"`
	Website                       string           `json:"website"`
	Stars                         int              `json:"stars_count"`
	Forks                         int              `json:"forks_count"`
	Watchers                      int              `json:"watchers_count"`
	OpenIssues                    int              `json:"open_issues_count"`
	OpenPulls                     int              `json:"open_pr_counter"`
	Releases                      int              `json:"release_counter"`
	DefaultBranch                 string           `json:"default_branch"`
	Archived                      bool             `json:"archived"`
	Created                       time.Time        `json:"created_at"`
	Updated                       time.Time        `json:"updated_at"`
	ArchivedAt                    time.Time        `json:"archived_at"`
	Permissions                   *Permission      `json:"permissions,omitempty"`
	HasCode                       bool             `json:"has_code"`
	HasIssues                     bool             `json:"has_issues"`
	InternalTracker               *InternalTracker `json:"internal_tracker,omitempty"`
	ExternalTracker               *ExternalTracker `json:"external_tracker,omitempty"`
	HasWiki                       bool             `json:"has_wiki"`
	ExternalWiki                  *ExternalWiki    `json:"external_wiki,omitempty"`
	HasPullRequests               bool             `json:"has_pull_requests"`
	HasProjects                   bool             `json:"has_projects"`
	ProjectsMode                  string           `json:"projects_mode"`
	HasReleases                   bool             `json:"has_releases"`
	HasPackages                   bool             `json:"has_packages"`
	HasActions                    bool             `json:"has_actions"`
	IgnoreWhitespaceConflicts     bool             `json:"ignore_whitespace_conflicts"`
	AllowMerge                    bool             `json:"allow_merge_commits"`
	AllowRebase                   bool             `json:"allow_rebase"`
	AllowRebaseMerge              bool             `json:"allow_rebase_explicit"`
	AllowSquash                   bool             `json:"allow_squash_merge"`
	AllowFastForwardOnly          bool             `json:"allow_fast_forward_only_merge"`
	AllowRebaseUpdate             bool             `json:"allow_rebase_update"`
	AllowManualMerge              bool             `json:"allow_manual_merge"`
	AutodetectManualMerge         bool             `json:"autodetect_manual_merge"`
	DefaultDeleteBranchAfterMerge bool             `json:"default_delete_branch_after_merge"`
	DefaultMergeStyle             string           `json:"default_merge_style"`
	DefaultAllowMaintainerEdit    bool             `json:"default_allow_maintainer_edit"`
	AvatarURL                     string           `json:"avatar_url"`
	Internal                      bool             `json:"internal"`
	MirrorInterval                string           `json:"mirror_interval"`
	ObjectFormatName              string           `json:"object_format_name"`
	MirrorUpdated                 time.Time        `json:"mirror_updated"`
	RepoTransfer                  *RepoTransfer    `json:"repo_transfer,omitempty"`
	Topics                        []string         `json:"topics"`
	Licenses                      []string         `json:"licenses"`
}

Repository represents a repository.

type RepositoryMeta

type RepositoryMeta struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	Owner    string `json:"owner"`
	FullName string `json:"full_name"`
}

RepositoryMeta basic repository information.

type RepositoryPayload

type RepositoryPayload struct {
	Action       HookRepoAction `json:"action"`
	Repository   *Repository    `json:"repository"`
	Organization *User          `json:"organization"`
	Sender       *User          `json:"sender"`
}

RepositoryPayload payload for repository webhooks.

type ReviewPayload

type ReviewPayload struct {
	Type    string `json:"type"`
	Content string `json:"content"`
}

ReviewPayload represents review information.

type StateType

type StateType string

StateType issue state type.

const (
	StateOpen   StateType = "open"
	StateClosed StateType = "closed"
	StateAll    StateType = "all"
)

type Team

type Team struct {
	ID                      int64             `json:"id"`
	Name                    string            `json:"name"`
	Description             string            `json:"description"`
	Organization            *Organization     `json:"organization"`
	IncludesAllRepositories bool              `json:"includes_all_repositories"`
	Permission              string            `json:"permission"`
	Units                   []string          `json:"units"`
	UnitsMap                map[string]string `json:"units_map"`
	CanCreateOrgRepo        bool              `json:"can_create_org_repo"`
}

Team represents a team in an organization.

type User

type User struct {
	ID        int64  `json:"id"`
	UserName  string `json:"login"`
	LoginName string `json:"login_name"`
	SourceID  int64  `json:"source_id"`
	FullName  string `json:"full_name"`
	Email     string `json:"email"`
	AvatarURL string `json:"avatar_url"`
	HTMLURL   string `json:"html_url"`
	Language  string `json:"language"`
	IsAdmin   bool   `json:"is_admin"`
	// swagger:strfmt date-time.
	LastLogin time.Time `json:"last_login"`
	// swagger:strfmt date-time.
	Created       time.Time `json:"created"`
	Restricted    bool      `json:"restricted"`
	IsActive      bool      `json:"active"`
	ProhibitLogin bool      `json:"prohibit_login"`
	Location      string    `json:"location"`
	Website       string    `json:"website"`
	Description   string    `json:"description"`
	Visibility    string    `json:"visibility"`
	Followers     int       `json:"followers_count"`
	Following     int       `json:"following_count"`
	StarredRepos  int       `json:"starred_repos_count"`
}

User represents a user.

func (User) MarshalJSON

func (u User) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility.

func (*User) UnmarshalJSON

func (u *User) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler, reading the "username" field into UserName if "login" is empty.

Jump to

Keyboard shortcuts

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