-
Notifications
You must be signed in to change notification settings - Fork 485
Added support for Wikis 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 |
gmessner
left a comment
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 WikisApi 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.
| } | ||
| } | ||
|
|
||
| /** |
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 WikisApi, you'll then need to add a public WikisApi getWikisApi() 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 WikisApi class, but later removed when I observed following pattern in the code.
- There is a
SnippetsApiclass for/snippetsendpoints. - Further implementation for the
/projects/:id/snippetsendpoints is added in theProjectApiclass.
As the endpoints for Wikis API are in-line with the second case, I added support for this API in ProjectApi class and removed WikisApi. The endpoints for Wikis API are /projects/:id/wikis. If you still suggest that I bring back WikisApi 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 WikisApi 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.