1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
/// <https://discord.com/developers/docs/resources/sku#sku-object>
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SKUApiType {
/// ID of SKU
pub id: String,
/// Type of SKU
#[serde(rename = "type")]
pub type_: SKUType,
/// ID of the parent application
pub application_id: String,
/// Customer-facing name of your premium offering
pub name: String,
/// System-generated URL slug based on the SKU's name
pub slug: String,
/// SKU flags combined as a bitfield
pub flags: u32,
}
/// <https://discord.com/developers/docs/resources/sku#sku-object-sku-types>
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u8)]
pub enum SKUType {
/// Durable one-time purchase
DURABLE = 2,
/// Consumable one-time purchase
CONSUMABLE = 3,
/// Represents a recurring subscription
SUBSCRIPTION = 5,
/// System-generated group for each SUBSCRIPTION SKU created
SUBSCRIPTION_GROUP = 6,
}
/// <https://discord.com/developers/docs/resources/sku#sku-object-sku-flags>
#[allow(non_camel_case_types)]
pub enum SKUFlags {
/// SKU is available for purchase
AVAILABLE = 1 << 2,
/// Recurring SKU that can be purchased by a user and applied to a single server
GUILD_SUBSCRIPTION = 1 << 7,
/// Recurring SKU purchased by a user for themselves
USER_SUBSCRIPTION = 1 << 8,
}