1616from .middleware .options import GraphTelemetryHandlerOption
1717
1818
19- class GraphClientFactory (KiotaClientFactory ):
19+ class GraphClientFactory ():
2020 """Constructs httpx.AsyncClient instances configured with either custom or default
2121 pipeline of graph specific middleware.
2222 """
@@ -35,10 +35,13 @@ def create_with_default_middleware( # type: ignore
3535 Args:
3636 api_version (APIVersion): The Graph API version to be used.
3737 Defaults to APIVersion.v1.
38- client (httpx.AsyncClient): The httpx.AsyncClient instance to be used.
39- Defaults to KiotaClientFactory.get_default_client().
38+ This is only used if the client parameter is None.
39+ client (Optional[httpx.AsyncClient]]): The httpx.AsyncClient instance to be used.
40+ Defaults to None.
41+ When None, a default client will be created with the base url set to https://{host}/{api_version}.
4042 host (NationalClouds): The national clound endpoint to be used.
4143 Defaults to NationalClouds.Global.
44+ This is only used if the client parameter is None.
4245 options (Optional[dict[str, RequestOption]]): The request options to use when
4346 instantiating default middleware. Defaults to dict[str, RequestOption]=None.
4447
@@ -47,7 +50,7 @@ def create_with_default_middleware( # type: ignore
4750 """
4851 if client is None :
4952 client = KiotaClientFactory .get_default_client ()
50- client .base_url = GraphClientFactory ._get_base_url (host , api_version ) # type: ignore
53+ client .base_url = GraphClientFactory ._get_base_url (host , api_version ) # type: ignore
5154 middleware = KiotaClientFactory .get_default_middleware (options )
5255 telemetry_handler = GraphClientFactory ._get_telemetry_handler (options )
5356 middleware .append (telemetry_handler )
@@ -64,19 +67,23 @@ def create_with_custom_middleware( # type: ignore
6467 """Applies a custom middleware chain to the HTTP Client
6568
6669 Args:
67- middleware(list[BaseMiddleware]): Custom middleware list that will be used to create
70+ middleware(Optional[ list[BaseMiddleware] ]): Custom middleware list that will be used to create
6871 a middleware pipeline. The middleware should be arranged in the order in which they will
6972 modify the request.
70- api_version (APIVersion): The Graph API version to be used.
73+ Defaults to None,
74+ api_version (APIVersion): The Graph API version to be used.
7175 Defaults to APIVersion.v1.
72- client (httpx.AsyncClient): The httpx.AsyncClient instance to be used.
73- Defaults to KiotaClientFactory.get_default_client().
74- host (NationalClouds): The national clound endpoint to be used.
76+ This is only used if the client parameter is None.
77+ client (Optional[httpx.AsyncClient]): The httpx.AsyncClient instance to be used.
78+ Defaults to None.
79+ When None, a default client will be created with the base url set to https://{host}/{api_version}.
80+ host (NationalClouds): The national cloud endpoint to be used.
7581 Defaults to NationalClouds.Global.
82+ This is only used if the client parameter is None.
7683 """
7784 if client is None :
7885 client = KiotaClientFactory .get_default_client ()
79- client .base_url = GraphClientFactory ._get_base_url (host , api_version ) # type: ignore
86+ client .base_url = GraphClientFactory ._get_base_url (host , api_version ) # type: ignore
8087 return GraphClientFactory ._load_middleware_to_client (client , middleware )
8188
8289 @staticmethod
0 commit comments