Java Code Examples for retrofit2.http.DELETE

The following are top voted examples for showing how to use retrofit2.http.DELETE. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Endpoint2mock2   File: MockAnnotationProccessor.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 2
Project: GitHub   File: ServiceMethod.java   Source Code and License 5 votes vote down vote up
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;
  }
}
 
Example 3
Project: GitHub   File: RequestBuilderTest.java   Source Code and License 5 votes vote down vote up
@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());
}
 
Example 4
Project: GitHub   File: RequestBuilderTest.java   Source Code and License 5 votes vote down vote up
@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");
}
 
Example 5
Project: GitHub   File: ServiceMethod.java   Source Code and License 5 votes vote down vote up
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;
  }
}
 
Example 6
Project: GitHub   File: RequestBuilderTest.java   Source Code and License 5 votes vote down vote up
@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());
}
 
Example 7
Project: DiscogsBrowser   File: DiscogsService.java   Source Code and License 4 votes vote down vote up
@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);
 
Example 8
Project: DiscogsBrowser   File: DiscogsService.java   Source Code and License 4 votes vote down vote up
@DELETE("/users/{username}/wants/{release_id}")
Single<Response<Void>> removeFromWantlist(@Path("username") String username, @Path("release_id") String releaseId);
 
Example 9
Project: yyox   File: AddressService.java   Source Code and License 4 votes vote down vote up
@Headers({HEADER_API_VERSION})
@DELETE("customer/address")
Observable<BaseJson<String>> deleteAddress(@Query("id") int id);
 
Example 10
Project: TOSCAna   File: TOSCAnaAPIService.java   Source Code and License 4 votes vote down vote up
@DELETE("/api/csars/{csarName}/delete")
Call<ResponseBody> deleteCsar(
    @Path("csarName") String name
);
 
Example 11
Project: TOSCAna   File: TOSCAnaAPIService.java   Source Code and License 4 votes vote down vote up
@DELETE("/api/csars/{csarName}/transformations/{platform}/delete")
Call<ResponseBody> deleteTransformation(
    @Path("csarName") String csarName,
    @Path("platform") String platform
);
 
Example 12
Project: Protein   File: ShotsService.java   Source Code and License 4 votes vote down vote up
@DELETE("/v1/shots/{shot_id}/like")
Observable<Response<ShotLike>> unlikeShot(@Path("shot_id") long shotId);
 
Example 13
Project: Protein   File: UserService.java   Source Code and License 4 votes vote down vote up
@DELETE("/v1/users/{user_id}/follow")
Observable<Response<Body>> unfollow(@Path("user_id") long userId);
 
Example 14
Project: filestack-java   File: BaseService.java   Source Code and License 4 votes vote down vote up
@DELETE("{handle}")
Call<ResponseBody> delete(
    @Path("handle") String handle,
    @Query("key") String key,
    @Query("policy") String policy,
    @Query("signature") String signature);
 
Example 15
Project: garras   File: PixelsApis.java   Source Code and License 4 votes vote down vote up
@DELETE("photos/{id}/like")
Flowable<Response<LikeResult>> unlike(@Path("id") String id);
 
Example 16
Project: garras   File: PixelsApis.java   Source Code and License 4 votes vote down vote up
@DELETE("collections/{id}")
Flowable<DeleteCollectionResult> deleteCollection(@Path("id") int id);
 
Example 17
Project: garras   File: PixelsApis.java   Source Code and License 4 votes vote down vote up
@DELETE("collections/{collection_id}/remove")
Flowable<ChangeCollectionPhotoResult> deletePhotoFromCollection(@Path("collection_id") int collection_id,
                                                                @Query("photo_id") String photo_id);
 
Example 18
Project: XSnow   File: ApiService.java   Source Code and License 4 votes vote down vote up
@FormUrlEncoded
@DELETE()
Observable<ResponseBody> delete(@Url() String url, @FieldMap Map<String, String> maps);
 
Example 19
Project: AndroidBasicLibs   File: ApiService.java   Source Code and License 4 votes vote down vote up
@DELETE()
Observable<ResponseBody> delete(@Url() String url, @QueryMap Map<String, String> maps);
 
Example 20
Project: RxEasyHttp   File: ApiService.java   Source Code and License 4 votes vote down vote up
@DELETE()
Observable<ResponseBody> delete(@Url String url, @QueryMap Map<String, String> maps);
 
