example.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * @api {get} /user/:id Read data of a User
  3. * @apiVersion 0.3.0
  4. * @apiName GetUser
  5. * @apiGroup User
  6. * @apiPermission admin
  7. *
  8. * @apiDescription Compare Verison 0.3.0 with 0.2.0 and you will see the green markers with new items in version 0.3.0 and red markers with removed items since 0.2.0.
  9. *
  10. * @apiParam {Number} id The Users-ID.
  11. *
  12. * @apiExample Example usage:
  13. * curl -i http://localhost/user/4711
  14. *
  15. * @apiSuccess {Number} id The Users-ID.
  16. * @apiSuccess {Date} registered Registration Date.
  17. * @apiSuccess {Date} name Fullname of the User.
  18. * @apiSuccess {String[]} nicknames List of Users nicknames (Array of Strings).
  19. * @apiSuccess {Object} profile Profile data (example for an Object)
  20. * @apiSuccess {Number} profile.age Users age.
  21. * @apiSuccess {String} profile.image Avatar-Image.
  22. * @apiSuccess {Object[]} options List of Users options (Array of Objects).
  23. * @apiSuccess {String} options.name Option Name.
  24. * @apiSuccess {String} options.value Option Value.
  25. *
  26. * @apiError NoAccessRight Only authenticated Admins can access the data.
  27. * @apiError UserNotFound The <code>id</code> of the User was not found.
  28. *
  29. * @apiErrorExample Response (example):
  30. * HTTP/1.1 401 Not Authenticated
  31. * {
  32. * "error": "NoAccessRight"
  33. * }
  34. */
  35. function getUser() { return; }
  36. /**
  37. * @api {post} /user Create a new User
  38. * @apiVersion 0.3.0
  39. * @apiName PostUser
  40. * @apiGroup User
  41. * @apiPermission none
  42. *
  43. * @apiDescription In this case "apiErrorStructure" is defined and used.
  44. * Define blocks with params that will be used in several functions, so you dont have to rewrite them.
  45. *
  46. * @apiParam {String} name Name of the User.
  47. *
  48. * @apiSuccess {Number} id The new Users-ID.
  49. *
  50. * @apiUse CreateUserError
  51. */
  52. function postUser() { return; }
  53. /**
  54. * @api {put} /user/:id Change a User
  55. * @apiVersion 0.3.0
  56. * @apiName PutUser
  57. * @apiGroup User
  58. * @apiPermission none
  59. *
  60. * @apiDescription This function has same errors like POST /user, but errors not defined again, they were included with "apiErrorStructure"
  61. *
  62. * @apiParam {String} name Name of the User.
  63. *
  64. * @apiUse CreateUserError
  65. */
  66. function putUser() { return; }