diff --git a/Cargo.toml b/Cargo.toml index c4a291b..56daf06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,13 +5,13 @@ members = [ [package] name = "pinpayments_rs" -version = "0.1.0" +version = "0.9.0" description = "API bindings for the Pin Payments HTTP API" rust-version = "1.65.0" authors = [ "Chris Kruger " ] -license = "MIT OR Apache-2.0" +license = "MIT" readme = "README.md" homepage = "https://github.com/montdidier/pinpayments_rs" repository = "https://github.com/montdidier/pinpayments_rs" @@ -19,6 +19,11 @@ keywords = ["pinpayments", "v1", "api", "async"] categories = ["api-bindings"] edition = "2021" +include = [ + "**/*.rs", + "Cargo.toml" +] + [lib] name = "pinpayments" diff --git a/src/resources/subscription.rs b/src/resources/subscription.rs index d3f6161..c6b4fc3 100644 --- a/src/resources/subscription.rs +++ b/src/resources/subscription.rs @@ -1,7 +1,7 @@ use time::{OffsetDateTime}; use serde::{Deserialize, Serialize}; -use crate::client::{Client, Response, StatusOnlyResponse}; +use crate::client::{Client, Response}; use crate::error::PinError; use crate::ids::{PlanId, CustomerId, SubscriptionId, CardId}; use crate::params::{unpack_contained, Page, Paginator, paginate}; @@ -68,6 +68,15 @@ impl Subscription { client.get_query("/subscriptions", ¶ms) } + pub fn list_with_paginator(client: &Client, per_page: Option) -> Paginator> { + paginate( + move |page, per_page| { + Subscription::list(client, Some(page), Some(per_page)) + }, + per_page.unwrap_or(25) + ) + } + pub fn retrieve(client: &Client, token: &SubscriptionId) -> Response { unpack_contained(client.get(&format!("/subscriptions/{}", token))) }