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

com.fireblocks.sdk.model.TokenOwnershipResponse 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.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;

/** TokenOwnershipResponse */
@JsonPropertyOrder({
    TokenOwnershipResponse.JSON_PROPERTY_ID,
    TokenOwnershipResponse.JSON_PROPERTY_TOKEN_ID,
    TokenOwnershipResponse.JSON_PROPERTY_STANDARD,
    TokenOwnershipResponse.JSON_PROPERTY_METADATA_U_R_I,
    TokenOwnershipResponse.JSON_PROPERTY_CACHED_METADATA_U_R_I,
    TokenOwnershipResponse.JSON_PROPERTY_MEDIA,
    TokenOwnershipResponse.JSON_PROPERTY_SPAM,
    TokenOwnershipResponse.JSON_PROPERTY_COLLECTION,
    TokenOwnershipResponse.JSON_PROPERTY_BALANCE,
    TokenOwnershipResponse.JSON_PROPERTY_VAULT_ACCOUNT_ID,
    TokenOwnershipResponse.JSON_PROPERTY_OWNERSHIP_START_TIME,
    TokenOwnershipResponse.JSON_PROPERTY_OWNERSHIP_LAST_UPDATE_TIME,
    TokenOwnershipResponse.JSON_PROPERTY_BLOCKCHAIN_DESCRIPTOR,
    TokenOwnershipResponse.JSON_PROPERTY_DESCRIPTION,
    TokenOwnershipResponse.JSON_PROPERTY_NAME,
    TokenOwnershipResponse.JSON_PROPERTY_NCW_ID,
    TokenOwnershipResponse.JSON_PROPERTY_NCW_ACCOUNT_ID,
    TokenOwnershipResponse.JSON_PROPERTY_STATUS
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class TokenOwnershipResponse {
    public static final String JSON_PROPERTY_ID = "id";
    private String id;

    public static final String JSON_PROPERTY_TOKEN_ID = "tokenId";
    private String tokenId;

    public static final String JSON_PROPERTY_STANDARD = "standard";
    private String standard;

    public static final String JSON_PROPERTY_METADATA_U_R_I = "metadataURI";
    private String metadataURI;

    public static final String JSON_PROPERTY_CACHED_METADATA_U_R_I = "cachedMetadataURI";
    private String cachedMetadataURI;

    public static final String JSON_PROPERTY_MEDIA = "media";
    private List media;

    public static final String JSON_PROPERTY_SPAM = "spam";
    private SpamOwnershipResponse spam;

    public static final String JSON_PROPERTY_COLLECTION = "collection";
    private TokenCollectionResponse collection;

    public static final String JSON_PROPERTY_BALANCE = "balance";
    private String balance;

    public static final String JSON_PROPERTY_VAULT_ACCOUNT_ID = "vaultAccountId";
    private String vaultAccountId;

    public static final String JSON_PROPERTY_OWNERSHIP_START_TIME = "ownershipStartTime";
    private BigDecimal ownershipStartTime;

    public static final String JSON_PROPERTY_OWNERSHIP_LAST_UPDATE_TIME = "ownershipLastUpdateTime";
    private BigDecimal ownershipLastUpdateTime;

    /** Gets or Sets blockchainDescriptor */
    public enum BlockchainDescriptorEnum {
        ETH("ETH"),

        ETH_TEST3("ETH_TEST3"),

        ETH_TEST5("ETH_TEST5"),

        ETH_TEST6("ETH_TEST6"),

        POLYGON("POLYGON"),

        POLYGON_TEST_MUMBAI("POLYGON_TEST_MUMBAI"),

        AMOY_POLYGON_TEST("AMOY_POLYGON_TEST"),

        XTZ("XTZ"),

        XTZ_TEST("XTZ_TEST"),

        BASECHAIN_ETH("BASECHAIN_ETH"),

        BASECHAIN_ETH_TEST3("BASECHAIN_ETH_TEST3"),

        ETHERLINK("ETHERLINK"),

        ETHERLINK_TEST("ETHERLINK_TEST"),

        MANTLE("MANTLE"),

        MANTLE_TEST("MANTLE_TEST"),

        GUN_GUNZILLA_TEST("GUN_GUNZILLA_TEST");

        private String value;

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

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

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

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

    public static final String JSON_PROPERTY_BLOCKCHAIN_DESCRIPTOR = "blockchainDescriptor";
    private BlockchainDescriptorEnum blockchainDescriptor;

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

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

    public static final String JSON_PROPERTY_NCW_ID = "ncwId";
    private String ncwId;

    public static final String JSON_PROPERTY_NCW_ACCOUNT_ID = "ncwAccountId";
    private String ncwAccountId;

    /** Owned Token's status */
    public enum StatusEnum {
        LISTED("LISTED"),

        ARCHIVED("ARCHIVED");

        private String value;

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

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

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

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

    public static final String JSON_PROPERTY_STATUS = "status";
    private StatusEnum status;

    public TokenOwnershipResponse() {}

    public TokenOwnershipResponse id(String id) {
        this.id = id;
        return this;
    }

    /**
     * The Fireblocks NFT asset id
     *
     * @return id
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public String getId() {
        return id;
    }

    @JsonProperty(JSON_PROPERTY_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setId(String id) {
        this.id = id;
    }

    public TokenOwnershipResponse tokenId(String tokenId) {
        this.tokenId = tokenId;
        return this;
    }

    /**
     * Token id within the contract/collection
     *
     * @return tokenId
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_TOKEN_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public String getTokenId() {
        return tokenId;
    }

    @JsonProperty(JSON_PROPERTY_TOKEN_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setTokenId(String tokenId) {
        this.tokenId = tokenId;
    }

    public TokenOwnershipResponse standard(String standard) {
        this.standard = standard;
        return this;
    }

    /**
     * ERC721 / ERC1155
     *
     * @return standard
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_STANDARD)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public String getStandard() {
        return standard;
    }

    @JsonProperty(JSON_PROPERTY_STANDARD)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setStandard(String standard) {
        this.standard = standard;
    }

    public TokenOwnershipResponse metadataURI(String metadataURI) {
        this.metadataURI = metadataURI;
        return this;
    }

    /**
     * URL of the original token JSON metadata
     *
     * @return metadataURI
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_METADATA_U_R_I)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getMetadataURI() {
        return metadataURI;
    }

    @JsonProperty(JSON_PROPERTY_METADATA_U_R_I)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setMetadataURI(String metadataURI) {
        this.metadataURI = metadataURI;
    }

    public TokenOwnershipResponse cachedMetadataURI(String cachedMetadataURI) {
        this.cachedMetadataURI = cachedMetadataURI;
        return this;
    }

    /**
     * URL of the cached token JSON metadata
     *
     * @return cachedMetadataURI
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CACHED_METADATA_U_R_I)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getCachedMetadataURI() {
        return cachedMetadataURI;
    }

    @JsonProperty(JSON_PROPERTY_CACHED_METADATA_U_R_I)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCachedMetadataURI(String cachedMetadataURI) {
        this.cachedMetadataURI = cachedMetadataURI;
    }

    public TokenOwnershipResponse media(List media) {
        this.media = media;
        return this;
    }

    public TokenOwnershipResponse addMediaItem(MediaEntityResponse mediaItem) {
        if (this.media == null) {
            this.media = new ArrayList<>();
        }
        this.media.add(mediaItem);
        return this;
    }

    /**
     * Media items extracted from metadata JSON
     *
     * @return media
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_MEDIA)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public List getMedia() {
        return media;
    }

    @JsonProperty(JSON_PROPERTY_MEDIA)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setMedia(List media) {
        this.media = media;
    }

    public TokenOwnershipResponse spam(SpamOwnershipResponse spam) {
        this.spam = spam;
        return this;
    }

    /**
     * Owned Token's Spam status
     *
     * @return spam
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_SPAM)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public SpamOwnershipResponse getSpam() {
        return spam;
    }

    @JsonProperty(JSON_PROPERTY_SPAM)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setSpam(SpamOwnershipResponse spam) {
        this.spam = spam;
    }

    public TokenOwnershipResponse collection(TokenCollectionResponse collection) {
        this.collection = collection;
        return this;
    }

    /**
     * Parent collection information
     *
     * @return collection
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_COLLECTION)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public TokenCollectionResponse getCollection() {
        return collection;
    }

    @JsonProperty(JSON_PROPERTY_COLLECTION)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCollection(TokenCollectionResponse collection) {
        this.collection = collection;
    }

    public TokenOwnershipResponse balance(String balance) {
        this.balance = balance;
        return this;
    }

    /**
     * Get balance
     *
     * @return balance
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_BALANCE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public String getBalance() {
        return balance;
    }

    @JsonProperty(JSON_PROPERTY_BALANCE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setBalance(String balance) {
        this.balance = balance;
    }

    public TokenOwnershipResponse vaultAccountId(String vaultAccountId) {
        this.vaultAccountId = vaultAccountId;
        return this;
    }

    /**
     * Get vaultAccountId
     *
     * @return vaultAccountId
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_VAULT_ACCOUNT_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getVaultAccountId() {
        return vaultAccountId;
    }

    @JsonProperty(JSON_PROPERTY_VAULT_ACCOUNT_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setVaultAccountId(String vaultAccountId) {
        this.vaultAccountId = vaultAccountId;
    }

    public TokenOwnershipResponse ownershipStartTime(BigDecimal ownershipStartTime) {
        this.ownershipStartTime = ownershipStartTime;
        return this;
    }

    /**
     * Get ownershipStartTime
     *
     * @return ownershipStartTime
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_OWNERSHIP_START_TIME)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public BigDecimal getOwnershipStartTime() {
        return ownershipStartTime;
    }

    @JsonProperty(JSON_PROPERTY_OWNERSHIP_START_TIME)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setOwnershipStartTime(BigDecimal ownershipStartTime) {
        this.ownershipStartTime = ownershipStartTime;
    }

    public TokenOwnershipResponse ownershipLastUpdateTime(BigDecimal ownershipLastUpdateTime) {
        this.ownershipLastUpdateTime = ownershipLastUpdateTime;
        return this;
    }

    /**
     * Get ownershipLastUpdateTime
     *
     * @return ownershipLastUpdateTime
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_OWNERSHIP_LAST_UPDATE_TIME)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public BigDecimal getOwnershipLastUpdateTime() {
        return ownershipLastUpdateTime;
    }

    @JsonProperty(JSON_PROPERTY_OWNERSHIP_LAST_UPDATE_TIME)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setOwnershipLastUpdateTime(BigDecimal ownershipLastUpdateTime) {
        this.ownershipLastUpdateTime = ownershipLastUpdateTime;
    }

    public TokenOwnershipResponse blockchainDescriptor(
            BlockchainDescriptorEnum blockchainDescriptor) {
        this.blockchainDescriptor = blockchainDescriptor;
        return this;
    }

    /**
     * Get blockchainDescriptor
     *
     * @return blockchainDescriptor
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_BLOCKCHAIN_DESCRIPTOR)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public BlockchainDescriptorEnum getBlockchainDescriptor() {
        return blockchainDescriptor;
    }

    @JsonProperty(JSON_PROPERTY_BLOCKCHAIN_DESCRIPTOR)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setBlockchainDescriptor(BlockchainDescriptorEnum blockchainDescriptor) {
        this.blockchainDescriptor = blockchainDescriptor;
    }

    public TokenOwnershipResponse 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;
    }

    public TokenOwnershipResponse 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 TokenOwnershipResponse ncwId(String ncwId) {
        this.ncwId = ncwId;
        return this;
    }

    /**
     * Ownership Non-Custodial Wallet ID
     *
     * @return ncwId
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_NCW_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getNcwId() {
        return ncwId;
    }

    @JsonProperty(JSON_PROPERTY_NCW_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setNcwId(String ncwId) {
        this.ncwId = ncwId;
    }

    public TokenOwnershipResponse ncwAccountId(String ncwAccountId) {
        this.ncwAccountId = ncwAccountId;
        return this;
    }

    /**
     * Ownership Non-Custodial Wallet's account ID
     *
     * @return ncwAccountId
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_NCW_ACCOUNT_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getNcwAccountId() {
        return ncwAccountId;
    }

    @JsonProperty(JSON_PROPERTY_NCW_ACCOUNT_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setNcwAccountId(String ncwAccountId) {
        this.ncwAccountId = ncwAccountId;
    }

    public TokenOwnershipResponse status(StatusEnum status) {
        this.status = status;
        return this;
    }

    /**
     * Owned Token's status
     *
     * @return status
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_STATUS)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public StatusEnum getStatus() {
        return status;
    }

    @JsonProperty(JSON_PROPERTY_STATUS)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setStatus(StatusEnum status) {
        this.status = status;
    }

    /** Return true if this TokenOwnershipResponse object is equal to o. */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TokenOwnershipResponse tokenOwnershipResponse = (TokenOwnershipResponse) o;
        return Objects.equals(this.id, tokenOwnershipResponse.id)
                && Objects.equals(this.tokenId, tokenOwnershipResponse.tokenId)
                && Objects.equals(this.standard, tokenOwnershipResponse.standard)
                && Objects.equals(this.metadataURI, tokenOwnershipResponse.metadataURI)
                && Objects.equals(this.cachedMetadataURI, tokenOwnershipResponse.cachedMetadataURI)
                && Objects.equals(this.media, tokenOwnershipResponse.media)
                && Objects.equals(this.spam, tokenOwnershipResponse.spam)
                && Objects.equals(this.collection, tokenOwnershipResponse.collection)
                && Objects.equals(this.balance, tokenOwnershipResponse.balance)
                && Objects.equals(this.vaultAccountId, tokenOwnershipResponse.vaultAccountId)
                && Objects.equals(
                        this.ownershipStartTime, tokenOwnershipResponse.ownershipStartTime)
                && Objects.equals(
                        this.ownershipLastUpdateTime,
                        tokenOwnershipResponse.ownershipLastUpdateTime)
                && Objects.equals(
                        this.blockchainDescriptor, tokenOwnershipResponse.blockchainDescriptor)
                && Objects.equals(this.description, tokenOwnershipResponse.description)
                && Objects.equals(this.name, tokenOwnershipResponse.name)
                && Objects.equals(this.ncwId, tokenOwnershipResponse.ncwId)
                && Objects.equals(this.ncwAccountId, tokenOwnershipResponse.ncwAccountId)
                && Objects.equals(this.status, tokenOwnershipResponse.status);
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                id,
                tokenId,
                standard,
                metadataURI,
                cachedMetadataURI,
                media,
                spam,
                collection,
                balance,
                vaultAccountId,
                ownershipStartTime,
                ownershipLastUpdateTime,
                blockchainDescriptor,
                description,
                name,
                ncwId,
                ncwAccountId,
                status);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class TokenOwnershipResponse {\n");
        sb.append("    id: ").append(toIndentedString(id)).append("\n");
        sb.append("    tokenId: ").append(toIndentedString(tokenId)).append("\n");
        sb.append("    standard: ").append(toIndentedString(standard)).append("\n");
        sb.append("    metadataURI: ").append(toIndentedString(metadataURI)).append("\n");
        sb.append("    cachedMetadataURI: ")
                .append(toIndentedString(cachedMetadataURI))
                .append("\n");
        sb.append("    media: ").append(toIndentedString(media)).append("\n");
        sb.append("    spam: ").append(toIndentedString(spam)).append("\n");
        sb.append("    collection: ").append(toIndentedString(collection)).append("\n");
        sb.append("    balance: ").append(toIndentedString(balance)).append("\n");
        sb.append("    vaultAccountId: ").append(toIndentedString(vaultAccountId)).append("\n");
        sb.append("    ownershipStartTime: ")
                .append(toIndentedString(ownershipStartTime))
                .append("\n");
        sb.append("    ownershipLastUpdateTime: ")
                .append(toIndentedString(ownershipLastUpdateTime))
                .append("\n");
        sb.append("    blockchainDescriptor: ")
                .append(toIndentedString(blockchainDescriptor))
                .append("\n");
        sb.append("    description: ").append(toIndentedString(description)).append("\n");
        sb.append("    name: ").append(toIndentedString(name)).append("\n");
        sb.append("    ncwId: ").append(toIndentedString(ncwId)).append("\n");
        sb.append("    ncwAccountId: ").append(toIndentedString(ncwAccountId)).append("\n");
        sb.append("    status: ").append(toIndentedString(status)).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 `id` to the URL query string
        if (getId() != null) {
            joiner.add(
                    String.format(
                            "%sid%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

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

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

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

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

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

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

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

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

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

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

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

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

        // 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")));
        }

        // 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 `ncwId` to the URL query string
        if (getNcwId() != null) {
            joiner.add(
                    String.format(
                            "%sncwId%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(String.valueOf(getNcwId()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

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

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

        return joiner.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy