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

com.github.twitch4j.graphql.internal.FetchUserQuery 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.Input;
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 java.io.IOException;
import java.lang.Boolean;
import java.lang.Integer;
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 FetchUserQuery implements Query {
  public static final String OPERATION_ID = "e0c653e6aba7c345345fa75c9d7c7bdb9376aa19b42d99f3c67304284d15a318";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "query fetchUser($id: ID, $login: String) {\n"
        + "  user(id: $id, login: $login, lookupType: ALL) {\n"
        + "    __typename\n"
        + "    id\n"
        + "    login\n"
        + "    displayName\n"
        + "    description\n"
        + "    profileImageURL(width: 50)\n"
        + "    profileViewCount\n"
        + "    primaryColorHex\n"
        + "    createdAt\n"
        + "    updatedAt\n"
        + "    broadcastSettings {\n"
        + "      __typename\n"
        + "      id\n"
        + "      title\n"
        + "      game {\n"
        + "        __typename\n"
        + "        id\n"
        + "        displayName\n"
        + "      }\n"
        + "    }\n"
        + "    stream {\n"
        + "      __typename\n"
        + "      id\n"
        + "      previewImageURL\n"
        + "    }\n"
        + "    followers {\n"
        + "      __typename\n"
        + "      totalCount\n"
        + "    }\n"
        + "    roles {\n"
        + "      __typename\n"
        + "      isAffiliate\n"
        + "      isPartner\n"
        + "      isStaff\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

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

  private final FetchUserQuery.Variables variables;

  public FetchUserQuery(@NotNull Input id, @NotNull Input login) {
    Utils.checkNotNull(id, "id == null");
    Utils.checkNotNull(login, "login == null");
    variables = new FetchUserQuery.Variables(id, login);
  }

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

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

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

  @Override
  public FetchUserQuery.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 Input id = Input.absent();

    private Input login = Input.absent();

    Builder() {
    }

    public Builder id(@Nullable String id) {
      this.id = Input.fromNullable(id);
      return this;
    }

    public Builder login(@Nullable String login) {
      this.login = Input.fromNullable(login);
      return this;
    }

    public Builder idInput(@NotNull Input id) {
      this.id = Utils.checkNotNull(id, "id == null");
      return this;
    }

    public Builder loginInput(@NotNull Input login) {
      this.login = Utils.checkNotNull(login, "login == null");
      return this;
    }

    public FetchUserQuery build() {
      return new FetchUserQuery(id, login);
    }
  }

  public static final class Variables extends Operation.Variables {
    private final Input id;

    private final Input login;

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

    Variables(Input id, Input login) {
      this.id = id;
      this.login = login;
      if (id.defined) {
        this.valueMap.put("id", id.value);
      }
      if (login.defined) {
        this.valueMap.put("login", login.value);
      }
    }

    public Input id() {
      return id;
    }

    public Input login() {
      return login;
    }

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

    @Override
    public InputFieldMarshaller marshaller() {
      return new InputFieldMarshaller() {
        @Override
        public void marshal(InputFieldWriter writer) throws IOException {
          if (id.defined) {
            writer.writeCustom("id", com.github.twitch4j.graphql.internal.type.CustomType.ID, id.value != null ? id.value : null);
          }
          if (login.defined) {
            writer.writeString("login", login.value);
          }
        }
      };
    }
  }

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

    final @Nullable User user;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@Nullable User user) {
      this.user = user;
    }

    /**
     * Get a user by their ID or login.
     * If no ID or login is provided, null is returned.
     * Lookup type can tell the resolver to include all users (inclusing deleted and
     * suspended accounts) on the lookup, defaults to only retrieve active users.
     */
    public @Nullable User user() {
      return this.user;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final User.Mapper userFieldMapper = new User.Mapper();

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

  /**
   * Twitch user.
   */
  public static class User {
    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("description", "description", null, true, Collections.emptyList()),
      ResponseField.forString("profileImageURL", "profileImageURL", new UnmodifiableMapBuilder(1)
      .put("width", 50)
      .build(), true, Collections.emptyList()),
      ResponseField.forInt("profileViewCount", "profileViewCount", null, true, Collections.emptyList()),
      ResponseField.forString("primaryColorHex", "primaryColorHex", null, true, Collections.emptyList()),
      ResponseField.forCustomType("createdAt", "createdAt", null, false, CustomType.TIME, Collections.emptyList()),
      ResponseField.forCustomType("updatedAt", "updatedAt", null, true, CustomType.TIME, Collections.emptyList()),
      ResponseField.forObject("broadcastSettings", "broadcastSettings", null, true, Collections.emptyList()),
      ResponseField.forObject("stream", "stream", null, true, Collections.emptyList()),
      ResponseField.forObject("followers", "followers", null, true, Collections.emptyList()),
      ResponseField.forObject("roles", "roles", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final @NotNull String login;

    final @NotNull String displayName;

    final @Nullable String description;

    final @Nullable String profileImageURL;

    final @Nullable Integer profileViewCount;

    final @Nullable String primaryColorHex;

    final @NotNull Object createdAt;

    final @Nullable Object updatedAt;

    final @Nullable BroadcastSettings broadcastSettings;

    final @Nullable Stream stream;

    final @Nullable Followers followers;

    final @Nullable Roles roles;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public User(@NotNull String __typename, @NotNull String id, @NotNull String login,
        @NotNull String displayName, @Nullable String description, @Nullable String profileImageURL,
        @Nullable Integer profileViewCount, @Nullable String primaryColorHex,
        @NotNull Object createdAt, @Nullable Object updatedAt,
        @Nullable BroadcastSettings broadcastSettings, @Nullable Stream stream,
        @Nullable Followers followers, @Nullable Roles roles) {
      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.description = description;
      this.profileImageURL = profileImageURL;
      this.profileViewCount = profileViewCount;
      this.primaryColorHex = primaryColorHex;
      this.createdAt = Utils.checkNotNull(createdAt, "createdAt == null");
      this.updatedAt = updatedAt;
      this.broadcastSettings = broadcastSettings;
      this.stream = stream;
      this.followers = followers;
      this.roles = roles;
    }

    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 user-provided blurb describing themselves.
     * Returns null when a description has not been set.
     */
    public @Nullable String description() {
      return this.description;
    }

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

    /**
     * The number of views this user's profile has received since creation.
     */
    public @Nullable Integer profileViewCount() {
      return this.profileViewCount;
    }

    /**
     * The hex string for the user's primary creator color.
     * Example: "FFFFFF".
     */
    public @Nullable String primaryColorHex() {
      return this.primaryColorHex;
    }

    /**
     * When the user created their account.
     */
    public @NotNull Object createdAt() {
      return this.createdAt;
    }

    /**
     * When the user last updated their account.
     * Returns null when the user's account has never been updated.
     */
    public @Nullable Object updatedAt() {
      return this.updatedAt;
    }

    /**
     * A User's broadcast settings that persists between streams.
     */
    public @Nullable BroadcastSettings broadcastSettings() {
      return this.broadcastSettings;
    }

    /**
     * The user's live stream.
     * Null if the user is not currently broadcasting.
     */
    public @Nullable Stream stream() {
      return this.stream;
    }

    /**
     * A paginated list of users which follow this user.
     */
    public @Nullable Followers followers() {
      return this.followers;
    }

    /**
     * The roles this user fulfills on Twitch.
     */
    public @Nullable Roles roles() {
      return this.roles;
    }

    @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], description);
          writer.writeString($responseFields[5], profileImageURL);
          writer.writeInt($responseFields[6], profileViewCount);
          writer.writeString($responseFields[7], primaryColorHex);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[8], createdAt);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[9], updatedAt);
          writer.writeObject($responseFields[10], broadcastSettings != null ? broadcastSettings.marshaller() : null);
          writer.writeObject($responseFields[11], stream != null ? stream.marshaller() : null);
          writer.writeObject($responseFields[12], followers != null ? followers.marshaller() : null);
          writer.writeObject($responseFields[13], roles != null ? roles.marshaller() : null);
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "User{"
          + "__typename=" + __typename + ", "
          + "id=" + id + ", "
          + "login=" + login + ", "
          + "displayName=" + displayName + ", "
          + "description=" + description + ", "
          + "profileImageURL=" + profileImageURL + ", "
          + "profileViewCount=" + profileViewCount + ", "
          + "primaryColorHex=" + primaryColorHex + ", "
          + "createdAt=" + createdAt + ", "
          + "updatedAt=" + updatedAt + ", "
          + "broadcastSettings=" + broadcastSettings + ", "
          + "stream=" + stream + ", "
          + "followers=" + followers + ", "
          + "roles=" + roles
          + "}";
      }
      return $toString;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      final BroadcastSettings.Mapper broadcastSettingsFieldMapper = new BroadcastSettings.Mapper();

      final Stream.Mapper streamFieldMapper = new Stream.Mapper();

      final Followers.Mapper followersFieldMapper = new Followers.Mapper();

      final Roles.Mapper rolesFieldMapper = new Roles.Mapper();

      @Override
      public User 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 description = reader.readString($responseFields[4]);
        final String profileImageURL = reader.readString($responseFields[5]);
        final Integer profileViewCount = reader.readInt($responseFields[6]);
        final String primaryColorHex = reader.readString($responseFields[7]);
        final Object createdAt = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[8]);
        final Object updatedAt = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[9]);
        final BroadcastSettings broadcastSettings = reader.readObject($responseFields[10], new ResponseReader.ObjectReader() {
          @Override
          public BroadcastSettings read(ResponseReader reader) {
            return broadcastSettingsFieldMapper.map(reader);
          }
        });
        final Stream stream = reader.readObject($responseFields[11], new ResponseReader.ObjectReader() {
          @Override
          public Stream read(ResponseReader reader) {
            return streamFieldMapper.map(reader);
          }
        });
        final Followers followers = reader.readObject($responseFields[12], new ResponseReader.ObjectReader() {
          @Override
          public Followers read(ResponseReader reader) {
            return followersFieldMapper.map(reader);
          }
        });
        final Roles roles = reader.readObject($responseFields[13], new ResponseReader.ObjectReader() {
          @Override
          public Roles read(ResponseReader reader) {
            return rolesFieldMapper.map(reader);
          }
        });
        return new User(__typename, id, login, displayName, description, profileImageURL, profileViewCount, primaryColorHex, createdAt, updatedAt, broadcastSettings, stream, followers, roles);
      }
    }
  }

  /**
   * Settings for a User's broadcast that persist between streams.
   */
  public static class BroadcastSettings {
    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("game", "game", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final @NotNull String title;

    final @Nullable Game game;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public BroadcastSettings(@NotNull String __typename, @NotNull String id, @NotNull String title,
        @Nullable Game game) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.id = Utils.checkNotNull(id, "id == null");
      this.title = Utils.checkNotNull(title, "title == null");
      this.game = game;
    }

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

    /**
     * The broadcast setting's unique identifier.
     * This happens to be the same as the User's ID, but should not be assumed to have any meaning.
     */
    public @NotNull String id() {
      return this.id;
    }

    /**
     * The title of the user's broadcast. The default value is "", when the user has not indicated a title.
     */
    public @NotNull String title() {
      return this.title;
    }

    /**
     * The game that the user has set as their current game. This will influence what the game field on a Streams object is when the User starts streaming.
     */
    public @Nullable Game game() {
      return this.game;
    }

    @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], game != null ? game.marshaller() : null);
        }
      };
    }

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final Game.Mapper gameFieldMapper = new Game.Mapper();

      @Override
      public BroadcastSettings 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 Game game = reader.readObject($responseFields[3], new ResponseReader.ObjectReader() {
          @Override
          public Game read(ResponseReader reader) {
            return gameFieldMapper.map(reader);
          }
        });
        return new BroadcastSettings(__typename, id, title, game);
      }
    }
  }

  /**
   * A Game is often the subject of a Stream on Twitch.
   */
  public static class Game {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forString("displayName", "displayName", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final @NotNull String displayName;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

    /**
     * The game's unique Twitch identifier.
     * It is used to associate games with product offers.
     */
    public @NotNull String id() {
      return this.id;
    }

    /**
     * The translated game name used for display purposes.
     * Use name for tracking props or URLs.
     */
    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], displayName);
        }
      };
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Game) {
        Game that = (Game) o;
        return this.__typename.equals(that.__typename)
         && this.id.equals(that.id)
         && 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 ^= displayName.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

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

  /**
   * A live stream.
   */
  public static class Stream {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forString("previewImageURL", "previewImageURL", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    final @Nullable String previewImageURL;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

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

    /**
     * A URL to a dynamically sized image.
     * If either `height` or `width` are not given, a templated value will be present instead.
     */
    public @Nullable String previewImageURL() {
      return this.previewImageURL;
    }

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

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

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

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

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

  /**
   * A paginated list of followers relationships.
   */
  public static class Followers {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forInt("totalCount", "totalCount", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable Integer totalCount;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Followers(@NotNull String __typename, @Nullable Integer totalCount) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.totalCount = totalCount;
    }

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

    /**
     * The total number of followers.
     */
    public @Nullable Integer totalCount() {
      return this.totalCount;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Followers map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Integer totalCount = reader.readInt($responseFields[1]);
        return new Followers(__typename, totalCount);
      }
    }
  }

  /**
   * Groups site-wide user roles together.
   */
  public static class Roles {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forBoolean("isAffiliate", "isAffiliate", null, true, Collections.emptyList()),
      ResponseField.forBoolean("isPartner", "isPartner", null, true, Collections.emptyList()),
      ResponseField.forBoolean("isStaff", "isStaff", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable Boolean isAffiliate;

    final @Nullable Boolean isPartner;

    final @Nullable Boolean isStaff;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Roles(@NotNull String __typename, @Nullable Boolean isAffiliate,
        @Nullable Boolean isPartner, @Nullable Boolean isStaff) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.isAffiliate = isAffiliate;
      this.isPartner = isPartner;
      this.isStaff = isStaff;
    }

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

    /**
     * Whether or not the user is enrolled in the affiliate program.
     * See https://affiliate.twitch.tv for more information.
     */
    public @Nullable Boolean isAffiliate() {
      return this.isAffiliate;
    }

    /**
     * Whether or not the user is a partnered broadcaster with Twitch.
     */
    public @Nullable Boolean isPartner() {
      return this.isPartner;
    }

    /**
     * Whether or not the user is a Twitch staff member.
     */
    public @Nullable Boolean isStaff() {
      return this.isStaff;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeString($responseFields[0], __typename);
          writer.writeBoolean($responseFields[1], isAffiliate);
          writer.writeBoolean($responseFields[2], isPartner);
          writer.writeBoolean($responseFields[3], isStaff);
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Roles{"
          + "__typename=" + __typename + ", "
          + "isAffiliate=" + isAffiliate + ", "
          + "isPartner=" + isPartner + ", "
          + "isStaff=" + isStaff
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Roles) {
        Roles that = (Roles) o;
        return this.__typename.equals(that.__typename)
         && ((this.isAffiliate == null) ? (that.isAffiliate == null) : this.isAffiliate.equals(that.isAffiliate))
         && ((this.isPartner == null) ? (that.isPartner == null) : this.isPartner.equals(that.isPartner))
         && ((this.isStaff == null) ? (that.isStaff == null) : this.isStaff.equals(that.isStaff));
      }
      return false;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Roles map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Boolean isAffiliate = reader.readBoolean($responseFields[1]);
        final Boolean isPartner = reader.readBoolean($responseFields[2]);
        final Boolean isStaff = reader.readBoolean($responseFields[3]);
        return new Roles(__typename, isAffiliate, isPartner, isStaff);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy