本文整理匯總了Java中retrofit2.http.GET類的典型用法代碼示例。如果您正苦於以下問題:Java GET類的具體用法?Java GET怎麽用?Java GET使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GET類屬於retrofit2.http包,在下文中一共展示了GET類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getWithEncodedQueryParamMap
import retrofit2.http.GET; //導入依賴的package包/類
@Test public void getWithEncodedQueryParamMap() {
class Example {
@GET("/foo/bar/") //
Call<ResponseBody> method(@QueryMap(encoded = true) Map<String, Object> query) {
return null;
}
}
Map<String, Object> params = new LinkedHashMap<>();
params.put("kit", "k%20t");
params.put("pi%20ng", "p%20g");
Request request = buildRequest(Example.class, params);
assertThat(request.method()).isEqualTo("GET");
assertThat(request.headers().size()).isZero();
assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/?kit=k%20t&pi%20ng=p%20g");
assertThat(request.body()).isNull();
}
示例2: getWithPathAndQueryHashParam
import retrofit2.http.GET; //導入依賴的package包/類
@Test public void getWithPathAndQueryHashParam() {
class Example {
@GET("/foo/bar/{ping}/") //
Call<ResponseBody> method(@Path("ping") String ping, @Query("kit") String kit) {
return null;
}
}
Request request = buildRequest(Example.class, "pong#", "kat#");
assertThat(request.method()).isEqualTo("GET");
assertThat(request.headers().size()).isZero();
assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/pong%23/?kit=kat%23");
assertThat(request.body()).isNull();
}
示例3: getWithJavaUriUrlAbsolute
import retrofit2.http.GET; //導入依賴的package包/類
@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();
}
示例4: getWeather
import retrofit2.http.GET; //導入依賴的package包/類
@GET("forecast.json")
Observable<Weather> getWeather(
@Query("key") String key,
@Query("q") String city
);
示例5: requestCharacterInventory
import retrofit2.http.GET; //導入依賴的package包/類
@Headers("X-API-KEY: " + apiKey)
@GET("/Platform/Destiny/{membershipType}/Account/{membershipId}/Character/{characterId}/Inventory")
Call<BungieResponse<DataResponse<CharacterInventory>>> requestCharacterInventory(@Path("membershipType") int membershipType,
@Path("membershipId") String membershipId,
@Path("characterId") String characterId,
@Header("Cookie") String cookie,
@Header("X-CSRF") String xcsrf);
示例6: get
import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.scheduler.Jobs get" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}")
Observable<Response<ResponseBody>> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("jobCollectionName") String jobCollectionName, @Path("jobName") String jobName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例7: listByResourceGroupNext
import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.Namespaces listByResourceGroupNext" })
@GET
Observable<Response<ResponseBody>> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例8: torrentSearch
import retrofit2.http.GET; //導入依賴的package包/類
@GET("ajax.php?action=browse")
Single<TorrentSearch> torrentSearch(@Query("searchstr") String search);
示例9: get
import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.RecommendedElasticPools get" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}")
Observable<Response<ResponseBody>> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例10: getRelease
import retrofit2.http.GET; //導入依賴的package包/類
@NonNull @GET("repos/{owner}/{repo}/releases/{id}")
@Headers("Accept: application/vnd.github.VERSION.full+json")
Single<Release> getRelease(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id);
示例11: listMultiRolePoolSkus
import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.AppServiceEnvironments listMultiRolePoolSkus" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus")
Observable<Response<ResponseBody>> listMultiRolePoolSkus(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例12: listByResourceGroupNext
import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineScaleSets listByResourceGroupNext" })
@GET
Observable<Response<ResponseBody>> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例13: getTrendingLanguages
import retrofit2.http.GET; //導入依賴的package包/類
/**
* get trending languages, update every day
*/
@Headers("Cache-Control: public, max-age=86400")
@NonNull @GET("languages")
Observable<Response<ArrayList<TrendingLanguage>>> getTrendingLanguages();
示例14: listPremierAddOnOffers
import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.WebSiteManagementClient listPremierAddOnOffers" })
@GET("subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers")
Observable<Response<ResponseBody>> listPremierAddOnOffers(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例15: getBeforeFreshNewsPosts
import retrofit2.http.GET; //導入依賴的package包/類
@GET("/")
Observable<FreshNewsPosts> getBeforeFreshNewsPosts(@Query("oxwlxojflwblxbsapi") String api,
@Query("include") String inclue,
@Query("custom_fields") String custom_fields,
@Query("dev") int dev,
@Query("page") int page);