ace.core.graphql.request

GraphQL Request Module

This module defines the GraphQLRequest dataclass that holds the built query/mutation and provides methods for execution.

class ace.core.graphql.request.GraphQLRequest(query: str, operation_name: str | None = None, operation_type: str = 'query', variables: Dict[str, ~typing.Any]=<factory>)[source]

Bases: object

Represents a built GraphQL request ready for execution.

query

The GraphQL query/mutation string

Type:

str

variables

The variables to pass with the request

Type:

Dict[str, Any]

operation_name

The name of the operation (optional)

Type:

str | None

operation_type

Either ‘query’ or ‘mutation’

Type:

str

query: str
operation_name: str | None = None
operation_type: str = 'query'
variables: Dict[str, Any]
to_dict() Dict[str, Any][source]

Convert request to dictionary format for HTTP payload.

with_variables(variables: Dict[str, Any]) GraphQLRequest[source]

Create a new request with the given variables.

Parameters:

variables – Dictionary of variable values

Returns:

New GraphQLRequest with variables set

__init__(query: str, operation_name: str | None = None, operation_type: str = 'query', variables: Dict[str, ~typing.Any]=<factory>) None