Exemplo n.º 1
0
 /**
  * Put complex types with array property.
  *
  * @param complexBody Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y",
  *     "The quick brown fox jumps over the lazy dog"
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  * @throws IllegalArgumentException thrown if callback is null
  * @return the {@link Call} object
  */
 public ServiceCall putValidAsync(
     ArrayWrapper complexBody, final ServiceCallback<Void> serviceCallback)
     throws IllegalArgumentException {
   if (serviceCallback == null) {
     throw new IllegalArgumentException("ServiceCallback is required for async calls.");
   }
   if (complexBody == null) {
     serviceCallback.failure(
         new IllegalArgumentException("Parameter complexBody is required and cannot be null."));
     return null;
   }
   Validator.validate(complexBody, serviceCallback);
   Call<ResponseBody> call = service.putValid(complexBody);
   final ServiceCall serviceCall = new ServiceCall(call);
   call.enqueue(
       new ServiceResponseCallback<Void>(serviceCallback) {
         @Override
         public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
           try {
             serviceCallback.success(putValidDelegate(response));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return serviceCall;
 }
Exemplo n.º 2
0
 /**
  * Put complex types with array property.
  *
  * @param complexBody Please put an array with 4 items: "1, 2, 3, 4", "", null, "&amp;S#$(*Y",
  *     "The quick brown fox jumps over the lazy dog"
  * @throws ErrorException exception thrown from REST call
  * @throws IOException exception thrown from serialization/deserialization
  * @throws IllegalArgumentException exception thrown from invalid parameters
  * @return the {@link ServiceResponse} object if successful.
  */
 public ServiceResponse<Void> putValid(ArrayWrapper complexBody)
     throws ErrorException, IOException, IllegalArgumentException {
   if (complexBody == null) {
     throw new IllegalArgumentException("Parameter complexBody is required and cannot be null.");
   }
   Validator.validate(complexBody);
   Call<ResponseBody> call = service.putValid(complexBody);
   return putValidDelegate(call.execute());
 }