Skip to content

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

Merged
merged 3 commits into from
Jun 5, 2018
Merged

Added support for Uncyclos API #191

merged 3 commits into from
Jun 5, 2018

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 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.*;
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.

@@ -1843,6 +1833,139 @@ public String getRawSnippetContent(Integer projectId, Integer snippetId) throws
}
}

/**
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 UncyclosApi, you'll then need to add a public UncyclosApi getUncyclosApi() 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 UncyclosApi 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 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.

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 UncyclosApi 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.

Uncyclos API
2 participants