diff --git a/docs/RenameBranchRepoOption.md b/docs/RenameBranchRepoOption.md new file mode 100644 index 0000000..1523187 --- /dev/null +++ b/docs/RenameBranchRepoOption.md @@ -0,0 +1,6 @@ +# RenameBranchRepoOption + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | New branch name | diff --git a/docs/RepositoryApi.md b/docs/RepositoryApi.md index e437abf..d03462f 100644 --- a/docs/RepositoryApi.md +++ b/docs/RepositoryApi.md @@ -173,6 +173,7 @@ Method | HTTP request | Description [**repoNewPinAllowed**](RepositoryApi.md#repoNewPinAllowed) | **GET** repos/{owner}/{repo}/new_pin_allowed | Returns if new Issue Pins are allowed [**repoPullRequestIsMerged**](RepositoryApi.md#repoPullRequestIsMerged) | **GET** repos/{owner}/{repo}/pulls/{index}/merge | Check if a pull request has been merged [**repoPushMirrorSync**](RepositoryApi.md#repoPushMirrorSync) | **POST** repos/{owner}/{repo}/push_mirrors-sync | Sync all push mirrored repository +[**repoRenameBranch**](RepositoryApi.md#repoRenameBranch) | **PATCH** repos/{owner}/{repo}/branches/{branch} | Rename a branch [**repoSearch**](RepositoryApi.md#repoSearch) | **GET** repos/search | Search for repositories [**repoSigningKey**](RepositoryApi.md#repoSigningKey) | **GET** repos/{owner}/{repo}/signing-key.gpg | Get signing-key.gpg for given repository [**repoSigningKeySSH**](RepositoryApi.md#repoSigningKeySSH) | **GET** repos/{owner}/{repo}/signing-key.pub | Get signing-key.pub for given repository @@ -182,7 +183,6 @@ 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 -[**repoUpdateBranch**](RepositoryApi.md#repoUpdateBranch) | **PATCH** repos/{owner}/{repo}/branches/{branch} | Update a branch [**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 @@ -15852,6 +15852,99 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: Not defined + +# **repoRenameBranch** +> Void repoRenameBranch(owner, repo, branch, body) + +Rename a branch + +### 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 branch = "branch_example"; // String | name of the branch +RenameBranchRepoOption body = new RenameBranchRepoOption(); // RenameBranchRepoOption | +try { + Void result = apiInstance.repoRenameBranch(owner, repo, branch, body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling RepositoryApi#repoRenameBranch"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **owner** | **String**| owner of the repo | + **repo** | **String**| name of the repo | + **branch** | **String**| name of the branch | + **body** | [**RenameBranchRepoOption**](RenameBranchRepoOption.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 + # **repoSearch** > SearchResults repoSearch(q, topic, includeDesc, uid, priorityOwnerId, teamId, starredBy, _private, isPrivate, template, archived, mode, exclusive, sort, order, page, limit) @@ -16711,99 +16804,6 @@ Name | Type | Description | Notes - **Content-Type**: application/json, text/plain - **Accept**: Not defined - -# **repoUpdateBranch** -> Void repoUpdateBranch(owner, repo, branch, body) - -Update a branch - -### 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 branch = "branch_example"; // String | name of the branch -UpdateBranchRepoOption body = new UpdateBranchRepoOption(); // UpdateBranchRepoOption | -try { - Void result = apiInstance.repoUpdateBranch(owner, repo, branch, body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling RepositoryApi#repoUpdateBranch"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **owner** | **String**| owner of the repo | - **repo** | **String**| name of the repo | - **branch** | **String**| name of the branch | - **body** | [**UpdateBranchRepoOption**](UpdateBranchRepoOption.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 - # **repoUpdateBranchProtectionPriories** > Void repoUpdateBranchProtectionPriories(owner, repo, body) 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 2c11156..467bbae 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.PullReviewRequestOptions; import org.gitnex.tea4j.v2.models.PushMirror; import org.gitnex.tea4j.v2.models.Reference; import org.gitnex.tea4j.v2.models.Release; +import org.gitnex.tea4j.v2.models.RenameBranchRepoOption; import org.gitnex.tea4j.v2.models.RepoCollaboratorPermission; import org.gitnex.tea4j.v2.models.RepoTopicOptions; import org.gitnex.tea4j.v2.models.Repository; @@ -100,7 +101,6 @@ 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.UpdateBranchRepoOption; import org.gitnex.tea4j.v2.models.UpdateFileOptions; import org.gitnex.tea4j.v2.models.UpdateRepoAvatarOption; import org.gitnex.tea4j.v2.models.UpdateVariableOption; @@ -2731,6 +2731,23 @@ public interface RepositoryApi { Call repoPushMirrorSync( @retrofit2.http.Path("owner") String owner, @retrofit2.http.Path("repo") String repo); + /** + * Rename a branch + * + * @param owner owner of the repo (required) + * @param repo name of the repo (required) + * @param branch name of the branch (required) + * @param body (optional) + * @return Call<Void> + */ + @Headers({"Content-Type:application/json"}) + @PATCH("repos/{owner}/{repo}/branches/{branch}") + Call repoRenameBranch( + @retrofit2.http.Path("owner") String owner, + @retrofit2.http.Path("repo") String repo, + @retrofit2.http.Path("branch") String branch, + @retrofit2.http.Body RenameBranchRepoOption body); + /** * Search for repositories * @@ -2912,23 +2929,6 @@ public interface RepositoryApi { @retrofit2.http.Path("repo") String repo, @retrofit2.http.Body UpdateRepoAvatarOption body); - /** - * Update a branch - * - * @param owner owner of the repo (required) - * @param repo name of the repo (required) - * @param branch name of the branch (required) - * @param body (optional) - * @return Call<Void> - */ - @Headers({"Content-Type:application/json"}) - @PATCH("repos/{owner}/{repo}/branches/{branch}") - Call repoUpdateBranch( - @retrofit2.http.Path("owner") String owner, - @retrofit2.http.Path("repo") String repo, - @retrofit2.http.Path("branch") String branch, - @retrofit2.http.Body UpdateBranchRepoOption body); - /** * Update the priorities of branch protections for a repository. * diff --git a/src/main/java/org/gitnex/tea4j/v2/models/RenameBranchRepoOption.java b/src/main/java/org/gitnex/tea4j/v2/models/RenameBranchRepoOption.java new file mode 100644 index 0000000..6be6709 --- /dev/null +++ b/src/main/java/org/gitnex/tea4j/v2/models/RenameBranchRepoOption.java @@ -0,0 +1,83 @@ +/* + * Gitea API + * This documentation describes the Gitea API. + * + * OpenAPI spec version: {{.SwaggerAppVer}} + * + * + * 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; + +/** RenameBranchRepoOption options when renaming a branch in a repository */ +@Schema(description = "RenameBranchRepoOption options when renaming a branch in a repository") +public class RenameBranchRepoOption implements Serializable { + private static final long serialVersionUID = 1L; + + @SerializedName("name") + private String name = null; + + public RenameBranchRepoOption name(String name) { + this.name = name; + return this; + } + + /** + * New branch name + * + * @return name + */ + @Schema(required = true, description = "New branch name") + 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; + } + RenameBranchRepoOption renameBranchRepoOption = (RenameBranchRepoOption) o; + return Objects.equals(this.name, renameBranchRepoOption.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenameBranchRepoOption {\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 "); + } +}