|
| 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 | + |
| 18 | +package com.cdancy.bitbucket.rest.features; |
| 19 | + |
| 20 | +import com.cdancy.bitbucket.rest.annotations.Documentation; |
| 21 | +import com.cdancy.bitbucket.rest.domain.build.StatusPage; |
| 22 | +import com.cdancy.bitbucket.rest.domain.build.Summary; |
| 23 | +import com.cdancy.bitbucket.rest.fallbacks.BitbucketFallbacks; |
| 24 | +import com.cdancy.bitbucket.rest.filters.BitbucketAuthentication; |
| 25 | +import org.jclouds.javax.annotation.Nullable; |
| 26 | +import org.jclouds.rest.annotations.Fallback; |
| 27 | +import org.jclouds.rest.annotations.RequestFilters; |
| 28 | + |
| 29 | +import javax.inject.Named; |
| 30 | +import javax.ws.rs.Consumes; |
| 31 | +import javax.ws.rs.GET; |
| 32 | +import javax.ws.rs.Path; |
| 33 | +import javax.ws.rs.PathParam; |
| 34 | +import javax.ws.rs.Produces; |
| 35 | +import javax.ws.rs.QueryParam; |
| 36 | +import javax.ws.rs.core.MediaType; |
| 37 | + |
| 38 | +@Produces(MediaType.APPLICATION_JSON) |
| 39 | +@RequestFilters(BitbucketAuthentication.class) |
| 40 | +@Path("/rest/build-status/{jclouds.api-version}") |
| 41 | +public interface BuildStatusApi { |
| 42 | + |
| 43 | + @Named("build:status") |
| 44 | + @Documentation({"https://developer.atlassian.com/static/rest/bitbucket-server/4.14.4/bitbucket-build-rest.html#idm44911111531152"}) |
| 45 | + @Consumes(MediaType.APPLICATION_JSON) |
| 46 | + @Path("/commits/{commitId}") |
| 47 | + @Fallback(BitbucketFallbacks.StatusPageOnError.class) |
| 48 | + @GET |
| 49 | + StatusPage status(@PathParam("commitId") String commitId, |
| 50 | + @Nullable @QueryParam("start") Integer start, |
| 51 | + @Nullable @QueryParam("limit") Integer limit); |
| 52 | + |
| 53 | + @Named("build:status-summary") |
| 54 | + @Documentation({"https://developer.atlassian.com/static/rest/bitbucket-server/4.14.4/bitbucket-build-rest.html#idm44911111484336"}) |
| 55 | + @Consumes(MediaType.APPLICATION_JSON) |
| 56 | + @Path("/commits/stats/{commitId}") |
| 57 | + @GET |
| 58 | + Summary summary(@PathParam("commitId") String commitId); |
| 59 | +} |
0 commit comments