feat: initial commit of Git Automation CLI
- Add comprehensive Git workflow automation tools - Include branch management utilities - Add commit helpers with conventional commit support - Implement GitHub integration for PR management - Add configuration management system - Include comprehensive test coverage - Add professional documentation and examples
This commit is contained in:
305
internal/github/models.go
Normal file
305
internal/github/models.go
Normal file
@@ -0,0 +1,305 @@
|
||||
package github
|
||||
|
||||
import "time"
|
||||
|
||||
// User represents a GitHub user
|
||||
type User struct {
|
||||
Login string `json:"login"`
|
||||
ID int64 `json:"id"`
|
||||
NodeID string `json:"node_id"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
GravatarID string `json:"gravatar_id"`
|
||||
URL string `json:"url"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
FollowersURL string `json:"followers_url"`
|
||||
FollowingURL string `json:"following_url"`
|
||||
GistsURL string `json:"gists_url"`
|
||||
StarredURL string `json:"starred_url"`
|
||||
SubscriptionsURL string `json:"subscriptions_url"`
|
||||
OrganizationsURL string `json:"organizations_url"`
|
||||
ReposURL string `json:"repos_url"`
|
||||
EventsURL string `json:"events_url"`
|
||||
ReceivedEventsURL string `json:"received_events_url"`
|
||||
Type string `json:"type"`
|
||||
SiteAdmin bool `json:"site_admin"`
|
||||
Name string `json:"name"`
|
||||
Company string `json:"company"`
|
||||
Blog string `json:"blog"`
|
||||
Location string `json:"location"`
|
||||
Email string `json:"email"`
|
||||
Hireable bool `json:"hireable"`
|
||||
Bio string `json:"bio"`
|
||||
TwitterUsername string `json:"twitter_username"`
|
||||
PublicRepos int `json:"public_repos"`
|
||||
PublicGists int `json:"public_gists"`
|
||||
Followers int `json:"followers"`
|
||||
Following int `json:"following"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// Repository represents a GitHub repository
|
||||
type Repository struct {
|
||||
ID int64 `json:"id"`
|
||||
NodeID string `json:"node_id"`
|
||||
Name string `json:"name"`
|
||||
FullName string `json:"full_name"`
|
||||
Private bool `json:"private"`
|
||||
Owner User `json:"owner"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
Description string `json:"description"`
|
||||
Fork bool `json:"fork"`
|
||||
URL string `json:"url"`
|
||||
ForksURL string `json:"forks_url"`
|
||||
KeysURL string `json:"keys_url"`
|
||||
CollaboratorsURL string `json:"collaborators_url"`
|
||||
TeamsURL string `json:"teams_url"`
|
||||
HooksURL string `json:"hooks_url"`
|
||||
IssueEventsURL string `json:"issue_events_url"`
|
||||
EventsURL string `json:"events_url"`
|
||||
AssigneesURL string `json:"assignees_url"`
|
||||
BranchesURL string `json:"branches_url"`
|
||||
TagsURL string `json:"tags_url"`
|
||||
BlobsURL string `json:"blobs_url"`
|
||||
GitTagsURL string `json:"git_tags_url"`
|
||||
GitRefsURL string `json:"git_refs_url"`
|
||||
TreesURL string `json:"trees_url"`
|
||||
StatusesURL string `json:"statuses_url"`
|
||||
LanguagesURL string `json:"languages_url"`
|
||||
StargazersURL string `json:"stargazers_url"`
|
||||
ContributorsURL string `json:"contributors_url"`
|
||||
SubscribersURL string `json:"subscribers_url"`
|
||||
SubscriptionURL string `json:"subscription_url"`
|
||||
CommitsURL string `json:"commits_url"`
|
||||
GitCommitsURL string `json:"git_commits_url"`
|
||||
CommentsURL string `json:"comments_url"`
|
||||
IssueCommentURL string `json:"issue_comment_url"`
|
||||
ContentsURL string `json:"contents_url"`
|
||||
CompareURL string `json:"compare_url"`
|
||||
MergesURL string `json:"merges_url"`
|
||||
ArchiveURL string `json:"archive_url"`
|
||||
DownloadsURL string `json:"downloads_url"`
|
||||
IssuesURL string `json:"issues_url"`
|
||||
PullsURL string `json:"pulls_url"`
|
||||
MilestonesURL string `json:"milestones_url"`
|
||||
NotificationsURL string `json:"notifications_url"`
|
||||
LabelsURL string `json:"labels_url"`
|
||||
ReleasesURL string `json:"releases_url"`
|
||||
DeploymentsURL string `json:"deployments_url"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
PushedAt time.Time `json:"pushed_at"`
|
||||
GitURL string `json:"git_url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
CloneURL string `json:"clone_url"`
|
||||
SVNURL string `json:"svn_url"`
|
||||
Homepage string `json:"homepage"`
|
||||
Size int `json:"size"`
|
||||
StargazersCount int `json:"stargazers_count"`
|
||||
WatchersCount int `json:"watchers_count"`
|
||||
Language string `json:"language"`
|
||||
HasIssues bool `json:"has_issues"`
|
||||
HasProjects bool `json:"has_projects"`
|
||||
HasWiki bool `json:"has_wiki"`
|
||||
HasPages bool `json:"has_pages"`
|
||||
HasDownloads bool `json:"has_downloads"`
|
||||
Archived bool `json:"archived"`
|
||||
Disabled bool `json:"disabled"`
|
||||
OpenIssuesCount int `json:"open_issues_count"`
|
||||
License struct {
|
||||
Key string `json:"key"`
|
||||
Name string `json:"name"`
|
||||
SPDXID string `json:"spdx_id"`
|
||||
URL string `json:"url"`
|
||||
NodeID string `json:"node_id"`
|
||||
} `json:"license"`
|
||||
ForksCount int `json:"forks_count"`
|
||||
OpenIssues int `json:"open_issues"`
|
||||
Watchers int `json:"watchers"`
|
||||
DefaultBranch string `json:"default_branch"`
|
||||
Permissions struct {
|
||||
Admin bool `json:"admin"`
|
||||
Push bool `json:"push"`
|
||||
Pull bool `json:"pull"`
|
||||
} `json:"permissions"`
|
||||
AllowRebaseMerge bool `json:"allow_rebase_merge"`
|
||||
TempCloneToken string `json:"temp_clone_token"`
|
||||
AllowSquashMerge bool `json:"allow_squash_merge"`
|
||||
AllowMergeCommit bool `json:"allow_merge_commit"`
|
||||
Deleted bool `json:"deleted"`
|
||||
AutoInit bool `json:"auto_init"`
|
||||
IsTemplate bool `json:"is_template"`
|
||||
}
|
||||
|
||||
// PullRequest represents a GitHub pull request
|
||||
type PullRequest struct {
|
||||
ID int64 `json:"id"`
|
||||
NodeID string `json:"node_id"`
|
||||
Number int `json:"number"`
|
||||
State string `json:"state"`
|
||||
Locked bool `json:"locked"`
|
||||
Title string `json:"title"`
|
||||
User User `json:"user"`
|
||||
Body string `json:"body"`
|
||||
Labels []Label `json:"labels"`
|
||||
Milestone *Milestone `json:"milestone"`
|
||||
ActiveLockReason string `json:"active_lock_reason"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ClosedAt *time.Time `json:"closed_at"`
|
||||
MergedAt *time.Time `json:"merged_at"`
|
||||
MergeCommitSha string `json:"merge_commit_sha"`
|
||||
Assignee *User `json:"assignee"`
|
||||
Assignees []User `json:"assignees"`
|
||||
RequestedReviewers []User `json:"requested_reviewers"`
|
||||
RequestedTeams []Team `json:"requested_teams"`
|
||||
Head PRBranchRef `json:"head"`
|
||||
Base PRBranchRef `json:"base"`
|
||||
AuthorAssociation string `json:"author_association"`
|
||||
Draft bool `json:"draft"`
|
||||
CommitsURL string `json:"commits_url"`
|
||||
ReviewCommentsURL string `json:"review_comments_url"`
|
||||
IssueCommentURL string `json:"issue_comment_url"`
|
||||
CommentsURL string `json:"comments_url"`
|
||||
StatusesURL string `json:"statuses_url"`
|
||||
Merged bool `json:"merged"`
|
||||
Mergeable bool `json:"mergeable"`
|
||||
Rebaseable bool `json:"rebaseable"`
|
||||
MergeableState string `json:"mergeable_state"`
|
||||
MergedBy *User `json:"merged_by"`
|
||||
Comments int `json:"comments"`
|
||||
ReviewComments int `json:"review_comments"`
|
||||
MaintainerCanModify bool `json:"maintainer_can_modify"`
|
||||
Commits int `json:"commits"`
|
||||
Additions int `json:"additions"`
|
||||
Deletions int `json:"deletions"`
|
||||
ChangedFiles int `json:"changed_files"`
|
||||
URL string `json:"url"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
IssueURL string `json:"issue_url"`
|
||||
}
|
||||
|
||||
// PRBranchRef represents a head or base reference in a pull request
|
||||
type PRBranchRef struct {
|
||||
Label string `json:"label"`
|
||||
Ref string `json:"ref"`
|
||||
SHA string `json:"sha"`
|
||||
User User `json:"user"`
|
||||
Repo *Repository `json:"repo"`
|
||||
}
|
||||
|
||||
// PullRequestRequest represents a request to create or update a pull request
|
||||
type PullRequestRequest struct {
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
Head string `json:"head"`
|
||||
Base string `json:"base"`
|
||||
Draft bool `json:"draft,omitempty"`
|
||||
}
|
||||
|
||||
// MergePullRequestRequest represents a request to merge a pull request
|
||||
type MergePullRequestRequest struct {
|
||||
CommitMessage string `json:"commit_message,omitempty"`
|
||||
SHA string `json:"sha,omitempty"`
|
||||
MergeMethod string `json:"merge_method,omitempty"`
|
||||
}
|
||||
|
||||
// MergePullRequestResponse represents the response from merging a pull request
|
||||
type MergePullRequestResponse struct {
|
||||
SHA string `json:"sha"`
|
||||
Merged bool `json:"merged"`
|
||||
Message string `json:"message"`
|
||||
Author *User `json:"author,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Issue represents a GitHub issue
|
||||
type Issue struct {
|
||||
ID int64 `json:"id"`
|
||||
NodeID string `json:"node_id"`
|
||||
URL string `json:"url"`
|
||||
RepositoryURL string `json:"repository_url"`
|
||||
LabelsURL string `json:"labels_url"`
|
||||
CommentsURL string `json:"comments_url"`
|
||||
EventsURL string `json:"events_url"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
Number int `json:"number"`
|
||||
State string `json:"state"`
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
User User `json:"user"`
|
||||
Labels []Label `json:"labels"`
|
||||
Assignee *User `json:"assignee"`
|
||||
Assignees []User `json:"assignees"`
|
||||
Milestone *Milestone `json:"milestone"`
|
||||
Locked bool `json:"locked"`
|
||||
ActiveLockReason string `json:"active_lock_reason"`
|
||||
Comments int `json:"comments"`
|
||||
PullRequest *struct {
|
||||
URL string `json:"url"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
DiffURL string `json:"diff_url"`
|
||||
PatchURL string `json:"patch_url"`
|
||||
} `json:"pull_request"`
|
||||
ClosedAt *time.Time `json:"closed_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ClosedBy *User `json:"closed_by"`
|
||||
AuthorAssociation string `json:"author_association"`
|
||||
}
|
||||
|
||||
// IssueRequest represents a request to create an issue
|
||||
type IssueRequest struct {
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
Assignees []string `json:"assignees,omitempty"`
|
||||
Labels []string `json:"labels,omitempty"`
|
||||
Milestone int `json:"milestone,omitempty"`
|
||||
}
|
||||
|
||||
// Label represents a GitHub label
|
||||
type Label struct {
|
||||
ID int64 `json:"id"`
|
||||
NodeID string `json:"node_id"`
|
||||
URL string `json:"url"`
|
||||
Name string `json:"name"`
|
||||
Color string `json:"color"`
|
||||
Default bool `json:"default"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// Milestone represents a GitHub milestone
|
||||
type Milestone struct {
|
||||
URL string `json:"url"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
LabelsURL string `json:"labels_url"`
|
||||
ID int64 `json:"id"`
|
||||
NodeID string `json:"node_id"`
|
||||
Number int `json:"number"`
|
||||
State string `json:"state"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Creator User `json:"creator"`
|
||||
OpenIssues int `json:"open_issues"`
|
||||
ClosedIssues int `json:"closed_issues"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ClosedAt *time.Time `json:"closed_at"`
|
||||
DueOn *time.Time `json:"due_on"`
|
||||
}
|
||||
|
||||
// Team represents a GitHub team
|
||||
type Team struct {
|
||||
ID int64 `json:"id"`
|
||||
NodeID string `json:"node_id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
Privacy string `json:"privacy"`
|
||||
URL string `json:"url"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
MembersURL string `json:"members_url"`
|
||||
RepositoriesURL string `json:"repositories_url"`
|
||||
Permission string `json:"permission"`
|
||||
Parent *Team `json:"parent"`
|
||||
}
|
Reference in New Issue
Block a user