Skip to content
Permalink
Browse files

Pull Request Comment Model

  • Loading branch information
kendfinger committed Aug 24, 2014
1 parent c413a1f commit 611588e76163c17ee4830a9b9e0609ebf5beb165
Showing with 68 additions and 9 deletions.
  1. +9 −9 lib/src/common/contents.dart
  2. +59 −0 lib/src/common/pull_request.dart
@@ -64,7 +64,7 @@ class File {
* Links
*/
@ApiName("_links")
FileLinks links;
Links links;

/**
* Text Content
@@ -92,7 +92,7 @@ class File {
..sha = input['sha']
..gitUrl = input['git_url']
..url = input['html_url']
..links = FileLinks.fromJSON(input['_links'])
..links = Links.fromJSON(input['_links'])
..sourceRepository = slug
..json = input;
}
@@ -110,7 +110,7 @@ class File {
/**
* File Links
*/
class FileLinks {
class Links {
/**
* Git Link
*/
@@ -129,13 +129,13 @@ class FileLinks {
@ApiName("html")
String html;

static FileLinks fromJSON(input) {
static Links fromJSON(input) {
if (input == null) return null;
var fileLinks = new FileLinks();
fileLinks.git = input['git'];
fileLinks.self = input['self'];
fileLinks.html = input['html'];
return fileLinks;
var links = new Links();
links.git = input['git'];
links.self = input['self'];
links.html = input['html'];
return links;
}
}

@@ -268,4 +268,63 @@ class CreatePullRequest {
putValue("body", body, map);
return JSON.encode(map);
}
}

class PullRequestComment {
final GitHub github;

int id;
@ApiName("diff_hunk")
String diffHunk;
String path;
int position;

@ApiName("original_position")
int originalPosition;

@ApiName("commit_id")
String commitID;

@ApiName("original_commit_id")
String originalCommitID;

User user;
String body;

@ApiName("created_at")
DateTime createdAt;

@ApiName("updated_at")
DateTime updatedAt;

@ApiName("html_url")
String url;

@ApiName("pull_request_url")
String pullRequestUrl;

@ApiName("_links")
Links links;

PullRequestComment(this.github);

static PullRequestComment fromJSON(GitHub github, input) {
if (input == null) return null;

return new PullRequestComment(github)
..id = input['id']
..diffHunk = input['diff_hunk']
..path = input['path']
..position = input['position']
..originalPosition = input['original_position']
..commitID = input['commit_id']
..originalCommitID = input['original_commit_id']
..user = User.fromJSON(github, input['user'])
..body = input['body']
..createdAt = parseDateTime(input['created_at'])
..updatedAt = parseDateTime(input['updated_at'])
..url = input['html_url']
..pullRequestUrl = input['pull_request_url']
..links = Links.fromJSON(input['_links']);
}
}

0 comments on commit 611588e

Please sign in to comment.
You can’t perform that action at this time.