@@ -820,17 +820,54 @@ def _request_api_list(
820
820
)
821
821
return resp
822
822
823
+ @overload
823
824
def get (
824
825
self ,
825
826
path : str ,
826
827
* ,
827
828
cast_to : Type [ResponseT ],
828
829
options : RequestOptions = {},
830
+ stream : Literal [False ] = False ,
829
831
) -> ResponseT :
832
+ ...
833
+
834
+ @overload
835
+ def get (
836
+ self ,
837
+ path : str ,
838
+ * ,
839
+ cast_to : Type [ResponseT ],
840
+ options : RequestOptions = {},
841
+ stream : Literal [True ],
842
+ stream_cls : type [_StreamT ],
843
+ ) -> _StreamT :
844
+ ...
845
+
846
+ @overload
847
+ def get (
848
+ self ,
849
+ path : str ,
850
+ * ,
851
+ cast_to : Type [ResponseT ],
852
+ options : RequestOptions = {},
853
+ stream : bool ,
854
+ stream_cls : type [_StreamT ] | None = None ,
855
+ ) -> ResponseT | _StreamT :
856
+ ...
857
+
858
+ def get (
859
+ self ,
860
+ path : str ,
861
+ * ,
862
+ cast_to : Type [ResponseT ],
863
+ options : RequestOptions = {},
864
+ stream : bool = False ,
865
+ stream_cls : type [_StreamT ] | None = None ,
866
+ ) -> ResponseT | _StreamT :
830
867
opts = FinalRequestOptions .construct (method = "get" , url = path , ** options )
831
868
# cast is required because mypy complains about returning Any even though
832
869
# it understands the type variables
833
- return cast (ResponseT , self .request (cast_to , opts , stream = False ))
870
+ return cast (ResponseT , self .request (cast_to , opts , stream = stream , stream_cls = stream_cls ))
834
871
835
872
@overload
836
873
def post (
@@ -1117,15 +1154,52 @@ def _request_api_list(
1117
1154
) -> AsyncPaginator [ModelT , AsyncPageT ]:
1118
1155
return AsyncPaginator (client = self , options = options , page_cls = page , model = model )
1119
1156
1157
+ @overload
1120
1158
async def get (
1121
1159
self ,
1122
1160
path : str ,
1123
1161
* ,
1124
1162
cast_to : Type [ResponseT ],
1125
1163
options : RequestOptions = {},
1164
+ stream : Literal [False ] = False ,
1126
1165
) -> ResponseT :
1166
+ ...
1167
+
1168
+ @overload
1169
+ async def get (
1170
+ self ,
1171
+ path : str ,
1172
+ * ,
1173
+ cast_to : Type [ResponseT ],
1174
+ options : RequestOptions = {},
1175
+ stream : Literal [True ],
1176
+ stream_cls : type [_AsyncStreamT ],
1177
+ ) -> _AsyncStreamT :
1178
+ ...
1179
+
1180
+ @overload
1181
+ async def get (
1182
+ self ,
1183
+ path : str ,
1184
+ * ,
1185
+ cast_to : Type [ResponseT ],
1186
+ options : RequestOptions = {},
1187
+ stream : bool ,
1188
+ stream_cls : type [_AsyncStreamT ] | None = None ,
1189
+ ) -> ResponseT | _AsyncStreamT :
1190
+ ...
1191
+
1192
+ async def get (
1193
+ self ,
1194
+ path : str ,
1195
+ * ,
1196
+ cast_to : Type [ResponseT ],
1197
+ options : RequestOptions = {},
1198
+ stream : bool = False ,
1199
+ stream_cls : type [_AsyncStreamT ] | None = None ,
1200
+ ) -> ResponseT | _AsyncStreamT :
1127
1201
opts = FinalRequestOptions .construct (method = "get" , url = path , ** options )
1128
- return await self .request (cast_to , opts )
1202
+ return await self .request (cast_to , opts , stream = stream , stream_cls = stream_cls )
1129
1203
1130
1204
@overload
1131
1205
async def post (
0 commit comments