-
Notifications
You must be signed in to change notification settings - Fork 486
added some apis #204
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
added some apis #204
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f6b9a5b
add getProject(int projectId, boolean statistics) api
zhengrenjie db80879
add getProject(String namespace, String project, Boolean statistics) api
zhengrenjie a83b643
add two getRepositoryArchive() apis with param "format"
zhengrenjie c94e2c8
1.added a pom dependency:
98b7fcc
Merge pull request #1 from gmessner/master
zhengrenjie 3ee5af9
added markdown transformed method and model
ff6accd
added license template method and model
31721a0
Merge remote-tracking branch 'origin/master'
12ef0b7
Removed the dependency on com.alibaba.fastjson.
524b50b
Restored RepositoryFileApi
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package org.gitlab4j.api; | ||
|
|
||
| import java.util.List; | ||
| import javax.ws.rs.core.Form; | ||
| import javax.ws.rs.core.GenericType; | ||
| import javax.ws.rs.core.Response; | ||
| import org.gitlab4j.api.models.LicenseTemplate; | ||
|
|
||
| /** | ||
| * This class provides an entry point to all the GitLab API licenses calls. | ||
| */ | ||
| public class LicensesApi extends AbstractApi { | ||
|
|
||
| public LicensesApi(GitLabApi gitLabApi) { | ||
| super(gitLabApi); | ||
| } | ||
|
|
||
| /** | ||
| * Get all license templates. | ||
| * | ||
| * GET /licenses | ||
| * | ||
| * @return a list of LicenseTemplate instances | ||
| * @throws GitLabApiException if any exception occurs | ||
| */ | ||
| public List<LicenseTemplate> getAllLicenseTemplates() throws GitLabApiException { | ||
| GitLabApiForm formData = null; | ||
| Response response = get(Response.Status.OK, formData.asMap(), "licenses"); | ||
| return (response.readEntity(new GenericType<List<LicenseTemplate>>() {})); | ||
| } | ||
|
|
||
| /** | ||
| * Get popular license templates. | ||
| * | ||
| * GET /licenses | ||
| * | ||
| * @return a list of LicenseTemplate instances | ||
| * @throws GitLabApiException if any exception occurs | ||
| */ | ||
| public List<LicenseTemplate> getPopularLicenseTemplates() throws GitLabApiException { | ||
| Form formData = new GitLabApiForm().withParam("popular", true, true); | ||
| Response response = get(Response.Status.OK, formData.asMap(), "licenses"); | ||
| return (response.readEntity(new GenericType<List<LicenseTemplate>>() {})); | ||
| } | ||
|
|
||
| /** | ||
| * Get a single license template. | ||
| * | ||
| * GET /licenses | ||
| * | ||
| * @param key The key of the license template | ||
| * @return a LicenseTemplate instance | ||
| * @throws GitLabApiException if any exception occurs | ||
| */ | ||
| public LicenseTemplate getSingleLicenseTemplate(String key) throws GitLabApiException { | ||
| GitLabApiForm formData = null; | ||
| Response response = get(Response.Status.OK, formData.asMap(), "licenses", key); | ||
| return (response.readEntity(LicenseTemplate.class)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package org.gitlab4j.api; | ||
|
|
||
| import javax.ws.rs.core.Form; | ||
| import javax.ws.rs.core.Response; | ||
| import org.gitlab4j.api.GitLabApi.ApiVersion; | ||
| import org.gitlab4j.api.models.Markdown; | ||
|
|
||
| /** | ||
| * This class provides an entry point to all the GitLab API markdown calls. | ||
| */ | ||
| public class MarkdownApi extends AbstractApi { | ||
|
|
||
| public MarkdownApi(GitLabApi gitLabApi) { | ||
| super(gitLabApi); | ||
| } | ||
|
|
||
| /** | ||
| * Render an arbitrary Markdown document. | ||
| * | ||
| * POST /api/v4/markdown | ||
| * | ||
| * @param text text to be transformed | ||
| * @return a Markdown instance with transformed info | ||
| * @throws GitLabApiException if any exception occurs | ||
| * @since GitLab 11.0 | ||
| */ | ||
| public Markdown getMarkdown(String text) throws GitLabApiException { | ||
|
|
||
| if(!isApiVersion(ApiVersion.V4)){ | ||
| throw new GitLabApiException("Api version must be v4"); | ||
| } | ||
|
|
||
| Form formData = new GitLabApiForm().withParam("text", text, true); | ||
| Response response = post(Response.Status.OK, formData.asMap(), "markdown"); | ||
| return (response.readEntity(Markdown.class)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
src/main/java/org/gitlab4j/api/models/LicenseTemplate.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| package org.gitlab4j.api.models; | ||
|
|
||
| import java.util.List; | ||
| import javax.xml.bind.annotation.XmlAccessType; | ||
| import javax.xml.bind.annotation.XmlAccessorType; | ||
| import javax.xml.bind.annotation.XmlRootElement; | ||
|
|
||
| @XmlRootElement | ||
| @XmlAccessorType(XmlAccessType.FIELD) | ||
| public class LicenseTemplate { | ||
|
|
||
| private String key; | ||
| private String name; | ||
| private String nickname; | ||
| private boolean featured; | ||
| private String htmlUrl; | ||
| private String sourceUrl; | ||
| private String description; | ||
| private List<String> conditions; | ||
| private List<String> permissions; | ||
| private List<String> limitations; | ||
| private String content; | ||
|
|
||
| public String getKey() { | ||
| return key; | ||
| } | ||
|
|
||
| public void setKey(String key) { | ||
| this.key = key; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public void setName(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public String getNickname() { | ||
| return nickname; | ||
| } | ||
|
|
||
| public void setNickname(String nickname) { | ||
| this.nickname = nickname; | ||
| } | ||
|
|
||
| public boolean isFeatured() { | ||
| return featured; | ||
| } | ||
|
|
||
| public void setFeatured(boolean featured) { | ||
| this.featured = featured; | ||
| } | ||
|
|
||
| public String getHtmlUrl() { | ||
| return htmlUrl; | ||
| } | ||
|
|
||
| public void setHtmlUrl(String htmlUrl) { | ||
| this.htmlUrl = htmlUrl; | ||
| } | ||
|
|
||
| public String getSourceUrl() { | ||
| return sourceUrl; | ||
| } | ||
|
|
||
| public void setSourceUrl(String sourceUrl) { | ||
| this.sourceUrl = sourceUrl; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
| return description; | ||
| } | ||
|
|
||
| public void setDescription(String description) { | ||
| this.description = description; | ||
| } | ||
|
|
||
| public List<String> getConditions() { | ||
| return conditions; | ||
| } | ||
|
|
||
| public void setConditions(List<String> conditions) { | ||
| this.conditions = conditions; | ||
| } | ||
|
|
||
| public List<String> getPermissions() { | ||
| return permissions; | ||
| } | ||
|
|
||
| public void setPermissions(List<String> permissions) { | ||
| this.permissions = permissions; | ||
| } | ||
|
|
||
| public List<String> getLimitations() { | ||
| return limitations; | ||
| } | ||
|
|
||
| public void setLimitations(List<String> limitations) { | ||
| this.limitations = limitations; | ||
| } | ||
|
|
||
| public String getContent() { | ||
| return content; | ||
| } | ||
|
|
||
| public void setContent(String content) { | ||
| this.content = content; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package org.gitlab4j.api.models; | ||
|
|
||
| import javax.xml.bind.annotation.XmlAccessType; | ||
| import javax.xml.bind.annotation.XmlAccessorType; | ||
| import javax.xml.bind.annotation.XmlRootElement; | ||
|
|
||
| @XmlRootElement | ||
| @XmlAccessorType(XmlAccessType.FIELD) | ||
| public class Markdown { | ||
|
|
||
| private String html; | ||
|
|
||
| public String getHtml() { | ||
| return html; | ||
| } | ||
|
|
||
| public void setHtml(String html) { | ||
| this.html = html; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
No need to introduce a new type for this, please re-implement
getProjectLanguage(Integer projectId)as follows: