@@ -106,7 +106,6 @@ async def execute_api_call(
106
106
out_type : type [T ],
107
107
params : QueryParamTypes | None = None ,
108
108
headers : HeaderTypes | None = None ,
109
- allow_null_body : bool = False ,
110
109
) -> T :
111
110
result = await self .__execute_api_call (
112
111
method ,
@@ -116,13 +115,35 @@ async def execute_api_call(
116
115
out_type = out_type ,
117
116
params = params ,
118
117
headers = headers ,
119
- allow_null_body = allow_null_body ,
118
+ allow_null_body = False ,
120
119
)
121
- if result is None and not allow_null_body :
120
+ if result is None :
122
121
msg = f"Failed to execute api call { method } { path } , was expecting a result of type { out_type } got None instead"
123
122
raise SaicApiException (msg )
124
123
return result
125
124
125
+ async def execute_api_call_with_optional_result (
126
+ self ,
127
+ method : str ,
128
+ path : str ,
129
+ * ,
130
+ body : Any | None = None ,
131
+ form_body : Any | None = None ,
132
+ out_type : type [T ],
133
+ params : QueryParamTypes | None = None ,
134
+ headers : HeaderTypes | None = None ,
135
+ ) -> T | None :
136
+ return await self .__execute_api_call (
137
+ method ,
138
+ path ,
139
+ body = body ,
140
+ form_body = form_body ,
141
+ out_type = out_type ,
142
+ params = params ,
143
+ headers = headers ,
144
+ allow_null_body = True ,
145
+ )
146
+
126
147
async def execute_api_call_no_result (
127
148
self ,
128
149
method : str ,
@@ -132,7 +153,6 @@ async def execute_api_call_no_result(
132
153
form_body : Any | None = None ,
133
154
params : QueryParamTypes | None = None ,
134
155
headers : HeaderTypes | None = None ,
135
- allow_null_body : bool = False ,
136
156
) -> None :
137
157
await self .__execute_api_call (
138
158
method ,
@@ -141,7 +161,7 @@ async def execute_api_call_no_result(
141
161
form_body = form_body ,
142
162
params = params ,
143
163
headers = headers ,
144
- allow_null_body = allow_null_body ,
164
+ allow_null_body = True ,
145
165
)
146
166
147
167
async def __execute_api_call (
0 commit comments