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

com.example.graphql.client.schema.DropTableMutation Maven / Gradle / Ivy

There is a newer version: 2.1.0-BETA-19
Show 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.example.graphql.client.schema;

import com.apollographql.apollo.api.Input;
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 java.io.IOException;
import java.lang.Boolean;
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 java.util.Optional;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class DropTableMutation implements Mutation, DropTableMutation.Variables> {
  public static final String OPERATION_ID = "562e2ff062b9586183d16210c95eed01f778416b2c56b67d944fb78afa3642bd";

  public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
    "mutation DropTable($keyspaceName: String!, $tableName: String!, $ifExists: Boolean) {\n"
        + "  dropTable(keyspaceName: $keyspaceName, tableName: $tableName, ifExists: $ifExists)\n"
        + "}"
  );

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

  private final DropTableMutation.Variables variables;

  public DropTableMutation(@NotNull String keyspaceName, @NotNull String tableName,
      @NotNull Input ifExists) {
    Utils.checkNotNull(keyspaceName, "keyspaceName == null");
    Utils.checkNotNull(tableName, "tableName == null");
    Utils.checkNotNull(ifExists, "ifExists == null");
    variables = new DropTableMutation.Variables(keyspaceName, tableName, ifExists);
  }

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

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

  @Override
  public Optional wrapData(DropTableMutation.Data data) {
    return Optional.ofNullable(data);
  }

  @Override
  public DropTableMutation.Variables variables() {
    return variables;
  }

  @Override
  public ResponseFieldMapper responseFieldMapper() {
    return new Data.Mapper();
  }

  public static Builder builder() {
    return new Builder();
  }

  @Override
  public OperationName name() {
    return OPERATION_NAME;
  }

  @Override
  @NotNull
  public Response> parse(@NotNull final BufferedSource source,
      @NotNull final ScalarTypeAdapters scalarTypeAdapters) throws IOException {
    return SimpleOperationResponseParser.parse(source, this, scalarTypeAdapters);
  }

  @Override
  @NotNull
  public Response> parse(@NotNull final ByteString byteString,
      @NotNull final ScalarTypeAdapters scalarTypeAdapters) throws IOException {
    return parse(new Buffer().write(byteString), scalarTypeAdapters);
  }

  @Override
  @NotNull
  public Response> parse(@NotNull final BufferedSource source)
      throws IOException {
    return parse(source, ScalarTypeAdapters.DEFAULT);
  }

  @Override
  @NotNull
  public Response> parse(@NotNull final ByteString byteString)
      throws IOException {
    return parse(byteString, ScalarTypeAdapters.DEFAULT);
  }

  @Override
  @NotNull
  public ByteString composeRequestBody(@NotNull final ScalarTypeAdapters scalarTypeAdapters) {
    return OperationRequestBodyComposer.compose(this, false, true, scalarTypeAdapters);
  }

  @NotNull
  @Override
  public ByteString composeRequestBody() {
    return OperationRequestBodyComposer.compose(this, false, true, ScalarTypeAdapters.DEFAULT);
  }

  @Override
  @NotNull
  public ByteString composeRequestBody(final boolean autoPersistQueries,
      final boolean withQueryDocument, @NotNull final ScalarTypeAdapters scalarTypeAdapters) {
    return OperationRequestBodyComposer.compose(this, autoPersistQueries, withQueryDocument, scalarTypeAdapters);
  }

  public static final class Builder {
    private @NotNull String keyspaceName;

    private @NotNull String tableName;

    private Input ifExists = Input.absent();

    Builder() {
    }

    public Builder keyspaceName(@NotNull String keyspaceName) {
      this.keyspaceName = keyspaceName;
      return this;
    }

    public Builder tableName(@NotNull String tableName) {
      this.tableName = tableName;
      return this;
    }

    public Builder ifExists(@Nullable Boolean ifExists) {
      this.ifExists = Input.fromNullable(ifExists);
      return this;
    }

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

    public DropTableMutation build() {
      Utils.checkNotNull(keyspaceName, "keyspaceName == null");
      Utils.checkNotNull(tableName, "tableName == null");
      return new DropTableMutation(keyspaceName, tableName, ifExists);
    }
  }

  public static final class Variables extends Operation.Variables {
    private final @NotNull String keyspaceName;

    private final @NotNull String tableName;

    private final Input ifExists;

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

    Variables(@NotNull String keyspaceName, @NotNull String tableName, Input ifExists) {
      this.keyspaceName = keyspaceName;
      this.tableName = tableName;
      this.ifExists = ifExists;
      this.valueMap.put("keyspaceName", keyspaceName);
      this.valueMap.put("tableName", tableName);
      if (ifExists.defined) {
        this.valueMap.put("ifExists", ifExists.value);
      }
    }

    public @NotNull String keyspaceName() {
      return keyspaceName;
    }

    public @NotNull String tableName() {
      return tableName;
    }

    public Input ifExists() {
      return ifExists;
    }

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

    @Override
    public InputFieldMarshaller marshaller() {
      return new InputFieldMarshaller() {
        @Override
        public void marshal(InputFieldWriter writer) throws IOException {
          writer.writeString("keyspaceName", keyspaceName);
          writer.writeString("tableName", tableName);
          if (ifExists.defined) {
            writer.writeBoolean("ifExists", ifExists.value);
          }
        }
      };
    }
  }

  /**
   * Data from the response after executing this GraphQL operation
   */
  public static class Data implements Operation.Data {
    static final ResponseField[] $responseFields = {
      ResponseField.forBoolean("dropTable", "dropTable", new UnmodifiableMapBuilder(3)
      .put("keyspaceName", new UnmodifiableMapBuilder(2)
        .put("kind", "Variable")
        .put("variableName", "keyspaceName")
        .build())
      .put("tableName", new UnmodifiableMapBuilder(2)
        .put("kind", "Variable")
        .put("variableName", "tableName")
        .build())
      .put("ifExists", new UnmodifiableMapBuilder(2)
        .put("kind", "Variable")
        .put("variableName", "ifExists")
        .build())
      .build(), true, Collections.emptyList())
    };

    final Optional dropTable;

    private transient volatile String $toString;

    private transient volatile int $hashCode;

    private transient volatile boolean $hashCodeMemoized;

    public Data(@Nullable Boolean dropTable) {
      this.dropTable = Optional.ofNullable(dropTable);
    }

    public Optional getDropTable() {
      return this.dropTable;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeBoolean($responseFields[0], dropTable.isPresent() ? dropTable.get() : null);
        }
      };
    }

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

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

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

    public Builder toBuilder() {
      Builder builder = new Builder();
      builder.dropTable = dropTable.isPresent() ? dropTable.get() : null;
      return builder;
    }

    public static Builder builder() {
      return new Builder();
    }

    public static final class Mapper implements ResponseFieldMapper {
      @Override
      public Data map(ResponseReader reader) {
        final Boolean dropTable = reader.readBoolean($responseFields[0]);
        return new Data(dropTable);
      }
    }

    public static final class Builder {
      private @Nullable Boolean dropTable;

      Builder() {
      }

      public Builder dropTable(@Nullable Boolean dropTable) {
        this.dropTable = dropTable;
        return this;
      }

      public Data build() {
        return new Data(dropTable);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy