Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix addDeveloperProduct & checkDeveloperProductName. addGamepass feature #785

Closed
wants to merge 1 commit into from

Conversation

emsar69
Copy link

@emsar69 emsar69 commented Mar 21, 2024

Fixed addDeveloperProduct & checkDeveloperProductName. Added 'addGamepass' function.

Copy link
Member

@Neztore Neztore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR, I've highlighted a few issues.
Your changes to checkDeveloperProductName would be breaking changes but we intend to move to a new major version - so that isn't an issue. I agree with your API changes there; returning a boolean is the best API.

I am not comfortable adding a dependency for form data as I believe it is done manually elsewhere and there are built in APIs for doing so (it is url encoded I believe so URLSearchParams could work)

data.forEach(product => {
if(product.name == args.productName || product.id == productId){
exists = true
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns undefined and the typing says it returns a boolean.
Would a better approach be:

for (const product of data) {
   if (...) {
       return true

}
}
return false
```?

@@ -23,17 +23,25 @@ exports.func = (args) => {
const productId = parseInt(args.productId) ? parseInt(args.productId) : 0

return http({
url: '//www.roblox.com/places/check-developerproduct-name?universeId=' + universeId + '&developerProductId=' + productId + '&developerProductName=' + args.productName + '&_=1515792139751',
url: `//apis.roblox.com/developer-products/v1/universes/${universeId}/developerproducts?pageNumber=1&pageSize=2147483647`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the meaning of the page size here? Why is it a large arbitrary number? how does this work when the number of pages is greater than 1? Could this use a pagination wrapper

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per my testing, Roblox does not use cursors for this endpoint. The number specified for the page size is (2^31)-1 (the largest possible signed 32bit int), which happens to be the largest page size Roblox supports. Now, whether the api will actually return that many results, I don't know.

I agree that a pagination wrapper would be preferable to this though, given this is already undocumented to start with and I don't really expect this to work in practice (but maybe somehow it does).

**/

const nextFunction = (jar, token, universeId, name, priceInRobux, description) => {
const FormData = require('form-data');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't require modules in functions like this.
This does not need a new dependency - I believe the new fetch API has a built in way of building these, and they are built manually elsewhere in the library.

resolveWithFullResponse: true
}
}).then((res) => {
console.log(res)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log shouldn't be there

@@ -59,7 +59,7 @@ const nextFunction = (jar, token, universeId, name, priceInRobux, description) =
exports.func = (args) => {
const jar = args.jar

return getGeneralToken({ jar }).then((xcsrf) => {
return getGeneralToken({ jar: jar }).then((xcsrf) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the point of this change is

@Neztore Neztore added this to the v5 milestone Apr 17, 2024
@Neztore Neztore added the help wanted Extra attention is needed label Apr 23, 2024
@Neztore
Copy link
Member

Neztore commented Apr 23, 2024

Adding help wanted if anyone wants to help out and resolve the above

@Neztore Neztore linked an issue May 18, 2024 that may be closed by this pull request
@frrazer
Copy link

frrazer commented May 27, 2024

Just seen this pr after I posted a fix for the same function #806

@Neztore
Copy link
Member

Neztore commented Jul 31, 2024

Closing this as it is stale. Please open a new PR if above are fixed

@Neztore Neztore closed this Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

createGamePass function
5 participants