Example 21
Project: GxIconDIY   File: NanoServerService.java   Source Code and License 4 votes vote down vote up
/**
 * { "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);
 
Example 22
Project: Concierge   File: StorageClient.java   Source Code and License 4 votes vote down vote up
@DELETE("keys/{key}")
Call<Boolean> delete(@Path("key") String key,
                     @Query("session") long session,
                     @Query("version") long version);
 
Example 23
Project: GxIconAndroid   File: NanoServerService.java   Source Code and License 4 votes vote down vote up
/**
 * { "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);
 
Example 24
Project: kong-java-client   File: RetrofitOAuth2ManageService.java   Source Code and License 4 votes vote down vote up
@DELETE("/consumers/{consumer_id}/oauth2/{id}")
Call<Void> deleteConsumerApplication(@Path("consumer_id") String consumerId, @Path("id") String applicationId);
 
Example 25
Project: kong-java-client   File: RetrofitOAuth2ManageService.java   Source Code and License 4 votes vote down vote up
@DELETE("/oauth2_tokens/{id}")
Call<Token> deleteToken(@Path("id") String tokenId);
 
Example 26
Project: kong-java-client   File: RetrofitApiPluginService.java   Source Code and License 4 votes vote down vote up
@DELETE("/apis/{api}/plugins/{id}")
Call<Void> deletePluginForApi(@Path("api") String apiNameOrId, @Path("id") String pluginNameOrId);
 
Example 27
Project: GHCli   File: IGitHubUser.java   Source Code and License 4 votes vote down vote up
@DELETE("user/following/{user}")
Call<Void> unfollow(@Header("Authorization") String credentials, @Path("user") String user);
 
Example 28
Project: FastEc   File: RestService.java   Source Code and License 4 votes vote down vote up
@DELETE
Call<String> delete(@Url String url, @QueryMap Map<String, Object> params);
 
Example 29
Project: azure-libraries-for-java   File: FunctionAppImpl.java   Source Code and License 4 votes vote down vote up
@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);
 
Example 30
Project: projectindoorapp   File: ProjectRestClient.java   Source Code and License 4 votes vote down vote up
@DELETE("project/deleteSelectedProject/")
public Call<Position> deleteSelectedProject(@Query("projectIdentifier") int projectIdentifier);
 
Example 31
Project: anitrend-app   File: UserListModel.java   Source Code and License 4 votes vote down vote up
@DELETE("animelist/{anime_id}")
Call<Object> deleteAnime(@Path("anime_id") int id);
 
Example 32
Project: anitrend-app   File: UserListModel.java   Source Code and License 4 votes vote down vote up
@DELETE("mangalist/{manga_id}")
Call<Object> deleteManga(@Path("manga_id") int id);
 
Example 33
Project: lecrec-android   File: RecordService.java   Source Code and License 4 votes vote down vote up
@DELETE("records/{record_id}")
Call<Void> deleteRecord(@Header("Authorization") String token, @Path("record_id") String id);
 
Example 34
Project: AvenueNet   File: ClientService.java   Source Code and License 4 votes vote down vote up
@DELETE
Observable<String> delete(@Url String url, @QueryMap Map<String, Object> params, @HeaderMap Map<String, Object> header);
 
Example 35
Project: mvvm-template   File: RepoService.java   Source Code and License 4 votes vote down vote up
@NonNull @DELETE("repos/{login}/{repoId}")
Single<Response<Boolean>> deleteRepo(@Path("login") String login, @Path("repoId") String repoId);
 
Example 36
Project: mvvm-template   File: RepoService.java   Source Code and License 4 votes vote down vote up
@NonNull @DELETE("user/starred/{owner}/{repo}")
Single<Response<Boolean>> unstarRepo(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId);
 
Example 37
Project: mvvm-template   File: RepoService.java   Source Code and License 4 votes vote down vote up
@NonNull @DELETE("user/subscriptions/{owner}/{repo}")
Single<Response<Boolean>> unwatchRepo(@Path("owner") String owner, @Path("repo") String repo);
 
Example 38
Project: mvvm-template   File: RepoService.java   Source Code and License 4 votes vote down vote up
@NonNull @DELETE("repos/{owner}/{repo}/comments/{id}")
Single<Response<Boolean>> deleteComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id);
 
Example 39
Project: mvvm-template   File: UserRestService.java   Source Code and License 4 votes vote down vote up
@DELETE("user/following/{username}")
Single<Response<Boolean>> unfollowUser(@Path("username") @NonNull String username);
 
Example 40
Project: mvvm-template   File: IssueService.java   Source Code and License 4 votes vote down vote up
@DELETE("repos/{owner}/{repo}/issues/{number}/lock")
Single<Response<Boolean>> unlockIssue(@Path("owner") String owner, @Path("repo") String repo, @Path("number") int number);