diff --git a/docs/LabelTemplate.md b/docs/LabelTemplate.md new file mode 100644 index 0000000..2d990dd --- /dev/null +++ b/docs/LabelTemplate.md @@ -0,0 +1,9 @@ +# LabelTemplate + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**description** | **String** | | [optional] +**exclusive** | **Boolean** | | [optional] +**name** | **String** | | [optional] diff --git a/docs/MiscellaneousApi.md b/docs/MiscellaneousApi.md index 46bc522..ded810a 100644 --- a/docs/MiscellaneousApi.md +++ b/docs/MiscellaneousApi.md @@ -5,11 +5,13 @@ 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 +[**getLabelTemplateInfo**](MiscellaneousApi.md#getLabelTemplateInfo) | **GET** label/templates/{name} | Returns all labels in a 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 +[**listLabelTemplates**](MiscellaneousApi.md#listLabelTemplates) | **GET** label/templates | Returns a list of all label 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 @@ -97,6 +99,93 @@ Name | Type | Description | Notes [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 + + +# **getLabelTemplateInfo** +> List<LabelTemplate> getLabelTemplateInfo(name) + +Returns all labels in a 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 { + List result = apiInstance.getLabelTemplateInfo(name); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling MiscellaneousApi#getLabelTemplateInfo"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **name** | **String**| name of the template | + +### Return type + +[**List<LabelTemplate>**](LabelTemplate.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 @@ -516,6 +605,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 + + +# **listLabelTemplates** +> List<String> listLabelTemplates() + +Returns a list of all label 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.listLabelTemplates(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling MiscellaneousApi#listLabelTemplates"); + 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 84726e0..78622bf 100644 --- a/src/main/java/org/gitnex/tea4j/v2/apis/MiscellaneousApi.java +++ b/src/main/java/org/gitnex/tea4j/v2/apis/MiscellaneousApi.java @@ -3,6 +3,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.LabelTemplate; import org.gitnex.tea4j.v2.models.LicenseTemplateInfo; import org.gitnex.tea4j.v2.models.LicensesTemplateListEntry; import org.gitnex.tea4j.v2.models.MarkdownOption; @@ -22,6 +23,15 @@ public interface MiscellaneousApi { @GET("gitignore/templates/{name}") Call getGitignoreTemplateInfo(@retrofit2.http.Path("name") String name); + /** + * Returns all labels in a template + * + * @param name name of the template (required) + * @return Call<List<LabelTemplate>> + */ + @GET("label/templates/{name}") + Call> getLabelTemplateInfo(@retrofit2.http.Path("name") String name); + /** * Returns information about a license template * @@ -63,6 +73,14 @@ public interface MiscellaneousApi { @GET("gitignore/templates") Call> listGitignoresTemplates(); + /** + * Returns a list of all label templates + * + * @return Call<List<String>> + */ + @GET("label/templates") + Call> listLabelTemplates(); + /** * Returns a list of all license templates * diff --git a/src/main/java/org/gitnex/tea4j/v2/models/LabelTemplate.java b/src/main/java/org/gitnex/tea4j/v2/models/LabelTemplate.java new file mode 100644 index 0000000..6adb8bd --- /dev/null +++ b/src/main/java/org/gitnex/tea4j/v2/models/LabelTemplate.java @@ -0,0 +1,155 @@ +/* + * 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; + +/** LabelTemplate info of a Label template */ +@Schema(description = "LabelTemplate info of a Label template") +public class LabelTemplate implements Serializable { + private static final long serialVersionUID = 1L; + + @SerializedName("color") + private String color = null; + + @SerializedName("description") + private String description = null; + + @SerializedName("exclusive") + private Boolean exclusive = null; + + @SerializedName("name") + private String name = null; + + public LabelTemplate color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * + * @return color + */ + @Schema(example = "00aabb", description = "") + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public LabelTemplate description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + */ + @Schema(description = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public LabelTemplate exclusive(Boolean exclusive) { + this.exclusive = exclusive; + return this; + } + + /** + * Get exclusive + * + * @return exclusive + */ + @Schema(example = "false", description = "") + public Boolean isExclusive() { + return exclusive; + } + + public void setExclusive(Boolean exclusive) { + this.exclusive = exclusive; + } + + public LabelTemplate 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; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LabelTemplate labelTemplate = (LabelTemplate) o; + return Objects.equals(this.color, labelTemplate.color) + && Objects.equals(this.description, labelTemplate.description) + && Objects.equals(this.exclusive, labelTemplate.exclusive) + && Objects.equals(this.name, labelTemplate.name); + } + + @Override + public int hashCode() { + return Objects.hash(color, description, exclusive, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LabelTemplate {\n"); + + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" exclusive: ").append(toIndentedString(exclusive)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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 "); + } +}