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

com.github.twitch4j.graphql.internal.CancelPredictionEventMutation 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.CancelPredictionEventErrorCode;
import com.github.twitch4j.graphql.internal.type.CancelPredictionEventInput;
import com.github.twitch4j.graphql.internal.type.CustomType;
import com.github.twitch4j.graphql.internal.type.PredictionEventStatus;
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.Map;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class CancelPredictionEventMutation implements Mutation {
  public static final String OPERATION_ID = "6137de01179ad3e80d3af5584fb703fac2f54fe44e24efc127c2c29cace152f3";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "mutation cancelPredictionEvent($input: CancelPredictionEventInput!) {\n"
        + "  cancelPredictionEvent(input: $input) {\n"
        + "    __typename\n"
        + "    error {\n"
        + "      __typename\n"
        + "      code\n"
        + "    }\n"
        + "    predictionEvent {\n"
        + "      __typename\n"
        + "      channel {\n"
        + "        __typename\n"
        + "        id\n"
        + "      }\n"
        + "      id\n"
        + "      status\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

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

  private final CancelPredictionEventMutation.Variables variables;

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

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

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

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

  @Override
  public CancelPredictionEventMutation.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 CancelPredictionEventInput input;

    Builder() {
    }

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

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

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

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

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

    public @NotNull CancelPredictionEventInput 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("cancelPredictionEvent", "cancelPredictionEvent", new UnmodifiableMapBuilder(1)
      .put("input", new UnmodifiableMapBuilder(2)
        .put("kind", "Variable")
        .put("variableName", "input")
        .build())
      .build(), true, Collections.emptyList())
    };

    final @Nullable CancelPredictionEvent cancelPredictionEvent;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@Nullable CancelPredictionEvent cancelPredictionEvent) {
      this.cancelPredictionEvent = cancelPredictionEvent;
    }

    /**
     * Cancel a Prediction Event.
     */
    public @Nullable CancelPredictionEvent cancelPredictionEvent() {
      return this.cancelPredictionEvent;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final CancelPredictionEvent.Mapper cancelPredictionEventFieldMapper = new CancelPredictionEvent.Mapper();

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

  /**
   * Payload for canceling a Prediction Evnet.
   */
  public static class CancelPredictionEvent {
    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 CancelPredictionEvent(@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 canceled 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 = "CancelPredictionEvent{"
          + "__typename=" + __typename + ", "
          + "error=" + error + ", "
          + "predictionEvent=" + predictionEvent
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof CancelPredictionEvent) {
        CancelPredictionEvent that = (CancelPredictionEvent) 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 CancelPredictionEvent 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 CancelPredictionEvent(__typename, error, predictionEvent);
      }
    }
  }

  /**
   * An error returned from the cancelPredictionEvent 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 CancelPredictionEventErrorCode code;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Error(@NotNull String __typename, @NotNull CancelPredictionEventErrorCode 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 CancelPredictionEventErrorCode 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 CancelPredictionEventErrorCode code;
        if (codeStr != null) {
          code = CancelPredictionEventErrorCode.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("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forString("status", "status", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable Channel channel;

    final @NotNull String id;

    final @NotNull PredictionEventStatus status;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public PredictionEvent(@NotNull String __typename, @Nullable Channel channel,
        @NotNull String id, @NotNull PredictionEventStatus status) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.channel = channel;
      this.id = Utils.checkNotNull(id, "id == null");
      this.status = Utils.checkNotNull(status, "status == 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;
    }

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

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

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

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "PredictionEvent{"
          + "__typename=" + __typename + ", "
          + "channel=" + channel + ", "
          + "id=" + id + ", "
          + "status=" + status
          + "}";
      }
      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.id.equals(that.id)
         && this.status.equals(that.status);
      }
      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 ^= id.hashCode();
        h *= 1000003;
        h ^= status.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      final Channel.Mapper channelFieldMapper = new Channel.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 String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[2]);
        final String statusStr = reader.readString($responseFields[3]);
        final PredictionEventStatus status;
        if (statusStr != null) {
          status = PredictionEventStatus.safeValueOf(statusStr);
        } else {
          status = null;
        }
        return new PredictionEvent(__typename, channel, id, status);
      }
    }
  }

  /**
   * 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);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy