Skip to content

Commit

Permalink
add actual developer product id to DeveloperProduct
Browse files Browse the repository at this point in the history
  • Loading branch information
frrazer committed May 30, 2024
1 parent b8ae398 commit d91296c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
27 changes: 24 additions & 3 deletions lib/games/getDeveloperProducts.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,30 @@ function getDeveloperProducts (jar, universeId, page, pageSize) {
reject(new Error('No developer products found'))
}

resolve({
DeveloperProducts: products,
PageSize: products.length
Promise.all(products.map(product => {
product.description = product.Description
delete product.Description
delete product.shopId

return http({
url: `//apis.roblox.com/developer-products/v1/developer-products/${product.id}`,
options: {
method: 'GET',
jar,
resolveWithFullResponse: true
}
}).then(res => {
if (res.statusCode === 200) {
product.productId = JSON.parse(res.body).id
}
}).catch(() => {
product.productId = null
})
})).then(() => {
resolve({
DeveloperProducts: products,
PageSize: products.length
})
})
} else {
const body = res.body || {}
Expand Down
3 changes: 1 addition & 2 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,7 @@ declare module "noblox.js" {
interface DeveloperProduct {
id: number;
name: string;
Description: string;
shopId: number;
description: string;
iconImageAssetId: number | null;
}

Expand Down

0 comments on commit d91296c

Please sign in to comment.