ds_protocol_graphql_py_lib.dataset.request

File: request.py Region: ds_protocol_graphql_py_lib/dataset/request

Immutable GraphQL-over-HTTP request snapshot used by pagination.

Pagination only ever changes variables; the query document is never rewritten.

Example

>>> snapshot = GraphqlRequestSnapshot(url="https://api/graphql", query="{ a }", variables={"x": 1})
>>> snapshot.with_variables({"after": "c1"}).to_payload()
{'query': '{ a }', 'variables': {'x': 1, 'after': 'c1'}}

Classes

GraphqlRequestSnapshot

One GraphQL POST: endpoint, document, variables, operation name, headers.

Module Contents

class ds_protocol_graphql_py_lib.dataset.request.GraphqlRequestSnapshot[source]

One GraphQL POST: endpoint, document, variables, operation name, headers.

url: str
query: str
variables: dict[str, Any]
operation_name: str | None = None
headers: dict[str, str] | None = None
with_variables(values: dict[str, Any]) → GraphqlRequestSnapshot[source]

Return a copy with values merged into variables.

Injected values win over existing variables with the same name. The original snapshot is not modified.

to_payload() → dict[str, Any][source]

Build the JSON body for the GraphQL POST.