APICategoryGraphQLBehavior
public protocol APICategoryGraphQLBehavior : AnyObject, Sendable
Behavior of the API category related to GraphQL operations
Note
Sendable because the implementing plugin is Sendable (see Plugin) and DataStore
holds this behavior across task boundaries throughout the sync engine.
-
query(request:Asynchronous) Perform a GraphQL query operation against a previously configured API. This operation will be asynchronous, with the callback accessible both locally and via the Hub.
Declaration
Swift
func query<R>(request: GraphQLRequest<R>) async throws -> GraphQLTask<R>.Success where R : Decodable, R : SendableParameters
requestThe GraphQL request containing apiName, document, variables, and responseType
listenerThe event listener for the operation
Return Value
The AmplifyOperation being enqueued
-
mutate(request:Asynchronous) Perform a GraphQL mutate operation against a previously configured API. This operation will be asynchronous, with the callback accessible both locally and via the Hub.
Declaration
Swift
func mutate<R>(request: GraphQLRequest<R>) async throws -> GraphQLTask<R>.Success where R : Decodable, R : SendableParameters
requestThe GraphQL request containing apiName, document, variables, and responseType
listenerThe event listener for the operation
Return Value
The AmplifyOperation being enqueued
-
Perform a GraphQL subscribe operation against a previously configured API. This operation will be asychronous, with the callback accessible both locally and via the Hub.
Declaration
Swift
func subscribe<R: Decodable>( request: GraphQLRequest<R> ) -> AmplifyAsyncThrowingSequence<GraphQLSubscriptionEvent<R>>Parameters
requestThe GraphQL request containing apiName, document, variables, and responseType
valueListenerInvoked when the GraphQL subscription receives a new value from the service
completionListenerInvoked when the subscription has terminated
Return Value
The AmplifyInProcessReportingOperation being enqueued
View on GitHub