From 93215eba35985d85e78b71897c1049f4a189a0a7 Mon Sep 17 00:00:00 2001 From: gitnexbot Date: Fri, 29 Apr 2022 22:00:36 +0000 Subject: [PATCH] Synchronizing API and documentation updates --- docs/CreateUserOption.md | 1 + docs/RepoCollaboratorPermission.md | 8 ++ docs/RepositoryApi.md | 92 ++++++++++++ .../gitnex/tea4j/v2/apis/RepositoryApi.java | 15 ++ .../tea4j/v2/models/CreateUserOption.java | 25 ++++ .../v2/models/RepoCollaboratorPermission.java | 131 ++++++++++++++++++ 6 files changed, 272 insertions(+) create mode 100644 docs/RepoCollaboratorPermission.md create mode 100644 src/main/java/org/gitnex/tea4j/v2/models/RepoCollaboratorPermission.java diff --git a/docs/CreateUserOption.md b/docs/CreateUserOption.md index 6fef421..6b98e7f 100644 --- a/docs/CreateUserOption.md +++ b/docs/CreateUserOption.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **loginName** | **String** | | [optional] **mustChangePassword** | **Boolean** | | [optional] **password** | **String** | | +**restricted** | **Boolean** | | [optional] **sendNotify** | **Boolean** | | [optional] **sourceId** | **Long** | | [optional] **username** | **String** | | diff --git a/docs/RepoCollaboratorPermission.md b/docs/RepoCollaboratorPermission.md new file mode 100644 index 0000000..53a481d --- /dev/null +++ b/docs/RepoCollaboratorPermission.md @@ -0,0 +1,8 @@ +# RepoCollaboratorPermission + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**permission** | **String** | | [optional] +**roleName** | **String** | | [optional] +**user** | [**User**](User.md) | | [optional] diff --git a/docs/RepositoryApi.md b/docs/RepositoryApi.md index d4bfb95..864e46b 100644 --- a/docs/RepositoryApi.md +++ b/docs/RepositoryApi.md @@ -85,6 +85,7 @@ Method | HTTP request | Description [**repoGetRelease**](RepositoryApi.md#repoGetRelease) | **GET** repos/{owner}/{repo}/releases/{id} | Get a release [**repoGetReleaseAttachment**](RepositoryApi.md#repoGetReleaseAttachment) | **GET** repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} | Get a release attachment [**repoGetReleaseByTag**](RepositoryApi.md#repoGetReleaseByTag) | **GET** repos/{owner}/{repo}/releases/tags/{tag} | Get a release by tag name +[**repoGetRepoPermissions**](RepositoryApi.md#repoGetRepoPermissions) | **GET** repos/{owner}/{repo}/collaborators/{collaborator}/permission | Get repository permissions for a user [**repoGetReviewers**](RepositoryApi.md#repoGetReviewers) | **GET** repos/{owner}/{repo}/reviewers | Return all users that can be requested to review in this repo [**repoGetSingleCommit**](RepositoryApi.md#repoGetSingleCommit) | **GET** repos/{owner}/{repo}/git/commits/{sha} | Get a single commit from a repository [**repoGetTag**](RepositoryApi.md#repoGetTag) | **GET** repos/{owner}/{repo}/tags/{tag} | Get the tag of a repository by tag name @@ -7556,6 +7557,97 @@ 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 + + +# **repoGetRepoPermissions** +> RepoCollaboratorPermission repoGetRepoPermissions(owner, repo, collaborator) + +Get repository permissions for 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.RepositoryApi; + +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"); + +RepositoryApi apiInstance = new RepositoryApi(); +String owner = "owner_example"; // String | owner of the repo +String repo = "repo_example"; // String | name of the repo +String collaborator = "collaborator_example"; // String | username of the collaborator +try { + RepoCollaboratorPermission result = apiInstance.repoGetRepoPermissions(owner, repo, collaborator); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling RepositoryApi#repoGetRepoPermissions"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **owner** | **String**| owner of the repo | + **repo** | **String**| name of the repo | + **collaborator** | **String**| username of the collaborator | + +### Return type + +[**RepoCollaboratorPermission**](RepoCollaboratorPermission.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/src/main/java/org/gitnex/tea4j/v2/apis/RepositoryApi.java b/src/main/java/org/gitnex/tea4j/v2/apis/RepositoryApi.java index b4a481e..ff3d61c 100644 --- a/src/main/java/org/gitnex/tea4j/v2/apis/RepositoryApi.java +++ b/src/main/java/org/gitnex/tea4j/v2/apis/RepositoryApi.java @@ -54,6 +54,7 @@ import org.gitnex.tea4j.v2.models.PullReviewComment; import org.gitnex.tea4j.v2.models.PullReviewRequestOptions; import org.gitnex.tea4j.v2.models.Reference; import org.gitnex.tea4j.v2.models.Release; +import org.gitnex.tea4j.v2.models.RepoCollaboratorPermission; import org.gitnex.tea4j.v2.models.RepoTopicOptions; import org.gitnex.tea4j.v2.models.Repository; import org.gitnex.tea4j.v2.models.SearchResults; @@ -1298,6 +1299,20 @@ public interface RepositoryApi { @retrofit2.http.Path("repo") String repo, @retrofit2.http.Path("tag") String tag); + /** + * Get repository permissions for a user + * + * @param owner owner of the repo (required) + * @param repo name of the repo (required) + * @param collaborator username of the collaborator (required) + * @return Call<RepoCollaboratorPermission> + */ + @GET("repos/{owner}/{repo}/collaborators/{collaborator}/permission") + Call repoGetRepoPermissions( + @retrofit2.http.Path("owner") String owner, + @retrofit2.http.Path("repo") String repo, + @retrofit2.http.Path("collaborator") String collaborator); + /** * Return all users that can be requested to review in this repo * diff --git a/src/main/java/org/gitnex/tea4j/v2/models/CreateUserOption.java b/src/main/java/org/gitnex/tea4j/v2/models/CreateUserOption.java index 468f5c5..b718ddb 100644 --- a/src/main/java/org/gitnex/tea4j/v2/models/CreateUserOption.java +++ b/src/main/java/org/gitnex/tea4j/v2/models/CreateUserOption.java @@ -37,6 +37,9 @@ public class CreateUserOption implements Serializable { @SerializedName("password") private String password = null; + @SerializedName("restricted") + private Boolean restricted = null; + @SerializedName("send_notify") private Boolean sendNotify = null; @@ -144,6 +147,25 @@ public class CreateUserOption implements Serializable { this.password = password; } + public CreateUserOption restricted(Boolean restricted) { + this.restricted = restricted; + return this; + } + + /** + * Get restricted + * + * @return restricted + */ + @Schema(description = "") + public Boolean isRestricted() { + return restricted; + } + + public void setRestricted(Boolean restricted) { + this.restricted = restricted; + } + public CreateUserOption sendNotify(Boolean sendNotify) { this.sendNotify = sendNotify; return this; @@ -234,6 +256,7 @@ public class CreateUserOption implements Serializable { && Objects.equals(this.loginName, createUserOption.loginName) && Objects.equals(this.mustChangePassword, createUserOption.mustChangePassword) && Objects.equals(this.password, createUserOption.password) + && Objects.equals(this.restricted, createUserOption.restricted) && Objects.equals(this.sendNotify, createUserOption.sendNotify) && Objects.equals(this.sourceId, createUserOption.sourceId) && Objects.equals(this.username, createUserOption.username) @@ -248,6 +271,7 @@ public class CreateUserOption implements Serializable { loginName, mustChangePassword, password, + restricted, sendNotify, sourceId, username, @@ -264,6 +288,7 @@ public class CreateUserOption implements Serializable { sb.append(" loginName: ").append(toIndentedString(loginName)).append("\n"); sb.append(" mustChangePassword: ").append(toIndentedString(mustChangePassword)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" restricted: ").append(toIndentedString(restricted)).append("\n"); sb.append(" sendNotify: ").append(toIndentedString(sendNotify)).append("\n"); sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); sb.append(" username: ").append(toIndentedString(username)).append("\n"); diff --git a/src/main/java/org/gitnex/tea4j/v2/models/RepoCollaboratorPermission.java b/src/main/java/org/gitnex/tea4j/v2/models/RepoCollaboratorPermission.java new file mode 100644 index 0000000..4c1018f --- /dev/null +++ b/src/main/java/org/gitnex/tea4j/v2/models/RepoCollaboratorPermission.java @@ -0,0 +1,131 @@ +/* + * 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; + +/** RepoCollaboratorPermission to get repository permission for a collaborator */ +@Schema(description = "RepoCollaboratorPermission to get repository permission for a collaborator") +public class RepoCollaboratorPermission implements Serializable { + private static final long serialVersionUID = 1L; + + @SerializedName("permission") + private String permission = null; + + @SerializedName("role_name") + private String roleName = null; + + @SerializedName("user") + private User user = null; + + public RepoCollaboratorPermission permission(String permission) { + this.permission = permission; + return this; + } + + /** + * Get permission + * + * @return permission + */ + @Schema(description = "") + public String getPermission() { + return permission; + } + + public void setPermission(String permission) { + this.permission = permission; + } + + public RepoCollaboratorPermission roleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Get roleName + * + * @return roleName + */ + @Schema(description = "") + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public RepoCollaboratorPermission user(User user) { + this.user = user; + return this; + } + + /** + * Get user + * + * @return user + */ + @Schema(description = "") + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RepoCollaboratorPermission repoCollaboratorPermission = (RepoCollaboratorPermission) o; + return Objects.equals(this.permission, repoCollaboratorPermission.permission) + && Objects.equals(this.roleName, repoCollaboratorPermission.roleName) + && Objects.equals(this.user, repoCollaboratorPermission.user); + } + + @Override + public int hashCode() { + return Objects.hash(permission, roleName, user); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RepoCollaboratorPermission {\n"); + + sb.append(" permission: ").append(toIndentedString(permission)).append("\n"); + sb.append(" roleName: ").append(toIndentedString(roleName)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).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 "); + } +}