-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
Support pagination for Search queries #468
Comments
I think I'm missing something because of this release note Line 32 in 8032120
|
This is the code that does not work let stripe_secret_key = get_stripe_secret_key()?;
let client = stripe::Client::new(stripe_secret_key);
// https://stripe.com/docs/search#query-fields-for-customers
let customer_search = CustomerSearchParams {
query: format!("-invoice_settings.default_payment_method:null"),
limit: Some(90),
..Default::default()
};
let customers = match Customer::search(&client, customer_search.clone()).await {
Ok(first_batch) => {
let mut customers = first_batch.data;
let paginator = first_batch.paginate(customer_search);
while let Some(next_batch) = paginator.next(&client).await {
customers.extend(next_batch.data);
}
customers
},
Err(e) => {
error!("Failed to search for customer in Stripe: {:?}", e);
return Err(ControlPlaneError::NetworkError(
"Failed to search for customer in Stripe".to_string(),
));
}
};
info!("Found {} customers with a payment method", customers.len());
Ok(customers) I was comparing to this async-stripe/examples/customer.rs Line 60 in 8032120
|
I think the param for paginate is the wrong type maybe Line 217 in 8032120
|
I have used this API before when testing the PRs in question but it is clearly broken. I should be stricter with mandating examples of public-facing apis when accepting PRs. I am currently mostly focusing on the codegen revamp but will try to prioritise this after that is cleared. |
Is your feature request related to a problem? Please describe.
Paginate for queries to Stripe Search API(s)
Describe the solution you'd like
impl Paginable for Search types
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: