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

com.bloxbean.cardano.gql.AssetQuery Maven / Gradle / Ivy

There is a newer version: 0.3.0-beta1
Show newest version
// AUTO-GENERATED FILE. DO NOT MODIFY.
//
// This class was automatically generated by Apollo GraphQL plugin from the GraphQL queries it found.
// It should not be modified by hand.
//
package com.bloxbean.cardano.gql;

import com.apollographql.apollo.api.Operation;
import com.apollographql.apollo.api.OperationName;
import com.apollographql.apollo.api.Query;
import com.apollographql.apollo.api.Response;
import com.apollographql.apollo.api.ResponseField;
import com.apollographql.apollo.api.ScalarTypeAdapters;
import com.apollographql.apollo.api.internal.InputFieldMarshaller;
import com.apollographql.apollo.api.internal.InputFieldWriter;
import com.apollographql.apollo.api.internal.OperationRequestBodyComposer;
import com.apollographql.apollo.api.internal.QueryDocumentMinifier;
import com.apollographql.apollo.api.internal.ResponseFieldMapper;
import com.apollographql.apollo.api.internal.ResponseFieldMarshaller;
import com.apollographql.apollo.api.internal.ResponseReader;
import com.apollographql.apollo.api.internal.ResponseWriter;
import com.apollographql.apollo.api.internal.SimpleOperationResponseParser;
import com.apollographql.apollo.api.internal.UnmodifiableMapBuilder;
import com.apollographql.apollo.api.internal.Utils;
import com.bloxbean.cardano.gql.type.CustomType;
import java.io.IOException;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class AssetQuery implements Query {
  public static final String OPERATION_ID = "a104522a253a907e01354b6ec67f80c9f959a04ba31b4397957711e52d9195a4";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "query AssetQuery($assetId: Hex!) {\n"
        + "  assets(where: {assetId: {_eq: $assetId}}) {\n"
        + "    __typename\n"
        + "    assetId\n"
        + "    policyId\n"
        + "    assetName\n"
        + "    fingerprint\n"
        + "    tokenMints {\n"
        + "      __typename\n"
        + "      transaction {\n"
        + "        __typename\n"
        + "        hash\n"
        + "      }\n"
        + "    }\n"
        + "    tokenMints {\n"
        + "      __typename\n"
        + "      quantity\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

  public static final OperationName OPERATION_NAME = new OperationName() {
    @Override
    public String name() {
      return "AssetQuery";
    }
  };

  private final AssetQuery.Variables variables;

  public AssetQuery(@NotNull Object assetId) {
    Utils.checkNotNull(assetId, "assetId == null");
    variables = new AssetQuery.Variables(assetId);
  }

  @Override
  public String operationId() {
    return OPERATION_ID;
  }

  @Override
  public String queryDocument() {
    return QUERY_DOCUMENT;
  }

  @Override
  public AssetQuery.Data wrapData(AssetQuery.Data data) {
    return data;
  }

  @Override
  public AssetQuery.Variables variables() {
    return variables;
  }

  @Override
  public ResponseFieldMapper responseFieldMapper() {
    return new Data.Mapper();
  }

  public static Builder builder() {
    return new Builder();
  }

  @Override
  public OperationName name() {
    return OPERATION_NAME;
  }

  @Override
  @NotNull
  public Response parse(@NotNull final BufferedSource source,
      @NotNull final ScalarTypeAdapters scalarTypeAdapters) throws IOException {
    return SimpleOperationResponseParser.parse(source, this, scalarTypeAdapters);
  }

  @Override
  @NotNull
  public Response parse(@NotNull final ByteString byteString,
      @NotNull final ScalarTypeAdapters scalarTypeAdapters) throws IOException {
    return parse(new Buffer().write(byteString), scalarTypeAdapters);
  }

  @Override
  @NotNull
  public Response parse(@NotNull final BufferedSource source) throws IOException {
    return parse(source, ScalarTypeAdapters.DEFAULT);
  }

  @Override
  @NotNull
  public Response parse(@NotNull final ByteString byteString) throws IOException {
    return parse(byteString, ScalarTypeAdapters.DEFAULT);
  }

  @Override
  @NotNull
  public ByteString composeRequestBody(@NotNull final ScalarTypeAdapters scalarTypeAdapters) {
    return OperationRequestBodyComposer.compose(this, false, true, scalarTypeAdapters);
  }

  @NotNull
  @Override
  public ByteString composeRequestBody() {
    return OperationRequestBodyComposer.compose(this, false, true, ScalarTypeAdapters.DEFAULT);
  }

  @Override
  @NotNull
  public ByteString composeRequestBody(final boolean autoPersistQueries,
      final boolean withQueryDocument, @NotNull final ScalarTypeAdapters scalarTypeAdapters) {
    return OperationRequestBodyComposer.compose(this, autoPersistQueries, withQueryDocument, scalarTypeAdapters);
  }

  public static final class Builder {
    private @NotNull Object assetId;

    Builder() {
    }

    public Builder assetId(@NotNull Object assetId) {
      this.assetId = assetId;
      return this;
    }

    public AssetQuery build() {
      Utils.checkNotNull(assetId, "assetId == null");
      return new AssetQuery(assetId);
    }
  }

  public static final class Variables extends Operation.Variables {
    private final @NotNull Object assetId;

    private final transient Map valueMap = new LinkedHashMap<>();

    Variables(@NotNull Object assetId) {
      this.assetId = assetId;
      this.valueMap.put("assetId", assetId);
    }

    public @NotNull Object assetId() {
      return assetId;
    }

    @Override
    public Map valueMap() {
      return Collections.unmodifiableMap(valueMap);
    }

    @Override
    public InputFieldMarshaller marshaller() {
      return new InputFieldMarshaller() {
        @Override
        public void marshal(InputFieldWriter writer) throws IOException {
          writer.writeCustom("assetId", com.bloxbean.cardano.gql.type.CustomType.HEX, assetId);
        }
      };
    }
  }

  /**
   * Data from the response after executing this GraphQL operation
   */
  public static class Data implements Operation.Data {
    static final ResponseField[] $responseFields = {
      ResponseField.forList("assets", "assets", new UnmodifiableMapBuilder(1)
      .put("where", new UnmodifiableMapBuilder(1)
        .put("assetId", new UnmodifiableMapBuilder(1)
          .put("_eq", new UnmodifiableMapBuilder(2)
            .put("kind", "Variable")
            .put("variableName", "assetId")
            .build())
          .build())
        .build())
      .build(), false, Collections.emptyList())
    };

    final @NotNull List assets;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@NotNull List assets) {
      this.assets = Utils.checkNotNull(assets, "assets == null");
    }

    public @NotNull List assets() {
      return this.assets;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeList($responseFields[0], assets, new ResponseWriter.ListWriter() {
            @Override
            public void write(List items, ResponseWriter.ListItemWriter listItemWriter) {
              for (Object item : items) {
                listItemWriter.writeObject(((Asset) item).marshaller());
              }
            }
          });
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Data{"
          + "assets=" + assets
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Data) {
        Data that = (Data) o;
        return this.assets.equals(that.assets);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= assets.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      final Asset.Mapper assetFieldMapper = new Asset.Mapper();

      @Override
      public Data map(ResponseReader reader) {
        final List assets = reader.readList($responseFields[0], new ResponseReader.ListReader() {
          @Override
          public Asset read(ResponseReader.ListItemReader listItemReader) {
            return listItemReader.readObject(new ResponseReader.ObjectReader() {
              @Override
              public Asset read(ResponseReader reader) {
                return assetFieldMapper.map(reader);
              }
            });
          }
        });
        return new Data(assets);
      }
    }
  }

  public static class Asset {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("assetId", "assetId", null, false, CustomType.HEX, Collections.emptyList()),
      ResponseField.forCustomType("policyId", "policyId", null, false, CustomType.HASH28HEX, Collections.emptyList()),
      ResponseField.forCustomType("assetName", "assetName", null, true, CustomType.HEX, Collections.emptyList()),
      ResponseField.forCustomType("fingerprint", "fingerprint", null, true, CustomType.ASSETFINGERPRINT, Collections.emptyList()),
      ResponseField.forList("tokenMints", "tokenMints", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull Object assetId;

    final @NotNull Object policyId;

    final @Nullable Object assetName;

    final @Nullable Object fingerprint;

    final @NotNull List tokenMints;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Asset(@NotNull String __typename, @NotNull Object assetId, @NotNull Object policyId,
        @Nullable Object assetName, @Nullable Object fingerprint,
        @NotNull List tokenMints) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.assetId = Utils.checkNotNull(assetId, "assetId == null");
      this.policyId = Utils.checkNotNull(policyId, "policyId == null");
      this.assetName = assetName;
      this.fingerprint = fingerprint;
      this.tokenMints = Utils.checkNotNull(tokenMints, "tokenMints == null");
    }

    public @NotNull String __typename() {
      return this.__typename;
    }

    public @NotNull Object assetId() {
      return this.assetId;
    }

    public @NotNull Object policyId() {
      return this.policyId;
    }

    public @Nullable Object assetName() {
      return this.assetName;
    }

    public @Nullable Object fingerprint() {
      return this.fingerprint;
    }

    public @NotNull List tokenMints() {
      return this.tokenMints;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeString($responseFields[0], __typename);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[1], assetId);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[2], policyId);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[3], assetName);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[4], fingerprint);
          writer.writeList($responseFields[5], tokenMints, new ResponseWriter.ListWriter() {
            @Override
            public void write(List items, ResponseWriter.ListItemWriter listItemWriter) {
              for (Object item : items) {
                listItemWriter.writeObject(((TokenMint) item).marshaller());
              }
            }
          });
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Asset{"
          + "__typename=" + __typename + ", "
          + "assetId=" + assetId + ", "
          + "policyId=" + policyId + ", "
          + "assetName=" + assetName + ", "
          + "fingerprint=" + fingerprint + ", "
          + "tokenMints=" + tokenMints
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Asset) {
        Asset that = (Asset) o;
        return this.__typename.equals(that.__typename)
         && this.assetId.equals(that.assetId)
         && this.policyId.equals(that.policyId)
         && ((this.assetName == null) ? (that.assetName == null) : this.assetName.equals(that.assetName))
         && ((this.fingerprint == null) ? (that.fingerprint == null) : this.fingerprint.equals(that.fingerprint))
         && this.tokenMints.equals(that.tokenMints);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= assetId.hashCode();
        h *= 1000003;
        h ^= policyId.hashCode();
        h *= 1000003;
        h ^= (assetName == null) ? 0 : assetName.hashCode();
        h *= 1000003;
        h ^= (fingerprint == null) ? 0 : fingerprint.hashCode();
        h *= 1000003;
        h ^= tokenMints.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      final TokenMint.Mapper tokenMintFieldMapper = new TokenMint.Mapper();

      @Override
      public Asset map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Object assetId = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        final Object policyId = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[2]);
        final Object assetName = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[3]);
        final Object fingerprint = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[4]);
        final List tokenMints = reader.readList($responseFields[5], new ResponseReader.ListReader() {
          @Override
          public TokenMint read(ResponseReader.ListItemReader listItemReader) {
            return listItemReader.readObject(new ResponseReader.ObjectReader() {
              @Override
              public TokenMint read(ResponseReader reader) {
                return tokenMintFieldMapper.map(reader);
              }
            });
          }
        });
        return new Asset(__typename, assetId, policyId, assetName, fingerprint, tokenMints);
      }
    }
  }

  public static class TokenMint {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forObject("transaction", "transaction", null, false, Collections.emptyList()),
      ResponseField.forString("quantity", "quantity", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull Transaction transaction;

    final @NotNull String quantity;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public TokenMint(@NotNull String __typename, @NotNull Transaction transaction,
        @NotNull String quantity) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.transaction = Utils.checkNotNull(transaction, "transaction == null");
      this.quantity = Utils.checkNotNull(quantity, "quantity == null");
    }

    public @NotNull String __typename() {
      return this.__typename;
    }

    public @NotNull Transaction transaction() {
      return this.transaction;
    }

    public @NotNull String quantity() {
      return this.quantity;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeString($responseFields[0], __typename);
          writer.writeObject($responseFields[1], transaction.marshaller());
          writer.writeString($responseFields[2], quantity);
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "TokenMint{"
          + "__typename=" + __typename + ", "
          + "transaction=" + transaction + ", "
          + "quantity=" + quantity
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof TokenMint) {
        TokenMint that = (TokenMint) o;
        return this.__typename.equals(that.__typename)
         && this.transaction.equals(that.transaction)
         && this.quantity.equals(that.quantity);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= transaction.hashCode();
        h *= 1000003;
        h ^= quantity.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      final Transaction.Mapper transactionFieldMapper = new Transaction.Mapper();

      @Override
      public TokenMint map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Transaction transaction = reader.readObject($responseFields[1], new ResponseReader.ObjectReader() {
          @Override
          public Transaction read(ResponseReader reader) {
            return transactionFieldMapper.map(reader);
          }
        });
        final String quantity = reader.readString($responseFields[2]);
        return new TokenMint(__typename, transaction, quantity);
      }
    }
  }

  public static class Transaction {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("hash", "hash", null, false, CustomType.HASH32HEX, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull Object hash;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Transaction(@NotNull String __typename, @NotNull Object hash) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.hash = Utils.checkNotNull(hash, "hash == null");
    }

    public @NotNull String __typename() {
      return this.__typename;
    }

    public @NotNull Object hash() {
      return this.hash;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeString($responseFields[0], __typename);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[1], hash);
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Transaction{"
          + "__typename=" + __typename + ", "
          + "hash=" + hash
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Transaction) {
        Transaction that = (Transaction) o;
        return this.__typename.equals(that.__typename)
         && this.hash.equals(that.hash);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= hash.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Transaction map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Object hash = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        return new Transaction(__typename, hash);
      }
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy