Exemplo n.º 1
0
 /**
  * Upload file.
  *
  * @param fileContent File to upload.
  * @param fileName File name to upload. Name has to be spelled exactly as written here.
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  * @return the {@link Call} object
  */
 public Call<ResponseBody> uploadFileAsync(
     InputStream fileContent,
     String fileName,
     final ServiceCallback<InputStream> serviceCallback) {
   if (fileContent == null) {
     serviceCallback.failure(
         new IllegalArgumentException("Parameter fileContent is required and cannot be null."));
     return null;
   }
   if (fileName == null) {
     serviceCallback.failure(
         new IllegalArgumentException("Parameter fileName is required and cannot be null."));
     return null;
   }
   Call<ResponseBody> call = service.uploadFile(fileContent, fileName);
   call.enqueue(
       new ServiceResponseCallback<InputStream>(serviceCallback) {
         @Override
         public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
           try {
             serviceCallback.success(uploadFileDelegate(response, retrofit));
           } catch (ServiceException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return call;
 }
 /**
  * POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to
  * '1234-5678-9012-3456' to succeed.
  *
  * @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 postSwaggerGlobalValidAsync(final ServiceCallback<Void> serviceCallback)
     throws IllegalArgumentException {
   if (serviceCallback == null) {
     throw new IllegalArgumentException("ServiceCallback is required for async calls.");
   }
   if (this.client.getSubscriptionId() == null) {
     serviceCallback.failure(
         new IllegalArgumentException(
             "Parameter this.client.getSubscriptionId() is required and cannot be null."));
     return null;
   }
   Call<ResponseBody> call =
       service.postSwaggerGlobalValid(
           this.client.getSubscriptionId(), this.client.getAcceptLanguage());
   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(postSwaggerGlobalValidDelegate(response));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return serviceCall;
 }
Exemplo n.º 3
0
 /**
  * Put complex types with array property which is empty.
  *
  * @param complexBody Please put an empty array
  * @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 putEmptyAsync(
     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.putEmpty(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(putEmptyDelegate(response));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return serviceCall;
 }
 /**
  * Gets the current usage count and the limit for the resources under the subscription.
  *
  * @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 listAsync(final ServiceCallback<UsageListResultInner> serviceCallback)
     throws IllegalArgumentException {
   if (serviceCallback == null) {
     throw new IllegalArgumentException("ServiceCallback is required for async calls.");
   }
   if (this.client.subscriptionId() == null) {
     serviceCallback.failure(
         new IllegalArgumentException(
             "Parameter this.client.subscriptionId() is required and cannot be null."));
     return null;
   }
   if (this.client.apiVersion() == null) {
     serviceCallback.failure(
         new IllegalArgumentException(
             "Parameter this.client.apiVersion() is required and cannot be null."));
     return null;
   }
   Call<ResponseBody> call =
       service.list(
           this.client.subscriptionId(),
           this.client.apiVersion(),
           this.client.acceptLanguage(),
           this.client.userAgent());
   final ServiceCall serviceCall = new ServiceCall(call);
   call.enqueue(
       new ServiceResponseCallback<UsageListResultInner>(serviceCallback) {
         @Override
         public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
           try {
             serviceCallback.success(listDelegate(response));
           } catch (CloudException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return serviceCall;
 }
Exemplo n.º 5
0
 /**
  * Test implicitly required path parameter.
  *
  * @param pathParameter the String value
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  * @return the {@link Call} object
  */
 public Call<ResponseBody> getRequiredPathAsync(
     String pathParameter, final ServiceCallback<Error> serviceCallback) {
   if (pathParameter == null) {
     serviceCallback.failure(
         new IllegalArgumentException("Parameter pathParameter is required and cannot be null."));
     return null;
   }
   Call<ResponseBody> call = service.getRequiredPath(pathParameter);
   call.enqueue(
       new ServiceResponseCallback<Error>(serviceCallback) {
         @Override
         public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
           try {
             serviceCallback.success(getRequiredPathDelegate(response, retrofit));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return call;
 }
Exemplo n.º 6
0
 /**
  * Put min datetime value 0001-01-01T00:00:00Z.
  *
  * @param datetimeBody the DateTime value
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  * @return the {@link Call} object
  */
 public Call<ResponseBody> putUtcMinDateTimeAsync(
     DateTime datetimeBody, final ServiceCallback<Void> serviceCallback) {
   if (datetimeBody == null) {
     serviceCallback.failure(
         new IllegalArgumentException("Parameter datetimeBody is required and cannot be null."));
     return null;
   }
   Call<ResponseBody> call = service.putUtcMinDateTime(datetimeBody);
   call.enqueue(
       new ServiceResponseCallback<Void>(serviceCallback) {
         @Override
         public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
           try {
             serviceCallback.success(putUtcMinDateTimeDelegate(response, retrofit));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return call;
 }
Exemplo n.º 7
0
 /**
  * Test implicitly required query parameter.
  *
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  * @return the {@link Call} object
  */
 public Call<ResponseBody> getRequiredGlobalQueryAsync(
     final ServiceCallback<Error> serviceCallback) {
   if (this.client.getRequiredGlobalQuery() == null) {
     serviceCallback.failure(
         new IllegalArgumentException(
             "Parameter this.client.getRequiredGlobalQuery() is required and cannot be null."));
     return null;
   }
   Call<ResponseBody> call = service.getRequiredGlobalQuery(this.client.getRequiredGlobalQuery());
   call.enqueue(
       new ServiceResponseCallback<Error>(serviceCallback) {
         @Override
         public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
           try {
             serviceCallback.success(getRequiredGlobalQueryDelegate(response, retrofit));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return call;
 }
 /**
  * POST method with subscriptionId modeled in the method. pass in subscription id =
  * '1234-5678-9012-3456' to succeed.
  *
  * @param subscriptionId This should appear as a method parameter, use value '1234-5678-9012-3456'
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  * @return the {@link Call} object
  */
 public Call<ResponseBody> postMethodLocalValidAsync(
     String subscriptionId, final ServiceCallback<Void> serviceCallback) {
   if (subscriptionId == null) {
     serviceCallback.failure(
         new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."));
     return null;
   }
   Call<ResponseBody> call =
       service.postMethodLocalValid(subscriptionId, this.client.getAcceptLanguage());
   call.enqueue(
       new ServiceResponseCallback<Void>(serviceCallback) {
         @Override
         public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
           try {
             serviceCallback.success(postMethodLocalValidDelegate(response, retrofit));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return call;
 }
Exemplo n.º 9
0
 /**
  * GET method with api-version modeled in global settings.
  *
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  */
 public Call<ResponseBody> getMethodGlobalValidAsync(final ServiceCallback<Void> serviceCallback) {
   if (this.client.getApiVersion() == null) {
     serviceCallback.failure(
         new ServiceException(
             new IllegalArgumentException(
                 "Parameter this.client.getApiVersion() is required and cannot be null.")));
   }
   Call<ResponseBody> call =
       service.getMethodGlobalValid(this.client.getApiVersion(), this.client.getAcceptLanguage());
   call.enqueue(
       new ServiceResponseCallback<Void>(serviceCallback) {
         @Override
         public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
           try {
             serviceCallback.success(getMethodGlobalValidDelegate(response, retrofit));
           } catch (ServiceException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return call;
 }
 /**
  * Put complex types that are polymorphic and have recursive references.
  *
  * @param complexBody Please put a salmon that looks like this: { "fishtype": "salmon", "species":
  *     "king", "length": 1, "age": 1, "location": "alaska", "iswild": true, "siblings": [ {
  *     "fishtype": "shark", "species": "predator", "length": 20, "age": 6, "siblings": [ {
  *     "fishtype": "salmon", "species": "coho", "length": 2, "age": 2, "location": "atlantic",
  *     "iswild": true, "siblings": [ { "fishtype": "shark", "species": "predator", "length": 20,
  *     "age": 6 }, { "fishtype": "sawshark", "species": "dangerous", "length": 10, "age": 105 } ]
  *     }, { "fishtype": "sawshark", "species": "dangerous", "length": 10, "age": 105 } ] }, {
  *     "fishtype": "sawshark", "species": "dangerous", "length": 10, "age": 105 } ] }
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  * @return the {@link Call} object
  */
 public Call<ResponseBody> putValidAsync(
     Fish complexBody, final ServiceCallback<Void> serviceCallback) {
   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);
   call.enqueue(
       new ServiceResponseCallback<Void>(serviceCallback) {
         @Override
         public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
           try {
             serviceCallback.success(putValidDelegate(response, retrofit));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return call;
 }