UNPKG

openblox

Version:

Roblox API Wrapper For Both Classic And OpenCloud APIs.

342 lines (341 loc) 13.1 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var develop_exports = {}; __export(develop_exports, { authenticatedUserGroupsCanManage: () => authenticatedUserGroupsCanManage, authenticatedUserGroupsCanManageGamesOrItems: () => authenticatedUserGroupsCanManageGamesOrItems, authenticatedUserPermissionsForUniverse: () => authenticatedUserPermissionsForUniverse, authenticatedUserPermissionsForUniverses: () => authenticatedUserPermissionsForUniverses, authenticatedUserUniverses: () => authenticatedUserUniverses, closeTeamTestSession: () => closeTeamTestSession, gameTemplates: () => gameTemplates, groupUniverses: () => groupUniverses, placeConfiguration: () => placeConfiguration, pluginsInfo: () => pluginsInfo, setTeamCreateSettingsForUniverse: () => setTeamCreateSettingsForUniverse, teamCreateActiveMembers: () => teamCreateActiveMembers, teamCreateRemoveUsersAccessForUniverse: () => teamCreateRemoveUsersAccessForUniverse, teamCreateSettingsForUniverse: () => teamCreateSettingsForUniverse, teamCreateSettingsForUniverses: () => teamCreateSettingsForUniverses, universeConfiguration: () => universeConfiguration, universeInfo: () => universeInfo, universePlaces: () => universePlaces, universesInfo: () => universesInfo, updatePlaceConfiguration_V1: () => updatePlaceConfiguration_V1, updatePlaceConfiguration_V2: () => updatePlaceConfiguration_V2, updatePlugin: () => updatePlugin, updateUniverseConfiguration_V1: () => updateUniverseConfiguration_V1, updateUniverseConfiguration_V2: () => updateUniverseConfiguration_V2, vipServerConfigurationForUniverse: () => vipServerConfigurationForUniverse }); module.exports = __toCommonJS(develop_exports); var import_apiGroup = require("../../apiGroup"); var import_utils = require("../../../utils/utils"); const { createApiMethod } = (0, import_apiGroup.createApiGroup)({ name: "ClassicDevelop", baseUrl: "https://develop.roblox.com" }); const gameTemplates = createApiMethod(async () => ({ method: "GET", path: `/v1/gametemplates`, name: `gameTemplates`, formatRawDataFn: ({ data }) => data.map((template) => (0, import_utils.cloneAndMutateObject)(template, ({ universe }) => { universe.created = new Date(universe.created); universe.updated = new Date(universe.updated); })) })); const groupUniverses = createApiMethod(async ({ groupId, isArchived, limit, sortOrder, cursor }) => ({ method: "GET", path: `/v1/groups/${groupId}/universes`, searchParams: { isArchived, limit, sortOrder, cursor }, name: `groupUniverses`, formatRawDataFn: ({ data }) => data.map((universe) => (0, import_utils.cloneAndMutateObject)(universe, (obj) => { obj.created = new Date(obj.created); obj.updated = new Date(obj.updated); })) })); const teamCreateActiveMembers = createApiMethod(async ({ placeId, limit, cursor }) => ({ method: "GET", path: `/v1/places/${placeId}/teamcreate/active_session/members`, searchParams: { limit, cursor }, name: `teamCreateActiveMembers`, formatRawDataFn: ({ data }) => data })); const teamCreateSettingsForUniverse = createApiMethod(async ({ universeId }) => ({ method: "GET", path: `/v1/universes/${universeId}/teamcreate`, name: `teamCreateSettingsForUniverse` })); const setTeamCreateSettingsForUniverse = createApiMethod(async ({ universeId, isEnabled }) => ({ method: "PATCH", path: `/v1/universes/${universeId}/teamcreate`, body: { isEnabled }, name: `setTeamCreateSettingsForUniverse`, formatRawDataFn: import_utils.dataIsSuccess })); const teamCreateSettingsForUniverses = createApiMethod(async ({ universeIds }) => ({ method: "GET", path: `/v1/universes/multiget/teamcreate`, searchParams: { ids: universeIds }, name: `teamCreateSettingsForUniverses`, formatRawDataFn: ({ data }) => (0, import_utils.createObjectMapByKeyWithMiddleware)(data, "id", ({ id, ...rest }) => ({ ...rest })) })); const teamCreateRemoveUsersAccessForUniverse = createApiMethod(async ({ universeId, userId }) => ({ method: "DELETE", path: `/v1/universes/${universeId}/teamcreate/memberships`, body: { userId }, name: `teamCreateRemoveUsersAccessForUniverse`, formatRawDataFn: import_utils.dataIsSuccess })); const pluginsInfo = createApiMethod(async ({ pluginIds }) => ({ method: "GET", path: `/v1/plugins`, searchParams: { pluginIds }, name: `pluginsInfo`, formatRawDataFn: ({ data }) => (0, import_utils.createObjectMapByKeyWithMiddleware)(data, "id", ({ id, created, updated, ...rest }) => ({ created: new Date(created), updated: new Date(updated), ...rest })) })); const updatePlugin = createApiMethod(async ({ pluginId, name, description, commentsEnabled }) => ({ method: "PATCH", path: `/v1/plugins/${pluginId}`, body: { name, description, commentsEnabled }, name: `updatePlugin`, formatRawDataFn: import_utils.dataIsSuccess })); const universeInfo = createApiMethod(async ({ universeId }) => ({ method: "GET", path: `/v1/universes/${universeId}`, name: `universeInfo`, formatRawDataFn: (data) => (0, import_utils.cloneAndMutateObject)(data, (obj) => { obj.created = new Date(obj.created); obj.updated = new Date(obj.updated); }) })); const authenticatedUserPermissionsForUniverse = createApiMethod(async ({ universeId }) => ({ method: "GET", path: `/v1/universes/${universeId}/permissions`, name: `authenticatedUserPermissionsForUniverse` })); const universePlaces = createApiMethod(async ({ universeId, isUniverseCreation, limit, sortOrder, cursor }) => ({ method: "GET", path: `/v1/universes/${universeId}/places`, searchParams: { isUniverseCreation, limit, cursor, sortOrder }, name: `universePlaces`, formatRawDataFn: ({ data }) => data })); const universesInfo = createApiMethod(async ({ universeIds }) => ({ method: "GET", path: `/v1/universes/multiget`, searchParams: { ids: universeIds }, name: `universesInfo`, formatRawDataFn: ({ data }) => (0, import_utils.createObjectMapByKeyWithMiddleware)( data, "id", ({ id, created, updated, ...rest }) => ({ created: new Date(created), updated: new Date(updated), ...rest }) ) })); const authenticatedUserPermissionsForUniverses = createApiMethod(async ({ universeIds }) => ({ method: "GET", path: `/v1/universes/multiget/permissions`, searchParams: { ids: universeIds }, name: `authenticatedUserPermissionsForUniverses`, formatRawDataFn: ({ data }) => (0, import_utils.createObjectMapByKeyWithMiddleware)(data, "universeId", ({ universeId, ...rest }) => ({ ...rest })) })); const universeConfiguration = createApiMethod(async ({ universeId }) => ({ method: "GET", path: `/v1/universes/${universeId}/configuration`, name: `universeConfiguration` })); const updateUniverseConfiguration_V1 = createApiMethod(async ({ universeId, name, avatarType, scaleType, animationType, collisionType, bodyType, jointPositioningType, isArchived, isFriendsOnly, playableDevices, isMeshTextureApiAccessAllowed }) => ({ method: "PATCH", path: `/v1/universes/${universeId}/configuration`, body: { name, universeAvatarType: avatarType, universeScaleType: scaleType, universeAnimationType: animationType, universeCollisionType: collisionType, universeBodyType: bodyType, universeJointPositioningType: jointPositioningType, isArchived, isFriendsOnly, playableDevices, isMeshTextureApiAccessAllowed }, name: `updateUniverseConfiguration_V1` })); const vipServerConfigurationForUniverse = createApiMethod(async ({ universeId }) => ({ method: "GET", path: `/v1/universes/${universeId}/configuration/vip-servers`, name: `vipServerConfigurationForUniverse` })); const authenticatedUserGroupsCanManage = createApiMethod(async () => ({ method: "GET", path: `/v1/user/groups/canmanage`, name: `authenticatedUserGroupsCanManage`, formatRawDataFn: ({ data }) => data })); const authenticatedUserGroupsCanManageGamesOrItems = createApiMethod(async () => ({ method: "GET", path: `/v1/user/groups/canmanagegamesoritems`, name: `authenticatedUserGroupsCanManageGamesOrItems`, formatRawDataFn: ({ data }) => data })); const authenticatedUserUniverses = createApiMethod(async ({ isArchived, limit, sortOrder, cursor }) => ({ method: "GET", path: `/v1/user/universes`, searchParams: { isArchived, limit, sortOrder, cursor }, name: `universesForGroup`, formatRawDataFn: ({ data }) => data.map((universe) => (0, import_utils.cloneAndMutateObject)(universe, (obj) => { obj.created = new Date(obj.created); obj.updated = new Date(obj.updated); })) })); const updatePlaceConfiguration_V1 = createApiMethod(async ({ placeId, name, description }) => ({ method: "PATCH", path: `/v1/places/${placeId}`, body: { name, description }, name: `updatePlaceConfiguration_V1` })); const placeConfiguration = createApiMethod(async ({ placeId }) => ({ method: "GET", path: `/v2/places/${placeId}`, name: `placeConfiguration` })); const updatePlaceConfiguration_V2 = createApiMethod(async ({ placeId, name, description, maxPlayerCount, socialSlotType, customSocialSlotsCount, allowCopying, allowedGearTypes, isAllGenresAllowed }) => ({ method: "PATCH", path: `/v2/places/${placeId}`, body: { name, description, maxPlayerCount, socialSlotType, customSocialSlotsCount, allowedGearTypes, allowCopying, isAllGenresAllowed }, name: `updatePlaceConfiguration_V2` })); const updateUniverseConfiguration_V2 = createApiMethod(async ({ universeId, name, description, avatarType, animationType, collisionType, jointPositioningType, isArchived, isFriendsOnly, genre, playableDevices, avatarAssetOverrides, avatarMinScales, avatarMaxScales, studioAccessToApisAllowed, isThirdPartyTeleportAllowed, isThirdPartyAssetAllowed, isThirdPartyPurchaseAllowed, isMeshTextureApiAccessAllowed, allowPrivateServers, privateServerPrice, price, isForSale }) => ({ method: "PATCH", path: `/v2/universes/${universeId}/configuration`, body: { allowPrivateServers, privateServerPrice, name, description, universeAvatarType: avatarType, universeAnimationType: animationType, universeCollisionType: collisionType, universeJointPositioningType: jointPositioningType, isArchived, isFriendsOnly, genre, playableDevices, isForSale, price, universeAvatarAssetOverrides: avatarAssetOverrides, universeAvatarMinScales: avatarMinScales, universeAvatarMaxScales: avatarMaxScales, studioAccessToApisAllowed, permissions: { IsThirdPartyTeleportAllowed: isThirdPartyTeleportAllowed, IsThirdPartyAssetAllowed: isThirdPartyAssetAllowed, IsThirdPartyPurchaseAllowed: isThirdPartyPurchaseAllowed }, isMeshTextureApiAccessAllowed }, name: `updateUniverseConfiguration_V2`, formatRawDataFn: ({ permissions, universeAvatarAssetOverrides, ...rest }) => ({ ...rest, universeAvatarAssetOverrides: universeAvatarAssetOverrides.map(({ assetID, assetTypeID, ...rest2 }) => ({ assetId: assetID, assetTypeId: assetTypeID, ...rest2 })), permissions: { isThirdPartyTeleportAllowed: permissions.IsThirdPartyTeleportAllowed, isThirdPartyAssetAllowed: permissions.IsThirdPartyAssetAllowed, isThirdPartyPurchaseAllowed: permissions.IsThirdPartyPurchaseAllowed } }) })); const closeTeamTestSession = createApiMethod(async ({ placeId, jobId }) => ({ method: "DELETE", path: `/v2/teamtest/${placeId}`, searchParams: { gameId: jobId }, name: `closeTeamTestSession` })); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { authenticatedUserGroupsCanManage, authenticatedUserGroupsCanManageGamesOrItems, authenticatedUserPermissionsForUniverse, authenticatedUserPermissionsForUniverses, authenticatedUserUniverses, closeTeamTestSession, gameTemplates, groupUniverses, placeConfiguration, pluginsInfo, setTeamCreateSettingsForUniverse, teamCreateActiveMembers, teamCreateRemoveUsersAccessForUniverse, teamCreateSettingsForUniverse, teamCreateSettingsForUniverses, universeConfiguration, universeInfo, universePlaces, universesInfo, updatePlaceConfiguration_V1, updatePlaceConfiguration_V2, updatePlugin, updateUniverseConfiguration_V1, updateUniverseConfiguration_V2, vipServerConfigurationForUniverse });