noblox-asset.js 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
- package/.github/workflows/doc-publish.yml +33 -0
- package/.github/workflows/npmpublish.yml +72 -0
- package/.github/workflows/run-tests.yml +49 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/LICENSE +21 -0
- package/README.md +182 -0
- package/eslint.config.mjs +34 -0
- package/examples/cleanPlayers.js +130 -0
- package/examples/cleanWall.js +110 -0
- package/examples/revertRanks.js +100 -0
- package/examples/savePlayers.js +119 -0
- package/examples/saveWall.js +96 -0
- package/img/moderatedThumbnails/moderatedThumbnail_100x100.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_110x110.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_140x140.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_150x150.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_150x200.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_180x180.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_250x250.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_30x30.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_352x352.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_420x420.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_48x48.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_50x50.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_60x60.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_720x720.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_75x75.png +0 -0
- package/img/noblox-js-small.png +0 -0
- package/img/noblox-js.png +0 -0
- package/img/thumbnailSizes.png +0 -0
- package/jsDocsConfig.json +55 -0
- package/lib/accountinformation/getUserSocialLinks.js +40 -0
- package/lib/accountsettings/block.js +53 -0
- package/lib/accountsettings/unblock.js +53 -0
- package/lib/asset/deleteFromInventory.js +56 -0
- package/lib/asset/getGamePassProductInfo.js +50 -0
- package/lib/asset/getProductInfo.js +46 -0
- package/lib/asset/uploadAnimation.js +103 -0
- package/lib/asset/uploadItem.js +83 -0
- package/lib/asset/uploadModel.js +90 -0
- package/lib/avatar/avatarRules.js +39 -0
- package/lib/avatar/currentlyWearing.js +33 -0
- package/lib/avatar/getAvatar.js +36 -0
- package/lib/avatar/getCurrentAvatar.js +38 -0
- package/lib/avatar/getRecentItems.js +36 -0
- package/lib/avatar/outfitDetails.js +33 -0
- package/lib/avatar/outfits.js +38 -0
- package/lib/avatar/redrawAvatar.js +47 -0
- package/lib/avatar/removeAssetId.js +51 -0
- package/lib/avatar/setAvatarBodyColors.js +61 -0
- package/lib/avatar/setAvatarScales.js +61 -0
- package/lib/avatar/setPlayerAvatarType.js +51 -0
- package/lib/avatar/setWearingAssets.js +51 -0
- package/lib/avatar/wearAssetId.js +51 -0
- package/lib/badges/getAwardedTimestamps.js +49 -0
- package/lib/badges/getBadgeInfo.js +44 -0
- package/lib/badges/getGameBadges.js +63 -0
- package/lib/badges/getPlayerBadges.js +28 -0
- package/lib/badges/updateBadgeInfo.js +75 -0
- package/lib/cache/add.js +14 -0
- package/lib/cache/addIf.js +26 -0
- package/lib/cache/clear.js +8 -0
- package/lib/cache/get.js +28 -0
- package/lib/cache/index.js +17 -0
- package/lib/cache/new.js +12 -0
- package/lib/cache/wrap.js +25 -0
- package/lib/chat/addUsersToConversation.js +58 -0
- package/lib/chat/chatSettings.js +34 -0
- package/lib/chat/getChatMessages.js +41 -0
- package/lib/chat/getConversations.js +44 -0
- package/lib/chat/getRolloutSettings.js +36 -0
- package/lib/chat/getUnreadConversationCount.js +34 -0
- package/lib/chat/getUnreadMessages.js +39 -0
- package/lib/chat/getUserConversations.js +38 -0
- package/lib/chat/markChatAsRead.js +53 -0
- package/lib/chat/markChatAsSeen.js +51 -0
- package/lib/chat/multiGetLatestMessages.js +38 -0
- package/lib/chat/onNewConversation.js +50 -0
- package/lib/chat/onNewMessage.js +53 -0
- package/lib/chat/onNewMessageBySelf.js +50 -0
- package/lib/chat/onUserOnline.js +50 -0
- package/lib/chat/onUserTyping.js +54 -0
- package/lib/chat/removeFromGroupConversation.js +59 -0
- package/lib/chat/renameGroupConversation.js +58 -0
- package/lib/chat/sendChatMessage.js +58 -0
- package/lib/chat/setChatUserTyping.js +58 -0
- package/lib/chat/start121Conversation.js +51 -0
- package/lib/chat/startCloudEditConversation.js +51 -0
- package/lib/chat/startGroupConversation.js +59 -0
- package/lib/client/onNotification.js +86 -0
- package/lib/client/setAPIKey.js +18 -0
- package/lib/client/setCookie.js +38 -0
- package/lib/datastores/deleteDatastoreEntry.js +56 -0
- package/lib/datastores/getDatastoreEntry.js +88 -0
- package/lib/datastores/getDatastoreEntryVersions.js +73 -0
- package/lib/datastores/getDatastoreKeys.js +63 -0
- package/lib/datastores/getDatastores.js +62 -0
- package/lib/datastores/incrementDatastoreEntry.js +83 -0
- package/lib/datastores/setDatastoreEntry.js +80 -0
- package/lib/develop/canManage.js +42 -0
- package/lib/develop/configureItem.js +210 -0
- package/lib/develop/updateUniverse.js +52 -0
- package/lib/develop/updateUniverseAccess.js +54 -0
- package/lib/economy/getGroupFunds.js +42 -0
- package/lib/economy/getGroupPayoutEligibility.js +55 -0
- package/lib/economy/getGroupRevenueSummary.js +42 -0
- package/lib/economy/getGroupTransactions.js +32 -0
- package/lib/economy/getResaleData.js +48 -0
- package/lib/economy/getResellers.js +35 -0
- package/lib/economy/getUserFunds.js +43 -0
- package/lib/economy/getUserTransactions.js +34 -0
- package/lib/economy/onGroupTransaction.js +74 -0
- package/lib/friends/acceptFriendRequest.js +54 -0
- package/lib/friends/declineAllFriendRequests.js +52 -0
- package/lib/friends/declineFriendRequest.js +54 -0
- package/lib/friends/getFollowerCount.js +35 -0
- package/lib/friends/getFollowers.js +56 -0
- package/lib/friends/getFollowingCount.js +35 -0
- package/lib/friends/getFollowings.js +56 -0
- package/lib/friends/getFriendCount.js +35 -0
- package/lib/friends/getFriendRequests.js +51 -0
- package/lib/friends/getFriends.js +48 -0
- package/lib/friends/onFriendRequest.js +58 -0
- package/lib/friends/removeFriend.js +53 -0
- package/lib/friends/sendFriendRequest.js +54 -0
- package/lib/friends/unfollow.js +53 -0
- package/lib/games/addDeveloperProduct.js +53 -0
- package/lib/games/configureGamePass.js +126 -0
- package/lib/games/getDeveloperProducts.js +44 -0
- package/lib/games/getGameInstances.js +31 -0
- package/lib/games/getGamePasses.js +39 -0
- package/lib/games/getGameRevenue.js +48 -0
- package/lib/games/getGameSocialLinks.js +42 -0
- package/lib/games/getGroupGames.js +30 -0
- package/lib/games/getPlaceInfo.js +47 -0
- package/lib/games/getUniverseInfo.js +50 -0
- package/lib/games/publishToTopic.js +52 -0
- package/lib/games/sendUserNotification.js +65 -0
- package/lib/games/updateDeveloperProduct.js +56 -0
- package/lib/groups/banFromGroup.js +47 -0
- package/lib/groups/changeRank.js +59 -0
- package/lib/groups/deleteWallPost.js +59 -0
- package/lib/groups/deleteWallPostsByUser.js +55 -0
- package/lib/groups/demote.js +25 -0
- package/lib/groups/exile.js +55 -0
- package/lib/groups/getAuditLog.js +64 -0
- package/lib/groups/getGroup.js +50 -0
- package/lib/groups/getGroupBans.js +37 -0
- package/lib/groups/getGroupSocialLinks.js +41 -0
- package/lib/groups/getGroups.js +82 -0
- package/lib/groups/getJoinRequest.js +47 -0
- package/lib/groups/getJoinRequests.js +53 -0
- package/lib/groups/getPlayers.js +103 -0
- package/lib/groups/getRankInGroup.js +45 -0
- package/lib/groups/getRankNameInGroup.js +44 -0
- package/lib/groups/getRole.js +64 -0
- package/lib/groups/getRolePermissions.js +48 -0
- package/lib/groups/getRoles.js +53 -0
- package/lib/groups/getShout.js +47 -0
- package/lib/groups/getWall.js +56 -0
- package/lib/groups/groupPayout.js +103 -0
- package/lib/groups/handleJoinRequest.js +57 -0
- package/lib/groups/handleJoinRequests.js +61 -0
- package/lib/groups/leaveGroup.js +56 -0
- package/lib/groups/onAuditLog.js +62 -0
- package/lib/groups/onJoinRequest.js +63 -0
- package/lib/groups/onJoinRequestHandle.js +105 -0
- package/lib/groups/onShout.js +57 -0
- package/lib/groups/onWallPost.js +58 -0
- package/lib/groups/promote.js +25 -0
- package/lib/groups/searchGroups.js +32 -0
- package/lib/groups/setGroupDescription.js +58 -0
- package/lib/groups/setGroupName.js +59 -0
- package/lib/groups/setRank.js +74 -0
- package/lib/groups/setRoleInfo.js +84 -0
- package/lib/groups/shout.js +58 -0
- package/lib/groups/unbanFromGroup.js +41 -0
- package/lib/index.js +212 -0
- package/lib/internal/levelOneCopy.js +16 -0
- package/lib/internal/queue.js +61 -0
- package/lib/internal/timeout.js +30 -0
- package/lib/internal/wrap.js +78 -0
- package/lib/inventory/getCollectibles.js +31 -0
- package/lib/inventory/getInventory.js +32 -0
- package/lib/inventory/getInventoryById.js +31 -0
- package/lib/inventory/getOwnership.js +47 -0
- package/lib/inventory/getUAIDs.js +47 -0
- package/lib/itemconfiguration/getGroupAssets.js +32 -0
- package/lib/options.js +26 -0
- package/lib/party/onPartyDeleted.js +53 -0
- package/lib/party/onPartyInvite.js +53 -0
- package/lib/party/onPartyJoinedGame.js +53 -0
- package/lib/party/onPartyLeftGame.js +53 -0
- package/lib/party/onPartySelfJoined.js +53 -0
- package/lib/party/onPartySelfLeft.js +53 -0
- package/lib/party/onPartyUserJoined.js +53 -0
- package/lib/party/onPartyUserLeft.js +53 -0
- package/lib/premiumfeatures/getPremium.js +46 -0
- package/lib/presence/getPresences.js +60 -0
- package/lib/privatemessages/getMessages.js +55 -0
- package/lib/privatemessages/message.js +75 -0
- package/lib/privatemessages/onMessage.js +89 -0
- package/lib/thumbnails/getLogo.js +56 -0
- package/lib/thumbnails/getPlayerThumbnail.js +120 -0
- package/lib/thumbnails/getThumbnails.js +92 -0
- package/lib/trades/acceptTrade.js +52 -0
- package/lib/trades/canTradeWith.js +43 -0
- package/lib/trades/counterTrade.js +78 -0
- package/lib/trades/declineTrade.js +52 -0
- package/lib/trades/getTradeInfo.js +47 -0
- package/lib/trades/getTrades.js +37 -0
- package/lib/trades/sendTrade.js +76 -0
- package/lib/users/getBlurb.js +37 -0
- package/lib/users/getIdFromUsername.js +56 -0
- package/lib/users/getPlayerInfo.js +128 -0
- package/lib/users/getUserInfo.js +35 -0
- package/lib/users/getUsernameFromId.js +45 -0
- package/lib/users/getUsernameHistory.js +42 -0
- package/lib/users/onBlurbChange.js +46 -0
- package/lib/users/searchUsers.js +41 -0
- package/lib/util/apiError.js +50 -0
- package/lib/util/clearSession.js +32 -0
- package/lib/util/generalRequest.js +61 -0
- package/lib/util/getAction.js +45 -0
- package/lib/util/getAuthenticatedUser.js +41 -0
- package/lib/util/getCurrentUser.js +58 -0
- package/lib/util/getGeneralToken.js +52 -0
- package/lib/util/getHash.js +29 -0
- package/lib/util/getInputs.js +37 -0
- package/lib/util/getPageResults.js +86 -0
- package/lib/util/getSenderUserId.js +30 -0
- package/lib/util/getSession.js +38 -0
- package/lib/util/getVerification.js +60 -0
- package/lib/util/getVerificationInputs.js +31 -0
- package/lib/util/http.js +138 -0
- package/lib/util/jar.js +25 -0
- package/lib/util/refreshCookie.js +52 -0
- package/lib/util/relog.js +81 -0
- package/lib/util/setOptions.js +54 -0
- package/lib/util/shortPoll.js +102 -0
- package/package.json +76 -0
- package/postinstall.mjs +1 -0
- package/settings.json +115 -0
- package/test/accountinformation.test.js +27 -0
- package/test/accountsettings.test.js +27 -0
- package/test/asset.test.js +81 -0
- package/test/assets/Great-White-Shark-Fin.rbxm +0 -0
- package/test/assets/KeyframeSequence.rbxm +0 -0
- package/test/avatar.test.js +164 -0
- package/test/badges.test.js +96 -0
- package/test/chat.test.js +104 -0
- package/test/datastore.test.js +105 -0
- package/test/develop.test.js +53 -0
- package/test/economy.test.js +143 -0
- package/test/friends.test.js +146 -0
- package/test/games.test.js +229 -0
- package/test/groups.test.js +405 -0
- package/test/inventory.test.js +98 -0
- package/test/itemconfiguration.test.js +24 -0
- package/test/premiumfeatures.test.js +17 -0
- package/test/presence.test.js +25 -0
- package/test/privatemessages.test.js +33 -0
- package/test/thumbnails.test.js +53 -0
- package/test/users.test.js +110 -0
- package/tutorials/Authentication.md +75 -0
- package/tutorials/Event Emitters.md +26 -0
- package/tutorials/Promises.md +86 -0
- package/tutorials/VPS Authentication.md +72 -0
- package/typings/index.d.ts +2639 -0
- package/typings/jsDocs.ts +1987 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Includes
|
|
2
|
+
const http = require('../util/http.js').func
|
|
3
|
+
const getGeneralToken = require('../util/getGeneralToken.js').func
|
|
4
|
+
|
|
5
|
+
// Args
|
|
6
|
+
exports.required = ['group', 'member', 'amount']
|
|
7
|
+
exports.optional = ['recurring', 'usePercentage', 'jar']
|
|
8
|
+
|
|
9
|
+
// Docs
|
|
10
|
+
/**
|
|
11
|
+
* 🔐 Pay group funds out to a user.
|
|
12
|
+
* @category Group
|
|
13
|
+
* @alias groupPayout
|
|
14
|
+
* @param {number} group - The id of the group.
|
|
15
|
+
* @param {number | Array<number>} member - The member or array of members to payout.
|
|
16
|
+
* @param {number} amount - The amount of Robux for each recipient to receive.
|
|
17
|
+
* @param {boolean=} [recurring=false] - If the payment is recurring.
|
|
18
|
+
* @param {boolean=} [usePercentage=false] - If the amount is a percentage.
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
* @example const noblox = require("noblox.js")
|
|
21
|
+
* // Login using your cookie
|
|
22
|
+
* noblox.groupPayout(1117747196, 55549140, 30)
|
|
23
|
+
**/
|
|
24
|
+
|
|
25
|
+
// Define
|
|
26
|
+
function groupPayout (jar, token, group, data, recurring, usePercentage) {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const httpOpt = {
|
|
29
|
+
url: `//groups.roblox.com/v1/groups/${group}/payouts${recurring ? '/recurring' : ''}`,
|
|
30
|
+
options: {
|
|
31
|
+
resolveWithFullResponse: true,
|
|
32
|
+
method: 'POST',
|
|
33
|
+
jar,
|
|
34
|
+
headers: {
|
|
35
|
+
'X-CSRF-TOKEN': token,
|
|
36
|
+
'Content-Type': 'application/json'
|
|
37
|
+
},
|
|
38
|
+
body: JSON.stringify({
|
|
39
|
+
PayoutType: (usePercentage ? 'Percentage' : 'FixedAmount'),
|
|
40
|
+
Recipients: data
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return http(httpOpt)
|
|
45
|
+
.then(function (res) {
|
|
46
|
+
if (res.statusCode === 200) {
|
|
47
|
+
resolve()
|
|
48
|
+
} else {
|
|
49
|
+
const body = JSON.parse(res.body) || {}
|
|
50
|
+
if (body.errors && body.errors.length > 0) {
|
|
51
|
+
const errors = body.errors.map((e) => {
|
|
52
|
+
return e.message
|
|
53
|
+
})
|
|
54
|
+
reject(new Error(`${res.statusCode} ${errors.join(', ')}`))
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}).catch(error => reject(error))
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Although I would normally leave it to the endpoint to error when incorrect percentages are given, it's not very reliable so I'll do it instead
|
|
62
|
+
function isPercentage (num) {
|
|
63
|
+
return num >= 0 && num <= 100 && num % 1 === 0
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.func = function (args) {
|
|
67
|
+
const jar = args.jar
|
|
68
|
+
let member = args.member
|
|
69
|
+
let amount = args.amount
|
|
70
|
+
const recurring = args.recurring || false
|
|
71
|
+
const usePercentage = recurring ? true : args.usePercentage
|
|
72
|
+
const data = []
|
|
73
|
+
|
|
74
|
+
if (!(member instanceof Array)) {
|
|
75
|
+
member = [member]
|
|
76
|
+
amount = [amount]
|
|
77
|
+
} else if (!(amount instanceof Array) || member.length !== amount.length) {
|
|
78
|
+
throw new Error('If member is an array amount must be a parallel array')
|
|
79
|
+
}
|
|
80
|
+
let total = 0
|
|
81
|
+
for (let i = 0; i < member.length; i++) {
|
|
82
|
+
const value = amount[i]
|
|
83
|
+
if (usePercentage) {
|
|
84
|
+
if (!isPercentage(value)) {
|
|
85
|
+
throw new Error('Percent values must be whole numbers between 0 and 100 inclusive')
|
|
86
|
+
}
|
|
87
|
+
total += value
|
|
88
|
+
if (total > 100) {
|
|
89
|
+
throw new Error('Sum of percent values must be less than 100')
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
data.push({
|
|
93
|
+
recipientId: member[i],
|
|
94
|
+
recipientType: 'User',
|
|
95
|
+
amount: value
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return getGeneralToken({ jar })
|
|
100
|
+
.then(function (xcsrf) {
|
|
101
|
+
return groupPayout(jar, xcsrf, args.group, data, recurring, usePercentage)
|
|
102
|
+
})
|
|
103
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const RobloxAPIError = require('../util/apiError.js')
|
|
2
|
+
|
|
3
|
+
// Includes
|
|
4
|
+
const http = require('../util/http.js').func
|
|
5
|
+
const getGeneralToken = require('../util/getGeneralToken.js').func
|
|
6
|
+
|
|
7
|
+
// Args
|
|
8
|
+
exports.required = ['group', 'userId', 'accept']
|
|
9
|
+
exports.optional = ['jar']
|
|
10
|
+
|
|
11
|
+
// Docs
|
|
12
|
+
/**
|
|
13
|
+
* 🔐 Accept/decline a user's join request.
|
|
14
|
+
* @category Group
|
|
15
|
+
* @alias handleJoinRequest
|
|
16
|
+
* @param {number} group - The id of the group.
|
|
17
|
+
* @param {number} userId - The id of the user.
|
|
18
|
+
* @param {boolean} accept - If the user should be accepted into the group.
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
* @example const noblox = require("noblox.js")
|
|
21
|
+
* // Login using your cookie
|
|
22
|
+
* noblox.handleJoinRequest(1, 1, true)
|
|
23
|
+
**/
|
|
24
|
+
|
|
25
|
+
function handleJoinRequest (group, userId, accept, jar, xcsrf) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const httpOpt = {
|
|
28
|
+
url: `https://groups.roblox.com/v1/groups/${group}/join-requests/users/${userId}`,
|
|
29
|
+
options: {
|
|
30
|
+
method: accept ? 'POST' : 'DELETE',
|
|
31
|
+
resolveWithFullResponse: true,
|
|
32
|
+
jar,
|
|
33
|
+
headers: {
|
|
34
|
+
'X-CSRF-TOKEN': xcsrf
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return http(httpOpt)
|
|
40
|
+
.then(function (res) {
|
|
41
|
+
if (res.statusCode !== 200) {
|
|
42
|
+
reject(new RobloxAPIError(res))
|
|
43
|
+
} else {
|
|
44
|
+
resolve()
|
|
45
|
+
}
|
|
46
|
+
}).catch(error => reject(error))
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Define
|
|
51
|
+
exports.func = function (args) {
|
|
52
|
+
const jar = args.jar
|
|
53
|
+
return getGeneralToken({ jar })
|
|
54
|
+
.then(function (xcsrf) {
|
|
55
|
+
return handleJoinRequest(args.group, args.userId, args.accept, args.jar, xcsrf)
|
|
56
|
+
})
|
|
57
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const RobloxAPIError = require('../util/apiError.js')
|
|
2
|
+
|
|
3
|
+
// Includes
|
|
4
|
+
const http = require('../util/http.js').func
|
|
5
|
+
const getGeneralToken = require('../util/getGeneralToken.js').func
|
|
6
|
+
|
|
7
|
+
// Args
|
|
8
|
+
exports.required = ['group', 'userIds', 'accept']
|
|
9
|
+
exports.optional = ['jar']
|
|
10
|
+
|
|
11
|
+
// Docs
|
|
12
|
+
/**
|
|
13
|
+
* 🔐 Batch accept/decline multiple users' join requests.
|
|
14
|
+
* @category Group
|
|
15
|
+
* @alias handleJoinRequest
|
|
16
|
+
* @param {number} group - The id of the group.
|
|
17
|
+
* @param {Array<number>} userIds - The ids of the users.
|
|
18
|
+
* @param {boolean} accept - If the users should be accepted into the group.
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
* @example const noblox = require("noblox.js")
|
|
21
|
+
* // Login using your cookie
|
|
22
|
+
* noblox.handleJoinRequests(1, [1], true)
|
|
23
|
+
**/
|
|
24
|
+
|
|
25
|
+
function handleJoinRequests (group, userIds, accept, jar, xcsrf) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const httpOpt = {
|
|
28
|
+
url: `https://groups.roblox.com/v1/groups/${group}/join-requests`,
|
|
29
|
+
options: {
|
|
30
|
+
method: accept ? 'POST' : 'DELETE',
|
|
31
|
+
resolveWithFullResponse: true,
|
|
32
|
+
jar,
|
|
33
|
+
headers: {
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
'X-CSRF-TOKEN': xcsrf
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify({
|
|
38
|
+
UserIds: userIds
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return http(httpOpt)
|
|
44
|
+
.then(function (res) {
|
|
45
|
+
if (res.statusCode !== 200) {
|
|
46
|
+
reject(new RobloxAPIError(res))
|
|
47
|
+
} else {
|
|
48
|
+
resolve()
|
|
49
|
+
}
|
|
50
|
+
}).catch(error => reject(error))
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Define
|
|
55
|
+
exports.func = function (args) {
|
|
56
|
+
const jar = args.jar
|
|
57
|
+
return getGeneralToken({ jar })
|
|
58
|
+
.then(function (xcsrf) {
|
|
59
|
+
return handleJoinRequests(args.group, args.userIds, args.accept, args.jar, xcsrf)
|
|
60
|
+
})
|
|
61
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Includes
|
|
2
|
+
const http = require('../util/http.js').func
|
|
3
|
+
const getCurrentUser = require('../util/getCurrentUser').func
|
|
4
|
+
const getGeneralToken = require('../util/getGeneralToken.js').func
|
|
5
|
+
const RobloxAPIError = require('../util/apiError.js')
|
|
6
|
+
|
|
7
|
+
// Args
|
|
8
|
+
exports.required = ['group']
|
|
9
|
+
exports.optional = []
|
|
10
|
+
|
|
11
|
+
// Docs
|
|
12
|
+
/**
|
|
13
|
+
* 🔐 Leave a group.
|
|
14
|
+
* @category Group
|
|
15
|
+
* @alias leaveGroup
|
|
16
|
+
* @param {number} group - The id of the group.
|
|
17
|
+
* @returns {Promise<void>}
|
|
18
|
+
* @example const noblox = require("noblox.js")
|
|
19
|
+
* // Login using your cookie
|
|
20
|
+
* noblox.leaveGroup(1)
|
|
21
|
+
**/
|
|
22
|
+
|
|
23
|
+
// Define
|
|
24
|
+
function leaveGroup (group, jar, xcsrf, userId) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const httpOpt = {
|
|
27
|
+
url: `https://groups.roblox.com/v1/groups/${group}/users/${userId}`,
|
|
28
|
+
options: {
|
|
29
|
+
method: 'DELETE',
|
|
30
|
+
resolveWithFullResponse: true,
|
|
31
|
+
jar,
|
|
32
|
+
headers: {
|
|
33
|
+
'X-CSRF-TOKEN': xcsrf
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return http(httpOpt)
|
|
39
|
+
.then(function (res) {
|
|
40
|
+
if (res.statusCode !== 200) {
|
|
41
|
+
reject(new RobloxAPIError(res))
|
|
42
|
+
} else {
|
|
43
|
+
resolve()
|
|
44
|
+
}
|
|
45
|
+
}).catch(error => reject(error))
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
exports.func = function (args) {
|
|
50
|
+
const jar = args.jar
|
|
51
|
+
return getGeneralToken({ jar })
|
|
52
|
+
.then(async function (xcsrf) {
|
|
53
|
+
const currentUser = await getCurrentUser({ jar })
|
|
54
|
+
return leaveGroup(args.group, args.jar, xcsrf, currentUser.UserID)
|
|
55
|
+
})
|
|
56
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Includes
|
|
2
|
+
const shortPoll = require('../util/shortPoll.js').func
|
|
3
|
+
const getAuditLog = require('./getAuditLog.js').func
|
|
4
|
+
|
|
5
|
+
// Args
|
|
6
|
+
exports.required = ['group']
|
|
7
|
+
exports.optional = ['jar']
|
|
8
|
+
|
|
9
|
+
// Docs
|
|
10
|
+
/**
|
|
11
|
+
* 🔐 An event for when an audit log event is added.
|
|
12
|
+
* @category Group
|
|
13
|
+
* @alias onAuditLog
|
|
14
|
+
* @param {number} group - The id of the group.
|
|
15
|
+
* @returns An EventEmitter that emits when an action is added to the audit log.
|
|
16
|
+
* @example const noblox = require("noblox.js")
|
|
17
|
+
* // Login using your cookie
|
|
18
|
+
* const auditEvent = noblox.onAuditLog(1)
|
|
19
|
+
* auditEvent.on("data", function(data) {
|
|
20
|
+
* console.log("New action!", data)
|
|
21
|
+
* })
|
|
22
|
+
* auditEvent.on("error", function(err) {
|
|
23
|
+
* console.error("Something went wrong: ", err)
|
|
24
|
+
* // Handle error as needed
|
|
25
|
+
* })
|
|
26
|
+
**/
|
|
27
|
+
|
|
28
|
+
// Define
|
|
29
|
+
exports.func = function (args) {
|
|
30
|
+
let empty = false
|
|
31
|
+
return shortPoll({
|
|
32
|
+
getLatest: function (latest) {
|
|
33
|
+
return getAuditLog({ group: args.group, jar: args.jar, sortOrder: 'Desc' })
|
|
34
|
+
.then(function (audit) {
|
|
35
|
+
const given = []
|
|
36
|
+
if (audit) {
|
|
37
|
+
for (const key in audit.data) {
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(audit.data, key)) {
|
|
39
|
+
const date = audit.data[key].created
|
|
40
|
+
|
|
41
|
+
if (date > latest) {
|
|
42
|
+
latest = date
|
|
43
|
+
given.push(audit.data[key])
|
|
44
|
+
}
|
|
45
|
+
empty = false
|
|
46
|
+
} else if (!empty) {
|
|
47
|
+
const date = new Date()
|
|
48
|
+
given.push({ audit: '', author: { name: '', id: '-1' }, date })
|
|
49
|
+
latest = date
|
|
50
|
+
empty = true
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
latest,
|
|
55
|
+
data: given
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
delay: 'onAuditLog'
|
|
61
|
+
})
|
|
62
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Includes
|
|
2
|
+
const settings = require('../../settings.json')
|
|
3
|
+
const shortPoll = require('../util/shortPoll.js').func
|
|
4
|
+
const getJoinRequests = require('./getJoinRequests.js').func
|
|
5
|
+
const promiseTimeout = require('../internal/timeout')
|
|
6
|
+
|
|
7
|
+
// Args
|
|
8
|
+
exports.required = ['group']
|
|
9
|
+
exports.optional = ['jar']
|
|
10
|
+
|
|
11
|
+
// Docs
|
|
12
|
+
/**
|
|
13
|
+
* 🔐 An event for when someone makes a request to join the group.
|
|
14
|
+
* @category Group
|
|
15
|
+
* @alias onJoinRequest
|
|
16
|
+
* @param {number} group - The id of the group.
|
|
17
|
+
* @returns An EventEmitter that emits when someone tries to join.
|
|
18
|
+
* @example const noblox = require("noblox.js")
|
|
19
|
+
* // Login using your cookie
|
|
20
|
+
* const e = noblox.onJoinRequest()
|
|
21
|
+
* e.on("data", function(data) {
|
|
22
|
+
* console.log("New request!", data)
|
|
23
|
+
* })
|
|
24
|
+
* e.on("error", function (err) {
|
|
25
|
+
* ...
|
|
26
|
+
* })
|
|
27
|
+
**/
|
|
28
|
+
|
|
29
|
+
async function getRequests (jar, group, cursor) {
|
|
30
|
+
const requests = []
|
|
31
|
+
const res = await promiseTimeout(getJoinRequests({ jar, group, cursor, limit: 100 }), settings.event.timeout, 'getRequests onJoinRequests internal')
|
|
32
|
+
requests.push.apply(requests, res.data)
|
|
33
|
+
if (res.nextPageCursor) {
|
|
34
|
+
requests.push.apply(requests, await getRequests(jar, group, res.nextPageCursor))
|
|
35
|
+
}
|
|
36
|
+
return requests
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Define
|
|
40
|
+
exports.func = function (args) {
|
|
41
|
+
return shortPoll({
|
|
42
|
+
getLatest: function (latest) {
|
|
43
|
+
return getRequests(args.jar, args.group)
|
|
44
|
+
.then(function (requests) {
|
|
45
|
+
const given = []
|
|
46
|
+
for (const key in requests) {
|
|
47
|
+
if (Object.prototype.hasOwnProperty.call(requests, key)) {
|
|
48
|
+
const date = new Date(requests[key].created.slice(0, requests[key].created.lastIndexOf('.')))
|
|
49
|
+
if (date > latest) {
|
|
50
|
+
latest = date
|
|
51
|
+
given.push(requests[key])
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
latest,
|
|
57
|
+
data: given
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
delay: 'onJoinRequest'
|
|
62
|
+
})
|
|
63
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Includes
|
|
2
|
+
const settings = require('../../settings.json')
|
|
3
|
+
const shortPoll = require('../util/shortPoll.js').func
|
|
4
|
+
const getJoinRequests = require('./getJoinRequests.js').func
|
|
5
|
+
const handleJoinRequest = require('./handleJoinRequest.js').func
|
|
6
|
+
const promiseTimeout = require('../internal/timeout')
|
|
7
|
+
|
|
8
|
+
// Args
|
|
9
|
+
exports.required = ['group']
|
|
10
|
+
exports.optional = ['jar']
|
|
11
|
+
|
|
12
|
+
// Docs
|
|
13
|
+
/**
|
|
14
|
+
* 🔐 An event for when someone is added to the join requests, which allows you to handle the join request as part of a
|
|
15
|
+
* screening process. Emits all join requests and waits until all of them have been resolved by firing the handle event
|
|
16
|
+
* with the request and either true or false. You can also pass a third argument callback to handle to execute once the
|
|
17
|
+
* join request has been handled.
|
|
18
|
+
* Once all requests on a page have been resolved, the next page is collected. Make sure that all join requests are handled in some way.
|
|
19
|
+
* Because this function has to wait for input, it does handle timeouts but does them within the function as opposed to within shortPoll.
|
|
20
|
+
*
|
|
21
|
+
* The use of this function is generally pretty complex. If it is not as working as you expect, you may actually be wanting
|
|
22
|
+
* to use `onJoinRequest`.
|
|
23
|
+
* @category Group
|
|
24
|
+
* @alias onJoinRequestHandle
|
|
25
|
+
* @param {number} group - The id of the group.
|
|
26
|
+
* @returns An EventEmitter that emits when someone tries to join.
|
|
27
|
+
* @example const noblox = require("noblox.js")
|
|
28
|
+
* // Login using your cookie
|
|
29
|
+
*
|
|
30
|
+
* var blacklist = [1, 261]
|
|
31
|
+
* var evt = noblox.onJoinRequestHandle(18)
|
|
32
|
+
* evt.on('data', function (request) {
|
|
33
|
+
* noblox.getIdFromUsername(request.username).then(function (id) {
|
|
34
|
+
* for (var i = 0; i < blacklist.length; i++) {
|
|
35
|
+
* if (blacklist[i] === id) {
|
|
36
|
+
* evt.emit('handle', request, false);
|
|
37
|
+
* return;
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* evt.emit('handle', request, true, function () {
|
|
41
|
+
* console.log(`Welcome ${id} to the group`)
|
|
42
|
+
* });
|
|
43
|
+
*});
|
|
44
|
+
*});
|
|
45
|
+
**/
|
|
46
|
+
|
|
47
|
+
async function getRequests (jar, group, cursor) {
|
|
48
|
+
const requests = []
|
|
49
|
+
const res = await promiseTimeout(getJoinRequests({ jar, group, cursor, limit: 100 }), settings.event.timeout)
|
|
50
|
+
requests.push.apply(requests, res.data)
|
|
51
|
+
if (res.nextPageCursor) {
|
|
52
|
+
requests.push.apply(requests, await getRequests(jar, group, res.nextPageCursor))
|
|
53
|
+
}
|
|
54
|
+
return requests
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Define
|
|
58
|
+
exports.func = function (args) {
|
|
59
|
+
const group = args.group
|
|
60
|
+
const jar = args.jar
|
|
61
|
+
function getLatest (latest, evt) {
|
|
62
|
+
return getRequests(jar, group)
|
|
63
|
+
.then(function (requests) {
|
|
64
|
+
const complete = {
|
|
65
|
+
data: [],
|
|
66
|
+
latest: -2,
|
|
67
|
+
repeat: requests.length >= 20
|
|
68
|
+
}
|
|
69
|
+
let handled = 0
|
|
70
|
+
let promise
|
|
71
|
+
if (requests.length > 0) {
|
|
72
|
+
promise = new Promise(function (resolve, reject) {
|
|
73
|
+
evt.on('handle', function (request, accept, callback) {
|
|
74
|
+
const id = request.requester.userId
|
|
75
|
+
handleJoinRequest({ jar, group, userId: id, accept })
|
|
76
|
+
.then(function () {
|
|
77
|
+
handled++
|
|
78
|
+
if (callback) {
|
|
79
|
+
callback()
|
|
80
|
+
}
|
|
81
|
+
if (handled === requests.length) {
|
|
82
|
+
evt.removeAllListeners('handle')
|
|
83
|
+
resolve(complete)
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
.catch(reject)
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
for (let i = 0; i < requests.length; i++) {
|
|
91
|
+
const request = requests[i]
|
|
92
|
+
evt.emit('data', request)
|
|
93
|
+
}
|
|
94
|
+
if (requests.length > 0) {
|
|
95
|
+
return promise
|
|
96
|
+
}
|
|
97
|
+
return complete
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
return shortPoll({
|
|
101
|
+
getLatest,
|
|
102
|
+
delay: 'onJoinRequestHandle',
|
|
103
|
+
timeout: -1
|
|
104
|
+
})
|
|
105
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Includes
|
|
2
|
+
const shortPoll = require('../util/shortPoll.js').func
|
|
3
|
+
const getShout = require('./getShout.js').func
|
|
4
|
+
|
|
5
|
+
// Args
|
|
6
|
+
exports.required = ['group']
|
|
7
|
+
exports.optional = ['jar']
|
|
8
|
+
|
|
9
|
+
// Docs
|
|
10
|
+
/**
|
|
11
|
+
* 🔐 An event for when the shout is changed.
|
|
12
|
+
* @category Group
|
|
13
|
+
* @alias onShout
|
|
14
|
+
* @param {number} group - The id of the group.
|
|
15
|
+
* @returns An EventEmitter that emits when someone shouts.
|
|
16
|
+
* @example const noblox = require("noblox.js")
|
|
17
|
+
* // Login using your cookie
|
|
18
|
+
* const shoutEvent = noblox.onShout(1)
|
|
19
|
+
* shoutEvent.on("data", function(data) {
|
|
20
|
+
* console.log("New Shout!", data)
|
|
21
|
+
* })
|
|
22
|
+
* shoutEvent.on("error", function(err) {
|
|
23
|
+
* console.error("Something went wrong: ", err)
|
|
24
|
+
* // Handle error as needed
|
|
25
|
+
* })
|
|
26
|
+
**/
|
|
27
|
+
|
|
28
|
+
// Define
|
|
29
|
+
exports.func = function (args) {
|
|
30
|
+
let empty = false
|
|
31
|
+
return shortPoll({
|
|
32
|
+
getLatest: function (latest) {
|
|
33
|
+
return getShout({ group: args.group, jar: args.jar })
|
|
34
|
+
.then(function (shout) {
|
|
35
|
+
const given = []
|
|
36
|
+
if (shout) {
|
|
37
|
+
const date = new Date(shout.updated.slice(0, shout.updated.lastIndexOf('.')))
|
|
38
|
+
if (date > latest) {
|
|
39
|
+
latest = date
|
|
40
|
+
given.push(shout)
|
|
41
|
+
}
|
|
42
|
+
empty = false
|
|
43
|
+
} else if (!empty) {
|
|
44
|
+
const date = new Date()
|
|
45
|
+
given.push({ message: '', author: { name: '', id: '-1' }, date })
|
|
46
|
+
latest = date
|
|
47
|
+
empty = true
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
latest,
|
|
51
|
+
data: given
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
},
|
|
55
|
+
delay: 'onShout'
|
|
56
|
+
})
|
|
57
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Includes
|
|
2
|
+
const shortPoll = require('../util/shortPoll.js').func
|
|
3
|
+
const getWall = require('./getWall.js').func
|
|
4
|
+
|
|
5
|
+
// Args
|
|
6
|
+
exports.required = ['group']
|
|
7
|
+
exports.optional = ['view', 'jar']
|
|
8
|
+
|
|
9
|
+
// Docs
|
|
10
|
+
/**
|
|
11
|
+
* 🔐 An event for when someone posts on the group wall.
|
|
12
|
+
* @category Group
|
|
13
|
+
* @alias onWallPost
|
|
14
|
+
* @param {number} group - The id of the group.
|
|
15
|
+
* @returns An EventEmitter that emits when someone posts on the group wall.
|
|
16
|
+
* @example const noblox = require("noblox.js")
|
|
17
|
+
* // Login using your cookie
|
|
18
|
+
* const wallpostEvent = noblox.onWallPost(1)
|
|
19
|
+
* wallpostEvent.on("data", function(data) {
|
|
20
|
+
* console.log("New post!", data)
|
|
21
|
+
* })
|
|
22
|
+
* wallpostEvent.on("error", function(err) {
|
|
23
|
+
* console.error("Something went wrong: ", err)
|
|
24
|
+
* // Handle error as needed
|
|
25
|
+
* })
|
|
26
|
+
**/
|
|
27
|
+
|
|
28
|
+
// Define
|
|
29
|
+
exports.func = function (args) {
|
|
30
|
+
const group = args.group
|
|
31
|
+
const jar = args.jar
|
|
32
|
+
const view = args.view
|
|
33
|
+
return shortPoll({
|
|
34
|
+
getLatest: function (latest) {
|
|
35
|
+
return getWall({ group, jar, sortOrder: 'Desc' })
|
|
36
|
+
.then(function (wall) {
|
|
37
|
+
const posts = wall.data
|
|
38
|
+
const given = []
|
|
39
|
+
for (let i = posts.length - 1; i >= 0; i--) {
|
|
40
|
+
const post = posts[i]
|
|
41
|
+
const id = post.id
|
|
42
|
+
if (id > latest) {
|
|
43
|
+
latest = id
|
|
44
|
+
if (view) {
|
|
45
|
+
post.view = wall.views[post.parent.page]
|
|
46
|
+
}
|
|
47
|
+
given.push(post)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
latest,
|
|
52
|
+
data: given
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
delay: 'onWallPost'
|
|
57
|
+
})
|
|
58
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Includes
|
|
2
|
+
const changeRank = require('./changeRank.js').func
|
|
3
|
+
|
|
4
|
+
// Args
|
|
5
|
+
exports.required = ['group', 'target']
|
|
6
|
+
exports.optional = ['jar']
|
|
7
|
+
|
|
8
|
+
// Docs
|
|
9
|
+
/**
|
|
10
|
+
* 🔐 Promote a user.
|
|
11
|
+
* @category Group
|
|
12
|
+
* @alias promote
|
|
13
|
+
* @param {number} group - The id of the group.
|
|
14
|
+
* @param {number} target - The id of the user.
|
|
15
|
+
* @returns {Promise<ChangeRankResult>}
|
|
16
|
+
* @example const noblox = require("noblox.js")
|
|
17
|
+
* // Login using your cookie
|
|
18
|
+
* noblox.promote(1, 2)
|
|
19
|
+
**/
|
|
20
|
+
|
|
21
|
+
// Define
|
|
22
|
+
exports.func = function (args) {
|
|
23
|
+
args.change = 1
|
|
24
|
+
return changeRank(args)
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Includes
|
|
2
|
+
const getPageResults = require('../util/getPageResults.js').func
|
|
3
|
+
|
|
4
|
+
// Args
|
|
5
|
+
exports.required = ['keyword']
|
|
6
|
+
exports.optional = ['prioritizeExactMatch', 'limit']
|
|
7
|
+
|
|
8
|
+
// Docs
|
|
9
|
+
/**
|
|
10
|
+
* ✅ Searches for groups by a given search term.
|
|
11
|
+
* @category Group
|
|
12
|
+
* @alias searchGroups
|
|
13
|
+
* @param {string} keyword - The keyword or search term to search by.
|
|
14
|
+
* @param {boolean} [prioritizeExactMatch=false] - Whether or not to prioritize the exact match for the keyword
|
|
15
|
+
* @param {number} [limit=100] - The maximum number of groups to return. Supply 0 to apply no limit, returning all results.
|
|
16
|
+
* Note: This may significantly increase the time to execute and return potentially thousands of results.
|
|
17
|
+
* @returns {Promise<GroupSearchItem[]>}
|
|
18
|
+
* @example const noblox = require("noblox.js")
|
|
19
|
+
* const groupInfo = await noblox.searchGroups("noblox.js");
|
|
20
|
+
**/
|
|
21
|
+
|
|
22
|
+
// Define
|
|
23
|
+
exports.func = async function (args) {
|
|
24
|
+
const results = await getPageResults({
|
|
25
|
+
url: '//groups.roblox.com/v1/groups/search',
|
|
26
|
+
query: { keyword: args.keyword, prioritizeExactMatch: args.prioritizeExactMatch || false },
|
|
27
|
+
// If limit is 0, pass undefined for infinite results. Otherwise, default to 100.
|
|
28
|
+
limit: args.limit === 0 ? undefined : (args.limit || 100)
|
|
29
|
+
})
|
|
30
|
+
// Parse updated/created to Date objects.
|
|
31
|
+
return results.map((g) => ({ created: new Date(g.created), updated: new Date(g.updated), ...g }))
|
|
32
|
+
}
|