|
| 1 | +# Comments |
| 2 | + |
| 3 | +## List comments on an issue |
| 4 | + |
| 5 | +Issue Comments are ordered by ascending ID. |
| 6 | + |
| 7 | +``` |
| 8 | +GET /repos/:username/:reponame/issues/:index/comments |
| 9 | +``` |
| 10 | + |
| 11 | +### Parameters |
| 12 | + |
| 13 | +|Name|Type|Description| |
| 14 | +|----|----|-----------| |
| 15 | +|since|string|Only comments updated at or after this time are returned. This is a timestamp in RFC3339 format: **2006-01-02T15:04:05Z07:00**, e.g. **2017-06-27T15:04:05-04:00**| |
| 16 | + |
| 17 | +### Response |
| 18 | + |
| 19 | +``` |
| 20 | +Status: 200 OK |
| 21 | +``` |
| 22 | +```json |
| 23 | +[ |
| 24 | + { |
| 25 | + "id": 74, |
| 26 | + "user": { |
| 27 | + "id": 1, |
| 28 | + "username": "unknwon", |
| 29 | + "full_name": "无闻", |
| 30 | + "email": "fake@local", |
| 31 | + "avatar_url": "http://localhost:3000/avatars/1" |
| 32 | + }, |
| 33 | + "body": "what?", |
| 34 | + "created_at": "2016-08-26T11:58:18-07:00", |
| 35 | + "updated_at": "2016-08-26T11:58:18-07:00" |
| 36 | + }, |
| 37 | + { |
| 38 | + "id": 75, |
| 39 | + "user": { |
| 40 | + "id": 1, |
| 41 | + "username": "unknwon", |
| 42 | + "full_name": "无闻", |
| 43 | + "email": "fake@local", |
| 44 | + "avatar_url": "http://localhost:3000/avatars/1" |
| 45 | + }, |
| 46 | + "body": "awesome!!", |
| 47 | + "created_at": "2016-08-26T11:58:24-07:00", |
| 48 | + "updated_at": "2016-08-26T11:58:24-07:00" |
| 49 | + }, |
| 50 | + { |
| 51 | + "id": 76, |
| 52 | + "user": { |
| 53 | + "id": 1, |
| 54 | + "username": "unknwon", |
| 55 | + "full_name": "无闻", |
| 56 | + "email": "fake@local", |
| 57 | + "avatar_url": "http://localhost:3000/avatars/1" |
| 58 | + }, |
| 59 | + "body": "this is awesome?", |
| 60 | + "created_at": "2016-08-26T12:21:28-07:00", |
| 61 | + "updated_at": "2016-08-26T12:21:28-07:00" |
| 62 | + } |
| 63 | +] |
| 64 | +``` |
| 65 | + |
| 66 | +## List comments of an issue for a given repository |
| 67 | + |
| 68 | +Issue comments are ordered by ascending ID. |
| 69 | + |
| 70 | +``` |
| 71 | +GET /repos/:username/:reponame/issues/comments |
| 72 | +``` |
| 73 | + |
| 74 | +### Parameters |
| 75 | + |
| 76 | +| Name | Type | Description | |
| 77 | +| --- | --- | --- | |
| 78 | +| since | string | Only comments updated at or after this time are returned. This is a timestamp in RFC3339 format: **2006-01-02T15:04:05Z07:00**| |
| 79 | + |
| 80 | +### Response |
| 81 | + |
| 82 | +``` |
| 83 | +Status: 200 OK |
| 84 | +``` |
| 85 | +``` json |
| 86 | +[ |
| 87 | + { |
| 88 | + "id": 74, |
| 89 | + "user": { |
| 90 | + "id": 1, |
| 91 | + "username": "unknwon", |
| 92 | + "full_name": "无闻", |
| 93 | + "email": "fake@local", |
| 94 | + "avatar_url": "http://localhost:3000/avatars/1" |
| 95 | + }, |
| 96 | + "body": "what?", |
| 97 | + "created_at": "2016-08-26T11:58:18-07:00", |
| 98 | + "updated_at": "2016-08-26T11:58:18-07:00" |
| 99 | + } |
| 100 | +] |
| 101 | +``` |
| 102 | + |
| 103 | +## Create a comment |
| 104 | + |
| 105 | +``` |
| 106 | +POST /repos/:username/:reponame/issues/:index/comments |
| 107 | +``` |
| 108 | + |
| 109 | +### Parameters |
| 110 | + |
| 111 | +|Name|Type|Description| |
| 112 | +|----|----|-----------| |
| 113 | +|body|string|**Required** The contents of the comment.| |
| 114 | + |
| 115 | +### Example |
| 116 | + |
| 117 | +```json |
| 118 | +{ |
| 119 | + "body": "Me too" |
| 120 | +} |
| 121 | +``` |
| 122 | + |
| 123 | +### Response |
| 124 | + |
| 125 | +``` |
| 126 | +Status: 201 Created |
| 127 | +``` |
| 128 | +```json |
| 129 | +{ |
| 130 | +"id": 68, |
| 131 | +"user": { |
| 132 | + "id": 1, |
| 133 | + "username": "unknwon", |
| 134 | + "full_name": "无闻", |
| 135 | + "email": "fake@local", |
| 136 | + "avatar_url": "http://localhost:3000/avatars/1" |
| 137 | +}, |
| 138 | +"body": "Me too", |
| 139 | +"created_at": "2016-08-16T09:44:00-07:00", |
| 140 | +"updated_at": "2016-08-26T13:51:28-07:00" |
| 141 | +} |
| 142 | +``` |
| 143 | + |
| 144 | +## Edit a comment |
| 145 | + |
| 146 | +``` |
| 147 | +PATCH /repos/:username/:reponame/issues/:index/comments/:id |
| 148 | +``` |
| 149 | + |
| 150 | +### Parameters |
| 151 | + |
| 152 | +|Name|Type|Description| |
| 153 | +|----|----|-----------| |
| 154 | +|body|string|**Required** The contents of the comment.| |
| 155 | + |
| 156 | +## Delete a Issue-comment |
| 157 | + |
| 158 | +``` |
| 159 | +DELETE /repos/:username/:reponame/issues/:index/comments/:id |
| 160 | +``` |
| 161 | + |
| 162 | +### Response |
| 163 | + |
| 164 | +``` |
| 165 | +Status: 204 No Content |
| 166 | +``` |
0 commit comments