PageRenderTime 38ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/api/award_emoji.md

https://gitlab.com/effigies/gitlab-ce
Markdown | 367 lines | 300 code | 67 blank | 0 comment | 0 complexity | b620b9e95ac7c92a618c6e0de85e46c2 MD5 | raw file
  1. # Award Emoji
  2. >**Note:** This feature was introduced in GitLab 8.9
  3. An awarded emoji tells a thousand words, and can be awarded on issues, merge
  4. requests and notes/comments. Issues, merge requests and notes are further called
  5. `awardables`.
  6. ## Issues and merge requests
  7. ### List an awardable's award emoji
  8. Gets a list of all award emoji
  9. ```
  10. GET /projects/:id/issues/:issue_id/award_emoji
  11. GET /projects/:id/merge_requests/:merge_request_id/award_emoji
  12. ```
  13. Parameters:
  14. | Attribute | Type | Required | Description |
  15. | --------- | ---- | -------- | ----------- |
  16. | `id` | integer | yes | The ID of a project |
  17. | `awardable_id` | integer | yes | The ID of an awardable |
  18. ```bash
  19. curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" http://gitlab.example.com/api/v3/projects/1/issues/80/award_emoji
  20. ```
  21. Example Response:
  22. ```json
  23. [
  24. {
  25. "id": 4,
  26. "name": "1234",
  27. "user": {
  28. "name": "Administrator",
  29. "username": "root",
  30. "id": 1,
  31. "state": "active",
  32. "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
  33. "web_url": "http://gitlab.example.com/u/root"
  34. },
  35. "created_at": "2016-06-15T10:09:34.206Z",
  36. "updated_at": "2016-06-15T10:09:34.206Z",
  37. "awardable_id": 80,
  38. "awardable_type": "Issue"
  39. },
  40. {
  41. "id": 1,
  42. "name": "microphone",
  43. "user": {
  44. "name": "User 4",
  45. "username": "user4",
  46. "id": 26,
  47. "state": "active",
  48. "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
  49. "web_url": "http://gitlab.example.com/u/user4"
  50. },
  51. "created_at": "2016-06-15T10:09:34.177Z",
  52. "updated_at": "2016-06-15T10:09:34.177Z",
  53. "awardable_id": 80,
  54. "awardable_type": "Issue"
  55. }
  56. ]
  57. ```
  58. ### Get single award emoji
  59. Gets a single award emoji from an issue or merge request.
  60. ```
  61. GET /projects/:id/issues/:issue_id/award_emoji/:award_id
  62. GET /projects/:id/merge_requests/:merge_request_id/award_emoji/:award_id
  63. ```
  64. Parameters:
  65. | Attribute | Type | Required | Description |
  66. | --------- | ---- | -------- | ----------- |
  67. | `id` | integer | yes | The ID of a project |
  68. | `awardable_id` | integer | yes | The ID of an awardable |
  69. | `award_id` | integer | yes | The ID of the award emoji |
  70. ```bash
  71. curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" http://gitlab.example.com/api/v3/projects/1/issues/80/award_emoji/1
  72. ```
  73. Example Response:
  74. ```json
  75. {
  76. "id": 1,
  77. "name": "microphone",
  78. "user": {
  79. "name": "User 4",
  80. "username": "user4",
  81. "id": 26,
  82. "state": "active",
  83. "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
  84. "web_url": "http://gitlab.example.com/u/user4"
  85. },
  86. "created_at": "2016-06-15T10:09:34.177Z",
  87. "updated_at": "2016-06-15T10:09:34.177Z",
  88. "awardable_id": 80,
  89. "awardable_type": "Issue"
  90. }
  91. ```
  92. ### Award a new emoji
  93. This end point creates an award emoji on the specified resource
  94. ```
  95. POST /projects/:id/issues/:issue_id/award_emoji
  96. POST /projects/:id/merge_requests/:merge_request_id/award_emoji
  97. ```
  98. Parameters:
  99. | Attribute | Type | Required | Description |
  100. | --------- | ---- | -------- | ----------- |
  101. | `id` | integer | yes | The ID of a project |
  102. | `awardable_id` | integer | yes | The ID of an awardable |
  103. | `name` | string | yes | The name of the emoji, without colons |
  104. ```bash
  105. curl -X POST -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" http://gitlab.example.com/api/v3/projects/1/issues/80/award_emoji?name=blowfish
  106. ```
  107. Example Response:
  108. ```json
  109. {
  110. "id": 344,
  111. "name": "blowfish",
  112. "user": {
  113. "name": "Administrator",
  114. "username": "root",
  115. "id": 1,
  116. "state": "active",
  117. "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
  118. "web_url": "http://gitlab.example.com/u/root"
  119. },
  120. "created_at": "2016-06-17T17:47:29.266Z",
  121. "updated_at": "2016-06-17T17:47:29.266Z",
  122. "awardable_id": 80,
  123. "awardable_type": "Issue"
  124. }
  125. ```
  126. ### Delete an award emoji
  127. Sometimes its just not meant to be, and you'll have to remove your award. Only available to
  128. admins or the author of the award. Status code 200 on success, 401 if unauthorized.
  129. ```
  130. DELETE /projects/:id/issues/:issue_id/award_emoji/:award_id
  131. DELETE /projects/:id/merge_requests/:merge_request_id/award_emoji/:award_id
  132. ```
  133. Parameters:
  134. | Attribute | Type | Required | Description |
  135. | --------- | ---- | -------- | ----------- |
  136. | `id` | integer | yes | The ID of a project |
  137. | `issue_id` | integer | yes | The ID of an issue |
  138. | `award_id` | integer | yes | The ID of a award_emoji |
  139. ```bash
  140. curl -X DELETE -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" http://gitlab.example.com/api/v3/projects/1/issues/80/award_emoji/344
  141. ```
  142. Example Response:
  143. ```json
  144. {
  145. "id": 344,
  146. "name": "blowfish",
  147. "user": {
  148. "name": "Administrator",
  149. "username": "root",
  150. "id": 1,
  151. "state": "active",
  152. "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
  153. "web_url": "http://gitlab.example.com/u/root"
  154. },
  155. "created_at": "2016-06-17T17:47:29.266Z",
  156. "updated_at": "2016-06-17T17:47:29.266Z",
  157. "awardable_id": 80,
  158. "awardable_type": "Issue"
  159. }
  160. ```
  161. ## Award Emoji on Notes
  162. The endpoints documented above are available for Notes as well. Notes
  163. are a sub-resource of Issues and Merge Requests. The examples below
  164. describe working with Award Emoji on notes for an Issue, but can be
  165. easily adapted for notes on a Merge Request.
  166. ### List a note's award emoji
  167. ```
  168. GET /projects/:id/issues/:issue_id/notes/:note_id/award_emoji
  169. ```
  170. Parameters:
  171. | Attribute | Type | Required | Description |
  172. | --------- | ---- | -------- | ----------- |
  173. | `id` | integer | yes | The ID of a project |
  174. | `issue_id` | integer | yes | The ID of an issue |
  175. | `note_id` | integer | yes | The ID of an note |
  176. ```bash
  177. curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" http://gitlab.example.com/api/v3/projects/1/issues/80/notes/1/award_emoji
  178. ```
  179. Example Response:
  180. ```json
  181. [
  182. {
  183. "id": 2,
  184. "name": "mood_bubble_lightning",
  185. "user": {
  186. "name": "User 4",
  187. "username": "user4",
  188. "id": 26,
  189. "state": "active",
  190. "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
  191. "web_url": "http://gitlab.example.com/u/user4"
  192. },
  193. "created_at": "2016-06-15T10:09:34.197Z",
  194. "updated_at": "2016-06-15T10:09:34.197Z",
  195. "awardable_id": 1,
  196. "awardable_type": "Note"
  197. }
  198. ]
  199. ```
  200. ### Get single note's award emoji
  201. ```
  202. GET /projects/:id/issues/:issue_id/notes/:note_id/award_emoji/:award_id
  203. ```
  204. Parameters:
  205. | Attribute | Type | Required | Description |
  206. | --------- | ---- | -------- | ----------- |
  207. | `id` | integer | yes | The ID of a project |
  208. | `issue_id` | integer | yes | The ID of an issue |
  209. | `note_id` | integer | yes | The ID of a note |
  210. | `award_id` | integer | yes | The ID of the award emoji |
  211. ```bash
  212. curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" http://gitlab.example.com/api/v3/projects/1/issues/80/notes/1/award_emoji/2
  213. ```
  214. Example Response:
  215. ```json
  216. {
  217. "id": 2,
  218. "name": "mood_bubble_lightning",
  219. "user": {
  220. "name": "User 4",
  221. "username": "user4",
  222. "id": 26,
  223. "state": "active",
  224. "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
  225. "web_url": "http://gitlab.example.com/u/user4"
  226. },
  227. "created_at": "2016-06-15T10:09:34.197Z",
  228. "updated_at": "2016-06-15T10:09:34.197Z",
  229. "awardable_id": 1,
  230. "awardable_type": "Note"
  231. }
  232. ```
  233. ### Award a new emoji on a note
  234. ```
  235. POST /projects/:id/issues/:issue_id/notes/:note_id/award_emoji
  236. ```
  237. Parameters:
  238. | Attribute | Type | Required | Description |
  239. | --------- | ---- | -------- | ----------- |
  240. | `id` | integer | yes | The ID of a project |
  241. | `issue_id` | integer | yes | The ID of an issue |
  242. | `note_id` | integer | yes | The ID of a note |
  243. | `name` | string | yes | The name of the emoji, without colons |
  244. ```bash
  245. curl -X POST -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" http://gitlab.example.com/api/v3/projects/1/issues/80/notes/1/award_emoji?name=rocket
  246. ```
  247. Example Response:
  248. ```json
  249. {
  250. "id": 345,
  251. "name": "rocket",
  252. "user": {
  253. "name": "Administrator",
  254. "username": "root",
  255. "id": 1,
  256. "state": "active",
  257. "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
  258. "web_url": "http://gitlab.example.com/u/root"
  259. },
  260. "created_at": "2016-06-17T19:59:55.888Z",
  261. "updated_at": "2016-06-17T19:59:55.888Z",
  262. "awardable_id": 1,
  263. "awardable_type": "Note"
  264. }
  265. ```
  266. ### Delete an award emoji
  267. Sometimes its just not meant to be, and you'll have to remove your award. Only available to
  268. admins or the author of the award. Status code 200 on success, 401 if unauthorized.
  269. ```
  270. DELETE /projects/:id/issues/:issue_id/notes/:note_id/award_emoji/:award_id
  271. ```
  272. Parameters:
  273. | Attribute | Type | Required | Description |
  274. | --------- | ---- | -------- | ----------- |
  275. | `id` | integer | yes | The ID of a project |
  276. | `issue_id` | integer | yes | The ID of an issue |
  277. | `note_id` | integer | yes | The ID of a note |
  278. | `award_id` | integer | yes | The ID of a award_emoji |
  279. ```bash
  280. curl -X DELETE -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" http://gitlab.example.com/api/v3/projects/1/issues/80/award_emoji/345
  281. ```
  282. Example Response:
  283. ```json
  284. {
  285. "id": 345,
  286. "name": "rocket",
  287. "user": {
  288. "name": "Administrator",
  289. "username": "root",
  290. "id": 1,
  291. "state": "active",
  292. "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
  293. "web_url": "http://gitlab.example.com/u/root"
  294. },
  295. "created_at": "2016-06-17T19:59:55.888Z",
  296. "updated_at": "2016-06-17T19:59:55.888Z",
  297. "awardable_id": 1,
  298. "awardable_type": "Note"
  299. }
  300. ```