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

Add a way to get total number of beers #44

@trixn86

Description

@trixn86

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: [
        ...
    ],
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions