com.hellosign.openapi.model.SubAttachment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hellosign-java-sdk Show documentation
Show all versions of hellosign-java-sdk Show documentation
Use the HelloSign Java SDK to connect your Java app to HelloSign's service in microseconds!
The newest version!
/*
* HelloSign API
* HelloSign v3 API
*
* The version of the OpenAPI document: 3.0.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.hellosign.openapi.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.hellosign.openapi.JSON;
import com.hellosign.openapi.ApiException;
/**
* SubAttachment
*/
@JsonPropertyOrder({
SubAttachment.JSON_PROPERTY_NAME,
SubAttachment.JSON_PROPERTY_SIGNER_INDEX,
SubAttachment.JSON_PROPERTY_INSTRUCTIONS,
SubAttachment.JSON_PROPERTY_REQUIRED
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class SubAttachment {
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public static final String JSON_PROPERTY_SIGNER_INDEX = "signer_index";
private Integer signerIndex;
public static final String JSON_PROPERTY_INSTRUCTIONS = "instructions";
private String instructions;
public static final String JSON_PROPERTY_REQUIRED = "required";
private Boolean required = false;
public SubAttachment() {
}
public SubAttachment name(String name) {
this.name = name;
return this;
}
/**
* The name of attachment.
* @return name
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "The name of attachment.")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setName(String name) {
this.name = name;
}
public SubAttachment signerIndex(Integer signerIndex) {
this.signerIndex = signerIndex;
return this;
}
/**
* The signer's index in the `signers` parameter (0-based indexing). **NOTE**: Only one signer can be assigned per attachment.
* @return signerIndex
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "The signer's index in the `signers` parameter (0-based indexing). **NOTE**: Only one signer can be assigned per attachment.")
@JsonProperty(JSON_PROPERTY_SIGNER_INDEX)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public Integer getSignerIndex() {
return signerIndex;
}
@JsonProperty(JSON_PROPERTY_SIGNER_INDEX)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setSignerIndex(Integer signerIndex) {
this.signerIndex = signerIndex;
}
public SubAttachment instructions(String instructions) {
this.instructions = instructions;
return this;
}
/**
* The instructions for uploading the attachment.
* @return instructions
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "The instructions for uploading the attachment.")
@JsonProperty(JSON_PROPERTY_INSTRUCTIONS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getInstructions() {
return instructions;
}
@JsonProperty(JSON_PROPERTY_INSTRUCTIONS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setInstructions(String instructions) {
this.instructions = instructions;
}
public SubAttachment required(Boolean required) {
this.required = required;
return this;
}
/**
* Determines if the attachment must be uploaded.
* @return required
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Determines if the attachment must be uploaded.")
@JsonProperty(JSON_PROPERTY_REQUIRED)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getRequired() {
return required;
}
@JsonProperty(JSON_PROPERTY_REQUIRED)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setRequired(Boolean required) {
this.required = required;
}
/**
* Return true if this SubAttachment object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SubAttachment subAttachment = (SubAttachment) o;
return Objects.equals(this.name, subAttachment.name) &&
Objects.equals(this.signerIndex, subAttachment.signerIndex) &&
Objects.equals(this.instructions, subAttachment.instructions) &&
Objects.equals(this.required, subAttachment.required);
}
@Override
public int hashCode() {
return Objects.hash(name, signerIndex, instructions, required);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SubAttachment {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" signerIndex: ").append(toIndentedString(signerIndex)).append("\n");
sb.append(" instructions: ").append(toIndentedString(instructions)).append("\n");
sb.append(" required: ").append(toIndentedString(required)).append("\n");
sb.append("}");
return sb.toString();
}
public Map createFormData() throws ApiException {
Map map = new HashMap<>();
boolean fileTypeFound = false;
try {
if (name != null) {
if (isFileTypeOrListOfFiles(name)) {
fileTypeFound = true;
}
if (name.getClass().equals(java.io.File.class) ||
name.getClass().equals(Integer.class) ||
name.getClass().equals(String.class) ) {
map.put("name", name);
} else if (isListOfFile(name)) {
for(int i = 0; i< getListSize(name); i++) {
map.put("name[" + i + "]", getFromList(name, i));
}
}
else {
map.put("name", JSON.getDefault().getMapper().writeValueAsString(name));
}
}
if (signerIndex != null) {
if (isFileTypeOrListOfFiles(signerIndex)) {
fileTypeFound = true;
}
if (signerIndex.getClass().equals(java.io.File.class) ||
signerIndex.getClass().equals(Integer.class) ||
signerIndex.getClass().equals(String.class) ) {
map.put("signer_index", signerIndex);
} else if (isListOfFile(signerIndex)) {
for(int i = 0; i< getListSize(signerIndex); i++) {
map.put("signer_index[" + i + "]", getFromList(signerIndex, i));
}
}
else {
map.put("signer_index", JSON.getDefault().getMapper().writeValueAsString(signerIndex));
}
}
if (instructions != null) {
if (isFileTypeOrListOfFiles(instructions)) {
fileTypeFound = true;
}
if (instructions.getClass().equals(java.io.File.class) ||
instructions.getClass().equals(Integer.class) ||
instructions.getClass().equals(String.class) ) {
map.put("instructions", instructions);
} else if (isListOfFile(instructions)) {
for(int i = 0; i< getListSize(instructions); i++) {
map.put("instructions[" + i + "]", getFromList(instructions, i));
}
}
else {
map.put("instructions", JSON.getDefault().getMapper().writeValueAsString(instructions));
}
}
if (required != null) {
if (isFileTypeOrListOfFiles(required)) {
fileTypeFound = true;
}
if (required.getClass().equals(java.io.File.class) ||
required.getClass().equals(Integer.class) ||
required.getClass().equals(String.class) ) {
map.put("required", required);
} else if (isListOfFile(required)) {
for(int i = 0; i< getListSize(required); i++) {
map.put("required[" + i + "]", getFromList(required, i));
}
}
else {
map.put("required", JSON.getDefault().getMapper().writeValueAsString(required));
}
}
} catch (Exception e) {
throw new ApiException(e);
}
return fileTypeFound ? map : new HashMap<>();
}
private boolean isFileTypeOrListOfFiles(Object obj) throws Exception {
return obj.getClass().equals(java.io.File.class) || isListOfFile(obj);
}
private boolean isListOfFile(Object obj) throws Exception {
return obj instanceof java.util.List && !isListEmpty(obj) && getFromList(obj, 0) instanceof java.io.File;
}
private boolean isListEmpty(Object obj) throws Exception {
return (boolean) Class.forName(java.util.List.class.getName()).getMethod("isEmpty").invoke(obj);
}
private Object getFromList(Object obj, int index) throws Exception {
return Class.forName(java.util.List.class.getName()).getMethod("get", int.class).invoke(obj, index);
}
private int getListSize(Object obj) throws Exception {
return (int) Class.forName(java.util.List.class.getName()).getMethod("size").invoke(obj);
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy