pub struct Polar { /* private fields */ }Implementations§
Source§impl Polar
impl Polar
pub fn new<U: IntoUrl, T: Display>( base_url: U, access_token: T, ) -> PolarResult<Self>
pub async fn delete<T>(&self, path: &str) -> PolarResult<T>where
T: DeserializeOwned,
pub async fn get<T>(&self, path: &str) -> PolarResult<T>where
T: DeserializeOwned,
pub async fn get_with_params<P, T>(
&self,
path: &str,
params: &P,
) -> PolarResult<T>where
P: Serialize,
T: DeserializeOwned,
pub async fn patch<P, T>(&self, path: &str, params: &P) -> PolarResult<T>where
P: Serialize,
T: DeserializeOwned,
pub async fn post<P, T>(&self, path: &str, params: &P) -> PolarResult<T>where
P: Serialize,
T: DeserializeOwned,
Sourcepub async fn create_checkout_session(
&self,
params: &CheckoutSessionParams,
) -> PolarResult<CheckoutSession>
pub async fn create_checkout_session( &self, params: &CheckoutSessionParams, ) -> PolarResult<CheckoutSession>
Create a checkout session.
Scopes: checkouts:write
Reference: https://docs.polar.sh/api-reference/checkouts/create-session
Sourcepub async fn get_checkout_session(
&self,
id: Uuid,
) -> PolarResult<CheckoutSession>
pub async fn get_checkout_session( &self, id: Uuid, ) -> PolarResult<CheckoutSession>
Get a checkout session by ID.
Scopes: checkouts:read checkouts:write
Reference: https://docs.polar.sh/api-reference/checkouts/get-session
Sourcepub async fn list_checkout_sessions(
&self,
params: &ListCheckoutSessionsParams,
) -> PolarResult<Page<CheckoutSession>>
pub async fn list_checkout_sessions( &self, params: &ListCheckoutSessionsParams, ) -> PolarResult<Page<CheckoutSession>>
List checkout sessions.
Scopes: checkouts:read checkouts:write
Reference: https://docs.polar.sh/api-reference/checkouts/list-sessions
Sourcepub async fn get_subscription(&self, id: Uuid) -> PolarResult<Subscription>
pub async fn get_subscription(&self, id: Uuid) -> PolarResult<Subscription>
Get a subscription by ID.
Scopes: subscriptions:read subscriptions:write
Reference: https://docs.polar.sh/api-reference/subscriptions/get
Sourcepub async fn list_subscriptions(
&self,
params: &ListSubscriptionsParams,
) -> PolarResult<Page<Subscription>>
pub async fn list_subscriptions( &self, params: &ListSubscriptionsParams, ) -> PolarResult<Page<Subscription>>
List subscriptions.
Scopes: subscriptions:read subscriptions:write
Reference: https://docs.polar.sh/api-reference/subscriptions/list
Sourcepub async fn update_subscription(
&self,
id: Uuid,
params: &SubscriptionParams,
) -> PolarResult<Subscription>
pub async fn update_subscription( &self, id: Uuid, params: &SubscriptionParams, ) -> PolarResult<Subscription>
Update a subscription.
Scopes: subscriptions:write
Reference: https://docs.polar.sh/api-reference/subscriptions/update
Sourcepub async fn revoke_subscription(&self, id: Uuid) -> PolarResult<Subscription>
pub async fn revoke_subscription(&self, id: Uuid) -> PolarResult<Subscription>
Revoke a subscription, i.e cancel immediately.
Scopes: subscriptions:write
Reference: https://docs.polar.sh/api-reference/subscriptions/revoke
Sourcepub async fn get_product(&self, id: Uuid) -> PolarResult<Product>
pub async fn get_product(&self, id: Uuid) -> PolarResult<Product>
Get a product by ID.
Scopes: products:read products:write
Sourcepub async fn list_products(
&self,
params: &ListProductsParams,
) -> PolarResult<Page<Product>>
pub async fn list_products( &self, params: &ListProductsParams, ) -> PolarResult<Page<Product>>
List products.
Scopes: products:read products:write
Reference: https://docs.polar.sh/api-reference/products/list
Sourcepub async fn create_product(
&self,
params: &ProductParams,
) -> PolarResult<Product>
pub async fn create_product( &self, params: &ProductParams, ) -> PolarResult<Product>
Create a product.
Scopes: products:write
Reference: https://docs.polar.sh/api-reference/products/create
Sourcepub async fn update_product(
&self,
id: Uuid,
params: &UpdateProductParams,
) -> PolarResult<Product>
pub async fn update_product( &self, id: Uuid, params: &UpdateProductParams, ) -> PolarResult<Product>
Update a product.
Scopes: products:write
Reference: https://docs.polar.sh/api-reference/products/update
Sourcepub async fn update_product_benefits(
&self,
id: Uuid,
benefits: Vec<Uuid>,
) -> PolarResult<Product>
pub async fn update_product_benefits( &self, id: Uuid, benefits: Vec<Uuid>, ) -> PolarResult<Product>
Update benefits granted by a product..
Scopes: products:write
Reference: https://docs.polar.sh/api-reference/products/update-benefits
Sourcepub async fn ingest_events(&self, events: Vec<EventParams>) -> PolarResult<i64>
pub async fn ingest_events(&self, events: Vec<EventParams>) -> PolarResult<i64>
Ingest batch of events.
Scopes: events:write
Reference: https://docs.polar.sh/api-reference/events/ingest
pub async fn get_event(&self, id: Uuid) -> PolarResult<Event>
Sourcepub async fn create_meter(&self, params: &MeterParams) -> PolarResult<Meter>
pub async fn create_meter(&self, params: &MeterParams) -> PolarResult<Meter>
Sourcepub async fn get_meter(&self, id: Uuid) -> PolarResult<Meter>
pub async fn get_meter(&self, id: Uuid) -> PolarResult<Meter>
Get a meter by ID.
Scopes: meters:read meters:write
Sourcepub async fn list_meters(
&self,
params: &ListMetersParams,
) -> PolarResult<Page<Meter>>
pub async fn list_meters( &self, params: &ListMetersParams, ) -> PolarResult<Page<Meter>>
List meters.
Scopes: meters:read meters:write
Sourcepub async fn update_meter(
&self,
id: Uuid,
params: &UpdateMeterParams,
) -> PolarResult<Meter>
pub async fn update_meter( &self, id: Uuid, params: &UpdateMeterParams, ) -> PolarResult<Meter>
Sourcepub async fn get_meter_quantities(
&self,
id: Uuid,
params: &MeterQuantitiesParams,
) -> PolarResult<MeterQuantities>
pub async fn get_meter_quantities( &self, id: Uuid, params: &MeterQuantitiesParams, ) -> PolarResult<MeterQuantities>
Get quantities of a meter over a time period.
Scopes: meters:read meters:write
Reference: https://docs.polar.sh/api-reference/meters/get-quantities