Search in sources :

Example 36 with GET

use of retrofit2.http.GET in project azure-sdk-for-java by Azure.

the class GroupsInner method getMemberGroupsWithServiceResponseAsync.

/**
     * Gets a collection of object IDs of groups of which the specified group is a member.
     *
     * @param objectId The object ID of the group for which to get group membership.
     * @param securityEnabledOnly If true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the List<String> object
     */
public Observable<ServiceResponse<List<String>>> getMemberGroupsWithServiceResponseAsync(String objectId, boolean securityEnabledOnly) {
    if (objectId == null) {
        throw new IllegalArgumentException("Parameter objectId is required and cannot be null.");
    }
    if (this.client.tenantID() == null) {
        throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    GroupGetMemberGroupsParameters parameters = new GroupGetMemberGroupsParameters();
    parameters.withSecurityEnabledOnly(securityEnabledOnly);
    return service.getMemberGroups(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<String>>>>() {

        @Override
        public Observable<ServiceResponse<List<String>>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<PageImpl1<String>> result = getMemberGroupsDelegate(response);
                ServiceResponse<List<String>> clientResponse = new ServiceResponse<List<String>>(result.body().items(), result.response());
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) PagedList(com.microsoft.azure.PagedList) List(java.util.List) GroupGetMemberGroupsParameters(com.microsoft.azure.management.graphrbac.GroupGetMemberGroupsParameters)

Example 37 with GET

use of retrofit2.http.GET in project retrofit by square.

the class RequestBuilderAndroidTest method getWithAndroidUriUrlAbsolute.

@Test
public void getWithAndroidUriUrlAbsolute() {
    class Example {

        @GET
        Call<ResponseBody> method(@Url Uri url) {
            return null;
        }
    }
    Request request = buildRequest(Example.class, Uri.parse("https://example2.com/foo/bar/"));
    assertThat(request.method()).isEqualTo("GET");
    assertThat(request.headers().size()).isZero();
    assertThat(request.url().toString()).isEqualTo("https://example2.com/foo/bar/");
    assertThat(request.body()).isNull();
}
Also used : Request(okhttp3.Request) RequestBuilderTest.buildRequest(retrofit2.RequestBuilderTest.buildRequest) Uri(android.net.Uri) Url(retrofit2.http.Url) ResponseBody(okhttp3.ResponseBody) Test(org.junit.Test)

Example 38 with GET

use of retrofit2.http.GET in project retrofit by square.

the class RequestBuilderAndroidTest method getWithAndroidUriUrl.

@Test
public void getWithAndroidUriUrl() {
    class Example {

        @GET
        Call<ResponseBody> method(@Url Uri url) {
            return null;
        }
    }
    Request request = buildRequest(Example.class, Uri.parse("foo/bar/"));
    assertThat(request.method()).isEqualTo("GET");
    assertThat(request.headers().size()).isZero();
    assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/");
    assertThat(request.body()).isNull();
}
Also used : Request(okhttp3.Request) RequestBuilderTest.buildRequest(retrofit2.RequestBuilderTest.buildRequest) Uri(android.net.Uri) Url(retrofit2.http.Url) ResponseBody(okhttp3.ResponseBody) Test(org.junit.Test)

Example 39 with GET

use of retrofit2.http.GET in project retrofit by square.

the class RequestBuilderTest method getWithStringUrl.

@Test
public void getWithStringUrl() {
    class Example {

        @GET
        Call<ResponseBody> method(@Url String url) {
            return null;
        }
    }
    Request request = buildRequest(Example.class, "foo/bar/");
    assertThat(request.method()).isEqualTo("GET");
    assertThat(request.headers().size()).isZero();
    assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/");
    assertThat(request.body()).isNull();
}
Also used : Request(okhttp3.Request) Url(retrofit2.http.Url) HttpUrl(okhttp3.HttpUrl) ResponseBody(okhttp3.ResponseBody) Test(org.junit.Test)

Example 40 with GET

use of retrofit2.http.GET in project retrofit by square.

the class RequestBuilderTest method getWithJavaUriUrlAbsolute.

@Test
public void getWithJavaUriUrlAbsolute() {
    class Example {

        @GET
        Call<ResponseBody> method(@Url URI url) {
            return null;
        }
    }
    Request request = buildRequest(Example.class, URI.create("https://example2.com/foo/bar/"));
    assertThat(request.method()).isEqualTo("GET");
    assertThat(request.headers().size()).isZero();
    assertThat(request.url().toString()).isEqualTo("https://example2.com/foo/bar/");
    assertThat(request.body()).isNull();
}
Also used : Request(okhttp3.Request) URI(java.net.URI) Url(retrofit2.http.Url) HttpUrl(okhttp3.HttpUrl) ResponseBody(okhttp3.ResponseBody) Test(org.junit.Test)

Aggregations

ResponseBody (okhttp3.ResponseBody)61 Test (org.junit.Test)54 Request (okhttp3.Request)52 Response (retrofit2.Response)27 Retrofit (retrofit2.Retrofit)23 Query (retrofit2.http.Query)15 List (java.util.List)14 IOException (java.io.IOException)12 OkHttpClient (okhttp3.OkHttpClient)12 HttpUrl (okhttp3.HttpUrl)10 Path (retrofit2.http.Path)10 ArrayList (java.util.ArrayList)9 BrainSentences (com.gladysinc.gladys.Models.BrainSentences)8 RetrofitAPI (com.gladysinc.gladys.Utils.RetrofitAPI)8 SelfSigningClientBuilder (com.gladysinc.gladys.Utils.SelfSigningClientBuilder)8 ServiceResponse (com.microsoft.rest.ServiceResponse)8 Call (retrofit2.Call)8 Url (retrofit2.http.Url)8 Uri (android.net.Uri)6 View (android.view.View)6