From e5720459cd6f21183365487c32dc28062a883da7 Mon Sep 17 00:00:00 2001 From: gitnexbot Date: Fri, 28 Apr 2023 00:11:46 +0000 Subject: [PATCH] Synchronizing API and documentation updates --- docs/GitignoreTemplateInfo.md | 7 + docs/MiscellaneousApi.md | 172 ++++++++++++++++++ .../tea4j/v2/apis/MiscellaneousApi.java | 18 ++ .../v2/models/GitignoreTemplateInfo.java | 107 +++++++++++ 4 files changed, 304 insertions(+) create mode 100644 docs/GitignoreTemplateInfo.md create mode 100644 src/main/java/org/gitnex/tea4j/v2/models/GitignoreTemplateInfo.java diff --git a/docs/GitignoreTemplateInfo.md b/docs/GitignoreTemplateInfo.md new file mode 100644 index 0000000..cc15dff --- /dev/null +++ b/docs/GitignoreTemplateInfo.md @@ -0,0 +1,7 @@ +# GitignoreTemplateInfo + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] +**source** | **String** | | [optional] diff --git a/docs/MiscellaneousApi.md b/docs/MiscellaneousApi.md index a67c41c..46bc522 100644 --- a/docs/MiscellaneousApi.md +++ b/docs/MiscellaneousApi.md @@ -4,15 +4,104 @@ All URIs are relative to *http://{{AppSubUrl | JSEscape | Safe}}/api/v1* Method | HTTP request | Description ------------- | ------------- | ------------- +[**getGitignoreTemplateInfo**](MiscellaneousApi.md#getGitignoreTemplateInfo) | **GET** gitignore/templates/{name} | Returns information about a gitignore template [**getLicenseTemplateInfo**](MiscellaneousApi.md#getLicenseTemplateInfo) | **GET** licenses/{name} | Returns information about a license template [**getNodeInfo**](MiscellaneousApi.md#getNodeInfo) | **GET** nodeinfo | Returns the nodeinfo of the Gitea application [**getSigningKey**](MiscellaneousApi.md#getSigningKey) | **GET** signing-key.gpg | Get default signing-key.gpg [**getVersion**](MiscellaneousApi.md#getVersion) | **GET** version | Returns the version of the Gitea application +[**listGitignoresTemplates**](MiscellaneousApi.md#listGitignoresTemplates) | **GET** gitignore/templates | Returns a list of all gitignore templates [**listLicenseTemplates**](MiscellaneousApi.md#listLicenseTemplates) | **GET** licenses | Returns a list of all license templates [**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 + +# **getGitignoreTemplateInfo** +> GitignoreTemplateInfo getGitignoreTemplateInfo(name) + +Returns information about a gitignore template + +### 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(); +String name = "name_example"; // String | name of the template +try { + GitignoreTemplateInfo result = apiInstance.getGitignoreTemplateInfo(name); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling MiscellaneousApi#getGitignoreTemplateInfo"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **name** | **String**| name of the template | + +### Return type + +[**GitignoreTemplateInfo**](GitignoreTemplateInfo.md) + +### 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**: Not defined + - **Accept**: application/json + # **getLicenseTemplateInfo** > LicenseTemplateInfo getLicenseTemplateInfo(name) @@ -344,6 +433,89 @@ This endpoint does not need any parameter. [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**: Not defined + - **Accept**: application/json + + +# **listGitignoresTemplates** +> List<String> listGitignoresTemplates() + +Returns a list of all gitignore templates + +### 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(); +try { + List result = apiInstance.listGitignoresTemplates(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling MiscellaneousApi#listGitignoresTemplates"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**List<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**: Not defined 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 d3724ad..84726e0 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 java.util.List; import org.gitnex.tea4j.v2.CollectionFormats.*; +import org.gitnex.tea4j.v2.models.GitignoreTemplateInfo; import org.gitnex.tea4j.v2.models.LicenseTemplateInfo; import org.gitnex.tea4j.v2.models.LicensesTemplateListEntry; import org.gitnex.tea4j.v2.models.MarkdownOption; @@ -12,6 +13,15 @@ import retrofit2.Call; import retrofit2.http.*; public interface MiscellaneousApi { + /** + * Returns information about a gitignore template + * + * @param name name of the template (required) + * @return Call<GitignoreTemplateInfo> + */ + @GET("gitignore/templates/{name}") + Call getGitignoreTemplateInfo(@retrofit2.http.Path("name") String name); + /** * Returns information about a license template * @@ -45,6 +55,14 @@ public interface MiscellaneousApi { @GET("version") Call getVersion(); + /** + * Returns a list of all gitignore templates + * + * @return Call<List<String>> + */ + @GET("gitignore/templates") + Call> listGitignoresTemplates(); + /** * Returns a list of all license templates * diff --git a/src/main/java/org/gitnex/tea4j/v2/models/GitignoreTemplateInfo.java b/src/main/java/org/gitnex/tea4j/v2/models/GitignoreTemplateInfo.java new file mode 100644 index 0000000..06d5c1d --- /dev/null +++ b/src/main/java/org/gitnex/tea4j/v2/models/GitignoreTemplateInfo.java @@ -0,0 +1,107 @@ +/* + * 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; + +/** GitignoreTemplateInfo name and text of a gitignore template */ +@Schema(description = "GitignoreTemplateInfo name and text of a gitignore template") +public class GitignoreTemplateInfo implements Serializable { + private static final long serialVersionUID = 1L; + + @SerializedName("name") + private String name = null; + + @SerializedName("source") + private String source = null; + + public GitignoreTemplateInfo name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @Schema(description = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public GitignoreTemplateInfo source(String source) { + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @Schema(description = "") + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GitignoreTemplateInfo gitignoreTemplateInfo = (GitignoreTemplateInfo) o; + return Objects.equals(this.name, gitignoreTemplateInfo.name) + && Objects.equals(this.source, gitignoreTemplateInfo.source); + } + + @Override + public int hashCode() { + return Objects.hash(name, source); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GitignoreTemplateInfo {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).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 "); + } +}