Skip to content

Commit 67ca0d3

Browse files
committed
refactor: rename BaseSCIMClient in SCIMClient
1 parent f891122 commit 67ca0d3

File tree

9 files changed

+69
-66
lines changed

9 files changed

+69
-66
lines changed

doc/changelog.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Changelog
88

99
This version comes with breaking changes:
1010

11-
- :class:`~scim2_client.BaseSCIMClient` takes a mandatory :paramref:`~scim2_client.BaseSCIMClient.resource_types` parameter.
11+
- :class:`~scim2_client.SCIMClient` takes a mandatory :paramref:`~scim2_client.SCIMClient.resource_types` parameter.
1212

1313
Added
1414
^^^^^
15-
- Implement :meth:`~scim2_client.BaseSCIMClient.register_naive_resource_types`.
15+
- Implement :meth:`~scim2_client.SCIMClient.register_naive_resource_types`.
1616
- Implement :meth:`~scim2_client.BaseSyncSCIMClient.discover` methods.
1717

1818
[0.3.3] - 2024-11-29
@@ -28,9 +28,9 @@ Added
2828

2929
Added
3030
^^^^^
31-
- Implement :class:`~scim2_client.BaseSCIMClient` :paramref:`~scim2_client.BaseSCIMClient.check_request_payload`,
32-
:paramref:`~scim2_client.BaseSCIMClient.check_response_payload` and
33-
:paramref:`~scim2_client.BaseSCIMClient.raise_scim_errors` paramibutes,
31+
- Implement :class:`~scim2_client.SCIMClient` :paramref:`~scim2_client.SCIMClient.check_request_payload`,
32+
:paramref:`~scim2_client.SCIMClient.check_response_payload` and
33+
:paramref:`~scim2_client.SCIMClient.raise_scim_errors` paramibutes,
3434
to keep the same values for all the requests.
3535

3636
[0.3.1] - 2024-11-29

doc/tutorial.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,29 @@ Initialization
77
scim2-client depends on request engines such as `httpx <https://github.com/encode/httpx>`_ to perform network requests.
88
This tutorial demonstrate how to use scim2-client with httpx, and suppose you have installed the `httpx` extra for example with ``pip install scim2-models[httpx]``.
99

10-
As a start you will need to instantiate a httpx :code:`Client` object that you can parameter as your will, and then pass it to a :class:`SCIM client <scim2_client.BaseSCIMClient>` object.
10+
As a start you will need to instantiate a httpx :code:`Client` object that you can parameter as your will, and then pass it to a :class:`~scim2_client.SCIMClient` object.
1111
In addition to your SCIM server root endpoint, you will probably want to provide some authorization headers through the httpx :code:`Client` :code:`headers` parameter:
1212

1313
.. code-block:: python
1414
1515
from httpx import Client
1616
from scim2_client.engines.httpx import SyncSCIMClient
1717
18-
client = Client(base_url="https://auth.example/scim/v2", headers={"Authorization": "Bearer foobar"})
18+
client = Client(
19+
base_url="https://auth.example/scim/v2",
20+
headers={"Authorization": "Bearer foobar"},
21+
)
1922
scim = SyncSCIMClient(client)
2023
21-
You need to give to indicate to :class:`~scim2_client.BaseSCIMClient` all the different :class:`~scim2_models.Resource` models that you will need to manipulate, and the matching :class:`~scim2_models.ResourceType` objects to let the client know where to look for resources on the server.
24+
You need to give to indicate to :class:`~scim2_client.SCIMClient` all the different :class:`~scim2_models.Resource` models that you will need to manipulate, and the matching :class:`~scim2_models.ResourceType` objects to let the client know where to look for resources on the server.
2225

2326
You can either provision those objects manually or automatically.
2427

2528
Automatic provisioning
2629
~~~~~~~~~~~~~~~~~~~~~~
2730

2831
The easiest way is to let the client discover what :class:`~scim2_models.Schema` and :class:`~scim2_models.ResourceType` are available on the server by calling :meth:`~scim2_client.BaseSyncSCIMClient.discover`.
29-
It will dynamically generate models based on those schema, and make them available to use with :meth:`~scim2_client.BaseSCIMClient.get_resource_model`.
32+
It will dynamically generate models based on those schema, and make them available to use with :meth:`~scim2_client.SCIMClient.get_resource_model`.
3033

