Search in sources :

Example 41 with Header

use of retrofit2.http.Header 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 42 with Header

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

the class LROsCustomHeadersImpl method put201CreatingSucceeded200WithServiceResponseAsync.

/**
 * x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’.  Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<Product>> put201CreatingSucceeded200WithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.put201CreatingSucceeded200(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<Product>() {
    }.getType());
}
Also used : ServiceResponse(com.microsoft.rest.ServiceResponse) Response(retrofit2.Response) TypeToken(com.google.common.reflect.TypeToken) Product(fixtures.lro.models.Product)

Example 43 with Header

use of retrofit2.http.Header 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 Header

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

the class LROSADsImpl method putAsyncRelativeRetryInvalidJsonPollingWithServiceResponseAsync.

/**
 * Long running put request, service returns 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, LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders>> putAsyncRelativeRetryInvalidJsonPollingWithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.putAsyncRelativeRetryInvalidJsonPolling(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken<Product>() {
    }.getType(), LROSADsPutAsyncRelativeRetryInvalidJsonPollingHeaders.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 Header

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

the class LROSADsImpl method putAsyncRelativeRetryInvalidHeaderWithServiceResponseAsync.

/**
 * Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponseWithHeaders<Product, LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders>> putAsyncRelativeRetryInvalidHeaderWithServiceResponseAsync() {
    final Product product = null;
    Observable<Response<ResponseBody>> observable = service.putAsyncRelativeRetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken<Product>() {
    }.getType(), LROSADsPutAsyncRelativeRetryInvalidHeaderHeaders.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)39 ServiceResponse (com.microsoft.rest.ServiceResponse)30 TypeToken (com.google.common.reflect.TypeToken)29 Product (fixtures.lro.models.Product)29 Request (okhttp3.Request)23 Retrofit (retrofit2.Retrofit)21 OkHttpClient (okhttp3.OkHttpClient)19 IOException (java.io.IOException)15 Test (org.junit.Test)14 SubProduct (fixtures.lro.models.SubProduct)12 Interceptor (okhttp3.Interceptor)12 Response (okhttp3.Response)10 ResponseBody (okhttp3.ResponseBody)9 Header (retrofit2.http.Header)6 ArrayList (java.util.ArrayList)4 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)4 GsonBuilder (com.google.gson.GsonBuilder)3 HttpException (retrofit2.HttpException)3 Context (android.content.Context)2 Nullable (android.support.annotation.Nullable)2