xanzy / go-gitlab

GitLab Go SDK
Apache License 2.0
2.42k stars 960 forks source link

Enhancement - make `projects` endpoints configurable #2028

Closed kolluria closed 2 weeks ago

kolluria commented 1 month ago

We have GitLab deployed on prem and the URLs are slightly different from what is mentioned in the API specification. For instance, to get a list of projects the user contributed to, instead of invoking https://gitlab.example.com/api/v4/users/5/contributed_projects we have to invoke https://gitlab.example.com/api/v4/users/5/contributed.

This change accommodates these discrepancies by exporting the endpoints so that users can configure then if they so need it.

svanharmelen commented 1 month ago

Hmm... Interesting. Are there any docs that explain why these differences exist and/or describe what differences exist for which endpoints? I.e. are these the only two endpoints that are different?

kolluria commented 1 month ago

@svanharmelen I might have spoken too soon. I investigated further and turns out some specific endpoints are not working on our on prem deployment like /api/v4/users/5/contributed_projects. Let me probe further and see if this change even makes sense.

Thanks.

kolluria commented 1 month ago

@svanharmelen we might be running an older version of GitLab. This is the output of the version endpoint -

gitlab.Version{Version:"15.11.13-ee", Revision:"c2a3ebb864f"}

Does any of the releases of this project support this version? Your help is highly appreciated.

Thank you.

svanharmelen commented 1 month ago

Searching through the project I see this was added about a year ago and has always used these paths: https://github.com/xanzy/go-gitlab/pull/1792 So if version 15.11 is older then a year, I guess not.

RicePatrick commented 2 weeks ago

Yeah, 15.11 would have been about 1.5 years ago. The contributed_projects API was introduced in 16.2 (here: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124579), so I think you just need to update your gitlab version to take advantage of it via go-gitlab :)

kolluria commented 2 weeks ago

Yeah, 15.11 would have been about 1.5 years ago. The contributed_projects API was introduced in 16.2 (here: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124579), so I think you just need to update your gitlab version to take advantage of it via go-gitlab :)

Unfortunately I don't know if that's gonna happen any time soon :(