package org.apache.archiva.rest.api.services;
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.rest.api.model.Artifact;
import org.apache.archiva.rest.api.model.BrowseResult;
import org.apache.archiva.rest.api.model.TreeEntry;
import org.apache.archiva.rest.api.model.VersionsList;
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;

/**
 * @author Olivier Lamy
 * @since 1.4-M3
 */
@Path( "/browseService/" )
public interface BrowseService
{
    @Path( "rootGroups" )
    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = true, noRestriction = true )
    BrowseResult getRootGroups( @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;

    @Path( "browseGroupId/{groupId}" )
    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = true, noRestriction = true )
    BrowseResult browseGroupId( @PathParam( "groupId" ) String groupId,
                                @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;

    @Path( "versionsList/{g}/{a}" )
    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = true, noRestriction = true )
    VersionsList getVersionsList( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
                                  @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;

    @Path( "projectVersionMetadata/{g}/{a}" )
    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = true, noRestriction = true )
    ProjectVersionMetadata getProjectVersionMetadata( @PathParam( "g" ) String groupId,
                                                      @PathParam( "a" ) String artifactId,
                                                      @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;

    @Path( "projectVersionMetadata/{g}/{a}/{v}" )
    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = true, noRestriction = true )
    ProjectVersionMetadata getProjectMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
                                               @PathParam( "v" ) String version,
                                               @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;

    @Path( "userRepositories" )
    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = true, noRestriction = true )
    List<ManagedRepository> getUserRepositories()
        throws ArchivaRestServiceException;

    @Path( "treeEntries/{g}/{a}/{v}" )
    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = true, noRestriction = true )
    List<TreeEntry> getTreeEntries( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
                                    @PathParam( "v" ) String version,
                                    @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;

    @Path( "dependees/{g}/{a}/{v}" )
    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = true, noRestriction = true )
    List<Artifact> getDependees( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
                                 @PathParam( "v" ) String version, @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;

    @Path( "metadatas/{g}/{a}/{v}" )
    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = true, noRestriction = true )
    Map<String, String> getMetadatas( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
                                      @PathParam( "v" ) String version,
                                      @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;

    @Path( "metadata/{g}/{a}/{v}/{key}/{value}" )
    @PUT
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
    Boolean addMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
                         @PathParam( "v" ) String version, @PathParam( "key" ) String key,
                         @PathParam( "value" ) String value, @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;

    @Path( "metadata/{g}/{a}/{v}/{key}" )
    @DELETE
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    @RedbackAuthorization( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
    Boolean deleteMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
                            @PathParam( "v" ) String version, @PathParam( "key" ) String key,
                            @QueryParam( "repositoryId" ) String repositoryId )
        throws ArchivaRestServiceException;
}

@@ -4031,32 +4031,114 @@
 iction = true )%0A
+    /**%0A     * @return List of managed repositories current user can read%0A     */%0A
     List%3CManaged
@@ -4171,16 +4171,16 @@
 ories()%0A
-
         
@@ -4402,32 +4402,148 @@
 iction = true )%0A
+    /**%0A     * return the dependency Tree for an artifacts%0A     * %3Cb%3Ethe List result has only one entry%3C/b%3E%0A     */%0A
     List%3CTreeEnt
@@ -4949,32 +4949,32 @@
 ICATION_XML %7D )%0A
-
     @RedbackAuth
@@ -5024,24 +5024,105 @@
 on = true )%0A
+    /**%0A     * List of artifacts using the artifact passed in parameter.%0A     */%0A
     List%3CArt

add javadoc