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

com.github.twitch4j.graphql.internal.FetchSquadStreamQuery 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.SquadStreamStatus;
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 FetchSquadStreamQuery implements Query {
  public static final String OPERATION_ID = "2ad934f180f92d32dbd4cb2d2542fca749aeeb64e47633492af139ee84fdc713";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "query fetchSquadStream($id: ID!) {\n"
        + "  squadStream(id: $id) {\n"
        + "    __typename\n"
        + "    id\n"
        + "    members {\n"
        + "      __typename\n"
        + "      id\n"
        + "      login\n"
        + "      displayName\n"
        + "      profileImageURL(width: 150)\n"
        + "    }\n"
        + "    owner {\n"
        + "      __typename\n"
        + "      id\n"
        + "    }\n"
        + "    status\n"
        + "  }\n"
        + "}"
  );

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

  private final FetchSquadStreamQuery.Variables variables;

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

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

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

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

  @Override
  public FetchSquadStreamQuery.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 FetchSquadStreamQuery build() {
      Utils.checkNotNull(id, "id == null");
      return new FetchSquadStreamQuery(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("squadStream", "squadStream", new UnmodifiableMapBuilder(1)
      .put("id", new UnmodifiableMapBuilder(2)
        .put("kind", "Variable")
        .put("variableName", "id")
        .build())
      .build(), true, Collections.emptyList())
    };

    final @Nullable SquadStream squadStream;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@Nullable SquadStream squadStream) {
      this.squadStream = squadStream;
    }

    /**
     * Get a squad stream by ID.
     */
    public @Nullable SquadStream squadStream() {
      return this.squadStream;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final SquadStream.Mapper squadStreamFieldMapper = new SquadStream.Mapper();

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

  /**
   * A squad stream represents a group of broadcasters that are streaming together.  When a squad
   * stream is live, viewers can opt to watch the streams of all its members together from a
   * single view.
   *
   * Squad streams are created by a broadcaster who invites other broadcasters to participate.
   * Each broadcaster who accepts an invitation becomes a member of the squad stream and can also
   * invite other broadcasters to participate.  At the moment, a squad stream can have up to
   * four members and a broadcaster can only belong to a single squad stream.
   *
   * A squad stream ends when all its members leave or stop streaming.
   */
  public static class SquadStream {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forList("members", "members", null, true, Collections.emptyList()),
      ResponseField.forObject("owner", "owner", null, true, Collections.emptyList()),
      ResponseField.forString("status", "status", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final @Nullable List members;

    final @Nullable Owner owner;

    final @NotNull SquadStreamStatus status;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public SquadStream(@NotNull String __typename, @NotNull String id,
        @Nullable List members, @Nullable Owner owner, @NotNull SquadStreamStatus status) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.id = Utils.checkNotNull(id, "id == null");
      this.members = members;
      this.owner = owner;
      this.status = Utils.checkNotNull(status, "status == null");
    }

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

    /**
     * The ID of the squad stream.
     */
    public @NotNull String id() {
      return this.id;
    }

    /**
     * Broadcasters who are currently participating in the squad stream.
     */
    public @Nullable List members() {
      return this.members;
    }

    /**
     * The owner can remove members from the squad stream.
     */
    public @Nullable Owner owner() {
      return this.owner;
    }

    /**
     * The current status of the squad stream.
     */
    public @NotNull SquadStreamStatus 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.writeCustom((ResponseField.CustomTypeField) $responseFields[1], id);
          writer.writeList($responseFields[2], members, new ResponseWriter.ListWriter() {
            @Override
            public void write(List items, ResponseWriter.ListItemWriter listItemWriter) {
              for (Object item : items) {
                listItemWriter.writeObject(((Member) item).marshaller());
              }
            }
          });
          writer.writeObject($responseFields[3], owner != null ? owner.marshaller() : null);
          writer.writeString($responseFields[4], status.rawValue());
        }
      };
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof SquadStream) {
        SquadStream that = (SquadStream) o;
        return this.__typename.equals(that.__typename)
         && this.id.equals(that.id)
         && ((this.members == null) ? (that.members == null) : this.members.equals(that.members))
         && ((this.owner == null) ? (that.owner == null) : this.owner.equals(that.owner))
         && this.status.equals(that.status);
      }
      return false;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      final Member.Mapper memberFieldMapper = new Member.Mapper();

      final Owner.Mapper ownerFieldMapper = new Owner.Mapper();

      @Override
      public SquadStream map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        final List members = reader.readList($responseFields[2], new ResponseReader.ListReader() {
          @Override
          public Member read(ResponseReader.ListItemReader listItemReader) {
            return listItemReader.readObject(new ResponseReader.ObjectReader() {
              @Override
              public Member read(ResponseReader reader) {
                return memberFieldMapper.map(reader);
              }
            });
          }
        });
        final Owner owner = reader.readObject($responseFields[3], new ResponseReader.ObjectReader() {
          @Override
          public Owner read(ResponseReader reader) {
            return ownerFieldMapper.map(reader);
          }
        });
        final String statusStr = reader.readString($responseFields[4]);
        final SquadStreamStatus status;
        if (statusStr != null) {
          status = SquadStreamStatus.safeValueOf(statusStr);
        } else {
          status = null;
        }
        return new SquadStream(__typename, id, members, owner, status);
      }
    }
  }

  /**
   * Twitch user.
   */
  public static class Member {
    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()),
      ResponseField.forString("profileImageURL", "profileImageURL", new UnmodifiableMapBuilder(1)
      .put("width", 150)
      .build(), true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final @NotNull String login;

    final @NotNull String displayName;

    final @Nullable String profileImageURL;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Member(@NotNull String __typename, @NotNull String id, @NotNull String login,
        @NotNull String displayName, @Nullable String profileImageURL) {
      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");
      this.profileImageURL = profileImageURL;
    }

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

    /**
     * A URL to the user's profile image.
     * Valid widths are 28, 50, 70, 96, 150, 300, and 600.
     * The image height will be the same as the given width.
     */
    public @Nullable String profileImageURL() {
      return this.profileImageURL;
    }

    @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);
          writer.writeString($responseFields[4], profileImageURL);
        }
      };
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Member) {
        Member that = (Member) o;
        return this.__typename.equals(that.__typename)
         && this.id.equals(that.id)
         && this.login.equals(that.login)
         && this.displayName.equals(that.displayName)
         && ((this.profileImageURL == null) ? (that.profileImageURL == null) : this.profileImageURL.equals(that.profileImageURL));
      }
      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();
        h *= 1000003;
        h ^= (profileImageURL == null) ? 0 : profileImageURL.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Member 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]);
        final String profileImageURL = reader.readString($responseFields[4]);
        return new Member(__typename, id, login, displayName, profileImageURL);
      }
    }
  }

  /**
   * Twitch user.
   */
  public static class Owner {
    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 Owner(@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 user's unique identifier.
     */
    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 = "Owner{"
          + "__typename=" + __typename + ", "
          + "id=" + id
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Owner) {
        Owner that = (Owner) 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 Owner map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        return new Owner(__typename, id);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy