Search in sources :

Example 6 with Page

use of com.microsoft.azure.Page in project autorest.java by Azure.

the class PagingsImpl method getMultiplePagesWithOffset.

/**
 * 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<Product> 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();
        }
    };
}
Also used : PagingGetMultiplePagesWithOffsetNextOptions(fixtures.paging.models.PagingGetMultiplePagesWithOffsetNextOptions) PagedList(com.microsoft.azure.PagedList) Product(fixtures.paging.models.Product) Page(com.microsoft.azure.Page)

Example 7 with Page

use of com.microsoft.azure.Page in project azure-sdk-for-java by Azure.

the class TopLevelDomainsInner method listAgreementsSinglePageAsync.

/**
     * Gets all legal agreements that user needs to accept before purchasing a domain.
     * Gets all legal agreements that user needs to accept before purchasing a domain.
     *
     * @param name Name of the top-level domain.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;TldLegalAgreementInner&gt; object wrapped in {@link ServiceResponse} if successful.
     */
public Observable<ServiceResponse<Page<TldLegalAgreementInner>>> listAgreementsSinglePageAsync(final String name) {
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    final String apiVersion = "2015-04-01";
    final Boolean includePrivacy = null;
    TopLevelDomainAgreementOption agreementOption = new TopLevelDomainAgreementOption();
    agreementOption.withIncludePrivacy(null);
    return service.listAgreements(name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), agreementOption, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<TldLegalAgreementInner>>>>() {

        @Override
        public Observable<ServiceResponse<Page<TldLegalAgreementInner>>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<PageImpl<TldLegalAgreementInner>> result = listAgreementsDelegate(response);
                return Observable.just(new ServiceResponse<Page<TldLegalAgreementInner>>(result.body(), result.response()));
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Page(com.microsoft.azure.Page) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) TopLevelDomainAgreementOption(com.microsoft.azure.management.appservice.TopLevelDomainAgreementOption)

Example 8 with Page

use of com.microsoft.azure.Page in project azure-sdk-for-java by Azure.

the class TopLevelDomainsInner method listAgreementsSinglePageAsync.

/**
     * Gets all legal agreements that user needs to accept before purchasing a domain.
     * Gets all legal agreements that user needs to accept before purchasing a domain.
     *
    ServiceResponse<PageImpl<TldLegalAgreementInner>> * @param name Name of the top-level domain.
    ServiceResponse<PageImpl<TldLegalAgreementInner>> * @param includePrivacy If &lt;code&gt;true&lt;/code&gt;, then the list of agreements will include agreements for domain privacy as well; otherwise, &lt;code&gt;false&lt;/code&gt;.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;TldLegalAgreementInner&gt; object wrapped in {@link ServiceResponse} if successful.
     */
public Observable<ServiceResponse<Page<TldLegalAgreementInner>>> listAgreementsSinglePageAsync(final String name, final Boolean includePrivacy) {
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    final String apiVersion = "2015-04-01";
    TopLevelDomainAgreementOption agreementOption = new TopLevelDomainAgreementOption();
    agreementOption.withIncludePrivacy(includePrivacy);
    return service.listAgreements(name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), agreementOption, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<TldLegalAgreementInner>>>>() {

        @Override
        public Observable<ServiceResponse<Page<TldLegalAgreementInner>>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<PageImpl<TldLegalAgreementInner>> result = listAgreementsDelegate(response);
                return Observable.just(new ServiceResponse<Page<TldLegalAgreementInner>>(result.body(), result.response()));
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Page(com.microsoft.azure.Page) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) TopLevelDomainAgreementOption(com.microsoft.azure.management.appservice.TopLevelDomainAgreementOption)

Example 9 with Page

use of com.microsoft.azure.Page in project autorest.java by Azure.

the class PagingsImpl method getMultiplePagesSinglePageAsync.

/**
 * 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);
            }
        }
    });
}
Also used : Product(fixtures.paging.models.Product) Page(com.microsoft.azure.Page) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) PagingGetMultiplePagesOptions(fixtures.paging.models.PagingGetMultiplePagesOptions) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse)

Example 10 with Page

use of com.microsoft.azure.Page in project autorest.java by Azure.

the class PagingsImpl method getOdataMultiplePagesNextSinglePageAsync.

/**
 * 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);
            }
        }
    });
}
Also used : Product(fixtures.paging.models.Product) PagingGetOdataMultiplePagesOptions(fixtures.paging.models.PagingGetOdataMultiplePagesOptions) Page(com.microsoft.azure.Page) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse)

Aggregations

Page (com.microsoft.azure.Page)13 ServiceResponse (com.microsoft.rest.ServiceResponse)8 ResponseBody (okhttp3.ResponseBody)8 Response (retrofit2.Response)8 Observable (rx.Observable)8 Product (fixtures.paging.models.Product)7 PagingGetMultiplePagesWithOffsetNextOptions (fixtures.paging.models.PagingGetMultiplePagesWithOffsetNextOptions)3 PagedList (com.microsoft.azure.PagedList)2 TopLevelDomainAgreementOption (com.microsoft.azure.management.appservice.TopLevelDomainAgreementOption)2 VirtualMachineInner (com.microsoft.azure.management.compute.implementation.VirtualMachineInner)2 PagingGetMultiplePagesOptions (fixtures.paging.models.PagingGetMultiplePagesOptions)2 Action1 (rx.functions.Action1)2 Azure (com.microsoft.azure.management.Azure)1 SkuName (com.microsoft.azure.management.appservice.SkuName)1 DataDisk (com.microsoft.azure.management.compute.DataDisk)1 InstanceViewStatus (com.microsoft.azure.management.compute.InstanceViewStatus)1 InstanceViewTypes (com.microsoft.azure.management.compute.InstanceViewTypes)1 OSDisk (com.microsoft.azure.management.compute.OSDisk)1 OperatingSystemTypes (com.microsoft.azure.management.compute.OperatingSystemTypes)1 StorageAccountTypes (com.microsoft.azure.management.compute.StorageAccountTypes)1