@@ -932,6 +932,131 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
932
932
apiClient .executeAsync (call , callback );
933
933
return call ;
934
934
}
935
+ /**
936
+ * Build call for updatePetWithForm
937
+ * @param petId ID of pet that needs to be updated (required)
938
+ * @param body (optional)
939
+ * @param progressListener Progress listener
940
+ * @param progressRequestListener Progress request listener
941
+ * @return Call to execute
942
+ * @throws ApiException If fail to serialize the request body object
943
+ */
944
+ public com .squareup .okhttp .Call updatePetWithFormCall (Integer petId , Object body , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
945
+ Object localVarPostBody = body ;
946
+
947
+ // create path and map variables
948
+ String localVarPath = "/pet/{petId}"
949
+ .replaceAll ("\\ {" + "petId" + "\\ }" , apiClient .escapeString (petId .toString ()));
950
+
951
+ List <Pair > localVarQueryParams = new ArrayList <Pair >();
952
+ List <Pair > localVarCollectionQueryParams = new ArrayList <Pair >();
953
+
954
+ Map <String , String > localVarHeaderParams = new HashMap <String , String >();
955
+
956
+ Map <String , Object > localVarFormParams = new HashMap <String , Object >();
957
+
958
+ final String [] localVarAccepts = {
959
+
960
+ };
961
+ final String localVarAccept = apiClient .selectHeaderAccept (localVarAccepts );
962
+ if (localVarAccept != null ) localVarHeaderParams .put ("Accept" , localVarAccept );
963
+
964
+ final String [] localVarContentTypes = {
965
+ "application/x-www-form-urlencoded"
966
+ };
967
+ final String localVarContentType = apiClient .selectHeaderContentType (localVarContentTypes );
968
+ localVarHeaderParams .put ("Content-Type" , localVarContentType );
969
+
970
+ if (progressListener != null ) {
971
+ apiClient .getHttpClient ().networkInterceptors ().add (new com .squareup .okhttp .Interceptor () {
972
+ @ Override
973
+ public com .squareup .okhttp .Response intercept (com .squareup .okhttp .Interceptor .Chain chain ) throws IOException {
974
+ com .squareup .okhttp .Response originalResponse = chain .proceed (chain .request ());
975
+ return originalResponse .newBuilder ()
976
+ .body (new ProgressResponseBody (originalResponse .body (), progressListener ))
977
+ .build ();
978
+ }
979
+ });
980
+ }
981
+
982
+ String [] localVarAuthNames = new String [] { "petstore_auth" };
983
+ return apiClient .buildCall (localVarPath , "POST" , localVarQueryParams , localVarCollectionQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAuthNames , progressRequestListener );
984
+ }
985
+
986
+ @ SuppressWarnings ("rawtypes" )
987
+ private com .squareup .okhttp .Call updatePetWithFormValidateBeforeCall (Integer petId , Object body , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
988
+ // verify the required parameter 'petId' is set
989
+ if (petId == null ) {
990
+ throw new ApiException ("Missing the required parameter 'petId' when calling updatePetWithForm(Async)" );
991
+ }
992
+
993
+ com .squareup .okhttp .Call call = updatePetWithFormCall (petId , body , progressListener , progressRequestListener );
994
+ return call ;
995
+
996
+
997
+
998
+
999
+
1000
+ }
1001
+
1002
+ /**
1003
+ * Updates a pet in the store with form data
1004
+ *
1005
+ * @param petId ID of pet that needs to be updated (required)
1006
+ * @param body (optional)
1007
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
1008
+ */
1009
+ public void updatePetWithForm (Integer petId , Object body ) throws ApiException {
1010
+ updatePetWithFormWithHttpInfo (petId , body );
1011
+ }
1012
+
1013
+ /**
1014
+ * Updates a pet in the store with form data
1015
+ *
1016
+ * @param petId ID of pet that needs to be updated (required)
1017
+ * @param body (optional)
1018
+ * @return ApiResponse<Void>
1019
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
1020
+ */
1021
+ public ApiResponse <Void > updatePetWithFormWithHttpInfo (Integer petId , Object body ) throws ApiException {
1022
+ com .squareup .okhttp .Call call = updatePetWithFormValidateBeforeCall (petId , body , null , null );
1023
+ return apiClient .execute (call );
1024
+ }
1025
+
1026
+ /**
1027
+ * Updates a pet in the store with form data (asynchronously)
1028
+ *
1029
+ * @param petId ID of pet that needs to be updated (required)
1030
+ * @param body (optional)
1031
+ * @param callback The callback to be executed when the API call finishes
1032
+ * @return The request call
1033
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
1034
+ */
1035
+ public com .squareup .okhttp .Call updatePetWithFormAsync (Integer petId , Object body , final ApiCallback <Void > callback ) throws ApiException {
1036
+
1037
+ ProgressResponseBody .ProgressListener progressListener = null ;
1038
+ ProgressRequestBody .ProgressRequestListener progressRequestListener = null ;
1039
+
1040
+ if (callback != null ) {
1041
+ progressListener = new ProgressResponseBody .ProgressListener () {
1042
+ @ Override
1043
+ public void update (long bytesRead , long contentLength , boolean done ) {
1044
+ callback .onDownloadProgress (bytesRead , contentLength , done );
1045
+ }
1046
+ };
1047
+
1048
+ progressRequestListener = new ProgressRequestBody .ProgressRequestListener () {
1049
+ @ Override
1050
+ public void onRequestProgress (long bytesWritten , long contentLength , boolean done ) {
1051
+ callback .onUploadProgress (bytesWritten , contentLength , done );
1052
+ }
1053
+ };
1054
+ }
1055
+
1056
+ com .squareup .okhttp .Call call = updatePetWithFormValidateBeforeCall (petId , body , progressListener , progressRequestListener );
1057
+ apiClient .executeAsync (call , callback );
1058
+ return call ;
1059
+ }
935
1060
/**
936
1061
* Build call for uploadFile
937
1062
* @param petId ID of pet to update (required)
@@ -1069,4 +1194,133 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
1069
1194
apiClient .executeAsync (call , localVarReturnType , callback );
1070
1195
return call ;
1071
1196
}
1197
+ /**
1198
+ * Build call for uploadFile
1199
+ * @param petId ID of pet to update (required)
1200
+ * @param body (optional)
1201
+ * @param progressListener Progress listener
1202
+ * @param progressRequestListener Progress request listener
1203
+ * @return Call to execute
1204
+ * @throws ApiException If fail to serialize the request body object
1205
+ */
1206
+ public com .squareup .okhttp .Call uploadFileCall (Integer petId , Object body , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
1207
+ Object localVarPostBody = body ;
1208
+
1209
+ // create path and map variables
1210
+ String localVarPath = "/pet/{petId}/uploadImage"
1211
+ .replaceAll ("\\ {" + "petId" + "\\ }" , apiClient .escapeString (petId .toString ()));
1212
+
1213
+ List <Pair > localVarQueryParams = new ArrayList <Pair >();
1214
+ List <Pair > localVarCollectionQueryParams = new ArrayList <Pair >();
1215
+
1216
+ Map <String , String > localVarHeaderParams = new HashMap <String , String >();
1217
+
1218
+ Map <String , Object > localVarFormParams = new HashMap <String , Object >();
1219
+
1220
+ final String [] localVarAccepts = {
1221
+ "application/json"
1222
+ };
1223
+ final String localVarAccept = apiClient .selectHeaderAccept (localVarAccepts );
1224
+ if (localVarAccept != null ) localVarHeaderParams .put ("Accept" , localVarAccept );
1225
+
1226
+ final String [] localVarContentTypes = {
1227
+ "multipart/form-data"
1228
+ };
1229
+ final String localVarContentType = apiClient .selectHeaderContentType (localVarContentTypes );
1230
+ localVarHeaderParams .put ("Content-Type" , localVarContentType );
1231
+
1232
+ if (progressListener != null ) {
1233
+ apiClient .getHttpClient ().networkInterceptors ().add (new com .squareup .okhttp .Interceptor () {
1234
+ @ Override
1235
+ public com .squareup .okhttp .Response intercept (com .squareup .okhttp .Interceptor .Chain chain ) throws IOException {
1236
+ com .squareup .okhttp .Response originalResponse = chain .proceed (chain .request ());
1237
+ return originalResponse .newBuilder ()
1238
+ .body (new ProgressResponseBody (originalResponse .body (), progressListener ))
1239
+ .build ();
1240
+ }
1241
+ });
1242
+ }
1243
+
1244
+ String [] localVarAuthNames = new String [] { "petstore_auth" };
1245
+ return apiClient .buildCall (localVarPath , "POST" , localVarQueryParams , localVarCollectionQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAuthNames , progressRequestListener );
1246
+ }
1247
+
1248
+ @ SuppressWarnings ("rawtypes" )
1249
+ private com .squareup .okhttp .Call uploadFileValidateBeforeCall (Integer petId , Object body , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
1250
+ // verify the required parameter 'petId' is set
1251
+ if (petId == null ) {
1252
+ throw new ApiException ("Missing the required parameter 'petId' when calling uploadFile(Async)" );
1253
+ }
1254
+
1255
+ com .squareup .okhttp .Call call = uploadFileCall (petId , body , progressListener , progressRequestListener );
1256
+ return call ;
1257
+
1258
+
1259
+
1260
+
1261
+
1262
+ }
1263
+
1264
+ /**
1265
+ * uploads an image
1266
+ *
1267
+ * @param petId ID of pet to update (required)
1268
+ * @param body (optional)
1269
+ * @return ModelApiResponse
1270
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
1271
+ */
1272
+ public ModelApiResponse uploadFile (Integer petId , Object body ) throws ApiException {
1273
+ ApiResponse <ModelApiResponse > resp = uploadFileWithHttpInfo (petId , body );
1274
+ return resp .getData ();
1275
+ }
1276
+
1277
+ /**
1278
+ * uploads an image
1279
+ *
1280
+ * @param petId ID of pet to update (required)
1281
+ * @param body (optional)
1282
+ * @return ApiResponse<ModelApiResponse>
1283
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
1284
+ */
1285
+ public ApiResponse <ModelApiResponse > uploadFileWithHttpInfo (Integer petId , Object body ) throws ApiException {
1286
+ com .squareup .okhttp .Call call = uploadFileValidateBeforeCall (petId , body , null , null );
1287
+ Type localVarReturnType = new TypeToken <ModelApiResponse >(){}.getType ();
1288
+ return apiClient .execute (call , localVarReturnType );
1289
+ }
1290
+
1291
+ /**
1292
+ * uploads an image (asynchronously)
1293
+ *
1294
+ * @param petId ID of pet to update (required)
1295
+ * @param body (optional)
1296
+ * @param callback The callback to be executed when the API call finishes
1297
+ * @return The request call
1298
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
1299
+ */
1300
+ public com .squareup .okhttp .Call uploadFileAsync (Integer petId , Object body , final ApiCallback <ModelApiResponse > callback ) throws ApiException {
1301
+
1302
+ ProgressResponseBody .ProgressListener progressListener = null ;
1303
+ ProgressRequestBody .ProgressRequestListener progressRequestListener = null ;
1304
+
1305
+ if (callback != null ) {
1306
+ progressListener = new ProgressResponseBody .ProgressListener () {
1307
+ @ Override
1308
+ public void update (long bytesRead , long contentLength , boolean done ) {
1309
+ callback .onDownloadProgress (bytesRead , contentLength , done );
1310
+ }
1311
+ };
1312
+
1313
+ progressRequestListener = new ProgressRequestBody .ProgressRequestListener () {
1314
+ @ Override
1315
+ public void onRequestProgress (long bytesWritten , long contentLength , boolean done ) {
1316
+ callback .onUploadProgress (bytesWritten , contentLength , done );
1317
+ }
1318
+ };
1319
+ }
1320
+
1321
+ com .squareup .okhttp .Call call = uploadFileValidateBeforeCall (petId , body , progressListener , progressRequestListener );
1322
+ Type localVarReturnType = new TypeToken <ModelApiResponse >(){}.getType ();
1323
+ apiClient .executeAsync (call , localVarReturnType , callback );
1324
+ return call ;
1325
+ }
1072
1326
}
0 commit comments