2020-01-03 07:43:49 +01:00
|
|
|
import "package:gql_exec/gql_exec.dart";
|
2019-12-07 06:18:44 +01:00
|
|
|
import "package:gql/language.dart";
|
|
|
|
import 'package:gql_link/gql_link.dart';
|
|
|
|
|
|
|
|
class GithubRequestSerializer extends RequestSerializer {
|
|
|
|
const GithubRequestSerializer();
|
|
|
|
|
|
|
|
@override
|
|
|
|
Map<String, dynamic> serializeRequest(Request request) {
|
|
|
|
final RequestExtensionsThunk thunk = request.context.entry();
|
|
|
|
|
|
|
|
return <String, dynamic>{
|
|
|
|
// Remove operationName here for GitHub API compatibility
|
|
|
|
// "operationName": request.operation.operationName,
|
2020-01-03 07:43:49 +01:00
|
|
|
"variables": request.variables,
|
2019-12-07 06:18:44 +01:00
|
|
|
"query": printNode(request.operation.document),
|
|
|
|
if (thunk != null)
|
|
|
|
"extensions": thunk.getRequestExtensions(request),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|