Coverage Report - com.jcabi.github.PullComments
 
Classes in this File Line Coverage Branch Coverage Complexity
PullComments
N/A
N/A
1
 
 1  
 /**
 2  
  * Copyright (c) 2013-2015, 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  
 import javax.validation.constraints.NotNull;
 36  
 
 37  
 /**
 38  
  * Github pull comments.
 39  
  *
 40  
  * @author Andres Candal (andres.candal@rollasolution.com)
 41  
  * @version $Id$
 42  
  * @since 0.8
 43  
  * @see <a href="http://developer.github.com/v3/pulls/comments/">Review Comments API</a>
 44  
  */
 45  
 @Immutable
 46  
 public interface PullComments {
 47  
 
 48  
     /**
 49  
      * Pull we're in.
 50  
      *
 51  
      * @return Pull
 52  
      */
 53  
     @NotNull(message = "pull is never NULL")
 54  
     Pull pull();
 55  
 
 56  
     /**
 57  
      * Get specific pull comment by number.
 58  
      *
 59  
      * @param number Pull comment number
 60  
      * @return Pull comment
 61  
      * @see <a href="http://developer.github.com/v3/pulls/comments/#get-a-single-comment">Get a single comment</a>
 62  
      */
 63  
     @NotNull(message = "PullComment is never NULL")
 64  
     PullComment get(int number);
 65  
 
 66  
     /**
 67  
      * Iterate all pull comments for this repo.
 68  
      *
 69  
      * @param params Iterating parameters, as specified by API
 70  
      * @return Iterable of pull comments
 71  
      * @see <a href="http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository">List comments in a repository</a>
 72  
      */
 73  
     @NotNull(message = "iterable is never NULL")
 74  
     Iterable<PullComment> iterate(
 75  
         @NotNull(message = "map of params can't be NULL")
 76  
         Map<String, String> params);
 77  
 
 78  
     /**
 79  
      * Iterate all pull comments for a pull request.
 80  
      *
 81  
      * @param number Pull comment number
 82  
      * @param params Iterating parameters, as specified by API
 83  
      * @return Iterable of pull comments
 84  
      * @see <a href="http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request">List comments on a pull request</a>
 85  
      */
 86  
     @NotNull(message = "iterable is never NULL")
 87  
     Iterable<PullComment> iterate(int number,
 88  
         @NotNull(message = "map of params can't be NULL")
 89  
         Map<String, String> params);
 90  
 
 91  
     /**
 92  
      * Post a new pull comment.
 93  
      *
 94  
      * @param body Body of it
 95  
      * @param commit Commit ID (SHA) of it
 96  
      * @param path Path of the file to comment on
 97  
      * @param position Line index in the diff to comment on
 98  
      * @return PullComment just created
 99  
      * @throws IOException If there is any I/O problem
 100  
      * @see <a href="http://developer.github.com/v3/pulls/comments/#create-a-comment">Create a comment</a>
 101  
      * @checkstyle ParameterNumberCheck (7 lines)
 102  
      */
 103  
     @NotNull(message = "PullComment is never NULL")
 104  
     PullComment post(
 105  
         @NotNull(message = "Comment body is never NULL") String body,
 106  
         @NotNull(message = "commit ID is never NULL") String commit,
 107  
         @NotNull(message = "path body is never NULL") String path,
 108  
         @NotNull(message = "position is never NULL") int position)
 109  
         throws IOException;
 110  
 
 111  
     /**
 112  
      * Create a new comment as a reply to an existing pull comment.
 113  
      *
 114  
      * @param body Body of it
 115  
      * @param comment Commit ID (SHA) of it
 116  
      * @return PullComment just created
 117  
      * @throws IOException If there is any I/O problem
 118  
      * @see <a href="http://developer.github.com/v3/pulls/comments/#create-a-comment">Create a comment</a>
 119  
      */
 120  
     @NotNull(message = "PullComment is never NULL")
 121  
     PullComment reply(
 122  
         @NotNull(message = "Comment body is never NULL") String body,
 123  
         @NotNull(message = "comment ID is never NULL") int comment)
 124  
         throws IOException;
 125  
 
 126  
     /**
 127  
      * Removes a pull comment by ID.
 128  
      *
 129  
      * @param number The ID of the pull comment to delete.
 130  
      * @throws IOException If there is any I/O problem.
 131  
      */
 132  
     void remove(int number) throws IOException;
 133  
 
 134  
 }