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.ArtifactContent;
28 import org.apache.archiva.rest.api.model.ArtifactContentEntry;
29 import org.apache.archiva.rest.api.model.BrowseResult;
30 import org.apache.archiva.rest.api.model.Entry;
31 import org.apache.archiva.rest.api.model.MetadataAddRequest;
32 import org.apache.archiva.rest.api.model.VersionsList;
34 import javax.ws.rs.DELETE;
35 import javax.ws.rs.GET;
36 import javax.ws.rs.POST;
37 import javax.ws.rs.PUT;
38 import javax.ws.rs.Path;
39 import javax.ws.rs.PathParam;
40 import javax.ws.rs.Produces;
41 import javax.ws.rs.QueryParam;
42 import javax.ws.rs.core.MediaType;
43 import java.util.List;
46 * @author Olivier Lamy
49 @Path("/browseService/")
50 @Tag( name = "Browse", description = "Repository Browse Service")
51 public interface BrowseService
55 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
56 @RedbackAuthorization(noPermission = true, noRestriction = true)
57 BrowseResult getRootGroups( @QueryParam("repositoryId") String repositoryId )
58 throws ArchivaRestServiceException;
61 * @param groupId groupId to browse
62 * @param repositoryId optionnal (repository to browse if <code>null</code> all available user repositories are used)
64 @Path("browseGroupId/{groupId}")
66 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
67 @RedbackAuthorization(noPermission = true, noRestriction = true)
68 BrowseResult browseGroupId( @PathParam("groupId") String groupId, @QueryParam("repositoryId") String repositoryId )
69 throws ArchivaRestServiceException;
71 @Path("versionsList/{g}/{a}")
73 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
74 @RedbackAuthorization(noPermission = true, noRestriction = true)
75 VersionsList getVersionsList( @PathParam("g") String groupId, @PathParam("a") String artifactId,
76 @QueryParam("repositoryId") String repositoryId )
77 throws ArchivaRestServiceException;
79 @Path("projectVersionMetadata/{g}/{a}")
81 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
82 @RedbackAuthorization(noPermission = true, noRestriction = true)
83 ProjectVersionMetadata getProjectVersionMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
84 @QueryParam("repositoryId") String repositoryId )
85 throws ArchivaRestServiceException;
87 @Path("projectVersionMetadata/{g}/{a}/{v}")
89 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
90 @RedbackAuthorization(noPermission = true, noRestriction = true)
91 ProjectVersionMetadata getProjectMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
92 @PathParam("v") String version,
93 @QueryParam("repositoryId") String repositoryId )
94 throws ArchivaRestServiceException;
97 * @return List of managed repositories current user can read
99 @Path("userRepositories")
101 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
102 @RedbackAuthorization(noPermission = true, noRestriction = true)
103 List<ManagedRepository> getUserRepositories()
104 throws ArchivaRestServiceException;
107 * @return List of repositories current user can manage
109 @Path("userManagableRepositories")
111 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
112 @RedbackAuthorization(noPermission = true, noRestriction = true)
113 List<ManagedRepository> getUserManagableRepositories()
114 throws ArchivaRestServiceException;
117 * return the dependency Tree for an artifacts
118 * <b>the List result has only one entry</b>
120 @Path("treeEntries/{g}/{a}/{v}")
122 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
123 @RedbackAuthorization(noPermission = true, noRestriction = true)
124 List<TreeEntry> getTreeEntries( @PathParam("g") String groupId, @PathParam("a") String artifactId,
125 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
126 throws ArchivaRestServiceException;
129 * List of artifacts using the artifact passed in parameter.
131 @Path("dependees/{g}/{a}/{v}")
133 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
134 @RedbackAuthorization(noPermission = true, noRestriction = true)
135 List<Artifact> getDependees( @PathParam("g") String groupId, @PathParam("a") String artifactId,
136 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
137 throws ArchivaRestServiceException;
139 @Path("metadatas/{g}/{a}/{v}")
141 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
142 @RedbackAuthorization(noPermission = true, noRestriction = true)
143 List<Entry> getMetadatas( @PathParam("g") String groupId, @PathParam("a") String artifactId,
144 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
145 throws ArchivaRestServiceException;
147 @Path("metadata/{g}/{a}/{v}/{key}/{value}")
149 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
150 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
151 Boolean addMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
152 @PathParam("v") String version, @PathParam("key") String key, @PathParam("value") String value,
153 @QueryParam("repositoryId") String repositoryId )
154 throws ArchivaRestServiceException;
156 @Path("metadata/{g}/{a}/{v}/{key}")
158 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
159 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
160 Boolean deleteMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
161 @PathParam("v") String version, @PathParam("key") String key,
162 @QueryParam("repositoryId") String repositoryId )
163 throws ArchivaRestServiceException;
165 @Path("importMetadata")
167 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
168 Boolean importMetadata( MetadataAddRequest metadataAddRequest, @QueryParam("repository") String repository )
169 throws ArchivaRestServiceException;
171 @Path("artifactContentEntries/{g}/{a}/{v}")
173 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
174 @RedbackAuthorization(noPermission = true, noRestriction = true)
175 List<ArtifactContentEntry> getArtifactContentEntries( @PathParam("g") String groupId,
176 @PathParam("a") String artifactId,
177 @PathParam("v") String version,
178 @QueryParam("c") String classifier,
179 @QueryParam("t") String type, @QueryParam("p") String path,
180 @QueryParam("repositoryId") String repositoryId )
181 throws ArchivaRestServiceException;
183 @Path("artifactDownloadInfos/{g}/{a}/{v}")
185 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
186 @RedbackAuthorization(noPermission = true, noRestriction = true)
187 List<Artifact> getArtifactDownloadInfos( @PathParam("g") String groupId, @PathParam("a") String artifactId,
188 @PathParam("v") String version,
189 @QueryParam("repositoryId") String repositoryId )
190 throws ArchivaRestServiceException;
193 * if path is empty content of the file is returned (for pom view)
195 @Path("artifactContentText/{g}/{a}/{v}")
197 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
198 @RedbackAuthorization(noPermission = true, noRestriction = true)
199 ArtifactContent getArtifactContentText( @PathParam("g") String groupId, @PathParam("a") String artifactId,
200 @PathParam("v") String version, @QueryParam("c") String classifier,
201 @QueryParam("t") String type, @QueryParam("p") String path,
202 @QueryParam("repositoryId") String repositoryId )
203 throws ArchivaRestServiceException;
206 * verify if an artifact is available locally if not download from proxies will be try
210 @Path("artifactAvailable/{g}/{a}/{v}")
212 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
213 @RedbackAuthorization(noPermission = true, noRestriction = true)
214 Boolean artifactAvailable( @PathParam("g") String groupId, @PathParam("a") String artifactId,
215 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
216 throws ArchivaRestServiceException;
219 * verify if an artifact is available locally if not download from proxies will be try
223 @Path( "artifactAvailable/{g}/{a}/{v}/{c}" )
225 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
226 @RedbackAuthorization( noPermission = true, noRestriction = true )
227 Boolean artifactAvailable( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
228 @PathParam( "v" ) String version, @PathParam( "c" ) String classifier,
229 @QueryParam( "repositoryId" ) String repositoryId )
230 throws ArchivaRestServiceException;
233 * return List of all artifacts from this repository
235 * @param repositoryId
237 * @throws ArchivaRestServiceException
240 @Path("artifacts/{r}")
242 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
243 @RedbackAuthorization(noPermission = true, noRestriction = true)
244 List<Artifact> getArtifacts( @PathParam("r") String repositoryId )
245 throws ArchivaRestServiceException;
248 * Return List of artifacts from this repository with project version level metadata key matching value. If
249 * repository is not provided the search runs in all repositories.
253 * @param repositoryId
255 * @throws ArchivaRestServiceException
258 @Path( "artifactsByProjectVersionMetadata/{key}/{value}" )
260 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
261 @RedbackAuthorization( noPermission = true, noRestriction = true )
262 List<Artifact> getArtifactsByProjectVersionMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
263 @QueryParam("repositoryId") String repositoryId )
264 throws ArchivaRestServiceException;
267 * Return List of artifacts from this repository with artifact metadata key matching value.
268 * If repository is not provided the search runs in all repositories.
272 * @param repositoryId
274 * @throws ArchivaRestServiceException
277 @Path( "artifactsByMetadata/{key}/{value}" )
279 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
280 @RedbackAuthorization( noPermission = true, noRestriction = true )
281 List<Artifact> getArtifactsByMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
282 @QueryParam("repositoryId") String repositoryId )
283 throws ArchivaRestServiceException;
286 * Return List of artifacts from this repository with property key matching value.
287 * If repository is not provided the search runs in all repositories.
291 * @param repositoryId
293 * @throws ArchivaRestServiceException
296 @Path( "artifactsByProperty/{key}/{value}" )
298 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
299 @RedbackAuthorization( noPermission = true, noRestriction = true )
300 List<Artifact> getArtifactsByProperty( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
301 @QueryParam("repositoryId") String repositoryId )
302 throws ArchivaRestServiceException;
305 * Search artifacts with any property matching text. If repository is not provided the search runs in all
306 * repositories. If exact is true only the artifacts whose property match exactly are returned.
309 * @param repositoryId
312 * @throws ArchivaRestServiceException
315 @Path( "searchArtifacts/{text}" )
317 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
318 @RedbackAuthorization( noPermission = true, noRestriction = true )
319 List<Artifact> searchArtifacts( @PathParam( "text" ) String text,
320 @QueryParam( "repositoryId" ) String repositoryId,
321 @QueryParam( "exact" ) Boolean exact )
322 throws ArchivaRestServiceException;
325 * Search artifacts with the property specified by key matching text. If repository is not provided the search runs
326 * in all repositories. If exact is true only the artifacts whose property match exactly are returned.
330 * @param repositoryId
333 * @throws ArchivaRestServiceException
336 @Path( "searchArtifacts/{key}/{text}" )
338 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
339 @RedbackAuthorization( noPermission = true, noRestriction = true )
340 List<Artifact> searchArtifacts( @PathParam( "key" ) String key, @PathParam( "text" ) String text,
341 @QueryParam( "repositoryId" ) String repositoryId,
342 @QueryParam( "exact" ) Boolean exact )
343 throws ArchivaRestServiceException;