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.api;
18
19 import com.atlassian.jira.rest.client.api.domain.BasicProject;
20 import com.atlassian.jira.rest.client.api.domain.Project;
21 import com.atlassian.util.concurrent.Promise;
22
23 import java.net.URI;
24
25 /**
26 * The com.atlassian.jira.rest.client.api handling project resources.
27 *
28 * @since v0.1
29 */
30 public interface ProjectRestClient {
31 /**
32 * Retrieves complete information about given project.
33 *
34 * @param key unique key of the project (usually 2+ characters)
35 * @return complete information about given project
36 * @throws RestClientException in case of problems (connectivity, malformed messages, etc.)
37 */
38 Promise<Project> getProject(String key);
39
40 /**
41 * Retrieves complete information about given project.
42 * Use this method rather than {@link ProjectRestClient#getProject(String)}
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 * @return complete information about given project
48 * @throws RestClientException in case of problems (connectivity, malformed messages, etc.)
49 */
50 Promise<Project> getProject(URI projectUri);
51
52 /**
53 * Returns all projects, which are visible for the currently logged in user. If no user is logged in, it returns the
54 * list of projects that are visible when using anonymous access.
55 *
56 * @return projects which the currently logged user can see
57 * @since com.atlassian.jira.rest.client.api: 0.2, server 4.3
58 */
59 Promise<Iterable<BasicProject>> getAllProjects();
60
61 }