io.smallrye.graphql.client.core.Operation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of smallrye-graphql-client-api Show documentation
Show all versions of smallrye-graphql-client-api Show documentation
SmallRye specific Client API, extending the MicroProfile client api, allowing us to play with the api first before we move it to the spec
package io.smallrye.graphql.client.core;
import static io.smallrye.graphql.client.core.OperationType.QUERY;
import static io.smallrye.graphql.client.core.utils.ServiceUtils.getNewInstanceOf;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import java.util.List;
public interface Operation extends FragmentOrOperation {
/*
* Helpers
*/
static List operations(Operation... operations) {
return asList(operations);
}
// (fields)
static Operation operation(FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(QUERY);
operation.setName("");
operation.setVariables(emptyList());
operation.setFields(asList(fields));
operation.setDirectives(emptyList());
return operation;
}
// (directives, fields)
static Operation operationWithDirectives(List directives, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(QUERY);
operation.setName("");
operation.setVariables(emptyList());
operation.setFields(asList(fields));
operation.setDirectives(directives);
return operation;
}
// (vars, fields)
static Operation operation(List vars, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(QUERY);
operation.setName("");
operation.setVariables(vars);
operation.setFields(asList(fields));
operation.setDirectives(emptyList());
return operation;
}
// (vars, directives, fields)
static Operation operationWithDirectives(List vars, List directives, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(QUERY);
operation.setName("");
operation.setVariables(vars);
operation.setFields(asList(fields));
operation.setDirectives(directives);
return operation;
}
// (type, fields)
static Operation operation(OperationType type, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(type);
operation.setName("");
operation.setVariables(emptyList());
operation.setFields(asList(fields));
operation.setDirectives(emptyList());
return operation;
}
// (type, directives, fields)
static Operation operationWithDirectives(OperationType type,
List directives,
FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(type);
operation.setName("");
operation.setVariables(emptyList());
operation.setFields(asList(fields));
operation.setDirectives(directives);
return operation;
}
// (type, vars, fields)
static Operation operation(OperationType type, List vars, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(type);
operation.setName("");
operation.setVariables(vars);
operation.setFields(asList(fields));
operation.setDirectives(emptyList());
return operation;
}
// (type, vars, directives, fields)
static Operation operationWithDirectives(OperationType type,
List vars,
List directives,
FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(type);
operation.setName("");
operation.setVariables(vars);
operation.setFields(asList(fields));
operation.setDirectives(directives);
return operation;
}
// (name, fields)
static Operation operation(String name, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(QUERY);
operation.setName(name);
operation.setVariables(emptyList());
operation.setFields(asList(fields));
operation.setDirectives(emptyList());
return operation;
}
// (name, directives, fields)
static Operation operationWithDirectives(String name, List directives, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(QUERY);
operation.setName(name);
operation.setVariables(emptyList());
operation.setFields(asList(fields));
operation.setDirectives(directives);
return operation;
}
// (type, name, fields)
static Operation operation(OperationType type, String name, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(type);
operation.setName(name);
operation.setVariables(emptyList());
operation.setFields(asList(fields));
operation.setDirectives(emptyList());
return operation;
}
// (type, name, directives, fields)
static Operation operationWithDirectives(OperationType type,
String name,
List directives,
FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(type);
operation.setName(name);
operation.setVariables(emptyList());
operation.setFields(asList(fields));
operation.setDirectives(directives);
return operation;
}
// (name, vars, fields)
static Operation operation(String name, List vars, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(QUERY);
operation.setName(name);
operation.setVariables(vars);
operation.setFields(asList(fields));
operation.setDirectives(emptyList());
return operation;
}
// (name, vars, directives, fields)
static Operation operationWithDirectives(String name,
List vars,
List directives,
FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(QUERY);
operation.setName(name);
operation.setVariables(vars);
operation.setFields(asList(fields));
operation.setDirectives(directives);
return operation;
}
// (type, name, vars, fields)
static Operation operation(OperationType type, String name, List vars, FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(type);
operation.setName(name);
operation.setVariables(vars);
operation.setFields(asList(fields));
operation.setDirectives(emptyList());
return operation;
}
// (type, name, vars, directives, fields)
static Operation operationWithDirectives(OperationType type,
String name,
List vars,
List directives,
FieldOrFragment... fields) {
Operation operation = getNewInstanceOf(Operation.class);
operation.setType(type);
operation.setName(name);
operation.setVariables(vars);
operation.setFields(asList(fields));
operation.setDirectives(directives);
return operation;
}
/*
* Getter/Setter
*/
OperationType getType();
void setType(OperationType type);
String getName();
void setName(String name);
List getVariables();
void setVariables(List vars);
List getFields();
void setFields(List fields);
List getDirectives();
void setDirectives(List directives);
}