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

com.github.twitch4j.graphql.internal.UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsMutation 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.UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsInput;
import com.github.twitch4j.graphql.internal.type.UpdateCommunityPointsCustomRewardRedemptionStatusesErrorCode;
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 UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsMutation implements Mutation {
  public static final String OPERATION_ID = "2293384becd267e6ebe116bca704228c360b07c5f9ed157d338ab038f2f8aeeb";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "mutation updateCommunityPointsCustomRewardRedemptionStatusesByRedemptions($input: UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsInput!) {\n"
        + "  updateCommunityPointsCustomRewardRedemptionStatusesByRedemptions(input: $input) {\n"
        + "    __typename\n"
        + "    error {\n"
        + "      __typename\n"
        + "      code\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

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

  private final UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsMutation.Variables variables;

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

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

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

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

  @Override
  public UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsMutation.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 UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsInput input;

    Builder() {
    }

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

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

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

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

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

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

    final @Nullable UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptions updateCommunityPointsCustomRewardRedemptionStatusesByRedemptions;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@Nullable UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptions updateCommunityPointsCustomRewardRedemptionStatusesByRedemptions) {
      this.updateCommunityPointsCustomRewardRedemptionStatusesByRedemptions = updateCommunityPointsCustomRewardRedemptionStatusesByRedemptions;
    }

    /**
     * Update the status of the Community Points redemptions from the provided list.
     */
    public @Nullable UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptions updateCommunityPointsCustomRewardRedemptionStatusesByRedemptions() {
      return this.updateCommunityPointsCustomRewardRedemptionStatusesByRedemptions;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptions.Mapper updateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsFieldMapper = new UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptions.Mapper();

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

  /**
   * The response from acting on the Community Points redemptions from the provided list.
   * Most of the work is done as an async task and redemption status changes are pushed over pubsub.
   */
  public static class UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptions {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forObject("error", "error", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable Error error;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

    /**
     * An error that occurred while updating the redemption statuses.
     */
    public @Nullable Error error() {
      return this.error;
    }

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

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

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

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

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

      @Override
      public UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptions 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);
          }
        });
        return new UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptions(__typename, error);
      }
    }
  }

  /**
   * An error from acting on a Community Points redemption.
   */
  public static class Error {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forString("code", "code", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable UpdateCommunityPointsCustomRewardRedemptionStatusesErrorCode code;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

    /**
     * An identifier for the error that occurred.
     */
    public @Nullable UpdateCommunityPointsCustomRewardRedemptionStatusesErrorCode 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 != null ? code.rawValue() : null);
        }
      };
    }

    @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 == null) ? (that.code == null) : 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 == null) ? 0 : 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 UpdateCommunityPointsCustomRewardRedemptionStatusesErrorCode code;
        if (codeStr != null) {
          code = UpdateCommunityPointsCustomRewardRedemptionStatusesErrorCode.safeValueOf(codeStr);
        } else {
          code = null;
        }
        return new Error(__typename, code);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy