2018-08-02 13:31:54 +00:00
|
|
|
part of graphql_schema.src.schema;
|
|
|
|
|
|
|
|
GraphQLObjectType objectType(String name,
|
2018-08-03 23:43:00 +00:00
|
|
|
{String description,
|
|
|
|
bool isInterface: false,
|
|
|
|
Iterable<GraphQLField> fields = const [],
|
|
|
|
Iterable<GraphQLObjectType> interfaces = const []}) {
|
|
|
|
var obj = new GraphQLObjectType(name, description, isInterface: isInterface)
|
|
|
|
..fields.addAll(fields ?? []);
|
|
|
|
|
|
|
|
if (interfaces?.isNotEmpty == true) {
|
|
|
|
for (var i in interfaces) {
|
|
|
|
obj.inheritFrom(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
2018-08-02 13:31:54 +00:00
|
|
|
|
|
|
|
GraphQLField<T, Serialized> field<T, Serialized>(String name,
|
2018-08-02 15:17:14 +00:00
|
|
|
{Iterable<GraphQLFieldArgument<T, Serialized>> arguments: const [],
|
2018-08-02 13:31:54 +00:00
|
|
|
GraphQLFieldResolver<T, Serialized> resolve,
|
2018-08-03 18:59:31 +00:00
|
|
|
GraphQLType<T, Serialized> type,
|
|
|
|
String deprecationReason}) {
|
2018-08-02 13:31:54 +00:00
|
|
|
return new GraphQLField(name,
|
2018-08-03 18:59:31 +00:00
|
|
|
arguments: arguments,
|
|
|
|
resolve: resolve,
|
|
|
|
type: type,
|
|
|
|
deprecationReason: deprecationReason);
|
2018-08-02 13:31:54 +00:00
|
|
|
}
|