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

com.github.twitch4j.graphql.internal.FetchPollQuery Maven / Gradle / Ivy

The 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.github.twitch4j.graphql.internal;

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.github.twitch4j.graphql.internal.type.CustomType;
import com.github.twitch4j.graphql.internal.type.PollStatus;
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 FetchPollQuery implements Query {
  public static final String OPERATION_ID = "df9b86ea8daa191b393a5396a8c085d0a190c1be8a0ff273fcf054cd1de595ad";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "query fetchPoll($id: ID!) {\n"
        + "  poll(id: $id) {\n"
        + "    __typename\n"
        + "    id\n"
        + "    status\n"
        + "    title\n"
        + "    ownedBy {\n"
        + "      __typename\n"
        + "      id\n"
        + "      login\n"
        + "      displayName\n"
        + "    }\n"
        + "    durationSeconds\n"
        + "    endedAt\n"
        + "    startedAt\n"
        + "    totalVoters\n"
        + "    choices {\n"
        + "      __typename\n"
        + "      id\n"
        + "      title\n"
        + "      votes {\n"
        + "        __typename\n"
        + "        id\n"
        + "        base\n"
        + "        bits\n"
        + "        total\n"
        + "      }\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

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

  private final FetchPollQuery.Variables variables;

  public FetchPollQuery(@NotNull String id) {
    Utils.checkNotNull(id, "id == null");
    variables = new FetchPollQuery.Variables(id);
  }

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

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

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

  @Override
  public FetchPollQuery.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 String id;

    Builder() {
    }

    public Builder id(@NotNull String id) {
      this.id = id;
      return this;
    }

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

  public static final class Variables extends Operation.Variables {
    private final @NotNull String id;

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

    Variables(@NotNull String id) {
      this.id = id;
      this.valueMap.put("id", id);
    }

    public @NotNull String id() {
      return id;
    }

    @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("id", com.github.twitch4j.graphql.internal.type.CustomType.ID, id);
        }
      };
    }
  }

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

    final @Nullable Poll poll;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@Nullable Poll poll) {
      this.poll = poll;
    }

    /**
     * Returns a poll by its ID.
     */
    public @Nullable Poll poll() {
      return this.poll;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeObject($responseFields[0], poll != null ? poll.marshaller() : null);
        }
      };
    }

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final Poll.Mapper pollFieldMapper = new Poll.Mapper();

      @Override
      public Data map(ResponseReader reader) {
        final Poll poll = reader.readObject($responseFields[0], new ResponseReader.ObjectReader() {
          @Override
          public Poll read(ResponseReader reader) {
            return pollFieldMapper.map(reader);
          }
        });
        return new Data(poll);
      }
    }
  }

  /**
   * A poll users can vote in.
   */
  public static class Poll {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forString("status", "status", null, false, Collections.emptyList()),
      ResponseField.forString("title", "title", null, false, Collections.emptyList()),
      ResponseField.forObject("ownedBy", "ownedBy", null, true, Collections.emptyList()),
      ResponseField.forInt("durationSeconds", "durationSeconds", null, false, Collections.emptyList()),
      ResponseField.forCustomType("endedAt", "endedAt", null, true, CustomType.TIME, Collections.emptyList()),
      ResponseField.forCustomType("startedAt", "startedAt", null, false, CustomType.TIME, Collections.emptyList()),
      ResponseField.forInt("totalVoters", "totalVoters", null, false, Collections.emptyList()),
      ResponseField.forList("choices", "choices", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final @NotNull PollStatus status;

    final @NotNull String title;

    final @Nullable OwnedBy ownedBy;

    final int durationSeconds;

    final @Nullable Object endedAt;

    final @NotNull Object startedAt;

    final int totalVoters;

    final @NotNull List choices;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Poll(@NotNull String __typename, @NotNull String id, @NotNull PollStatus status,
        @NotNull String title, @Nullable OwnedBy ownedBy, int durationSeconds,
        @Nullable Object endedAt, @NotNull Object startedAt, int totalVoters,
        @NotNull List choices) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.id = Utils.checkNotNull(id, "id == null");
      this.status = Utils.checkNotNull(status, "status == null");
      this.title = Utils.checkNotNull(title, "title == null");
      this.ownedBy = ownedBy;
      this.durationSeconds = durationSeconds;
      this.endedAt = endedAt;
      this.startedAt = Utils.checkNotNull(startedAt, "startedAt == null");
      this.totalVoters = totalVoters;
      this.choices = Utils.checkNotNull(choices, "choices == null");
    }

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

    /**
     * ID of poll.
     */
    public @NotNull String id() {
      return this.id;
    }

    /**
     * The status of the poll.
     */
    public @NotNull PollStatus status() {
      return this.status;
    }

    /**
     * Title of poll.
     */
    public @NotNull String title() {
      return this.title;
    }

    /**
     * User who owns this poll. The poll will appear on their channel.
     */
    public @Nullable OwnedBy ownedBy() {
      return this.ownedBy;
    }

    /**
     * Amount of seconds from when the poll starts to when it ends.
     * Since a broadcaster can end a poll early ("terminate a poll"), it may be possible for endedAt - startedAt != duration.
     */
    public int durationSeconds() {
      return this.durationSeconds;
    }

    /**
     * Time when the poll ended.
     * Null if the poll is still active.
     */
    public @Nullable Object endedAt() {
      return this.endedAt;
    }

    /**
     * Time when poll started.
     */
    public @NotNull Object startedAt() {
      return this.startedAt;
    }

    /**
     * Total number of unique voters that have voted in this poll.
     */
    public int totalVoters() {
      return this.totalVoters;
    }

    /**
     * A list of choices users can vote for.
     */
    public @NotNull List choices() {
      return this.choices;
    }

    @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], id);
          writer.writeString($responseFields[2], status.rawValue());
          writer.writeString($responseFields[3], title);
          writer.writeObject($responseFields[4], ownedBy != null ? ownedBy.marshaller() : null);
          writer.writeInt($responseFields[5], durationSeconds);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[6], endedAt);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[7], startedAt);
          writer.writeInt($responseFields[8], totalVoters);
          writer.writeList($responseFields[9], choices, new ResponseWriter.ListWriter() {
            @Override
            public void write(List items, ResponseWriter.ListItemWriter listItemWriter) {
              for (Object item : items) {
                listItemWriter.writeObject(((Choice) item).marshaller());
              }
            }
          });
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Poll{"
          + "__typename=" + __typename + ", "
          + "id=" + id + ", "
          + "status=" + status + ", "
          + "title=" + title + ", "
          + "ownedBy=" + ownedBy + ", "
          + "durationSeconds=" + durationSeconds + ", "
          + "endedAt=" + endedAt + ", "
          + "startedAt=" + startedAt + ", "
          + "totalVoters=" + totalVoters + ", "
          + "choices=" + choices
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Poll) {
        Poll that = (Poll) o;
        return this.__typename.equals(that.__typename)
         && this.id.equals(that.id)
         && this.status.equals(that.status)
         && this.title.equals(that.title)
         && ((this.ownedBy == null) ? (that.ownedBy == null) : this.ownedBy.equals(that.ownedBy))
         && this.durationSeconds == that.durationSeconds
         && ((this.endedAt == null) ? (that.endedAt == null) : this.endedAt.equals(that.endedAt))
         && this.startedAt.equals(that.startedAt)
         && this.totalVoters == that.totalVoters
         && this.choices.equals(that.choices);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= id.hashCode();
        h *= 1000003;
        h ^= status.hashCode();
        h *= 1000003;
        h ^= title.hashCode();
        h *= 1000003;
        h ^= (ownedBy == null) ? 0 : ownedBy.hashCode();
        h *= 1000003;
        h ^= durationSeconds;
        h *= 1000003;
        h ^= (endedAt == null) ? 0 : endedAt.hashCode();
        h *= 1000003;
        h ^= startedAt.hashCode();
        h *= 1000003;
        h ^= totalVoters;
        h *= 1000003;
        h ^= choices.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      final OwnedBy.Mapper ownedByFieldMapper = new OwnedBy.Mapper();

      final Choice.Mapper choiceFieldMapper = new Choice.Mapper();

      @Override
      public Poll map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        final String statusStr = reader.readString($responseFields[2]);
        final PollStatus status;
        if (statusStr != null) {
          status = PollStatus.safeValueOf(statusStr);
        } else {
          status = null;
        }
        final String title = reader.readString($responseFields[3]);
        final OwnedBy ownedBy = reader.readObject($responseFields[4], new ResponseReader.ObjectReader() {
          @Override
          public OwnedBy read(ResponseReader reader) {
            return ownedByFieldMapper.map(reader);
          }
        });
        final int durationSeconds = reader.readInt($responseFields[5]);
        final Object endedAt = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[6]);
        final Object startedAt = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[7]);
        final int totalVoters = reader.readInt($responseFields[8]);
        final List choices = reader.readList($responseFields[9], new ResponseReader.ListReader() {
          @Override
          public Choice read(ResponseReader.ListItemReader listItemReader) {
            return listItemReader.readObject(new ResponseReader.ObjectReader() {
              @Override
              public Choice read(ResponseReader reader) {
                return choiceFieldMapper.map(reader);
              }
            });
          }
        });
        return new Poll(__typename, id, status, title, ownedBy, durationSeconds, endedAt, startedAt, totalVoters, choices);
      }
    }
  }

  /**
   * Twitch user.
   */
  public static class OwnedBy {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forString("login", "login", null, false, Collections.emptyList()),
      ResponseField.forString("displayName", "displayName", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final @NotNull String login;

    final @NotNull String displayName;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public OwnedBy(@NotNull String __typename, @NotNull String id, @NotNull String login,
        @NotNull String displayName) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.id = Utils.checkNotNull(id, "id == null");
      this.login = Utils.checkNotNull(login, "login == null");
      this.displayName = Utils.checkNotNull(displayName, "displayName == null");
    }

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

    /**
     * The user's unique identifier.
     */
    public @NotNull String id() {
      return this.id;
    }

    /**
     * The user's standard alphanumeric Twitch name.
     */
    public @NotNull String login() {
      return this.login;
    }

    /**
     * A user-styled version of their login.
     * For international users, this could be the user's login with localized characters.
     */
    public @NotNull String displayName() {
      return this.displayName;
    }

    @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], id);
          writer.writeString($responseFields[2], login);
          writer.writeString($responseFields[3], displayName);
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "OwnedBy{"
          + "__typename=" + __typename + ", "
          + "id=" + id + ", "
          + "login=" + login + ", "
          + "displayName=" + displayName
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof OwnedBy) {
        OwnedBy that = (OwnedBy) o;
        return this.__typename.equals(that.__typename)
         && this.id.equals(that.id)
         && this.login.equals(that.login)
         && this.displayName.equals(that.displayName);
      }
      return false;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public OwnedBy map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        final String login = reader.readString($responseFields[2]);
        final String displayName = reader.readString($responseFields[3]);
        return new OwnedBy(__typename, id, login, displayName);
      }
    }
  }

  /**
   * A choice in a poll that users can vote for.
   */
  public static class Choice {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forString("title", "title", null, false, Collections.emptyList()),
      ResponseField.forObject("votes", "votes", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final @NotNull String title;

    final @NotNull Votes votes;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Choice(@NotNull String __typename, @NotNull String id, @NotNull String title,
        @NotNull Votes votes) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.id = Utils.checkNotNull(id, "id == null");
      this.title = Utils.checkNotNull(title, "title == null");
      this.votes = Utils.checkNotNull(votes, "votes == null");
    }

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

    /**
     * ID of choice.
     */
    public @NotNull String id() {
      return this.id;
    }

    /**
     * The title of the choice.
     */
    public @NotNull String title() {
      return this.title;
    }

    /**
     * A breakdown of the different votes cast for this choice.
     */
    public @NotNull Votes votes() {
      return this.votes;
    }

    @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], id);
          writer.writeString($responseFields[2], title);
          writer.writeObject($responseFields[3], votes.marshaller());
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Choice{"
          + "__typename=" + __typename + ", "
          + "id=" + id + ", "
          + "title=" + title + ", "
          + "votes=" + votes
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Choice) {
        Choice that = (Choice) o;
        return this.__typename.equals(that.__typename)
         && this.id.equals(that.id)
         && this.title.equals(that.title)
         && this.votes.equals(that.votes);
      }
      return false;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      final Votes.Mapper votesFieldMapper = new Votes.Mapper();

      @Override
      public Choice map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        final String title = reader.readString($responseFields[2]);
        final Votes votes = reader.readObject($responseFields[3], new ResponseReader.ObjectReader() {
          @Override
          public Votes read(ResponseReader reader) {
            return votesFieldMapper.map(reader);
          }
        });
        return new Choice(__typename, id, title, votes);
      }
    }
  }

  /**
   * A breakdown of votes cast for/by this poll/choice/user.
   */
  public static class Votes {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forInt("base", "base", null, false, Collections.emptyList()),
      ResponseField.forInt("bits", "bits", null, false, Collections.emptyList()),
      ResponseField.forInt("total", "total", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final int base;

    final int bits;

    final int total;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Votes(@NotNull String __typename, @NotNull String id, int base, int bits, int total) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.id = Utils.checkNotNull(id, "id == null");
      this.base = base;
      this.bits = bits;
      this.total = total;
    }

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

    /**
     * ID of vote breakdown.
     */
    public @NotNull String id() {
      return this.id;
    }

    /**
     * Total number of base votes.
     */
    public int base() {
      return this.base;
    }

    /**
     * Total number of votes due to bits contributions.
     */
    public int bits() {
      return this.bits;
    }

    /**
     * Total number of votes across all different vote types.
     */
    public int total() {
      return this.total;
    }

    @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], id);
          writer.writeInt($responseFields[2], base);
          writer.writeInt($responseFields[3], bits);
          writer.writeInt($responseFields[4], total);
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Votes{"
          + "__typename=" + __typename + ", "
          + "id=" + id + ", "
          + "base=" + base + ", "
          + "bits=" + bits + ", "
          + "total=" + total
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Votes) {
        Votes that = (Votes) o;
        return this.__typename.equals(that.__typename)
         && this.id.equals(that.id)
         && this.base == that.base
         && this.bits == that.bits
         && this.total == that.total;
      }
      return false;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Votes map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        final int base = reader.readInt($responseFields[2]);
        final int bits = reader.readInt($responseFields[3]);
        final int total = reader.readInt($responseFields[4]);
        return new Votes(__typename, id, base, bits, total);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy