From 52491ea091fe9d745c93c0a513bd974bd743b9ec Mon Sep 17 00:00:00 2001 From: Alan Bixby Date: Wed, 14 Feb 2024 10:30:48 -0500 Subject: [PATCH] Update updateDeveloperProduct function to new 'apis.' endpoint; removes iconImageAssetId parameter (needs new method call) (#778) --- lib/games/updateDeveloperProduct.js | 14 +++++--------- typings/index.d.ts | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/games/updateDeveloperProduct.js b/lib/games/updateDeveloperProduct.js index b5209f976..71a069226 100644 --- a/lib/games/updateDeveloperProduct.js +++ b/lib/games/updateDeveloperProduct.js @@ -2,7 +2,7 @@ const http = require('../util/http.js').func const getGeneralToken = require('../util/getGeneralToken.js').func exports.required = ['universeId', 'productId', 'priceInRobux'] -exports.optional = ['name', 'description', 'iconImageAssetId', 'jar'] +exports.optional = ['name', 'description', 'jar'] // Docs /** @@ -14,17 +14,16 @@ exports.optional = ['name', 'description', 'iconImageAssetId', 'jar'] * @param {number} priceInRobux - The new price of the product. * @param {string=} name - The new name of the product. * @param {string=} description - The new description of the product. - * @param {iconImageAssetId=} iconImageAssetId - The new icon image asset ID for the product. * @returns {Promise} * @example const noblox = require("noblox.js") * // Login using your cookie * noblox.updateDeveloperProduct(1, 2, 10, "An Updated Developer Product", "My new updated product.") **/ -function updateDeveloperProduct (universeId, productId, priceInRobux, name, description, iconImageAssetId, jar, token) { +function updateDeveloperProduct(universeId, productId, priceInRobux, name, description, jar, token) { return new Promise((resolve, reject) => { return http({ - url: `//develop.roblox.com/v1/universes/${universeId}/developerproducts/${productId}/update`, + url: `//apis.roblox.com/developer-products/v1/universes/${universeId}/developerproducts/${productId}/update`, options: { method: 'POST', jar: jar, @@ -34,7 +33,6 @@ function updateDeveloperProduct (universeId, productId, priceInRobux, name, desc json: { Name: name, Description: description, - IconImageAssetId: iconImageAssetId, PriceInRobux: priceInRobux }, resolveWithFullResponse: true @@ -46,14 +44,12 @@ function updateDeveloperProduct (universeId, productId, priceInRobux, name, desc reject(new Error(`[${statusCode}] ${body.errors[0].message} | universeId: ${universeId}, body: ${JSON.stringify({ Name: name, Description: description, - IconImageAssetId: iconImageAssetId, PriceInRobux: priceInRobux })}`)) } else { reject(new Error(`An unknown error occurred with updateDeveloperProduct() | [${statusCode}] universeId: ${universeId}, body: ${JSON.stringify({ Name: name, Description: description, - IconImageAssetId: iconImageAssetId, PriceInRobux: priceInRobux })}`)) } @@ -61,9 +57,9 @@ function updateDeveloperProduct (universeId, productId, priceInRobux, name, desc }) } -exports.func = function ({ universeId, productId, priceInRobux, name, description, iconImageAssetId, jar }) { +exports.func = function ({ universeId, productId, priceInRobux, name, description, jar }) { return getGeneralToken({ jar }) .then((token) => { - return updateDeveloperProduct(universeId, productId, priceInRobux, name, description, iconImageAssetId, jar, token) + return updateDeveloperProduct(universeId, productId, priceInRobux, name, description, jar, token) }) } diff --git a/typings/index.d.ts b/typings/index.d.ts index c216034c6..cb8fc1392 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1879,7 +1879,7 @@ declare module "noblox.js" { /** * 🔐 Update a developer product. */ - function updateDeveloperProduct(universeId: number, productId: number, priceInRobux: number, name?: string, description?: string, iconImageAssetId?: number, jar?: CookieJar): Promise; + function updateDeveloperProduct(universeId: number, productId: number, priceInRobux: number, name?: string, description?: string, jar?: CookieJar): Promise; /// Groups /**