noblox.js
noblox.js copied to clipboard
Fix getAwardedTimestamps typings, jest case, allow number badgeId- breaking change
This pull request was intended to make badgeId
accept a number
or Array<number>
instead of just Array<number>
, however I stumbled into several blatant errors that were also fixed.
// New Functionality
await noblox.getAwardedTimestamps(2416399685, [2124549302])
// is now equivalent to
await noblox.getAwardedTimestamps(2416399685, 2124549302)
In it's previous state getAwardedTimestamps
needlessly returns a data object with no cursors, this is not reflected in UserBadgeStats
, likewise, awardedDate
is currently a string
, not a Date
:
// Old Return
{
data: [ { badgeId: 19450168, awardedDate: '2010-01-09T20:54:57.38Z' } ]
}
// New Return
[ { badgeId: 19450168, awardedDate: 2010-01-09T20:54:57.38Z } ]
I have fixed these errors, updated the return type, and made the jest case more precise to reflect these changes.
This pull request introduces three breaking changes:
- The return is no longer encapsulated by a
data
object - QoL improvement which agrees with the type interface, but introduces a breaking change -
awardedDate
is now aDate
instead of astring
- this is what the original typings intended - The parameter
badgeId
is renamed tobadgeIds
- breaks object parameter (included since return already would be breaking)
These changes look good. I am, however, not sure if it is worth triggering a breaking change for the sake of making a parameter name plural.
Is there a way we could do this while supporting both badgeId and badgeIds? is the increase in library usability worth it? This would be a Semver major change.
is it worth revisiting this?