You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check the [tutorial](https://scim2-client.readthedocs.io/en/latest/tutorial.html) and the [reference](https://scim2-client.readthedocs.io/en/latest/reference.html) for more details.
25
+
Check the [tutorial](https://scim2-client.readthedocs.io/en/latest/tutorial.html)
26
+
and the [reference](https://scim2-client.readthedocs.io/en/latest/reference.html) for more details.
26
27
27
28
Here is an example of usage:
28
29
29
30
```python
30
31
import datetime
31
32
from httpx import Client
32
-
from scim2_models importUser, EnterpriseUser, Group, Error
33
+
from scim2_models import Error
33
34
from scim2_client.engines.httpx import SyncSCIMClient
You need to give to indicate to :class:`~scim2_client.BaseSCIMClient` all the different :class:`~scim2_models.Resource` types that you will need to manipulate with the :code:`resource_models` parameter.
23
-
This is needed so scim2-client will be able to guess which resource type to instante when an arbitrary payload is met.
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
22
25
-
.. todo::
23
+
You can either provision those objects manually or automatically.
26
24
27
-
We plan to implement the automatic discovery of SCIM server resources,
28
-
so they can dynamically be used without explicitly passing them with the :code:`resource_models` parameter.
25
+
Automatic provisioning
26
+
~~~~~~~~~~~~~~~~~~~~~~
27
+
28
+
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`.
30
+
31
+
.. code-block:: python
32
+
:caption: Dynamically discover models from the server
33
+
34
+
scim.discover()
35
+
User = scim.get_resource_model("User")
36
+
37
+
Manual provisioning
38
+
~~~~~~~~~~~~~~~~~~~
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.
40
+
41
+
42
+
.. code-block:: python
43
+
:caption: Manually registering models and resource types
44
+
45
+
from scim2_models import User, EnterpriseUserUser, Group, ResourceType
0 commit comments