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

com.github.twitch4j.graphql.internal.UpdateCommunityPointsCommunityGoalMutation 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.CommunityPointsCommunityGoalStatus;
import com.github.twitch4j.graphql.internal.type.CommunityPointsCommunityGoalType;
import com.github.twitch4j.graphql.internal.type.CustomType;
import com.github.twitch4j.graphql.internal.type.UpdateCommunityPointsCommunityGoalErrorCode;
import com.github.twitch4j.graphql.internal.type.UpdateCommunityPointsCommunityGoalInput;
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 UpdateCommunityPointsCommunityGoalMutation implements Mutation {
  public static final String OPERATION_ID = "6e58a208f0cd1e8f36910112a8776097eb661cda13a8bc5a9171c8a0eaae6a24";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "mutation updateCommunityPointsCommunityGoal($input: UpdateCommunityPointsCommunityGoalInput!) {\n"
        + "  updateCommunityPointsCommunityGoal(input: $input) {\n"
        + "    __typename\n"
        + "    error {\n"
        + "      __typename\n"
        + "      code\n"
        + "    }\n"
        + "    goal {\n"
        + "      __typename\n"
        + "      amountNeeded\n"
        + "      backgroundColor\n"
        + "      defaultImage {\n"
        + "        __typename\n"
        + "        url\n"
        + "        url2x\n"
        + "        url4x\n"
        + "      }\n"
        + "      description\n"
        + "      durationDays\n"
        + "      endedAt\n"
        + "      id\n"
        + "      image {\n"
        + "        __typename\n"
        + "        url\n"
        + "        url2x\n"
        + "        url4x\n"
        + "      }\n"
        + "      isInStock\n"
        + "      perStreamUserMaximumContribution\n"
        + "      pointsContributed\n"
        + "      smallContribution\n"
        + "      startedAt\n"
        + "      status\n"
        + "      title\n"
        + "      type\n"
        + "    }\n"
        + "  }\n"
        + "}"
  );

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

  private final UpdateCommunityPointsCommunityGoalMutation.Variables variables;

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

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

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

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

  @Override
  public UpdateCommunityPointsCommunityGoalMutation.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 UpdateCommunityPointsCommunityGoalInput input;

    Builder() {
    }

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

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

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

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

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

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

    final @Nullable UpdateCommunityPointsCommunityGoal updateCommunityPointsCommunityGoal;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@Nullable UpdateCommunityPointsCommunityGoal updateCommunityPointsCommunityGoal) {
      this.updateCommunityPointsCommunityGoal = updateCommunityPointsCommunityGoal;
    }

    /**
     * updateCommunityPointsCommunityGoal updates a Community Points Community Goal.
     */
    public @Nullable UpdateCommunityPointsCommunityGoal updateCommunityPointsCommunityGoal() {
      return this.updateCommunityPointsCommunityGoal;
    }

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

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

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

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

    public static final class Mapper implements ResponseFieldMapper {
      final UpdateCommunityPointsCommunityGoal.Mapper updateCommunityPointsCommunityGoalFieldMapper = new UpdateCommunityPointsCommunityGoal.Mapper();

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

  /**
   * Update community goal payload.
   */
  public static class UpdateCommunityPointsCommunityGoal {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forObject("error", "error", null, true, Collections.emptyList()),
      ResponseField.forObject("goal", "goal", null, true, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @Nullable Error error;

    final @Nullable Goal goal;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

    /**
     * The error, if any.
     */
    public @Nullable Error error() {
      return this.error;
    }

    /**
     * The community goal.
     */
    public @Nullable Goal goal() {
      return this.goal;
    }

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

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

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

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

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

      final Goal.Mapper goalFieldMapper = new Goal.Mapper();

      @Override
      public UpdateCommunityPointsCommunityGoal map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final Error error = reader.readObject($responseFields[1], new ResponseReader.ObjectReader() {
          @Override
          public Error read(ResponseReader reader) {
            return errorFieldMapper.map(reader);
          }
        });
        final Goal goal = reader.readObject($responseFields[2], new ResponseReader.ObjectReader() {
          @Override
          public Goal read(ResponseReader reader) {
            return goalFieldMapper.map(reader);
          }
        });
        return new UpdateCommunityPointsCommunityGoal(__typename, error, goal);
      }
    }
  }

  /**
   * Update community goal error.
   */
  public static class Error {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forString("code", "code", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull UpdateCommunityPointsCommunityGoalErrorCode code;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

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

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

    /**
     * The error code.
     */
    public @NotNull UpdateCommunityPointsCommunityGoalErrorCode code() {
      return this.code;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Error) {
        Error that = (Error) o;
        return this.__typename.equals(that.__typename)
         && this.code.equals(that.code);
      }
      return false;
    }

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

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Error map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String codeStr = reader.readString($responseFields[1]);
        final UpdateCommunityPointsCommunityGoalErrorCode code;
        if (codeStr != null) {
          code = UpdateCommunityPointsCommunityGoalErrorCode.safeValueOf(codeStr);
        } else {
          code = null;
        }
        return new Error(__typename, code);
      }
    }
  }

  /**
   * Community goal.
   */
  public static class Goal {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forInt("amountNeeded", "amountNeeded", null, false, Collections.emptyList()),
      ResponseField.forString("backgroundColor", "backgroundColor", null, false, Collections.emptyList()),
      ResponseField.forObject("defaultImage", "defaultImage", null, false, Collections.emptyList()),
      ResponseField.forString("description", "description", null, true, Collections.emptyList()),
      ResponseField.forInt("durationDays", "durationDays", null, false, Collections.emptyList()),
      ResponseField.forCustomType("endedAt", "endedAt", null, true, CustomType.TIME, Collections.emptyList()),
      ResponseField.forCustomType("id", "id", null, false, CustomType.ID, Collections.emptyList()),
      ResponseField.forObject("image", "image", null, true, Collections.emptyList()),
      ResponseField.forBoolean("isInStock", "isInStock", null, false, Collections.emptyList()),
      ResponseField.forInt("perStreamUserMaximumContribution", "perStreamUserMaximumContribution", null, false, Collections.emptyList()),
      ResponseField.forInt("pointsContributed", "pointsContributed", null, false, Collections.emptyList()),
      ResponseField.forInt("smallContribution", "smallContribution", null, false, Collections.emptyList()),
      ResponseField.forCustomType("startedAt", "startedAt", null, true, CustomType.TIME, Collections.emptyList()),
      ResponseField.forString("status", "status", null, false, Collections.emptyList()),
      ResponseField.forString("title", "title", null, false, Collections.emptyList()),
      ResponseField.forString("type", "type", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final int amountNeeded;

    final @NotNull String backgroundColor;

    final @NotNull DefaultImage defaultImage;

    final @Nullable String description;

    final int durationDays;

    final @Nullable Object endedAt;

    final @NotNull String id;

    final @Nullable Image image;

    final boolean isInStock;

    final int perStreamUserMaximumContribution;

    final int pointsContributed;

    final int smallContribution;

    final @Nullable Object startedAt;

    final @NotNull CommunityPointsCommunityGoalStatus status;

    final @NotNull String title;

    final @NotNull CommunityPointsCommunityGoalType type;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Goal(@NotNull String __typename, int amountNeeded, @NotNull String backgroundColor,
        @NotNull DefaultImage defaultImage, @Nullable String description, int durationDays,
        @Nullable Object endedAt, @NotNull String id, @Nullable Image image, boolean isInStock,
        int perStreamUserMaximumContribution, int pointsContributed, int smallContribution,
        @Nullable Object startedAt, @NotNull CommunityPointsCommunityGoalStatus status,
        @NotNull String title, @NotNull CommunityPointsCommunityGoalType type) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.amountNeeded = amountNeeded;
      this.backgroundColor = Utils.checkNotNull(backgroundColor, "backgroundColor == null");
      this.defaultImage = Utils.checkNotNull(defaultImage, "defaultImage == null");
      this.description = description;
      this.durationDays = durationDays;
      this.endedAt = endedAt;
      this.id = Utils.checkNotNull(id, "id == null");
      this.image = image;
      this.isInStock = isInStock;
      this.perStreamUserMaximumContribution = perStreamUserMaximumContribution;
      this.pointsContributed = pointsContributed;
      this.smallContribution = smallContribution;
      this.startedAt = startedAt;
      this.status = Utils.checkNotNull(status, "status == null");
      this.title = Utils.checkNotNull(title, "title == null");
      this.type = Utils.checkNotNull(type, "type == null");
    }

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

    /**
     * The amount of community points that this goal needs to succeed.
     */
    public int amountNeeded() {
      return this.amountNeeded;
    }

    /**
     * The background color of this goal. Should be a hex color string, for example "FF0000".
     */
    public @NotNull String backgroundColor() {
      return this.backgroundColor;
    }

    /**
     * The default image of community goals.
     */
    public @NotNull DefaultImage defaultImage() {
      return this.defaultImage;
    }

    /**
     * The description of this goal.
     */
    public @Nullable String description() {
      return this.description;
    }

    /**
     * The *initial* duration the streamer set for the goal.
     * Only really used during the UNSTARTED state; once the goal is started
     * the endedAt timestamp is populated (and updated for extended deadlines).
     */
    public int durationDays() {
      return this.durationDays;
    }

    /**
     * When the goal ended / will end.
     */
    public @Nullable Object endedAt() {
      return this.endedAt;
    }

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

    /**
     * The image of the goal.
     */
    public @Nullable Image image() {
      return this.image;
    }

    /**
     * If this goal is available to be contributed to.
     * true when the goal is active and the streamer is live.
     * For MLP, this is just whether the channel is live.
     */
    public boolean isInStock() {
      return this.isInStock;
    }

    /**
     * The max per stream, per user contribution limit.
     */
    public int perStreamUserMaximumContribution() {
      return this.perStreamUserMaximumContribution;
    }

    /**
     * The total points contributed to this goal.
     */
    public int pointsContributed() {
      return this.pointsContributed;
    }

    /**
     * The small contribution needed to contribute to the goal. Contribution can only be
     * less than this amount if the goal has less than this amount left to complete or if
     * the viewer has less than this amount to be able to contribute.
     */
    public int smallContribution() {
      return this.smallContribution;
    }

    /**
     * When the goal started.
     */
    public @Nullable Object startedAt() {
      return this.startedAt;
    }

    /**
     * The current status of this goal.
     */
    public @NotNull CommunityPointsCommunityGoalStatus status() {
      return this.status;
    }

    /**
     * The title of this goal.
     */
    public @NotNull String title() {
      return this.title;
    }

    /**
     * The type of this goal.
     */
    public @NotNull CommunityPointsCommunityGoalType type() {
      return this.type;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeString($responseFields[0], __typename);
          writer.writeInt($responseFields[1], amountNeeded);
          writer.writeString($responseFields[2], backgroundColor);
          writer.writeObject($responseFields[3], defaultImage.marshaller());
          writer.writeString($responseFields[4], description);
          writer.writeInt($responseFields[5], durationDays);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[6], endedAt);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[7], id);
          writer.writeObject($responseFields[8], image != null ? image.marshaller() : null);
          writer.writeBoolean($responseFields[9], isInStock);
          writer.writeInt($responseFields[10], perStreamUserMaximumContribution);
          writer.writeInt($responseFields[11], pointsContributed);
          writer.writeInt($responseFields[12], smallContribution);
          writer.writeCustom((ResponseField.CustomTypeField) $responseFields[13], startedAt);
          writer.writeString($responseFields[14], status.rawValue());
          writer.writeString($responseFields[15], title);
          writer.writeString($responseFields[16], type.rawValue());
        }
      };
    }

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Goal{"
          + "__typename=" + __typename + ", "
          + "amountNeeded=" + amountNeeded + ", "
          + "backgroundColor=" + backgroundColor + ", "
          + "defaultImage=" + defaultImage + ", "
          + "description=" + description + ", "
          + "durationDays=" + durationDays + ", "
          + "endedAt=" + endedAt + ", "
          + "id=" + id + ", "
          + "image=" + image + ", "
          + "isInStock=" + isInStock + ", "
          + "perStreamUserMaximumContribution=" + perStreamUserMaximumContribution + ", "
          + "pointsContributed=" + pointsContributed + ", "
          + "smallContribution=" + smallContribution + ", "
          + "startedAt=" + startedAt + ", "
          + "status=" + status + ", "
          + "title=" + title + ", "
          + "type=" + type
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Goal) {
        Goal that = (Goal) o;
        return this.__typename.equals(that.__typename)
         && this.amountNeeded == that.amountNeeded
         && this.backgroundColor.equals(that.backgroundColor)
         && this.defaultImage.equals(that.defaultImage)
         && ((this.description == null) ? (that.description == null) : this.description.equals(that.description))
         && this.durationDays == that.durationDays
         && ((this.endedAt == null) ? (that.endedAt == null) : this.endedAt.equals(that.endedAt))
         && this.id.equals(that.id)
         && ((this.image == null) ? (that.image == null) : this.image.equals(that.image))
         && this.isInStock == that.isInStock
         && this.perStreamUserMaximumContribution == that.perStreamUserMaximumContribution
         && this.pointsContributed == that.pointsContributed
         && this.smallContribution == that.smallContribution
         && ((this.startedAt == null) ? (that.startedAt == null) : this.startedAt.equals(that.startedAt))
         && this.status.equals(that.status)
         && this.title.equals(that.title)
         && this.type.equals(that.type);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= amountNeeded;
        h *= 1000003;
        h ^= backgroundColor.hashCode();
        h *= 1000003;
        h ^= defaultImage.hashCode();
        h *= 1000003;
        h ^= (description == null) ? 0 : description.hashCode();
        h *= 1000003;
        h ^= durationDays;
        h *= 1000003;
        h ^= (endedAt == null) ? 0 : endedAt.hashCode();
        h *= 1000003;
        h ^= id.hashCode();
        h *= 1000003;
        h ^= (image == null) ? 0 : image.hashCode();
        h *= 1000003;
        h ^= Boolean.valueOf(isInStock).hashCode();
        h *= 1000003;
        h ^= perStreamUserMaximumContribution;
        h *= 1000003;
        h ^= pointsContributed;
        h *= 1000003;
        h ^= smallContribution;
        h *= 1000003;
        h ^= (startedAt == null) ? 0 : startedAt.hashCode();
        h *= 1000003;
        h ^= status.hashCode();
        h *= 1000003;
        h ^= title.hashCode();
        h *= 1000003;
        h ^= type.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      final DefaultImage.Mapper defaultImageFieldMapper = new DefaultImage.Mapper();

      final Image.Mapper imageFieldMapper = new Image.Mapper();

      @Override
      public Goal map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final int amountNeeded = reader.readInt($responseFields[1]);
        final String backgroundColor = reader.readString($responseFields[2]);
        final DefaultImage defaultImage = reader.readObject($responseFields[3], new ResponseReader.ObjectReader() {
          @Override
          public DefaultImage read(ResponseReader reader) {
            return defaultImageFieldMapper.map(reader);
          }
        });
        final String description = reader.readString($responseFields[4]);
        final int durationDays = reader.readInt($responseFields[5]);
        final Object endedAt = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[6]);
        final String id = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[7]);
        final Image image = reader.readObject($responseFields[8], new ResponseReader.ObjectReader() {
          @Override
          public Image read(ResponseReader reader) {
            return imageFieldMapper.map(reader);
          }
        });
        final boolean isInStock = reader.readBoolean($responseFields[9]);
        final int perStreamUserMaximumContribution = reader.readInt($responseFields[10]);
        final int pointsContributed = reader.readInt($responseFields[11]);
        final int smallContribution = reader.readInt($responseFields[12]);
        final Object startedAt = reader.readCustomType((ResponseField.CustomTypeField) $responseFields[13]);
        final String statusStr = reader.readString($responseFields[14]);
        final CommunityPointsCommunityGoalStatus status;
        if (statusStr != null) {
          status = CommunityPointsCommunityGoalStatus.safeValueOf(statusStr);
        } else {
          status = null;
        }
        final String title = reader.readString($responseFields[15]);
        final String typeStr = reader.readString($responseFields[16]);
        final CommunityPointsCommunityGoalType type;
        if (typeStr != null) {
          type = CommunityPointsCommunityGoalType.safeValueOf(typeStr);
        } else {
          type = null;
        }
        return new Goal(__typename, amountNeeded, backgroundColor, defaultImage, description, durationDays, endedAt, id, image, isInStock, perStreamUserMaximumContribution, pointsContributed, smallContribution, startedAt, status, title, type);
      }
    }
  }

  /**
   * Image URLs of different sizes for community points rewards.
   */
  public static class DefaultImage {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forString("url", "url", null, false, Collections.emptyList()),
      ResponseField.forString("url2x", "url2x", null, false, Collections.emptyList()),
      ResponseField.forString("url4x", "url4x", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String url;

    final @NotNull String url2x;

    final @NotNull String url4x;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public DefaultImage(@NotNull String __typename, @NotNull String url, @NotNull String url2x,
        @NotNull String url4x) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.url = Utils.checkNotNull(url, "url == null");
      this.url2x = Utils.checkNotNull(url2x, "url2x == null");
      this.url4x = Utils.checkNotNull(url4x, "url4x == null");
    }

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

    /**
     * The URL for the small size image.
     */
    public @NotNull String url() {
      return this.url;
    }

    /**
     * The URL for the medium size image.
     */
    public @NotNull String url2x() {
      return this.url2x;
    }

    /**
     * The URL for the large size image.
     */
    public @NotNull String url4x() {
      return this.url4x;
    }

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

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "DefaultImage{"
          + "__typename=" + __typename + ", "
          + "url=" + url + ", "
          + "url2x=" + url2x + ", "
          + "url4x=" + url4x
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof DefaultImage) {
        DefaultImage that = (DefaultImage) o;
        return this.__typename.equals(that.__typename)
         && this.url.equals(that.url)
         && this.url2x.equals(that.url2x)
         && this.url4x.equals(that.url4x);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= url.hashCode();
        h *= 1000003;
        h ^= url2x.hashCode();
        h *= 1000003;
        h ^= url4x.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public DefaultImage map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String url = reader.readString($responseFields[1]);
        final String url2x = reader.readString($responseFields[2]);
        final String url4x = reader.readString($responseFields[3]);
        return new DefaultImage(__typename, url, url2x, url4x);
      }
    }
  }

  /**
   * Image URLs of different sizes for community points rewards.
   */
  public static class Image {
    static final ResponseField[] $responseFields = {
      ResponseField.forString("__typename", "__typename", null, false, Collections.emptyList()),
      ResponseField.forString("url", "url", null, false, Collections.emptyList()),
      ResponseField.forString("url2x", "url2x", null, false, Collections.emptyList()),
      ResponseField.forString("url4x", "url4x", null, false, Collections.emptyList())
    };

    final @NotNull String __typename;

    final @NotNull String url;

    final @NotNull String url2x;

    final @NotNull String url4x;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Image(@NotNull String __typename, @NotNull String url, @NotNull String url2x,
        @NotNull String url4x) {
      this.__typename = Utils.checkNotNull(__typename, "__typename == null");
      this.url = Utils.checkNotNull(url, "url == null");
      this.url2x = Utils.checkNotNull(url2x, "url2x == null");
      this.url4x = Utils.checkNotNull(url4x, "url4x == null");
    }

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

    /**
     * The URL for the small size image.
     */
    public @NotNull String url() {
      return this.url;
    }

    /**
     * The URL for the medium size image.
     */
    public @NotNull String url2x() {
      return this.url2x;
    }

    /**
     * The URL for the large size image.
     */
    public @NotNull String url4x() {
      return this.url4x;
    }

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

    @Override
    public String toString() {
      if ($toString == null) {
        $toString = "Image{"
          + "__typename=" + __typename + ", "
          + "url=" + url + ", "
          + "url2x=" + url2x + ", "
          + "url4x=" + url4x
          + "}";
      }
      return $toString;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (o instanceof Image) {
        Image that = (Image) o;
        return this.__typename.equals(that.__typename)
         && this.url.equals(that.url)
         && this.url2x.equals(that.url2x)
         && this.url4x.equals(that.url4x);
      }
      return false;
    }

    @Override
    public int hashCode() {
      if (!$hashCodeMemoized) {
        int h = 1;
        h *= 1000003;
        h ^= __typename.hashCode();
        h *= 1000003;
        h ^= url.hashCode();
        h *= 1000003;
        h ^= url2x.hashCode();
        h *= 1000003;
        h ^= url4x.hashCode();
        $hashCode = h;
        $hashCodeMemoized = true;
      }
      return $hashCode;
    }

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Image map(ResponseReader reader) {
        final String __typename = reader.readString($responseFields[0]);
        final String url = reader.readString($responseFields[1]);
        final String url2x = reader.readString($responseFields[2]);
        final String url4x = reader.readString($responseFields[3]);
        return new Image(__typename, url, url2x, url4x);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy