diff --git a/docs/BranchProtection.md b/docs/BranchProtection.md index 417cc61..ccb258b 100644 --- a/docs/BranchProtection.md +++ b/docs/BranchProtection.md @@ -25,6 +25,7 @@ Name | Type | Description | Notes **ignoreStaleApprovals** | **Boolean** | | [optional] **mergeWhitelistTeams** | **List<String>** | | [optional] **mergeWhitelistUsernames** | **List<String>** | | [optional] +**priority** | **Long** | | [optional] **protectedFilePatterns** | **String** | | [optional] **pushWhitelistDeployKeys** | **Boolean** | | [optional] **pushWhitelistTeams** | **List<String>** | | [optional] diff --git a/docs/CreateBranchProtectionOption.md b/docs/CreateBranchProtectionOption.md index 61f3185..c571342 100644 --- a/docs/CreateBranchProtectionOption.md +++ b/docs/CreateBranchProtectionOption.md @@ -24,6 +24,7 @@ Name | Type | Description | Notes **ignoreStaleApprovals** | **Boolean** | | [optional] **mergeWhitelistTeams** | **List<String>** | | [optional] **mergeWhitelistUsernames** | **List<String>** | | [optional] +**priority** | **Long** | | [optional] **protectedFilePatterns** | **String** | | [optional] **pushWhitelistDeployKeys** | **Boolean** | | [optional] **pushWhitelistTeams** | **List<String>** | | [optional] diff --git a/docs/EditBranchProtectionOption.md b/docs/EditBranchProtectionOption.md index 84ea16d..357d4a5 100644 --- a/docs/EditBranchProtectionOption.md +++ b/docs/EditBranchProtectionOption.md @@ -23,6 +23,7 @@ Name | Type | Description | Notes **ignoreStaleApprovals** | **Boolean** | | [optional] **mergeWhitelistTeams** | **List<String>** | | [optional] **mergeWhitelistUsernames** | **List<String>** | | [optional] +**priority** | **Long** | | [optional] **protectedFilePatterns** | **String** | | [optional] **pushWhitelistDeployKeys** | **Boolean** | | [optional] **pushWhitelistTeams** | **List<String>** | | [optional] diff --git a/docs/RepositoryApi.md b/docs/RepositoryApi.md index c7570c7..e2b9ed9 100644 --- a/docs/RepositoryApi.md +++ b/docs/RepositoryApi.md @@ -156,6 +156,7 @@ Method | HTTP request | Description [**repoTransfer**](RepositoryApi.md#repoTransfer) | **POST** repos/{owner}/{repo}/transfer | Transfer a repo ownership [**repoUnDismissPullReview**](RepositoryApi.md#repoUnDismissPullReview) | **POST** repos/{owner}/{repo}/pulls/{index}/reviews/{id}/undismissals | Cancel to dismiss a review for a pull request [**repoUpdateAvatar**](RepositoryApi.md#repoUpdateAvatar) | **POST** repos/{owner}/{repo}/avatar | Update avatar +[**repoUpdateBranchProtectionPriories**](RepositoryApi.md#repoUpdateBranchProtectionPriories) | **POST** repos/{owner}/{repo}/branch_protections/priority | Update the priorities of branch protections for a repository. [**repoUpdateFile**](RepositoryApi.md#repoUpdateFile) | **PUT** repos/{owner}/{repo}/contents/{filepath} | Update a file in a repository [**repoUpdatePullRequest**](RepositoryApi.md#repoUpdatePullRequest) | **POST** repos/{owner}/{repo}/pulls/{index}/update | Merge PR's baseBranch into headBranch [**repoUpdateTopics**](RepositoryApi.md#repoUpdateTopics) | **PUT** repos/{owner}/{repo}/topics | Replace list of topics for a repository @@ -14275,6 +14276,97 @@ Name | Type | Description | Notes - **Content-Type**: application/json, text/plain - **Accept**: Not defined + +# **repoUpdateBranchProtectionPriories** +> Void repoUpdateBranchProtectionPriories(owner, repo, body) + +Update the priorities of branch protections for a repository. + +### 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 +UpdateBranchProtectionPriories body = new UpdateBranchProtectionPriories(); // UpdateBranchProtectionPriories | +try { + Void result = apiInstance.repoUpdateBranchProtectionPriories(owner, repo, body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling RepositoryApi#repoUpdateBranchProtectionPriories"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **owner** | **String**| owner of the repo | + **repo** | **String**| name of the repo | + **body** | [**UpdateBranchProtectionPriories**](UpdateBranchProtectionPriories.md)| | [optional] + +### 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 + - **Accept**: Not defined + # **repoUpdateFile** > FileResponse repoUpdateFile(body, owner, repo, filepath) diff --git a/docs/UpdateBranchProtectionPriories.md b/docs/UpdateBranchProtectionPriories.md new file mode 100644 index 0000000..a5fab54 --- /dev/null +++ b/docs/UpdateBranchProtectionPriories.md @@ -0,0 +1,6 @@ +# UpdateBranchProtectionPriories + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | **List<Long>** | | [optional] 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 c47b5ef..36fdaf0 100644 --- a/src/main/java/org/gitnex/tea4j/v2/apis/RepositoryApi.java +++ b/src/main/java/org/gitnex/tea4j/v2/apis/RepositoryApi.java @@ -86,6 +86,7 @@ import org.gitnex.tea4j.v2.models.TopicName; import org.gitnex.tea4j.v2.models.TopicResponse; import org.gitnex.tea4j.v2.models.TrackedTime; import org.gitnex.tea4j.v2.models.TransferRepoOption; +import org.gitnex.tea4j.v2.models.UpdateBranchProtectionPriories; import org.gitnex.tea4j.v2.models.UpdateFileOptions; import org.gitnex.tea4j.v2.models.UpdateRepoAvatarOption; import org.gitnex.tea4j.v2.models.UpdateVariableOption; @@ -2475,6 +2476,21 @@ public interface RepositoryApi { @retrofit2.http.Path("repo") String repo, @retrofit2.http.Body UpdateRepoAvatarOption body); + /** + * Update the priorities of branch protections for a repository. + * + * @param owner owner of the repo (required) + * @param repo name of the repo (required) + * @param body (optional) + * @return Call<Void> + */ + @Headers({"Content-Type:application/json"}) + @POST("repos/{owner}/{repo}/branch_protections/priority") + Call repoUpdateBranchProtectionPriories( + @retrofit2.http.Path("owner") String owner, + @retrofit2.http.Path("repo") String repo, + @retrofit2.http.Body UpdateBranchProtectionPriories body); + /** * Update a file in a repository * diff --git a/src/main/java/org/gitnex/tea4j/v2/models/BranchProtection.java b/src/main/java/org/gitnex/tea4j/v2/models/BranchProtection.java index 2387fa4..07149f0 100644 --- a/src/main/java/org/gitnex/tea4j/v2/models/BranchProtection.java +++ b/src/main/java/org/gitnex/tea4j/v2/models/BranchProtection.java @@ -91,6 +91,9 @@ public class BranchProtection implements Serializable { @SerializedName("merge_whitelist_usernames") private List mergeWhitelistUsernames = null; + @SerializedName("priority") + private Long priority = null; + @SerializedName("protected_file_patterns") private String protectedFilePatterns = null; @@ -588,6 +591,25 @@ public class BranchProtection implements Serializable { this.mergeWhitelistUsernames = mergeWhitelistUsernames; } + public BranchProtection priority(Long priority) { + this.priority = priority; + return this; + } + + /** + * Get priority + * + * @return priority + */ + @Schema(description = "") + public Long getPriority() { + return priority; + } + + public void setPriority(Long priority) { + this.priority = priority; + } + public BranchProtection protectedFilePatterns(String protectedFilePatterns) { this.protectedFilePatterns = protectedFilePatterns; return this; @@ -837,6 +859,7 @@ public class BranchProtection implements Serializable { && Objects.equals(this.ignoreStaleApprovals, branchProtection.ignoreStaleApprovals) && Objects.equals(this.mergeWhitelistTeams, branchProtection.mergeWhitelistTeams) && Objects.equals(this.mergeWhitelistUsernames, branchProtection.mergeWhitelistUsernames) + && Objects.equals(this.priority, branchProtection.priority) && Objects.equals(this.protectedFilePatterns, branchProtection.protectedFilePatterns) && Objects.equals(this.pushWhitelistDeployKeys, branchProtection.pushWhitelistDeployKeys) && Objects.equals(this.pushWhitelistTeams, branchProtection.pushWhitelistTeams) @@ -874,6 +897,7 @@ public class BranchProtection implements Serializable { ignoreStaleApprovals, mergeWhitelistTeams, mergeWhitelistUsernames, + priority, protectedFilePatterns, pushWhitelistDeployKeys, pushWhitelistTeams, @@ -947,6 +971,7 @@ public class BranchProtection implements Serializable { sb.append(" mergeWhitelistUsernames: ") .append(toIndentedString(mergeWhitelistUsernames)) .append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); sb.append(" protectedFilePatterns: ") .append(toIndentedString(protectedFilePatterns)) .append("\n"); diff --git a/src/main/java/org/gitnex/tea4j/v2/models/CreateBranchProtectionOption.java b/src/main/java/org/gitnex/tea4j/v2/models/CreateBranchProtectionOption.java index cf0fa03..ec8f327 100644 --- a/src/main/java/org/gitnex/tea4j/v2/models/CreateBranchProtectionOption.java +++ b/src/main/java/org/gitnex/tea4j/v2/models/CreateBranchProtectionOption.java @@ -87,6 +87,9 @@ public class CreateBranchProtectionOption implements Serializable { @SerializedName("merge_whitelist_usernames") private List mergeWhitelistUsernames = null; + @SerializedName("priority") + private Long priority = null; + @SerializedName("protected_file_patterns") private String protectedFilePatterns = null; @@ -573,6 +576,25 @@ public class CreateBranchProtectionOption implements Serializable { this.mergeWhitelistUsernames = mergeWhitelistUsernames; } + public CreateBranchProtectionOption priority(Long priority) { + this.priority = priority; + return this; + } + + /** + * Get priority + * + * @return priority + */ + @Schema(description = "") + public Long getPriority() { + return priority; + } + + public void setPriority(Long priority) { + this.priority = priority; + } + public CreateBranchProtectionOption protectedFilePatterns(String protectedFilePatterns) { this.protectedFilePatterns = protectedFilePatterns; return this; @@ -820,6 +842,7 @@ public class CreateBranchProtectionOption implements Serializable { this.mergeWhitelistTeams, createBranchProtectionOption.mergeWhitelistTeams) && Objects.equals( this.mergeWhitelistUsernames, createBranchProtectionOption.mergeWhitelistUsernames) + && Objects.equals(this.priority, createBranchProtectionOption.priority) && Objects.equals( this.protectedFilePatterns, createBranchProtectionOption.protectedFilePatterns) && Objects.equals( @@ -861,6 +884,7 @@ public class CreateBranchProtectionOption implements Serializable { ignoreStaleApprovals, mergeWhitelistTeams, mergeWhitelistUsernames, + priority, protectedFilePatterns, pushWhitelistDeployKeys, pushWhitelistTeams, @@ -932,6 +956,7 @@ public class CreateBranchProtectionOption implements Serializable { sb.append(" mergeWhitelistUsernames: ") .append(toIndentedString(mergeWhitelistUsernames)) .append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); sb.append(" protectedFilePatterns: ") .append(toIndentedString(protectedFilePatterns)) .append("\n"); diff --git a/src/main/java/org/gitnex/tea4j/v2/models/EditBranchProtectionOption.java b/src/main/java/org/gitnex/tea4j/v2/models/EditBranchProtectionOption.java index 7ad308e..08df996 100644 --- a/src/main/java/org/gitnex/tea4j/v2/models/EditBranchProtectionOption.java +++ b/src/main/java/org/gitnex/tea4j/v2/models/EditBranchProtectionOption.java @@ -84,6 +84,9 @@ public class EditBranchProtectionOption implements Serializable { @SerializedName("merge_whitelist_usernames") private List mergeWhitelistUsernames = null; + @SerializedName("priority") + private Long priority = null; + @SerializedName("protected_file_patterns") private String protectedFilePatterns = null; @@ -545,6 +548,25 @@ public class EditBranchProtectionOption implements Serializable { this.mergeWhitelistUsernames = mergeWhitelistUsernames; } + public EditBranchProtectionOption priority(Long priority) { + this.priority = priority; + return this; + } + + /** + * Get priority + * + * @return priority + */ + @Schema(description = "") + public Long getPriority() { + return priority; + } + + public void setPriority(Long priority) { + this.priority = priority; + } + public EditBranchProtectionOption protectedFilePatterns(String protectedFilePatterns) { this.protectedFilePatterns = protectedFilePatterns; return this; @@ -769,6 +791,7 @@ public class EditBranchProtectionOption implements Serializable { && Objects.equals(this.mergeWhitelistTeams, editBranchProtectionOption.mergeWhitelistTeams) && Objects.equals( this.mergeWhitelistUsernames, editBranchProtectionOption.mergeWhitelistUsernames) + && Objects.equals(this.priority, editBranchProtectionOption.priority) && Objects.equals( this.protectedFilePatterns, editBranchProtectionOption.protectedFilePatterns) && Objects.equals( @@ -807,6 +830,7 @@ public class EditBranchProtectionOption implements Serializable { ignoreStaleApprovals, mergeWhitelistTeams, mergeWhitelistUsernames, + priority, protectedFilePatterns, pushWhitelistDeployKeys, pushWhitelistTeams, @@ -876,6 +900,7 @@ public class EditBranchProtectionOption implements Serializable { sb.append(" mergeWhitelistUsernames: ") .append(toIndentedString(mergeWhitelistUsernames)) .append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); sb.append(" protectedFilePatterns: ") .append(toIndentedString(protectedFilePatterns)) .append("\n"); diff --git a/src/main/java/org/gitnex/tea4j/v2/models/UpdateBranchProtectionPriories.java b/src/main/java/org/gitnex/tea4j/v2/models/UpdateBranchProtectionPriories.java new file mode 100644 index 0000000..0e8403a --- /dev/null +++ b/src/main/java/org/gitnex/tea4j/v2/models/UpdateBranchProtectionPriories.java @@ -0,0 +1,96 @@ +/* + * Gitea API + * This documentation describes the Gitea API. + * + * OpenAPI spec version: {{AppVer | JSEscape}} + * + * + * 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.ArrayList; +import java.util.List; +import java.util.Objects; + +/** UpdateBranchProtectionPriories a list to update the branch protection rule priorities */ +@Schema( + description = + "UpdateBranchProtectionPriories a list to update the branch protection rule priorities") +public class UpdateBranchProtectionPriories implements Serializable { + private static final long serialVersionUID = 1L; + + @SerializedName("ids") + private List ids = null; + + public UpdateBranchProtectionPriories ids(List ids) { + this.ids = ids; + return this; + } + + public UpdateBranchProtectionPriories addIdsItem(Long idsItem) { + if (this.ids == null) { + this.ids = new ArrayList<>(); + } + this.ids.add(idsItem); + return this; + } + + /** + * Get ids + * + * @return ids + */ + @Schema(description = "") + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateBranchProtectionPriories updateBranchProtectionPriories = + (UpdateBranchProtectionPriories) o; + return Objects.equals(this.ids, updateBranchProtectionPriories.ids); + } + + @Override + public int hashCode() { + return Objects.hash(ids); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateBranchProtectionPriories {\n"); + + sb.append(" ids: ").append(toIndentedString(ids)).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 "); + } +}