All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hellosign.openapi.model.ApiAppListResponse Maven / Gradle / Ivy

Go to download

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 com.hellosign.openapi.model.ApiAppResponse;
import com.hellosign.openapi.model.ListInfoResponse;
import com.hellosign.openapi.model.WarningResponse;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.hellosign.openapi.JSON;


import com.hellosign.openapi.ApiException;
/**
 * ApiAppListResponse
 */
@JsonPropertyOrder({
    ApiAppListResponse.JSON_PROPERTY_API_APPS,
    ApiAppListResponse.JSON_PROPERTY_LIST_INFO,
    ApiAppListResponse.JSON_PROPERTY_WARNINGS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiAppListResponse {
  public static final String JSON_PROPERTY_API_APPS = "api_apps";
  private List apiApps = null;

  public static final String JSON_PROPERTY_LIST_INFO = "list_info";
  private ListInfoResponse listInfo;

  public static final String JSON_PROPERTY_WARNINGS = "warnings";
  private List warnings = null;

  public ApiAppListResponse() { 
  }

  public ApiAppListResponse apiApps(List apiApps) {
    this.apiApps = apiApps;
    return this;
  }

  public ApiAppListResponse addApiAppsItem(ApiAppResponse apiAppsItem) {
    if (this.apiApps == null) {
      this.apiApps = new ArrayList<>();
    }
    this.apiApps.add(apiAppsItem);
    return this;
  }

   /**
   * Contains information about API Apps.
   * @return apiApps
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Contains information about API Apps.")
  @JsonProperty(JSON_PROPERTY_API_APPS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List getApiApps() {
    return apiApps;
  }


  @JsonProperty(JSON_PROPERTY_API_APPS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setApiApps(List apiApps) {
    this.apiApps = apiApps;
  }


  public ApiAppListResponse listInfo(ListInfoResponse listInfo) {
    this.listInfo = listInfo;
    return this;
  }

   /**
   * Get listInfo
   * @return listInfo
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")
  @JsonProperty(JSON_PROPERTY_LIST_INFO)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public ListInfoResponse getListInfo() {
    return listInfo;
  }


  @JsonProperty(JSON_PROPERTY_LIST_INFO)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setListInfo(ListInfoResponse listInfo) {
    this.listInfo = listInfo;
  }


  public ApiAppListResponse warnings(List warnings) {
    this.warnings = warnings;
    return this;
  }

  public ApiAppListResponse addWarningsItem(WarningResponse warningsItem) {
    if (this.warnings == null) {
      this.warnings = new ArrayList<>();
    }
    this.warnings.add(warningsItem);
    return this;
  }

   /**
   * A list of warnings.
   * @return warnings
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "A list of warnings.")
  @JsonProperty(JSON_PROPERTY_WARNINGS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List getWarnings() {
    return warnings;
  }


  @JsonProperty(JSON_PROPERTY_WARNINGS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setWarnings(List warnings) {
    this.warnings = warnings;
  }


  /**
   * Return true if this ApiAppListResponse object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ApiAppListResponse apiAppListResponse = (ApiAppListResponse) o;
    return Objects.equals(this.apiApps, apiAppListResponse.apiApps) &&
        Objects.equals(this.listInfo, apiAppListResponse.listInfo) &&
        Objects.equals(this.warnings, apiAppListResponse.warnings);
  }

  @Override
  public int hashCode() {
    return Objects.hash(apiApps, listInfo, warnings);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ApiAppListResponse {\n");
    sb.append("    apiApps: ").append(toIndentedString(apiApps)).append("\n");
    sb.append("    listInfo: ").append(toIndentedString(listInfo)).append("\n");
    sb.append("    warnings: ").append(toIndentedString(warnings)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  public Map createFormData() throws ApiException {
    Map map = new HashMap<>();
    boolean fileTypeFound = false;
    try {
    if (apiApps != null) {
        if (isFileTypeOrListOfFiles(apiApps)) {
            fileTypeFound = true;
        }

        if (apiApps.getClass().equals(java.io.File.class) ||
            apiApps.getClass().equals(Integer.class) ||
            apiApps.getClass().equals(String.class) ) {
            map.put("api_apps", apiApps);
        } else if (isListOfFile(apiApps)) {
            for(int i = 0; i< getListSize(apiApps); i++) {
                map.put("api_apps[" + i + "]", getFromList(apiApps, i));
            }
        }
        else {
            map.put("api_apps", JSON.getDefault().getMapper().writeValueAsString(apiApps));
        }
    }
    if (listInfo != null) {
        if (isFileTypeOrListOfFiles(listInfo)) {
            fileTypeFound = true;
        }

        if (listInfo.getClass().equals(java.io.File.class) ||
            listInfo.getClass().equals(Integer.class) ||
            listInfo.getClass().equals(String.class) ) {
            map.put("list_info", listInfo);
        } else if (isListOfFile(listInfo)) {
            for(int i = 0; i< getListSize(listInfo); i++) {
                map.put("list_info[" + i + "]", getFromList(listInfo, i));
            }
        }
        else {
            map.put("list_info", JSON.getDefault().getMapper().writeValueAsString(listInfo));
        }
    }
    if (warnings != null) {
        if (isFileTypeOrListOfFiles(warnings)) {
            fileTypeFound = true;
        }

        if (warnings.getClass().equals(java.io.File.class) ||
            warnings.getClass().equals(Integer.class) ||
            warnings.getClass().equals(String.class) ) {
            map.put("warnings", warnings);
        } else if (isListOfFile(warnings)) {
            for(int i = 0; i< getListSize(warnings); i++) {
                map.put("warnings[" + i + "]", getFromList(warnings, i));
            }
        }
        else {
            map.put("warnings", JSON.getDefault().getMapper().writeValueAsString(warnings));
        }
    }
    } 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