From 75416ab578350f082263839a213f90ed1e4fadff Mon Sep 17 00:00:00 2001 From: Kisaragi <48310258+KisaragiEffective@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:53:11 +0900 Subject: [PATCH] refactor: convert input document to JSDoc format (#698) * refactor: convert input document to JSDoc format * refactor: migrate rest of document * chore: eslint and prettier --- html/src/app.js | 826 ++++++++++++++++++++++++------------------------ 1 file changed, 408 insertions(+), 418 deletions(-) diff --git a/html/src/app.js b/html/src/app.js index 75b8823d7..45b549ab8 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -1424,12 +1424,10 @@ speechSynthesis.getVoices(); // }); }; - /* - params: { - username: string, - password: string - } - */ + /** + * @param {{ username: string, password: string }} params credential to login + * @returns {Promise<{origin: boolean, json: any, params}>} + */ API.login = function (params) { var { username, password, saveCredentials, cipher } = params; username = encodeURIComponent(username); @@ -1468,11 +1466,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - code: string - } - */ + /** + * @param {{ code: string }} params One-time password + * @returns {Promise<{json: any, params}>} + */ API.verifyOTP = function (params) { return this.call('auth/twofactorauth/otp/verify', { method: 'POST', @@ -1487,11 +1484,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - code: string - } - */ + /** + * @param {{ code: string }} params One-time token + * @returns {Promise<{json: any, params}>} + */ API.verifyTOTP = function (params) { return this.call('auth/twofactorauth/totp/verify', { method: 'POST', @@ -1506,11 +1502,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - code: string - } - */ + /** + * @param {{ code: string }} params One-time token + * @returns {Promise<{json: any, params}>} + */ API.verifyEmailOTP = function (params) { return this.call('auth/twofactorauth/emailotp/verify', { method: 'POST', @@ -1989,11 +1984,11 @@ speechSynthesis.getVoices(); return ref; }; - /* - params: { - userId: string - } - */ + /** + * Fetch user from API. + * @param {{ userId: string }} params identifier of registered user + * @returns {Promise<{json: any, params}>} + */ API.getUser = function (params) { return this.call(`users/${params.userId}`, { method: 'GET' @@ -2007,11 +2002,11 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - userId: string - } - */ + /** + * Fetch user from cache if they're in it. Otherwise, calls API. + * @param {{ userId: string }} params identifier of registered user + * @returns {Promise<{json: any, params}>} + */ API.getCachedUser = function (params) { return new Promise((resolve, reject) => { var ref = this.cachedUsers.get(params.userId); @@ -2028,15 +2023,18 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - n: number, - offset: number, - search: string, - sort: string ('nuisanceFactor', 'created', '_created_at', 'last_login'), - order: string ('ascending', 'descending') - } - */ + /** @typedef {{ + * n: number, + * offset: number, + * search: string, + * sort: 'nuisanceFactor' | 'created' | '_created_at' | 'last_login', + * order: 'ascending', 'descending' + }} GetUsersParameters */ + /** + * Fetch multiple users from API. + * @param params {GetUsersParameters} filtering and sorting parameters + * @returns {Promise<{json: any, params}>} + */ API.getUsers = function (params) { return this.call('users', { method: 'GET', @@ -2051,12 +2049,18 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - status: string ('active', 'offline', 'busy', 'ask me', 'join me'), - statusDescription: string - } - */ + /** + * @typedef {{ + * status: 'active' | 'offline' | 'busy' | 'ask me' | 'join me', + * statusDescription: string + * }} SaveCurrentUserParameters + */ + + /** + * Updates current user's status. + * @param params {SaveCurrentUserParameters} new status to be set + * @returns {Promise<{json: any, params}>} + */ API.saveCurrentUser = function (params) { return this.call(`users/${this.currentUser.id}`, { method: 'PUT', @@ -2071,11 +2075,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - tags: array[string] - } - */ + /** + * @param params {string[]} + * @returns {Promise<{json: any, params}>} + */ API.addUserTags = function (params) { return this.call(`users/${this.currentUser.id}/addTags`, { method: 'POST', @@ -2090,11 +2093,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - tags: array[string] - } - */ + /** + * @param params {string[]} + * @returns {Promise<{json: any, params}>} + */ API.removeUserTags = function (params) { return this.call(`users/${this.currentUser.id}/removeTags`, { method: 'POST', @@ -2109,11 +2111,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - userId: string - } - */ + /** + * @param params {{ userId: string }} + * @returns {Promise<{json: any, params}>} + */ API.getUserFeedback = function (params) { return this.call(`users/${params.userId}/feedback`, { method: 'GET', @@ -2288,11 +2289,11 @@ speechSynthesis.getVoices(); return ref; }; - /* - params: { - worldId: string - } - */ + /** + * + * @param {{worldId: string}} params + * @returns {Promise<{json: any, params}>} + */ API.getWorld = function (params) { return this.call(`worlds/${params.worldId}`, { method: 'GET' @@ -2306,11 +2307,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - worldId: string - } - */ + /** + * @param {{worldId: string}} params + * @returns {Promise<{json: any, params}>} + */ API.getCachedWorld = function (params) { return new Promise((resolve, reject) => { var ref = this.cachedWorlds.get(params.worldId); @@ -2327,20 +2327,25 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - n: number, - offset: number, - search: string, - userId: string, - user: string ('me','friend') - sort: string ('popularity','heat','trust','shuffle','favorites','reportScore','reportCount','publicationDate','labsPublicationDate','created','_created_at','updated','_updated_at','order'), - order: string ('ascending','descending'), - releaseStatus: string ('public','private','hidden','all'), - featured: boolean - }, - option: string - */ + /** + * @typedef {{ + n: number, + offset: number, + search: string, + userId: string, + user: 'me' | 'friend', + sort: 'popularity' | 'heat' | 'trust' | 'shuffle' | 'favorites' | 'reportScore' | 'reportCount' | 'publicationDate' | 'labsPublicationDate' | 'created' | '_created_at' | 'updated' | '_updated_at' | 'order', + order: 'ascending' | 'descending', + releaseStatus: 'public' | 'private' | 'hidden' | 'all', + featured: boolean + }} WorldSearchParameter + */ + /** + * + * @param {WorldSearchParameter} params + * @param {string?} option sub-path of calling endpoint + * @returns {Promise<{json: any, params, option}>} + */ API.getWorlds = function (params, option) { var endpoint = 'worlds'; if (typeof option !== 'undefined') { @@ -2360,11 +2365,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - worldId: string - } - */ + /** + * @param {{worldId: string}} params + * @returns {Promise<{json: any, params}>} + */ API.deleteWorld = function (params) { return this.call(`worlds/${params.worldId}`, { method: 'DELETE' @@ -2378,11 +2382,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - id: string - } - */ + /** + * @param {{id: string}} params + * @returns {Promise<{json: any, params}>} + */ API.saveWorld = function (params) { return this.call(`worlds/${params.id}`, { method: 'PUT', @@ -2397,11 +2400,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - worldId: string - } - */ + /** + * @param {{worldId: string}} params + * @returns {Promise<{json: any, params}>} + */ API.publishWorld = function (params) { return this.call(`worlds/${params.worldId}/publish`, { method: 'PUT', @@ -2416,11 +2418,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - worldId: string - } - */ + /** + * @param {{worldId: string}} params + * @returns {Promise<{json: any, params}>} + */ API.unpublishWorld = function (params) { return this.call(`worlds/${params.worldId}/publish`, { method: 'DELETE', @@ -2440,12 +2441,10 @@ speechSynthesis.getVoices(); API.cachedInstances = new Map(); - /* - params: { - worldId: string, - instanceId: string - } - */ + /** + * @param {{worldId: string, instanceId: string}} params + * @returns {Promise<{json: any, params}>} + */ API.getInstance = function (params) { return this.call(`instances/${params.worldId}:${params.instanceId}`, { method: 'GET' @@ -2459,17 +2458,22 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - worldId: string, - type: string, - region: string, - ownerId: string, - roleIds: string[], - groupAccessType: string, - queueEnabled: boolean - } - */ + /** + * @typedef {{ + * worldId: string, + * type: string, + * region: string, + * ownerId: string, + * roleIds: string[], + * groupAccessType: string, + * queueEnabled: boolean + * }} CreateInstanceParameter + */ + + /** + * @param {CreateInstanceParameter} params + * @returns {Promise<{json: any, params}>} + */ API.createInstance = function (params) { return this.call('instances', { method: 'POST', @@ -2484,13 +2488,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - worldId: string, - instanceId: string, - shortName: string - } - */ + /** + * @param {{ worldId: string, instanceId: string, shortName: string }} instance + * @returns {Promise<{instance, json: T, params: {}}>} + */ API.getInstanceShortName = function (instance) { var params = {}; if (instance.shortName) { @@ -2513,11 +2514,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - shortName: string - } - */ + /** + * @param {{ shortName: string }} params + * @returns {Promise<{json: any, params}>} + */ API.getInstanceFromShortName = function (params) { return this.call(`instances/s/${params.shortName}`, { method: 'GET' @@ -2531,14 +2531,15 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - worldId: string, - instanceId: string, - shortName: string - } - */ + /** + * Send invite to current user. + * @param {{ worldId: string, instanceId: string, shortName: string }} instance + * @returns {Promise<{instance, json: any, params}>} + */ API.selfInvite = function (instance) { + /** + * @type {{ shortName?: string }} + */ var params = {}; if (instance.shortName) { params.shortName = instance.shortName; @@ -2763,13 +2764,11 @@ speechSynthesis.getVoices(); return friends; }; - /* - params: { - n: number, - offset: number, - offline: boolean - } - */ + /** + * Fetch friends of current user. + * @param {{ n: number, offset: number, offline: boolean }} params + * @returns {Promise<{json: any, params}>} + */ API.getFriends = function (params) { return this.call('auth/user/friends', { method: 'GET', @@ -2784,11 +2783,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - userId: string - } - */ + /** + * @param {{ userId: string }} params + * @returns {Promise<{json: any, params}>} + */ API.deleteFriend = function (params) { return this.call(`auth/user/friends/${params.userId}`, { method: 'DELETE' @@ -2802,11 +2800,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - userId: string - } - */ + /** + * @param {{ userId: string }} params + * @returns {Promise<{json: T, params}>} + */ API.sendFriendRequest = function (params) { return this.call(`user/${params.userId}/friendRequest`, { method: 'POST' @@ -2820,11 +2817,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - userId: string - } - */ + /** + * @param {{ userId: string }} params + * @returns {Promise<{json: any, params}>} + */ API.cancelFriendRequest = function (params) { return this.call(`user/${params.userId}/friendRequest`, { method: 'DELETE' @@ -2853,11 +2849,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - userId: string - } - */ + /** + * @param {{ userId: string }} params + * @returns {Promise<{json: any, params}>} + */ API.getFriendStatus = function (params) { return this.call(`user/${params.userId}/friendStatus`, { method: 'GET' @@ -2961,11 +2956,10 @@ speechSynthesis.getVoices(); return ref; }; - /* - params: { - avatarId: string - } - */ + /** + * @param {{ avatarId: string }} params + * @returns {Promise<{json: any, params}>} + */ API.getAvatar = function (params) { return this.call(`avatars/${params.avatarId}`, { method: 'GET' @@ -2979,19 +2973,24 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - n: number, - offset: number, - search: string, - userId: string, - user: string ('me','friends') - sort: string ('created','updated','order','_created_at','_updated_at'), - order: string ('ascending','descending'), - releaseStatus: string ('public','private','hidden','all'), - featured: boolean - } - */ + /** + * @typedef {{ + * n: number, + * offset: number, + * search: string, + * userId: string, + * user: 'me' | 'friends' + * sort: 'created' | 'updated' | 'order' | '_created_at' | '_updated_at', + * order: 'ascending' | 'descending', + * releaseStatus: 'public' | 'private' | 'hidden' | 'all', + * featured: boolean + * }} GetAvatarsParameter + */ + /** + * + * @param {GetAvatarsParameter} params + * @returns {Promise<{json: any, params}>} + */ API.getAvatars = function (params) { return this.call('avatars', { method: 'GET', @@ -3006,12 +3005,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - id: string - releaseStatus: string ('public','private'), - } - */ + /** + * @param {{ id: string, releaseStatus: 'public' | 'private' }} params + * @returns {Promise<{json: any, params}>} + */ API.saveAvatar = function (params) { return this.call(`avatars/${params.id}`, { method: 'PUT', @@ -3026,11 +3023,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - avatarId: string - } - */ + /** + * @param {{avatarId: string }} params + * @returns {Promise<{json: any, params}>} + */ API.selectAvatar = function (params) { return this.call(`avatars/${params.avatarId}/select`, { method: 'PUT', @@ -3045,11 +3041,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - avatarId: string - } - */ + /** + * @param {{ avatarId: string }} params + * @return { Promise<{json: any, params}> } + */ API.selectFallbackAvatar = function (params) { return this.call(`avatars/${params.avatarId}/selectfallback`, { method: 'PUT', @@ -3064,11 +3059,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - avatarId: string - } - */ + /** + * @param {{ avatarId: string }} params + * @return { Promise<{json: any, params}> } + */ API.deleteAvatar = function (params) { return this.call(`avatars/${params.avatarId}`, { method: 'DELETE' @@ -3082,11 +3076,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - avatarId: string - } - */ + /** + * @param {{ avatarId: string }} params + * @returns {Promise<{json: any, params}>} + */ API.createImposter = function (params) { return this.call(`avatars/${params.avatarId}/impostor/enqueue`, { method: 'POST' @@ -3100,11 +3093,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - avatarId: string - } - */ + /** + * @param {{ avatarId: string }} params + * @returns {Promise<{json: T, params}>} + */ API.deleteImposter = function (params) { return this.call(`avatars/${params.avatarId}/impostor`, { method: 'DELETE' @@ -3340,15 +3332,20 @@ speechSynthesis.getVoices(); this.isNotificationsLoading = false; }; - /* - params: { - n: number, - offset: number, - sent: boolean, - type: string, - after: string (ISO8601 or 'five_minutes_ago') - } - */ + /** @typedef {{ + * n: number, + * offset: number, + * sent: boolean, + * type: string, + * // (ISO8601 or 'five_minutes_ago') + * after: 'five_minutes_ago' | (string & {}) + }} NotificationFetchParameter */ + + /** + * + * @param {NotificationFetchParameter} params + * @returns {Promise<{json: any, params}>} + */ API.getNotifications = function (params) { return this.call('auth/user/notifications', { method: 'GET', @@ -3447,12 +3444,13 @@ speechSynthesis.getVoices(); } }); - /* - params: { + /** + * @param {{ notificationId: string, responseType: string, responseData: string - } + }} params + * @return { Promise<{json: any, params}> } */ API.sendNotificationResponse = function (params) { return this.call(`notifications/${params.notificationId}/respond`, { @@ -3477,14 +3475,20 @@ speechSynthesis.getVoices(); console.log('NOTIFICATION:RESPONSE', args); }); - /* - params: { + /** + * string that represents valid serialized JSON of T's value + * @template T=any + * @typedef {string} JsonString + */ + /** + * @param {{ receiverUserId: string, type: string, message: string, seen: boolean, - details: json-string - } + details: JsonString + }} params + * @return { Promise<{json: any, params}> } */ API.sendInvite = function (params, receiverUserId) { return this.call(`invite/${receiverUserId}`, { @@ -3581,11 +3585,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - notificationId: string - } - */ + /** + * @param {{ notificationId: string }} params + * @return { Promise<{json: any, params}> } + */ API.acceptNotification = function (params) { return this.call( `auth/user/notifications/${params.notificationId}/accept`, @@ -3602,11 +3605,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - notificationId: string - } - */ + /** + * @param {{ notificationId: string }} params + * @return { Promise<{json: any, params}> } + */ API.hideNotification = function (params) { return this.call( `auth/user/notifications/${params.notificationId}/hide`, @@ -3768,12 +3770,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - moderated: string, - type: string - } - */ + /** + * @param {{ moderated: string, type: string }} params + * @return { Promise<{json: any, params}> } + */ // old-way: POST auth/user/blocks {blocked:userId} API.sendPlayerModeration = function (params) { return this.call('auth/user/playermoderations', { @@ -3789,12 +3789,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - moderated: string, - type: string - } - */ + /** + * @param {{ moderated: string, type: string }} params + * @return { Promise<{json: any, params}> } + */ // old-way: PUT auth/user/unblocks {blocked:userId} API.deletePlayerModeration = function (params) { return this.call('auth/user/unplayermoderate', { @@ -3827,12 +3825,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - avatarModerationType: string, - targetAvatarId: string - } - */ + /** + * @param {{ avatarModerationType: string, targetAvatarId: string }} params + * @return { Promise<{json: any, params}> } + */ API.sendAvatarModeration = function (params) { return this.call('auth/user/avatarmoderations', { method: 'POST', @@ -3847,12 +3843,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - avatarModerationType: string, - targetAvatarId: string - } - */ + /** + * @param {{ avatarModerationType: string, targetAvatarId: string }} params + * @return { Promise<{json: any, params}> } + */ API.deleteAvatarModeration = function (params) { return this.call( `auth/user/avatarmoderations?targetAvatarId=${encodeURIComponent( @@ -4475,14 +4469,15 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - n: number, - offset: number, - type: string, - tag: string - } - */ + /** + * @param {{ + * n: number, + * offset: number, + * type: string, + * tag: string + * }} params + * @return { Promise<{json: any, params}> } + */ API.getFavorites = function (params) { return this.call('favorites', { method: 'GET', @@ -4497,13 +4492,14 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - type: string, - favoriteId: string (objectId), - tags: string - } - */ + /** + * @param {{ + * type: string, + * favoriteId: string (objectId), + * tags: string + * }} params + * @return { Promise<{json: any, params}> } + */ API.addFavorite = function (params) { return this.call('favorites', { method: 'POST', @@ -4518,11 +4514,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - objectId: string - } - */ + /** + * @param {{ objectId: string }} params + * @return { Promise<{json: any, params}> } + */ API.deleteFavorite = function (params) { return this.call(`favorites/${params.objectId}`, { method: 'DELETE' @@ -4536,13 +4531,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - n: number, - offset: number, - type: string - } - */ + /** + * @param {{ n: number, offset: number, type: string }} params + * @return { Promise<{json: any, params}> } + */ API.getFavoriteGroups = function (params) { return this.call('favorite/groups', { method: 'GET', @@ -4557,14 +4549,11 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - type: string, - group: string (name), - displayName: string, - visibility: string - } - */ + /** + * + * @param {{ type: string, group: string, displayName: string, visibility: string }} params group is a name + * @return { Promise<{json: any, params}> } + */ API.saveFavoriteGroup = function (params) { return this.call( `favorite/group/${params.type}/${params.group}/${this.currentUser.id}`, @@ -4582,12 +4571,13 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - type: string, - group: string (name) - } - */ + /** + * @param {{ + * type: string, + * group: string (name) + * }} params + * @return { Promise<{json: any, params}> } + */ API.clearFavoriteGroup = function (params) { return this.call( `favorite/group/${params.type}/${params.group}/${this.currentUser.id}`, @@ -4605,11 +4595,12 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - n: number, - offset: number - } + /** + * @param {{ + n: number, + offset: number + }} params + * @return { Promise<{json: any, params}> } */ API.getFavoriteWorlds = function (params) { return this.call('worlds/favorites', { @@ -4625,11 +4616,12 @@ speechSynthesis.getVoices(); }); }; - /* - params: { + /** + * @param {{ n: number, offset: number - } + }} params + * @return { Promise<{json: any, params}> } */ API.getFavoriteAvatars = function (params) { return this.call('avatars/favorites', { @@ -26944,11 +26936,9 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - groupId: string - } - */ + /** + * @param {{ groupId: string }} params + */ API.getGroup = function (params) { return this.call(`groups/${params.groupId}`, { method: 'GET', @@ -26983,11 +26973,10 @@ speechSynthesis.getVoices(); D.ref = ref; }); - /* - params: { - userId: string - } - */ + /** + * @param {{ userId: string }} params + * @return { Promise<{json: any, params}> } + */ API.getRepresentedGroup = function (params) { return this.call(`users/${params.userId}/groups/represented`, { method: 'GET' @@ -27018,11 +27007,10 @@ speechSynthesis.getVoices(); }); }); - /* - params: { - userId: string - } - */ + /** + * @param {{ userId: string }} params + * @return { Promise<{json: any, params}> } + */ API.getGroups = function (params) { return this.call(`users/${params.userId}/groups`, { method: 'GET' @@ -27050,11 +27038,10 @@ speechSynthesis.getVoices(); } }); - /* - params: { - groupId: string - } - */ + /** + * @param {{ groupId: string }} params + * @return { Promise<{json: any, params}> } + */ API.joinGroup = function (params) { return this.call(`groups/${params.groupId}/join`, { method: 'POST' @@ -27099,11 +27086,10 @@ speechSynthesis.getVoices(); this.currentUserGroups.set(groupId, json); }); - /* - params: { - groupId: string - } - */ + /** + * @param {{ groupId: string }} params + * @return { Promise<{json: any, params}> } + */ API.leaveGroup = function (params) { return this.call(`groups/${params.groupId}/leave`, { method: 'POST' @@ -27133,11 +27119,10 @@ speechSynthesis.getVoices(); this.currentUserGroups.delete(groupId); }); - /* - params: { - groupId: string - } - */ + /** + * @param {{ groupId: string }} params + * @return { Promise<{json: any, params}> } + */ API.cancelGroupRequest = function (params) { return this.call(`groups/${params.groupId}/requests`, { method: 'DELETE' @@ -27191,11 +27176,10 @@ speechSynthesis.getVoices(); } }); - /* - params: { - query: string - } - */ + /** + * @param {{ query: string }} params + * @return { Promise<{json: any, params}> } + */ API.groupStrictsearch = function (params) { return this.call(`groups/strictsearch`, { method: 'GET', @@ -27304,12 +27288,13 @@ speechSynthesis.getVoices(); } }); - /* - params: { + /** + * @param {{ userId: string, groupId: string, roleId: string - } + }} params + * @return { Promise<{json: any, params}> } */ API.addGroupMemberRole = function (params) { return this.call( @@ -27327,12 +27312,13 @@ speechSynthesis.getVoices(); }); }; - /* - params: { + /** + * @param {{ userId: string, groupId: string, roleId: string - } + }} params + * @return { Promise<{json: any, params}> } */ API.removeGroupMemberRole = function (params) { return this.call( @@ -27381,11 +27367,10 @@ speechSynthesis.getVoices(); } }); - /* - params: { - groupId: string - } - */ + //** + // * @param {{ groupId: string }} params + // * @return { Promise<{json: any, params}> } + // */ // API.getGroupAnnouncement = function (params) { // return this.call(`groups/${params.groupId}/announcement`, { // method: 'GET' @@ -27399,12 +27384,13 @@ speechSynthesis.getVoices(); // }); // }; - /* - params: { + /** + * @param {{ groupId: string, n: number, offset: number - } + }} params + * @return { Promise<{json: any, params}> } */ API.getGroupPosts = function (params) { return this.call(`groups/${params.groupId}/posts`, { @@ -27420,11 +27406,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - groupId: string - } - */ + /** + * @param {{ groupId: string }} params + * @return { Promise<{json: any, params}> } + */ API.getAllGroupPosts = async function (params) { var posts = []; var offset = 0; @@ -27446,11 +27431,12 @@ speechSynthesis.getVoices(); }; }; - /* - params: { + /** + * @param {{ groupId: string, userId: string - } + }} params + * @return { Promise<{json: any, params}> } */ API.getGroupMember = function (params) { return this.call(`groups/${params.groupId}/members/${params.userId}`, { @@ -27465,12 +27451,13 @@ speechSynthesis.getVoices(); }); }; - /* - params: { + /** + * @param {{ groupId: string, n: number, offset: number - } + }} params + * @return { Promise<{json: any, params}> } */ API.getGroupMembers = function (params) { return this.call(`groups/${params.groupId}/members`, { @@ -27501,13 +27488,14 @@ speechSynthesis.getVoices(); args.ref = this.applyGroupMember(args.json); }); - /* - params: { + /** + * @param {{ groupId: string, query: string, n: number, offset: number - } + }} params + * @return { Promise<{json: any, params}> } */ API.getGroupMembersSearch = function (params) { return this.call(`groups/${params.groupId}/members/search`, { @@ -27534,11 +27522,12 @@ speechSynthesis.getVoices(); } }); - /* - params: { + /** + * @param {{ groupId: string, userId: string - } + * }} params + * @return { Promise<{json: any, params}> } */ API.sendGroupInvite = function (params) { return this.call(`groups/${params.groupId}/invites`, { @@ -27556,11 +27545,12 @@ speechSynthesis.getVoices(); }); }; - /* - params: { + /** + * @param {{ groupId: string, userId: string - } + }} params + * @return { Promise<{json: any, params}> } */ API.kickGroupMember = function (params) { return this.call(`groups/${params.groupId}/members/${params.userId}`, { @@ -27575,12 +27565,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - groupId: string, - userId: string - } - */ + /** + * @param {{ groupId: string, userId: string }} params + * @return { Promise<{json: any, params}> } + */ API.banGroupMember = function (params) { return this.call(`groups/${params.groupId}/bans`, { method: 'POST', @@ -27597,11 +27585,10 @@ speechSynthesis.getVoices(); }); }; - /* - params: { - groupId: string - } - */ + /** + * @param {{ groupId: string }} params + * @return { Promise<{json: any, params}> } + */ API.getGroupInstances = function (params) { return this.call( @@ -27641,11 +27628,10 @@ speechSynthesis.getVoices(); } }); - /* - params: { - groupId: string - } - */ + /** + * @param {{ groupId: string }} params + * @return { Promise<{json: any, params}> } + */ API.getGroupRoles = function (params) { return this.call(`groups/${params.groupId}/roles`, { @@ -27712,14 +27698,15 @@ speechSynthesis.getVoices(); } }); - /* - params: { + /** + * @param {{ query: string, n: number, offset: number, order: string, sortBy: string - } + }} params + * @return { Promise<{json: any, params}> } */ API.groupSearch = function (params) { return this.call(`groups`, { @@ -27746,11 +27733,10 @@ speechSynthesis.getVoices(); } }); - /* - params: { - groupId: string - } - */ + /** + * @param {{ groupId: string }} params + * @return { Promise<{json: any, params}> } + */ API.getCachedGroup = function (params) { return new Promise((resolve, reject) => { var ref = this.cachedGroups.get(params.groupId); @@ -28468,13 +28454,14 @@ speechSynthesis.getVoices(); $app.data.isGroupGalleryLoading = false; - /* - params: { + /** + * @param {{ groupId: string, galleryId: string, n: number, offset: number - } + }} params + * @return { Promise<{json: any, params}> } */ API.getGroupGallery = function (params) { return this.call( @@ -28906,13 +28893,14 @@ speechSynthesis.getVoices(); }); }; - /* - params: { + /** + * @param {{ userId: string, contentType: string, reason: string, type: string - } + }} params + * @return { Promise<{json: any, params}> } */ API.reportUser = function (params) { return this.call(`feedback/${params.userId}/user`, { @@ -28936,11 +28924,13 @@ speechSynthesis.getVoices(); return text.replace(/([^!])\[[^\]]+\]\([^)]+\)/g, '$1'); }; - /* - params: { + /** + * @param {{ fileId: string, version: number - } + }} params + * @return { Promise<{json: any, params}> } + */ API.getFileAnalysis = function (params) { return this.call(`analysis/${params.fileId}/${params.version}`, {