1 /*
2 * Copyright (C) 2010 Atlassian
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.atlassian.jira.rest.client;
18
19 import com.atlassian.jira.rest.client.domain.BasicProject;
20 import com.atlassian.jira.rest.client.domain.Project;
21
22 import java.net.URI;
23
24 /**
25 * The client handling project resources.
26 *
27 * @since v0.1
28 */
29 public interface ProjectRestClient {
30 /**
31 * Retrieves complete information about given project.
32 *
33 * @param key unique key of the project (usually 2+ characters)
34 * @param progressMonitor progress monitor
35 * @return complete information about given project
36 * @throws RestClientException in case of problems (connectivity, malformed messages, etc.)
37 */
38 Project getProject(String key, ProgressMonitor progressMonitor);
39
40 /**
41 * Retrieves complete information about given project.
42 * Use this method rather than {@link com.atlassian.jira.rest.client.ProjectRestClient#getProject(String, ProgressMonitor)}
43 * wheever you can, as this method is proof for potential changes of URI scheme used for exposing various
44 * resources by JIRA REST API.
45 *
46 * @param projectUri URI to project resource (usually get from <code>self</code> attribute describing component elsewhere
47 * @param progressMonitor progress monitor
48 * @return complete information about given project
49 * @throws RestClientException in case of problems (connectivity, malformed messages, etc.)
50 */
51 Project getProject(URI projectUri, ProgressMonitor progressMonitor);
52
53 /**
54 * Returns all projects, which are visible for the currently logged in user. If no user is logged in, it returns the
55 * list of projects that are visible when using anonymous access.
56 *
57 * @since client: 0.2, server 4.3
58 *
59 * @return projects which the currently logged user can see
60 * @param progressMonitor progress monitor
61 */
62 Iterable<BasicProject> getAllProjects(ProgressMonitor progressMonitor);
63
64 }