Java 类retrofit2.http.DELETE 实例源码

项目:Endpoint2mock2    文件:MockAnnotationProccessor.java   
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();
}
项目:GitHub    文件:ServiceMethod.java   
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;
  }
}
项目:GitHub    文件:RequestBuilderTest.java   
@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());
}
项目:GitHub    文件:RequestBuilderTest.java   
@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");
}
项目:GitHub    文件:ServiceMethod.java   
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;
  }
}
项目:GitHub    文件:RequestBuilderTest.java   
@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());
}
项目:DiscogsBrowser    文件:DiscogsService.java   
@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);
项目:DiscogsBrowser    文件:DiscogsService.java   
@DELETE("/users/{username}/wants/{release_id}")
Single<Response<Void>> removeFromWantlist(@Path("username") String username, @Path("release_id") String releaseId);
项目:yyox    文件:AddressService.java   
@Headers({HEADER_API_VERSION})
@DELETE("customer/address")
Observable<BaseJson<String>> deleteAddress(@Query("id") int id);
项目:TOSCAna    文件:TOSCAnaAPIService.java   
@DELETE("/api/csars/{csarName}/delete")
Call<ResponseBody> deleteCsar(
    @Path("csarName") String name
);
项目:TOSCAna    文件:TOSCAnaAPIService.java   
@DELETE("/api/csars/{csarName}/transformations/{platform}/delete")
Call<ResponseBody> deleteTransformation(
    @Path("csarName") String csarName,
    @Path("platform") String platform
);
项目:Protein    文件:ShotsService.java   
@DELETE("/v1/shots/{shot_id}/like")
Observable<Response<ShotLike>> unlikeShot(@Path("shot_id") long shotId);
项目:Protein    文件:UserService.java   
@DELETE("/v1/users/{user_id}/follow")
Observable<Response<Body>> unfollow(@Path("user_id") long userId);
项目:filestack-java    文件:BaseService.java   
@DELETE("{handle}")
Call<ResponseBody> delete(
    @Path("handle") String handle,
    @Query("key") String key,
    @Query("policy") String policy,
    @Query("signature") String signature);
项目:garras    文件:PixelsApis.java   
@DELETE("photos/{id}/like")
Flowable<Response<LikeResult>> unlike(@Path("id") String id);
项目:garras    文件:PixelsApis.java   
@DELETE("collections/{id}")
Flowable<DeleteCollectionResult> deleteCollection(@Path("id") int id);
项目:garras    文件:PixelsApis.java   
@DELETE("collections/{collection_id}/remove")
Flowable<ChangeCollectionPhotoResult> deletePhotoFromCollection(@Path("collection_id") int collection_id,
                                                                @Query("photo_id") String photo_id);
项目:XSnow    文件:ApiService.java   
@FormUrlEncoded
@DELETE()
Observable<ResponseBody> delete(@Url() String url, @FieldMap Map<String, String> maps);
项目:AndroidBasicLibs    文件:ApiService.java   
@DELETE()
Observable<ResponseBody> delete(@Url() String url, @QueryMap Map<String, String> maps);
项目:RxEasyHttp    文件:ApiService.java   
@DELETE()
Observable<ResponseBody> delete(@Url String url, @QueryMap Map<String, String> maps);
项目:GxIconDIY    文件:NanoServerService.java   
/**
 * { "status": 0, "msg": "success" }
 */
@DELETE("reqfilter/{iconpack}/{user}")
Call<ResResBean> undoFilterPkg(@Path("iconpack") String iconPack,
                               @Path("user") String user,
                               @Query("pkg") String pkgName,
                               @Query("launcher") String launcherActivity);
项目:Concierge    文件:StorageClient.java   
@DELETE("keys/{key}")
Call<Boolean> delete(@Path("key") String key,
                     @Query("session") long session,
                     @Query("version") long version);
项目:GxIconAndroid    文件:NanoServerService.java   
/**
 * { "status": 0, "msg": "success" }
 */
@DELETE("reqfilter/{iconpack}/{user}")
Call<ResResBean> undoFilterPkg(@Path("iconpack") String iconPack,
                               @Path("user") String user,
                               @Query("pkg") String pkgName,
                               @Query("launcher") String launcherActivity);
项目:kong-java-client    文件:RetrofitOAuth2ManageService.java   
@DELETE("/consumers/{consumer_id}/oauth2/{id}")
Call<Void> deleteConsumerApplication(@Path("consumer_id") String consumerId, @Path("id") String applicationId);
项目:kong-java-client    文件:RetrofitOAuth2ManageService.java   
@DELETE("/oauth2_tokens/{id}")
Call<Token> deleteToken(@Path("id") String tokenId);
项目:kong-java-client    文件:RetrofitApiPluginService.java   
@DELETE("/apis/{api}/plugins/{id}")
Call<Void> deletePluginForApi(@Path("api") String apiNameOrId, @Path("id") String pluginNameOrId);
项目:GHCli    文件:IGitHubUser.java   
@DELETE("user/following/{user}")
Call<Void> unfollow(@Header("Authorization") String credentials, @Path("user") String user);
项目:FastEc    文件:RestService.java   
@DELETE
Call<String> delete(@Url String url, @QueryMap Map<String, Object> params);
项目:azure-libraries-for-java    文件:FunctionAppImpl.java   
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.WebApps deleteFunctionKey" })
@DELETE("admin/functions/{name}/keys/{keyName}")
Observable<Void> deleteFunctionKey(@Path("name") String functionName, @Path("keyName") String keyName);
项目:projectindoorapp    文件:ProjectRestClient.java   
@DELETE("project/deleteSelectedProject/")
public Call<Position> deleteSelectedProject(@Query("projectIdentifier") int projectIdentifier);
项目:anitrend-app    文件:UserListModel.java   
@DELETE("animelist/{anime_id}")
Call<Object> deleteAnime(@Path("anime_id") int id);
项目:anitrend-app    文件:UserListModel.java   
@DELETE("mangalist/{manga_id}")
Call<Object> deleteManga(@Path("manga_id") int id);
项目:lecrec-android    文件:RecordService.java   
@DELETE("records/{record_id}")
Call<Void> deleteRecord(@Header("Authorization") String token, @Path("record_id") String id);
项目:AvenueNet    文件:ClientService.java   
@DELETE
Observable<String> delete(@Url String url, @QueryMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
项目:mvvm-template    文件:RepoService.java   
@NonNull @DELETE("repos/{login}/{repoId}")
Single<Response<Boolean>> deleteRepo(@Path("login") String login, @Path("repoId") String repoId);
项目:mvvm-template    文件:RepoService.java   
@NonNull @DELETE("user/starred/{owner}/{repo}")
Single<Response<Boolean>> unstarRepo(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId);
项目:mvvm-template    文件:RepoService.java   
@NonNull @DELETE("user/subscriptions/{owner}/{repo}")
Single<Response<Boolean>> unwatchRepo(@Path("owner") String owner, @Path("repo") String repo);
项目:mvvm-template    文件:RepoService.java   
@NonNull @DELETE("repos/{owner}/{repo}/comments/{id}")
Single<Response<Boolean>> deleteComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id);
项目:mvvm-template    文件:UserRestService.java   
@DELETE("user/following/{username}")
Single<Response<Boolean>> unfollowUser(@Path("username") @NonNull String username);
项目:mvvm-template    文件:IssueService.java   
@DELETE("repos/{owner}/{repo}/issues/{number}/lock")
Single<Response<Boolean>> unlockIssue(@Path("owner") String owner, @Path("repo") String repo, @Path("number") int number);