Unverified Commit 930f8257 authored by Sander van Harmelen's avatar Sander van Harmelen Committed by GitHub

Merge pull request #666 from alexkalderimis/add-head-pipeline

Add new pipeline fields
parents 34a5cacb 642cbc29
...@@ -34,74 +34,43 @@ type MergeRequestsService struct { ...@@ -34,74 +34,43 @@ type MergeRequestsService struct {
// //
// GitLab API docs: https://docs.gitlab.com/ce/api/merge_requests.html // GitLab API docs: https://docs.gitlab.com/ce/api/merge_requests.html
type MergeRequest struct { type MergeRequest struct {
ID int `json:"id"` ID int `json:"id"`
IID int `json:"iid"` IID int `json:"iid"`
TargetBranch string `json:"target_branch"` TargetBranch string `json:"target_branch"`
SourceBranch string `json:"source_branch"` SourceBranch string `json:"source_branch"`
ProjectID int `json:"project_id"` ProjectID int `json:"project_id"`
Title string `json:"title"` Title string `json:"title"`
State string `json:"state"` State string `json:"state"`
CreatedAt *time.Time `json:"created_at"` CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"` UpdatedAt *time.Time `json:"updated_at"`
Upvotes int `json:"upvotes"` Upvotes int `json:"upvotes"`
Downvotes int `json:"downvotes"` Downvotes int `json:"downvotes"`
Author struct { Author *MergeRequestUser `json:"author"`
ID int `json:"id"` Assignee *MergeRequestUser `json:"assignee"`
Username string `json:"username"` Assignees []*MergeRequestUser `json:"assignees"`
Name string `json:"name"` SourceProjectID int `json:"source_project_id"`
State string `json:"state"` TargetProjectID int `json:"target_project_id"`
CreatedAt *time.Time `json:"created_at"` Labels []string `json:"labels"`
AvatarURL string `json:"avatar_url"` Description string `json:"description"`
WebURL string `json:"web_url"` WorkInProgress bool `json:"work_in_progress"`
} `json:"author"` Milestone *Milestone `json:"milestone"`
Assignee struct { MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
ID int `json:"id"` MergeStatus string `json:"merge_status"`
Username string `json:"username"` MergeError string `json:"merge_error"`
Name string `json:"name"` MergedBy *MergeRequestUser `json:"merged_by"`
State string `json:"state"` MergedAt *time.Time `json:"merged_at"`
CreatedAt *time.Time `json:"created_at"` ClosedBy *MergeRequestUser `json:"closed_by"`
AvatarURL string `json:"avatar_url"` ClosedAt *time.Time `json:"closed_at"`
WebURL string `json:"web_url"` Subscribed bool `json:"subscribed"`
} `json:"assignee"` SHA string `json:"sha"`
SourceProjectID int `json:"source_project_id"` MergeCommitSHA string `json:"merge_commit_sha"`
TargetProjectID int `json:"target_project_id"` UserNotesCount int `json:"user_notes_count"`
Labels []string `json:"labels"` ChangesCount string `json:"changes_count"`
Description string `json:"description"` ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
WorkInProgress bool `json:"work_in_progress"` ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
Milestone *Milestone `json:"milestone"` WebURL string `json:"web_url"`
MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"` DiscussionLocked bool `json:"discussion_locked"`
MergeStatus string `json:"merge_status"` Changes []struct {
MergeError string `json:"merge_error"`
MergedBy struct {
ID int `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
State string `json:"state"`
CreatedAt *time.Time `json:"created_at"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
} `json:"merged_by"`
MergedAt *time.Time `json:"merged_at"`
ClosedBy struct {
ID int `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
State string `json:"state"`
CreatedAt *time.Time `json:"created_at"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
} `json:"closed_by"`
ClosedAt *time.Time `json:"closed_at"`
Subscribed bool `json:"subscribed"`
SHA string `json:"sha"`
MergeCommitSHA string `json:"merge_commit_sha"`
UserNotesCount int `json:"user_notes_count"`
ChangesCount string `json:"changes_count"`
ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
WebURL string `json:"web_url"`
DiscussionLocked bool `json:"discussion_locked"`
Changes []struct {
OldPath string `json:"old_path"` OldPath string `json:"old_path"`
NewPath string `json:"new_path"` NewPath string `json:"new_path"`
AMode string `json:"a_mode"` AMode string `json:"a_mode"`
...@@ -111,22 +80,32 @@ type MergeRequest struct { ...@@ -111,22 +80,32 @@ type MergeRequest struct {
RenamedFile bool `json:"renamed_file"` RenamedFile bool `json:"renamed_file"`
DeletedFile bool `json:"deleted_file"` DeletedFile bool `json:"deleted_file"`
} `json:"changes"` } `json:"changes"`
TimeStats *TimeStats `json:"time_stats"` TimeStats *TimeStats `json:"time_stats"`
Squash bool `json:"squash"` Squash bool `json:"squash"`
Pipeline struct { Pipeline *PipelineInfo `json:"pipeline"`
ID int `json:"id"` HeadPipeline *Pipeline `json:"head_pipeline"`
Ref string `json:"ref"` DiffRefs struct {
SHA string `json:"sha"`
Status string `json:"status"`
} `json:"pipeline"`
DiffRefs struct {
BaseSha string `json:"base_sha"` BaseSha string `json:"base_sha"`
HeadSha string `json:"head_sha"` HeadSha string `json:"head_sha"`
StartSha string `json:"start_sha"` StartSha string `json:"start_sha"`
} `json:"diff_refs"` } `json:"diff_refs"`
DivergedCommitsCount int `json:"diverged_commits_count"` DivergedCommitsCount int `json:"diverged_commits_count"`
RebaseInProgress bool `json:"rebase_in_progress"` RebaseInProgress bool `json:"rebase_in_progress"`
ApprovalsBeforeMerge int `json:"approvals_before_merge"` ApprovalsBeforeMerge int `json:"approvals_before_merge"`
Reference string `json:"reference"`
}
// MergeRequestUser represents a GitLab User record within a MergeRequest
//
// GitLab API docs: https://docs.gitlab.com/ce/api/merge_requests.html
type MergeRequestUser struct {
ID int `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
State string `json:"state"`
CreatedAt *time.Time `json:"created_at"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
} }
func (m MergeRequest) String() string { func (m MergeRequest) String() string {
......
...@@ -56,14 +56,30 @@ type Pipeline struct { ...@@ -56,14 +56,30 @@ type Pipeline struct {
AvatarURL string `json:"avatar_url"` AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"` WebURL string `json:"web_url"`
} }
UpdatedAt *time.Time `json:"updated_at"` UpdatedAt *time.Time `json:"updated_at"`
CreatedAt *time.Time `json:"created_at"` CreatedAt *time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at"` StartedAt *time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at"` FinishedAt *time.Time `json:"finished_at"`
CommittedAt *time.Time `json:"committed_at"` CommittedAt *time.Time `json:"committed_at"`
Duration int `json:"duration"` Duration int `json:"duration"`
Coverage string `json:"coverage"` Coverage string `json:"coverage"`
WebURL string `json:"web_url"` WebURL string `json:"web_url"`
DetailedStatus *DetailedStatus `json:"detailed_status"`
}
// DetailedStatus contains detailed information about the status of a pipeline
type DetailedStatus struct {
Icon string `json:"icon"`
Text string `json:"text"`
Label string `json:"label"`
Group string `json:"group"`
Tooltip string `json:"tooltip"`
HasDetails bool `json:"has_details"`
DetailsPath string `json:"details_path"`
Illustration *struct {
Image string `json:"image"`
} `json:"illustration"`
Favicon string `json:"favicon"`
} }
func (i Pipeline) String() string { func (i Pipeline) String() string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment