Synchronizing API and documentation updates

This commit is contained in:
gitnexbot
2023-05-30 00:29:18 +00:00
parent cbe4b6eada
commit 046b53c029
8 changed files with 798 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
# ChangeFileOperation
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**content** | **String** | content must be base64 encoded |
**fromPath** | **String** | old path of the file to move | [optional]
**operation** | [**OperationEnum**](#OperationEnum) | indicates what to do with the file |
**path** | **String** | path to the existing or new file | [optional]
**sha** | **String** | sha is the SHA for the file that already exists, required for update, delete | [optional]
<a name="OperationEnum"></a>
## Enum: OperationEnum
Name | Value
---- | -----
CREATE | &quot;create&quot;
UPDATE | &quot;update&quot;
DELETE | &quot;delete&quot;
+13
View File
@@ -0,0 +1,13 @@
# ChangeFilesOptions
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**author** | [**Identity**](Identity.md) | | [optional]
**branch** | **String** | branch (optional) to base this file from. if not given, the default branch is used | [optional]
**committer** | [**Identity**](Identity.md) | | [optional]
**dates** | [**CommitDateOptions**](CommitDateOptions.md) | | [optional]
**files** | [**List&lt;ChangeFileOperation&gt;**](ChangeFileOperation.md) | | [optional]
**message** | **String** | message (optional) for the commit of this file. if not supplied, a default message will be used | [optional]
**newBranch** | **String** | new_branch (optional) will make a new branch from &#x60;branch&#x60; before creating the file | [optional]
**signoff** | **Boolean** | Add a Signed-off-by trailer by the committer at the end of the commit log message. | [optional]
+8
View File
@@ -0,0 +1,8 @@
# FilesResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**commit** | [**FileCommitResponse**](FileCommitResponse.md) | | [optional]
**files** | [**List&lt;ContentsResponse&gt;**](ContentsResponse.md) | | [optional]
**verification** | [**PayloadCommitVerification**](PayloadCommitVerification.md) | | [optional]
+92
View File
@@ -19,6 +19,7 @@ Method | HTTP request | Description
[**repoAddTopic**](RepositoryApi.md#repoAddTopic) | **PUT** repos/{owner}/{repo}/topics/{topic} | Add a topic to a repository
[**repoApplyDiffPatch**](RepositoryApi.md#repoApplyDiffPatch) | **POST** repos/{owner}/{repo}/diffpatch | Apply diff patch to repository
[**repoCancelScheduledAutoMerge**](RepositoryApi.md#repoCancelScheduledAutoMerge) | **DELETE** repos/{owner}/{repo}/pulls/{index}/merge | Cancel the scheduled auto merge for the given pull request
[**repoChangeFiles**](RepositoryApi.md#repoChangeFiles) | **POST** repos/{owner}/{repo}/contents | Create or update multiple files in a repository
[**repoCheckCollaborator**](RepositoryApi.md#repoCheckCollaborator) | **GET** repos/{owner}/{repo}/collaborators/{collaborator} | Check if a user is a collaborator of a repository
[**repoCheckTeam**](RepositoryApi.md#repoCheckTeam) | **GET** repos/{owner}/{repo}/teams/{team} | Check if a team is assigned to a repository
[**repoCreateBranch**](RepositoryApi.md#repoCreateBranch) | **POST** repos/{owner}/{repo}/branches | Create a branch
@@ -1513,6 +1514,97 @@ Name | Type | Description | Notes
- **Content-Type**: Not defined
- **Accept**: Not defined
<a name="repoChangeFiles"></a>
# **repoChangeFiles**
> FilesResponse repoChangeFiles(body, owner, repo)
Create or update multiple files in 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();
ChangeFilesOptions body = new ChangeFilesOptions(); // ChangeFilesOptions |
String owner = "owner_example"; // String | owner of the repo
String repo = "repo_example"; // String | name of the repo
try {
FilesResponse result = apiInstance.repoChangeFiles(body, owner, repo);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RepositoryApi#repoChangeFiles");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ChangeFilesOptions**](ChangeFilesOptions.md)| |
**owner** | **String**| owner of the repo |
**repo** | **String**| name of the repo |
### Return type
[**FilesResponse**](FilesResponse.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**: application/json
<a name="repoCheckCollaborator"></a>
# **repoCheckCollaborator**
> Void repoCheckCollaborator(owner, repo, collaborator)
@@ -11,6 +11,7 @@ import org.gitnex.tea4j.v2.models.AnnotatedTag;
import org.gitnex.tea4j.v2.models.Attachment;
import org.gitnex.tea4j.v2.models.Branch;
import org.gitnex.tea4j.v2.models.BranchProtection;
import org.gitnex.tea4j.v2.models.ChangeFilesOptions;
import org.gitnex.tea4j.v2.models.ChangedFile;
import org.gitnex.tea4j.v2.models.CombinedStatus;
import org.gitnex.tea4j.v2.models.Commit;
@@ -42,6 +43,7 @@ import org.gitnex.tea4j.v2.models.EditReleaseOption;
import org.gitnex.tea4j.v2.models.EditRepoOption;
import org.gitnex.tea4j.v2.models.FileDeleteResponse;
import org.gitnex.tea4j.v2.models.FileResponse;
import org.gitnex.tea4j.v2.models.FilesResponse;
import org.gitnex.tea4j.v2.models.GenerateRepoOption;
import org.gitnex.tea4j.v2.models.GitBlobResponse;
import org.gitnex.tea4j.v2.models.GitHook;
@@ -300,6 +302,21 @@ public interface RepositoryApi {
@retrofit2.http.Path("repo") String repo,
@retrofit2.http.Path("index") Long index);
/**
* Create or update multiple files in a repository
*
* @param body (required)
* @param owner owner of the repo (required)
* @param repo name of the repo (required)
* @return Call&lt;FilesResponse&gt;
*/
@Headers({"Content-Type:application/json"})
@POST("repos/{owner}/{repo}/contents")
Call<FilesResponse> repoChangeFiles(
@retrofit2.http.Body ChangeFilesOptions body,
@retrofit2.http.Path("owner") String owner,
@retrofit2.http.Path("repo") String repo);
/**
* Check if a user is a collaborator of a repository
*
@@ -0,0 +1,231 @@
/*
* 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.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.IOException;
import java.io.Serializable;
import java.util.Objects;
/** ChangeFileOperation for creating, updating or deleting a file */
@Schema(description = "ChangeFileOperation for creating, updating or deleting a file")
public class ChangeFileOperation implements Serializable {
private static final long serialVersionUID = 1L;
@SerializedName("content")
private String content = null;
@SerializedName("from_path")
private String fromPath = null;
/** indicates what to do with the file */
@JsonAdapter(OperationEnum.Adapter.class)
public enum OperationEnum {
CREATE("create"),
UPDATE("update"),
DELETE("delete");
private String value;
OperationEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static OperationEnum fromValue(String input) {
for (OperationEnum b : OperationEnum.values()) {
if (b.value.equals(input)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<OperationEnum> {
@Override
public void write(final JsonWriter jsonWriter, final OperationEnum enumeration)
throws IOException {
jsonWriter.value(String.valueOf(enumeration.getValue()));
}
@Override
public OperationEnum read(final JsonReader jsonReader) throws IOException {
Object value = jsonReader.nextString();
return OperationEnum.fromValue((String) (value));
}
}
}
@SerializedName("operation")
private OperationEnum operation = null;
@SerializedName("path")
private String path = null;
@SerializedName("sha")
private String sha = null;
public ChangeFileOperation content(String content) {
this.content = content;
return this;
}
/**
* content must be base64 encoded
*
* @return content
*/
@Schema(required = true, description = "content must be base64 encoded")
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public ChangeFileOperation fromPath(String fromPath) {
this.fromPath = fromPath;
return this;
}
/**
* old path of the file to move
*
* @return fromPath
*/
@Schema(description = "old path of the file to move")
public String getFromPath() {
return fromPath;
}
public void setFromPath(String fromPath) {
this.fromPath = fromPath;
}
public ChangeFileOperation operation(OperationEnum operation) {
this.operation = operation;
return this;
}
/**
* indicates what to do with the file
*
* @return operation
*/
@Schema(required = true, description = "indicates what to do with the file")
public OperationEnum getOperation() {
return operation;
}
public void setOperation(OperationEnum operation) {
this.operation = operation;
}
public ChangeFileOperation path(String path) {
this.path = path;
return this;
}
/**
* path to the existing or new file
*
* @return path
*/
@Schema(description = "path to the existing or new file")
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public ChangeFileOperation sha(String sha) {
this.sha = sha;
return this;
}
/**
* sha is the SHA for the file that already exists, required for update, delete
*
* @return sha
*/
@Schema(
description = "sha is the SHA for the file that already exists, required for update, delete")
public String getSha() {
return sha;
}
public void setSha(String sha) {
this.sha = sha;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ChangeFileOperation changeFileOperation = (ChangeFileOperation) o;
return Objects.equals(this.content, changeFileOperation.content)
&& Objects.equals(this.fromPath, changeFileOperation.fromPath)
&& Objects.equals(this.operation, changeFileOperation.operation)
&& Objects.equals(this.path, changeFileOperation.path)
&& Objects.equals(this.sha, changeFileOperation.sha);
}
@Override
public int hashCode() {
return Objects.hash(content, fromPath, operation, path, sha);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ChangeFileOperation {\n");
sb.append(" content: ").append(toIndentedString(content)).append("\n");
sb.append(" fromPath: ").append(toIndentedString(fromPath)).append("\n");
sb.append(" operation: ").append(toIndentedString(operation)).append("\n");
sb.append(" path: ").append(toIndentedString(path)).append("\n");
sb.append(" sha: ").append(toIndentedString(sha)).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 ");
}
}
@@ -0,0 +1,278 @@
/*
* 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.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* ChangeFilesOptions options for creating, updating or deleting multiple files Note:
* &#x60;author&#x60; and &#x60;committer&#x60; are optional (if only one is given, it will be used
* for the other, otherwise the authenticated user will be used)
*/
@Schema(
description =
"ChangeFilesOptions options for creating, updating or deleting multiple files Note:"
+ " `author` and `committer` are optional (if only one is given, it will be used for"
+ " the other, otherwise the authenticated user will be used)")
public class ChangeFilesOptions implements Serializable {
private static final long serialVersionUID = 1L;
@SerializedName("author")
private Identity author = null;
@SerializedName("branch")
private String branch = null;
@SerializedName("committer")
private Identity committer = null;
@SerializedName("dates")
private CommitDateOptions dates = null;
@SerializedName("files")
private List<ChangeFileOperation> files = null;
@SerializedName("message")
private String message = null;
@SerializedName("new_branch")
private String newBranch = null;
@SerializedName("signoff")
private Boolean signoff = null;
public ChangeFilesOptions author(Identity author) {
this.author = author;
return this;
}
/**
* Get author
*
* @return author
*/
@Schema(description = "")
public Identity getAuthor() {
return author;
}
public void setAuthor(Identity author) {
this.author = author;
}
public ChangeFilesOptions branch(String branch) {
this.branch = branch;
return this;
}
/**
* branch (optional) to base this file from. if not given, the default branch is used
*
* @return branch
*/
@Schema(
description =
"branch (optional) to base this file from. if not given, the default branch is used")
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
public ChangeFilesOptions committer(Identity committer) {
this.committer = committer;
return this;
}
/**
* Get committer
*
* @return committer
*/
@Schema(description = "")
public Identity getCommitter() {
return committer;
}
public void setCommitter(Identity committer) {
this.committer = committer;
}
public ChangeFilesOptions dates(CommitDateOptions dates) {
this.dates = dates;
return this;
}
/**
* Get dates
*
* @return dates
*/
@Schema(description = "")
public CommitDateOptions getDates() {
return dates;
}
public void setDates(CommitDateOptions dates) {
this.dates = dates;
}
public ChangeFilesOptions files(List<ChangeFileOperation> files) {
this.files = files;
return this;
}
public ChangeFilesOptions addFilesItem(ChangeFileOperation filesItem) {
if (this.files == null) {
this.files = new ArrayList<>();
}
this.files.add(filesItem);
return this;
}
/**
* Get files
*
* @return files
*/
@Schema(description = "")
public List<ChangeFileOperation> getFiles() {
return files;
}
public void setFiles(List<ChangeFileOperation> files) {
this.files = files;
}
public ChangeFilesOptions message(String message) {
this.message = message;
return this;
}
/**
* message (optional) for the commit of this file. if not supplied, a default message will be used
*
* @return message
*/
@Schema(
description =
"message (optional) for the commit of this file. if not supplied, a default message will"
+ " be used")
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public ChangeFilesOptions newBranch(String newBranch) {
this.newBranch = newBranch;
return this;
}
/**
* new_branch (optional) will make a new branch from &#x60;branch&#x60; before creating the file
*
* @return newBranch
*/
@Schema(
description =
"new_branch (optional) will make a new branch from `branch` before creating the file")
public String getNewBranch() {
return newBranch;
}
public void setNewBranch(String newBranch) {
this.newBranch = newBranch;
}
public ChangeFilesOptions signoff(Boolean signoff) {
this.signoff = signoff;
return this;
}
/**
* Add a Signed-off-by trailer by the committer at the end of the commit log message.
*
* @return signoff
*/
@Schema(
description =
"Add a Signed-off-by trailer by the committer at the end of the commit log message.")
public Boolean isSignoff() {
return signoff;
}
public void setSignoff(Boolean signoff) {
this.signoff = signoff;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ChangeFilesOptions changeFilesOptions = (ChangeFilesOptions) o;
return Objects.equals(this.author, changeFilesOptions.author)
&& Objects.equals(this.branch, changeFilesOptions.branch)
&& Objects.equals(this.committer, changeFilesOptions.committer)
&& Objects.equals(this.dates, changeFilesOptions.dates)
&& Objects.equals(this.files, changeFilesOptions.files)
&& Objects.equals(this.message, changeFilesOptions.message)
&& Objects.equals(this.newBranch, changeFilesOptions.newBranch)
&& Objects.equals(this.signoff, changeFilesOptions.signoff);
}
@Override
public int hashCode() {
return Objects.hash(author, branch, committer, dates, files, message, newBranch, signoff);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ChangeFilesOptions {\n");
sb.append(" author: ").append(toIndentedString(author)).append("\n");
sb.append(" branch: ").append(toIndentedString(branch)).append("\n");
sb.append(" committer: ").append(toIndentedString(committer)).append("\n");
sb.append(" dates: ").append(toIndentedString(dates)).append("\n");
sb.append(" files: ").append(toIndentedString(files)).append("\n");
sb.append(" message: ").append(toIndentedString(message)).append("\n");
sb.append(" newBranch: ").append(toIndentedString(newBranch)).append("\n");
sb.append(" signoff: ").append(toIndentedString(signoff)).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 ");
}
}
@@ -0,0 +1,141 @@
/*
* 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.ArrayList;
import java.util.List;
import java.util.Objects;
/** FilesResponse contains information about multiple files from a repo */
@Schema(description = "FilesResponse contains information about multiple files from a repo")
public class FilesResponse implements Serializable {
private static final long serialVersionUID = 1L;
@SerializedName("commit")
private FileCommitResponse commit = null;
@SerializedName("files")
private List<ContentsResponse> files = null;
@SerializedName("verification")
private PayloadCommitVerification verification = null;
public FilesResponse commit(FileCommitResponse commit) {
this.commit = commit;
return this;
}
/**
* Get commit
*
* @return commit
*/
@Schema(description = "")
public FileCommitResponse getCommit() {
return commit;
}
public void setCommit(FileCommitResponse commit) {
this.commit = commit;
}
public FilesResponse files(List<ContentsResponse> files) {
this.files = files;
return this;
}
public FilesResponse addFilesItem(ContentsResponse filesItem) {
if (this.files == null) {
this.files = new ArrayList<>();
}
this.files.add(filesItem);
return this;
}
/**
* Get files
*
* @return files
*/
@Schema(description = "")
public List<ContentsResponse> getFiles() {
return files;
}
public void setFiles(List<ContentsResponse> files) {
this.files = files;
}
public FilesResponse verification(PayloadCommitVerification verification) {
this.verification = verification;
return this;
}
/**
* Get verification
*
* @return verification
*/
@Schema(description = "")
public PayloadCommitVerification getVerification() {
return verification;
}
public void setVerification(PayloadCommitVerification verification) {
this.verification = verification;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FilesResponse filesResponse = (FilesResponse) o;
return Objects.equals(this.commit, filesResponse.commit)
&& Objects.equals(this.files, filesResponse.files)
&& Objects.equals(this.verification, filesResponse.verification);
}
@Override
public int hashCode() {
return Objects.hash(commit, files, verification);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FilesResponse {\n");
sb.append(" commit: ").append(toIndentedString(commit)).append("\n");
sb.append(" files: ").append(toIndentedString(files)).append("\n");
sb.append(" verification: ").append(toIndentedString(verification)).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 ");
}
}