14
14
from speakeasy import utils
15
15
from speakeasy ._hooks import SDKHooks
16
16
from speakeasy .models import shared
17
- from typing import Callable , Dict , Union
17
+ from typing import Callable , Dict , Optional , Union
18
18
19
19
class Speakeasy :
20
20
r"""Speakeasy API: The Speakeasy API allows teams to manage common operations with their APIs
@@ -43,14 +43,14 @@ class Speakeasy:
43
43
def __init__ (self ,
44
44
security : Union [shared .Security ,Callable [[], shared .Security ]] = None ,
45
45
workspace_id : str = None ,
46
- server : str = None ,
47
- server_url : str = None ,
48
- url_params : Dict [str , str ] = None ,
49
- client : requests_http .Session = None ,
50
- retry_config : utils .RetryConfig = None
46
+ server : Optional [ str ] = None ,
47
+ server_url : Optional [ str ] = None ,
48
+ url_params : Optional [ Dict [str , str ] ] = None ,
49
+ client : Optional [ requests_http .Session ] = None ,
50
+ retry_config : Optional [ utils .RetryConfig ] = None
51
51
) -> None :
52
52
"""Instantiates the SDK configuring it with the provided parameters.
53
-
53
+
54
54
:param security: The security details required for authentication
55
55
:type security: Union[shared.Security,Callable[[], shared.Security]]
56
56
:param workspace_id: Configures the workspace_id parameter for all supported operations
@@ -68,20 +68,28 @@ def __init__(self,
68
68
"""
69
69
if client is None :
70
70
client = requests_http .Session ()
71
-
71
+
72
72
if server_url is not None :
73
73
if url_params is not None :
74
74
server_url = utils .template_url (server_url , url_params )
75
-
76
- self .sdk_configuration = SDKConfiguration (client , security , server_url , server , {
75
+ global_params = {
77
76
'parameters' : {
78
77
'queryParam' : {
79
78
},
80
79
'pathParam' : {
81
80
'workspace_id' : workspace_id ,
82
81
},
83
82
},
84
- }, retry_config = retry_config )
83
+ }
84
+
85
+ self .sdk_configuration = SDKConfiguration (
86
+ client ,
87
+ security ,
88
+ server_url ,
89
+ server ,
90
+ global_params ,
91
+ retry_config = retry_config
92
+ )
85
93
86
94
hooks = SDKHooks ()
87
95
@@ -91,10 +99,11 @@ def __init__(self,
91
99
self .sdk_configuration .server_url = server_url
92
100
93
101
# pylint: disable=protected-access
94
- self .sdk_configuration ._hooks = hooks
95
-
102
+ self .sdk_configuration ._hooks = hooks
103
+
96
104
self ._init_sdks ()
97
-
105
+
106
+
98
107
def _init_sdks (self ):
99
108
self .apis = Apis (self .sdk_configuration )
100
109
self .api_endpoints = APIEndpoints (self .sdk_configuration )
@@ -105,4 +114,3 @@ def _init_sdks(self):
105
114
self .organizations = Organizations (self .sdk_configuration )
106
115
self .embeds = Embeds (self .sdk_configuration )
107
116
self .events = Events (self .sdk_configuration )
108
-
0 commit comments