-
Notifications
You must be signed in to change notification settings - Fork 941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return basic info about pipeline in GET /projects/:id/pipelines #163
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for helping to get stuff ready for the V4 API! I do have some comments/suggestions on this PR. Please let me know your thoughts...
examples/pipelines.go
Outdated
git.SetBaseURL("https://gitlab.com/api/v4") | ||
|
||
pipelines, _, err := git.Pipelines.ListProjectPipelines(2743054) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitting please remove this empty line here
Ref string `json:"ref"` | ||
Sha string `json:"sha"` | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what to make of this. I see what you are trying to do and I agree it's maybe somewhat cleaner to have a smaller struct matching the field returned from a list call. But I don't think I like the suggested solution.
The name RootPipeline
seems to imply something that doesn't exist (there is no such thing as a root of a pipeline). And also please do not put the new type in between the Pipeline
type and it's String
method. I like to keep those close together. Additionally please also add the String
method for the new struct.
As for a possible solution I would like to suggest making a PipelineList
type:
type PipelineList []struct {
ID int `json:"id"`
Status string `json:"status"`
Ref string `json:"ref"`
Sha string `json:"sha"`
}
I think that would (both in term of it's name and it's structure) fit the context a bit better. Thoughts?
@ivaravko that looks much better (to me at least 😉) Thanks! |
* Return basic info about pipeline in GET /projects/:id/pipelines * Adds pipeline example * Rename RootPipeline to PipelineList with type []struct
* Return basic info about pipeline in GET /projects/:id/pipelines * Adds pipeline example * Rename RootPipeline to PipelineList with type []struct
This is updated v4 API. See https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines and https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8875 for more information.