Skip to content

Commit 4891b1e

Browse files
committed
feat(graphql): Extend GraphQL class to support multiple authentication methods and more API options
This commit extends the constructor (`__init__` method) of the `GraphQL` class to handle a wider range of interactions with the GitLab API. The main changes include: - **Added support for multiple authentication tokens:** In addition to the original `token`, it now supports `private_token`, `oauth_token`, and `job_token`, allowing users to configure based on different authentication requirements. - **Added HTTP Basic Authentication:** Introduced `http_username` and `http_password` parameters, allowing the use of HTTP Basic Authentication to interact with the API. - **Added API version control:** Introduced the `api_version` parameter, with a default value of `"4"`, allowing users to specify the GitLab API version to use. - **Added pagination control parameters:** Added `per_page`, `pagination`, and `order_by` parameters to provide finer control over the API's pagination behavior and data sorting. - **Added an option to keep the Base URL:** Added the `keep_base_url` parameter, allowing the configured base URL to be retained across multiple API calls. - **Added `**kwargs: Any`:** Allows passing additional keyword arguments, providing greater flexibility. These changes make the `GraphQL` class more powerful and flexible, capable of handling a broader range of GitLab API use cases.
1 parent af137ca commit 4891b1e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

gitlab/client.py

+11
Original file line numberDiff line numberDiff line change
@@ -1315,14 +1315,25 @@ def __init__(
13151315
url: str | None = None,
13161316
*,
13171317
token: str | None = None,
1318+
private_token: str | None = None,
1319+
oauth_token: str | None = None,
1320+
job_token: str | None = None,
13181321
ssl_verify: bool | str = True,
13191322
client: httpx.Client | None = None,
1323+
http_username: str | None = None,
1324+
http_password: str | None = None,
13201325
timeout: float | None = None,
1326+
api_version: str = "4",
1327+
per_page: int | None = None,
1328+
pagination: str | None = None,
1329+
order_by: str | None = None,
13211330
user_agent: str = gitlab.const.USER_AGENT,
13221331
fetch_schema_from_transport: bool = False,
13231332
max_retries: int = 10,
13241333
obey_rate_limit: bool = True,
13251334
retry_transient_errors: bool = False,
1335+
keep_base_url: bool = False,
1336+
**kwargs: Any,
13261337
) -> None:
13271338
super().__init__(
13281339
url=url,

0 commit comments

Comments
 (0)