本文整理汇总了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);