@@ -77,6 +77,22 @@ class ResponseHeaders(Protocol):
7777 def get (self , key : str , / ) -> str | None : ...
7878
7979
80+ class RawResponse (Protocol ):
81+ """A response as returned by the HTTP library of an engine."""
82+
83+ @property
84+ def status_code (self ) -> int :
85+ """The HTTP status code."""
86+
87+ @property
88+ def headers (self ) -> ResponseHeaders :
89+ """The HTTP headers."""
90+
91+ @property
92+ def text (self ) -> str :
93+ """The body, decoded as text."""
94+
95+
8096def describe_resource_models (
8197 resource_models : Collection [type [Resource [Any ]]],
8298) -> tuple [tuple [DescribedModel , ...], tuple [ResourceType , ...]]:
@@ -1776,6 +1792,29 @@ def discover(
17761792 discovered_schemas , discovered_resource_types , config
17771793 )
17781794
1795+ def request (self , method : str , url : str , ** kwargs : Any ) -> RawResponse :
1796+ """Send a request to the server, without any SCIM processing.
1797+
1798+ Neither the request nor the response is checked, so this is fitted to
1799+ observe how the server behaves, for instance with an unsupported HTTP method.
1800+
1801+ :param method: The HTTP method.
1802+ :param url: The URL, relative to the SCIM server base URL.
1803+ :param kwargs: Additional parameters passed to the underlying
1804+ HTTP request library.
1805+ :return: The response of the underlying HTTP request library.
1806+ :raises ~scim2_client.RequestNetworkException: When the request cannot be sent.
1807+
1808+ :usage:
1809+
1810+ .. code-block:: python
1811+ :caption: Checking that the ``/Schemas`` endpoint refuses ``DELETE``
1812+
1813+ response = scim.request("DELETE", "/Schemas")
1814+ assert response.status_code == 405
1815+ """
1816+ raise NotImplementedError ()
1817+
17791818
17801819class BaseAsyncSCIMClient (SCIMClient ):
17811820 """Base class for asynchronous request clients."""
@@ -2275,3 +2314,26 @@ async def discover(
22752314 self .provider = self ._describe_service (
22762315 discovered_schemas , discovered_resource_types , config
22772316 )
2317+
2318+ async def request (self , method : str , url : str , ** kwargs : Any ) -> RawResponse :
2319+ """Send a request to the server, without any SCIM processing.
2320+
2321+ Neither the request nor the response is checked, so this is fitted to
2322+ observe how the server behaves, for instance with an unsupported HTTP method.
2323+
2324+ :param method: The HTTP method.
2325+ :param url: The URL, relative to the SCIM server base URL.
2326+ :param kwargs: Additional parameters passed to the underlying
2327+ HTTP request library.
2328+ :return: The response of the underlying HTTP request library.
2329+ :raises ~scim2_client.RequestNetworkException: When the request cannot be sent.
2330+
2331+ :usage:
2332+
2333+ .. code-block:: python
2334+ :caption: Checking that the ``/Schemas`` endpoint refuses ``DELETE``
2335+
2336+ response = await scim.request("DELETE", "/Schemas")
2337+ assert response.status_code == 405
2338+ """
2339+ raise NotImplementedError ()
0 commit comments