3134
.. code-block:: python
3235
:caption: Dynamically discover models from the server
@@ -36,7 +39,7 @@ It will dynamically generate models based on those schema, and make them availab
3639
3740
Manual provisioning
3841
~~~~~~~~~~~~~~~~~~~
39-
To manually register models and resource types, you can simply use the :paramref:`~scim2_client.BaseSCIMClient.resource_models` and :paramref:`~scim2_client.BaseSCIMClient.resource_types` arguments.
42+
To manually register models and resource types, you can simply use the :paramref:`~scim2_client.SCIMClient.resource_models` and :paramref:`~scim2_client.SCIMClient.resource_types` arguments.
4043

4144

4245
.. code-block:: python
@@ -54,7 +57,7 @@ To manually register models and resource types, you can simply use the :paramref
5457
If you know that all the resources are hosted at regular server endpoints
5558
(for instance `/Users` for :class:`~scim2_models.User` etc.),
5659
you can skip passing the :class:`~scim2_models.ResourceType` objects by hand,
57-
and simply call :meth:`~scim2_client.BaseSCIMClient.register_naive_resource_types`.
60+
and simply call :meth:`~scim2_client.SCIMClient.register_naive_resource_types`.
5861

5962
.. code-block:: python
6063
:caption: Manually registering models and resource types
@@ -99,20 +102,20 @@ Have a look at the :doc:`reference` to see usage examples and the exhaustive set
99102
Request and response validation
100103
===============================
101104

102-
By default, the data passed to the :class:`SCIM client <scim2_client.BaseSCIMClient>` as well as the server response will be validated against the SCIM specifications, and will raise an error if they don't respect them.
105+
By default, the data passed to the :class:`SCIM client <scim2_client.SCIMClient>` as well as the server response will be validated against the SCIM specifications, and will raise an error if they don't respect them.
103106
However sometimes you want to accept invalid inputs and outputs.
104107
To achieve this, all the methods provide the following parameters, all are :data:`True` by default:
105108

106-
- :paramref:`~scim2_client.BaseSCIMClient.check_request_payload`:
109+
- :paramref:`~scim2_client.SCIMClient.check_request_payload`:
107110
If :data:`True` (the default) a :class:`~pydantic.ValidationError` will be raised if the input does not respect the SCIM standard.
108111
If :data:`False`, input is expected to be a :data:`dict` that will be passed as-is in the request.
109-
- :paramref:`~scim2_client.BaseSCIMClient.check_response_payload`:
112+
- :paramref:`~scim2_client.SCIMClient.check_response_payload`:
110113
If :data:`True` (the default) a :class:`~pydantic.ValidationError` will be raised if the server response does not respect the SCIM standard.
111114
If :data:`False` the server response is returned as-is.
112115
- :code:`expected_status_codes`: The list of expected status codes in the response.
113116
If :data:`None` any status code is accepted.
114117
If an unexpected status code is returned, a :class:`~scim2_client.errors.UnexpectedStatusCode` exception is raised.
115-
- :paramref:`~scim2_client.BaseSCIMClient.raise_scim_errors`: If :data:`True` (the default) and the server returned an :class:`~scim2_models.Error` object, a :class:`~scim2_client.SCIMResponseErrorObject` exception will be raised.
118+
- :paramref:`~scim2_client.SCIMClient.raise_scim_errors`: If :data:`True` (the default) and the server returned an :class:`~scim2_models.Error` object, a :class:`~scim2_client.SCIMResponseErrorObject` exception will be raised.
116119
If :data:`False` the error object is returned.
117120

118121

@@ -134,7 +137,7 @@ Currently those engines are shipped:
134137
It takes a WSGI app and directly execute the server code instead of performing real HTTP requests.
135138
This is faster in unit test suites, and helpful to catch the server exceptions.
136139

137-
You can easily implement your own engine by inheriting from :class:`~scim2_client.BaseSCIMClient`.
140+
You can easily implement your own engine by inheriting from :class:`~scim2_client.SCIMClient`.
138141

139142
Additional request parameters
140143
=============================

scim2_client/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from .client import BaseSCIMClient
21
from .client import BaseSyncSCIMClient
2+
from .client import SCIMClient
33
from .errors import RequestNetworkError
44
from .errors import RequestPayloadValidationError
55
from .errors import ResponsePayloadValidationError
@@ -12,7 +12,7 @@
1212
from .errors import UnexpectedStatusCode
1313

1414
__all__ = [
15-
"BaseSCIMClient",
15+
"SCIMClient",
1616
"BaseSyncSCIMClient",
1717
"SCIMClientError",
1818
"SCIMRequestError",

0 commit comments

Comments
 (0)