Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RepoCommits |
|
| 1.0;1 |
1 | /** | |
2 | * Copyright (c) 2013-2017, jcabi.com | |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: 1) Redistributions of source code must retain the above | |
8 | * copyright notice, this list of conditions and the following | |
9 | * disclaimer. 2) Redistributions in binary form must reproduce the above | |
10 | * copyright notice, this list of conditions and the following | |
11 | * disclaimer in the documentation and/or other materials provided | |
12 | * with the distribution. 3) Neither the name of the jcabi.com nor | |
13 | * the names of its contributors may be used to endorse or promote | |
14 | * products derived from this software without specific prior written | |
15 | * permission. | |
16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT | |
19 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
20 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | |
21 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
22 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
26 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
28 | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | */ | |
30 | package com.jcabi.github; | |
31 | ||
32 | import com.jcabi.aspects.Immutable; | |
33 | import java.io.IOException; | |
34 | import java.util.Map; | |
35 | ||
36 | /** | |
37 | * Commits of a Github repository. | |
38 | * @author Alexander Sinyagin (sinyagin.alexander@gmail.com) | |
39 | * @version $Id: 2e0f165539f5190ee679b54d5782e6a85373d6a8 $ | |
40 | * @see <a href="http://developer.github.com/v3/repos/commits/">Commits API</a> | |
41 | */ | |
42 | @Immutable | |
43 | @SuppressWarnings("PMD.AvoidDuplicateLiterals") | |
44 | public interface RepoCommits extends JsonReadable { | |
45 | ||
46 | /** | |
47 | * Iterate all repository's commits. | |
48 | * @return All commits | |
49 | * @param params Url's parameters | |
50 | * @see <a href="http://developer.github.com/v3/repos/commits/#list-commits-on-a-repository">List commits on a repository</a> | |
51 | */ | |
52 | Iterable<RepoCommit> iterate( | |
53 | final Map<String, String> params | |
54 | ); | |
55 | ||
56 | /** | |
57 | * Get single repository's commits. | |
58 | * | |
59 | * @param sha SHA of a commit | |
60 | * @return RepoCommit | |
61 | * @see <a href="http://developer.github.com/v3/repos/commits/#get-a-single-commit">Get a single commit</a> | |
62 | */ | |
63 | RepoCommit get(String sha); | |
64 | ||
65 | /** | |
66 | * Compare two commits. | |
67 | * @param base SHA of the base repo commit | |
68 | * @param head SHA of the head repo commit | |
69 | * @return Commits comparison | |
70 | */ | |
71 | CommitsComparison compare( | |
72 | String base, | |
73 | String head); | |
74 | ||
75 | /** | |
76 | * Compare two commits and provide result in diff format. | |
77 | * @param base SHA of the base repo commit | |
78 | * @param head SHA of the head repo commit | |
79 | * @return Commits comparison | |
80 | * @throws IOException If there is any I/O problem | |
81 | * @since 0.8 | |
82 | */ | |
83 | String diff( | |
84 | String base, | |
85 | String head | |
86 | ) throws IOException; | |
87 | ||
88 | /** | |
89 | * Compare two commits and provide result in patch format. | |
90 | * @param base SHA of the base repo commit | |
91 | * @param head SHA of the head repo commit | |
92 | * @return Commits comparison | |
93 | * @throws IOException If there is any I/O problem | |
94 | * @since 0.8 | |
95 | */ | |
96 | String patch( | |
97 | String base, | |
98 | String head | |
99 | ) throws IOException; | |
100 | } |