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

com.fireblocks.sdk.model.WriteAbiFunction 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.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;
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;

/** WriteAbiFunction */
@JsonPropertyOrder({
    WriteAbiFunction.JSON_PROPERTY_STATE_MUTABILITY,
    WriteAbiFunction.JSON_PROPERTY_OUTPUTS,
    WriteAbiFunction.JSON_PROPERTY_TYPE,
    WriteAbiFunction.JSON_PROPERTY_NAME,
    WriteAbiFunction.JSON_PROPERTY_INPUTS,
    WriteAbiFunction.JSON_PROPERTY_DESCRIPTION
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class WriteAbiFunction {
    /** Gets or Sets stateMutability */
    public enum StateMutabilityEnum {
        PAYABLE("payable"),

        NONPAYABLE("nonpayable");

        private String value;

        StateMutabilityEnum(String value) {
            this.value = value;
        }

        @JsonValue
        public String getValue() {
            return value;
        }

        @Override
        public String toString() {
            return String.valueOf(value);
        }

        @JsonCreator
        public static StateMutabilityEnum fromValue(String value) {
            for (StateMutabilityEnum b : StateMutabilityEnum.values()) {
                if (b.value.equals(value)) {
                    return b;
                }
            }
            throw new IllegalArgumentException("Unexpected value '" + value + "'");
        }
    }

    public static final String JSON_PROPERTY_STATE_MUTABILITY = "stateMutability";
    private StateMutabilityEnum stateMutability;

    public static final String JSON_PROPERTY_OUTPUTS = "outputs";
    private List outputs;

    /** Gets or Sets type */
    public enum TypeEnum {
        FUNCTION("function");

        private String value;

        TypeEnum(String value) {
            this.value = value;
        }

        @JsonValue
        public String getValue() {
            return value;
        }

        @Override
        public String toString() {
            return String.valueOf(value);
        }

        @JsonCreator
        public static TypeEnum fromValue(String value) {
            for (TypeEnum b : TypeEnum.values()) {
                if (b.value.equals(value)) {
                    return b;
                }
            }
            throw new IllegalArgumentException("Unexpected value '" + value + "'");
        }
    }

    public static final String JSON_PROPERTY_TYPE = "type";
    private TypeEnum type;

    public static final String JSON_PROPERTY_NAME = "name";
    private String name;

    public static final String JSON_PROPERTY_INPUTS = "inputs";
    private List inputs = new ArrayList<>();

    public static final String JSON_PROPERTY_DESCRIPTION = "description";
    private String description;

    public WriteAbiFunction() {}

    public WriteAbiFunction stateMutability(StateMutabilityEnum stateMutability) {
        this.stateMutability = stateMutability;
        return this;
    }

    /**
     * Get stateMutability
     *
     * @return stateMutability
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_STATE_MUTABILITY)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public StateMutabilityEnum getStateMutability() {
        return stateMutability;
    }

    @JsonProperty(JSON_PROPERTY_STATE_MUTABILITY)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setStateMutability(StateMutabilityEnum stateMutability) {
        this.stateMutability = stateMutability;
    }

    public WriteAbiFunction outputs(List outputs) {
        this.outputs = outputs;
        return this;
    }

    public WriteAbiFunction addOutputsItem(Parameter outputsItem) {
        if (this.outputs == null) {
            this.outputs = new ArrayList<>();
        }
        this.outputs.add(outputsItem);
        return this;
    }

    /**
     * Get outputs
     *
     * @return outputs
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_OUTPUTS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public List getOutputs() {
        return outputs;
    }

    @JsonProperty(JSON_PROPERTY_OUTPUTS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setOutputs(List outputs) {
        this.outputs = outputs;
    }

    public WriteAbiFunction type(TypeEnum type) {
        this.type = type;
        return this;
    }

    /**
     * Get type
     *
     * @return type
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_TYPE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public TypeEnum getType() {
        return type;
    }

    @JsonProperty(JSON_PROPERTY_TYPE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setType(TypeEnum type) {
        this.type = type;
    }

    public WriteAbiFunction name(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get name
     *
     * @return name
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_NAME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getName() {
        return name;
    }

    @JsonProperty(JSON_PROPERTY_NAME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setName(String name) {
        this.name = name;
    }

    public WriteAbiFunction inputs(List inputs) {
        this.inputs = inputs;
        return this;
    }

    public WriteAbiFunction addInputsItem(ParameterWithValue inputsItem) {
        if (this.inputs == null) {
            this.inputs = new ArrayList<>();
        }
        this.inputs.add(inputsItem);
        return this;
    }

    /**
     * Get inputs
     *
     * @return inputs
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_INPUTS)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public List getInputs() {
        return inputs;
    }

    @JsonProperty(JSON_PROPERTY_INPUTS)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setInputs(List inputs) {
        this.inputs = inputs;
    }

    public WriteAbiFunction description(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get description
     *
     * @return description
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_DESCRIPTION)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getDescription() {
        return description;
    }

    @JsonProperty(JSON_PROPERTY_DESCRIPTION)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setDescription(String description) {
        this.description = description;
    }

    /** Return true if this WriteAbiFunction object is equal to o. */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        WriteAbiFunction writeAbiFunction = (WriteAbiFunction) o;
        return Objects.equals(this.stateMutability, writeAbiFunction.stateMutability)
                && Objects.equals(this.outputs, writeAbiFunction.outputs)
                && Objects.equals(this.type, writeAbiFunction.type)
                && Objects.equals(this.name, writeAbiFunction.name)
                && Objects.equals(this.inputs, writeAbiFunction.inputs)
                && Objects.equals(this.description, writeAbiFunction.description);
    }

    @Override
    public int hashCode() {
        return Objects.hash(stateMutability, outputs, type, name, inputs, description);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class WriteAbiFunction {\n");
        sb.append("    stateMutability: ").append(toIndentedString(stateMutability)).append("\n");
        sb.append("    outputs: ").append(toIndentedString(outputs)).append("\n");
        sb.append("    type: ").append(toIndentedString(type)).append("\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    inputs: ").append(toIndentedString(inputs)).append("\n");
        sb.append("    description: ").append(toIndentedString(description)).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 `stateMutability` to the URL query string
        if (getStateMutability() != null) {
            joiner.add(
                    String.format(
                            "%sstateMutability%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getStateMutability()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `outputs` to the URL query string
        if (getOutputs() != null) {
            for (int i = 0; i < getOutputs().size(); i++) {
                if (getOutputs().get(i) != null) {
                    joiner.add(
                            getOutputs()
                                    .get(i)
                                    .toUrlQueryString(
                                            String.format(
                                                    "%soutputs%s%s",
                                                    prefix,
                                                    suffix,
                                                    "".equals(suffix)
                                                            ? ""
                                                            : String.format(
                                                                    "%s%d%s",
                                                                    containerPrefix,
                                                                    i,
                                                                    containerSuffix))));
                }
            }
        }

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

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

        // add `inputs` to the URL query string
        if (getInputs() != null) {
            for (int i = 0; i < getInputs().size(); i++) {
                if (getInputs().get(i) != null) {
                    joiner.add(
                            getInputs()
                                    .get(i)
                                    .toUrlQueryString(
                                            String.format(
                                                    "%sinputs%s%s",
                                                    prefix,
                                                    suffix,
                                                    "".equals(suffix)
                                                            ? ""
                                                            : String.format(
                                                                    "%s%d%s",
                                                                    containerPrefix,
                                                                    i,
                                                                    containerSuffix))));
                }
            }
        }

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

        return joiner.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy