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

Pull Request Commits have this neat comment_count property #374

Closed
shiftkey opened this issue Feb 18, 2014 · 1 comment
Closed

Pull Request Commits have this neat comment_count property #374

shiftkey opened this issue Feb 18, 2014 · 1 comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone

Comments

@shiftkey
Copy link
Member

It's not part of /repos/{user}/{repo}/git/commits but can be seen on each commit in a PR.

We should use it.

Example payload from /git/commits/:

{
  "sha": "a70d4a4ca752e2607e7686ab3259b4c5de2cbc8f",
  "url": "https://api.github.com/repos/shiftkey-tester/source-repo-20140218090015676/git/commits/a70d4a4ca752e2607e7686ab3259b4c5de2cbc8f",
  "html_url": "https://github.com/shiftkey-tester/source-repo-20140218090015676/commits/a70d4a4ca752e2607e7686ab3259b4c5de2cbc8f",
  "author": {
    "name": "shiftkey-tester",
    "email": "[email protected]",
    "date": "2014-02-18T09:00:25Z"
  },
  "committer": {
    "name": "shiftkey-tester",
    "email": "[email protected]",
    "date": "2014-02-18T09:00:25Z"
  },
  "tree": {
    "sha": "4f84e630c3c050fccc2f603aa560296b4d69d2af",
    "url": "https://api.github.com/repos/shiftkey-tester/source-repo-20140218090015676/git/trees/4f84e630c3c050fccc2f603aa560296b4d69d2af"
  },
  "message": "this is the commit to merge into the pull request",
  "parents": [
    {
      "sha": "3d21dd08b0553e7ac270aee5ff76b47d962d294c",
      "url": "https://api.github.com/repos/shiftkey-tester/source-repo-20140218090015676/git/commits/3d21dd08b0553e7ac270aee5ff76b47d962d294c",
      "html_url": "https://github.com/shiftkey-tester/source-repo-20140218090015676/commits/3d21dd08b0553e7ac270aee5ff76b47d962d294c"
    }
  ]
}

Example payload from /pulls/{id}/commits:

[
  {
    "sha": "a70d4a4ca752e2607e7686ab3259b4c5de2cbc8f",
    "commit": {
      "author": {
        "name": "shiftkey-tester",
        "email": "[email protected]",
        "date": "2014-02-18T09:00:25Z"
      },
      "committer": {
        "name": "shiftkey-tester",
        "email": "[email protected]",
        "date": "2014-02-18T09:00:25Z"
      },
      "message": "this is the commit to merge into the pull request",
      "tree": {
        "sha": "4f84e630c3c050fccc2f603aa560296b4d69d2af",
        "url": "https://api.github.com/repos/shiftkey-tester/source-repo-20140218090015676/git/trees/4f84e630c3c050fccc2f603aa560296b4d69d2af"
      },
      "url": "https://api.github.com/repos/shiftkey-tester/source-repo-20140218090015676/git/commits/a70d4a4ca752e2607e7686ab3259b4c5de2cbc8f",
      "comment_count": 0
    },
    "url": "https://api.github.com/repos/shiftkey-tester/source-repo-20140218090015676/commits/a70d4a4ca752e2607e7686ab3259b4c5de2cbc8f",
    "html_url": "https://github.com/shiftkey-tester/source-repo-20140218090015676/commit/a70d4a4ca752e2607e7686ab3259b4c5de2cbc8f",
    "comments_url": "https://api.github.com/repos/shiftkey-tester/source-repo-20140218090015676/commits/a70d4a4ca752e2607e7686ab3259b4c5de2cbc8f/comments",
    "author": {
      "login": "shiftkey-tester",
      "id": 5151713,
      "avatar_url": "https://gravatar.com/avatar/bcd3cc17a673e125b5c8bd7000829326?d=https%3A%2F%2Fidenticons.github.com%2F99287b8402d96a214d105082adf69567.png&r=x",
      "gravatar_id": "bcd3cc17a673e125b5c8bd7000829326",
      "url": "https://api.github.com/users/shiftkey-tester",
      "html_url": "https://github.com/shiftkey-tester",
      "followers_url": "https://api.github.com/users/shiftkey-tester/followers",
      "following_url": "https://api.github.com/users/shiftkey-tester/following{/other_user}",
      "gists_url": "https://api.github.com/users/shiftkey-tester/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/shiftkey-tester/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/shiftkey-tester/subscriptions",
      "organizations_url": "https://api.github.com/users/shiftkey-tester/orgs",
      "repos_url": "https://api.github.com/users/shiftkey-tester/repos",
      "events_url": "https://api.github.com/users/shiftkey-tester/events{/privacy}",
      "received_events_url": "https://api.github.com/users/shiftkey-tester/received_events",
      "type": "User",
      "site_admin": false
    },
    "committer": {
      "login": "shiftkey-tester",
      "id": 5151713,
      "avatar_url": "https://gravatar.com/avatar/bcd3cc17a673e125b5c8bd7000829326?d=https%3A%2F%2Fidenticons.github.com%2F99287b8402d96a214d105082adf69567.png&r=x",
      "gravatar_id": "bcd3cc17a673e125b5c8bd7000829326",
      "url": "https://api.github.com/users/shiftkey-tester",
      "html_url": "https://github.com/shiftkey-tester",
      "followers_url": "https://api.github.com/users/shiftkey-tester/followers",
      "following_url": "https://api.github.com/users/shiftkey-tester/following{/other_user}",
      "gists_url": "https://api.github.com/users/shiftkey-tester/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/shiftkey-tester/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/shiftkey-tester/subscriptions",
      "organizations_url": "https://api.github.com/users/shiftkey-tester/orgs",
      "repos_url": "https://api.github.com/users/shiftkey-tester/repos",
      "events_url": "https://api.github.com/users/shiftkey-tester/events{/privacy}",
      "received_events_url": "https://api.github.com/users/shiftkey-tester/received_events",
      "type": "User",
      "site_admin": false
    },
    "parents": [
      {
        "sha": "3d21dd08b0553e7ac270aee5ff76b47d962d294c",
        "url": "https://api.github.com/repos/shiftkey-tester/source-repo-20140218090015676/commits/3d21dd08b0553e7ac270aee5ff76b47d962d294c",
        "html_url": "https://github.com/shiftkey-tester/source-repo-20140218090015676/commit/3d21dd08b0553e7ac270aee5ff76b47d962d294c"
      }
    ]
  }
]
@gabrielweyer
Copy link
Contributor

@shiftkey This should do it. I was just wondering if we should have different commit objects as the returned payloads are different. If not the work is done 😄

I would consider throwing a more meaningful error when the JSON deserialization is failing. I was getting a meaningless NullRef, it should probably be wrapped in a try catch and rethrow with the name of the property and the value.

@shiftkey shiftkey closed this as completed Jul 7, 2014
@nickfloyd nickfloyd added Status: Up for grabs Issues that are ready to be worked on by anyone and removed up-for-grabs labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone
Projects
None yet
Development

No branches or pull requests

3 participants