From c1be415ed0d2792eb4d820fd34a36b4eb1073083 Mon Sep 17 00:00:00 2001 From: gitnexbot Date: Wed, 15 Mar 2023 00:17:26 +0000 Subject: [PATCH] Synchronizing API and documentation updates --- docs/AdminApi.md | 272 ++++++++++++++++++ docs/Email.md | 2 + docs/RenameUserOption.md | 6 + .../org/gitnex/tea4j/v2/apis/AdminApi.java | 39 +++ .../org/gitnex/tea4j/v2/models/Email.java | 50 +++- .../tea4j/v2/models/RenameUserOption.java | 85 ++++++ 6 files changed, 453 insertions(+), 1 deletion(-) create mode 100644 docs/RenameUserOption.md create mode 100644 src/main/java/org/gitnex/tea4j/v2/models/RenameUserOption.java diff --git a/docs/AdminApi.md b/docs/AdminApi.md index 1fc2011..2811aa2 100644 --- a/docs/AdminApi.md +++ b/docs/AdminApi.md @@ -18,10 +18,13 @@ Method | HTTP request | Description [**adminDeleteUserPublicKey**](AdminApi.md#adminDeleteUserPublicKey) | **DELETE** admin/users/{username}/keys/{id} | Delete a user's public key [**adminEditHook**](AdminApi.md#adminEditHook) | **PATCH** admin/hooks/{id} | Update a hook [**adminEditUser**](AdminApi.md#adminEditUser) | **PATCH** admin/users/{username} | Edit an existing user +[**adminGetAllEmails**](AdminApi.md#adminGetAllEmails) | **GET** admin/emails | List all emails [**adminGetAllOrgs**](AdminApi.md#adminGetAllOrgs) | **GET** admin/orgs | List all organizations [**adminGetAllUsers**](AdminApi.md#adminGetAllUsers) | **GET** admin/users | List all users [**adminGetHook**](AdminApi.md#adminGetHook) | **GET** admin/hooks/{id} | Get a hook [**adminListHooks**](AdminApi.md#adminListHooks) | **GET** admin/hooks | List system's webhooks +[**adminRenameUser**](AdminApi.md#adminRenameUser) | **POST** admin/users/{username}/rename | Rename a user +[**adminSearchEmails**](AdminApi.md#adminSearchEmails) | **GET** admin/emails/search | Search all emails [**adminUnadoptedList**](AdminApi.md#adminUnadoptedList) | **GET** admin/unadopted | List unadopted repositories @@ -1262,6 +1265,95 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json + +# **adminGetAllEmails** +> List<Email> adminGetAllEmails(page, limit) + +List all emails + +### 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.AdminApi; + +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"); + +AdminApi apiInstance = new AdminApi(); +Integer page = 56; // Integer | page number of results to return (1-based) +Integer limit = 56; // Integer | page size of results +try { + List result = apiInstance.adminGetAllEmails(page, limit); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling AdminApi#adminGetAllEmails"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **page** | **Integer**| page number of results to return (1-based) | [optional] + **limit** | **Integer**| page size of results | [optional] + +### Return type + +[**List<Email>**](Email.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 + # **adminGetAllOrgs** > List<Organization> adminGetAllOrgs(page, limit) @@ -1611,6 +1703,186 @@ 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 + + +# **adminRenameUser** +> Void adminRenameUser(body, username) + +Rename a user + +### 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.AdminApi; + +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"); + +AdminApi apiInstance = new AdminApi(); +RenameUserOption body = new RenameUserOption(); // RenameUserOption | +String username = "username_example"; // String | existing username of user +try { + Void result = apiInstance.adminRenameUser(body, username); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling AdminApi#adminRenameUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**RenameUserOption**](RenameUserOption.md)| | + **username** | **String**| existing username of user | + +### Return type + +[**Void**](.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**: application/json, text/plain + - **Accept**: Not defined + + +# **adminSearchEmails** +> List<Email> adminSearchEmails(q, page, limit) + +Search all emails + +### 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.AdminApi; + +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"); + +AdminApi apiInstance = new AdminApi(); +String q = "q_example"; // String | keyword +Integer page = 56; // Integer | page number of results to return (1-based) +Integer limit = 56; // Integer | page size of results +try { + List result = apiInstance.adminSearchEmails(q, page, limit); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling AdminApi#adminSearchEmails"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **q** | **String**| keyword | [optional] + **page** | **Integer**| page number of results to return (1-based) | [optional] + **limit** | **Integer**| page size of results | [optional] + +### Return type + +[**List<Email>**](Email.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 diff --git a/docs/Email.md b/docs/Email.md index 039de42..b87816b 100644 --- a/docs/Email.md +++ b/docs/Email.md @@ -5,4 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **email** | **String** | | [optional] **primary** | **Boolean** | | [optional] +**userId** | **Long** | | [optional] +**username** | **String** | | [optional] **verified** | **Boolean** | | [optional] diff --git a/docs/RenameUserOption.md b/docs/RenameUserOption.md new file mode 100644 index 0000000..b68bd94 --- /dev/null +++ b/docs/RenameUserOption.md @@ -0,0 +1,6 @@ +# RenameUserOption + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**newUsername** | **String** | New username for this user. This name cannot be in use yet by any other user. | diff --git a/src/main/java/org/gitnex/tea4j/v2/apis/AdminApi.java b/src/main/java/org/gitnex/tea4j/v2/apis/AdminApi.java index 50ad557..bc11735 100644 --- a/src/main/java/org/gitnex/tea4j/v2/apis/AdminApi.java +++ b/src/main/java/org/gitnex/tea4j/v2/apis/AdminApi.java @@ -10,9 +10,11 @@ import org.gitnex.tea4j.v2.models.CreateUserOption; import org.gitnex.tea4j.v2.models.Cron; import org.gitnex.tea4j.v2.models.EditHookOption; import org.gitnex.tea4j.v2.models.EditUserOption; +import org.gitnex.tea4j.v2.models.Email; import org.gitnex.tea4j.v2.models.Hook; import org.gitnex.tea4j.v2.models.Organization; import org.gitnex.tea4j.v2.models.PublicKey; +import org.gitnex.tea4j.v2.models.RenameUserOption; import org.gitnex.tea4j.v2.models.Repository; import org.gitnex.tea4j.v2.models.User; import retrofit2.Call; @@ -173,6 +175,17 @@ public interface AdminApi { Call adminEditUser( @retrofit2.http.Path("username") String username, @retrofit2.http.Body EditUserOption body); + /** + * List all emails + * + * @param page page number of results to return (1-based) (optional) + * @param limit page size of results (optional) + * @return Call<List<Email>> + */ + @GET("admin/emails") + Call> adminGetAllEmails( + @retrofit2.http.Query("page") Integer page, @retrofit2.http.Query("limit") Integer limit); + /** * List all organizations * @@ -215,6 +228,32 @@ public interface AdminApi { Call> adminListHooks( @retrofit2.http.Query("page") Integer page, @retrofit2.http.Query("limit") Integer limit); + /** + * Rename a user + * + * @param body (required) + * @param username existing username of user (required) + * @return Call<Void> + */ + @Headers({"Content-Type:application/json"}) + @POST("admin/users/{username}/rename") + Call adminRenameUser( + @retrofit2.http.Body RenameUserOption body, @retrofit2.http.Path("username") String username); + + /** + * Search all emails + * + * @param q keyword (optional) + * @param page page number of results to return (1-based) (optional) + * @param limit page size of results (optional) + * @return Call<List<Email>> + */ + @GET("admin/emails/search") + Call> adminSearchEmails( + @retrofit2.http.Query("q") String q, + @retrofit2.http.Query("page") Integer page, + @retrofit2.http.Query("limit") Integer limit); + /** * List unadopted repositories * diff --git a/src/main/java/org/gitnex/tea4j/v2/models/Email.java b/src/main/java/org/gitnex/tea4j/v2/models/Email.java index a332dec..d6614ad 100644 --- a/src/main/java/org/gitnex/tea4j/v2/models/Email.java +++ b/src/main/java/org/gitnex/tea4j/v2/models/Email.java @@ -28,6 +28,12 @@ public class Email implements Serializable { @SerializedName("primary") private Boolean primary = null; + @SerializedName("user_id") + private Long userId = null; + + @SerializedName("username") + private String username = null; + @SerializedName("verified") private Boolean verified = null; @@ -69,6 +75,44 @@ public class Email implements Serializable { this.primary = primary; } + public Email userId(Long userId) { + this.userId = userId; + return this; + } + + /** + * Get userId + * + * @return userId + */ + @Schema(description = "") + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Email username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * + * @return username + */ + @Schema(description = "") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + public Email verified(Boolean verified) { this.verified = verified; return this; @@ -99,12 +143,14 @@ public class Email implements Serializable { Email email = (Email) o; return Objects.equals(this.email, email.email) && Objects.equals(this.primary, email.primary) + && Objects.equals(this.userId, email.userId) + && Objects.equals(this.username, email.username) && Objects.equals(this.verified, email.verified); } @Override public int hashCode() { - return Objects.hash(email, primary, verified); + return Objects.hash(email, primary, userId, username, verified); } @Override @@ -114,6 +160,8 @@ public class Email implements Serializable { sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); sb.append(" verified: ").append(toIndentedString(verified)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/org/gitnex/tea4j/v2/models/RenameUserOption.java b/src/main/java/org/gitnex/tea4j/v2/models/RenameUserOption.java new file mode 100644 index 0000000..5d58f60 --- /dev/null +++ b/src/main/java/org/gitnex/tea4j/v2/models/RenameUserOption.java @@ -0,0 +1,85 @@ +/* + * 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; + +/** RenameUserOption options when renaming a user */ +@Schema(description = "RenameUserOption options when renaming a user") +public class RenameUserOption implements Serializable { + private static final long serialVersionUID = 1L; + + @SerializedName("new_username") + private String newUsername = null; + + public RenameUserOption newUsername(String newUsername) { + this.newUsername = newUsername; + return this; + } + + /** + * New username for this user. This name cannot be in use yet by any other user. + * + * @return newUsername + */ + @Schema( + required = true, + description = "New username for this user. This name cannot be in use yet by any other user.") + public String getNewUsername() { + return newUsername; + } + + public void setNewUsername(String newUsername) { + this.newUsername = newUsername; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenameUserOption renameUserOption = (RenameUserOption) o; + return Objects.equals(this.newUsername, renameUserOption.newUsername); + } + + @Override + public int hashCode() { + return Objects.hash(newUsername); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenameUserOption {\n"); + + sb.append(" newUsername: ").append(toIndentedString(newUsername)).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 "); + } +}