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

com.bloxbean.cardano.gql.MetadataQuery 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 com.fasterxml.jackson.databind.JsonNode;
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 MetadataQuery implements Query {
  public static final String OPERATION_ID = "938407ca7e9977e78f7fc38e564b44a9c58d5a4bed634acc05b3f7ee31f7dfe3";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "query MetadataQuery($txnhash: Hash32Hex!) {\n"
        + "  transactions(where: {hash: {_eq: $txnhash}}) {\n"
        + "    __typename\n"
        + "    metadata {\n"
        + "      __typename\n"
        + "      key\n"
        + "      value\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

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

  private final MetadataQuery.Variables variables;

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

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

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

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

  @Override
  public MetadataQuery.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 txnhash;

    Builder() {
    }

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

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

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

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

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

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

    @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("txnhash", com.bloxbean.cardano.gql.type.CustomType.HASH32HEX, txnhash);
        }
      };
    }
  }

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

    final @NotNull List transactions;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

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

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

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

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

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

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

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

    final @NotNull String __typename;

    final @Nullable List metadata;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Transaction(@NotNull String __typename, @Nullable List metadata) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.metadata = metadata;
    }

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

    public @Nullable List metadata() {
      return this.metadata;
    }

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

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Transaction{"
          + "__typename=" + __typename + ", "
          + "metadata=" + metadata
          + "}";
      }
      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.metadata == null) ? (that.metadata == null) : this.metadata.equals(that.metadata));
      }
      return false;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      final Metadatum.Mapper metadatumFieldMapper = new Metadatum.Mapper();

      @Override
      public Transaction map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final List metadata = reader.readList($responseFields[1], new ResponseReader.ListReader() {
          @Override
          public Metadatum read(ResponseReader.ListItemReader listItemReader) {
            return listItemReader.readObject(new ResponseReader.ObjectReader() {
              @Override
              public Metadatum read(ResponseReader reader) {
                return metadatumFieldMapper.map(reader);
              }
            });
          }
        });
        return new Transaction(__typename, metadata);
      }
    }
  }

  public static class Metadatum {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forString("key", "key", null, false, Collections.emptyList()),
      ResponseField.forCustomType("value", "value", null, false, CustomType.JSON, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String key;

    final @NotNull JsonNode value;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Metadatum(@NotNull String __typename, @NotNull String key, @NotNull JsonNode value) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.key = Utils.checkNotNull(key, "key == null");
      this.value = Utils.checkNotNull(value, "value == null");
    }

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

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

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

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

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Metadatum{"
          + "__typename=" + __typename + ", "
          + "key=" + key + ", "
          + "value=" + value
          + "}";
      }
      return $toString;
    }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy