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

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

// 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.Input;
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.Integer;
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 UtxosQuery implements Query {
  public static final String OPERATION_ID = "1d1210efc7af09a52325d187283547ea49100b5fc87cd07c4c42972bdc4c9f26";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "query UtxosQuery($address:String, $limit: Int, $offset: Int) {\n"
        + "  utxos(limit: $limit, offset: $offset, where: {address: {_eq: $address}}) {\n"
        + "    __typename\n"
        + "    txHash\n"
        + "    index\n"
        + "    value\n"
        + "    tokens {\n"
        + "      __typename\n"
        + "      asset {\n"
        + "        __typename\n"
        + "        assetId\n"
        + "      }\n"
        + "      quantity\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

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

  private final UtxosQuery.Variables variables;

  public UtxosQuery(@NotNull Input address, @NotNull Input limit,
      @NotNull Input offset) {
    Utils.checkNotNull(address, "address == null");
    Utils.checkNotNull(limit, "limit == null");
    Utils.checkNotNull(offset, "offset == null");
    variables = new UtxosQuery.Variables(address, limit, offset);
  }

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

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

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

  @Override
  public UtxosQuery.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 Input address = Input.absent();

    private Input limit = Input.absent();

    private Input offset = Input.absent();

    Builder() {
    }

    public Builder address(@Nullable String address) {
      this.address = Input.fromNullable(address);
      return this;
    }

    public Builder limit(@Nullable Integer limit) {
      this.limit = Input.fromNullable(limit);
      return this;
    }

    public Builder offset(@Nullable Integer offset) {
      this.offset = Input.fromNullable(offset);
      return this;
    }

    public Builder addressInput(@NotNull Input address) {
      this.address = Utils.checkNotNull(address, "address == null");
      return this;
    }

    public Builder limitInput(@NotNull Input limit) {
      this.limit = Utils.checkNotNull(limit, "limit == null");
      return this;
    }

    public Builder offsetInput(@NotNull Input offset) {
      this.offset = Utils.checkNotNull(offset, "offset == null");
      return this;
    }

    public UtxosQuery build() {
      return new UtxosQuery(address, limit, offset);
    }
  }

  public static final class Variables extends Operation.Variables {
    private final Input address;

    private final Input limit;

    private final Input offset;

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

    Variables(Input address, Input limit, Input offset) {
      this.address = address;
      this.limit = limit;
      this.offset = offset;
      if (address.defined) {
        this.valueMap.put("address", address.value);
      }
      if (limit.defined) {
        this.valueMap.put("limit", limit.value);
      }
      if (offset.defined) {
        this.valueMap.put("offset", offset.value);
      }
    }

    public Input address() {
      return address;
    }

    public Input limit() {
      return limit;
    }

    public Input offset() {
      return offset;
    }

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

    @Override
    public InputFieldMarshaller marshaller() {
      return new InputFieldMarshaller() {
        @Override
        public void marshal(InputFieldWriter writer) throws IOException {
          if (address.defined) {
            writer.writeString("address", address.value);
          }
          if (limit.defined) {
            writer.writeInt("limit", limit.value);
          }
          if (offset.defined) {
            writer.writeInt("offset", offset.value);
          }
        }
      };
    }
  }

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

    final @NotNull List utxos;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final Utxo.Mapper utxoFieldMapper = new Utxo.Mapper();

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

  public static class Utxo {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("txHash", "txHash", null, false, CustomType.HASH32HEX, Collections.emptyList()),
      ResponseField.forInt("index", "index", null, false, Collections.emptyList()),
      ResponseField.forString("value", "value", null, false, Collections.emptyList()),
      ResponseField.forList("tokens", "tokens", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull Object txHash;

    final int index;

    final @NotNull String value;

    final @NotNull List tokens;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Utxo(@NotNull String __typename, @NotNull Object txHash, int index,
        @NotNull String value, @NotNull List tokens) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.txHash = Utils.checkNotNull(txHash, "txHash == null");
      this.index = index;
      this.value = Utils.checkNotNull(value, "value == null");
      this.tokens = Utils.checkNotNull(tokens, "tokens == null");
    }

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

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

    public int index() {
      return this.index;
    }

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

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

    @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], txHash);
          writer.writeInt($responseFields[2], index);
          writer.writeString($responseFields[3], value);
          writer.writeList($responseFields[4], tokens, new ResponseWriter.ListWriter() {
            @Override
            public void write(List items, ResponseWriter.ListItemWriter listItemWriter) {
              for (Object item : items) {
                listItemWriter.writeObject(((Token) item).marshaller());
              }
            }
          });
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Utxo{"
          + "__typename=" + __typename + ", "
          + "txHash=" + txHash + ", "
          + "index=" + index + ", "
          + "value=" + value + ", "
          + "tokens=" + tokens
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Utxo) {
        Utxo that = (Utxo) o;
        return this.__typename.equals(that.__typename)
         && this.txHash.equals(that.txHash)
         && this.index == that.index
         && this.value.equals(that.value)
         && this.tokens.equals(that.tokens);
      }
      return false;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      final Token.Mapper tokenFieldMapper = new Token.Mapper();

      @Override
      public Utxo map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Object txHash = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        final int index = reader.readInt($responseFields[2]);
        final String value = reader.readString($responseFields[3]);
        final List tokens = reader.readList($responseFields[4], new ResponseReader.ListReader() {
          @Override
          public Token read(ResponseReader.ListItemReader listItemReader) {
            return listItemReader.readObject(new ResponseReader.ObjectReader() {
              @Override
              public Token read(ResponseReader reader) {
                return tokenFieldMapper.map(reader);
              }
            });
          }
        });
        return new Utxo(__typename, txHash, index, value, tokens);
      }
    }
  }

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

    final @NotNull String __typename;

    final @NotNull Asset asset;

    final @NotNull String quantity;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Token(@NotNull String __typename, @NotNull Asset asset, @NotNull String quantity) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.asset = Utils.checkNotNull(asset, "asset == null");
      this.quantity = Utils.checkNotNull(quantity, "quantity == null");
    }

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

    public @NotNull Asset asset() {
      return this.asset;
    }

    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], asset.marshaller());
          writer.writeString($responseFields[2], quantity);
        }
      };
    }

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

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

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

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

      @Override
      public Token map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Asset asset = reader.readObject($responseFields[1], new ResponseReader.ObjectReader() {
          @Override
          public Asset read(ResponseReader reader) {
            return assetFieldMapper.map(reader);
          }
        });
        final String quantity = reader.readString($responseFields[2]);
        return new Token(__typename, asset, quantity);
      }
    }
  }

  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())
    };

    final @NotNull String __typename;

    final @NotNull Object assetId;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

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

    @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);
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Asset{"
          + "__typename=" + __typename + ", "
          + "assetId=" + assetId
          + "}";
      }
      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);
      }
      return false;
    }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy