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

com.github.twitch4j.graphql.internal.UnfollowMutation 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.CustomType;
import com.github.twitch4j.graphql.internal.type.UnfollowUserInput;
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 UnfollowMutation implements Mutation {
  public static final String OPERATION_ID = "49e6eca0a92a11afdef7dc4e73a0fc2f08b52379a6abb188332abbe10bb42ef8";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "mutation unfollow($unfollowUserInput: UnfollowUserInput!) {\n"
        + "  unfollowUser(input: $unfollowUserInput) {\n"
        + "    __typename\n"
        + "    follow {\n"
        + "      __typename\n"
        + "      user {\n"
        + "        __typename\n"
        + "        id\n"
        + "      }\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

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

  private final UnfollowMutation.Variables variables;

  public UnfollowMutation(@NotNull UnfollowUserInput unfollowUserInput) {
    Utils.checkNotNull(unfollowUserInput, "unfollowUserInput == null");
    variables = new UnfollowMutation.Variables(unfollowUserInput);
  }

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

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

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

  @Override
  public UnfollowMutation.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 UnfollowUserInput unfollowUserInput;

    Builder() {
    }

    public Builder unfollowUserInput(@NotNull UnfollowUserInput unfollowUserInput) {
      this.unfollowUserInput = unfollowUserInput;
      return this;
    }

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

  public static final class Variables extends Operation.Variables {
    private final @NotNull UnfollowUserInput unfollowUserInput;

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

    Variables(@NotNull UnfollowUserInput unfollowUserInput) {
      this.unfollowUserInput = unfollowUserInput;
      this.valueMap.put("unfollowUserInput", unfollowUserInput);
    }

    public @NotNull UnfollowUserInput unfollowUserInput() {
      return unfollowUserInput;
    }

    @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("unfollowUserInput", unfollowUserInput.marshaller());
        }
      };
    }
  }

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

    final @Nullable UnfollowUser unfollowUser;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@Nullable UnfollowUser unfollowUser) {
      this.unfollowUser = unfollowUser;
    }

    /**
     * unfollowUser destroys the follow relationship between the authenticated user and
     * the target user.
     */
    public @Nullable UnfollowUser unfollowUser() {
      return this.unfollowUser;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final UnfollowUser.Mapper unfollowUserFieldMapper = new UnfollowUser.Mapper();

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

  public static class UnfollowUser {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forObject("follow", "follow", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable Follow follow;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public UnfollowUser(@NotNull String __typename, @Nullable Follow follow) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.follow = follow;
    }

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

    /**
     * The deleted follow relationship.
     */
    public @Nullable Follow follow() {
      return this.follow;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final Follow.Mapper followFieldMapper = new Follow.Mapper();

      @Override
      public UnfollowUser map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Follow follow = reader.readObject($responseFields[1], new ResponseReader.ObjectReader() {
          @Override
          public Follow read(ResponseReader reader) {
            return followFieldMapper.map(reader);
          }
        });
        return new UnfollowUser(__typename, follow);
      }
    }
  }

  /**
   * Data about the relationship between one User and a User they are following.
   */
  public static class Follow {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forObject("user", "user", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable User user;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Follow(@NotNull String __typename, @Nullable User user) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.user = user;
    }

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

    /**
     * The user who is followed.
     */
    public @Nullable User user() {
      return this.user;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Follow) {
        Follow that = (Follow) o;
        return this.__typename.equals(that.__typename)
         && ((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 ^= __typename.hashCode();
        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 Follow map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final User user = reader.readObject($responseFields[1], new ResponseReader.ObjectReader() {
          @Override
          public User read(ResponseReader reader) {
            return userFieldMapper.map(reader);
          }
        });
        return new Follow(__typename, 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())
    };

    final @NotNull String __typename;

    final @NotNull String id;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public User(@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 = "User{"
          + "__typename=" + __typename + ", "
          + "id=" + id
          + "}";
      }
      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);
      }
      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 User map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[1]);
        return new User(__typename, id);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy