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

[Request] Add version identifier to API results #143

Open
ddankel opened this issue Mar 17, 2022 · 1 comment
Open

[Request] Add version identifier to API results #143

ddankel opened this issue Mar 17, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@ddankel
Copy link

ddankel commented Mar 17, 2022

Adding a unique version identifier to the api results (either the root, every index page, or even every result) that incremented whenever data was updated would allow developers to quickly determine if their data is stale. One request to the api root could be used to see if anything changed instead of having to walk through every page and resource to update any cached data.

Example:

// https://api.genshin.dev/
{
  "types": [
    "artifacts",
    "boss",
    "characters",
    "consumables",
    "domains",
    "elements",
    "enemies",
    "materials",
    "nations",
    "weapons"
  ],
  "version": 123.4
}

Alternatively, instead of inserting version to some/all endpoints via middleware, a /version endpoint could be added for this purpose.

The example above uses a version number but it could also be a hash, uuid, datetime, or any other unique value. Something that could be calculated instead of having to be manually updated each release seems preferable. Perhaps use something like node-cache to cache a hash of the assets directory?

@mmgfrcs
Copy link

mmgfrcs commented Sep 23, 2022

+1

I would recommend having the game version in it, then use the patch version to indicate fixes

Example: v3.0.2 tells me that this data is up to date until game version 3.0, and it is the 2nd revision.

@man90es man90es added the enhancement New feature or request label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants