4 releases (2 breaking)
0.3.1 | Nov 15, 2024 |
---|---|
0.3.0 | Nov 15, 2024 |
0.2.0 | Nov 14, 2024 |
0.1.0 | Oct 31, 2024 |
#769 in Web programming
91 downloads per month
14KB
256 lines
buy_me_a_coffee
A Rust crate for interacting with the Buy Me a Coffee API.
Here's an example of how you could use this crate to check if somebody has a membership level called "Early Access":
use buy_me_a_coffee::MemberStatus;
async fn has_early_access(email: String) -> bool {
let client = buy_me_a_coffee::Client::new("personal access token here");
let mut page_num = 1;
while let Ok(page) = client.members(MemberStatus::Active, page_num).await {
for membership in page.data {
if membership.payer_email != email {
continue;
}
if membership.id != EARLY_ACCESS_ID {
continue;
}
return true;
}
page_num += 1;
}
false
}
Truthfully, this crate is not really ready to be used. It's not possible to test most things when I don't have any supporters on Buy Me a Coffee since the API returns a "No [subscriptions|supporters|extra purchases]" error. If someone would buy me a coffee, that would really help out with this project, wink wink...
Dependencies
~4–15MB
~198K SLoC