improve apidocs related to allocating Stat Points and user/unlock - fixes #10557 (#10592)

* correct curl parameter (-X for request method; -x for proxy information)

* fix typo in error message

* fix mistakes in apidocs for allocating Stat Points
This commit is contained in:
Alys
2018-08-12 20:11:01 +10:00
committed by Matteo Pagliazzi
parent 1f7dd421d4
commit 2c921609c1
3 changed files with 22 additions and 21 deletions

View File

@@ -2,7 +2,7 @@
module.exports = { module.exports = {
invalidAttribute: '"<%= attr %>" is not a valid Stat.', invalidAttribute: '"<%= attr %>" is not a valid Stat.',
statsObjectRequired: '"stats" update is required', statsObjectRequired: '"stats" object is required',
missingTypeParam: '"req.params.type" is required.', missingTypeParam: '"req.params.type" is required.',
missingKeyParam: '"req.params.key" is required.', missingKeyParam: '"req.params.key" is required.',

View File

@@ -1445,8 +1445,8 @@ api.userSell = {
* @apiParam (Query) {String} path Full path to unlock. See "content" API call for list of items. * @apiParam (Query) {String} path Full path to unlock. See "content" API call for list of items.
* *
* @apiParamExample {curl} * @apiParamExample {curl}
* curl -x POST http://habitica.com/api/v3/user/unlock?path=background.midnight_clouds * curl -X POST http://habitica.com/api/v3/user/unlock?path=background.midnight_clouds
* curl -x POST http://habitica.com/api/v3/user/unlock?path=hair.color.midnight * curl -X POST http://habitica.com/api/v3/user/unlock?path=hair.color.midnight
* *
* @apiSuccess {Object} data.purchased * @apiSuccess {Object} data.purchased
* @apiSuccess {Object} data.items * @apiSuccess {Object} data.items

View File

@@ -5,24 +5,24 @@ import { authWithHeaders } from '../../../middlewares/auth';
let api = {}; let api = {};
/** /**
* @api {post} /api/v3/user/allocate Allocate a single attribute point * @api {post} /api/v3/user/allocate Allocate a single Stat Point (previously called Attribute Point)
* @apiName UserAllocate * @apiName UserAllocate
* @apiGroup User * @apiGroup User
* *
* @apiParam (Body) {String="str","con","int","per"} stat Query parameter - Default ='str' * @apiParam (Query) {String="str","con","int","per"} stat The Stat to increase. Default is 'str'
* *
* @apiParamExample {json} Example request * @apiParamExample {curl}
* {"stat":"int"} * curl -X POST -d "" https://habitica.com/api/v3/user/allocate?stat=int
* *
* @apiSuccess {Object} data Returns stats from the user profile * @apiSuccess {Object} data Returns stats and notifications from the user profile
* *
* @apiError {NotAuthorized} NoPoints Not enough attribute points to increment a stat. * @apiError {NotAuthorized} NoPoints You don't have enough Stat Points.
* *
* @apiErrorExample {json} * @apiErrorExample {json}
* { * {
* "success": false, * "success": false,
* "error": "NotAuthorized", * "error": "NotAuthorized",
* "message": "You don't have enough attribute points." * "message": "You don't have enough Stat Points."
* } * }
*/ */
api.allocate = { api.allocate = {
@@ -40,7 +40,7 @@ api.allocate = {
}; };
/** /**
* @api {post} /api/v3/user/allocate-bulk Allocate multiple attribute points * @api {post} /api/v3/user/allocate-bulk Allocate multiple Stat Points
* @apiName UserAllocateBulk * @apiName UserAllocateBulk
* @apiGroup User * @apiGroup User
* *
@@ -49,22 +49,22 @@ api.allocate = {
* @apiParamExample {json} Example request * @apiParamExample {json} Example request
* { * {
* stats: { * stats: {
* 'int': int, * "int": int,
* 'str': int, * "str": str,
* 'con': int, * "con": con,
* 'per': int, * "per": per
* }, * }
* } * }
* *
* @apiSuccess {Object} data Returns stats from the user profile * @apiSuccess {Object} data Returns stats and notifications from the user profile
* *
* @apiError {NotAuthorized} NoPoints Not enough attribute points to increment a stat. * @apiError {NotAuthorized} NoPoints You don't have enough Stat Points.
* *
* @apiErrorExample {json} * @apiErrorExample {json}
* { * {
* "success": false, * "success": false,
* "error": "NotAuthorized", * "error": "NotAuthorized",
* "message": "You don't have enough attribute points." * "message": "You don't have enough Stat Points."
* } * }
*/ */
api.allocateBulk = { api.allocateBulk = {
@@ -82,7 +82,7 @@ api.allocateBulk = {
}; };
/** /**
* @api {post} /api/v3/user/allocate-now Allocate all attribute points * @api {post} /api/v3/user/allocate-now Allocate all Stat Points
* @apiDescription Uses the user's chosen automatic allocation method, or if none, assigns all to STR. Note: will return success, even if there are 0 points to allocate. * @apiDescription Uses the user's chosen automatic allocation method, or if none, assigns all to STR. Note: will return success, even if there are 0 points to allocate.
* @apiName UserAllocateNow * @apiName UserAllocateNow
* @apiGroup User * @apiGroup User
@@ -119,7 +119,8 @@ api.allocateBulk = {
* "per": 0, * "per": 0,
* "str": 0, * "str": 0,
* "con": 0 * "con": 0
* } * },
* "notifications": [ .... ],
* } * }
* } * }
* *