Loading docs/api-usage-graphql.rst 0 → 100644 +52 −0 Original line number Diff line number Diff line ############################ Using the GraphQL API (beta) ############################ python-gitlab provides basic support for executing GraphQL queries and mutations. .. danger:: The GraphQL client is experimental and only provides basic support. It does not currently support pagination, obey rate limits, or attempt complex retries. You can use it to build simple queries and mutations. It is currently unstable and its implementation may change. You can expect a more mature client in one of the upcoming versions. The ``gitlab.GraphQL`` class ================================== As with the REST client, you connect to a GitLab instance by creating a ``gitlab.GraphQL`` object: .. code-block:: python import gitlab # anonymous read-only access for public resources (GitLab.com) gq = gitlab.GraphQL() # anonymous read-only access for public resources (self-hosted GitLab instance) gq = gitlab.GraphQL('https://gitlab.example.com') # personal access token or OAuth2 token authentication (GitLab.com) gq = gitlab.GraphQL(token='glpat-JVNSESs8EwWRx5yDxM5q') # personal access token or OAuth2 token authentication (self-hosted GitLab instance) gq = gitlab.GraphQL('https://gitlab.example.com', token='glpat-JVNSESs8EwWRx5yDxM5q') Sending queries =============== Get the result of a query: .. code-block:: python query = """{ query { currentUser { name } } """ result = gq.execute(query) docs/api-usage.rst +4 −4 Original line number Diff line number Diff line ############################ Getting started with the API ############################ ################## Using the REST API ################## python-gitlab only supports GitLab API v4. python-gitlab currently only supports v4 of the GitLab REST API. ``gitlab.Gitlab`` class ======================= Loading docs/cli-usage.rst +3 −3 Original line number Diff line number Diff line ############################ Getting started with the CLI ############################ ############# Using the CLI ############# ``python-gitlab`` provides a :command:`gitlab` command-line tool to interact with GitLab servers. Loading docs/index.rst +1 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ cli-usage api-usage api-usage-advanced api-usage-graphql cli-examples api-objects api/gitlab Loading gitlab/__init__.py +2 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ from gitlab._version import ( # noqa: F401 __title__, __version__, ) from gitlab.client import Gitlab, GitlabList # noqa: F401 from gitlab.client import Gitlab, GitlabList, GraphQL # noqa: F401 from gitlab.exceptions import * # noqa: F401,F403 warnings.filterwarnings("default", category=DeprecationWarning, module="^gitlab") Loading @@ -42,5 +42,6 @@ __all__ = [ "__version__", "Gitlab", "GitlabList", "GraphQL", ] __all__.extend(gitlab.exceptions.__all__) Loading
docs/api-usage-graphql.rst 0 → 100644 +52 −0 Original line number Diff line number Diff line ############################ Using the GraphQL API (beta) ############################ python-gitlab provides basic support for executing GraphQL queries and mutations. .. danger:: The GraphQL client is experimental and only provides basic support. It does not currently support pagination, obey rate limits, or attempt complex retries. You can use it to build simple queries and mutations. It is currently unstable and its implementation may change. You can expect a more mature client in one of the upcoming versions. The ``gitlab.GraphQL`` class ================================== As with the REST client, you connect to a GitLab instance by creating a ``gitlab.GraphQL`` object: .. code-block:: python import gitlab # anonymous read-only access for public resources (GitLab.com) gq = gitlab.GraphQL() # anonymous read-only access for public resources (self-hosted GitLab instance) gq = gitlab.GraphQL('https://gitlab.example.com') # personal access token or OAuth2 token authentication (GitLab.com) gq = gitlab.GraphQL(token='glpat-JVNSESs8EwWRx5yDxM5q') # personal access token or OAuth2 token authentication (self-hosted GitLab instance) gq = gitlab.GraphQL('https://gitlab.example.com', token='glpat-JVNSESs8EwWRx5yDxM5q') Sending queries =============== Get the result of a query: .. code-block:: python query = """{ query { currentUser { name } } """ result = gq.execute(query)
docs/api-usage.rst +4 −4 Original line number Diff line number Diff line ############################ Getting started with the API ############################ ################## Using the REST API ################## python-gitlab only supports GitLab API v4. python-gitlab currently only supports v4 of the GitLab REST API. ``gitlab.Gitlab`` class ======================= Loading
docs/cli-usage.rst +3 −3 Original line number Diff line number Diff line ############################ Getting started with the CLI ############################ ############# Using the CLI ############# ``python-gitlab`` provides a :command:`gitlab` command-line tool to interact with GitLab servers. Loading
docs/index.rst +1 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ cli-usage api-usage api-usage-advanced api-usage-graphql cli-examples api-objects api/gitlab Loading
gitlab/__init__.py +2 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ from gitlab._version import ( # noqa: F401 __title__, __version__, ) from gitlab.client import Gitlab, GitlabList # noqa: F401 from gitlab.client import Gitlab, GitlabList, GraphQL # noqa: F401 from gitlab.exceptions import * # noqa: F401,F403 warnings.filterwarnings("default", category=DeprecationWarning, module="^gitlab") Loading @@ -42,5 +42,6 @@ __all__ = [ "__version__", "Gitlab", "GitlabList", "GraphQL", ] __all__.extend(gitlab.exceptions.__all__)