mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
finish linting server
This commit is contained in:
@@ -28,16 +28,20 @@ const api = {};
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/user/auth/local/register Register
|
||||
* @apiDescription Register a new user with email, login name, and password or attach local auth to a social user
|
||||
* @apiDescription Register a new user with email, login name, and password or
|
||||
* attach local auth to a social user
|
||||
* @apiName UserRegisterLocal
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiParam (Body) {String} username Login name of the new user. Must be 1-36 characters, containing only a-z, 0-9, hyphens (-), or underscores (_).
|
||||
* @apiParam (Body) {String} username Login name of the new user.
|
||||
* Must be 1-36 characters, containing only a-z, 0-9,
|
||||
* hyphens (-), or underscores (_).
|
||||
* @apiParam (Body) {String} email Email address of the new user
|
||||
* @apiParam (Body) {String} password Password for the new user
|
||||
* @apiParam (Body) {String} confirmPassword Password confirmation
|
||||
*
|
||||
* @apiSuccess {Object} data The user object, if local auth was just attached to a social user then only user.auth.local
|
||||
* @apiSuccess {Object} data The user object, if local auth was just
|
||||
* attached to a social user then only user.auth.local
|
||||
*/
|
||||
api.registerLocal = {
|
||||
method: 'POST',
|
||||
@@ -60,8 +64,10 @@ api.registerLocal = {
|
||||
* @apiParam (Body) {String} password The user's password
|
||||
*
|
||||
* @apiSuccess {String} data._id The user's unique identifier
|
||||
* @apiSuccess {String} data.apiToken The user's api token that must be used to authenticate requests.
|
||||
* @apiSuccess {Boolean} data.newUser Returns true if the user was just created (always false for local login).
|
||||
* @apiSuccess {String} data.apiToken The user's api token
|
||||
* that must be used to authenticate requests.
|
||||
* @apiSuccess {Boolean} data.newUser Returns true if the user was just created
|
||||
* (always false for local login).
|
||||
*/
|
||||
api.loginLocal = {
|
||||
method: 'POST',
|
||||
@@ -404,7 +410,8 @@ api.resetPasswordSetNewOne = {
|
||||
|
||||
/**
|
||||
* @api {delete} /api/v3/user/auth/social/:network Delete social authentication method
|
||||
* @apiDescription Remove a social authentication method (only facebook supported) from a user profile. The user must have local authentication enabled
|
||||
* @apiDescription Remove a social authentication method (only facebook supported)
|
||||
* from a user profile. The user must have local authentication enabled
|
||||
* @apiName UserDeleteSocial
|
||||
* @apiGroup User
|
||||
*
|
||||
|
||||
@@ -58,12 +58,14 @@ const api = {};
|
||||
* @apiSuccess {UUID} challenge._id Same as `challenge.id`.
|
||||
* @apiSuccess {String} challenge.prize Number of gems offered as prize to winner (can be 0).
|
||||
* @apiSuccess {String} challenge.memberCount Number users participating in challenge.
|
||||
* @apiSuccess {Object} challenge.tasksOrder Object containing IDs of the challenge's tasks and rewards in their preferred sort order.
|
||||
* @apiSuccess {Object} challenge.tasksOrder Object containing IDs of the challenge's
|
||||
* tasks and rewards in their preferred sort order.
|
||||
* @apiSuccess {Array} challenge.tasksOrder.rewards Array of `reward` task IDs.
|
||||
* @apiSuccess {Array} challenge.tasksOrder.todos Array of `todo` task IDs.
|
||||
* @apiSuccess {Array} challenge.tasksOrder.dailys Array of `daily` task IDs.
|
||||
* @apiSuccess {Array} challenge.tasksOrder.habits Array of `habit` task IDs.
|
||||
* @apiSuccess {Boolean} challenge.official Boolean indicating if this is an official Habitica challenge.
|
||||
* @apiSuccess {Boolean} challenge.official Boolean indicating if
|
||||
* this is an official Habitica challenge.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -159,24 +161,32 @@ const api = {};
|
||||
* @api {post} /api/v3/challenges Create a new challenge
|
||||
* @apiName CreateChallenge
|
||||
* @apiGroup Challenge
|
||||
* @apiDescription Creates a challenge. Cannot create associated tasks with this route. See <a href="#api-Task-CreateChallengeTasks">CreateChallengeTasks</a>.
|
||||
* @apiDescription Creates a challenge. Cannot create associated
|
||||
* tasks with this route. See <a href="#api-Task-CreateChallengeTasks">CreateChallengeTasks</a>.
|
||||
*
|
||||
* @apiParam (Body) {Object} challenge An object representing the challenge to be created
|
||||
* @apiParam (Body) {UUID} challenge.group The id of the group to which the challenge belongs
|
||||
* @apiParam (Body) {String} challenge.name The full name of the challenge
|
||||
* @apiParam (Body) {String} challenge.shortName A shortened name for the challenge, to be used as a tag
|
||||
* @apiParam (Body) {String} [challenge.summary] A short summary advertising the main purpose of the challenge; maximum 250 characters; if not supplied, challenge.name will be used
|
||||
* @apiParam (Body) {String} challenge.shortName A shortened name for the challenge,
|
||||
* to be used as a tag.
|
||||
* @apiParam (Body) {String} [challenge.summary] A short summary advertising the main purpose
|
||||
* of the challenge; maximum 250 characters;
|
||||
* if not supplied, challenge.name will be used.
|
||||
* @apiParam (Body) {String} [challenge.description] A detailed description of the challenge
|
||||
* @apiParam (Body) {Boolean} [official=false] Whether or not a challenge is an official Habitica challenge (requires admin)
|
||||
* @apiParam (Body) {Number} [challenge.prize=0] Number of gems offered as a prize to challenge winner
|
||||
* @apiParam (Body) {Boolean} [official=false] Whether or not a challenge is an official
|
||||
* Habitica challenge (requires admin).
|
||||
* @apiParam (Body) {Number} [challenge.prize=0] Number of gems offered as
|
||||
* a prize to challenge winner.
|
||||
*
|
||||
* @apiSuccess (201) {Object} challenge The newly created challenge.
|
||||
* @apiUse SuccessfulChallengeRequest
|
||||
*
|
||||
* @apiUse ChallengeSuccessExample
|
||||
*
|
||||
* @apiError (401) {NotAuthorized} CantAffordPrize User does not have enough gems to offer this prize.
|
||||
* @apiError (400) {BadRequest} ChallengeValidationFailed Invalid or missing parameter in challenge body.
|
||||
* @apiError (401) {NotAuthorized} CantAffordPrize User does not have enough
|
||||
gems to offer this prize.
|
||||
* @apiError (400) {BadRequest} ChallengeValidationFailed Invalid or missing parameter
|
||||
in challenge body.
|
||||
*
|
||||
* @apiUse GroupNotFound
|
||||
* @apiUse UserNotFound
|
||||
@@ -282,7 +292,9 @@ api.joinChallenge = {
|
||||
* @apiName LeaveChallenge
|
||||
* @apiGroup Challenge
|
||||
* @apiParam (Path) {UUID} challengeId The challenge _id
|
||||
* @apiParam (Body) {String="remove-all","keep-all"} [keep="keep-all"] Whether or not to keep or remove the challenge's tasks
|
||||
* @apiParam (Body) {String="remove-all","keep-all"} [keep="keep-all"] Whether or not to
|
||||
* keep or remove the
|
||||
* challenge's tasks.
|
||||
*
|
||||
* @apiSuccess {Object} data An empty object
|
||||
*
|
||||
@@ -328,9 +340,12 @@ api.leaveChallenge = {
|
||||
* @api {get} /api/v3/challenges/user Get challenges for a user
|
||||
* @apiName GetUserChallenges
|
||||
* @apiGroup Challenge
|
||||
* @apiDescription Get challenges the user has access to. Includes public challenges, challenges belonging to the user's group, and challenges the user has already joined.
|
||||
* @apiDescription Get challenges the user has access to. Includes public challenges,
|
||||
* challenges belonging to the user's group, and challenges the user has already joined.
|
||||
*
|
||||
* @apiSuccess {Object[]} challenges An array of challenges sorted with official challenges first, followed by the challenges in order from newest to oldest
|
||||
* @apiSuccess {Object[]} challenges An array of challenges sorted with official
|
||||
* challenges first, followed by the challenges
|
||||
* in order from newest to oldest.
|
||||
*
|
||||
* @apiUse SuccessfulChallengeRequest
|
||||
*
|
||||
@@ -431,9 +446,11 @@ api.getUserChallenges = {
|
||||
* @apiName GetGroupChallenges
|
||||
* @apiGroup Challenge
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted)
|
||||
*
|
||||
* @apiSuccess {Array} data An array of challenges sorted with official challenges first, followed by the challenges in order from newest to oldest
|
||||
* @apiSuccess {Array} data An array of challenges sorted with official challenges first,
|
||||
* followed by the challenges in order from newest to oldest.
|
||||
*
|
||||
* @apiUse SuccessfulChallengeRequest
|
||||
* @apiUse ChallengeArrayExample
|
||||
|
||||
@@ -55,7 +55,8 @@ function textContainsBannedSlur (message) {
|
||||
* @apiGroup Chat
|
||||
* @apiDescription Fetches an array of messages from a group
|
||||
*
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and
|
||||
* 'habitrpg' for tavern are accepted).
|
||||
*
|
||||
* @apiSuccess {Array} data An array of <a href='https://github.com/HabitRPG/habitica/blob/develop/website/server/models/group.js#L51' target='_blank'>chat messages</a>
|
||||
*
|
||||
@@ -95,13 +96,16 @@ const mentionRegex = new RegExp('\\B@[-\\w]+', 'g');
|
||||
* @apiGroup Chat
|
||||
* @apiDescription Posts a chat message to a group
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted)
|
||||
* @apiParam (Body) {String} message Message The message to post
|
||||
* @apiParam (Query) {UUID} previousMsg The previous chat message's UUID which will force a return of the full group chat
|
||||
* @apiParam (Query) {UUID} previousMsg The previous chat message's UUID which will
|
||||
* force a return of the full group chat.
|
||||
*
|
||||
* @apiUse GroupNotFound
|
||||
* @apiUse GroupIdRequired
|
||||
* @apiError (400) {NotAuthorized} chatPriviledgesRevoked You cannot do that because your chat privileges have been revoked.
|
||||
* @apiError (400) {NotAuthorized} chatPriviledgesRevoked You cannot do that because
|
||||
* your chat privileges have been revoked.
|
||||
*/
|
||||
api.postChat = {
|
||||
method: 'POST',
|
||||
@@ -270,7 +274,8 @@ api.postChat = {
|
||||
* @apiGroup Chat
|
||||
* @apiDescription Likes a chat message from a group
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted).
|
||||
* @apiParam (Path) {UUID} chatId The chat message _id
|
||||
*
|
||||
* @apiSuccess {Object} data The liked <a href='https://github.com/HabitRPG/habitica/blob/develop/website/server/models/group.js#L51' target='_blank'>chat message</a>
|
||||
@@ -314,11 +319,14 @@ api.likeChat = {
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/groups/:groupId/chat/:chatId/flag Flag a group chat message
|
||||
* @apiDescription A message will be hidden from chat if two or more users flag a message. It will be hidden immediately if a moderator flags the message. An email is sent to the moderators about every flagged message.
|
||||
* @apiDescription A message will be hidden from chat if two or more users flag a message.
|
||||
* It will be hidden immediately if a moderator flags the message.
|
||||
* An email is sent to the moderators about every flagged message.
|
||||
* @apiName FlagChat
|
||||
* @apiGroup Chat
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} chatId The chat message id
|
||||
* @apiParam (Body) {String} [comment] explain why the message was flagged
|
||||
*
|
||||
@@ -336,8 +344,10 @@ api.likeChat = {
|
||||
* @apiUse MessageNotFound
|
||||
* @apiUse GroupIdRequired
|
||||
* @apiUse ChatIdRequired
|
||||
* @apiError (404) {NotFound} AlreadyFlagged Chat messages cannot be flagged more than once by a user
|
||||
* @apiError (404) {NotFound} messageGroupChatFlagAlreadyReported The message has already been flagged
|
||||
* @apiError (404) {NotFound} AlreadyFlagged Chat messages cannot be flagged
|
||||
more than once by a user
|
||||
* @apiError (404) {NotFound} messageGroupChatFlagAlreadyReported The message
|
||||
has already been flagged.
|
||||
*/
|
||||
api.flagChat = {
|
||||
method: 'POST',
|
||||
@@ -352,12 +362,14 @@ api.flagChat = {
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/groups/:groupId/chat/:chatId/clearflags Clear flags
|
||||
* @apiDescription Resets the flag count on a chat message. Retains the id of the user's that have flagged the message. (Only visible to moderators)
|
||||
* @apiDescription Resets the flag count on a chat message.
|
||||
* Retains the id of the user's that have flagged the message. (Only visible to moderators)
|
||||
* @apiPermission Admin
|
||||
* @apiName ClearFlags
|
||||
* @apiGroup Chat
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} chatId The chat message id
|
||||
*
|
||||
* @apiSuccess {Object} data An empty object
|
||||
@@ -433,7 +445,8 @@ api.clearChatFlags = {
|
||||
* @apiName SeenChat
|
||||
* @apiGroup Chat
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted)
|
||||
*
|
||||
* @apiSuccess {Object} data An empty object
|
||||
* @apiUse GroupIdRequired
|
||||
@@ -492,18 +505,23 @@ api.seenChat = {
|
||||
* @apiGroup Chat
|
||||
* @apiDescription Delete's a chat message from a group
|
||||
*
|
||||
* @apiParam (Query) {UUID} previousMsg The last message's ID fetched by the client so that the whole chat will be returned only if new messages have been posted in the meantime
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Query) {UUID} previousMsg The last message's ID fetched by the
|
||||
* client so that the whole chat will be returned only
|
||||
* if new messages have been posted in the meantime.
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted).
|
||||
* @apiParam (Path) {UUID} chatId The chat message id
|
||||
*
|
||||
* @apiSuccess data The updated chat array or an empty object if no message was posted after previousMsg
|
||||
* @apiSuccess data The updated chat array or an empty object if no message was posted
|
||||
* after previousMsg.
|
||||
* @apiSuccess {Object} data An empty object when the previous message was deleted
|
||||
*
|
||||
* @apiUse GroupNotFound
|
||||
* @apiUse MessageNotFound
|
||||
* @apiUse GroupIdRequired
|
||||
* @apiUse ChatIdRequired
|
||||
* @apiError (400) onlyCreatorOrAdminCanDeleteChat Only the creator of the message and admins can delete a chat message
|
||||
* @apiError (400) onlyCreatorOrAdminCanDeleteChat Only the creator of the message and admins
|
||||
can delete a chat message.
|
||||
*/
|
||||
api.deleteChat = {
|
||||
method: 'DELETE',
|
||||
|
||||
@@ -71,7 +71,15 @@ async function saveContentToDisk (language, content) {
|
||||
* @apiName ContentGet
|
||||
* @apiGroup Content
|
||||
*
|
||||
* @apiParam (Query) {String="bg","cs","da","de","en","en@pirate","en_GB","es","es_419","fr","he","hu","id","it","ja","nl","pl","pt","pt_BR","ro","ru","sk","sr","sv","uk","zh","zh_TW"} [language=en] Language code used for the items' strings. If the authenticated user makes the request, the content will return with the user's configured language.
|
||||
* @apiParam (Query) {String="bg","cs","da","de",
|
||||
* "en","en@pirate","en_GB",
|
||||
* "es","es_419","fr","he","hu",
|
||||
* "id","it","ja","nl","pl","pt","pt_BR",
|
||||
* "ro","ru","sk","sr","sv",
|
||||
* "uk","zh","zh_TW"} [language=en] Language code used for the items'
|
||||
* strings. If the authenticated user makes
|
||||
* the request, the content will return with
|
||||
* the user's configured language.
|
||||
*
|
||||
* @apiSuccess {Object} data Various data about the content of Habitica. The content route
|
||||
* contains many keys, but the data listed below are the recomended data to use.
|
||||
@@ -84,8 +92,9 @@ async function saveContentToDisk (language, content) {
|
||||
* @apiSuccess {Object} data.armoire Data about the armoire.
|
||||
* @apiSuccess {Array} data.classes The available classes.
|
||||
* @apiSuccess {Object} data.eggs All available eggs.
|
||||
* @apiSuccess {Object} data.timeTravelStable The animals available in the Time Traveler's stable, separated
|
||||
* into pets and mounts.
|
||||
* @apiSuccess {Object} data.timeTravelStable The animals available
|
||||
* in the Time Traveler's stable, separated
|
||||
* into pets and mounts.
|
||||
* @apiSuccess {Object} data.hatchingPotions All the hatching potions.
|
||||
* @apiSuccess {Object} data.petInfo All the pets with extra info.
|
||||
* @apiSuccess {Object} data.mountInfo All the mounts with extra info.
|
||||
|
||||
@@ -56,12 +56,15 @@ api.getCoupons = {
|
||||
* @apiGroup Coupon
|
||||
* @apiPermission sudo
|
||||
*
|
||||
* @apiParam (Path) {String=wondercon,google_6mo} event The event for which the coupon should be generated
|
||||
* @apiParam (Path) {String=wondercon,google_6mo} event The event for which the coupon
|
||||
* should be generated
|
||||
* @apiParam (Query) {Number} count The number of coupon codes to generate
|
||||
*
|
||||
* @apiSuccess {Array} data Generated coupons
|
||||
*
|
||||
* @apiError (400) {BadRequest} CouponValidationError The request was missing the count query parameter or used an invalid event.
|
||||
* @apiError (400) {BadRequest} CouponValidationError The request was missing the
|
||||
* count query parameter or used
|
||||
* an invalid event.
|
||||
*
|
||||
*/
|
||||
api.generateCoupons = {
|
||||
|
||||
@@ -8,7 +8,8 @@ const { content } = common;
|
||||
|
||||
/**
|
||||
* @apiDefine Development Development
|
||||
* These routes only exist while Habitica is in development mode. (Such as running a local instance on your computer)
|
||||
* These routes only exist while Habitica is in development mode.
|
||||
* (Such as running a local instance on your computer).
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,7 +52,8 @@ const TECH_ASSISTANCE_EMAIL = nconf.get('EMAILS_TECH_ASSISTANCE_EMAIL');
|
||||
|
||||
/**
|
||||
* @apiDefine messageGroupRequiresInvite
|
||||
* @apiError (400) {NotAuthorized} messageGroupRequiresInvite Group requires an invitation to join (e.g. private group, party)
|
||||
* @apiError (400) {NotAuthorized} messageGroupRequiresInvite Group requires an invitation
|
||||
* to join (e.g. private group, party).
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -81,7 +82,8 @@ const api = {};
|
||||
* @apiError (401) {NotAuthorized} messageInsufficientGems User does not have enough gems (4)
|
||||
* @apiError (401) {NotAuthorized} partyMustbePrivate Party must have privacy set to private
|
||||
* @apiError (401) {NotAuthorized} messageGroupAlreadyInParty
|
||||
* @apiError (401) {NotAuthorized} chatPrivilegesRevoked You cannot do this because your chat privileges have been removed...
|
||||
* @apiError (401) {NotAuthorized} chatPrivilegesRevoked You cannot do this because your chat
|
||||
privileges have been removed...
|
||||
*
|
||||
* @apiSuccess (201) {Object} data The created group (See <a href="https://github.com/HabitRPG/habitica/blob/develop/website/server/models/group.js" target="_blank">/website/server/models/group.js</a>)
|
||||
*
|
||||
@@ -264,9 +266,16 @@ api.createGroupPlan = {
|
||||
* @apiName GetGroups
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Query) {String} type The type of groups to retrieve. Must be a query string representing a list of values like 'tavern,party'. Possible values are party, guilds, privateGuilds, publicGuilds, tavern
|
||||
* @apiParam (Query) {String="true","false"} [paginate] Public guilds support pagination. When true guilds are returned in groups of 30
|
||||
* @apiParam (Query) {Number} [page] When pagination is enabled for public guilds this parameter can be used to specify the page number (the initial page is number 0 and not required)
|
||||
* @apiParam (Query) {String} type The type of groups to retrieve.
|
||||
* Must be a query string representing a list of values
|
||||
* like 'tavern,party'. Possible values are party, guilds,
|
||||
* privateGuilds, publicGuilds, tavern.
|
||||
* @apiParam (Query) {String="true","false"} [paginate] Public guilds support pagination.
|
||||
* When true guilds are returned in
|
||||
* groups of 30.
|
||||
* @apiParam (Query) {Number} [page] When pagination is enabled for public guilds this
|
||||
parameter can be used to specify the page number
|
||||
(the initial page is number 0 and not required).
|
||||
*
|
||||
* @apiParamExample {json} Private Guilds, Tavern:
|
||||
* {
|
||||
@@ -274,7 +283,8 @@ api.createGroupPlan = {
|
||||
* }
|
||||
*
|
||||
* @apiError (400) {BadRequest} groupTypesRequired Group types are required
|
||||
* @apiError (400) {BadRequest} guildsPaginateBooleanString Paginate query parameter must be a boolean (true or false)
|
||||
* @apiError (400) {BadRequest} guildsPaginateBooleanString Paginate query parameter
|
||||
* must be a boolean (true or false).
|
||||
* @apiError (400) {BadRequest} queryPageInteger Page query parameter must be a positive integer
|
||||
* @apiError (400) {BadRequest} guildsOnlyPaginate Only public guilds support pagination
|
||||
*
|
||||
@@ -362,7 +372,8 @@ api.getGroups = {
|
||||
* @apiName GetGroup
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party
|
||||
* and 'habitrpg' for tavern are accepted)
|
||||
*
|
||||
* @apiParamExample {String} Tavern:
|
||||
* /api/v3/groups/habitrpg
|
||||
@@ -419,12 +430,14 @@ api.getGroup = {
|
||||
* @apiName UpdateGroup
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted).
|
||||
*
|
||||
* @apiParamExample {String} Tavern:
|
||||
* /api/v3/groups/habitrpg
|
||||
*
|
||||
* @apiError (400) {NotAuthorized} messageGroupOnlyLeaderCanUpdate Only the group's leader can update the party
|
||||
* @apiError (400) {NotAuthorized} messageGroupOnlyLeaderCanUpdate Only the group's leader
|
||||
* can update the party.
|
||||
*
|
||||
* @apiSuccess {Object} data The updated group (See <a href="https://github.com/HabitRPG/habitica/blob/develop/website/server/models/group.js" target="_blank">/website/server/models/group.js</a>)
|
||||
*
|
||||
@@ -485,7 +498,8 @@ api.updateGroup = {
|
||||
* @apiName JoinGroup
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted).
|
||||
*
|
||||
* @apiParamExample {String} Tavern:
|
||||
* /api/v3/groups/habitrpg/join
|
||||
@@ -667,7 +681,8 @@ api.joinGroup = {
|
||||
* @apiName RejectGroupInvite
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted).
|
||||
*
|
||||
* @apiParamExample {String} party:
|
||||
* /api/v3/groups/party/reject-invite
|
||||
@@ -735,9 +750,16 @@ function _removeMessagesFromMember (member, groupId) {
|
||||
* @apiName LeaveGroup
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Query) {String="remove-all","keep-all"} keep=keep-all Whether or not to keep challenge tasks belonging to the group being left.
|
||||
* @apiParam (Body) {String="remain-in-challenges","leave-challenges"} [keepChallenges=leave-challenges] Whether or not to remain in the challenges of the group being left.
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted).
|
||||
* @apiParam (Query) {String="remove-all","keep-all"} keep=keep-all Whether or not to keep
|
||||
* challenge tasks belonging to
|
||||
* the group being left.
|
||||
* @apiParam (Body) {String="remain-in-challenges"
|
||||
* ,"leave-challenges"} [keepChallenges=leave-challenges] Whether or not
|
||||
* to remain in the
|
||||
* challenges of the
|
||||
* group being left.
|
||||
*
|
||||
* @apiParamExample {json} Leave Party:
|
||||
* /api/v3/groups/party/leave
|
||||
@@ -746,8 +768,11 @@ function _removeMessagesFromMember (member, groupId) {
|
||||
* }
|
||||
*
|
||||
* @apiError (400) {BadRequest} keepOrRemoveAll "keep" parameter is not "remove-all" or "keep-all"
|
||||
* @apiError (400) {NotAuthorized} questLeaderCannotLeaveGroup User could not leave party because they are the owner of a quest currently running
|
||||
* @apiError (400) {NotAuthorized} cannotLeaveWhileActiveQuest User could not leave party due to being in a quest
|
||||
* @apiError (400) {NotAuthorized} questLeaderCannotLeaveGroup User could not leave party because
|
||||
* they are the owner of a quest
|
||||
* currently running.
|
||||
* @apiError (400) {NotAuthorized} cannotLeaveWhileActiveQuest User could not leave party due to
|
||||
* being in a quest.
|
||||
*
|
||||
* @apiSuccess {Object} data An empty object
|
||||
*
|
||||
@@ -827,7 +852,8 @@ function _sendMessageToRemoved (group, removedUser, message, isInGroup) {
|
||||
* @apiName RemoveGroupMember
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted).
|
||||
* @apiParam (Path) {UUID} memberId The _id of the member to remove
|
||||
* @apiParam (Query) {String} message Query parameter - The message to send to the removed members
|
||||
*
|
||||
@@ -835,7 +861,8 @@ function _sendMessageToRemoved (group, removedUser, message, isInGroup) {
|
||||
* /api/v3/groups/party/removeMember/[User's ID]?message=Bye
|
||||
*
|
||||
* @apiError (400) {BadRequest} userIdrequired "memberId" cannot be empty or not a UUID
|
||||
* @apiError (400) {NotAuthorized} onlyLeaderCanRemoveMember Only the group leader can remove members
|
||||
* @apiError (400) {NotAuthorized} onlyLeaderCanRemoveMember Only the group
|
||||
leader can remove members.
|
||||
* @apiError (400) {NotAuthorized} memberCannotRemoveYourself Group leader cannot remove themselves
|
||||
* @apiError (404) {NotFound} groupMemberNotFound Group member was not found
|
||||
*
|
||||
@@ -952,11 +979,14 @@ api.removeGroupMember = {
|
||||
* @api {post} /api/v3/groups/:groupId/invite Invite users to a group
|
||||
* @apiName InviteToGroup
|
||||
* @apiGroup Group
|
||||
* @apiDescription You can provide both `emails` and `uuids`, or just one. You must provide at least one.
|
||||
* @apiDescription You can provide both `emails` and `uuids`, or just one.
|
||||
* You must provide at least one.
|
||||
*
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {String} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted)
|
||||
*
|
||||
* @apiParam (Body) {Object[]} [emails] An array of objects, each representing one email address to invite
|
||||
* @apiParam (Body) {Object[]} [emails] An array of objects, each representing one
|
||||
* email address to invite.
|
||||
* @apiParam (Body) {String} emails.email The email address of the user being invited.
|
||||
* @apiParam (Body) {String} [emails.name] The name of the user being invited.
|
||||
* @apiParam (Body) {Array} [uuids] An array of uuids to invite
|
||||
@@ -982,8 +1012,10 @@ api.removeGroupMember = {
|
||||
* }
|
||||
*
|
||||
* @apiSuccess {Array} data The invites
|
||||
* @apiSuccess {Object} data[0] If the invitation was a User ID, you'll receive back an object. You'll receive one Object for each succesful User ID invite.
|
||||
* @apiSuccess {String} data[1] If the invitation was an email, you'll receive back the email. You'll receive one String for each successful email invite.
|
||||
* @apiSuccess {Object} data[0] If the invitation was a User ID, you'll receive back an object.
|
||||
* You'll receive one Object for each succesful User ID invite.
|
||||
* @apiSuccess {String} data[1] If the invitation was an email, you'll receive back the email.
|
||||
* You'll receive one String for each successful email invite.
|
||||
*
|
||||
* @apiSuccessExample {json} Successful Response with Emails
|
||||
* {
|
||||
@@ -1010,20 +1042,30 @@ api.removeGroupMember = {
|
||||
*
|
||||
* @apiUse GroupBodyInvalid
|
||||
*
|
||||
* @apiError (400) {BadRequest} NoEmailProvided An email address was not provided in the `emails` body
|
||||
* param `Array`.
|
||||
* @apiError (400) {BadRequest} UuidOrEmailOnly The `emails` and `uuids` params were both missing and/or a
|
||||
* key other than `emails` or `uuids` was provided in the body param.
|
||||
* @apiError (400) {BadRequest} CannotInviteSelf User ID or email of invitee matches that of the inviter.
|
||||
* @apiError (400) {BadRequest} NoEmailProvided An email address was not provided
|
||||
* in the `emails` body param `Array`.
|
||||
* @apiError (400) {BadRequest} UuidOrEmailOnly The `emails` and `uuids` params
|
||||
* were both missing and/or a.
|
||||
* key other than `emails` or `uuids` was provided
|
||||
* in the body param.
|
||||
* @apiError (400) {BadRequest} CannotInviteSelf User ID or email of invitee matches
|
||||
* that of the inviter.
|
||||
* @apiError (400) {BadRequest} MustBeArray The `uuids` or `emails` body param was not an array.
|
||||
* @apiError (400) {BadRequest} TooManyInvites A max of 100 invites (combined emails and User IDs) can
|
||||
* be sent out at a time.
|
||||
* @apiError (400) {BadRequest} TooManyInvites A max of 100 invites (combined
|
||||
* emails and User IDs) can
|
||||
* be sent out at a time.
|
||||
* @apiError (400) {BadRequest} ExceedsMembersLimit A max of 30 members can join a party.
|
||||
*
|
||||
* @apiError (401) {NotAuthorized} UserAlreadyInvited The user has already been invited to the group.
|
||||
* @apiError (401) {NotAuthorized} UserAlreadyInvited The user has already
|
||||
* been invited to the group.
|
||||
* @apiError (401) {NotAuthorized} UserAlreadyInGroup The user is already a member of the group.
|
||||
* @apiError (401) {NotAuthorized} CannotInviteWhenMuted You cannot invite anyone to a guild or party because your chat privileges have been revoked.
|
||||
* @apiError (401) {NotAuthorized} NotAuthorizedToSendMessageToThisUser You can't send a message to this player because they have chosen to block messages.
|
||||
* @apiError (401) {NotAuthorized} CannotInviteWhenMuted You cannot invite anyone
|
||||
* to a guild or party because your
|
||||
* chat privileges have been revoked.
|
||||
* @apiError (401) {NotAuthorized} NotAuthorizedToSendMessageToThisUser You can't send a
|
||||
* message to this player
|
||||
* because they have chosen to
|
||||
* block messages.
|
||||
*
|
||||
* @apiUse GroupNotFound
|
||||
* @apiUse UserNotFound
|
||||
@@ -1104,7 +1146,8 @@ api.inviteToGroup = {
|
||||
* @apiName AddGroupManager
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted).
|
||||
*
|
||||
* @apiParamExample {String} party:
|
||||
* /api/v3/groups/party/add-manager
|
||||
@@ -1153,7 +1196,8 @@ api.addGroupManager = {
|
||||
* @apiName RemoveGroupManager
|
||||
* @apiGroup Group
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg' for tavern are accepted)
|
||||
* @apiParam (Path) {UUID} groupId The group _id ('party' for the user party and 'habitrpg'
|
||||
* for tavern are accepted).
|
||||
*
|
||||
* @apiParamExample {String} party:
|
||||
* /api/v3/groups/party/add-manager
|
||||
|
||||
@@ -208,7 +208,9 @@ const gemsPerTier = {
|
||||
* @apiGroup Hall
|
||||
* @apiPermission Admin
|
||||
*
|
||||
* @apiDescription Update user's gem balance, contributions & contribution tier and admin status. Grant items, block / unblock user's account and revoke / unrevoke chat privileges.
|
||||
* @apiDescription Update user's gem balance, contributions & contribution tier
|
||||
* and admin status. Grant items, block / unblock user's account
|
||||
* and revoke / unrevoke chat privileges.
|
||||
*
|
||||
* @apiExample Example Body:
|
||||
* {
|
||||
|
||||
@@ -22,9 +22,10 @@ function geti18nBrowserScript (language) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /api/v3/i18n/browser-script Returns a JS script to make all the i18n strings available in the browser
|
||||
* under window.i18n.strings
|
||||
* @apiDescription Does not require authentication.
|
||||
* @api {get} /api/v3/i18n/browser-script Returns the i18n JS script.
|
||||
* @apiDescription Returns the i18n JS script to make
|
||||
* all the i18n strings available in the browser under window.i18n.strings.
|
||||
* Does not require authentication.
|
||||
* @apiName i18nBrowserScriptGet
|
||||
* @apiGroup i18n
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,8 @@ const api = {};
|
||||
* @apiSuccess {Object} data.profile Includes name
|
||||
* @apiSuccess {Object} data.preferences Includes info about appearance and public prefs
|
||||
* @apiSuccess {Object} data.party Includes basic info about current party and quests
|
||||
* @apiSuccess {Object} data.items Basic inventory information includes quests, food, potions, eggs, gear, special items
|
||||
* @apiSuccess {Object} data.items Basic inventory information includes quests,
|
||||
* food, potions, eggs, gear, special items
|
||||
* @apiSuccess {Object} data.achievements Lists current achievements
|
||||
* @apiSuccess {Object} data.auth Includes latest timestamps
|
||||
*
|
||||
@@ -154,7 +155,8 @@ api.getMemberByUsername = {
|
||||
* @api {get} /api/v3/members/:memberId/achievements Get member achievements object
|
||||
* @apiName GetMemberAchievements
|
||||
* @apiGroup Member
|
||||
* @apiDescription Get a list of achievements of the requested member, grouped by basic / seasonal / special.
|
||||
* @apiDescription Get a list of achievements
|
||||
* of the requested member, grouped by basic / seasonal / special.
|
||||
*
|
||||
* @apiParam (Path) {UUID} memberId The member's id
|
||||
*
|
||||
@@ -170,9 +172,12 @@ api.getMemberByUsername = {
|
||||
* @apiSuccess {String} data.*.achievements.title The localized title string
|
||||
* @apiSuccess {String} data.*.achievements.text The localized description string
|
||||
* @apiSuccess {Boolean} data.*.achievements.earned Whether the user has earned the achievement
|
||||
* @apiSuccess {Number} data.*.achievements.index The unique index assigned to the achievement (only for sorting purposes)
|
||||
* @apiSuccess {Anything} data.*.achievements.value The value related to the achievement (if applicable)
|
||||
* @apiSuccess {Number} data.*.achievements.optionalCount The count related to the achievement (if applicable)
|
||||
* @apiSuccess {Number} data.*.achievements.index The unique index assigned
|
||||
* to the achievement (only for sorting purposes).
|
||||
* @apiSuccess {Anything} data.*.achievements.value The value related to the achievement
|
||||
* (if applicable)
|
||||
* @apiSuccess {Number} data.*.achievements.optionalCount The count related to the achievement
|
||||
* (if applicable)
|
||||
*
|
||||
* @apiSuccessExample {json} Successful Response
|
||||
* {
|
||||
@@ -190,7 +195,9 @@ api.getMemberByUsername = {
|
||||
* },
|
||||
* perfect: {
|
||||
* title: "5 Perfect Days",
|
||||
* text: "Completed all active Dailies on 5 days. With this achievement you get a +level/2 buff to all attributes for the next day. Levels greater than 100 don't have any additional effects on buffs.",
|
||||
* text: "Completed all active Dailies on 5 days. With this achievement
|
||||
* you get a +level/2 buff to all attributes for the next day.
|
||||
* Levels greater than 100 don't have any additional effects on buffs.",
|
||||
* icon: "achievement-perfect",
|
||||
* earned: true,
|
||||
* value: 5,
|
||||
@@ -218,7 +225,8 @@ api.getMemberByUsername = {
|
||||
* achievements: {
|
||||
* habitSurveys: {
|
||||
* title: "Helped Habitica Grow",
|
||||
* text: "Helped Habitica grow on 0 occasions, either by filling out a survey or helping with a major testing effort. Thank you!",
|
||||
* text: "Helped Habitica grow on 0 occasions, either by filling out
|
||||
* a survey or helping with a major testing effort. Thank you!",
|
||||
* icon: "achievement-tree",
|
||||
* earned: false,
|
||||
* value: 0,
|
||||
@@ -229,8 +237,10 @@ api.getMemberByUsername = {
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @apiError (400) {BadRequest} MemberIdRequired The `id` param is required and must be a valid `UUID`
|
||||
* @apiError (404) {NotFound} UserWithIdNotFound The `id` param did not belong to an existing member
|
||||
* @apiError (400) {BadRequest} MemberIdRequired The `id` param is required
|
||||
* and must be a valid `UUID`.
|
||||
* @apiError (404) {NotFound} UserWithIdNotFound The `id` param did not
|
||||
* belong to an existing member.
|
||||
*/
|
||||
api.getMemberAchievements = {
|
||||
method: 'GET',
|
||||
@@ -386,13 +396,21 @@ function _getMembersForItem (type) {
|
||||
|
||||
/**
|
||||
* @api {get} /api/v3/groups/:groupId/members Get members for a group
|
||||
* @apiDescription With a limit of 30 member per request. To get all members run requests against this routes (updating the lastId query parameter) until you get less than 30 results.
|
||||
* @apiDescription With a limit of 30 member per request.
|
||||
* To get all members run requests against this routes (updating the lastId query parameter)
|
||||
* until you get less than 30 results.
|
||||
* @apiName GetMembersForGroup
|
||||
* @apiGroup Member
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group id
|
||||
* @apiParam (Query) {UUID} lastId Query parameter to specify the last member returned in a previous request to this route and get the next batch of results
|
||||
* @apiParam (Query) {Boolean} includeAllPublicFields Query parameter available only when fetching a party. If === `true` then all public fields for members will be returned (like when making a request for a single member)
|
||||
* @apiParam (Query) {UUID} lastId Query parameter to specify the last member
|
||||
* returned in a previous request to this route and
|
||||
* get the next batch of results.
|
||||
* @apiParam (Query) {Boolean} includeAllPublicFields Query parameter available
|
||||
* only when fetching a party. If === `true`
|
||||
* then all public fields for members
|
||||
* will be returned (like when making a request
|
||||
* for a single member).
|
||||
*
|
||||
* @apiSuccess {Array} data An array of members, sorted by _id
|
||||
*
|
||||
@@ -422,12 +440,16 @@ api.getMembersForGroup = {
|
||||
|
||||
/**
|
||||
* @api {get} /api/v3/groups/:groupId/invites Get invites for a group
|
||||
* @apiDescription With a limit of 30 member per request. To get all invites run requests against this routes (updating the lastId query parameter) until you get less than 30 results.
|
||||
* @apiDescription With a limit of 30 member per request. To get all invites run
|
||||
* requests against this routes (updating the lastId query parameter)
|
||||
* until you get less than 30 results.
|
||||
* @apiName GetInvitesForGroup
|
||||
* @apiGroup Member
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The group id
|
||||
* @apiParam (Query) {UUID} lastId Query parameter to specify the last invite returned in a previous request to this route and get the next batch of results
|
||||
* @apiParam (Query) {UUID} lastId Query parameter to specify the last invite
|
||||
* returned in a previous request to this route and
|
||||
* get the next batch of results.
|
||||
*
|
||||
* @apiSuccess {array} data An array of invites, sorted by _id
|
||||
*
|
||||
@@ -459,16 +481,21 @@ api.getInvitesForGroup = {
|
||||
/**
|
||||
* @api {get} /api/v3/challenges/:challengeId/members Get members for a challenge
|
||||
* @apiDescription With a limit of 30 member per request.
|
||||
* To get all members run requests against this routes (updating the lastId query parameter) until you get less than 30 results.
|
||||
* BETA You can also use ?includeAllMembers=true. This option is currently in BETA and may be removed in future.
|
||||
* To get all members run requests against this routes (updating the lastId query parameter)
|
||||
* until you get less than 30 results.
|
||||
* BETA You can also use ?includeAllMembers=true. This option is currently in BETA
|
||||
* and may be removed in future.
|
||||
* Its use is discouraged and its performaces are not optimized especially for large challenges.
|
||||
*
|
||||
* @apiName GetMembersForChallenge
|
||||
* @apiGroup Member
|
||||
*
|
||||
* @apiParam (Path) {UUID} challengeId The challenge id
|
||||
* @apiParam (Query) {UUID} lastId Query parameter to specify the last member returned in a previous request to this route and get the next batch of results
|
||||
* @apiParam (Query) {String} includeAllMembers BETA Query parameter - If 'true' all challenge members are returned
|
||||
* @apiParam (Query) {UUID} lastId Query parameter to specify the last member returned
|
||||
* in a previous request to this route and
|
||||
* get the next batch of results.
|
||||
* @apiParam (Query) {String} includeAllMembers BETA Query parameter - If 'true' all
|
||||
* challenge members are returned.
|
||||
|
||||
* @apiSuccess {Array} data An array of members, sorted by _id
|
||||
*
|
||||
@@ -490,7 +517,8 @@ api.getMembersForChallenge = {
|
||||
* @apiParam (Path) {UUID} challengeId The challenge _id
|
||||
* @apiParam (Path) {UUID} memberId The member _id
|
||||
*
|
||||
* @apiSuccess {Object} data Return an object with member _id, profile.name and a tasks object with the challenge tasks for the member
|
||||
* @apiSuccess {Object} data Return an object with member _id, profile.name
|
||||
* and a tasks object with the challenge tasks for the member.
|
||||
*
|
||||
* @apiSuccessExample {json} Success-Response:
|
||||
* {
|
||||
@@ -586,15 +614,21 @@ api.getChallengeMemberProgress = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @api {get} /api/v3/members/:toUserId/objections/:interaction Get any objections that would occur if the given interaction was attempted - BETA
|
||||
* @api {get} /api/v3/members/:toUserId/objections/:interaction Get objections to interaction
|
||||
* @apiDescription Get any objections that would occur
|
||||
* if the given interaction was attempted - BETA.
|
||||
*
|
||||
* @apiVersion 3.0.0
|
||||
* @apiName GetObjectionsToInteraction
|
||||
* @apiGroup Member
|
||||
*
|
||||
* @apiParam (Path) {UUID} toUserId The user to interact with
|
||||
* @apiParam (Path) {String="send-private-message","transfer-gems"} interaction Name of the interaction to query
|
||||
* @apiParam (Path) {String="send-private-message","transfer-gems"} interaction Name of the
|
||||
* interaction
|
||||
* to query.
|
||||
*
|
||||
* @apiSuccess {Array} data Return an array of objections, if the interaction would be blocked; otherwise an empty array
|
||||
* @apiSuccess {Array} data Return an array of objections,
|
||||
* if the interaction would be blocked; otherwise an empty array.
|
||||
*/
|
||||
api.getObjectionsToInteraction = {
|
||||
method: 'GET',
|
||||
|
||||
@@ -11,12 +11,14 @@ const allModels = ['user', 'tag', 'challenge', 'group'].concat(tasksModels);
|
||||
* @apiName GetUserModelPaths
|
||||
* @apiGroup Meta
|
||||
*
|
||||
* @apiParam (Path) {String="user","group","challenge","tag","habit","daily","todo","reward"} model The name of the model
|
||||
* @apiParam (Path) {String="user","group","challenge","tag","habit",
|
||||
"daily","todo","reward"} model The name of the model
|
||||
*
|
||||
* @apiExample {curl} Tag
|
||||
* curl https://habitica.com/api/v3/models/tag/paths
|
||||
*
|
||||
* @apiSuccess {Object} data A key-value object made of fieldPath: fieldType (like {'field.nested': Boolean})
|
||||
* @apiSuccess {Object} data A key-value object made of fieldPath: fieldType
|
||||
(like {'field.nested': Boolean})
|
||||
*
|
||||
* @apiSuccessExample {json} Tag
|
||||
* {
|
||||
|
||||
@@ -98,7 +98,9 @@ api.readNotifications = {
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/notifications/:notificationId/see Mark one notification as seen
|
||||
* @apiDescription Mark a notification as seen. Different from marking them as read in that the notification isn't removed but the `seen` field is set to `true`
|
||||
* @apiDescription Mark a notification as seen.
|
||||
* Different from marking them as read in that the notification isn't
|
||||
* removed but the `seen` field is set to `true`.
|
||||
* @apiName SeeNotification
|
||||
* @apiGroup Notification
|
||||
*
|
||||
|
||||
@@ -14,7 +14,9 @@ import {
|
||||
|
||||
/**
|
||||
* @apiDefine InvalidUUID
|
||||
* @apiError (400) {BadRequest} InvalidRequestParameters "tagId" must be a valid UUID corresponding to a tag belonging to the user.
|
||||
* @apiError (400) {BadRequest} InvalidRequestParameters "tagId" must be a valid UUID
|
||||
* corresponding to a tag
|
||||
* belonging to the user.
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,7 +35,8 @@ const api = {};
|
||||
* @apiSuccess (201) {Object} data The newly created tag
|
||||
*
|
||||
* @apiSuccessExample {json} Example return:
|
||||
* {"success":true,"data":{"name":"practicetag","id":"8bc0afbf-ab8e-49a4-982d-67a40557ed1a"},"notifications":[]}
|
||||
* {"success":true,"data":{"name":"practicetag","id":"8bc0afbf-ab8e-49a4-982d-67a40557ed1a"},
|
||||
* "notifications":[]}
|
||||
*/
|
||||
api.createTag = {
|
||||
method: 'POST',
|
||||
@@ -59,7 +62,10 @@ api.createTag = {
|
||||
* @apiSuccess {Array} data An array of tags
|
||||
*
|
||||
* @apiSuccessExample {json} Example return:
|
||||
* {"success":true,"data":[{"name":"Work","id":"3d5d324d-a042-4d5f-872e-0553e228553e"},{"name":"apitester","challenge":"true","id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},{"name":"practicetag","id":"8bc0afbf-ab8e-49a4-982d-67a40557ed1a"}],"notifications":[]}
|
||||
* {"success":true,"data":[{"name":"Work",
|
||||
* "id":"3d5d324d-a042-4d5f-872e-0553e228553e"},
|
||||
* {"name":"apitester","challenge":"true","id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},
|
||||
* {"name":"practicetag","id":"8bc0afbf-ab8e-49a4-982d-67a40557ed1a"}],"notifications":[]}
|
||||
*/
|
||||
api.getTags = {
|
||||
method: 'GET',
|
||||
@@ -81,7 +87,8 @@ api.getTags = {
|
||||
* @apiSuccess {Object} data The tag object
|
||||
*
|
||||
* @apiSuccessExample {json} Example return:
|
||||
* {"success":true,"data":{"name":"practicetag","id":"8bc0afbf-ab8e-49a4-982d-67a40557ed1a"},"notifications":[]}
|
||||
* {"success":true,"data":{"name":"practicetag",
|
||||
* "id":"8bc0afbf-ab8e-49a4-982d-67a40557ed1a"},"notifications":[]}
|
||||
*
|
||||
* @apiUse TagNotFound
|
||||
* @apiUSe InvalidUUID
|
||||
@@ -118,7 +125,8 @@ api.getTag = {
|
||||
* @apiSuccess {Object} data The updated tag
|
||||
*
|
||||
* @apiSuccessExample {json} Example result:
|
||||
* {"success":true,"data":{"name":"practice-tag","id":"8bc0afbf-ab8e-49a4-982d-67a40557ed1a"},"notifications":[]}
|
||||
* {"success":true,"data":{"name":"practice-tag",
|
||||
* "id":"8bc0afbf-ab8e-49a4-982d-67a40557ed1a"},"notifications":[]}
|
||||
*
|
||||
* @apiUse TagNotFound
|
||||
* @apiUSe InvalidUUID
|
||||
|
||||
@@ -53,27 +53,52 @@ const requiredGroupFields = '_id leader tasksOrder name';
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/tasks/user Create a new task belonging to the user
|
||||
* @apiDescription Can be passed an object to create a single task or an array of objects to create multiple tasks.
|
||||
* @apiDescription Can be passed an object to create a single task or an array of objects
|
||||
* to create multiple tasks.
|
||||
* @apiName CreateUserTasks
|
||||
* @apiGroup Task
|
||||
*
|
||||
* @apiParam (Body) {String} text The text to be displayed for the task
|
||||
* @apiParam (Body) {String="habit","daily","todo","reward"} type Task type, options are: "habit", "daily", "todo", "reward".
|
||||
* @apiParam (Body) {String="habit","daily","todo","reward"} type Task type, options are: "habit",
|
||||
* "daily", "todo", "reward".
|
||||
* @apiParam (Body) {String[]} [tags] Array of UUIDs of tags
|
||||
* @apiParam (Body) {String} [alias] Alias to assign to task
|
||||
* @apiParam (Body) {String="str","int","per","con"} [attribute] User's attribute to use, options are: "str", "int", "per", "con"
|
||||
* @apiParam (Body) {String="str","int","per","con"} [attribute] User's attribute to use,
|
||||
* options are: "str", "int",
|
||||
* "per", "con"
|
||||
* @apiParam (Body) {Boolean} [collapseChecklist=false] Determines if a checklist will be displayed
|
||||
* @apiParam (Body) {String} [notes] Extra notes
|
||||
* @apiParam (Body) {String} [date] Due date to be shown in task list. Only valid for type "todo."
|
||||
* @apiParam (Body) {Number="0.1","1","1.5","2"} [priority=1] Difficulty, options are 0.1, 1, 1.5, 2; eqivalent of Trivial, Easy, Medium, Hard.
|
||||
* @apiParam (Body) {String[]} [reminders] Array of reminders, each an object that must include: a UUID, startDate and time. For example {"id":"ed427623-9a69-4aac-9852-13deb9c190c3","startDate":"1/16/17","time":"1/16/17" }
|
||||
* @apiParam (Body) {String="weekly","daily"} [frequency=weekly] Value "weekly" enables "On days of the week", value "daily" enables "EveryX Days". Only valid for type "daily".
|
||||
* @apiParam (Body) {String} [repeat=true] List of objects for days of the week, Days that are true will be repeated upon. Only valid for type "daily". Any days not specified will be marked as true. Days are: su, m, t, w, th, f, s. Value of frequency must be "weekly". For example, to skip repeats on Mon and Fri: "repeat":{"f":false,"m":false}
|
||||
* @apiParam (Body) {Number} [everyX=1] Value of frequency must be "daily", the number of days until this daily task is available again.
|
||||
* @apiParam (Body) {Number} [streak=0] Number of days that the task has consecutively been checked off. Only valid for type "daily"
|
||||
* @apiParam (Body) {Date} [startDate] Date when the task will first become available. Only valid for type "daily"
|
||||
* @apiParam (Body) {Boolean} [up=true] Only valid for type "habit" If true, enables the "+" under "Directions/Action" for "Good habits"
|
||||
* @apiParam (Body) {Boolean} [down=true] Only valid for type "habit" If true, enables the "-" under "Directions/Action" for "Bad habits"
|
||||
* @apiParam (Body) {Number="0.1","1","1.5","2"} [priority=1] Difficulty, options are 0.1, 1,
|
||||
* 1.5, 2; eqivalent of Trivial,
|
||||
* Easy, Medium, Hard.
|
||||
* @apiParam (Body) {String[]} [reminders] Array of reminders, each an object that must
|
||||
* include: a UUID, startDate and time.
|
||||
* For example {"id":"ed427623-9a69-4aac-9852-13deb9c190c3",
|
||||
* "startDate":"1/16/17","time":"1/16/17" }
|
||||
* @apiParam (Body) {String="weekly","daily"} [frequency=weekly] Value "weekly" enables
|
||||
* "On days of the week", value
|
||||
* "daily" enables "EveryX Days".
|
||||
* Only valid for type "daily".
|
||||
* @apiParam (Body) {String} [repeat=true] List of objects for days of the week,
|
||||
* Days that are true will be repeated upon.
|
||||
* Only valid for type "daily". Any days not specified
|
||||
* will be marked as true. Days are: su, m, t, w, th,
|
||||
* f, s. Value of frequency must be "weekly".
|
||||
* For example, to skip repeats on Mon and
|
||||
* Fri: "repeat":{"f":false,"m":false}
|
||||
* @apiParam (Body) {Number} [everyX=1] Value of frequency must be "daily",
|
||||
* the number of days until this daily
|
||||
* task is available again.
|
||||
* @apiParam (Body) {Number} [streak=0] Number of days that the task has consecutively
|
||||
* been checked off. Only valid for type "daily"
|
||||
* @apiParam (Body) {Date} [startDate] Date when the task will first become available.
|
||||
* Only valid for type "daily"
|
||||
* @apiParam (Body) {Boolean} [up=true] Only valid for type "habit"
|
||||
* If true, enables the "+" under "Directions/Action"
|
||||
* for "Good habits"-
|
||||
* @apiParam (Body) {Boolean} [down=true] Only valid for type "habit" If true, enables
|
||||
* the "-" under "Directions/Action" for "Bad habits"
|
||||
* @apiParam (Body) {Number} [value=0] Only valid for type "reward." The cost in gold of the reward
|
||||
*
|
||||
* @apiParamExample {json} Request-Example:
|
||||
@@ -135,10 +160,14 @@ const requiredGroupFields = '_id leader tasksOrder name';
|
||||
* }
|
||||
*
|
||||
* @apiError (404) {NotFound} ChecklistNotFound The specified checklist item could not be found.
|
||||
* @apiError (400) {BadRequest} MustBeType Task type must be one of "habit", "daily", "todo", "reward".
|
||||
* @apiError (400) {BadRequest} MustBeType Task type must be one of "habit", "daily",
|
||||
* "todo", "reward".
|
||||
* @apiError (400) {BadRequest} Text-ValidationFailed Path 'text' is required.
|
||||
* @apiError (400) {BadRequest} Alias-ValidationFailed Task short names can only contain alphanumeric characters, underscores and dashes.
|
||||
* @apiError (400) {BadRequest} Value-ValidationFailed `x` is not a valid enum value for path `(body param)`.
|
||||
* @apiError (400) {BadRequest} Alias-ValidationFailed Task short names can only
|
||||
* contain alphanumeric characters,
|
||||
* underscores and dashes.
|
||||
* @apiError (400) {BadRequest} Value-ValidationFailed `x` is not a valid enum value
|
||||
* for path `(body param)`.
|
||||
* @apiError (401) {NotAuthorized} There is no account that uses those credentials.
|
||||
*
|
||||
* @apiErrorExample {json} Error-Response:
|
||||
@@ -187,28 +216,52 @@ api.createUserTasks = {
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/tasks/challenge/:challengeId Create a new task belonging to a challenge
|
||||
* @apiDescription Can be passed an object to create a single task or an array of objects to create multiple tasks.
|
||||
* @apiDescription Can be passed an object to create a single task or an
|
||||
* array of objects to create multiple tasks.
|
||||
* @apiName CreateChallengeTasks
|
||||
* @apiGroup Task
|
||||
*
|
||||
* @apiParam (Path) {UUID} challengeId The id of the challenge the new task(s) will belong to
|
||||
*
|
||||
* @apiParam (Body) {String} text The text to be displayed for the task
|
||||
* @apiParam (Body) {String="habit","daily","todo","reward"} type Task type, options are: "habit", "daily", "todo", "reward".
|
||||
* @apiParam (Body) {String="habit","daily","todo","reward"} type Task type, options are: "habit",
|
||||
* "daily", "todo", "reward".
|
||||
* @apiParam (Body) {String} [alias] Alias to assign to task
|
||||
* @apiParam (Body) {String="str","int","per","con"} [attribute] User's attribute to use, options are: "str", "int", "per", "con"
|
||||
* @apiParam (Body) {String="str","int","per","con"} [attribute] User's attribute to use,
|
||||
* options are: "str",
|
||||
* "int", "per", "con".
|
||||
* @apiParam (Body) {Boolean} [collapseChecklist=false] Determines if a checklist will be displayed
|
||||
* @apiParam (Body) {String} [notes] Extra notes
|
||||
* @apiParam (Body) {String} [date] Due date to be shown in task list. Only valid for type "todo."
|
||||
* @apiParam (Body) {Number="0.1","1","1.5","2"} [priority=1] Difficulty, options are 0.1, 1, 1.5, 2; eqivalent of Trivial, Easy, Medium, Hard.
|
||||
* @apiParam (Body) {String[]} [reminders] Array of reminders, each an object that must include: a UUID, startDate and time. For example {"id":"ed427623-9a69-4aac-9852-13deb9c190c3","startDate":"1/16/17","time":"1/16/17" }
|
||||
* @apiParam (Body) {String="weekly","daily"} [frequency=weekly] Value "weekly" enables "On days of the week", value "daily" enables "EveryX Days". Only valid for type "daily".
|
||||
* @apiParam (Body) {String} [repeat=true] List of objects for days of the week, Days that are true will be repeated upon. Only valid for type "daily". Any days not specified will be marked as true. Days are: su, m, t, w, th, f, s. Value of frequency must be "weekly". For example, to skip repeats on Mon and Fri: "repeat":{"f":false,"m":false}
|
||||
* @apiParam (Body) {Number} [everyX=1] Value of frequency must be "daily", the number of days until this daily task is available again.
|
||||
* @apiParam (Body) {Number} [streak=0] Number of days that the task has consecutively been checked off. Only valid for type "daily"
|
||||
* @apiParam (Body) {Date} [startDate] Date when the task will first become available. Only valid for type "daily"
|
||||
* @apiParam (Body) {Boolean} [up=true] Only valid for type "habit" If true, enables the "+" under "Directions/Action" for "Good habits"
|
||||
* @apiParam (Body) {Boolean} [down=true] Only valid for type "habit" If true, enables the "-" under "Directions/Action" for "Bad habits"
|
||||
* @apiParam (Body) {Number="0.1","1","1.5","2"} [priority=1] Difficulty, options are 0.1, 1,
|
||||
* 1.5, 2; eqivalent of Trivial,
|
||||
* Easy, Medium, Hard.
|
||||
* @apiParam (Body) {String[]} [reminders] Array of reminders, each an object that must
|
||||
* include: a UUID, startDate and time.
|
||||
* For example {"id":"ed427623-9a69-4aac-9852-13deb9c190c3",
|
||||
* "startDate":"1/16/17","time":"1/16/17" }
|
||||
* @apiParam (Body) {String="weekly","daily"} [frequency=weekly] Value "weekly" enables
|
||||
* "On days of the week", value
|
||||
* "daily" enables "EveryX Days".
|
||||
* Only valid for type "daily".
|
||||
* @apiParam (Body) {String} [repeat=true] List of objects for days of the week,
|
||||
* Days that are true will be repeated upon.
|
||||
* Only valid for type "daily". Any days not
|
||||
* specified will be marked as true. Days are:
|
||||
* su, m, t, w, th, f, s. Value of frequency must
|
||||
* be "weekly". For example, to skip repeats on
|
||||
* Mon and Fri: "repeat":{"f":false,"m":false}
|
||||
* @apiParam (Body) {Number} [everyX=1] Value of frequency must be "daily", the number
|
||||
* of days until this daily task is available again.
|
||||
* @apiParam (Body) {Number} [streak=0] Number of days that the task has consecutively
|
||||
* been checked off. Only valid for type "daily"
|
||||
* @apiParam (Body) {Date} [startDate] Date when the task will first become available.
|
||||
* Only valid for type "daily"
|
||||
* @apiParam (Body) {Boolean} [up=true] Only valid for type "habit" If true,
|
||||
* enables the "+" under "Directions/Action"
|
||||
* for "Good habits"
|
||||
* @apiParam (Body) {Boolean} [down=true] Only valid for type "habit" If true, enables
|
||||
* the "-" under "Directions/Action" for "Bad habits"
|
||||
* @apiParam (Body) {Number} [value=0] Only valid for type "reward." The cost in gold of the reward
|
||||
*
|
||||
* @apiParamExample {json} Request-Example:
|
||||
@@ -217,14 +270,25 @@ api.createUserTasks = {
|
||||
* @apiSuccess (201) data An object if a single task was created, otherwise an array of tasks
|
||||
*
|
||||
* @apiSuccessExample {json} Example return:
|
||||
* {"success":true,"data":{"text":"Test API Params","type":"todo","notes":"","tags":[],"value":0,"priority":1,"attribute":"str","challenge":{"id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[],"_id":"4a29874c-0308-417b-a909-2a7d262b49f6","createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-13T21:23:05.949Z","checklist":[],"collapseChecklist":false,"completed":false,"id":"4a29874c-0308-417b-a909-2a7d262b49f6"},"notifications":[]}
|
||||
* {"success":true,"data":{"text":"Test API Params","type":"todo","notes":"",
|
||||
* "tags":[],"value":0,"priority":1,"attribute":"str",
|
||||
* "challenge":{"id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},
|
||||
* "group":{"assignedUsers":[],"approval":{"required":false,"approved":false,
|
||||
* "requested":false}},"reminders":[],"_id":"4a29874c-0308-417b-a909-2a7d262b49f6",
|
||||
* "createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-13T21:23:05.949Z",
|
||||
* "checklist":[],"collapseChecklist":false,"completed":false,
|
||||
* "id":"4a29874c-0308-417b-a909-2a7d262b49f6"},"notifications":[]}
|
||||
*
|
||||
* @apiError (404) {NotFound} ChecklistNotFound The specified checklist item could not be found.
|
||||
* @apiUse ChallengeNotFound
|
||||
* @apiError (400) {BadRequest} MustBeType Task type must be one of "habit", "daily", "todo", "reward".
|
||||
* @apiError (400) {BadRequest} MustBeType Task type must be one of "habit",
|
||||
* "daily", "todo", "reward".
|
||||
* @apiError (400) {BadRequest} Text-ValidationFailed Path 'text' is required.
|
||||
* @apiError (400) {BadRequest} Alias-ValidationFailed Task short names can only contain alphanumeric characters, underscores and dashes.
|
||||
* @apiError (400) {BadRequest} Value-ValidationFailed `x` is not a valid enum value for path `(body param)`.
|
||||
* @apiError (400) {BadRequest} Alias-ValidationFailed Task short names can only contain
|
||||
* alphanumeric characters, underscores
|
||||
* and dashes.
|
||||
* @apiError (400) {BadRequest} Value-ValidationFailed `x` is not a valid enum value
|
||||
* for path `(body param)`.
|
||||
* @apiError (401) {NotAuthorized} There is no account that uses those credentials.
|
||||
*/
|
||||
api.createChallengeTasks = {
|
||||
@@ -270,15 +334,39 @@ api.createChallengeTasks = {
|
||||
* @apiName GetUserTasks
|
||||
* @apiGroup Task
|
||||
*
|
||||
* @apiParam (Query) {String="habits","dailys","todos","rewards","completedTodos"} type Optional query parameter to return just a type of tasks. By default all types will be returned except completed todos that must be requested separately. The "completedTodos" type returns only the 30 most recently completed.
|
||||
* @apiParam (Query) [dueDate] type Optional date to use for computing the nextDue field for each returned task.
|
||||
* @apiParam (Query) {String="habits","dailys",
|
||||
* "todos","rewards","completedTodos"} type Optional query parameter to return
|
||||
* just a type of tasks. By default all
|
||||
* types will be returned except
|
||||
* completed todos that must be
|
||||
* requested separately.
|
||||
* The "completedTodos" type returns
|
||||
* only the 30 most recently completed.
|
||||
* @apiParam (Query) [dueDate] type Optional date to use for computing the nextDue field
|
||||
* for each returned task.
|
||||
*
|
||||
* @apiSuccess {Array} data An array of tasks
|
||||
*
|
||||
* @apiSuccessExample
|
||||
* {"success":true,"data":[{"_id":"8a9d461b-f5eb-4a16-97d3-c03380c422a3","userId":"b0413351-405f-416f-8787-947ec1c85199","text":"15 minute break","type":"reward","notes":"","tags":[],"value":10,"priority":1,"attribute":"str","challenge":{},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[],"createdAt":"2017-01-07T17:52:09.121Z","updatedAt":"2017-01-11T14:25:32.504Z","id":"8a9d461b-f5eb-4a16-97d3-c03380c422a3"},,{"_id":"84c2e874-a8c9-4673-bd31-d97a1a42e9a3","userId":"b0413351-405f-416f-8787-947ec1c85199","alias":"prac31","text":"Practice Task 31","type":"daily","notes":"","tags":[],"value":1,"priority":1,"attribute":"str","challenge":{},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[{"time":"2017-01-13T16:21:00.074Z","startDate":"2017-01-13T16:20:00.074Z","id":"b8b549c4-8d56-4e49-9b38-b4dcde9763b9"}],"createdAt":"2017-01-13T16:34:06.632Z","updatedAt":"2017-01-13T16:49:35.762Z","checklist":[],"collapseChecklist":false,"completed":true,"history":[],"streak":1,"repeat":{"su":false,"s":false,"f":true,"th":true,"w":true,"t":true,"m":true},"startDate":"2017-01-13T00:00:00.000Z","everyX":1,"frequency":"weekly","id":"84c2e874-a8c9-4673-bd31-d97a1a42e9a3"}],"notifications":[]}
|
||||
* {"success":true,"data":[{"_id":"8a9d461b-f5eb-4a16-97d3-c03380c422a3",
|
||||
* "userId":"b0413351-405f-416f-8787-947ec1c85199","text":"15 minute break",
|
||||
* "type":"reward","notes":"","tags":[],"value":10,"priority":1,"attribute":"str",
|
||||
* "challenge":{},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,
|
||||
* "requested":false}},"reminders":[],"createdAt":"2017-01-07T17:52:09.121Z",
|
||||
* "updatedAt":"2017-01-11T14:25:32.504Z","id":"8a9d461b-f5eb-4a16-97d3-c03380c422a3"},
|
||||
* ,{"_id":"84c2e874-a8c9-4673-bd31-d97a1a42e9a3","userId":"b0413351-405f-416f-8787-947ec1c85199",
|
||||
* "alias":"prac31","text":"Practice Task 31","type":"daily","notes":"","tags":[],"value":1,
|
||||
* "priority":1,"attribute":"str","challenge":{},"group":{"assignedUsers":[],
|
||||
* "approval":{"required":false,"approved":false,"requested":false}},
|
||||
* "reminders":[{"time":"2017-01-13T16:21:00.074Z","startDate":"2017-01-13T16:20:00.074Z",
|
||||
* "id":"b8b549c4-8d56-4e49-9b38-b4dcde9763b9"}],"createdAt":"2017-01-13T16:34:06.632Z",
|
||||
* "updatedAt":"2017-01-13T16:49:35.762Z","checklist":[],"collapseChecklist":false,
|
||||
* "completed":true,"history":[],"streak":1,"repeat":{"su":false,"s":false,"f":true,
|
||||
* "th":true,"w":true,"t":true,"m":true},"startDate":"2017-01-13T00:00:00.000Z",
|
||||
* "everyX":1,"frequency":"weekly","id":"84c2e874-a8c9-4673-bd31-d97a1a42e9a3"}],"notifications":[]}
|
||||
*
|
||||
* @apiError (BadRequest) Invalid_request_parameters Error returned if the type URL param was not correct.
|
||||
* @apiError (BadRequest) Invalid_request_parameters Error returned if the
|
||||
* type URL param was not correct.
|
||||
* @apiError (401) {NotAuthorized} There is no account that uses those credentials.
|
||||
*/
|
||||
api.getUserTasks = {
|
||||
@@ -310,7 +398,8 @@ api.getUserTasks = {
|
||||
* @apiGroup Task
|
||||
*
|
||||
* @apiParam (Path) {UUID} challengeId The id of the challenge from which to retrieve the tasks
|
||||
* @apiParam (Query) {String="habits","dailys","todos","rewards"} [type] Query parameter to return just a type of tasks
|
||||
* @apiParam (Query) {String="habits","dailys","todos","rewards"} [type] Query parameter to return
|
||||
* just a type of tasks.
|
||||
*
|
||||
* @apiExample {curl} Example use:
|
||||
* curl -i https://habitica.com/api/v3/tasks/challenge/f23c12f2-5830-4f15-9c36-e17fd729a812
|
||||
@@ -318,7 +407,23 @@ api.getUserTasks = {
|
||||
* @apiSuccess {Array} data An array of tasks
|
||||
*
|
||||
* @apiSuccessExample
|
||||
* {"success":true,"data":[{"_id":"5f12bfba-da30-4733-ad01-9c42f9817975","text":"API Trial","type":"habit","notes":"","tags":[],"value":27.70767809690112,"priority":1.5,"attribute":"str","challenge":{"id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[],"createdAt":"2017-01-12T19:03:33.485Z","updatedAt":"2017-01-13T17:45:52.442Z","history":[{"date":1484257319183,"value":18.53316748293123},{"date":1484329552441,"value":27.70767809690112}],"down":false,"up":true,"id":"5f12bfba-da30-4733-ad01-9c42f9817975"},{"_id":"54a81d23-529c-4daa-a6f7-c5c6e7e84936","text":"Challenge TODO","type":"todo","notes":"","tags":[],"value":2,"priority":2,"attribute":"str","challenge":{"id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[],"createdAt":"2017-01-12T19:07:10.310Z","updatedAt":"2017-01-13T20:24:51.070Z","checklist":[],"collapseChecklist":false,"completed":false,"id":"54a81d23-529c-4daa-a6f7-c5c6e7e84936"}],"notifications":[]}
|
||||
* {"success":true,"data":[{"_id":"5f12bfba-da30-4733-ad01-9c42f9817975",
|
||||
* "text":"API Trial","type":"habit","notes":"","tags":[],"value":27.70767809690112,
|
||||
* "priority":1.5,"attribute":"str","challenge":{"id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},
|
||||
* "group":{"assignedUsers":[],"approval":{"required":false,"approved":false,
|
||||
* "requested":false}},"reminders":[],"createdAt":"2017-01-12T19:03:33.485Z",
|
||||
* "updatedAt":"2017-01-13T17:45:52.442Z","history":
|
||||
* [{"date":1484257319183,"value":18.53316748293123},
|
||||
* {"date":1484329552441,"value":27.70767809690112}],
|
||||
* "down":false,"up":true,"id":"5f12bfba-da30-4733-ad01-9c42f9817975"},
|
||||
* {"_id":"54a81d23-529c-4daa-a6f7-c5c6e7e84936","text":"Challenge TODO","type":"todo",
|
||||
* "notes":"","tags":[],"value":2,"priority":2,"attribute":"str",
|
||||
* "challenge":{"id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},
|
||||
* "group":{"assignedUsers":[],"approval":{"required":false,"approved":false,
|
||||
* "requested":false}},"reminders":[],"createdAt":"2017-01-12T19:07:10.310Z",
|
||||
* "updatedAt":"2017-01-13T20:24:51.070Z","checklist":[],
|
||||
* "collapseChecklist":false,"completed":false,"id":"54a81d23-529c-4daa-a6f7-c5c6e7e84936"}],
|
||||
* "notifications":[]}
|
||||
*
|
||||
* @apiUse ChallengeNotFound
|
||||
*/
|
||||
@@ -368,7 +473,20 @@ api.getChallengeTasks = {
|
||||
* @apiSuccess {Object} data The task object
|
||||
*
|
||||
* @apiSuccessExample {json} Example returned object
|
||||
* {"success":true,"data":{"_id":"2b774d70-ec8b-41c1-8967-eb6b13d962ba","userId":"b0413351-405f-416f-8787-947ec1c85199","text":"API Trial","alias":"apiTrial","type":"habit","notes":"","tags":[],"value":11.996661122825959,"priority":1.5,"attribute":"str","challenge":{"taskId":"5f12bfba-da30-4733-ad01-9c42f9817975","id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[],"createdAt":"2017-01-12T19:03:33.495Z","updatedAt":"2017-01-13T20:52:02.927Z","history":[{"value":1,"date":1484248053486},{"value":1.9747,"date":1484252965224},{"value":2.9253562257358428,"date":1484252966902},{"value":3.853133245658556,"date":1484257191129},{"value":4.759112700885761,"date":1484257318911},{"value":5.6443010177121415,"date":1484257319164},{"value":3.752384470969301,"date":1484311429292},{"value":4.660705953838478,"date":1484311575632},{"value":5.54812929062314,"date":1484315395369},{"value":6.415599723011605,"date":1484329050485},{"value":7.263999553295137,"date":1484329050885},{"value":8.094153625212375,"date":1484329051509},{"value":8.906834219714574,"date":1484329088943},{"value":9.70276543915464,"date":1484329089547},{"value":10.482627142836241,"date":1484329089835},{"value":11.24705848799571,"date":1484329095500},{"value":11.996661122825959,"date":1484329552423}],"down":false,"up":true,"id":"2b774d70-ec8b-41c1-8967-eb6b13d962ba"},"notifications":[]}
|
||||
* {"success":true,"data":{"_id":"2b774d70-ec8b-41c1-8967-eb6b13d962ba",
|
||||
* "userId":"b0413351-405f-416f-8787-947ec1c85199","text":"API Trial",
|
||||
* "alias":"apiTrial","type":"habit","notes":"","tags":[],"value":11.996661122825959,
|
||||
* "priority":1.5,"attribute":"str","challenge":{"taskId":"5f12bfba-da30-4733-ad01-9c42f9817975",
|
||||
* "id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],
|
||||
* "approval":{"required":false,"approved":false,"requested":false}},"reminders":[],
|
||||
* "createdAt":"2017-01-12T19:03:33.495Z","updatedAt":"2017-01-13T20:52:02.927Z",
|
||||
* "history":[{"value":1,"date":1484248053486},{"value":1.9747,"date":1484252965224},
|
||||
* {"value":2.9253562257358428,"date":1484252966902},
|
||||
* {"value":6.415599723011605,"date":1484329050485},
|
||||
* {"value":10.482627142836241,"date":1484329089835},
|
||||
* {"value":11.24705848799571,"date":1484329095500},
|
||||
* {"value":11.996661122825959,"date":1484329552423}],"down":false,
|
||||
* "up":true,"id":"2b774d70-ec8b-41c1-8967-eb6b13d962ba"},"notifications":[]}
|
||||
*
|
||||
* @apiUse TaskNotFound
|
||||
*/
|
||||
@@ -415,19 +533,37 @@ api.getTask = {
|
||||
* @apiParam (Path) {String} taskId The task _id or alias
|
||||
*
|
||||
* @apiParam (Body) {String} [text] The text to be displayed for the task
|
||||
* @apiParam (Body) {String="str","int","per","con"} [attribute] User's attribute to use, options are: "str", "int", "per", "con"
|
||||
* @apiParam (Body) {String="str","int","per","con"} [attribute] User's attribute to use,
|
||||
* options are: "str", "int",
|
||||
* "per", "con".
|
||||
* @apiParam (Body) {Boolean} [collapseChecklist=false] Determines if a checklist will be displayed
|
||||
* @apiParam (Body) {String} [notes] Extra notes
|
||||
* @apiParam (Body) {String} [date] Due date to be shown in task list. Only valid for type "todo."
|
||||
* @apiParam (Body) {Number="0.1","1","1.5","2"} [priority=1] Difficulty, options are 0.1, 1, 1.5, 2; eqivalent of Trivial, Easy, Medium, Hard.
|
||||
* @apiParam (Body) {String[]} [reminders] Array of reminders, each an object that must include: a UUID, startDate and time.
|
||||
* @apiParam (Body) {String="weekly","daily"} [frequency=weekly] Value "weekly" enables "On days of the week", value "daily" enables "EveryX Days". Only valid for type "daily".
|
||||
* @apiParam (Body) {String} [repeat=true] List of objects for days of the week, Days that are true will be repeated upon. Only valid for type "daily". Any days not specified will be marked as true. Days are: su, m, t, w, th, f, s. Value of frequency must be "weekly". For example, to skip repeats on Mon and Fri: "repeat":{"f":false,"m":false}
|
||||
* @apiParam (Body) {Number} [everyX=1] Value of frequency must be "daily", the number of days until this daily task is available again.
|
||||
* @apiParam (Body) {Number} [streak=0] Number of days that the task has consecutively been checked off. Only valid for type "daily"
|
||||
* @apiParam (Body) {Date} [startDate] Date when the task will first become available. Only valid for type "daily"
|
||||
* @apiParam (Body) {Boolean} [up=true] Only valid for type "habit" If true, enables the "+" under "Directions/Action" for "Good habits"
|
||||
* @apiParam (Body) {Boolean} [down=true] Only valid for type "habit" If true, enables the "-" under "Directions/Action" for "Bad habits"
|
||||
* @apiParam (Body) {Number="0.1","1","1.5","2"} [priority=1] Difficulty, options are 0.1, 1,
|
||||
* 1.5, 2; eqivalent of Trivial,
|
||||
* Easy, Medium, Hard.
|
||||
* @apiParam (Body) {String[]} [reminders] Array of reminders, each an object that must include:
|
||||
* a UUID, startDate and time.
|
||||
* @apiParam (Body) {String="weekly","daily"} [frequency=weekly] Value "weekly" enables "On days
|
||||
* of the week", value "daily"
|
||||
* enables "EveryX Days".
|
||||
* Only valid for type "daily".
|
||||
* @apiParam (Body) {String} [repeat=true] List of objects for days of the week, Days that
|
||||
* are true will be repeated upon. Only valid for type
|
||||
* "daily". Any days not specified will be marked as true.
|
||||
* Days are: su, m, t, w, th, f, s. Value of frequency must
|
||||
* be "weekly". For example, to skip repeats on Mon and Fri:
|
||||
* "repeat":{"f":false,"m":false}
|
||||
* @apiParam (Body) {Number} [everyX=1] Value of frequency must be "daily", the number
|
||||
* of days until this daily task is available again.
|
||||
* @apiParam (Body) {Number} [streak=0] Number of days that the task has consecutively
|
||||
* been checked off. Only valid for type "daily",
|
||||
* @apiParam (Body) {Date} [startDate] Date when the task will first become available.
|
||||
* Only valid for type "daily".
|
||||
* @apiParam (Body) {Boolean} [up=true] Only valid for type "habit" If true, enables
|
||||
* the "+" under "Directions/Action" for "Good habits".
|
||||
* @apiParam (Body) {Boolean} [down=true] Only valid for type "habit" If true, enables the
|
||||
* "-" under "Directions/Action" for "Bad habits".
|
||||
* @apiParam (Body) {Number} [value=0] Only valid for type "reward." The cost in gold of the reward
|
||||
*
|
||||
* @apiParamExample {json} Request-Example:
|
||||
@@ -548,10 +684,23 @@ api.updateTask = {
|
||||
* @apiSuccess {Number} data.delta The delta
|
||||
*
|
||||
* @apiSuccessExample {json} Example result:
|
||||
* {"success":true,"data":{"delta":0.9746999906450404,"_tmp":{},"hp":49.06645205596985,"mp":37.2008917491047,"exp":101.93810026267543,"gp":77.09694176716997,"lvl":19,"class":"rogue","points":0,"str":5,"con":3,"int":3,"per":8,"buffs":{"str":9,"int":9,"per":9,"con":9,"stealth":0,"streaks":false,"snowball":false,"spookySparkles":false,"shinySeed":false,"seafoam":false},"training":{"int":0,"per":0,"str":0,"con":0}},"notifications":[]}
|
||||
* {"success":true,"data":{"delta":0.9746999906450404,"_tmp":{},"hp":49.06645205596985,
|
||||
* "mp":37.2008917491047,"exp":101.93810026267543,"gp":77.09694176716997,
|
||||
* "lvl":19,"class":"rogue","points":0,"str":5,"con":3,"int":3,"per":8,
|
||||
* "buffs":{"str":9,"int":9,"per":9,"con":9,"stealth":0,"streaks":false,
|
||||
* "snowball":false,"spookySparkles":false,"shinySeed":false,"seafoam":false},
|
||||
* "training":{"int":0,"per":0,"str":0,"con":0}},"notifications":[]}
|
||||
*
|
||||
* @apiSuccessExample {json} Example result with item drop:
|
||||
* {"success":true,"data":{"delta":1.0259567046270648,"_tmp":{"quest":{"progressDelta":1.2362778290756147,"collection":1},"drop":{"target":"Zombie","canDrop":true,"value":1,"key":"RottenMeat","type":"Food","dialog":"You've found Rotten Meat! Feed this to a pet and it may grow into a sturdy steed."}},"hp":50,"mp":66.2390716654227,"exp":143.93810026267545,"gp":135.12889840462591,"lvl":20,"class":"rogue","points":0,"str":6,"con":3,"int":3,"per":8,"buffs":{"str":10,"int":10,"per":10,"con":10,"stealth":0,"streaks":false,"snowball":false,"spookySparkles":false,"shinySeed":false,"seafoam":false},"training":{"int":0,"per":0,"str":0,"con":0}},"notifications":[]}
|
||||
* {"success":true,"data":{"delta":1.0259567046270648,
|
||||
* "_tmp":{"quest":{"progressDelta":1.2362778290756147,"collection":1},
|
||||
* "drop":{"target":"Zombie","canDrop":true,"value":1,"key":"RottenMeat","type":"Food",
|
||||
* "dialog":"You've found Rotten Meat! Feed this to a pet and it may grow into a sturdy steed."}},
|
||||
* "hp":50,"mp":66.2390716654227,"exp":143.93810026267545,"gp":135.12889840462591,
|
||||
* "lvl":20,"class":"rogue","points":0,"str":6,"con":3,"int":3,"per":8,
|
||||
* "buffs":{"str":10,"int":10,"per":10,"con":10,"stealth":0,"streaks":false,
|
||||
* "snowball":false,"spookySparkles":false,"shinySeed":false,"seafoam":false},
|
||||
* "training":{"int":0,"per":0,"str":0,"con":0}},"notifications":[]}
|
||||
*
|
||||
* @apiUse TaskNotFound
|
||||
*/
|
||||
@@ -732,17 +881,22 @@ api.scoreTask = {
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/tasks/:taskId/move/to/:position Move a task to a new position
|
||||
* @apiDescription Note: completed To-Dos are not sortable, do not appear in user.tasksOrder.todos, and are ordered by date of completion.
|
||||
* @apiDescription Note: completed To-Dos are not sortable,
|
||||
* do not appear in user.tasksOrder.todos, and are ordered by date of completion.
|
||||
* @apiName MoveTask
|
||||
* @apiGroup Task
|
||||
*
|
||||
* @apiParam (Path) {String} taskId The task _id or alias
|
||||
* @apiParam (Path) {Number} position Where to move the task. 0 = top of the list. -1 = bottom of the list. (-1 means push to bottom). First position is 0
|
||||
* @apiParam (Path) {Number} position Where to move the task. 0 = top of the list.
|
||||
é -1 = bottom of the list.
|
||||
é (-1 means push to bottom). First position is 0
|
||||
*
|
||||
* @apiSuccess {Array} data The new tasks order for the specific type that the taskID belongs to.
|
||||
*
|
||||
* @apiSuccessExample {json}
|
||||
* {"success":true,"data":["8d7e237a-b259-46ee-b431-33621256bb0b","2b774d70-ec8b-41c1-8967-eb6b13d962ba","f03d4a2b-9c36-4f33-9b5f-bae0aed23a49"],"notifications":[]}
|
||||
* {"success":true,"data":["8d7e237a-b259-46ee-b431-33621256bb0b",
|
||||
* "2b774d70-ec8b-41c1-8967-eb6b13d962ba","f03d4a2b-9c36-4f33-9b5f-bae0aed23a49"],
|
||||
* "notifications":[]}
|
||||
*
|
||||
* @apiUse TaskNotFound
|
||||
*/
|
||||
@@ -811,7 +965,16 @@ api.moveTask = {
|
||||
* @apiSuccess {Object} data The updated task
|
||||
*
|
||||
* @apiSuccessExample {json} Example return:
|
||||
* {"success":true,"data":{"_id":"84f02d6a-7b43-4818-a35c-d3336cec4880","userId":"b0413351-405f-416f-8787-947ec1c85199","text":"Test API Params","alias":"test-api-params","type":"todo","notes":"","tags":[],"value":0,"priority":2,"attribute":"int","challenge":{"taskId":"4a29874c-0308-417b-a909-2a7d262b49f6","id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[],"createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-14T03:38:07.406Z","checklist":[{"id":"afe4079d-dff1-47d9-9b06-5d76c69ddb12","text":"Do this subtask","completed":false}],"collapseChecklist":false,"completed":false,"id":"84f02d6a-7b43-4818-a35c-d3336cec4880"},"notifications":[]}
|
||||
* {"success":true,"data":{"_id":"84f02d6a-7b43-4818-a35c-d3336cec4880",
|
||||
* "userId":"b0413351-405f-416f-8787-947ec1c85199","text":"Test API Params",
|
||||
* "alias":"test-api-params","type":"todo","notes":"","tags":[],"value":0,
|
||||
* "priority":2,"attribute":"int","challenge":{"taskId":"4a29874c-0308-417b-a909-2a7d262b49f6",
|
||||
* "id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],
|
||||
* "approval":{"required":false,"approved":false,"requested":false}},"reminders":[],
|
||||
* "createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-14T03:38:07.406Z",
|
||||
* "checklist":[{"id":"afe4079d-dff1-47d9-9b06-5d76c69ddb12","text":"Do this subtask",
|
||||
* "completed":false}],"collapseChecklist":false,"completed":false,
|
||||
* "id":"84f02d6a-7b43-4818-a35c-d3336cec4880"},"notifications":[]}
|
||||
*
|
||||
* @apiUse TaskNotFound
|
||||
*/
|
||||
@@ -996,7 +1159,15 @@ api.updateChecklistItem = {
|
||||
* @apiSuccess {Object} data The updated task
|
||||
*
|
||||
* @apiSuccessExample {json} Example return:
|
||||
* {"success":true,"data":{"_id":"84f02d6a-7b43-4818-a35c-d3336cec4880","userId":"b0413351-405f-416f-8787-947ec1c85199","text":"Test API Params","alias":"test-api-params","type":"todo","notes":"","tags":[],"value":-1,"priority":2,"attribute":"int","challenge":{"taskId":"4a29874c-0308-417b-a909-2a7d262b49f6","id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[],"createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-14T19:35:41.881Z","checklist":[],"collapseChecklist":false,"completed":false,"id":"84f02d6a-7b43-4818-a35c-d3336cec4880"},"notifications":[]}
|
||||
* {"success":true,"data":{"_id":"84f02d6a-7b43-4818-a35c-d3336cec4880",
|
||||
* "userId":"b0413351-405f-416f-8787-947ec1c85199","text":"Test API Params",
|
||||
* "alias":"test-api-params","type":"todo","notes":"","tags":[],"value":-1,
|
||||
* "priority":2,"attribute":"int","challenge":{"taskId":"4a29874c-0308-417b-a909-2a7d262b49f6",
|
||||
* "id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],
|
||||
* "approval":{"required":false,"approved":false,"requested":false}},"reminders":[],
|
||||
* "createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-14T19:35:41.881Z",
|
||||
* "checklist":[],"collapseChecklist":false,"completed":false,
|
||||
* "id":"84f02d6a-7b43-4818-a35c-d3336cec4880"},"notifications":[]}
|
||||
*
|
||||
* @apiUse TaskNotFound
|
||||
* @apiUse ChallengeNotFound
|
||||
@@ -1063,10 +1234,21 @@ api.removeChecklistItem = {
|
||||
* @apiSuccess {Object} data The updated task
|
||||
*
|
||||
* @apiSuccessExample {json} Example return:
|
||||
* {"success":true,"data":{"_id":"84f02d6a-7b43-4818-a35c-d3336cec4880","userId":"b0413351-405f-416f-8787-947ec1c85199","text":"Test API Params","alias":"test-api-params","type":"todo","notes":"","tags":["3d5d324d-a042-4d5f-872e-0553e228553e"],"value":-1,"priority":2,"attribute":"int","challenge":{"taskId":"4a29874c-0308-417b-a909-2a7d262b49f6","id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[],"createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-14T19:41:29.466Z","checklist":[],"collapseChecklist":false,"completed":false,"id":"84f02d6a-7b43-4818-a35c-d3336cec4880"},"notifications":[]}
|
||||
* {"success":true,"data":{"_id":"84f02d6a-7b43-4818-a35c-d3336cec4880",
|
||||
* "userId":"b0413351-405f-416f-8787-947ec1c85199","text":"Test API Params",
|
||||
* "alias":"test-api-params","type":"todo","notes":"",
|
||||
* "tags":["3d5d324d-a042-4d5f-872e-0553e228553e"],"value":-1,"priority":2,"attribute":"int",
|
||||
* "challenge":{"taskId":"4a29874c-0308-417b-a909-2a7d262b49f6",
|
||||
* "id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],
|
||||
* "approval":{"required":false,"approved":false,"requested":false}},"reminders":[],
|
||||
* "createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-14T19:41:29.466Z",
|
||||
* "checklist":[],"collapseChecklist":false,"completed":false,
|
||||
* "id":"84f02d6a-7b43-4818-a35c-d3336cec4880"},"notifications":[]}
|
||||
*
|
||||
* @apiUse TaskNotFound
|
||||
* @apiError (400) {BadRequest} Invalid-request-parameters "tagId" must be a valid UUID corresponding to a tag belonging to the user.
|
||||
* @apiError (400) {BadRequest} Invalid-request-parameters "tagId" must be a valid UUID
|
||||
* corresponding to a tag belonging
|
||||
* to the user.
|
||||
* @apiError (400) {BadRequest} TagExists The task is already tagged with given tag.
|
||||
*/
|
||||
api.addTagToTask = {
|
||||
@@ -1113,7 +1295,15 @@ api.addTagToTask = {
|
||||
* @apiSuccess {Object} data The updated task
|
||||
*
|
||||
* @apiSuccessExample {json} Example return:
|
||||
* {"success":true,"data":{"_id":"84f02d6a-7b43-4818-a35c-d3336cec4880","userId":"b0413351-405f-416f-8787-947ec1c85199","text":"Test API Params","alias":"test-api-params","type":"todo","notes":"","tags":[],"value":-1,"priority":2,"attribute":"int","challenge":{"taskId":"4a29874c-0308-417b-a909-2a7d262b49f6","id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],"approval":{"required":false,"approved":false,"requested":false}},"reminders":[],"createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-14T20:02:18.206Z","checklist":[],"collapseChecklist":false,"completed":false,"id":"84f02d6a-7b43-4818-a35c-d3336cec4880"},"notifications":[]}
|
||||
* {"success":true,"data":{"_id":"84f02d6a-7b43-4818-a35c-d3336cec4880",
|
||||
* "userId":"b0413351-405f-416f-8787-947ec1c85199","text":"Test API Params",
|
||||
* "alias":"test-api-params","type":"todo","notes":"","tags":[],"value":-1,"priority":2,
|
||||
* "attribute":"int","challenge":{"taskId":"4a29874c-0308-417b-a909-2a7d262b49f6",
|
||||
* "id":"f23c12f2-5830-4f15-9c36-e17fd729a812"},"group":{"assignedUsers":[],
|
||||
* "approval":{"required":false,"approved":false,"requested":false}},"reminders":[],
|
||||
* "createdAt":"2017-01-13T21:23:05.949Z","updatedAt":"2017-01-14T20:02:18.206Z","checklist":[],
|
||||
* "collapseChecklist":false,"completed":false,"id":"84f02d6a-7b43-4818-a35c-d3336cec4880"},
|
||||
* "notifications":[]}
|
||||
*
|
||||
* @apiUse TaskNotFound
|
||||
* @apiUse TagNotFound
|
||||
@@ -1150,7 +1340,9 @@ api.removeTagFromTask = {
|
||||
* @apiGroup Task
|
||||
*
|
||||
* @apiParam (Path) {UUID} challengeId The challenge _id
|
||||
* @apiParam (Query) {String='keep-all','remove-all'} keep Specifies if tasks should be kept(keep-all) or removed(remove-all) after the unlink
|
||||
* @apiParam (Query) {String='keep-all','remove-all'} keep Specifies if tasks
|
||||
* should be kept(keep-all) or
|
||||
* removed(remove-all) after the unlink.
|
||||
*
|
||||
* @apiExample {curl}
|
||||
* curl -X "POST" https://habitica.com/api/v3/tasks/unlink-all/f23c12f2-5830-4f15-9c36-e17fd729a812?keep=remove-all
|
||||
@@ -1218,7 +1410,8 @@ api.unlinkAllTasks = {
|
||||
* @apiGroup Task
|
||||
*
|
||||
* @apiParam (Path) {String} taskId The task _id or alias
|
||||
* @apiParam (Query) {String='keep','remove'} keep Specifies if the task should be kept(keep) or removed(remove)
|
||||
* @apiParam (Query) {String='keep','remove'} keep Specifies if the task should
|
||||
* be kept(keep) or removed(remove).
|
||||
*
|
||||
* @apiExample {curl} Example call:
|
||||
* curl -X "POST" https://habitica.com/api/v3/tasks/unlink-one/ee882e1d-ebd1-4716-88f2-4f9e47d947a8?keep=keep
|
||||
@@ -1326,7 +1519,8 @@ api.clearCompletedTodos = {
|
||||
* @apiUse TaskNotFound
|
||||
* @apiError (401) {NotAuthorized} Challenge A task belonging to a challenge can't be deleted.
|
||||
* @apiError (401) {NotAuthorized} Group Can't delete group tasks that are assigned to you
|
||||
* @apiError (401) {NotAuthorized} ChallengeLeader Tasks belonging to a challenge can only be edited by the leader.
|
||||
* @apiError (401) {NotAuthorized} ChallengeLeader Tasks belonging to a challenge
|
||||
* can only be edited by the leader.
|
||||
* @apiError (401) {NotAuthorized} GroupLeader Not authorized to manage tasks!
|
||||
*/
|
||||
api.deleteTask = {
|
||||
|
||||
@@ -32,7 +32,8 @@ const api = {};
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/tasks/group/:groupId Create a new task belonging to a group
|
||||
* @apiDescription Can be passed an object to create a single task or an array of objects to create multiple tasks.
|
||||
* @apiDescription Can be passed an object to create a single task or
|
||||
* an array of objects to create multiple tasks.
|
||||
* @apiName CreateGroupTasks
|
||||
* @apiGroup Task
|
||||
*
|
||||
@@ -80,7 +81,8 @@ api.createGroupTasks = {
|
||||
* @apiGroup Task
|
||||
*
|
||||
* @apiParam (Path) {UUID} groupId The id of the group from which to retrieve the tasks
|
||||
* @apiParam (Query) {string="habits","dailys","todos","rewards"} [type] Query parameter to return just a type of tasks
|
||||
* @apiParam (Query) {string="habits","dailys","todos","rewards"} [type] Query parameter to
|
||||
* return just a type of tasks
|
||||
*
|
||||
* @apiSuccess {Array} data An array of tasks
|
||||
*/
|
||||
@@ -110,14 +112,16 @@ api.getGroupTasks = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/group/:groupId/tasks/:taskId/move/to/:position Move a group task to a specified position
|
||||
* @api {post} /api/v3/group/:groupId/tasks/:taskId/move/to/:position Move a group task to
|
||||
* a specified position
|
||||
* @apiDescription Moves a group task to a specified position
|
||||
* @apiVersion 3.0.0
|
||||
* @apiName GroupMoveTask
|
||||
* @apiGroup Task
|
||||
*
|
||||
* @apiParam (Path) {String} taskId The task _id
|
||||
* @apiParam (Path) {Number} position Where to move the task (-1 means push to bottom). First position is 0
|
||||
* @apiParam (Path) {Number} position Where to move the task (-1 means push to bottom).
|
||||
* First position is 0
|
||||
*
|
||||
* @apiSuccess {Array} data The new tasks order (group.tasksOrder.{task.type}s)
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,8 @@ const api = {};
|
||||
* @apiName UserGet
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiDescription The user profile contains data related to the authenticated user including (but not limited to);
|
||||
* @apiDescription The user profile contains data related to the authenticated
|
||||
* user including (but not limited to);
|
||||
* Achievements
|
||||
* Authentications (including types and timestamps)
|
||||
* Challenges
|
||||
@@ -61,7 +62,9 @@ const api = {};
|
||||
* Tags
|
||||
* TasksOrder (list of all ids for dailys, habits, rewards and todos)
|
||||
*
|
||||
* @apiParam (Query) {String} [userFields] A list of comma separated user fields to be returned instead of the entire document. Notifications are always returned.
|
||||
* @apiParam (Query) {String} [userFields] A list of comma separated user fields to
|
||||
* be returned instead of the entire document.
|
||||
* Notifications are always returned.
|
||||
*
|
||||
* @apiExample {curl} Example use:
|
||||
* curl -i https://habitica.com/api/v3/user?userFields=achievements,items.mounts
|
||||
@@ -88,7 +91,8 @@ api.getUser = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @api {get} /api/v3/user/inventory/buy Get the gear items available for purchase for the authenticated user
|
||||
* @api {get} /api/v3/user/inventory/buy Get the gear items available for purchase
|
||||
* for the authenticated user
|
||||
* @apiName UserGetBuyList
|
||||
* @apiGroup User
|
||||
*
|
||||
@@ -146,7 +150,9 @@ api.getBuyList = {
|
||||
* {
|
||||
* "key":"weapon_armoire_battleAxe",
|
||||
* "text":"Battle Axe",
|
||||
* "notes":"This fine iron axe is well-suited to battling your fiercest foes or your most difficult tasks. Increases Intelligence by 6 and Constitution by 8. Enchanted Armoire: Independent Item.",
|
||||
* "notes":"This fine iron axe is well-suited to battling your fiercest
|
||||
* foes or your most difficult tasks. Increases Intelligence by 6 and
|
||||
* Constitution by 8. Enchanted Armoire: Independent Item.",
|
||||
* "value":1,
|
||||
* "type":"weapon",
|
||||
* "locked":false,
|
||||
@@ -201,7 +207,8 @@ api.getInAppRewardsList = {
|
||||
*
|
||||
* @apiSuccess {Object} data The updated user object, the result is identical to the get user call
|
||||
*
|
||||
* @apiError (401) {NotAuthorized} messageUserOperationProtected Returned if the change is not allowed.
|
||||
* @apiError (401) {NotAuthorized} messageUserOperationProtected Returned if the change
|
||||
* is not allowed.
|
||||
*
|
||||
* @apiErrorExample {json} Error-Response:
|
||||
* {
|
||||
@@ -697,11 +704,13 @@ api.buyQuest = {
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/user/buy-special-spell/:key Buy special "spell" item
|
||||
* @apiDescription Includes gift cards (e.g., birthday card), and avatar Transformation Items and their antidotes (e.g., Snowball item and Salt reward).
|
||||
* @apiDescription Includes gift cards (e.g., birthday card), and avatar Transformation
|
||||
* Items and their antidotes (e.g., Snowball item and Salt reward).
|
||||
* @apiName UserBuySpecialSpell
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiParam (Path) {String} key The special item to buy. Must be one of the keys from "content.special", such as birthday, snowball, salt.
|
||||
* @apiParam (Path) {String} key The special item to buy. Must be one of the keys
|
||||
* from "content.special", such as birthday, snowball, salt.
|
||||
*
|
||||
* @apiSuccess {Object} data.stats User's current stats
|
||||
* @apiSuccess {Object} data.items User's current inventory
|
||||
@@ -760,11 +769,13 @@ api.buySpecialSpell = {
|
||||
* @apiError {NotFound} messageInvalidEggPotionCombo Cannot use that combination of egg and potion.
|
||||
*
|
||||
* @apiErrorExample {json} Already have that pet.
|
||||
* {"success":false,"error":"NotAuthorized","message":"You already have that pet. Try hatching a different combination
|
||||
* {"success":false,"error":"NotAuthorized","message":"You already have that pet.
|
||||
* Try hatching a different combination"}
|
||||
* @apiErrorExample {json} Either potion or egg (or both) not in inventory
|
||||
* {"success":false,"error":"NotFound","message":"You're missing either that egg or that potion"}
|
||||
* @apiErrorExample {json} Cannot use that combination
|
||||
* {"success":false,"error":"NotAuthorized","message":"You can't hatch Quest Pet Eggs with Magic Hatching Potions! Try a different egg."}
|
||||
* {"success":false,"error":"NotAuthorized","message":"You can't hatch Quest
|
||||
* Pet Eggs with Magic Hatching Potions! Try a different egg."}
|
||||
*/
|
||||
api.hatch = {
|
||||
method: 'POST',
|
||||
@@ -794,7 +805,8 @@ api.hatch = {
|
||||
* @apiName UserEquip
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiParam (Path) {String="mount","pet","costume","equipped"} type The type of item to equip or unequip
|
||||
* @apiParam (Path) {String="mount","pet","costume","equipped"} type The type of item
|
||||
* to equip or unequip.
|
||||
* @apiParam (Path) {String} key The item to equip or unequip
|
||||
*
|
||||
* @apiParamExample {URL} Example-URL
|
||||
@@ -810,7 +822,8 @@ api.hatch = {
|
||||
* "message": "Training Sword unequipped."
|
||||
* }
|
||||
*
|
||||
* @apiError {NotFound} notOwned Item is not in inventory, item doesn't exist, or item is of the wrong type.
|
||||
* @apiError {NotFound} notOwned Item is not in inventory, item doesn't
|
||||
* exist, or item is of the wrong type.
|
||||
*
|
||||
* @apiErrorExample {json} Item not owned or doesn't exist.
|
||||
* {"success":false,"error":"NotFound","message":"You do not own this item."}
|
||||
@@ -845,11 +858,13 @@ api.equip = {
|
||||
* @apiSuccess {String} message Success message
|
||||
*
|
||||
* @apiSuccessExample {json}
|
||||
* {"success":true,"data":10,"message":"Shade Armadillo really likes the Chocolate!","notifications":[]}
|
||||
* {"success":true,"data":10,"message":"Shade Armadillo
|
||||
* really likes the Chocolate!","notifications":[]}
|
||||
*
|
||||
* @apiError {NotFound} PetNotOwned :pet not found in user.items.pets
|
||||
* @apiError {BedRequest} InvalidPet Invalid pet name supplied.
|
||||
* @apiError {NotFound} FoodNotOwned :food not found in user.items.food Note: also sent if food name is invalid.
|
||||
* @apiError {NotFound} FoodNotOwned :food not found in user.items.food
|
||||
* Note: also sent if food name is invalid.
|
||||
*
|
||||
*
|
||||
*/
|
||||
@@ -880,7 +895,10 @@ api.feed = {
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/user/change-class Change class
|
||||
* @apiDescription User must be at least level 10. If ?class is defined and user.flags.classSelected is false it'll change the class. If user.preferences.disableClasses it'll enable classes, otherwise it sets user.flags.classSelected to false (costs 3 gems)
|
||||
* @apiDescription User must be at least level 10. If ?class is
|
||||
* defined and user.flags.classSelected is false it'll change the class.
|
||||
* If user.preferences.disableClasses it'll enable classes, otherwise it
|
||||
* sets user.flags.classSelected to false (costs 3 gems).
|
||||
* @apiName UserChangeClass
|
||||
* @apiGroup User
|
||||
*
|
||||
@@ -891,7 +909,8 @@ api.feed = {
|
||||
* @apiSuccess {Object} data.preferences user.preferences
|
||||
* @apiSuccess {Object} data.items user.items
|
||||
*
|
||||
* @apiError {NotAuthorized} Gems Not enough gems, if class was already selected and gems needed to be paid.
|
||||
* @apiError {NotAuthorized} Gems Not enough gems, if class was already
|
||||
* selected and gems needed to be paid.
|
||||
* @apiError {NotAuthorized} Level To change class you must be at least level 10.
|
||||
*
|
||||
* @apiErrorExample {json}
|
||||
@@ -935,20 +954,23 @@ api.disableClasses = {
|
||||
* @apiName UserPurchase
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiParam (Path) {String="gems","eggs","hatchingPotions","premiumHatchingPotions",food","quests","gear"} type Type of item to purchase.
|
||||
* @apiParam (Path) {String="gems","eggs","hatchingPotions","premiumHatchingPotions"
|
||||
,food","quests","gear"} type Type of item to purchase.
|
||||
* @apiParam (Path) {String} key Item's key (use "gem" for purchasing gems)
|
||||
*
|
||||
* @apiSuccess {Object} data.items user.items
|
||||
* @apiSuccess {Number} data.balance user.balance
|
||||
* @apiSuccess {String} message Success message
|
||||
*
|
||||
* @apiError {NotAuthorized} NotAvailable Item is not available to be purchased (not unlocked for the user).
|
||||
* @apiError {NotAuthorized} NotAvailable Item is not available to be purchased
|
||||
* (not unlocked for the user).
|
||||
* @apiError {NotAuthorized} Gems Not enough gems
|
||||
* @apiError {NotFound} Key Key not found for Content type.
|
||||
* @apiError {NotFound} Type Type invalid.
|
||||
*
|
||||
* @apiErrorExample {json}
|
||||
* {"success":false,"error":"NotAuthorized","message":"This item is not currently available for purchase."}
|
||||
* {"success":false,"error":"NotAuthorized","message":
|
||||
* "This item is not currently available for purchase."}
|
||||
*/
|
||||
api.purchase = {
|
||||
method: 'POST',
|
||||
@@ -986,7 +1008,9 @@ api.purchase = {
|
||||
* @apiParam (Path) {String="pets","mounts"} type The type of item to purchase
|
||||
* @apiParam (Path) {String} key Ex: {Phoenix-Base}. The key for the mount/pet
|
||||
*
|
||||
* @apiParam (Body) {Integer} [quantity=1] Count of items to buy. Defaults to 1 and is ignored for items where quantity is irrelevant.
|
||||
* @apiParam (Body) {Integer} [quantity=1] Count of items to buy.
|
||||
* Defaults to 1 and is ignored
|
||||
* for items where quantity is irrelevant.
|
||||
*
|
||||
* @apiSuccess {Object} data.items user.items
|
||||
* @apiSuccess {Object} data.purchasedPlanConsecutive user.purchased.plan.consecutive
|
||||
@@ -1024,7 +1048,8 @@ api.userPurchaseHourglass = {
|
||||
* @apiName UserReadCard
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiParam (Path) {String} cardType Type of card to read (e.g. - birthday, greeting, nye, thankyou, valentine)
|
||||
* @apiParam (Path) {String} cardType Type of card to read (e.g. - birthday,
|
||||
* greeting, nye, thankyou, valentine).
|
||||
*
|
||||
* @apiSuccess {Object} data.specialItems user.items.special
|
||||
* @apiSuccess {Boolean} data.cardReceived user.flags.cardReceived
|
||||
@@ -1242,11 +1267,14 @@ api.userReleaseMounts = {
|
||||
* @apiSuccess {Object} data.stats
|
||||
* @apiSuccess {Object} data.items
|
||||
*
|
||||
* @apiError {NotFound} InvalidKey Key not found for user.items eggs (either the key does not exist or the user has none in inventory)
|
||||
* @apiError {NotFound} InvalidKey Key not found for user.items eggs
|
||||
* (either the key does not exist or the
|
||||
* user has none in inventory).
|
||||
* @apiError {NotAuthorized} InvalidType Type is not a valid type.
|
||||
*
|
||||
* @apiErrorExample {json}
|
||||
* {"success":false,"error":"NotAuthorized","message":"Type is not sellable. Must be one of the following eggs, hatchingPotions, food"}
|
||||
* {"success":false,"error":"NotAuthorized","message":"Type is not sellable.
|
||||
* Must be one of the following eggs, hatchingPotions, food"}
|
||||
*/
|
||||
api.userSell = {
|
||||
method: 'POST',
|
||||
@@ -1552,12 +1580,14 @@ api.userReset = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/user/custom-day-start Set preferences.dayStart (Custom Day Start time) for user
|
||||
* @api {post} /api/v3/user/custom-day-start Set preferences.dayStart
|
||||
* (Custom Day Start time) for user.
|
||||
* @apiName setCustomDayStart
|
||||
* @apiGroup User
|
||||
*
|
||||
*
|
||||
* @apiParam (Body) {number} [dayStart=0] The hour number 0-23 for day to begin. If body is not included, will default to 0.
|
||||
* @apiParam (Body) {number} [dayStart=0] The hour number 0-23 for day to begin.
|
||||
* If body is not included, will default to 0.
|
||||
*
|
||||
* @apiParamExample {json} Request-Example:
|
||||
* {"dayStart":2}
|
||||
@@ -1571,7 +1601,9 @@ api.userReset = {
|
||||
* @apiError {BadRequest} Validation Value provided is not a number, or is outside the range of 0-23
|
||||
*
|
||||
* @apiErrorExample {json}
|
||||
* {"success":false,"error":"BadRequest","message":"User validation failed","errors":[{"message":"Path `preferences.dayStart` (25) is more than maximum allowed value (23).","path":"preferences.dayStart","value":25}]}
|
||||
* {"success":false,"error":"BadRequest","message":"User validation failed",
|
||||
* "errors":[{"message":"Path `preferences.dayStart` (25) is more than maximum allowed value (23)."
|
||||
* ,"path":"preferences.dayStart","value":25}]}
|
||||
*/
|
||||
api.setCustomDayStart = {
|
||||
method: 'POST',
|
||||
@@ -1634,17 +1666,21 @@ api.togglePinnedItem = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/user/move-pinned-item/:type/:path/move/to/:position Move a pinned item in the rewards column to a new position after being sorted
|
||||
* @api {post} /api/v3/user/move-pinned-item/:type/:path/move/to/:position Move a pinned
|
||||
* item in the rewards column to a new position after being sorted
|
||||
* @apiName MovePinnedItem
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiParam (Path) {String} path The unique item path used for pinning
|
||||
* @apiParam (Path) {Number} position Where to move the task. 0 = top of the list. -1 = bottom of the list. (-1 means push to bottom). First position is 0
|
||||
* @apiParam (Path) {Number} position Where to move the task. 0 = top of the list.
|
||||
* -1 = bottom of the list.
|
||||
* (-1 means push to bottom). First position is 0.
|
||||
*
|
||||
* @apiSuccess {Array} data The new pinned items order.
|
||||
*
|
||||
* @apiSuccessExample {json}
|
||||
* {"success":true,"data":{"path":"quests.mayhemMistiflying3","type":"quests","_id": "5a32d357232feb3bc94c2bdf"},"notifications":[]}
|
||||
* {"success":true,"data":{"path":"quests.mayhemMistiflying3","type":"quests",
|
||||
* "_id": "5a32d357232feb3bc94c2bdf"},"notifications":[]}
|
||||
*
|
||||
* @apiUse TaskNotFound
|
||||
*/
|
||||
|
||||
@@ -13,8 +13,12 @@ const api = {};
|
||||
* @apiGroup User
|
||||
*
|
||||
|
||||
* @apiParam (Path) {String=fireball, mpheal, earth, frost, smash, defensiveStance, valorousPresence, intimidate, pickPocket, backStab, toolsOfTrade, stealth, heal, protectAura, brightness, healAll} spellId The skill to cast.
|
||||
* @apiParam (Query) {UUID} targetId Query parameter, necessary if the spell is cast on a party member or task. Not used if the spell is case on the user or the user's current party.
|
||||
* @apiParam (Path) {String=fireball, mpheal, earth, frost, smash, defensiveStance,
|
||||
* valorousPresence, intimidate, pickPocket, backStab, toolsOfTrade,
|
||||
* stealth, heal, protectAura, brightness, healAll} spellId The skill to cast.
|
||||
* @apiParam (Query) {UUID} targetId Query parameter, necessary if the spell is
|
||||
* cast on a party member or task. Not used if the spell
|
||||
* is casted on the user or the user's current party.
|
||||
* @apiParamExample {json} Query example:
|
||||
* Cast "Pickpocket" on a task:
|
||||
* https://habitica.com/api/v3/user/class/cast/pickPocket?targetId=fd427623...
|
||||
@@ -22,7 +26,8 @@ const api = {};
|
||||
* Cast "Tools of the Trade" on the party:
|
||||
* https://habitica.com/api/v3/user/class/cast/toolsOfTrade
|
||||
*
|
||||
* @apiSuccess data Will return the modified targets. For party members only the necessary fields will be populated. The user is always returned.
|
||||
* @apiSuccess data Will return the modified targets. For party members only
|
||||
* the necessary fields will be populated. The user is always returned.
|
||||
*
|
||||
* @apiDescription Skill Key to Name Mapping
|
||||
* Mage
|
||||
|
||||
@@ -5,7 +5,8 @@ import { authWithHeaders } from '../../../middlewares/auth';
|
||||
const api = {};
|
||||
|
||||
/**
|
||||
* @api {post} /api/v3/user/allocate Allocate a single Stat Point (previously called Attribute Point)
|
||||
* @api {post} /api/v3/user/allocate Allocate a single Stat Point
|
||||
* (previously called Attribute Point)
|
||||
* @apiName UserAllocate
|
||||
* @apiGroup User
|
||||
*
|
||||
@@ -79,7 +80,9 @@ api.allocateBulk = {
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @apiGroup User
|
||||
*
|
||||
|
||||
@@ -7,9 +7,11 @@ const api = {};
|
||||
|
||||
/**
|
||||
* @apiDefine Webhook Webhook
|
||||
* Webhooks fire when a particular action is performed, such as updating a task, or sending a message in a group.
|
||||
* Webhooks fire when a particular action is performed, such as updating a task,
|
||||
* or sending a message in a group.
|
||||
*
|
||||
* Your user's configured webhooks are stored as an `Array` on the user object under the `webhooks` property.
|
||||
* Your user's configured webhooks are stored as an `Array` on the user
|
||||
* object under the `webhooks` property.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -19,7 +21,8 @@ const api = {};
|
||||
|
||||
/**
|
||||
* @apiDefine WebhookBodyInvalid
|
||||
* @apiError (400) {BadRequest} WebhookBodyInvalid A body parameter passed in the request did not pass validation.
|
||||
* @apiError (400) {BadRequest} WebhookBodyInvalid A body parameter passed in the
|
||||
* request did not pass validation.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -31,8 +34,12 @@ const api = {};
|
||||
* @apiParam (Body) {String} url The webhook's URL
|
||||
* @apiParam (Body) {String} [label] A label to remind you what this webhook does
|
||||
* @apiParam (Body) {Boolean} [enabled=true] If the webhook should be enabled
|
||||
* @apiParam (Body) {String="taskActivity","groupChatReceived","userActivity"} [type="taskActivity"] The webhook's type.
|
||||
* @apiParam (Body) {Object} [options] The webhook's options. Wil differ depending on type. Required for `groupChatReceived` type. If a webhook supports options, the default values are displayed in the examples below
|
||||
* @apiParam (Body) {String="taskActivity","groupChatReceived",
|
||||
"userActivity"} [type="taskActivity"] The webhook's type.
|
||||
* @apiParam (Body) {Object} [options] The webhook's options. Wil differ depending on type.
|
||||
* Required for `groupChatReceived` type.
|
||||
* If a webhook supports options, the default values
|
||||
* are displayed in the examples below
|
||||
* @apiParamExample {json} Task Activity Example
|
||||
* {
|
||||
* "enabled": true, // default
|
||||
@@ -117,14 +124,17 @@ api.getWebhook = {
|
||||
* @api {put} /api/v3/user/webhook/:id Edit a webhook - BETA
|
||||
* @apiName UserUpdateWebhook
|
||||
* @apiGroup Webhook
|
||||
* @apiDescription Can change `url`, `enabled`, `type`, and `options` properties. Cannot change `id`.
|
||||
* @apiDescription Can change `url`, `enabled`, `type`, and `options`
|
||||
* properties. Cannot change `id`.
|
||||
*
|
||||
* @apiParam (Path) {UUID} id URL parameter - The id of the webhook to update
|
||||
* @apiParam (Body) {String} [url] The webhook's URL
|
||||
* @apiParam (Body) {String} [label] A label to remind you what this webhook does
|
||||
* @apiParam (Body) {Boolean} [enabled] If the webhook should be enabled
|
||||
* @apiParam (Body) {String="taskActivity","groupChatReceived"} [type] The webhook's type.
|
||||
* @apiParam (Body) {Object} [options] The webhook's options. Wil differ depending on type. The options are enumerated in the [add webhook examples](#api-Webhook-UserAddWebhook).
|
||||
* @apiParam (Body) {Object} [options] The webhook's options. Wil differ depending on type.
|
||||
* The options are enumerated in the
|
||||
* [add webhook examples](#api-Webhook-UserAddWebhook).
|
||||
* @apiParamExample {json} Update Enabled and Type Properties
|
||||
* {
|
||||
* "enabled": false,
|
||||
|
||||
@@ -23,7 +23,9 @@ async function getWorldBoss () {
|
||||
* @apiGroup WorldState
|
||||
*
|
||||
* @apiSuccess {Object} data.worldBoss.active Boolean, true if world boss quest is underway
|
||||
* @apiSuccess {Object} data.worldBoss.extra.worldDmg Object with NPC names as Boolean properties, true if they are affected by Rage Strike
|
||||
* @apiSuccess {Object} data.worldBoss.extra.worldDmg Object with NPC names
|
||||
* as Boolean properties, true if they
|
||||
* are affected by Rage Strike.
|
||||
* @apiSuccess {Object} data.worldBoss.key String, Quest content key for the world boss
|
||||
* @apiSuccess {Object} data.worldBoss.progress.hp Number, Current Health of the world boss
|
||||
* @apiSuccess {Object} data.worldBoss.progress.rage Number, Current Rage of the world boss
|
||||
|
||||
Reference in New Issue
Block a user