-
Notifications
You must be signed in to change notification settings - Fork 473
Added support for Uncyclos API #191
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
Conversation
Added tests Removed separate API class
I have added tests as were written in |
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.
@shuklaalok7
Thank you for your contribution. The implementation look great and thanks for including tests. Just one request is to create a UncyclosApi class.
import org.gitlab4j.api.models.PushRules; | ||
import org.gitlab4j.api.models.Snippet; | ||
import org.gitlab4j.api.models.Visibility; | ||
import org.gitlab4j.api.models.*; |
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.
We follow the practice of importing the individual items and avoid use of the wildcard.
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 agree with the suggestion.
@@ -1843,6 +1833,139 @@ public String getRawSnippetContent(Integer projectId, Integer snippetId) throws | |||
} | |||
} | |||
|
|||
/** |
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.
The convention we use is to have a one-to-one mapping of an API class to the GitLab API documentation page, in this case https://docs.gitlab.com/ce/api/wikis.html. The code that was added to the ProjectApi
class should be moved to a new class called UncyclosApi
, you'll then need to add a public UncyclosApi getUncyclosApi()
method to the GitLabApi
class.
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.
@gmessner Thanks for reviewing it.
Actually, I had added the UncyclosApi
class, but later removed when I observed following pattern in the code.
- There is a
SnippetsApi
class for/snippets
endpoints. - Further implementation for the
/projects/:id/snippets
endpoints is added in theProjectApi
class.
As the endpoints for Uncyclos API are in-line with the second case, I added support for this API in ProjectApi
class and removed UncyclosApi
. The endpoints for Uncyclos API are /projects/:id/wikis
. If you still suggest that I bring back UncyclosApi
class, I'll do that this week.
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.
The project snippets documentation use to be part of the Projects API at GitLab, it still is, but they moved the documentation to it's own page at https://docs.gitlab.com/ee/api/project_snippets.html
Notice that this is not called an API it is called "Project snippets". That being said, I will eventually deprecate the snippet methods in the ProjectApi
and relocate them to SnippetsApi
. You will also find a few others similar to this, I deprecate and relocate when I am making mods in the file for some other reason.
The GitLab API has evolved over the years, it is almost impossible to keep up with the changes. But keeping a one-to-one mapping of API classes to API documentation pages is how this project does it now, so please use the UncyclosApi
approach.
@gmessner Requested changes have been made. Let me know if any more change is needed. Tests are passing well. |
@shuklaalok7 |
@gmessner Thanks. |
It fixes #189. Please review/discuss and merge these changes.