GraphQLRequest<T> class
A GraphQL request with a few extra properties used to decode the response or use the correct API if the backend has multiple.
Constructors
-
GraphQLRequest({required String document, String? apiName, APIAuthorizationType<
AmplifyAuthProvider> ? authorizationMode, Map<String, dynamic> variables = const <String, dynamic>{}, Map<String, String> ? headers, String? decodePath, ModelType<Model> ? modelType})
Properties
- apiName → String?
-
Only required if your backend has multiple GraphQL endpoints in the amplifyconfiguration.dart file. This parameter is then needed to specify which one to use for this request.
final
-
Authorization type to use for this request.
final
- decodePath → String?
-
Only required for custom decoding logic. In most cases, will match the operation name in the
document
.final - document → String
-
The body of the request, starting with the operation type and operation name.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> ? -
A map of Strings to dynamically use for custom headers in the http request.
final
- id → String
-
final
-
modelType
→ ModelType<
Model> ? -
Only required for custom decoding logic. The response will be decoded to this type.
For a request of a single instance (like get, update, create or delete):
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
variables
→ Map<
String, dynamic> -
A map of values to dynamically use for variable names in the
document
.final
Methods
-
copyWith(
{String? document, String? apiName, Map< String, String> ? headers, APIAuthorizationType<AmplifyAuthProvider> ? authorizationMode, Map<String, dynamic> ? variables, String? decodePath, ModelType<Model> ? modelType}) → GraphQLRequest<T> - Creates a copy of this request with the given fields replaced with the new values. If no new value is given, the old value is used.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> -
Serializes
this
as a JSON object. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited