-
Notifications
You must be signed in to change notification settings - Fork 641
Expose all download history through the API #557
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
Comments
Right now the only route for this is the downloads route but that just provides the data you see rendered already. I don't believe there's a route for a historical paginated version of this. Adding one would be fine though! |
Thank you for that link! I will try and grok the code and open a pr. So far I mostly have questions. :-P I think the comment may be out of date or I don't know how to read it, the link /crates/quadrature/downloads just gets me an error. It seems to be maching L89: "/crates/:crate_id/:version" insted of line L94: "/crates/:crate_id/downloads". Is there some kind of caching for Is there some kind of caching for the website? All the download counts (except for today's data) are going to be static, seems a shame to hit the database repeatedly. Is there a schema for the tables that we can query? |
Nah currently we don't have any caching, everything hits the database. Also there's currently no caching around |
I will experiment with a locale instance when I have a chance. :-) How do I hit the "/crates/:crate_id/:version" target? Everything I try just gets me error messages. |
This should do the trick:
|
Concrete suggestion: let offset = req.query().get("offset").parce().unwrap_or(0);
let cutoff_date_end = ::now() + Duration::days(-offset);
let cutoff_date_start = cutoff_date_end + Duration::days(-90); This is primarily the smallest change I can think of to make the data available. |
Alternative suggestion: let offset = req.query().get("page").parce().unwrap_or(0);
let cutoff_date_end = ::now() + Duration::days(-90 * offset);
let cutoff_date_start = cutoff_date_end + Duration::days(-90); Are these at all an acceptable idea? How can these ideas be improved? |
Sure, paging sounds great and would match other endpoints' interfaces. |
Random note if that endpoint is using Diesel by the time someone gets to it -- it can be done entirely in SQL as use diesel::expression::dsl::*;
let cutoff_end_date = now - (90 * offset).days();
let cuttof_start_date = cutoff_end_date - 90.days(); |
All of the endpoints moved to Diesel do! ;) https://github.com/diesel-rs/diesel/blob/428db9515e5c7769a9313b4cf9bc14f1ced290e7/diesel/src/connection/statement_cache.rs |
Closed in #611 |
Hi,
What is the best way to get the download history for all crates? The data is publicly available by scraping the graphs out of each crates page, but that is rude and inelegant.
If the data is available, how can I improve the docs to make it easier to find?
If it is not available, what can I do to add that functionality?
The text was updated successfully, but these errors were encountered: