GET /repos/{owner}/{repo}/issues/comments/{id}/reactions
PUT /repos/{owner}/{repo}/issues/comments/{id}/reactions
DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions
GitHub docu https://developer.github.com/v3/issues/comments/#reactions-summary
think we can do better
@mmarif4u what is earyer to process:
for GET /repos/{owner}/{repo}/issues/comments/{id}/reactions
[
{
"id": 0,
"username": "6543",
"reaction": "heart",
},
{
"id": 4,
"username": "6543",
"reaction": "laugh",
},
{
"id": 8,
"username": "mmarif",
"reaction": "laugh",
},
{
"id": 10,
"username": "user1",
"reaction": "confused",
}
]
[
{
"reaction": "heart",
"users": [ "6543" ]
},
{
"reaction": "laugh",
"users": [ "6543", "mmarif" ]
},
{
"reaction": "confused",
"users": [ "user1" ]
}
]
PS: i dont like to send whole User.APIFormat() user this would generate to mouch overhead
[
{
"reaction": "heart",
"users": [ "6543" ]
},
{
"reaction": "laugh",
"users": [ "6543", "mmarif" ]
},
{
"reaction": "confused",
"users": [ "user1" ]
}
]
Is better: more concise, no ids exposed.
I agree with @guillep2k, that is the right way to do it. :+1:
PUT / DELETE use as body
{
"reaction": "heart",
"users": [ "6543" ]
}
I could make it eaven mor simpler by just allow a string
to be send or
"reaction": "heart"
but i leave it open so admins have an API to send ractions for other users/bots... too
Don't forget Sudo allows an admin to act like any other user - so you should only add that if you're going to allow the admin to set multiple user's reactions.
imho we should follow GitHub API compatibility:
https://developer.github.com/v3/reactions/
Link above is just reaction counts by type in issue details API
@lafriks @techknowlogick one downside:
consider a issue with 15 comments -> each had ~ 10 reactions
-> api return user information in the worst case 150 times (dedundancy)
and if there all other users we still load a huge amount of user information wich isnt used ...
and if an app like to load more about a user it still kan get it by its name
I'm thinking about mobile conection ...
@lafriks add more fields beside the user{} can be usefull but should i expose the reaction ID (-> @guillep2k)?
GET /repos/{owner}/{repo}/issues/comments/{id}/reactions
consume: null
return:
[
{
"user": "octocat",
"content": "heart",
"created_at": "2016-05-20T20:09:31Z"
},
{
"user": "6543",
"content": "heart",
"created_at": "2017-10-20T20:09:31Z"
}
]
PUT/DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions
consume:
content: "heart"
return:
[
{
"user": "octocat",
"content": "heart",
"created_at": "2016-05-20T20:09:31Z"
}
]
I don't agree as most probably you will still want to have user avatar url, user url, we do return this format in all other api, so I would not like this to be different. Reaction summary (counts by type) you will already have them in issue/pr/comment API. These are details so you really need to request them rarely - when you really want to know exact details
@lafriks
GET /repos/{owner}/{repo}/issues/{index}
as no reaction info
GET /repos/{owner}/{repo}/pulls/{index}
also
a GET /repos/{owner}/{repo}/issues/comments/{id}
do NOT exist!
and GET /repos/{owner}/{repo}/issues/comments
has no reaction info
this is same at GET /repos/{owner}/{repo}/issues/{index}/comments
so add a "reactions_light" or so type wich has smal foodprint to :arrow_up: API endpoints?
and make /repos/{owner}/{repo}/issues/comments/{id}/reactions
like github?
@lafriks github has a similar aproach: https://developer.github.com/v3/issues/#reactions-summary
one thing wich is not goog at this reaction_summary_api:
parsing it with custom reactions is not that great - i dont like to hardcode reaction types to a data struct!
@lafriks I'm thinking of #8811
GET /repos/{owner}/{repo}/issues/comments/{id}/reactions
consume: null
return:
[
{
"id": 1,
"user": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat",
..... (gitea_api_user)
"type": "User",
"site_admin": false
},
"content": "heart",
"created_at": "2016-05-20T20:09:31Z"
}
]
PUT/DELETE /repos/{owner}/{repo}/issues/comments/{id}/reactions
consume:
content: "heart"
return:
http code
add a reaction field: (api.reaction_summary)
"reactions": [
{
"reaction": "heart",
"users": [ "6543" ],
"count": 1
},
{
"reaction": "rocket",
"users": [ "octa" ],
"count": 1
}
],
"reactions_count": 2,
"reactions_url": "/repos/{owner}/{repo}/<issues/comments/pull ...>/{id}/reactions"
Github API for this is better imho
"reactions": {
"total_count": 5,
"+1": 3,
"-1": 1,
"laugh": 0,
"confused": 0,
"heart": 1,
"hooray": 0,
"url": "{owner}/{repo}/issues/comments/{id}/reactions"
}
@lafriks what if i like to add "rocket" :rocket:?
this is no array. types are hardcoded :(
and if we like support for custom reactions we cant provide a usefull summary representation
I'll do it the github way, but don't blame me for limitating api afterwards ...
"reactions_summary": [
{
"reaction": "heart",
"users": [ "6543" ],
"count": 1
},
{
"reaction": "rocket",
"users": [ "octa" ],
"count": 1
}
],
"reactions_counter": 2,
EDIT: wont imlement jet - only if somebody need this, if so comment on this issue :D
Most helpful comment
Is better: more concise, no ids exposed.