djs_rest/endpoints/sku.rs
1//! The [SKU endpoint](https://docs.discord.com/developers/resources/sku): the premium
2//! offerings an app sells.
3
4use djs_model::{id::ApplicationId, sku::Sku};
5
6use crate::client::boxed;
7use crate::{Error, Request, Rest, Route};
8
9impl Rest {
10 /// [List SKUs](https://docs.discord.com/developers/resources/sku#list-skus): returns the
11 /// application's SKUs. A subscription appears as two SKUs; entitlements and tests use
12 /// the one of type [`Subscription`](djs_model::sku::SkuType::Subscription).
13 ///
14 /// discord.js counterpart: `ClientApplication#fetchSKUs`.
15 ///
16 /// # Errors
17 ///
18 /// See [`Rest::request`].
19 pub fn list_skus(
20 &self,
21 application_id: ApplicationId,
22 ) -> impl Future<Output = Result<Vec<Sku>, Error>> + Send + '_ {
23 boxed(async move {
24 self.call(Request::new(Route::ListSkus { application_id }))
25 .await
26 })
27 }
28}