getIntrospectionSchema method
Future<GetIntrospectionSchemaResponse>
getIntrospectionSchema({
- required String apiId,
- required OutputType format,
- bool? includeDirectives,
Retrieves the introspection schema for a GraphQL API.
May throw GraphQLSchemaException. May throw NotFoundException. May throw UnauthorizedException. May throw InternalFailureException.
Parameter apiId
:
The API ID.
Parameter format
:
The schema format: SDL or JSON.
Parameter includeDirectives
:
A flag that specifies whether the schema introspection should contain
directives.
Implementation
Future<GetIntrospectionSchemaResponse> getIntrospectionSchema({
required String apiId,
required OutputType format,
bool? includeDirectives,
}) async {
ArgumentError.checkNotNull(apiId, 'apiId');
ArgumentError.checkNotNull(format, 'format');
final $query = <String, List<String>>{
'format': [format.toValue()],
if (includeDirectives != null)
'includeDirectives': [includeDirectives.toString()],
};
final response = await _protocol.sendRaw(
payload: null,
method: 'GET',
requestUri: '/v1/apis/${Uri.encodeComponent(apiId)}/schema',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return GetIntrospectionSchemaResponse(
schema: await response.stream.toBytes(),
);
}