Search in sources :

Example 16 with PUT

use of retrofit2.http.PUT in project autorest.java by Azure.

the class LROsImpl method putAsyncSubResourceWithServiceResponseAsync.

/**
 * Long running put request with sub resource.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<SubProduct>> putAsyncSubResourceWithServiceResponseAsync() {
    final SubProduct product = null;
    Observable<Response<ResponseBody>> observable = service.putAsyncSubResource(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<SubProduct>() {
    }.getType());
}
Also used : SubProduct(fixtures.lro.models.SubProduct) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken)

Example 17 with PUT

use of retrofit2.http.PUT in project autorest.java by Azure.

the class LROsImpl method putAsyncNoHeaderInRetryWithServiceResponseAsync.

/**
 * Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponseWithHeaders<Product, LROsPutAsyncNoHeaderInRetryHeaders>> putAsyncNoHeaderInRetryWithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.putAsyncNoHeaderInRetry(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken<Product>() {
    }.getType(), LROsPutAsyncNoHeaderInRetryHeaders.class);
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) Product(fixtures.lro.models.Product) SubProduct(fixtures.lro.models.SubProduct)

Example 18 with PUT

use of retrofit2.http.PUT in project autorest.java by Azure.

the class AutoRestResourceFlatteningTestServiceImpl method postFlattenedSimpleProductWithServiceResponseAsync.

/**
 * Put Flattened Simple Product with client flattening true on the parameter.
 *
 * @param productId Unique identifier representing a specific product for a given latitude &amp; longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles.
 * @param maxProductDisplayName Display name of product.
 * @param description Description of product.
 * @param genericValue Generic URL value.
 * @param odatavalue URL value.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the SimpleProduct object
 */
public Observable<ServiceResponse<SimpleProduct>> postFlattenedSimpleProductWithServiceResponseAsync(String productId, String maxProductDisplayName, String description, String genericValue, String odatavalue) {
    if (productId == null) {
        throw new IllegalArgumentException("Parameter productId is required and cannot be null.");
    }
    if (maxProductDisplayName == null) {
        throw new IllegalArgumentException("Parameter maxProductDisplayName is required and cannot be null.");
    }
    SimpleProduct simpleBodyProduct = null;
    if (description != null || genericValue != null || odatavalue != null) {
        simpleBodyProduct = new SimpleProduct();
        simpleBodyProduct.withProductId(productId);
        simpleBodyProduct.withDescription(description);
        simpleBodyProduct.withMaxProductDisplayName(maxProductDisplayName);
        simpleBodyProduct.withGenericValue(genericValue);
        simpleBodyProduct.withOdatavalue(odatavalue);
    }
    return service.postFlattenedSimpleProduct(simpleBodyProduct).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SimpleProduct>>>() {

        @Override
        public Observable<ServiceResponse<SimpleProduct>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<SimpleProduct> clientResponse = postFlattenedSimpleProductDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) SimpleProduct(fixtures.modelflattening.models.SimpleProduct) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 19 with PUT

use of retrofit2.http.PUT in project autorest.java by Azure.

the class AutoRestResourceFlatteningTestServiceImpl method putSimpleProductWithGroupingWithServiceResponseAsync.

/**
 * Put Simple Product with client flattening true on the model.
 *
 * @param flattenParameterGroup Additional parameters for the operation
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the SimpleProduct object
 */
public Observable<ServiceResponse<SimpleProduct>> putSimpleProductWithGroupingWithServiceResponseAsync(FlattenParameterGroup flattenParameterGroup) {
    if (flattenParameterGroup == null) {
        throw new IllegalArgumentException("Parameter flattenParameterGroup is required and cannot be null.");
    }
    Validator.validate(flattenParameterGroup);
    String name = flattenParameterGroup.name();
    String productId = flattenParameterGroup.productId();
    String description = flattenParameterGroup.description();
    String maxProductDisplayName = flattenParameterGroup.maxProductDisplayName();
    String genericValue = flattenParameterGroup.genericValue();
    String odatavalue = flattenParameterGroup.odatavalue();
    SimpleProduct simpleBodyProduct = null;
    if (description != null || genericValue != null || odatavalue != null) {
        simpleBodyProduct = new SimpleProduct();
        simpleBodyProduct.withProductId(productId);
        simpleBodyProduct.withDescription(description);
        simpleBodyProduct.withMaxProductDisplayName(maxProductDisplayName);
        simpleBodyProduct.withGenericValue(genericValue);
        simpleBodyProduct.withOdatavalue(odatavalue);
    }
    return service.putSimpleProductWithGrouping(name, simpleBodyProduct).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SimpleProduct>>>() {

        @Override
        public Observable<ServiceResponse<SimpleProduct>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<SimpleProduct> clientResponse = putSimpleProductWithGroupingDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) SimpleProduct(fixtures.modelflattening.models.SimpleProduct) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 20 with PUT

use of retrofit2.http.PUT in project autorest.java by Azure.

the class LRORetrysImpl method putAsyncRelativeRetrySucceededWithServiceResponseAsync.

/**
 * Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponseWithHeaders<Product, LRORetrysPutAsyncRelativeRetrySucceededHeaders>> putAsyncRelativeRetrySucceededWithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.putAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken<Product>() {
    }.getType(), LRORetrysPutAsyncRelativeRetrySucceededHeaders.class);
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) Product(fixtures.lro.models.Product)

Aggregations

Response (retrofit2.Response)36 ServiceResponse (com.microsoft.rest.ServiceResponse)33 TypeToken (com.google.common.reflect.TypeToken)31 Product (fixtures.lro.models.Product)27 SubProduct (fixtures.lro.models.SubProduct)15 Intent (android.content.Intent)2 Uri (android.net.Uri)2 ResponseBody (okhttp3.ResponseBody)2 ValueAnimator (android.animation.ValueAnimator)1 ActionBar (android.app.ActionBar)1 Activity (android.app.Activity)1 TaskStackBuilder (android.app.TaskStackBuilder)1 ActivityNotFoundException (android.content.ActivityNotFoundException)1 ComponentName (android.content.ComponentName)1 Context (android.content.Context)1 Intent.createChooser (android.content.Intent.createChooser)1 PackageManager (android.content.pm.PackageManager)1 Bitmap (android.graphics.Bitmap)1 BitmapFactory (android.graphics.BitmapFactory)1 Color (android.graphics.Color)1