claim_list_by_channel API returns inconsistent results
See original GitHub issueThe Issue
The claim_list_by_channel api call returns inconsistent results. If I call it with only a URI then it returns a single value like this:
{
"id": null,
"jsonrpc": "2.0",
"result": {
"lbry://@OTR": {
"claims_in_channel": 94
}
}
}
However, if I request a specific page I get the same value, claims_in_channel, but now it’s a completely different type (a list of Claims). I don’t see the benefit in having this return the number of claims (there is another API, resolve, that returns the number of claims when passed a channel URI). This API should either return the first page of results (if no page was specified), or make the page parameter required.
The change of type doesn’t help the caller to know why the results aren’t as expected, the documentation mentions both types for claims_in_channel without indicating when the number version will be returned, and the integer return does not match the name of the API call (which specifically has “list” in the title).
It would be useful information in the normal return to say how many total items there are. This would give a UI a way to create a page select list (total number / page size == number of total pages). The API could return a “total_number_of_claims” or “total_claims_in_channel” value. I also think the name of this value should match the one returned by the resolve API.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Hey @42degrees, you’ve been digging in quite a bit recently. Good stuff!
@tzarebczan probably already linked this but we’d be happy to send you some LBC for your contributions.
Have you thought about contributing yourself? You can also email me at jeremy@lbry.io. Cheers!
closing, reopen if needed