1 package org.apache.archiva.rest.api.services;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import io.swagger.v3.oas.annotations.tags.Tag;
22 import org.apache.archiva.admin.model.beans.ManagedRepository;
23 import org.apache.archiva.maven2.model.Artifact;
24 import org.apache.archiva.maven2.model.TreeEntry;
25 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
26 import org.apache.archiva.redback.authorization.RedbackAuthorization;
27 import org.apache.archiva.rest.api.model.ActionStatus;
28 import org.apache.archiva.rest.api.model.ArtifactContent;
29 import org.apache.archiva.rest.api.model.ArtifactContentEntry;
30 import org.apache.archiva.rest.api.model.AvailabilityStatus;
31 import org.apache.archiva.rest.api.model.BrowseResult;
32 import org.apache.archiva.rest.api.model.Entry;
33 import org.apache.archiva.rest.api.model.MetadataAddRequest;
34 import org.apache.archiva.rest.api.model.VersionsList;
36 import javax.ws.rs.DELETE;
37 import javax.ws.rs.GET;
38 import javax.ws.rs.POST;
39 import javax.ws.rs.PUT;
40 import javax.ws.rs.Path;
41 import javax.ws.rs.PathParam;
42 import javax.ws.rs.Produces;
43 import javax.ws.rs.QueryParam;
44 import javax.ws.rs.core.MediaType;
45 import java.util.List;
48 * @author Olivier Lamy
51 @Path("/browseService/")
52 @Tag( name = "Browse", description = "Repository Browse Service")
53 public interface BrowseService
57 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
58 @RedbackAuthorization(noPermission = true, noRestriction = true)
59 BrowseResult getRootGroups( @QueryParam("repositoryId") String repositoryId )
60 throws ArchivaRestServiceException;
63 * @param groupId groupId to browse
64 * @param repositoryId optionnal (repository to browse if <code>null</code> all available user repositories are used)
66 @Path("browseGroupId/{groupId}")
68 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
69 @RedbackAuthorization(noPermission = true, noRestriction = true)
70 BrowseResult browseGroupId( @PathParam("groupId") String groupId, @QueryParam("repositoryId") String repositoryId )
71 throws ArchivaRestServiceException;
73 @Path("versionsList/{g}/{a}")
75 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
76 @RedbackAuthorization(noPermission = true, noRestriction = true)
77 VersionsList getVersionsList( @PathParam("g") String groupId, @PathParam("a") String artifactId,
78 @QueryParam("repositoryId") String repositoryId )
79 throws ArchivaRestServiceException;
81 @Path("projectVersionMetadata/{g}/{a}")
83 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
84 @RedbackAuthorization(noPermission = true, noRestriction = true)
85 ProjectVersionMetadata getProjectVersionMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
86 @QueryParam("repositoryId") String repositoryId )
87 throws ArchivaRestServiceException;
89 @Path("projectVersionMetadata/{g}/{a}/{v}")
91 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
92 @RedbackAuthorization(noPermission = true, noRestriction = true)
93 ProjectVersionMetadata getProjectMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
94 @PathParam("v") String version,
95 @QueryParam("repositoryId") String repositoryId )
96 throws ArchivaRestServiceException;
99 * @return List of managed repositories current user can read
101 @Path("userRepositories")
103 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
104 @RedbackAuthorization(noPermission = true, noRestriction = true)
105 List<ManagedRepository> getUserRepositories()
106 throws ArchivaRestServiceException;
109 * @return List of repositories current user can manage
111 @Path("userManagableRepositories")
113 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
114 @RedbackAuthorization(noPermission = true, noRestriction = true)
115 List<ManagedRepository> getUserManagableRepositories()
116 throws ArchivaRestServiceException;
119 * return the dependency Tree for an artifacts
120 * <b>the List result has only one entry</b>
122 @Path("treeEntries/{g}/{a}/{v}")
124 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
125 @RedbackAuthorization(noPermission = true, noRestriction = true)
126 List<TreeEntry> getTreeEntries( @PathParam("g") String groupId, @PathParam("a") String artifactId,
127 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
128 throws ArchivaRestServiceException;
131 * List of artifacts using the artifact passed in parameter.
133 @Path("dependees/{g}/{a}/{v}")
135 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
136 @RedbackAuthorization(noPermission = true, noRestriction = true)
137 List<Artifact> getDependees( @PathParam("g") String groupId, @PathParam("a") String artifactId,
138 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
139 throws ArchivaRestServiceException;
141 @Path("metadatas/{g}/{a}/{v}")
143 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
144 @RedbackAuthorization(noPermission = true, noRestriction = true)
145 List<Entry> getMetadatas( @PathParam("g") String groupId, @PathParam("a") String artifactId,
146 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
147 throws ArchivaRestServiceException;
149 @Path("metadata/{g}/{a}/{v}/{key}/{value}")
151 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
152 @RedbackAuthorization( permissions = "archiva-add-metadata", resource = "{repositoryId}")
153 ActionStatus addMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
154 @PathParam("v") String version, @PathParam("key") String key, @PathParam("value") String value,
155 @QueryParam("repositoryId") String repositoryId )
156 throws ArchivaRestServiceException;
158 @Path("metadata/{g}/{a}/{v}/{key}")
160 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
161 @RedbackAuthorization( permissions = "archiva-add-metadata", resource = "{repositoryId}")
162 ActionStatus deleteMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
163 @PathParam("v") String version, @PathParam("key") String key,
164 @QueryParam("repositoryId") String repositoryId )
165 throws ArchivaRestServiceException;
167 @Path("importMetadata")
169 @RedbackAuthorization( permissions = "archiva-add-metadata", resource = "{repository}")
170 ActionStatus importMetadata( MetadataAddRequest metadataAddRequest, @QueryParam("repository") String repository )
171 throws ArchivaRestServiceException;
173 @Path("artifactContentEntries/{g}/{a}/{v}")
175 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
176 @RedbackAuthorization(noPermission = true, noRestriction = true)
177 List<ArtifactContentEntry> getArtifactContentEntries( @PathParam("g") String groupId,
178 @PathParam("a") String artifactId,
179 @PathParam("v") String version,
180 @QueryParam("c") String classifier,
181 @QueryParam("t") String type, @QueryParam("p") String path,
182 @QueryParam("repositoryId") String repositoryId )
183 throws ArchivaRestServiceException;
185 @Path("artifactDownloadInfos/{g}/{a}/{v}")
187 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
188 @RedbackAuthorization(noPermission = true, noRestriction = true)
189 List<Artifact> getArtifactDownloadInfos( @PathParam("g") String groupId, @PathParam("a") String artifactId,
190 @PathParam("v") String version,
191 @QueryParam("repositoryId") String repositoryId )
192 throws ArchivaRestServiceException;
195 * if path is empty content of the file is returned (for pom view)
197 @Path("artifactContentText/{g}/{a}/{v}")
199 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
200 @RedbackAuthorization(noPermission = true, noRestriction = true)
201 ArtifactContent getArtifactContentText( @PathParam("g") String groupId, @PathParam("a") String artifactId,
202 @PathParam("v") String version, @QueryParam("c") String classifier,
203 @QueryParam("t") String type, @QueryParam("p") String path,
204 @QueryParam("repositoryId") String repositoryId )
205 throws ArchivaRestServiceException;
208 * verify if an artifact is available locally if not download from proxies will be try
212 @Path("artifactAvailable/{g}/{a}/{v}")
214 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
215 @RedbackAuthorization(noPermission = true, noRestriction = true)
216 AvailabilityStatus artifactAvailable( @PathParam("g") String groupId, @PathParam("a") String artifactId,
217 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
218 throws ArchivaRestServiceException;
221 * verify if an artifact is available locally if not download from proxies will be try
225 @Path( "artifactAvailable/{g}/{a}/{v}/{c}" )
227 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
228 @RedbackAuthorization( noPermission = true, noRestriction = true )
229 AvailabilityStatus artifactAvailable( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
230 @PathParam( "v" ) String version, @PathParam( "c" ) String classifier,
231 @QueryParam( "repositoryId" ) String repositoryId )
232 throws ArchivaRestServiceException;
235 * return List of all artifacts from this repository
237 * @param repositoryId
239 * @throws ArchivaRestServiceException
242 @Path("artifacts/{r}")
244 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
245 @RedbackAuthorization(noPermission = true, noRestriction = true)
246 List<Artifact> getArtifacts( @PathParam("r") String repositoryId )
247 throws ArchivaRestServiceException;
250 * Return List of artifacts from this repository with project version level metadata key matching value. If
251 * repository is not provided the search runs in all repositories.
255 * @param repositoryId
257 * @throws ArchivaRestServiceException
260 @Path( "artifactsByProjectVersionMetadata/{key}/{value}" )
262 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
263 @RedbackAuthorization( noPermission = true, noRestriction = true )
264 List<Artifact> getArtifactsByProjectVersionMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
265 @QueryParam("repositoryId") String repositoryId )
266 throws ArchivaRestServiceException;
269 * Return List of artifacts from this repository with artifact metadata key matching value.
270 * If repository is not provided the search runs in all repositories.
274 * @param repositoryId
276 * @throws ArchivaRestServiceException
279 @Path( "artifactsByMetadata/{key}/{value}" )
281 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
282 @RedbackAuthorization( noPermission = true, noRestriction = true )
283 List<Artifact> getArtifactsByMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
284 @QueryParam("repositoryId") String repositoryId )
285 throws ArchivaRestServiceException;
288 * Return List of artifacts from this repository with property key matching value.
289 * If repository is not provided the search runs in all repositories.
293 * @param repositoryId
295 * @throws ArchivaRestServiceException
298 @Path( "artifactsByProperty/{key}/{value}" )
300 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
301 @RedbackAuthorization( noPermission = true, noRestriction = true )
302 List<Artifact> getArtifactsByProperty( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
303 @QueryParam("repositoryId") String repositoryId )
304 throws ArchivaRestServiceException;
307 * Search artifacts with any property matching text. If repository is not provided the search runs in all
308 * repositories. If exact is true only the artifacts whose property match exactly are returned.
311 * @param repositoryId
314 * @throws ArchivaRestServiceException
317 @Path( "searchArtifacts/{text}" )
319 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
320 @RedbackAuthorization( noPermission = true, noRestriction = true )
321 List<Artifact> searchArtifacts( @PathParam( "text" ) String text,
322 @QueryParam( "repositoryId" ) String repositoryId,
323 @QueryParam( "exact" ) Boolean exact )
324 throws ArchivaRestServiceException;
327 * Search artifacts with the property specified by key matching text. If repository is not provided the search runs
328 * in all repositories. If exact is true only the artifacts whose property match exactly are returned.
332 * @param repositoryId
335 * @throws ArchivaRestServiceException
338 @Path( "searchArtifacts/{key}/{text}" )
340 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
341 @RedbackAuthorization( noPermission = true, noRestriction = true )
342 List<Artifact> searchArtifacts( @PathParam( "key" ) String key, @PathParam( "text" ) String text,
343 @QueryParam( "repositoryId" ) String repositoryId,
344 @QueryParam( "exact" ) Boolean exact )
345 throws ArchivaRestServiceException;