/src/main/java/com/cdancy/bitbucket/rest/features/DefaultReviewersApi.java

https://github.com/cdancy/bitbucket-rest · Java · 91 lines · 66 code · 9 blank · 16 comment · 0 complexity · 80f0b04c9baa2ec65e81175ab353bc90 MD5 · raw file

  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package com.cdancy.bitbucket.rest.features;
  18. import com.cdancy.bitbucket.rest.annotations.Documentation;
  19. import com.cdancy.bitbucket.rest.domain.common.RequestStatus;
  20. import com.cdancy.bitbucket.rest.domain.defaultreviewers.Condition;
  21. import com.cdancy.bitbucket.rest.fallbacks.BitbucketFallbacks;
  22. import com.cdancy.bitbucket.rest.filters.BitbucketAuthenticationFilter;
  23. import com.cdancy.bitbucket.rest.options.CreateCondition;
  24. import com.cdancy.bitbucket.rest.parsers.RequestStatusParser;
  25. import org.jclouds.rest.annotations.BinderParam;
  26. import org.jclouds.rest.annotations.Fallback;
  27. import org.jclouds.rest.annotations.RequestFilters;
  28. import org.jclouds.rest.binders.BindToJsonPayload;
  29. import javax.ws.rs.Consumes;
  30. import javax.ws.rs.DELETE;
  31. import javax.ws.rs.GET;
  32. import javax.ws.rs.POST;
  33. import javax.ws.rs.PUT;
  34. import javax.ws.rs.Path;
  35. import javax.ws.rs.PathParam;
  36. import javax.ws.rs.Produces;
  37. import javax.ws.rs.core.MediaType;
  38. import javax.inject.Named;
  39. import java.util.List;
  40. import org.jclouds.rest.annotations.ResponseParser;
  41. @Produces(MediaType.APPLICATION_JSON)
  42. @RequestFilters(BitbucketAuthenticationFilter.class)
  43. @Path("/rest/default-reviewers/{jclouds.api-version}/projects")
  44. @SuppressWarnings("PMD.AvoidDuplicateLiterals")
  45. public interface DefaultReviewersApi {
  46. @Named("default-reviewers:list-conditions")
  47. @Documentation({"https://developer.atlassian.com/static/rest/bitbucket-server/latest/bitbucket-default-reviewers-rest.html#idm46188393150720"})
  48. @Consumes(MediaType.APPLICATION_JSON)
  49. @Path("/{project}/repos/{repo}/conditions")
  50. @GET
  51. List<Condition> listConditions(@PathParam("project") String project,
  52. @PathParam("repo") String repo);
  53. @Named("default-reviewers:create-condition")
  54. @Documentation({"https://developer.atlassian.com/static/rest/bitbucket-server/latest/bitbucket-default-reviewers-rest.html#idm46188393242752"})
  55. @Consumes(MediaType.APPLICATION_JSON)
  56. @Path("/{project}/repos/{repo}/condition")
  57. @Fallback(BitbucketFallbacks.ConditionOnError.class)
  58. @POST
  59. Condition createCondition(@PathParam("project") String project,
  60. @PathParam("repo") String repo,
  61. @BinderParam(BindToJsonPayload.class) CreateCondition condition);
  62. @Named("default-reviewers:update-condition")
  63. @Documentation({"https://developer.atlassian.com/static/rest/bitbucket-server/latest/bitbucket-default-reviewers-rest.html#idm46188393163680"})
  64. @Consumes(MediaType.APPLICATION_JSON)
  65. @Path("/{project}/repos/{repo}/condition/{id}")
  66. @Fallback(BitbucketFallbacks.ConditionOnError.class)
  67. @PUT
  68. Condition updateCondition(@PathParam("project") String project,
  69. @PathParam("repo") String repo,
  70. @PathParam("id") long id,
  71. @BinderParam(BindToJsonPayload.class) CreateCondition condition);
  72. @Named("default-reviewers:delete-condition")
  73. @Documentation({"https://developer.atlassian.com/static/rest/bitbucket-server/latest/bitbucket-default-reviewers-rest.html#idm46188393163680"})
  74. @Consumes(MediaType.APPLICATION_JSON)
  75. @Path("/{project}/repos/{repo}/condition/{id}")
  76. @Fallback(BitbucketFallbacks.RequestStatusOnError.class)
  77. @ResponseParser(RequestStatusParser.class)
  78. @DELETE
  79. RequestStatus deleteCondition(@PathParam("project") String project,
  80. @PathParam("repo") String repo,
  81. @PathParam("id") long id);
  82. }