com.huaweicloud.sdk.cloudide.v2.model.UploadExtensionFileRequestBody Maven / Gradle / Ivy
package com.huaweicloud.sdk.cloudide.v2.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.huaweicloud.sdk.core.http.FormDataFilePart;
import com.huaweicloud.sdk.core.http.FormDataPart;
import com.huaweicloud.sdk.core.http.SdkFormDataBody;
import java.io.InputStream;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
/**
* UploadExtensionFileRequestBody
*/
public class UploadExtensionFileRequestBody implements SdkFormDataBody {
@JsonProperty(value = "file", access = JsonProperty.Access.WRITE_ONLY)
private FormDataFilePart file;
public UploadExtensionFileRequestBody withFile(FormDataFilePart file) {
this.file = file;
return this;
}
/**
* 文件
* @return file
*/
public FormDataFilePart getFile() {
return file;
}
public void setFile(FormDataFilePart file) {
this.file = file;
}
public UploadExtensionFileRequestBody withFile(InputStream inputStream, String fileName, String contentType) {
this.file = new FormDataFilePart(inputStream, fileName).withContentType(contentType);
return this;
}
public UploadExtensionFileRequestBody withFile(InputStream inputStream, String fileName) {
this.file = new FormDataFilePart(inputStream, fileName);
return this;
}
public UploadExtensionFileRequestBody withFile(InputStream inputStream, String fileName,
Map headers) {
this.file = new FormDataFilePart(inputStream, fileName).withHeaders(headers);
return this;
}
@Override
public Map> buildFormData() {
return new LinkedHashMap>() {
private static final long serialVersionUID = 1L;
{
put("file", file);
}
};
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
UploadExtensionFileRequestBody that = (UploadExtensionFileRequestBody) obj;
return Objects.equals(this.file, that.file);
}
@Override
public int hashCode() {
return Objects.hash(file);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UploadExtensionFileRequestBody {\n");
sb.append(" file: ").append(toIndentedString("[resource:will-not-print]")).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 ");
}
}