本文整理汇总了Java中retrofit2.http.DELETE类的典型用法代码示例。如果您正苦于以下问题:Java DELETE类的具体用法?Java DELETE怎么用?Java DELETE使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DELETE类属于retrofit2.http包,在下文中一共展示了DELETE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractPath
import retrofit2.http.DELETE; //导入依赖的package包/类
private static String extractPath(Element element) throws NoAnnotationException {
GET getAnnotation = element.getAnnotation(GET.class);
if (getAnnotation != null) {
return getAnnotation.value();
}
POST postAnnotation = element.getAnnotation(POST.class);
if (postAnnotation != null) {
return postAnnotation.value();
}
DELETE deleteAnnotation = element.getAnnotation(DELETE.class);
if (deleteAnnotation != null) {
return deleteAnnotation.value();
}
PUT putAnnotation = element.getAnnotation(PUT.class);
if (putAnnotation != null) {
return putAnnotation.value();
}
throw new NoAnnotationException();
}
示例2: parseMethodAnnotation
import retrofit2.http.DELETE; //导入依赖的package包/类
private void parseMethodAnnotation(Annotation annotation) {
if (annotation instanceof DELETE) {
parseHttpMethodAndPath("DELETE", ((DELETE) annotation).value(), false);
} else if (annotation instanceof GET) {
parseHttpMethodAndPath("GET", ((GET) annotation).value(), false);
} else if (annotation instanceof HEAD) {
parseHttpMethodAndPath("HEAD", ((HEAD) annotation).value(), false);
if (!Void.class.equals(responseType)) {
throw methodError("HEAD method must use Void as response type.");
}
} else if (annotation instanceof PATCH) {
parseHttpMethodAndPath("PATCH", ((PATCH) annotation).value(), true);
} else if (annotation instanceof POST) {
parseHttpMethodAndPath("POST", ((POST) annotation).value(), true);
} else if (annotation instanceof PUT) {
parseHttpMethodAndPath("PUT", ((PUT) annotation).value(), true);
} else if (annotation instanceof OPTIONS) {
parseHttpMethodAndPath("OPTIONS", ((OPTIONS) annotation).value(), false);
} else if (annotation instanceof HTTP) {
HTTP http = (HTTP) annotation;
parseHttpMethodAndPath(http.method(), http.path(), http.hasBody());
} else if (annotation instanceof retrofit2.http.Headers) {
String[] headersToParse = ((retrofit2.http.Headers) annotation).value();
if (headersToParse.length == 0) {
throw methodError("@Headers annotation is empty.");
}
headers = parseHeaders(headersToParse);
} else if (annotation instanceof Multipart) {
if (isFormEncoded) {
throw methodError("Only one encoding annotation is allowed.");
}
isMultipart = true;
} else if (annotation instanceof FormUrlEncoded) {
if (isMultipart) {
throw methodError("Only one encoding annotation is allowed.");
}
isFormEncoded = true;
}
}
示例3: delete
import retrofit2.http.DELETE; //导入依赖的package包/类
@Test public void delete() {
class Example {
@DELETE("/foo/bar/") //
Call<ResponseBody> method() {
return null;
}
}
Request request = buildRequest(Example.class);
assertThat(request.method()).isEqualTo("DELETE");
assertThat(request.headers().size()).isZero();
assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/");
assertNull(request.body());
}
示例4: contentTypeAnnotationHeaderAddsHeaderWithNoBody
import retrofit2.http.DELETE; //导入依赖的package包/类
@Test public void contentTypeAnnotationHeaderAddsHeaderWithNoBody() {
class Example {
@DELETE("/") //
@Headers("Content-Type: text/not-plain") //
Call<ResponseBody> method() {
return null;
}
}
Request request = buildRequest(Example.class);
assertThat(request.headers().get("Content-Type")).isEqualTo("text/not-plain");
}
示例5: removeFromCollection
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("/users/{username}/collection/folders/1/releases/{release_id}/instances/{instance_id}")
Single<Response<Void>> removeFromCollection(@Path("username") String username, @Path("release_id") String releaseId, @Path("instance_id") String instanceId);
示例6: removeFromWantlist
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("/users/{username}/wants/{release_id}")
Single<Response<Void>> removeFromWantlist(@Path("username") String username, @Path("release_id") String releaseId);
示例7: deleteAddress
import retrofit2.http.DELETE; //导入依赖的package包/类
@Headers({HEADER_API_VERSION})
@DELETE("customer/address")
Observable<BaseJson<String>> deleteAddress(@Query("id") int id);
示例8: deleteCsar
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("/api/csars/{csarName}/delete")
Call<ResponseBody> deleteCsar(
@Path("csarName") String name
);
示例9: deleteTransformation
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("/api/csars/{csarName}/transformations/{platform}/delete")
Call<ResponseBody> deleteTransformation(
@Path("csarName") String csarName,
@Path("platform") String platform
);
示例10: unlikeShot
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("/v1/shots/{shot_id}/like")
Observable<Response<ShotLike>> unlikeShot(@Path("shot_id") long shotId);
示例11: unfollow
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("/v1/users/{user_id}/follow")
Observable<Response<Body>> unfollow(@Path("user_id") long userId);
示例12: delete
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("{handle}")
Call<ResponseBody> delete(
@Path("handle") String handle,
@Query("key") String key,
@Query("policy") String policy,
@Query("signature") String signature);
示例13: unlike
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("photos/{id}/like")
Flowable<Response<LikeResult>> unlike(@Path("id") String id);
示例14: deleteCollection
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("collections/{id}")
Flowable<DeleteCollectionResult> deleteCollection(@Path("id") int id);
示例15: deletePhotoFromCollection
import retrofit2.http.DELETE; //导入依赖的package包/类
@DELETE("collections/{collection_id}/remove")
Flowable<ChangeCollectionPhotoResult> deletePhotoFromCollection(@Path("collection_id") int collection_id,
@Query("photo_id") String photo_id);