All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gitlab4j.api.MarkdownApi Maven / Gradle / Ivy

Go to download

GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.

There is a newer version: 6.0.0-rc.5
Show newest version
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.
     *
     * 
GitLab Endpoint: 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)); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy