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

com.bloxbean.cardano.gql.BlockByNumberQuery 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.fragment.BlockFragment;
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;

public final class BlockByNumberQuery implements Query {
  public static final String OPERATION_ID = "ede386f9000c72ba7f8a3268e360ed66bab413f781b31094accfc7d01a3e3f0c";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "query BlockByNumberQuery($number: Int!) {\n"
        + "  blocks(limit: 1, where: {number: {_eq: $number}}) {\n"
        + "    __typename\n"
        + "    ...BlockFragment\n"
        + "  }\n"
        + "}\n"
        + "fragment BlockFragment on Block {\n"
        + "  __typename\n"
        + "  forgedAt\n"
        + "  number\n"
        + "  hash\n"
        + "  slotNo\n"
        + "  epoch {\n"
        + "    __typename\n"
        + "    number\n"
        + "  }\n"
        + "  slotInEpoch\n"
        + "  slotLeader {\n"
        + "    __typename\n"
        + "    hash\n"
        + "  }\n"
        + "  size\n"
        + "  transactionsCount\n"
        + "  fees\n"
        + "  vrfKey\n"
        + "  previousBlock {\n"
        + "    __typename\n"
        + "    hash\n"
        + "  }\n"
        + "  nextBlock {\n"
        + "    __typename\n"
        + "    hash\n"
        + "  }\n"
        + "}"
  );

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

  private final BlockByNumberQuery.Variables variables;

  public BlockByNumberQuery(int number) {
    variables = new BlockByNumberQuery.Variables(number);
  }

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

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

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

  @Override
  public BlockByNumberQuery.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 int number;

    Builder() {
    }

    public Builder number(int number) {
      this.number = number;
      return this;
    }

    public BlockByNumberQuery build() {
      return new BlockByNumberQuery(number);
    }
  }

  public static final class Variables extends Operation.Variables {
    private final int number;

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

    Variables(int number) {
      this.number = number;
      this.valueMap.put("number", number);
    }

    public int number() {
      return number;
    }

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

    @Override
    public InputFieldMarshaller marshaller() {
      return new InputFieldMarshaller() {
        @Override
        public void marshal(InputFieldWriter writer) throws IOException {
          writer.writeInt("number", number);
        }
      };
    }
  }

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

    final @NotNull List blocks;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final Block.Mapper blockFieldMapper = new Block.Mapper();

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

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

    final @NotNull String __typename;

    private final @NotNull Fragments fragments;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Block(@NotNull String __typename, @NotNull Fragments fragments) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.fragments = Utils.checkNotNull(fragments, "fragments == null");
    }

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

    public @NotNull Fragments fragments() {
      return this.fragments;
    }

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

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

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

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

    public static class Fragments {
      final @NotNull BlockFragment blockFragment;

      private transient volatile String $toString;

      private transient volatile int $hashCode;

      private transient volatile boolean $hashCodeMemoized;

      public Fragments(@NotNull BlockFragment blockFragment) {
        this.blockFragment = Utils.checkNotNull(blockFragment, "blockFragment == null");
      }

      public @NotNull BlockFragment blockFragment() {
        return this.blockFragment;
      }

      public ResponseFieldMarshaller marshaller() {
        return new ResponseFieldMarshaller() {
          @Override
          public void marshal(ResponseWriter writer) {
            writer.writeFragment(blockFragment.marshaller());
          }
        };
      }

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

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

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

      public static final class Mapper implements ResponseFieldMapper {
        static final ResponseField[] $responseFields = {
          ResponseField.forFragment("__typename", "__typename", Collections.emptyList())
        };

        final BlockFragment.Mapper blockFragmentFieldMapper = new BlockFragment.Mapper();

        @Override
        public @NotNull Fragments map(ResponseReader reader) {
          final BlockFragment blockFragment = reader.readFragment($responseFields[0], new ResponseReader.ObjectReader() {
            @Override
            public BlockFragment read(ResponseReader reader) {
              return blockFragmentFieldMapper.map(reader);
            }
          });
          return new Fragments(blockFragment);
        }
      }
    }

    public static final class Mapper implements ResponseFieldMapper {
      final Fragments.Mapper fragmentsFieldMapper = new Fragments.Mapper();

      @Override
      public Block map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Fragments fragments = fragmentsFieldMapper.map(reader);
        return new Block(__typename, fragments);
      }
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy