Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to create review comments #142

Merged
merged 1 commit into from Aug 3, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+26 −5
Diff settings

Always

Just for now

Copy path View file
@@ -378,7 +378,7 @@ impl PullOptions {

#[derive(Debug, Deserialize)]
pub struct FileDiff {
// sha may be null when file mode changed without contents changing
/// sha from GitHub may be null when file mode changed without contents changing
pub sha: Option<String>,
pub filename: String,
pub status: String,
Copy path View file
@@ -1,11 +1,15 @@
//! Review comments interface

extern crate futures;
extern crate serde_json;

use hyper::client::Connect;

use {Future, Github};
use futures::future;
use users::User;

/// A structure for interfacing with a issue comments
/// A structure for interfacing with a review comments
pub struct ReviewComments<C>
where
C: Clone + Connect,
@@ -31,17 +35,34 @@ impl<C: Clone + Connect> ReviewComments<C> {
}
}

/// list pull requests
/// list review comments
pub fn list(&self) -> Future<Vec<ReviewComment>> {
self.github.get::<Vec<ReviewComment>>(&format!(
self.github.get::<Vec<ReviewComment>>(&self.path())
}

/// Create new review comment
pub fn create(&self, review_comment: &ReviewCommentOptions) -> Future<ReviewComment> {
self.github.post(&self.path(), json!(review_comment))
}

fn path(&self) -> String {
format!(
"/repos/{}/{}/pulls/{}/comments",
self.owner, self.repo, self.number
))
)
}
}

// representations (todo: replace with derive_builder)

#[derive(Default, Serialize)]
pub struct ReviewCommentOptions {
pub body: String,
pub commit_id: String,
pub path: String,
pub position: usize,
}

#[derive(Debug, Deserialize)]
pub struct ReviewComment {
pub id: u64,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.