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

com.fireblocks.sdk.model.CreateValidationKeyResponseDto Maven / Gradle / Ivy

/*
 * Fireblocks API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.6.2
 * 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.fireblocks.sdk.model;


import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

/** CreateValidationKeyResponseDto */
@JsonPropertyOrder({
    CreateValidationKeyResponseDto.JSON_PROPERTY_VALIDATION_KEY,
    CreateValidationKeyResponseDto.JSON_PROPERTY_ADMINS,
    CreateValidationKeyResponseDto.JSON_PROPERTY_APPROVAL_THRESHOLD,
    CreateValidationKeyResponseDto.JSON_PROPERTY_REQUEST_ID
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class CreateValidationKeyResponseDto {
    public static final String JSON_PROPERTY_VALIDATION_KEY = "validationKey";
    private ValidationKeyDto validationKey;

    public static final String JSON_PROPERTY_ADMINS = "admins";
    private List admins = new ArrayList<>();

    public static final String JSON_PROPERTY_APPROVAL_THRESHOLD = "approvalThreshold";
    private BigDecimal approvalThreshold;

    public static final String JSON_PROPERTY_REQUEST_ID = "requestId";
    private BigDecimal requestId;

    public CreateValidationKeyResponseDto() {}

    public CreateValidationKeyResponseDto validationKey(ValidationKeyDto validationKey) {
        this.validationKey = validationKey;
        return this;
    }

    /**
     * Created validation key
     *
     * @return validationKey
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_VALIDATION_KEY)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public ValidationKeyDto getValidationKey() {
        return validationKey;
    }

    @JsonProperty(JSON_PROPERTY_VALIDATION_KEY)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setValidationKey(ValidationKeyDto validationKey) {
        this.validationKey = validationKey;
    }

    public CreateValidationKeyResponseDto admins(List admins) {
        this.admins = admins;
        return this;
    }

    public CreateValidationKeyResponseDto addAdminsItem(String adminsItem) {
        if (this.admins == null) {
            this.admins = new ArrayList<>();
        }
        this.admins.add(adminsItem);
        return this;
    }

    /**
     * Admins who have to approve the validation key addition
     *
     * @return admins
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_ADMINS)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public List getAdmins() {
        return admins;
    }

    @JsonProperty(JSON_PROPERTY_ADMINS)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setAdmins(List admins) {
        this.admins = admins;
    }

    public CreateValidationKeyResponseDto approvalThreshold(BigDecimal approvalThreshold) {
        this.approvalThreshold = approvalThreshold;
        return this;
    }

    /**
     * Minimal number of approvers required. 0 for all minimum: 0
     *
     * @return approvalThreshold
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_APPROVAL_THRESHOLD)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public BigDecimal getApprovalThreshold() {
        return approvalThreshold;
    }

    @JsonProperty(JSON_PROPERTY_APPROVAL_THRESHOLD)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setApprovalThreshold(BigDecimal approvalThreshold) {
        this.approvalThreshold = approvalThreshold;
    }

    public CreateValidationKeyResponseDto requestId(BigDecimal requestId) {
        this.requestId = requestId;
        return this;
    }

    /**
     * Approval request id. Can be cancelled
     *
     * @return requestId
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_REQUEST_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public BigDecimal getRequestId() {
        return requestId;
    }

    @JsonProperty(JSON_PROPERTY_REQUEST_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setRequestId(BigDecimal requestId) {
        this.requestId = requestId;
    }

    /** Return true if this CreateValidationKeyResponseDto object is equal to o. */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CreateValidationKeyResponseDto createValidationKeyResponseDto =
                (CreateValidationKeyResponseDto) o;
        return Objects.equals(this.validationKey, createValidationKeyResponseDto.validationKey)
                && Objects.equals(this.admins, createValidationKeyResponseDto.admins)
                && Objects.equals(
                        this.approvalThreshold, createValidationKeyResponseDto.approvalThreshold)
                && Objects.equals(this.requestId, createValidationKeyResponseDto.requestId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(validationKey, admins, approvalThreshold, requestId);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class CreateValidationKeyResponseDto {\n");
        sb.append("    validationKey: ").append(toIndentedString(validationKey)).append("\n");
        sb.append("    admins: ").append(toIndentedString(admins)).append("\n");
        sb.append("    approvalThreshold: ")
                .append(toIndentedString(approvalThreshold))
                .append("\n");
        sb.append("    requestId: ").append(toIndentedString(requestId)).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(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

    /**
     * Convert the instance into URL query string.
     *
     * @return URL query string
     */
    public String toUrlQueryString() {
        return toUrlQueryString(null);
    }

    /**
     * Convert the instance into URL query string.
     *
     * @param prefix prefix of the query string
     * @return URL query string
     */
    public String toUrlQueryString(String prefix) {
        String suffix = "";
        String containerSuffix = "";
        String containerPrefix = "";
        if (prefix == null) {
            // style=form, explode=true, e.g. /pet?name=cat&type=manx
            prefix = "";
        } else {
            // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
            prefix = prefix + "[";
            suffix = "]";
            containerSuffix = "]";
            containerPrefix = "[";
        }

        StringJoiner joiner = new StringJoiner("&");

        // add `validationKey` to the URL query string
        if (getValidationKey() != null) {
            joiner.add(getValidationKey().toUrlQueryString(prefix + "validationKey" + suffix));
        }

        // add `admins` to the URL query string
        if (getAdmins() != null) {
            for (int i = 0; i < getAdmins().size(); i++) {
                joiner.add(
                        String.format(
                                "%sadmins%s%s=%s",
                                prefix,
                                suffix,
                                "".equals(suffix)
                                        ? ""
                                        : String.format(
                                                "%s%d%s", containerPrefix, i, containerSuffix),
                                URLEncoder.encode(
                                                String.valueOf(getAdmins().get(i)),
                                                StandardCharsets.UTF_8)
                                        .replaceAll("\\+", "%20")));
            }
        }

        // add `approvalThreshold` to the URL query string
        if (getApprovalThreshold() != null) {
            joiner.add(
                    String.format(
                            "%sapprovalThreshold%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getApprovalThreshold()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `requestId` to the URL query string
        if (getRequestId() != null) {
            joiner.add(
                    String.format(
                            "%srequestId%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getRequestId()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        return joiner.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy