From 5ca6fed34fe5fa20f61134a27340a7b64b8d603f Mon Sep 17 00:00:00 2001 From: gitnexbot Date: Sat, 25 Mar 2023 00:09:19 +0000 Subject: [PATCH] Synchronizing API and documentation updates --- docs/MarkdownOption.md | 2 +- docs/MarkupOption.md | 10 + docs/MiscellaneousApi.md | 88 +++++++++ .../tea4j/v2/apis/MiscellaneousApi.java | 11 ++ .../tea4j/v2/models/MarkdownOption.java | 4 +- .../gitnex/tea4j/v2/models/MarkupOption.java | 179 ++++++++++++++++++ 6 files changed, 291 insertions(+), 3 deletions(-) create mode 100644 docs/MarkupOption.md create mode 100644 src/main/java/org/gitnex/tea4j/v2/models/MarkupOption.java diff --git a/docs/MarkdownOption.md b/docs/MarkdownOption.md index 5b3f2d3..92e5e37 100644 --- a/docs/MarkdownOption.md +++ b/docs/MarkdownOption.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **context** | **String** | Context to render in: body | [optional] -**mode** | **String** | Mode to render in: body | [optional] +**mode** | **String** | Mode to render (comment, gfm, markdown) in: body | [optional] **text** | **String** | Text markdown to render in: body | [optional] **wiki** | **Boolean** | Is it a wiki page ? in: body | [optional] diff --git a/docs/MarkupOption.md b/docs/MarkupOption.md new file mode 100644 index 0000000..4658490 --- /dev/null +++ b/docs/MarkupOption.md @@ -0,0 +1,10 @@ +# MarkupOption + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**context** | **String** | Context to render in: body | [optional] +**filePath** | **String** | File path for detecting extension in file mode in: body | [optional] +**mode** | **String** | Mode to render (comment, gfm, markdown, file) in: body | [optional] +**text** | **String** | Text markup to render in: body | [optional] +**wiki** | **Boolean** | Is it a wiki page ? in: body | [optional] diff --git a/docs/MiscellaneousApi.md b/docs/MiscellaneousApi.md index 018d8ad..e07cf18 100644 --- a/docs/MiscellaneousApi.md +++ b/docs/MiscellaneousApi.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**getVersion**](MiscellaneousApi.md#getVersion) | **GET** version | Returns the version of the Gitea application [**renderMarkdown**](MiscellaneousApi.md#renderMarkdown) | **POST** markdown | Render a markdown document as HTML [**renderMarkdownRaw**](MiscellaneousApi.md#renderMarkdownRaw) | **POST** markdown/raw | Render raw markdown as HTML +[**renderMarkup**](MiscellaneousApi.md#renderMarkup) | **POST** markup | Render a markup document as HTML # **getNodeInfo** @@ -433,3 +434,90 @@ Name | Type | Description | Notes - **Content-Type**: text/plain - **Accept**: text/html + +# **renderMarkup** +> String renderMarkup(body) + +Render a markup document as HTML + +### Example +```java +// Import classes: +//import org.gitnex.tea4j.v2.ApiClient; +//import org.gitnex.tea4j.v2.ApiException; +//import org.gitnex.tea4j.v2.Configuration; +//import org.gitnex.tea4j.v2.auth.*; +//import org.gitnex.tea4j.v2.apis.MiscellaneousApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: AccessToken +ApiKeyAuth AccessToken = (ApiKeyAuth) defaultClient.getAuthentication("AccessToken"); +AccessToken.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//AccessToken.setApiKeyPrefix("Token"); + +// Configure API key authorization: AuthorizationHeaderToken +ApiKeyAuth AuthorizationHeaderToken = (ApiKeyAuth) defaultClient.getAuthentication("AuthorizationHeaderToken"); +AuthorizationHeaderToken.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//AuthorizationHeaderToken.setApiKeyPrefix("Token"); +// Configure HTTP basic authorization: BasicAuth +HttpBasicAuth BasicAuth = (HttpBasicAuth) defaultClient.getAuthentication("BasicAuth"); +BasicAuth.setUsername("YOUR USERNAME"); +BasicAuth.setPassword("YOUR PASSWORD"); + +// Configure API key authorization: SudoHeader +ApiKeyAuth SudoHeader = (ApiKeyAuth) defaultClient.getAuthentication("SudoHeader"); +SudoHeader.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//SudoHeader.setApiKeyPrefix("Token"); + +// Configure API key authorization: SudoParam +ApiKeyAuth SudoParam = (ApiKeyAuth) defaultClient.getAuthentication("SudoParam"); +SudoParam.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//SudoParam.setApiKeyPrefix("Token"); + +// Configure API key authorization: TOTPHeader +ApiKeyAuth TOTPHeader = (ApiKeyAuth) defaultClient.getAuthentication("TOTPHeader"); +TOTPHeader.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//TOTPHeader.setApiKeyPrefix("Token"); + +// Configure API key authorization: Token +ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token"); +Token.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//Token.setApiKeyPrefix("Token"); + +MiscellaneousApi apiInstance = new MiscellaneousApi(); +MarkupOption body = new MarkupOption(); // MarkupOption | +try { + String result = apiInstance.renderMarkup(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling MiscellaneousApi#renderMarkup"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**MarkupOption**](MarkupOption.md)| | [optional] + +### Return type + +**String** + +### Authorization + +[AccessToken](../README.md#AccessToken)[AuthorizationHeaderToken](../README.md#AuthorizationHeaderToken)[BasicAuth](../README.md#BasicAuth)[SudoHeader](../README.md#SudoHeader)[SudoParam](../README.md#SudoParam)[TOTPHeader](../README.md#TOTPHeader)[Token](../README.md#Token) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/html + diff --git a/src/main/java/org/gitnex/tea4j/v2/apis/MiscellaneousApi.java b/src/main/java/org/gitnex/tea4j/v2/apis/MiscellaneousApi.java index 37b81a4..d42ef26 100644 --- a/src/main/java/org/gitnex/tea4j/v2/apis/MiscellaneousApi.java +++ b/src/main/java/org/gitnex/tea4j/v2/apis/MiscellaneousApi.java @@ -2,6 +2,7 @@ package org.gitnex.tea4j.v2.apis; import org.gitnex.tea4j.v2.CollectionFormats.*; import org.gitnex.tea4j.v2.models.MarkdownOption; +import org.gitnex.tea4j.v2.models.MarkupOption; import org.gitnex.tea4j.v2.models.NodeInfo; import org.gitnex.tea4j.v2.models.ServerVersion; import retrofit2.Call; @@ -51,4 +52,14 @@ public interface MiscellaneousApi { @Headers({"Content-Type:text/plain"}) @POST("markdown/raw") Call renderMarkdownRaw(@retrofit2.http.Body String body); + + /** + * Render a markup document as HTML + * + * @param body (optional) + * @return Call<String> + */ + @Headers({"Content-Type:application/json"}) + @POST("markup") + Call renderMarkup(@retrofit2.http.Body MarkupOption body); } diff --git a/src/main/java/org/gitnex/tea4j/v2/models/MarkdownOption.java b/src/main/java/org/gitnex/tea4j/v2/models/MarkdownOption.java index 9e3a7ee..21e113f 100644 --- a/src/main/java/org/gitnex/tea4j/v2/models/MarkdownOption.java +++ b/src/main/java/org/gitnex/tea4j/v2/models/MarkdownOption.java @@ -59,11 +59,11 @@ public class MarkdownOption implements Serializable { } /** - * Mode to render in: body + * Mode to render (comment, gfm, markdown) in: body * * @return mode */ - @Schema(description = "Mode to render in: body") + @Schema(description = "Mode to render (comment, gfm, markdown) in: body") public String getMode() { return mode; } diff --git a/src/main/java/org/gitnex/tea4j/v2/models/MarkupOption.java b/src/main/java/org/gitnex/tea4j/v2/models/MarkupOption.java new file mode 100644 index 0000000..74f02f5 --- /dev/null +++ b/src/main/java/org/gitnex/tea4j/v2/models/MarkupOption.java @@ -0,0 +1,179 @@ +/* + * Gitea API. + * This documentation describes the Gitea API. + * + * OpenAPI spec version: {{AppVer | JSEscape | Safe}} + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package org.gitnex.tea4j.v2.models; + +import com.google.gson.annotations.SerializedName; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.Serializable; +import java.util.Objects; + +/** MarkupOption markup options */ +@Schema(description = "MarkupOption markup options") +public class MarkupOption implements Serializable { + private static final long serialVersionUID = 1L; + + @SerializedName("Context") + private String context = null; + + @SerializedName("FilePath") + private String filePath = null; + + @SerializedName("Mode") + private String mode = null; + + @SerializedName("Text") + private String text = null; + + @SerializedName("Wiki") + private Boolean wiki = null; + + public MarkupOption context(String context) { + this.context = context; + return this; + } + + /** + * Context to render in: body + * + * @return context + */ + @Schema(description = "Context to render in: body") + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } + + public MarkupOption filePath(String filePath) { + this.filePath = filePath; + return this; + } + + /** + * File path for detecting extension in file mode in: body + * + * @return filePath + */ + @Schema(description = "File path for detecting extension in file mode in: body") + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public MarkupOption mode(String mode) { + this.mode = mode; + return this; + } + + /** + * Mode to render (comment, gfm, markdown, file) in: body + * + * @return mode + */ + @Schema(description = "Mode to render (comment, gfm, markdown, file) in: body") + public String getMode() { + return mode; + } + + public void setMode(String mode) { + this.mode = mode; + } + + public MarkupOption text(String text) { + this.text = text; + return this; + } + + /** + * Text markup to render in: body + * + * @return text + */ + @Schema(description = "Text markup to render in: body") + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public MarkupOption wiki(Boolean wiki) { + this.wiki = wiki; + return this; + } + + /** + * Is it a wiki page ? in: body + * + * @return wiki + */ + @Schema(description = "Is it a wiki page ? in: body") + public Boolean isWiki() { + return wiki; + } + + public void setWiki(Boolean wiki) { + this.wiki = wiki; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarkupOption markupOption = (MarkupOption) o; + return Objects.equals(this.context, markupOption.context) + && Objects.equals(this.filePath, markupOption.filePath) + && Objects.equals(this.mode, markupOption.mode) + && Objects.equals(this.text, markupOption.text) + && Objects.equals(this.wiki, markupOption.wiki); + } + + @Override + public int hashCode() { + return Objects.hash(context, filePath, mode, text, wiki); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarkupOption {\n"); + + sb.append(" context: ").append(toIndentedString(context)).append("\n"); + sb.append(" filePath: ").append(toIndentedString(filePath)).append("\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" wiki: ").append(toIndentedString(wiki)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +}