Synchronizing API and documentation updates

This commit is contained in:
gitnexbot
2023-03-25 00:09:19 +00:00
parent 762e9a48e3
commit 5ca6fed34f
6 changed files with 291 additions and 3 deletions
+1 -1
View File
@@ -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]
+10
View File
@@ -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]
+88
View File
@@ -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
<a name="getNodeInfo"></a>
# **getNodeInfo**
@@ -433,3 +434,90 @@ Name | Type | Description | Notes
- **Content-Type**: text/plain
- **Accept**: text/html
<a name="renderMarkup"></a>
# **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
@@ -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<String> renderMarkdownRaw(@retrofit2.http.Body String body);
/**
* Render a markup document as HTML
*
* @param body (optional)
* @return Call&lt;String&gt;
*/
@Headers({"Content-Type:application/json"})
@POST("markup")
Call<String> renderMarkup(@retrofit2.http.Body MarkupOption body);
}
@@ -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;
}
@@ -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 ");
}
}