Search in sources :

Example 41 with POST

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

the class LRORetrysImpl method postAsyncRelativeRetrySucceededWithServiceResponseAsync.

/**
 * Long running post request, service returns a 500, then a 202 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<Void, LRORetrysPostAsyncRelativeRetrySucceededHeaders>> postAsyncRelativeRetrySucceededWithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.postAsyncRelativeRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken<Void>() {
    }.getType(), LRORetrysPostAsyncRelativeRetrySucceededHeaders.class);
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) Product(fixtures.lro.models.Product)

Example 42 with POST

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

the class LROsCustomHeadersImpl method post202Retry200WithServiceResponseAsync.

/**
 * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponseWithHeaders<Void, LROsCustomHeaderPost202Retry200Headers>> post202Retry200WithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.post202Retry200(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken<Void>() {
    }.getType(), LROsCustomHeaderPost202Retry200Headers.class);
}
Also used : ServiceResponse(com.microsoft.rest.ServiceResponse) Response(retrofit2.Response) TypeToken(com.google.common.reflect.TypeToken) Product(fixtures.lro.models.Product)

Example 43 with POST

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

the class LROSADsImpl method post202NonRetry400WithServiceResponseAsync.

/**
 * Long running post request, service returns a 202 with a location header.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponseWithHeaders<Void, LROSADsPost202NonRetry400Headers>> post202NonRetry400WithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.post202NonRetry400(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken<Void>() {
    }.getType(), LROSADsPost202NonRetry400Headers.class);
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) Product(fixtures.lro.models.Product)

Example 44 with POST

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

the class LROSADsImpl method post202RetryInvalidHeaderWithServiceResponseAsync.

/**
 * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponseWithHeaders<Void, LROSADsPost202RetryInvalidHeaderHeaders>> post202RetryInvalidHeaderWithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken<Void>() {
    }.getType(), LROSADsPost202RetryInvalidHeaderHeaders.class);
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) Product(fixtures.lro.models.Product)

Example 45 with POST

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

the class LROsImpl method postAsyncNoRetrySucceededWithServiceResponseAsync.

/**
 * Long running post request, service returns a 202 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, LROsPostAsyncNoRetrySucceededHeaders>> postAsyncNoRetrySucceededWithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.postAsyncNoRetrySucceeded(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken<Product>() {
    }.getType(), LROsPostAsyncNoRetrySucceededHeaders.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)

Aggregations

ResponseBody (okhttp3.ResponseBody)40 Test (org.junit.Test)33 Request (okhttp3.Request)31 Response (retrofit2.Response)27 ServiceResponse (com.microsoft.rest.ServiceResponse)22 RequestBody (okhttp3.RequestBody)19 TypeToken (com.google.common.reflect.TypeToken)18 Product (fixtures.lro.models.Product)18 Buffer (okio.Buffer)14 MultipartBody (okhttp3.MultipartBody)13 Part (retrofit2.http.Part)10 OkHttpClient (okhttp3.OkHttpClient)8 Body (retrofit2.http.Body)8 HashMap (java.util.HashMap)7 LinkedHashMap (java.util.LinkedHashMap)7 Field (retrofit2.http.Field)6 FieldMap (retrofit2.http.FieldMap)6 PartMap (retrofit2.http.PartMap)6 List (java.util.List)5 Map (java.util.Map)5