Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Add a way to get total number of beers #44

Open
trixn86 opened this issue Jan 20, 2019 · 1 comment
Open

Add a way to get total number of beers #44

trixn86 opened this issue Jan 20, 2019 · 1 comment

Comments

@trixn86
Copy link

trixn86 commented Jan 20, 2019

Currently it is not possible to get the total number of beers/pages from the api.Thus it is also not possible to display the index of the last page to the user. Displaying the page index is a very common thing to do when displaying a paginated list to a user.

Of course you could fetch all the beers in advance to find out the total amount. But that would lead to over-fetching data and is not an option at all (the rate limit is 1req/sec). And even then there is a possibility that a beer could be added/deleted without the client taking notice of that.

Is it possible to add some metadata to the api response that includes the total number of beers?

Something like this:

{
    metadata: {
        "page": 5,
        "per_page": 20,
        "page_count": 27,
        "total_count": 521,
    },
    records: [
        ...
    ],
}
@sammdec
Copy link
Owner

sammdec commented Feb 18, 2019

Yeah I think that is a really good idea. I will have a look into that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants