/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

package fixtures.paging.implementation;

import retrofit2.Retrofit;
import fixtures.paging.Pagings;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceFuture;
import com.microsoft.azure.CloudException;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.Validator;
import fixtures.paging.models.CustomParameterGroup;
import fixtures.paging.models.PageImpl;
import fixtures.paging.models.PageImpl1;
import fixtures.paging.models.PagingGetMultiplePagesOptions;
import fixtures.paging.models.PagingGetMultiplePagesWithOffsetNextOptions;
import fixtures.paging.models.PagingGetMultiplePagesWithOffsetOptions;
import fixtures.paging.models.PagingGetOdataMultiplePagesOptions;
import fixtures.paging.models.Product;
import java.io.IOException;
import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.Url;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;

/**
 * An instance of this class provides access to all the operations defined
 * in Pagings.
 */
public class PagingsImpl implements Pagings {
    /** The Retrofit service to perform REST calls. */
    private PagingsService service;
    /** The service client containing this operation class. */
    private AutoRestPagingTestServiceImpl client;

    /**
     * Initializes an instance of PagingsImpl.
     *
     * @param retrofit the Retrofit instance built from a Retrofit Builder.
     * @param client the instance of the service client containing this operation class.
     */
    public PagingsImpl(Retrofit retrofit, AutoRestPagingTestServiceImpl client) {
        this.service = retrofit.create(PagingsService.class);
        this.client = client;
    }

    /**
     * The interface defining all the services for Pagings to be
     * used by Retrofit to perform actually REST calls.
     */
    interface PagingsService {
        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getSinglePages" })
        @GET("paging/single")
        Observable<Response<ResponseBody>> getSinglePages(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePages" })
        @GET("paging/multiple")
        Observable<Response<ResponseBody>> getMultiplePages(@Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getOdataMultiplePages" })
        @GET("paging/multiple/odata")
        Observable<Response<ResponseBody>> getOdataMultiplePages(@Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesWithOffset" })
        @GET("paging/multiple/withpath/{offset}")
        Observable<Response<ResponseBody>> getMultiplePagesWithOffset(@Path("offset") int offset, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesRetryFirst" })
        @GET("paging/multiple/retryfirst")
        Observable<Response<ResponseBody>> getMultiplePagesRetryFirst(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesRetrySecond" })
        @GET("paging/multiple/retrysecond")
        Observable<Response<ResponseBody>> getMultiplePagesRetrySecond(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getSinglePagesFailure" })
        @GET("paging/single/failure")
        Observable<Response<ResponseBody>> getSinglePagesFailure(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesFailure" })
        @GET("paging/multiple/failure")
        Observable<Response<ResponseBody>> getMultiplePagesFailure(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesFailureUri" })
        @GET("paging/multiple/failureuri")
        Observable<Response<ResponseBody>> getMultiplePagesFailureUri(@Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesFragmentNextLink" })
        @GET("paging/multiple/fragment/{tenant}")
        Observable<Response<ResponseBody>> getMultiplePagesFragmentNextLink(@Path("tenant") String tenant, @Query("api_version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesFragmentWithGroupingNextLink" })
        @GET("paging/multiple/fragmentwithgrouping/{tenant}")
        Observable<Response<ResponseBody>> getMultiplePagesFragmentWithGroupingNextLink(@Path("tenant") String tenant, @Header("accept-language") String acceptLanguage, @Query("api_version") String apiVersion, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings nextFragment" })
        @GET
        Observable<Response<ResponseBody>> nextFragment(@Url String nextUrl, @Query("api_version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings nextFragmentWithGrouping" })
        @GET
        Observable<Response<ResponseBody>> nextFragmentWithGrouping(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Query("api_version") String apiVersion, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getSinglePagesNext" })
        @GET
        Observable<Response<ResponseBody>> getSinglePagesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesNext" })
        @GET
        Observable<Response<ResponseBody>> getMultiplePagesNext(@Url String nextUrl, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getOdataMultiplePagesNext" })
        @GET
        Observable<Response<ResponseBody>> getOdataMultiplePagesNext(@Url String nextUrl, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesWithOffsetNext" })
        @GET
        Observable<Response<ResponseBody>> getMultiplePagesWithOffsetNext(@Url String nextUrl, @Header("client-request-id") String clientRequestId, @Header("accept-language") String acceptLanguage, @Header("maxresults") Integer maxresults, @Header("timeout") Integer timeout, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesRetryFirstNext" })
        @GET
        Observable<Response<ResponseBody>> getMultiplePagesRetryFirstNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesRetrySecondNext" })
        @GET
        Observable<Response<ResponseBody>> getMultiplePagesRetrySecondNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getSinglePagesFailureNext" })
        @GET
        Observable<Response<ResponseBody>> getSinglePagesFailureNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesFailureNext" })
        @GET
        Observable<Response<ResponseBody>> getMultiplePagesFailureNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

        @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.paging.Pagings getMultiplePagesFailureUriNext" })
        @GET
        Observable<Response<ResponseBody>> getMultiplePagesFailureUriNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getSinglePages() {
        ServiceResponse<Page<Product>> response = getSinglePagesSinglePageAsync().toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getSinglePagesNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getSinglePagesAsync(final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getSinglePagesSinglePageAsync(),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getSinglePagesNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getSinglePagesAsync() {
        return getSinglePagesWithServiceResponseAsync()
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getSinglePagesWithServiceResponseAsync() {
        return getSinglePagesSinglePageAsync()
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getSinglePagesNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getSinglePagesSinglePageAsync() {
        return service.getSinglePages(this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getSinglePagesDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getSinglePagesDelegate(Response<ResponseBody> response) throws CloudException, IOException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePages() {
        ServiceResponse<Page<Product>> response = getMultiplePagesSinglePageAsync().toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesNextSinglePageAsync(nextPageLink, null, null).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesAsync(final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesSinglePageAsync(),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesNextSinglePageAsync(nextPageLink, null, null);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesAsync() {
        return getMultiplePagesWithServiceResponseAsync()
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithServiceResponseAsync() {
        return getMultiplePagesSinglePageAsync()
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesNextWithServiceResponseAsync(nextPageLink, null, null));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesSinglePageAsync() {
        final String clientRequestId = null;
        final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions = null;
        Integer maxresults = null;
        Integer timeout = null;
        return service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePages(final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions) {
        ServiceResponse<Page<Product>> response = getMultiplePagesSinglePageAsync(clientRequestId, pagingGetMultiplePagesOptions).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesAsync(final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesSinglePageAsync(clientRequestId, pagingGetMultiplePagesOptions),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesAsync(final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions) {
        return getMultiplePagesWithServiceResponseAsync(clientRequestId, pagingGetMultiplePagesOptions)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithServiceResponseAsync(final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions) {
        return getMultiplePagesSinglePageAsync(clientRequestId, pagingGetMultiplePagesOptions)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesNextWithServiceResponseAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
    ServiceResponse<PageImpl<Product>> * @param clientRequestId the String value
    ServiceResponse<PageImpl<Product>> * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesSinglePageAsync(final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions) {
        Validator.validate(pagingGetMultiplePagesOptions);
        Integer maxresults = null;
        if (pagingGetMultiplePagesOptions != null) {
            maxresults = pagingGetMultiplePagesOptions.maxresults();
        }
        Integer timeout = null;
        if (pagingGetMultiplePagesOptions != null) {
            timeout = pagingGetMultiplePagesOptions.timeout();
        }
        return service.getMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesDelegate(Response<ResponseBody> response) throws CloudException, IOException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getOdataMultiplePages() {
        ServiceResponse<Page<Product>> response = getOdataMultiplePagesSinglePageAsync().toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getOdataMultiplePagesNextSinglePageAsync(nextPageLink, null, null).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getOdataMultiplePagesAsync(final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getOdataMultiplePagesSinglePageAsync(),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getOdataMultiplePagesNextSinglePageAsync(nextPageLink, null, null);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getOdataMultiplePagesAsync() {
        return getOdataMultiplePagesWithServiceResponseAsync()
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getOdataMultiplePagesWithServiceResponseAsync() {
        return getOdataMultiplePagesSinglePageAsync()
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getOdataMultiplePagesNextWithServiceResponseAsync(nextPageLink, null, null));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getOdataMultiplePagesSinglePageAsync() {
        final String clientRequestId = null;
        final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions = null;
        Integer maxresults = null;
        Integer timeout = null;
        return service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl1<Product>> result = getOdataMultiplePagesDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param clientRequestId the String value
     * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getOdataMultiplePages(final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions) {
        ServiceResponse<Page<Product>> response = getOdataMultiplePagesSinglePageAsync(clientRequestId, pagingGetOdataMultiplePagesOptions).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getOdataMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param clientRequestId the String value
     * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getOdataMultiplePagesAsync(final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getOdataMultiplePagesSinglePageAsync(clientRequestId, pagingGetOdataMultiplePagesOptions),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getOdataMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param clientRequestId the String value
     * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getOdataMultiplePagesAsync(final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions) {
        return getOdataMultiplePagesWithServiceResponseAsync(clientRequestId, pagingGetOdataMultiplePagesOptions)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param clientRequestId the String value
     * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getOdataMultiplePagesWithServiceResponseAsync(final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions) {
        return getOdataMultiplePagesSinglePageAsync(clientRequestId, pagingGetOdataMultiplePagesOptions)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getOdataMultiplePagesNextWithServiceResponseAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
    ServiceResponse<PageImpl1<Product>> * @param clientRequestId the String value
    ServiceResponse<PageImpl1<Product>> * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getOdataMultiplePagesSinglePageAsync(final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions) {
        Validator.validate(pagingGetOdataMultiplePagesOptions);
        Integer maxresults = null;
        if (pagingGetOdataMultiplePagesOptions != null) {
            maxresults = pagingGetOdataMultiplePagesOptions.maxresults();
        }
        Integer timeout = null;
        if (pagingGetOdataMultiplePagesOptions != null) {
            timeout = pagingGetOdataMultiplePagesOptions.timeout();
        }
        return service.getOdataMultiplePages(clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl1<Product>> result = getOdataMultiplePagesDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl1<Product>> getOdataMultiplePagesDelegate(Response<ResponseBody> response) throws CloudException, IOException {
        return this.client.restClient().responseBuilderFactory().<PageImpl1<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl1<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesWithOffset(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions) {
        ServiceResponse<Page<Product>> response = getMultiplePagesWithOffsetSinglePageAsync(pagingGetMultiplePagesWithOffsetOptions).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions();
                pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults());
                pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout());
                return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, null, pagingGetMultiplePagesWithOffsetNextOptions).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesWithOffsetAsync(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesWithOffsetSinglePageAsync(pagingGetMultiplePagesWithOffsetOptions),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions();
                    pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults());
                    pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout());
                    return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, null, pagingGetMultiplePagesWithOffsetNextOptions);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesWithOffsetAsync(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions) {
        return getMultiplePagesWithOffsetWithServiceResponseAsync(pagingGetMultiplePagesWithOffsetOptions)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithOffsetWithServiceResponseAsync(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions) {
        return getMultiplePagesWithOffsetSinglePageAsync(pagingGetMultiplePagesWithOffsetOptions)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions();
                    pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults());
                    pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout());
                    return Observable.just(page).concatWith(getMultiplePagesWithOffsetNextWithServiceResponseAsync(nextPageLink, null, pagingGetMultiplePagesWithOffsetNextOptions));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithOffsetSinglePageAsync(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions) {
        if (pagingGetMultiplePagesWithOffsetOptions == null) {
            throw new IllegalArgumentException("Parameter pagingGetMultiplePagesWithOffsetOptions is required and cannot be null.");
        }
        Validator.validate(pagingGetMultiplePagesWithOffsetOptions);
        final String clientRequestId = null;
        Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults();
        int offset = pagingGetMultiplePagesWithOffsetOptions.offset();
        Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout();
        return service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesWithOffsetDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
     * @param clientRequestId the String value
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesWithOffset(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions, final String clientRequestId) {
        ServiceResponse<Page<Product>> response = getMultiplePagesWithOffsetSinglePageAsync(pagingGetMultiplePagesWithOffsetOptions, clientRequestId).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions();
                pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults());
                pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout());
                return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
     * @param clientRequestId the String value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesWithOffsetAsync(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions, final String clientRequestId, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesWithOffsetSinglePageAsync(pagingGetMultiplePagesWithOffsetOptions, clientRequestId),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions();
                    pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults());
                    pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout());
                    return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
     * @param clientRequestId the String value
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesWithOffsetAsync(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions, final String clientRequestId) {
        return getMultiplePagesWithOffsetWithServiceResponseAsync(pagingGetMultiplePagesWithOffsetOptions, clientRequestId)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
     * @param clientRequestId the String value
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithOffsetWithServiceResponseAsync(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions, final String clientRequestId) {
        return getMultiplePagesWithOffsetSinglePageAsync(pagingGetMultiplePagesWithOffsetOptions, clientRequestId)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = new PagingGetMultiplePagesWithOffsetNextOptions();
                    pagingGetMultiplePagesWithOffsetNextOptions.withMaxresults(pagingGetMultiplePagesWithOffsetOptions.maxresults());
                    pagingGetMultiplePagesWithOffsetNextOptions.withTimeout(pagingGetMultiplePagesWithOffsetOptions.timeout());
                    return Observable.just(page).concatWith(getMultiplePagesWithOffsetNextWithServiceResponseAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
    ServiceResponse<PageImpl<Product>> * @param pagingGetMultiplePagesWithOffsetOptions Additional parameters for the operation
    ServiceResponse<PageImpl<Product>> * @param clientRequestId the String value
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithOffsetSinglePageAsync(final PagingGetMultiplePagesWithOffsetOptions pagingGetMultiplePagesWithOffsetOptions, final String clientRequestId) {
        if (pagingGetMultiplePagesWithOffsetOptions == null) {
            throw new IllegalArgumentException("Parameter pagingGetMultiplePagesWithOffsetOptions is required and cannot be null.");
        }
        Validator.validate(pagingGetMultiplePagesWithOffsetOptions);
        Integer maxresults = pagingGetMultiplePagesWithOffsetOptions.maxresults();
        int offset = pagingGetMultiplePagesWithOffsetOptions.offset();
        Integer timeout = pagingGetMultiplePagesWithOffsetOptions.timeout();
        return service.getMultiplePagesWithOffset(offset, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesWithOffsetDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesWithOffsetDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesRetryFirst() {
        ServiceResponse<Page<Product>> response = getMultiplePagesRetryFirstSinglePageAsync().toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesRetryFirstNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesRetryFirstAsync(final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesRetryFirstSinglePageAsync(),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesRetryFirstNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesRetryFirstAsync() {
        return getMultiplePagesRetryFirstWithServiceResponseAsync()
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesRetryFirstWithServiceResponseAsync() {
        return getMultiplePagesRetryFirstSinglePageAsync()
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesRetryFirstNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesRetryFirstSinglePageAsync() {
        return service.getMultiplePagesRetryFirst(this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesRetryFirstDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesRetryFirstDelegate(Response<ResponseBody> response) throws CloudException, IOException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesRetrySecond() {
        ServiceResponse<Page<Product>> response = getMultiplePagesRetrySecondSinglePageAsync().toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesRetrySecondNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesRetrySecondAsync(final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesRetrySecondSinglePageAsync(),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesRetrySecondNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesRetrySecondAsync() {
        return getMultiplePagesRetrySecondWithServiceResponseAsync()
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesRetrySecondWithServiceResponseAsync() {
        return getMultiplePagesRetrySecondSinglePageAsync()
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesRetrySecondNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesRetrySecondSinglePageAsync() {
        return service.getMultiplePagesRetrySecond(this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesRetrySecondDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesRetrySecondDelegate(Response<ResponseBody> response) throws CloudException, IOException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getSinglePagesFailure() {
        ServiceResponse<Page<Product>> response = getSinglePagesFailureSinglePageAsync().toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getSinglePagesFailureNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getSinglePagesFailureAsync(final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getSinglePagesFailureSinglePageAsync(),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getSinglePagesFailureNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getSinglePagesFailureAsync() {
        return getSinglePagesFailureWithServiceResponseAsync()
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getSinglePagesFailureWithServiceResponseAsync() {
        return getSinglePagesFailureSinglePageAsync()
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getSinglePagesFailureNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getSinglePagesFailureSinglePageAsync() {
        return service.getSinglePagesFailure(this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getSinglePagesFailureDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getSinglePagesFailureDelegate(Response<ResponseBody> response) throws CloudException, IOException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesFailure() {
        ServiceResponse<Page<Product>> response = getMultiplePagesFailureSinglePageAsync().toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesFailureNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesFailureAsync(final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesFailureSinglePageAsync(),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesFailureNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesFailureAsync() {
        return getMultiplePagesFailureWithServiceResponseAsync()
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFailureWithServiceResponseAsync() {
        return getMultiplePagesFailureSinglePageAsync()
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesFailureNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFailureSinglePageAsync() {
        return service.getMultiplePagesFailure(this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesFailureDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesFailureDelegate(Response<ResponseBody> response) throws CloudException, IOException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesFailureUri() {
        ServiceResponse<Page<Product>> response = getMultiplePagesFailureUriSinglePageAsync().toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesFailureUriNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesFailureUriAsync(final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesFailureUriSinglePageAsync(),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesFailureUriNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesFailureUriAsync() {
        return getMultiplePagesFailureUriWithServiceResponseAsync()
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFailureUriWithServiceResponseAsync() {
        return getMultiplePagesFailureUriSinglePageAsync()
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesFailureUriNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFailureUriSinglePageAsync() {
        return service.getMultiplePagesFailureUri(this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesFailureUriDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesFailureUriDelegate(Response<ResponseBody> response) throws CloudException, IOException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param tenant Sets the tenant to use.
     * @param apiVersion Sets the api version to use.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesFragmentNextLink(final String tenant, final String apiVersion) {
        ServiceResponse<Page<Product>> response = getMultiplePagesFragmentNextLinkSinglePageAsync(tenant, apiVersion).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextLink) {
                return nextFragmentSinglePageAsync(tenant, nextLink, apiVersion).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param tenant Sets the tenant to use.
     * @param apiVersion Sets the api version to use.
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesFragmentNextLinkAsync(final String tenant, final String apiVersion, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesFragmentNextLinkSinglePageAsync(tenant, apiVersion),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextLink) {
                    return nextFragmentSinglePageAsync(tenant, nextLink, apiVersion);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param tenant Sets the tenant to use.
     * @param apiVersion Sets the api version to use.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesFragmentNextLinkAsync(final String tenant, final String apiVersion) {
        return getMultiplePagesFragmentNextLinkWithServiceResponseAsync(tenant, apiVersion)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param tenant Sets the tenant to use.
     * @param apiVersion Sets the api version to use.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFragmentNextLinkWithServiceResponseAsync(final String tenant, final String apiVersion) {
        return getMultiplePagesFragmentNextLinkSinglePageAsync(tenant, apiVersion)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextLink = page.body().nextPageLink();
                    if (nextLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(nextFragmentWithServiceResponseAsync(tenant, nextLink, apiVersion));
                }
            });
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
    ServiceResponse<PageImpl1<Product>> * @param tenant Sets the tenant to use.
    ServiceResponse<PageImpl1<Product>> * @param apiVersion Sets the api version to use.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFragmentNextLinkSinglePageAsync(final String tenant, final String apiVersion) {
        if (tenant == null) {
            throw new IllegalArgumentException("Parameter tenant is required and cannot be null.");
        }
        if (apiVersion == null) {
            throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null.");
        }
        return service.getMultiplePagesFragmentNextLink(tenant, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl1<Product>> result = getMultiplePagesFragmentNextLinkDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl1<Product>> getMultiplePagesFragmentNextLinkDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl1<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl1<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment with parameters grouped.
     *
     * @param customParameterGroup Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesFragmentWithGroupingNextLink(final CustomParameterGroup customParameterGroup) {
        ServiceResponse<Page<Product>> response = getMultiplePagesFragmentWithGroupingNextLinkSinglePageAsync(customParameterGroup).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextLink) {
                return nextFragmentWithGroupingSinglePageAsync(nextLink, customParameterGroup).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment with parameters grouped.
     *
     * @param customParameterGroup Additional parameters for the operation
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesFragmentWithGroupingNextLinkAsync(final CustomParameterGroup customParameterGroup, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesFragmentWithGroupingNextLinkSinglePageAsync(customParameterGroup),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextLink) {
                    return nextFragmentWithGroupingSinglePageAsync(nextLink, customParameterGroup);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment with parameters grouped.
     *
     * @param customParameterGroup Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesFragmentWithGroupingNextLinkAsync(final CustomParameterGroup customParameterGroup) {
        return getMultiplePagesFragmentWithGroupingNextLinkWithServiceResponseAsync(customParameterGroup)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment with parameters grouped.
     *
     * @param customParameterGroup Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFragmentWithGroupingNextLinkWithServiceResponseAsync(final CustomParameterGroup customParameterGroup) {
        return getMultiplePagesFragmentWithGroupingNextLinkSinglePageAsync(customParameterGroup)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextLink = page.body().nextPageLink();
                    if (nextLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(nextFragmentWithGroupingWithServiceResponseAsync(nextLink, customParameterGroup));
                }
            });
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment with parameters grouped.
     *
    ServiceResponse<PageImpl1<Product>> * @param customParameterGroup Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFragmentWithGroupingNextLinkSinglePageAsync(final CustomParameterGroup customParameterGroup) {
        if (customParameterGroup == null) {
            throw new IllegalArgumentException("Parameter customParameterGroup is required and cannot be null.");
        }
        Validator.validate(customParameterGroup);
        String apiVersion = customParameterGroup.apiVersion();
        String tenant = customParameterGroup.tenant();
        return service.getMultiplePagesFragmentWithGroupingNextLink(tenant, this.client.acceptLanguage(), apiVersion, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl1<Product>> result = getMultiplePagesFragmentWithGroupingNextLinkDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl1<Product>> getMultiplePagesFragmentWithGroupingNextLinkDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl1<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl1<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param tenant Sets the tenant to use.
     * @param nextLink Next link for list operation.
     * @param apiVersion Sets the api version to use.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> nextFragment(final String tenant, final String nextLink, final String apiVersion) {
        ServiceResponse<Page<Product>> response = nextFragmentSinglePageAsync(tenant, nextLink, apiVersion).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextLink) {
                return nextFragmentSinglePageAsync(tenant, nextLink, apiVersion).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param tenant Sets the tenant to use.
     * @param nextLink Next link for list operation.
     * @param apiVersion Sets the api version to use.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> nextFragmentAsync(final String tenant, final String nextLink, final String apiVersion, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            nextFragmentSinglePageAsync(tenant, nextLink, apiVersion),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextLink) {
                    return nextFragmentSinglePageAsync(tenant, nextLink, apiVersion);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param tenant Sets the tenant to use.
     * @param nextLink Next link for list operation.
     * @param apiVersion Sets the api version to use.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> nextFragmentAsync(final String tenant, final String nextLink, final String apiVersion) {
        return nextFragmentWithServiceResponseAsync(tenant, nextLink, apiVersion)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param tenant Sets the tenant to use.
     * @param nextLink Next link for list operation.
     * @param apiVersion Sets the api version to use.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> nextFragmentWithServiceResponseAsync(final String tenant, final String nextLink, final String apiVersion) {
        return nextFragmentSinglePageAsync(tenant, nextLink, apiVersion)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextLink = page.body().nextPageLink();
                    if (nextLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(nextFragmentWithServiceResponseAsync(tenant, nextLink, apiVersion));
                }
            });
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
    ServiceResponse<PageImpl1<Product>> * @param tenant Sets the tenant to use.
    ServiceResponse<PageImpl1<Product>> * @param nextLink Next link for list operation.
    ServiceResponse<PageImpl1<Product>> * @param apiVersion Sets the api version to use.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> nextFragmentSinglePageAsync(final String tenant, final String nextLink, final String apiVersion) {
        if (tenant == null) {
            throw new IllegalArgumentException("Parameter tenant is required and cannot be null.");
        }
        if (nextLink == null) {
            throw new IllegalArgumentException("Parameter nextLink is required and cannot be null.");
        }
        if (apiVersion == null) {
            throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null.");
        }
        String nextUrl = String.format("paging/multiple/fragment/%s/%s", tenant, nextLink);
        return service.nextFragment(nextUrl, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl1<Product>> result = nextFragmentDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl1<Product>> nextFragmentDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl1<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl1<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param nextLink Next link for list operation.
     * @param customParameterGroup Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> nextFragmentWithGrouping(final String nextLink, final CustomParameterGroup customParameterGroup) {
        ServiceResponse<Page<Product>> response = nextFragmentWithGroupingSinglePageAsync(nextLink, customParameterGroup).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextLink) {
                return nextFragmentWithGroupingSinglePageAsync(nextLink, customParameterGroup).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param nextLink Next link for list operation.
     * @param customParameterGroup Additional parameters for the operation
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> nextFragmentWithGroupingAsync(final String nextLink, final CustomParameterGroup customParameterGroup, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            nextFragmentWithGroupingSinglePageAsync(nextLink, customParameterGroup),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextLink) {
                    return nextFragmentWithGroupingSinglePageAsync(nextLink, customParameterGroup);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param nextLink Next link for list operation.
     * @param customParameterGroup Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> nextFragmentWithGroupingAsync(final String nextLink, final CustomParameterGroup customParameterGroup) {
        return nextFragmentWithGroupingWithServiceResponseAsync(nextLink, customParameterGroup)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
     * @param nextLink Next link for list operation.
     * @param customParameterGroup Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> nextFragmentWithGroupingWithServiceResponseAsync(final String nextLink, final CustomParameterGroup customParameterGroup) {
        return nextFragmentWithGroupingSinglePageAsync(nextLink, customParameterGroup)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextLink = page.body().nextPageLink();
                    if (nextLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(nextFragmentWithGroupingWithServiceResponseAsync(nextLink, customParameterGroup));
                }
            });
    }

    /**
     * A paging operation that doesn't return a full URL, just a fragment.
     *
    ServiceResponse<PageImpl1<Product>> * @param nextLink Next link for list operation.
    ServiceResponse<PageImpl1<Product>> * @param customParameterGroup Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> nextFragmentWithGroupingSinglePageAsync(final String nextLink, final CustomParameterGroup customParameterGroup) {
        if (nextLink == null) {
            throw new IllegalArgumentException("Parameter nextLink is required and cannot be null.");
        }
        if (customParameterGroup == null) {
            throw new IllegalArgumentException("Parameter customParameterGroup is required and cannot be null.");
        }
        Validator.validate(customParameterGroup);
        String apiVersion = customParameterGroup.apiVersion();
        String tenant = customParameterGroup.tenant();
        String nextUrl = String.format("paging/multiple/fragmentwithgrouping/%s/%s", tenant, nextLink);
        return service.nextFragmentWithGrouping(nextUrl, this.client.acceptLanguage(), apiVersion, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl1<Product>> result = nextFragmentWithGroupingDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl1<Product>> nextFragmentWithGroupingDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl1<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl1<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getSinglePagesNext(final String nextPageLink) {
        ServiceResponse<Page<Product>> response = getSinglePagesNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getSinglePagesNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getSinglePagesNextAsync(final String nextPageLink, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getSinglePagesNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getSinglePagesNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getSinglePagesNextAsync(final String nextPageLink) {
        return getSinglePagesNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getSinglePagesNextWithServiceResponseAsync(final String nextPageLink) {
        return getSinglePagesNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getSinglePagesNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that finishes on the first call without a nextlink.
     *
    ServiceResponse<PageImpl<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getSinglePagesNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.getSinglePagesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getSinglePagesNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getSinglePagesNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesNext(final String nextPageLink) {
        ServiceResponse<Page<Product>> response = getMultiplePagesNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesNextSinglePageAsync(nextPageLink, null, null).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesNextAsync(final String nextPageLink, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesNextSinglePageAsync(nextPageLink, null, null);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesNextAsync(final String nextPageLink) {
        return getMultiplePagesNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesNextWithServiceResponseAsync(final String nextPageLink) {
        return getMultiplePagesNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesNextWithServiceResponseAsync(nextPageLink, null, null));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        final String clientRequestId = null;
        final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions = null;
        Integer maxresults = null;
        Integer timeout = null;
        String nextUrl = String.format("%s", nextPageLink);
        return service.getMultiplePagesNext(nextUrl, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesNext(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions) {
        ServiceResponse<Page<Product>> response = getMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesNextAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesNextAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions) {
        return getMultiplePagesNextWithServiceResponseAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesNextWithServiceResponseAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions) {
        return getMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesNextWithServiceResponseAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesOptions));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
    ServiceResponse<PageImpl<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation.
    ServiceResponse<PageImpl<Product>> * @param clientRequestId the String value
    ServiceResponse<PageImpl<Product>> * @param pagingGetMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesNextSinglePageAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesOptions pagingGetMultiplePagesOptions) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        Validator.validate(pagingGetMultiplePagesOptions);
        Integer maxresults = null;
        if (pagingGetMultiplePagesOptions != null) {
            maxresults = pagingGetMultiplePagesOptions.maxresults();
        }
        Integer timeout = null;
        if (pagingGetMultiplePagesOptions != null) {
            timeout = pagingGetMultiplePagesOptions.timeout();
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.getMultiplePagesNext(nextUrl, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getOdataMultiplePagesNext(final String nextPageLink) {
        ServiceResponse<Page<Product>> response = getOdataMultiplePagesNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getOdataMultiplePagesNextSinglePageAsync(nextPageLink, null, null).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getOdataMultiplePagesNextAsync(final String nextPageLink, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getOdataMultiplePagesNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getOdataMultiplePagesNextSinglePageAsync(nextPageLink, null, null);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getOdataMultiplePagesNextAsync(final String nextPageLink) {
        return getOdataMultiplePagesNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getOdataMultiplePagesNextWithServiceResponseAsync(final String nextPageLink) {
        return getOdataMultiplePagesNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getOdataMultiplePagesNextWithServiceResponseAsync(nextPageLink, null, null));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getOdataMultiplePagesNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        final String clientRequestId = null;
        final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions = null;
        Integer maxresults = null;
        Integer timeout = null;
        String nextUrl = String.format("%s", nextPageLink);
        return service.getOdataMultiplePagesNext(nextUrl, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl1<Product>> result = getOdataMultiplePagesNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getOdataMultiplePagesNext(final String nextPageLink, final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions) {
        ServiceResponse<Page<Product>> response = getOdataMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getOdataMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getOdataMultiplePagesNextAsync(final String nextPageLink, final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getOdataMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getOdataMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getOdataMultiplePagesNextAsync(final String nextPageLink, final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions) {
        return getOdataMultiplePagesNextWithServiceResponseAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getOdataMultiplePagesNextWithServiceResponseAsync(final String nextPageLink, final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions) {
        return getOdataMultiplePagesNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getOdataMultiplePagesNextWithServiceResponseAsync(nextPageLink, clientRequestId, pagingGetOdataMultiplePagesOptions));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink in odata format that has 10 pages.
     *
    ServiceResponse<PageImpl1<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation.
    ServiceResponse<PageImpl1<Product>> * @param clientRequestId the String value
    ServiceResponse<PageImpl1<Product>> * @param pagingGetOdataMultiplePagesOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getOdataMultiplePagesNextSinglePageAsync(final String nextPageLink, final String clientRequestId, final PagingGetOdataMultiplePagesOptions pagingGetOdataMultiplePagesOptions) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        Validator.validate(pagingGetOdataMultiplePagesOptions);
        Integer maxresults = null;
        if (pagingGetOdataMultiplePagesOptions != null) {
            maxresults = pagingGetOdataMultiplePagesOptions.maxresults();
        }
        Integer timeout = null;
        if (pagingGetOdataMultiplePagesOptions != null) {
            timeout = pagingGetOdataMultiplePagesOptions.timeout();
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.getOdataMultiplePagesNext(nextUrl, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl1<Product>> result = getOdataMultiplePagesNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl1<Product>> getOdataMultiplePagesNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl1<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl1<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesWithOffsetNext(final String nextPageLink) {
        ServiceResponse<Page<Product>> response = getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, null, null).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesWithOffsetNextAsync(final String nextPageLink, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, null, null);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesWithOffsetNextAsync(final String nextPageLink) {
        return getMultiplePagesWithOffsetNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithOffsetNextWithServiceResponseAsync(final String nextPageLink) {
        return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesWithOffsetNextWithServiceResponseAsync(nextPageLink, null, null));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithOffsetNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        final String clientRequestId = null;
        final PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions = null;
        Integer maxresults = null;
        Integer timeout = null;
        String nextUrl = String.format("%s", nextPageLink);
        return service.getMultiplePagesWithOffsetNext(nextUrl, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesWithOffsetNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesWithOffsetNextOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesWithOffsetNext(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions) {
        ServiceResponse<Page<Product>> response = getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesWithOffsetNextOptions Additional parameters for the operation
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesWithOffsetNextAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesWithOffsetNextOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesWithOffsetNextAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions) {
        return getMultiplePagesWithOffsetNextWithServiceResponseAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param clientRequestId the String value
     * @param pagingGetMultiplePagesWithOffsetNextOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithOffsetNextWithServiceResponseAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions) {
        return getMultiplePagesWithOffsetNextSinglePageAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesWithOffsetNextWithServiceResponseAsync(nextPageLink, clientRequestId, pagingGetMultiplePagesWithOffsetNextOptions));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages.
     *
    ServiceResponse<PageImpl<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation.
    ServiceResponse<PageImpl<Product>> * @param clientRequestId the String value
    ServiceResponse<PageImpl<Product>> * @param pagingGetMultiplePagesWithOffsetNextOptions Additional parameters for the operation
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesWithOffsetNextSinglePageAsync(final String nextPageLink, final String clientRequestId, final PagingGetMultiplePagesWithOffsetNextOptions pagingGetMultiplePagesWithOffsetNextOptions) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        Validator.validate(pagingGetMultiplePagesWithOffsetNextOptions);
        Integer maxresults = null;
        if (pagingGetMultiplePagesWithOffsetNextOptions != null) {
            maxresults = pagingGetMultiplePagesWithOffsetNextOptions.maxresults();
        }
        Integer timeout = null;
        if (pagingGetMultiplePagesWithOffsetNextOptions != null) {
            timeout = pagingGetMultiplePagesWithOffsetNextOptions.timeout();
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.getMultiplePagesWithOffsetNext(nextUrl, clientRequestId, this.client.acceptLanguage(), maxresults, timeout, this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesWithOffsetNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesWithOffsetNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesRetryFirstNext(final String nextPageLink) {
        ServiceResponse<Page<Product>> response = getMultiplePagesRetryFirstNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesRetryFirstNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesRetryFirstNextAsync(final String nextPageLink, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesRetryFirstNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesRetryFirstNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesRetryFirstNextAsync(final String nextPageLink) {
        return getMultiplePagesRetryFirstNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesRetryFirstNextWithServiceResponseAsync(final String nextPageLink) {
        return getMultiplePagesRetryFirstNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesRetryFirstNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages.
     *
    ServiceResponse<PageImpl<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesRetryFirstNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.getMultiplePagesRetryFirstNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesRetryFirstNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesRetryFirstNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesRetrySecondNext(final String nextPageLink) {
        ServiceResponse<Page<Product>> response = getMultiplePagesRetrySecondNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesRetrySecondNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesRetrySecondNextAsync(final String nextPageLink, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesRetrySecondNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesRetrySecondNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesRetrySecondNextAsync(final String nextPageLink) {
        return getMultiplePagesRetrySecondNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesRetrySecondNextWithServiceResponseAsync(final String nextPageLink) {
        return getMultiplePagesRetrySecondNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesRetrySecondNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually.
     *
    ServiceResponse<PageImpl<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesRetrySecondNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.getMultiplePagesRetrySecondNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesRetrySecondNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesRetrySecondNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getSinglePagesFailureNext(final String nextPageLink) {
        ServiceResponse<Page<Product>> response = getSinglePagesFailureNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getSinglePagesFailureNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getSinglePagesFailureNextAsync(final String nextPageLink, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getSinglePagesFailureNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getSinglePagesFailureNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getSinglePagesFailureNextAsync(final String nextPageLink) {
        return getSinglePagesFailureNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getSinglePagesFailureNextWithServiceResponseAsync(final String nextPageLink) {
        return getSinglePagesFailureNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getSinglePagesFailureNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that receives a 400 on the first call.
     *
    ServiceResponse<PageImpl<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getSinglePagesFailureNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.getSinglePagesFailureNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getSinglePagesFailureNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getSinglePagesFailureNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesFailureNext(final String nextPageLink) {
        ServiceResponse<Page<Product>> response = getMultiplePagesFailureNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesFailureNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesFailureNextAsync(final String nextPageLink, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesFailureNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesFailureNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesFailureNextAsync(final String nextPageLink) {
        return getMultiplePagesFailureNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFailureNextWithServiceResponseAsync(final String nextPageLink) {
        return getMultiplePagesFailureNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesFailureNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that receives a 400 on the second call.
     *
    ServiceResponse<PageImpl<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFailureNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.getMultiplePagesFailureNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesFailureNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesFailureNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @throws CloudException thrown if the request is rejected by server
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
     * @return the PagedList&lt;Product&gt; object if successful.
     */
    public PagedList<Product> getMultiplePagesFailureUriNext(final String nextPageLink) {
        ServiceResponse<Page<Product>> response = getMultiplePagesFailureUriNextSinglePageAsync(nextPageLink).toBlocking().single();
        return new PagedList<Product>(response.body()) {
            @Override
            public Page<Product> nextPage(String nextPageLink) {
                return getMultiplePagesFailureUriNextSinglePageAsync(nextPageLink).toBlocking().single().body();
            }
        };
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param serviceFuture the ServiceFuture object tracking the Retrofit calls
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the {@link ServiceFuture} object
     */
    public ServiceFuture<List<Product>> getMultiplePagesFailureUriNextAsync(final String nextPageLink, final ServiceFuture<List<Product>> serviceFuture, final ListOperationCallback<Product> serviceCallback) {
        return AzureServiceFuture.fromPageResponse(
            getMultiplePagesFailureUriNextSinglePageAsync(nextPageLink),
            new Func1<String, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(String nextPageLink) {
                    return getMultiplePagesFailureUriNextSinglePageAsync(nextPageLink);
                }
            },
            serviceCallback);
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<Page<Product>> getMultiplePagesFailureUriNextAsync(final String nextPageLink) {
        return getMultiplePagesFailureUriNextWithServiceResponseAsync(nextPageLink)
            .map(new Func1<ServiceResponse<Page<Product>>, Page<Product>>() {
                @Override
                public Page<Product> call(ServiceResponse<Page<Product>> response) {
                    return response.body();
                }
            });
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the PagedList&lt;Product&gt; object
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFailureUriNextWithServiceResponseAsync(final String nextPageLink) {
        return getMultiplePagesFailureUriNextSinglePageAsync(nextPageLink)
            .concatMap(new Func1<ServiceResponse<Page<Product>>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(ServiceResponse<Page<Product>> page) {
                    String nextPageLink = page.body().nextPageLink();
                    if (nextPageLink == null) {
                        return Observable.just(page);
                    }
                    return Observable.just(page).concatWith(getMultiplePagesFailureUriNextWithServiceResponseAsync(nextPageLink));
                }
            });
    }

    /**
     * A paging operation that receives an invalid nextLink.
     *
    ServiceResponse<PageImpl<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful.
     */
    public Observable<ServiceResponse<Page<Product>>> getMultiplePagesFailureUriNextSinglePageAsync(final String nextPageLink) {
        if (nextPageLink == null) {
            throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
        }
        String nextUrl = String.format("%s", nextPageLink);
        return service.getMultiplePagesFailureUriNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
            .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<Product>>>>() {
                @Override
                public Observable<ServiceResponse<Page<Product>>> call(Response<ResponseBody> response) {
                    try {
                        ServiceResponse<PageImpl<Product>> result = getMultiplePagesFailureUriNextDelegate(response);
                        return Observable.just(new ServiceResponse<Page<Product>>(result.body(), result.response()));
                    } catch (Throwable t) {
                        return Observable.error(t);
                    }
                }
            });
    }

    private ServiceResponse<PageImpl<Product>> getMultiplePagesFailureUriNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
        return this.client.restClient().responseBuilderFactory().<PageImpl<Product>, CloudException>newInstance(this.client.serializerAdapter())
                .register(200, new TypeToken<PageImpl<Product>>() { }.getType())
                .registerError(CloudException.class)
                .build(response);
    }

}