com.example.graphql.client.schema.CreateTableMutation Maven / Gradle / Ivy
// 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 com.example.graphql.client.schema.type.ClusteringKeyInput;
import com.example.graphql.client.schema.type.ColumnInput;
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.List;
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 CreateTableMutation implements Mutation, CreateTableMutation.Variables> {
public static final String OPERATION_ID = "c9cc8bcb8dd7f5e767965318f7655d4ce845ff9d4765d9ec7bbee95ea1dbcfbe";
public static final String QUERY_DOCUMENT = QueryDocumentMinifier.minify(
"mutation CreateTable($keyspaceName: String!, $tableName: String!, $partitionKeys: [ColumnInput]!, $clusteringKeys: [ClusteringKeyInput], $values: [ColumnInput], $ifNotExists: Boolean) {\n"
+ " createTable(keyspaceName: $keyspaceName, tableName: $tableName, partitionKeys: $partitionKeys, clusteringKeys: $clusteringKeys, values: $values, ifNotExists: $ifNotExists)\n"
+ "}"
);
public static final OperationName OPERATION_NAME = new OperationName() {
@Override
public String name() {
return "CreateTable";
}
};
private final CreateTableMutation.Variables variables;
public CreateTableMutation(@NotNull String keyspaceName, @NotNull String tableName,
@NotNull List partitionKeys,
@NotNull Input> clusteringKeys,
@NotNull Input> values, @NotNull Input ifNotExists) {
Utils.checkNotNull(keyspaceName, "keyspaceName == null");
Utils.checkNotNull(tableName, "tableName == null");
Utils.checkNotNull(partitionKeys, "partitionKeys == null");
Utils.checkNotNull(clusteringKeys, "clusteringKeys == null");
Utils.checkNotNull(values, "values == null");
Utils.checkNotNull(ifNotExists, "ifNotExists == null");
variables = new CreateTableMutation.Variables(keyspaceName, tableName, partitionKeys, clusteringKeys, values, ifNotExists);
}
@Override
public String operationId() {
return OPERATION_ID;
}
@Override
public String queryDocument() {
return QUERY_DOCUMENT;
}
@Override
public Optional wrapData(CreateTableMutation.Data data) {
return Optional.ofNullable(data);
}
@Override
public CreateTableMutation.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 @NotNull List partitionKeys;
private Input> clusteringKeys = Input.absent();
private Input> values = Input.absent();
private Input ifNotExists = 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 partitionKeys(@NotNull List partitionKeys) {
this.partitionKeys = partitionKeys;
return this;
}
public Builder clusteringKeys(@Nullable List clusteringKeys) {
this.clusteringKeys = Input.fromNullable(clusteringKeys);
return this;
}
public Builder values(@Nullable List values) {
this.values = Input.fromNullable(values);
return this;
}
public Builder ifNotExists(@Nullable Boolean ifNotExists) {
this.ifNotExists = Input.fromNullable(ifNotExists);
return this;
}
public Builder clusteringKeysInput(@NotNull Input> clusteringKeys) {
this.clusteringKeys = Utils.checkNotNull(clusteringKeys, "clusteringKeys == null");
return this;
}
public Builder valuesInput(@NotNull Input> values) {
this.values = Utils.checkNotNull(values, "values == null");
return this;
}
public Builder ifNotExistsInput(@NotNull Input ifNotExists) {
this.ifNotExists = Utils.checkNotNull(ifNotExists, "ifNotExists == null");
return this;
}
public CreateTableMutation build() {
Utils.checkNotNull(keyspaceName, "keyspaceName == null");
Utils.checkNotNull(tableName, "tableName == null");
Utils.checkNotNull(partitionKeys, "partitionKeys == null");
return new CreateTableMutation(keyspaceName, tableName, partitionKeys, clusteringKeys, values, ifNotExists);
}
}
public static final class Variables extends Operation.Variables {
private final @NotNull String keyspaceName;
private final @NotNull String tableName;
private final @NotNull List partitionKeys;
private final Input> clusteringKeys;
private final Input> values;
private final Input ifNotExists;
private final transient Map valueMap = new LinkedHashMap<>();
Variables(@NotNull String keyspaceName, @NotNull String tableName,
@NotNull List partitionKeys, Input> clusteringKeys,
Input> values, Input ifNotExists) {
this.keyspaceName = keyspaceName;
this.tableName = tableName;
this.partitionKeys = partitionKeys;
this.clusteringKeys = clusteringKeys;
this.values = values;
this.ifNotExists = ifNotExists;
this.valueMap.put("keyspaceName", keyspaceName);
this.valueMap.put("tableName", tableName);
this.valueMap.put("partitionKeys", partitionKeys);
if (clusteringKeys.defined) {
this.valueMap.put("clusteringKeys", clusteringKeys.value);
}
if (values.defined) {
this.valueMap.put("values", values.value);
}
if (ifNotExists.defined) {
this.valueMap.put("ifNotExists", ifNotExists.value);
}
}
public @NotNull String keyspaceName() {
return keyspaceName;
}
public @NotNull String tableName() {
return tableName;
}
public @NotNull List partitionKeys() {
return partitionKeys;
}
public Input> clusteringKeys() {
return clusteringKeys;
}
public Input> values() {
return values;
}
public Input ifNotExists() {
return ifNotExists;
}
@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);
writer.writeList("partitionKeys", new InputFieldWriter.ListWriter() {
@Override
public void write(InputFieldWriter.ListItemWriter listItemWriter) throws IOException {
for (final ColumnInput $item : partitionKeys) {
listItemWriter.writeObject($item != null ? $item.marshaller() : null);
}
}
});
if (clusteringKeys.defined) {
writer.writeList("clusteringKeys", clusteringKeys.value != null ? new InputFieldWriter.ListWriter() {
@Override
public void write(InputFieldWriter.ListItemWriter listItemWriter) throws IOException {
for (final ClusteringKeyInput $item : clusteringKeys.value) {
listItemWriter.writeObject($item != null ? $item.marshaller() : null);
}
}
} : null);
}
if (values.defined) {
writer.writeList("values", values.value != null ? new InputFieldWriter.ListWriter() {
@Override
public void write(InputFieldWriter.ListItemWriter listItemWriter) throws IOException {
for (final ColumnInput $item : values.value) {
listItemWriter.writeObject($item != null ? $item.marshaller() : null);
}
}
} : null);
}
if (ifNotExists.defined) {
writer.writeBoolean("ifNotExists", ifNotExists.value);
}
}
};
}
}
/**
* Data from the response after executing this GraphQL operation
*/
public static class Data implements Operation.Data {
static final ResponseField[] $responseFields = {
ResponseField.forBoolean("createTable", "createTable", new UnmodifiableMapBuilder(6)
.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("partitionKeys", new UnmodifiableMapBuilder(2)
.put("kind", "Variable")
.put("variableName", "partitionKeys")
.build())
.put("clusteringKeys", new UnmodifiableMapBuilder(2)
.put("kind", "Variable")
.put("variableName", "clusteringKeys")
.build())
.put("values", new UnmodifiableMapBuilder(2)
.put("kind", "Variable")
.put("variableName", "values")
.build())
.put("ifNotExists", new UnmodifiableMapBuilder(2)
.put("kind", "Variable")
.put("variableName", "ifNotExists")
.build())
.build(), true, Collections.emptyList())
};
final Optional createTable;
private transient volatile String $toString;
private transient volatile int $hashCode;
private transient volatile boolean $hashCodeMemoized;
public Data(@Nullable Boolean createTable) {
this.createTable = Optional.ofNullable(createTable);
}
public Optional getCreateTable() {
return this.createTable;
}
@SuppressWarnings({"rawtypes", "unchecked"})
public ResponseFieldMarshaller marshaller() {
return new ResponseFieldMarshaller() {
@Override
public void marshal(ResponseWriter writer) {
writer.writeBoolean($responseFields[0], createTable.isPresent() ? createTable.get() : null);
}
};
}
@Override
public String toString() {
if ($toString == null) {
$toString = "Data{"
+ "createTable=" + createTable
+ "}";
}
return $toString;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof Data) {
Data that = (Data) o;
return this.createTable.equals(that.createTable);
}
return false;
}
@Override
public int hashCode() {
if (!$hashCodeMemoized) {
int h = 1;
h *= 1000003;
h ^= createTable.hashCode();
$hashCode = h;
$hashCodeMemoized = true;
}
return $hashCode;
}
public Builder toBuilder() {
Builder builder = new Builder();
builder.createTable = createTable.isPresent() ? createTable.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 createTable = reader.readBoolean($responseFields[0]);
return new Data(createTable);
}
}
public static final class Builder {
private @Nullable Boolean createTable;
Builder() {
}
public Builder createTable(@Nullable Boolean createTable) {
this.createTable = createTable;
return this;
}
public Data build() {
return new Data(createTable);
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy