diff --git a/docs/IdAssetsBody1.md b/docs/IdAssetsBody1.md index 6070ed1..ed8a10b 100644 --- a/docs/IdAssetsBody1.md +++ b/docs/IdAssetsBody1.md @@ -3,4 +3,4 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**attachment** | [**File**](File.md) | attachment to upload | +**attachment** | [**File**](File.md) | attachment to upload | [optional] diff --git a/docs/IdAssetsBody2.md b/docs/IdAssetsBody2.md new file mode 100644 index 0000000..28303d9 --- /dev/null +++ b/docs/IdAssetsBody2.md @@ -0,0 +1,6 @@ +# IdAssetsBody2 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**attachment** | [**File**](File.md) | attachment to upload | [optional] diff --git a/docs/RepositoryApi.md b/docs/RepositoryApi.md index a706f0d..a794d2c 100644 --- a/docs/RepositoryApi.md +++ b/docs/RepositoryApi.md @@ -2712,7 +2712,7 @@ Name | Type | Description | Notes # **repoCreateReleaseAttachment** -> Attachment repoCreateReleaseAttachment(attachment, owner, repo, id, name) +> Attachment repoCreateReleaseAttachment(owner, repo, id, attachment, name) Create a release attachment @@ -2768,13 +2768,13 @@ Token.setApiKey("YOUR API KEY"); //Token.setApiKeyPrefix("Token"); RepositoryApi apiInstance = new RepositoryApi(); -File attachment = new File("attachment_example"); // File | String owner = "owner_example"; // String | owner of the repo String repo = "repo_example"; // String | name of the repo Long id = 789L; // Long | id of the release +File attachment = new File("attachment_example"); // File | String name = "name_example"; // String | name of the attachment try { - Attachment result = apiInstance.repoCreateReleaseAttachment(attachment, owner, repo, id, name); + Attachment result = apiInstance.repoCreateReleaseAttachment(owner, repo, id, attachment, name); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling RepositoryApi#repoCreateReleaseAttachment"); @@ -2786,10 +2786,10 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **attachment** | **File**| | **owner** | **String**| owner of the repo | **repo** | **String**| name of the repo | **id** | **Long**| id of the release | + **attachment** | **File**| | [optional] **name** | **String**| name of the attachment | [optional] ### Return type @@ -2802,7 +2802,102 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: multipart/form-data + - **Content-Type**: multipart/form-data, application/octet-stream + - **Accept**: application/json + + +# **repoCreateReleaseAttachment** +> Attachment repoCreateReleaseAttachment(owner, repo, id, body, name) + +Create a release attachment + +### 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 +Long id = 789L; // Long | id of the release +IdAssetsBody2 body = new IdAssetsBody2(); // IdAssetsBody2 | +String name = "name_example"; // String | name of the attachment +try { + Attachment result = apiInstance.repoCreateReleaseAttachment(owner, repo, id, body, name); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling RepositoryApi#repoCreateReleaseAttachment"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **owner** | **String**| owner of the repo | + **repo** | **String**| name of the repo | + **id** | **Long**| id of the release | + **body** | [**IdAssetsBody2**](IdAssetsBody2.md)| | [optional] + **name** | **String**| name of the attachment | [optional] + +### Return type + +[**Attachment**](Attachment.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**: multipart/form-data, application/octet-stream - **Accept**: application/json 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 30c46b5..a0e12c6 100644 --- a/src/main/java/org/gitnex/tea4j/v2/apis/RepositoryApi.java +++ b/src/main/java/org/gitnex/tea4j/v2/apis/RepositoryApi.java @@ -50,6 +50,7 @@ import org.gitnex.tea4j.v2.models.GitBlobResponse; import org.gitnex.tea4j.v2.models.GitHook; import org.gitnex.tea4j.v2.models.GitTreeResponse; import org.gitnex.tea4j.v2.models.Hook; +import org.gitnex.tea4j.v2.models.IdAssetsBody2; import org.gitnex.tea4j.v2.models.Issue; import org.gitnex.tea4j.v2.models.IssueConfig; import org.gitnex.tea4j.v2.models.IssueConfigValidation; @@ -505,20 +506,39 @@ public interface RepositoryApi { /** * Create a release attachment * - * @param attachment (required) * @param owner owner of the repo (required) * @param repo name of the repo (required) * @param id id of the release (required) + * @param attachment (optional) * @param name name of the attachment (optional) * @return Call<Attachment> */ @retrofit2.http.Multipart @POST("repos/{owner}/{repo}/releases/{id}/assets") Call repoCreateReleaseAttachment( - @retrofit2.http.Part("attachment\"; filename=\"attachment") RequestBody attachment, @retrofit2.http.Path("owner") String owner, @retrofit2.http.Path("repo") String repo, @retrofit2.http.Path("id") Long id, + @retrofit2.http.Part("attachment\"; filename=\"attachment") RequestBody attachment, + @retrofit2.http.Query("name") String name); + + /** + * Create a release attachment + * + * @param owner owner of the repo (required) + * @param repo name of the repo (required) + * @param id id of the release (required) + * @param body (optional) + * @param name name of the attachment (optional) + * @return Call<Attachment> + */ + @retrofit2.http.Multipart + @POST("repos/{owner}/{repo}/releases/{id}/assets") + Call repoCreateReleaseAttachment( + @retrofit2.http.Path("owner") String owner, + @retrofit2.http.Path("repo") String repo, + @retrofit2.http.Path("id") Long id, + @retrofit2.http.Body IdAssetsBody2 body, @retrofit2.http.Query("name") String name); /** diff --git a/src/main/java/org/gitnex/tea4j/v2/models/IdAssetsBody1.java b/src/main/java/org/gitnex/tea4j/v2/models/IdAssetsBody1.java index fa300f4..0d7b98b 100644 --- a/src/main/java/org/gitnex/tea4j/v2/models/IdAssetsBody1.java +++ b/src/main/java/org/gitnex/tea4j/v2/models/IdAssetsBody1.java @@ -35,7 +35,7 @@ public class IdAssetsBody1 implements Serializable { * * @return attachment */ - @Schema(required = true, description = "attachment to upload") + @Schema(description = "attachment to upload") public File getAttachment() { return attachment; } diff --git a/src/main/java/org/gitnex/tea4j/v2/models/IdAssetsBody2.java b/src/main/java/org/gitnex/tea4j/v2/models/IdAssetsBody2.java new file mode 100644 index 0000000..63e72ef --- /dev/null +++ b/src/main/java/org/gitnex/tea4j/v2/models/IdAssetsBody2.java @@ -0,0 +1,83 @@ +/* + * 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.File; +import java.io.Serializable; +import java.util.Objects; + +/** IdAssetsBody2 */ +public class IdAssetsBody2 implements Serializable { + private static final long serialVersionUID = 1L; + + @SerializedName("attachment") + private File attachment = null; + + public IdAssetsBody2 attachment(File attachment) { + this.attachment = attachment; + return this; + } + + /** + * attachment to upload + * + * @return attachment + */ + @Schema(description = "attachment to upload") + public File getAttachment() { + return attachment; + } + + public void setAttachment(File attachment) { + this.attachment = attachment; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IdAssetsBody2 idAssetsBody2 = (IdAssetsBody2) o; + return Objects.equals(this.attachment, idAssetsBody2.attachment); + } + + @Override + public int hashCode() { + return Objects.hash(Objects.hashCode(attachment)); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IdAssetsBody2 {\n"); + + sb.append(" attachment: ").append(toIndentedString(attachment)).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 "); + } +}