Skip to content

Conversation

@shuklaalok7
Copy link
Contributor

It fixes #189. Please review/discuss and merge these changes.

@shuklaalok7
Copy link
Contributor Author

I have added tests as were written in TestProjectApiSnippets class. All the tests are passing.

Copy link
Collaborator

@gmessner gmessner left a 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.*;
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

}
}

/**
Copy link
Collaborator

@gmessner gmessner Jun 2, 2018

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.

Copy link
Contributor Author

@shuklaalok7 shuklaalok7 Jun 2, 2018

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.

  1. There is a SnippetsApi class for /snippets endpoints.
  2. Further implementation for the /projects/:id/snippets endpoints is added in the ProjectApi class.

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.

Copy link
Collaborator

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.

@shuklaalok7
Copy link
Contributor Author

@gmessner Requested changes have been made. Let me know if any more change is needed. Tests are passing well.

@gmessner gmessner merged commit 0bfdb38 into gitlab4j:master Jun 5, 2018
@gmessner
Copy link
Collaborator

@shuklaalok7
This has been released in 4.8.21

@shuklaalok7
Copy link
Contributor Author

@gmessner Thanks.

@shuklaalok7 shuklaalok7 mentioned this pull request Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wikis API

2 participants