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

com.github.twitch4j.graphql.internal.CreatePredictionEventMutation 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.Mutation;
import com.apollographql.apollo.api.Operation;
import com.apollographql.apollo.api.OperationName;
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.CreatePredictionEventErrorCode;
import com.github.twitch4j.graphql.internal.type.CreatePredictionEventInput;
import com.github.twitch4j.graphql.internal.type.CustomType;
import com.github.twitch4j.graphql.internal.type.PredictionEventStatus;
import com.github.twitch4j.graphql.internal.type.PredictionOutcomeColor;
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 CreatePredictionEventMutation implements Mutation {
  public static final String OPERATION_ID = "246676883d2756491b510c2107b086d673df084f924307853eed93e9c9bea527";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "mutation createPredictionEvent($input: CreatePredictionEventInput!) {\n"
        + "  createPredictionEvent(input: $input) {\n"
        + "    __typename\n"
        + "    error {\n"
        + "      __typename\n"
        + "      code\n"
        + "    }\n"
        + "    predictionEvent {\n"
        + "      __typename\n"
        + "      channel {\n"
        + "        __typename\n"
        + "        id\n"
        + "      }\n"
        + "      createdAt\n"
        + "      id\n"
        + "      outcomes {\n"
        + "        __typename\n"
        + "        color\n"
        + "        id\n"
        + "        title\n"
        + "      }\n"
        + "      predictionWindowSeconds\n"
        + "      status\n"
        + "      title\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

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

  private final CreatePredictionEventMutation.Variables variables;

  public CreatePredictionEventMutation(@NotNull CreatePredictionEventInput input) {
    Utils.checkNotNull(input, "input == null");
    variables = new CreatePredictionEventMutation.Variables(input);
  }

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

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

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

  @Override
  public CreatePredictionEventMutation.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 CreatePredictionEventInput input;

    Builder() {
    }

    public Builder input(@NotNull CreatePredictionEventInput input) {
      this.input = input;
      return this;
    }

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

  public static final class Variables extends Operation.Variables {
    private final @NotNull CreatePredictionEventInput input;

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

    Variables(@NotNull CreatePredictionEventInput input) {
      this.input = input;
      this.valueMap.put("input", input);
    }

    public @NotNull CreatePredictionEventInput input() {
      return input;
    }

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

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

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

    final @Nullable CreatePredictionEvent createPredictionEvent;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@Nullable CreatePredictionEvent createPredictionEvent) {
      this.createPredictionEvent = createPredictionEvent;
    }

    /**
     * Create a new Prediction Event.
     */
    public @Nullable CreatePredictionEvent createPredictionEvent() {
      return this.createPredictionEvent;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final CreatePredictionEvent.Mapper createPredictionEventFieldMapper = new CreatePredictionEvent.Mapper();

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

  /**
   * Payload for creating a prediction event.
   */
  public static class CreatePredictionEvent {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forObject("error", "error", null, true, Collections.emptyList()),
      ResponseField.forObject("predictionEvent", "predictionEvent", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable Error error;

    final @Nullable PredictionEvent predictionEvent;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public CreatePredictionEvent(@NotNull String __typename, @Nullable Error error,
        @Nullable PredictionEvent predictionEvent) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.error = error;
      this.predictionEvent = predictionEvent;
    }

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

    /**
     * If present, there was an error with the request.
     */
    public @Nullable Error error() {
      return this.error;
    }

    /**
     * The created Prediction Event.
     */
    public @Nullable PredictionEvent predictionEvent() {
      return this.predictionEvent;
    }

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

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "CreatePredictionEvent{"
          + "__typename=" + __typename + ", "
          + "error=" + error + ", "
          + "predictionEvent=" + predictionEvent
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof CreatePredictionEvent) {
        CreatePredictionEvent that = (CreatePredictionEvent) o;
        return this.__typename.equals(that.__typename)
         && ((this.error == null) ? (that.error == null) : this.error.equals(that.error))
         && ((this.predictionEvent == null) ? (that.predictionEvent == null) : this.predictionEvent.equals(that.predictionEvent));
      }
      return false;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      final Error.Mapper errorFieldMapper = new Error.Mapper();

      final PredictionEvent.Mapper predictionEventFieldMapper = new PredictionEvent.Mapper();

      @Override
      public CreatePredictionEvent map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Error error = reader.readObject($responseFields[1], new ResponseReader.ObjectReader() {
          @Override
          public Error read(ResponseReader reader) {
            return errorFieldMapper.map(reader);
          }
        });
        final PredictionEvent predictionEvent = reader.readObject($responseFields[2], new ResponseReader.ObjectReader() {
          @Override
          public PredictionEvent read(ResponseReader reader) {
            return predictionEventFieldMapper.map(reader);
          }
        });
        return new CreatePredictionEvent(__typename, error, predictionEvent);
      }
    }
  }

  /**
   * An error returned from the createPredictionEvent mutation.
   */
  public static class Error {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forString("code", "code", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull CreatePredictionEventErrorCode code;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Error(@NotNull String __typename, @NotNull CreatePredictionEventErrorCode code) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.code = Utils.checkNotNull(code, "code == null");
    }

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

    /**
     * Code describing the error.
     */
    public @NotNull CreatePredictionEventErrorCode code() {
      return this.code;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Error map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String codeStr = reader.readString($responseFields[1]);
        final CreatePredictionEventErrorCode code;
        if (codeStr != null) {
          code = CreatePredictionEventErrorCode.safeValueOf(codeStr);
        } else {
          code = null;
        }
        return new Error(__typename, code);
      }
    }
  }

  /**
   * An Event that users can make Predictions on.
   */
  public static class PredictionEvent {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forObject("channel", "channel", null, true, Collections.emptyList()),
      ResponseField.forCustomType("createdAt", "createdAt", null, false, CustomType.TIME, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forList("outcomes", "outcomes", null, false, Collections.emptyList()),
      ResponseField.forInt("predictionWindowSeconds", "predictionWindowSeconds", null, false, Collections.emptyList()),
      ResponseField.forString("status", "status", null, false, Collections.emptyList()),
      ResponseField.forString("title", "title", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable Channel channel;

    final @NotNull Object createdAt;

    final @NotNull String id;

    final @NotNull List outcomes;

    final int predictionWindowSeconds;

    final @NotNull PredictionEventStatus status;

    final @NotNull String title;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public PredictionEvent(@NotNull String __typename, @Nullable Channel channel,
        @NotNull Object createdAt, @NotNull String id, @NotNull List outcomes,
        int predictionWindowSeconds, @NotNull PredictionEventStatus status, @NotNull String title) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.channel = channel;
      this.createdAt = Utils.checkNotNull(createdAt, "createdAt == null");
      this.id = Utils.checkNotNull(id, "id == null");
      this.outcomes = Utils.checkNotNull(outcomes, "outcomes == null");
      this.predictionWindowSeconds = predictionWindowSeconds;
      this.status = Utils.checkNotNull(status, "status == null");
      this.title = Utils.checkNotNull(title, "title == null");
    }

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

    /**
     * The channel that the Prediction Event belongs to. Null if this is Event is not tied to a channel.
     */
    public @Nullable Channel channel() {
      return this.channel;
    }

    /**
     * The timestamp of when the Event was created.
     */
    public @NotNull Object createdAt() {
      return this.createdAt;
    }

    /**
     * Unique identifier of the Prediction Event.
     */
    public @NotNull String id() {
      return this.id;
    }

    /**
     * The Outcomes available for predicting in this Event.
     */
    public @NotNull List outcomes() {
      return this.outcomes;
    }

    /**
     * The length of the prediction window (the duration that the Event accepts predictions) in seconds.
     */
    public int predictionWindowSeconds() {
      return this.predictionWindowSeconds;
    }

    /**
     * The current status of the Event.
     */
    public @NotNull PredictionEventStatus status() {
      return this.status;
    }

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

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeString($responseFields[0], __typename);
          writer.writeObject($responseFields[1], channel != null ? channel.marshaller() : null);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[2], createdAt);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[3], id);
          writer.writeList($responseFields[4], outcomes, new ResponseWriter.ListWriter() {
            @Override
            public void write(List items, ResponseWriter.ListItemWriter listItemWriter) {
              for (Object item : items) {
                listItemWriter.writeObject(((Outcome) item).marshaller());
              }
            }
          });
          writer.writeInt($responseFields[5], predictionWindowSeconds);
          writer.writeString($responseFields[6], status.rawValue());
          writer.writeString($responseFields[7], title);
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "PredictionEvent{"
          + "__typename=" + __typename + ", "
          + "channel=" + channel + ", "
          + "createdAt=" + createdAt + ", "
          + "id=" + id + ", "
          + "outcomes=" + outcomes + ", "
          + "predictionWindowSeconds=" + predictionWindowSeconds + ", "
          + "status=" + status + ", "
          + "title=" + title
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof PredictionEvent) {
        PredictionEvent that = (PredictionEvent) o;
        return this.__typename.equals(that.__typename)
         && ((this.channel == null) ? (that.channel == null) : this.channel.equals(that.channel))
         && this.createdAt.equals(that.createdAt)
         && this.id.equals(that.id)
         && this.outcomes.equals(that.outcomes)
         && this.predictionWindowSeconds == that.predictionWindowSeconds
         && this.status.equals(that.status)
         && this.title.equals(that.title);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= (channel == null) ? 0 : channel.hashCode();
        h *= 1000003;
        h ^= createdAt.hashCode();
        h *= 1000003;
        h ^= id.hashCode();
        h *= 1000003;
        h ^= outcomes.hashCode();
        h *= 1000003;
        h ^= predictionWindowSeconds;
        h *= 1000003;
        h ^= status.hashCode();
        h *= 1000003;
        h ^= title.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      final Channel.Mapper channelFieldMapper = new Channel.Mapper();

      final Outcome.Mapper outcomeFieldMapper = new Outcome.Mapper();

      @Override
      public PredictionEvent map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Channel channel = reader.readObject($responseFields[1], new ResponseReader.ObjectReader() {
          @Override
          public Channel read(ResponseReader reader) {
            return channelFieldMapper.map(reader);
          }
        });
        final Object createdAt = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[2]);
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[3]);
        final List outcomes = reader.readList($responseFields[4], new ResponseReader.ListReader() {
          @Override
          public Outcome read(ResponseReader.ListItemReader listItemReader) {
            return listItemReader.readObject(new ResponseReader.ObjectReader() {
              @Override
              public Outcome read(ResponseReader reader) {
                return outcomeFieldMapper.map(reader);
              }
            });
          }
        });
        final int predictionWindowSeconds = reader.readInt($responseFields[5]);
        final String statusStr = reader.readString($responseFields[6]);
        final PredictionEventStatus status;
        if (statusStr != null) {
          status = PredictionEventStatus.safeValueOf(statusStr);
        } else {
          status = null;
        }
        final String title = reader.readString($responseFields[7]);
        return new PredictionEvent(__typename, channel, createdAt, id, outcomes, predictionWindowSeconds, status, title);
      }
    }
  }

  /**
   * A User's place on Twitch.
   */
  public static class Channel {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

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

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

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

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

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

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

  /**
   * A single Outcome that users can choose in a Prediction Event.
   */
  public static class Outcome {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forString("color", "color", null, false, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forString("title", "title", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull PredictionOutcomeColor color;

    final @NotNull String id;

    final @NotNull String title;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Outcome(@NotNull String __typename, @NotNull PredictionOutcomeColor color,
        @NotNull String id, @NotNull String title) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.color = Utils.checkNotNull(color, "color == null");
      this.id = Utils.checkNotNull(id, "id == null");
      this.title = Utils.checkNotNull(title, "title == null");
    }

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

    /**
     * The color of this Outcome.
     */
    public @NotNull PredictionOutcomeColor color() {
      return this.color;
    }

    /**
     * The unique identifier of the Prediction Outcome.
     */
    public @NotNull String id() {
      return this.id;
    }

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

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Outcome map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String colorStr = reader.readString($responseFields[1]);
        final PredictionOutcomeColor color;
        if (colorStr != null) {
          color = PredictionOutcomeColor.safeValueOf(colorStr);
        } else {
          color = null;
        }
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[2]);
        final String title = reader.readString($responseFields[3]);
        return new Outcome(__typename, color, id, title);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy