platform/graphql_schema/lib/src/gen.dart

45 lines
1.4 KiB
Dart
Raw Normal View History

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,
2018-08-04 19:18:53 +00:00
Iterable<GraphQLObjectField> fields = const [],
2018-08-03 23:43:00 +00:00
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
2018-08-04 19:18:53 +00:00
GraphQLObjectField<T, Serialized> field<T, Serialized>(
String name, GraphQLType<T, Serialized> type,
{Iterable<GraphQLFieldInput<T, Serialized>> inputs: const [],
2018-08-02 13:31:54 +00:00
GraphQLFieldResolver<T, Serialized> resolve,
2018-08-04 19:18:53 +00:00
String deprecationReason, String description}) {
return new GraphQLObjectField<T, Serialized>(name, type,
arguments: inputs,
2018-08-05 01:32:20 +00:00
resolve: resolve,
2018-08-04 19:18:53 +00:00
description: description,
2018-08-03 18:59:31 +00:00
deprecationReason: deprecationReason);
2018-08-02 13:31:54 +00:00
}
2018-08-04 19:18:53 +00:00
GraphQLInputObjectType inputObjectType(String name,
{String description,
Iterable<GraphQLInputObjectField> inputFields: const []}) {
return new GraphQLInputObjectType(name,
description: description, inputFields: inputFields);
}
GraphQLInputObjectField<T, Serialized> inputField<T, Serialized>(
String name, GraphQLType<T, Serialized> type,
{String description, T defaultValue}) {
return new GraphQLInputObjectField(name, type,
description: description, defaultValue: defaultValue);
}