package interfaces import ( "github.com/goccy/go-json" "net/url" "time" ) type URL struct { url.URL } func (u *URL) UnmarshalJSON(bytes []byte) error { var s string if err := json.Unmarshal(bytes, &s); err != nil { return err } parsedURL, err := url.Parse(s) if err != nil { return err } u.URL = *parsedURL return nil } type ForgejoIssueEvent struct { Action string `json:"action"` Number int `json:"number"` Repo ForgejoRepo `json:"repository"` Sender ForgejoUser `json:"sender"` Issue ForgejoIssue `json:"issue"` } type ForgejoPushEvent struct { Ref string `json:"ref"` Before string `json:"before"` After string `json:"after"` CompareURL URL `json:"compare_url"` Commits []ForgejoCommit `json:"commits"` TotalCommits int `json:"total_commits"` HeadCommit ForgejoCommit `json:"head_commit"` Repo ForgejoRepo `json:"repository"` Pusher ForgejoUser `json:"pusher"` Sender ForgejoUser `json:"sender"` } type ForgejoCommit struct { ID string `json:"id"` Message string `json:"message"` URL URL `json:"url"` Author ForgejoPartialUser `json:"author"` Committer ForgejoPartialUser `json:"committer"` Timestamp time.Time `json:"timestamp"` Added []string `json:"added"` Removed []string `json:"removed"` Modified []string `json:"modified"` } type ForgejoPartialUser struct { Name string `json:"name"` Email string `json:"email"` Username string `json:"username"` } type ForgejoUser struct { ID int `json:"id"` Login string `json:"login"` LoginName string `json:"login_name"` SourceID int `json:"source_id"` FullName string `json:"full_name"` Email string `json:"email"` AvatarURL URL `json:"avatar_url"` HtmlURL URL `json:"html_url"` Language string `json:"language"` IsAdmin bool `json:"is_admin"` LastLogin time.Time `json:"last_login"` Created time.Time `json:"created"` IsRestricted bool `json:"restricted"` IsActive bool `json:"active"` IsProhbitLogin bool `json:"prohbit_login"` Location string `json:"location"` Pronouns string `json:"pronouns"` Website string `json:"website"` Description string `json:"description"` Visibility string `json:"visibility"` FollowerCount int `json:"followers_count"` FollowingCount int `json:"following_count"` StarCount int `json:"starred_repos_count"` Username string `json:"username"` } type ForgejoPartialRepo struct { ID int `json:"id"` Name string `json:"name"` Owner string `json:"owner"` FullName string `json:"full_name"` } type ForgejoRepo struct { ID int `json:"id"` Owner ForgejoUser `json:"owner"` Name string `json:"name"` FullName string `json:"full_name"` Description string `json:"description"` IsEmpty bool `json:"empty"` IsPrivate bool `json:"private"` IsFork bool `json:"fork"` IsTemplate bool `json:"template"` IsMirror bool `json:"mirror"` Parent *ForgejoRepo `json:"parent"` Size int `json:"size"` Language string `json:"language"` LanguagesURL URL `json:"languages_url"` HtmlURL URL `json:"html_url"` URL URL `json:"url"` Link URL `json:"link"` SshURL string `json:"ssh_url"` CloneURL URL `json:"clone_url"` OriginalURL URL `json:"original_url"` Website URL `json:"website"` StarCount int `json:"stars_count"` ForkCount int `json:"forks_count"` WatcherCount int `json:"watchers_count"` OpenIssueCount int `json:"open_issues_count"` OpenPrCount int `json:"open_pr_counter"` ReleaseCount int `json:"release_counter"` DefaultBranch string `json:"default_branch"` IsArchived bool `json:"archived"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ArchivedAt time.Time `json:"archived_at"` Permissions map[string]bool `json:"permissions"` HasIssues bool `json:"has_issues"` InternalTracker ForgejoRepoInternalTracker `json:"internal_tracker"` HasWiki bool `json:"has_wiki"` WikiBranch string `json:"wiki_branch"` GloballyEditableWiki bool `json:"globally_editable_wiki"` HasPullRequests bool `json:"has_pull_requests"` HasProjects bool `json:"has_projects"` HasReleases bool `json:"has_releases"` HasPackages bool `json:"has_packages"` HasActions bool `json:"has_actions"` IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts"` AllowMergeCommits bool `json:"allow_merge_commits"` AllowRebase bool `json:"allow_rebase"` AllowExplicitRebase bool `json:"allow_rebase_explicit"` AllowSquashMerge bool `json:"allow_squash_merge"` AllowFastFowardOnlyMerge bool `json:"allow_fast_foward_only_merge"` AllowRebaseUpdate bool `json:"allow_rebase_update"` DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge"` DefaultMergeStyle string `json:"default_merge_style"` DefaultAllowMaintainerEdit bool `json:"default_allow_maintainer_edit"` AvatarURL URL `json:"avatar_url"` Internal bool `json:"internal"` MirrorInterval string `json:"mirror_interval"` ObjectFormatName string `json:"object_format_name"` MirrorUpdated time.Time `json:"mirror_updated"` } type ForgejoRepoInternalTracker struct { TimeTracker bool `json:"time_tracker"` AllowContribTrackTime bool `json:"allow_only_contributors_to_track_time"` EnableIssueDependency bool `json:"enable_issue_dependencies"` } type ForgejoIssue struct { ID int `json:"id"` URL URL `json:"url"` HtmlURL URL `json:"html_url"` Number int `json:"number"` User ForgejoUser `json:"user"` OriginalAuthor string `json:"original_author"` OriginalAuthorID int `json:"original_author_id"` Title string `json:"title"` Body string `json:"body"` Ref string `json:"ref"` Assets []string `json:"assets"` Labels []string `json:"labels"` State string `json:"state"` IsLocked bool `json:"is_locked"` Comments int `json:"comments"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ClosedAt time.Time `json:"closed_at"` DueDate time.Time `json:"due_date"` Repo ForgejoPartialRepo `json:"repository"` PinOrder int `json:"pin_order"` }