Skip to content

Commit 9c64f7e

Browse files
committed
feat(api): Use client.execute variables
Adding this feature would directly allow specific conditions to be variables, increasing the flexibility of application. Using variables: https://gql.readthedocs.io/en/stable/usage/variables.html
1 parent 748ed9c commit 9c64f7e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gitlab/client.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,12 @@ def __enter__(self) -> GraphQL:
14241424
def __exit__(self, *args: Any) -> None:
14251425
self._http_client.close()
14261426

1427-
def execute(self, request: str | graphql.Source, *args: Any, **kwargs: Any) -> Any:
1427+
def execute(
1428+
self, request: str | graphql.Source,
1429+
variable_values: dict,
1430+
*args: Any,
1431+
**kwargs: Any
1432+
) -> Any:
14281433
parsed_document = self._gql(request)
14291434
retry = utils.Retry(
14301435
max_retries=self._max_retries,
@@ -1434,7 +1439,10 @@ def execute(self, request: str | graphql.Source, *args: Any, **kwargs: Any) -> A
14341439

14351440
while True:
14361441
try:
1437-
result = self._client.execute(parsed_document, *args, **kwargs)
1442+
result = self._client.execute(
1443+
parsed_document,
1444+
variable_values=variable_values,
1445+
*args, **kwargs)
14381446
except gql.transport.exceptions.TransportServerError as e:
14391447
if retry.handle_retry_on_status(
14401448
status_code=e.code, headers=self._transport.response_headers

0 commit comments

Comments
 (0)