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

added /skyblock/calendar and /skyblock/events endpoints #683

Merged
merged 6 commits into from
Aug 12, 2021
Merged

added /skyblock/calendar and /skyblock/events endpoints #683

merged 6 commits into from
Aug 12, 2021

Conversation

camnwalter
Copy link
Contributor

a few notes:

  • not sure how high the cap should be for how many years of data you can request at once.
  • another thing is I might add aliases for the events so you don't have to enter them exactly as they are.
  • one last thing that I just thought of is to add options for multiple events to be shown, separated by commas

@builder-247 builder-247 linked an issue Aug 3, 2021 that may be closed by this pull request
@builder-247
Copy link
Member

builder-247 commented Aug 3, 2021

Thank you for contributing!

Looks pretty good overall - perhaps it would be good to support the from and to parameter (like in https://github.com/slothpixel/core/blob/master/store/queryAuctions.js#L92) to allow flexible queries

@camnwalter
Copy link
Contributor Author

camnwalter commented Aug 4, 2021

Thank you for contributing!

Looks pretty good overall - perhaps it would be good to support the from and to parameter (like in https://github.com/slothpixel/core/blob/master/store/queryAuctions.js#L92) to allow flexible queries

should I just scrap the years parameter? not sure how to make it work with both.
with a from and a years parameter it will be easy to implement but idk how to have to and years

@builder-247
Copy link
Member

Thank you for contributing!
Looks pretty good overall - perhaps it would be good to support the from and to parameter (like in https://github.com/slothpixel/core/blob/master/store/queryAuctions.js#L92) to allow flexible queries

should I just scrap the years parameter? not sure how to make it work with both.
with a from and a years parameter it will be easy to implement but idk how to have to and years

You could just ignore to when years is used

@camnwalter
Copy link
Contributor Author

camnwalter commented Aug 4, 2021

might need to remove the stopatyearend parameter. seems to be causing some issues

edit: nvm some of the events were duplicating. fixed now.

@camnwalter camnwalter marked this pull request as draft August 4, 2021 21:49
@camnwalter camnwalter marked this pull request as ready for review August 5, 2021 03:04
routes/spec.js Outdated
const result = buildSkyblockCalendar(events, from, to, years, stopatyearend);
response.json(result);
} catch (error) {
response.status(500).json({ error: error.message });
Copy link
Member

Choose a reason for hiding this comment

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

This should use status code 400 for user input errors

};

function buildSkyblockCalendar(events = '', from = Date.now(), to, years, stopAtYearEnd = false) {
if (Number.isNaN(Number(to)) && Number.isNaN(Number(years))) {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason, the to parameter currently works for me but I'll change it to match it as you said.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for the from parameter, do you want it to error out if its below or just set it to yearZero if its below?

Copy link
Member

Choose a reason for hiding this comment

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

I think just setting to yearZero is fine

? timeToSkyblockYear(to) - currentYear
: years;

if (toToYears <= 0) throw new Error('Years must be positive');
Copy link
Member

Choose a reason for hiding this comment

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

We should probably add an upper bound to this as well

- fixed stopatyearend parameter finally
- added some more errors
- added from to be at least yearZero and years to maximum of 10
fixed an error location & updated the spec
"""
The starting timestamp from which to get events. Uses a unix timestamp.
"""
from: Float
Copy link
Member

Choose a reason for hiding this comment

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

from and to should be typed string to allow the custom syntax

routes/spec.js Outdated
'/skyblock/events': {
get: {
summary: 'SkyBlock event spec',
description: 'Returns SkyBlock events',
Copy link
Member

Choose a reason for hiding this comment

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

It would be good to mention here that these are used in the calendar endpoint

@builder-247 builder-247 merged commit 1889f25 into slothpixel:master Aug 12, 2021
@camnwalter camnwalter deleted the calendar branch August 12, 2021 23:52
ChristianDobbie pushed a commit to ChristianDobbie/slothpixel-core that referenced this pull request Jan 10, 2022
* added /skyblock/calendar and /skyblock/events endpoints

* added from and to parameters

query must have either 'to' or 'years' parameter

* remove duplicate events

* added special timestamps support

- fixed stopatyearend parameter finally
- added some more errors
- added from to be at least yearZero and years to maximum of 10

* whoops

fixed an error location & updated the spec

* updated graphql to support custom date strings
ChristianDobbie added a commit to ChristianDobbie/slothpixel-core that referenced this pull request Jan 10, 2022
ChristianDobbie added a commit to ChristianDobbie/slothpixel-core that referenced this pull request Jan 10, 2022
* Revert "Fixed lint"

This reverts commit d76d997.

* Revert "Updated hypixelconstants"

This reverts commit 681e2c4.

* Revert "Update arcade games processor (slothpixel#713)"

This reverts commit 3630094.

* Revert "updated hypixelconstants"

This reverts commit f323027.

* Revert "skip linter on build"

This reverts commit a7965a8.

* Revert "removed legacy stuff (slothpixel#705)"

This reverts commit a965cf3.

* Revert "whitelist items route"

This reverts commit d7a9abd.

* Revert "fix skyblock/profiles endpoint returning empty object when uncached on graphql (slothpixel#703)"

This reverts commit 4a33a62.

* Revert "Fix graphql not working with the guilds endpoint (slothpixel#702)"

This reverts commit d5aa338.

* Revert "Fix graphql not working with the guilds endpoint (slothpixel#701)"

This reverts commit 031a596.

* Revert "bump node to 16"

This reverts commit f734801.

* Revert "[experimental] disable sentry"

This reverts commit 3d2a3f4.

* Revert "Fix rank sort function (slothpixel#699)"

This reverts commit 8749c9e.

* Revert "audit fix"

This reverts commit 2330924.

* Revert "Bump @sentry/node from 6.2.0 to 6.12.0 (slothpixel#698)"

This reverts commit 4ba4c22.

* Revert "update hypixelconstants"

This reverts commit 51faccd.

* Revert "Fix tag_formatted rendering when tag is null (slothpixel#696)"

This reverts commit 37634f8.

* Revert "Guild rewrite, fixes slothpixel#690"

This reverts commit 63faa45.

* Revert "fix lint"

This reverts commit da5b6fe.

* Revert "Improvements to the guild and player endpoints (slothpixel#691)"

This reverts commit 122f272.

* Revert "Added new profile endpoint to graphql"

This reverts commit cddd130.

* Revert "Fixed ESLint workflow"

This reverts commit 87d818b.

* Revert "stopatyearend param quick fix (slothpixel#688)"

This reverts commit 6e4e1e3.

* Revert "Added ranked and mega stats (slothpixel#687)"

This reverts commit ba2ff84.

* Revert "Added /skyblock/calendar and /skyblock/events endpoints (slothpixel#683)"

This reverts commit c84b08d.

* Revert "Added more murder mystery stats (slothpixel#685)"

This reverts commit b10fdf0.

* Revert "Added guild achievement stats (slothpixel#682)"

This reverts commit bd5fc22.

* Revert "fix lint"

This reverts commit 704a05d.

* Revert "fix lint"

This reverts commit 5d5b792.

* Revert "Fixed errors and added missing stats (slothpixel#681)"

This reverts commit f858c23.

* Revert "fix: monthlyPackageRank having priority over rank (slothpixel#680)"

This reverts commit 8a0b0f2.

* Revert "Updated SkyWars stats (slothpixel#679)"

This reverts commit 63aae75.

* Revert "Added k_d, w_l, final_k_d and bed_ratio to bedwars gamemodes (slothpixel#678)"

This reverts commit 966824a.

* Revert "Change updateQueue to a Set"

This reverts commit 7e52927.

* Revert "create fixItems"

This reverts commit cd31c31.

* Revert "remove itemlist update call"

This reverts commit ff4c653.

* Revert "Added updateQueue to items"

This reverts commit 47416b5.

* Revert "Fixed 4v4 stats (slothpixel#677)"

This reverts commit 22ad0ea.

* Revert "Create eslint.yml"

This reverts commit 9e17ea0.

* Revert "Fixed Clean name for updated hypixel constants (slothpixel#675)"

This reverts commit a0a167c.

* Revert "Added 4v4 stats for bedwars (slothpixel#673)"

This reverts commit 28d88e8.

* Revert "Support more gamemodes in the /status endpoint (slothpixel#668)"

This reverts commit 94b2862.

* Revert "Add correct bedwars games played (slothpixel#662)"

This reverts commit 8a673dc.

* Revert "Fix minutely rate limit"

This reverts commit 7fb3ed3.

* Revert "Updated skyblock item filter (slothpixel#658)"

This reverts commit 9d72754.

* Revert "Changes to filter for processSkyblock (slothpixel#657)"

This reverts commit 287fdd0.

* Revert "processSkyblock filter change (slothpixel#656)"

This reverts commit d1b9686.

* Revert "Dep updates"

This reverts commit 7a36539.

* Revert "Add 2v2v2v2 and 3v3v3v3 to Bridge stats to Duels (slothpixel#647)"

This reverts commit bc7da5e.

* Revert "Update tiered achievement data (slothpixel#644)"

This reverts commit 96bf035.

* Revert "Don't require MVP+ for MVP++"

This reverts commit 0179d30.

* Revert "Update docs with new parser data (slothpixel#637)"

This reverts commit 5eb7190.

* Revert "sb-parser 0.2.8"

This reverts commit 9a5cc9a.

* Revert "audit fix"

This reverts commit 9d3f665.

* Revert "Reworked skyblock profile processing"

This reverts commit c9772a3.

* Revert "unbreak changes from express-graphql v.0.10.0"

This reverts commit bacbae3.

* Revert "Bump graphql from 14.6.0 to 15.5.0"

This reverts commit 02cb259.

* Revert "Bump ioredis from 4.19.4 to 4.27.2"

This reverts commit 5b089cd.

* Revert "Fixed profile cache not updating"

This reverts commit 154268b.

* Revert "bump hypixelconstants"

This reverts commit 0c291e1.

* Revert "fix linting errors"

This reverts commit c56e86a.

* Revert "change TNT Tag key: TNTAG to TNTTAG"

This reverts commit ef81163.

* Revert "add my uuid"

This reverts commit f19fe51.

* Revert "added naming to party games and tnt tag"

This reverts commit 2afbce6.

* Revert "update hypixelconstants"

This reverts commit d120443.

* Revert "Add the new slayer tier to docs"

This reverts commit 1108fb5.

* Revert "sb-parser 0.2.6"

This reverts commit 70cebc3.

* Revert "Bump express-graphql from 0.9.0 to 0.12.0"

This reverts commit ae23ccd.

* Revert "sb-parser 0.2.5"

This reverts commit b4e744a.

* Revert "sb-parser 0.2.5"

This reverts commit 5174bcc.

* Revert "sb-parser 0.2.5"

This reverts commit a9a940a.

* Revert "minor changes"

This reverts commit 186dd3f.

* Revert "Update buildSkyBlockProfiles.js"

This reverts commit b9e3abf.

* Revert "Update buildSkyBlockProfiles.js"

This reverts commit bd133ac.

* Revert "Update buildSkyBlockProfiles.js"

This reverts commit b9588aa.

* Revert "Append content"

This reverts commit a87e7bc.

* Revert "Add profile name to /skyblock/profile/ endpoint"

This reverts commit fe35a7c.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create SkyBlock calendar endpoint
2 participants