Skip to content

Commit

Permalink
Merge pull request #52 from Sleitnick/feature/finish-subscription
Browse files Browse the repository at this point in the history
Finish subscription
  • Loading branch information
Sleitnick authored Jun 12, 2024
2 parents cfd17da + 97ed7ef commit 328a2c0
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rbxcloud"
version = "0.12.0"
version = "0.13.0"
description = "CLI and SDK for the Roblox Open Cloud APIs"
authors = ["Stephen Leitnick"]
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The goal of this project is to support all API endpoints that Roblox provides.
### Aftman
Run the `aftman add` command within your project directory. This will add `rbxcloud` to the project's `aftman.toml` file (or create one if it doesn't yet exist).
```sh
$ aftman add Sleitnick/rbxcloud@0.12.0
$ aftman add Sleitnick/rbxcloud@0.13.0
```

### From Release
Expand All @@ -61,7 +61,7 @@ The library built for the CLI tool is available to use directly in Rust projects
To use `rbxcloud` in a Rust project, simply add `rbxcloud` to the `Cargo.toml` dependency list.
```toml
[dependencies]
rbxcloud = "0.12.0"
rbxcloud = "0.13.0"
```

Alternatively, use `cargo add`.
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/cli-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ There are a few different ways to install the `rbxcloud` CLI.
### [Aftman](https://github.com/LPGhatguy/aftman) <small>(Preferred)</small>
Run the `aftman add` command within your project directory. This will add `rbxcloud` to the project's `aftman.toml` file (or create one if it doesn't yet exist).
```sh
$ aftman add Sleitnick/rbxcloud@0.12.0
$ aftman add Sleitnick/rbxcloud@0.13.0
```

Next, run `aftman install` to install `rbxcloud`.
Expand All @@ -17,7 +17,7 @@ Add `rbxcloud` under the `[tools]` section of your `foreman.toml` file.
```toml
# foreman.toml
[tools]
rbxcloud = { github = "Sleitnick/rbxcloud", version = "0.12.0" }
rbxcloud = { github = "Sleitnick/rbxcloud", version = "0.13.0" }
```

Next, run `foreman install` to install `rbxcloud`.
Expand Down
2 changes: 1 addition & 1 deletion docs/lib/lib-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
To use `rbxcloud` in a Rust project, simply add `rbxcloud` to the `Cargo.toml` dependency list.
```toml
[dependencies]
rbxcloud = "0.12.0"
rbxcloud = "0.13.0"
```

Alternatively, use `cargo add`.
Expand Down
61 changes: 60 additions & 1 deletion src/rbx/v2/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,66 @@ pub struct GetSubscriptionParams {

#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct GetSubscriptionResponse {}
pub struct GetSubscriptionResponse {
path: String,
create_time: String,
update_time: String,
active: bool,
will_renew: bool,
last_billing_time: String,
next_renew_time: String,
expire_time: String,
state: SubscriptionState,
expiration_details: SubscriptionExpirationDetails,
purchase_platform: SubscriptionPurchasePlatform,
payment_provider: SubscriptionPaymentProvider,
user: String,
}

#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct SubscriptionExpirationDetails {
reason: SubscriptionExpirationReason,
}

#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum SubscriptionState {
StateUnspecified,
SubscribedWillRenew,
SubscribedWillNotRenew,
SubscribedRenewalPaymentPending,
Expired,
}

#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum SubscriptionExpirationReason {
ExpirationReasonUnspecified,
ProductInactive,
ProductDeleted,
SubscriberCancelled,
SubscriberRefunded,
Lapsed,
}

#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum SubscriptionPurchasePlatform {
PurchasePlatformUnspecified,
Desktop,
Mobile,
}

#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum SubscriptionPaymentProvider {
PaymentProviderUnspecified,
Stripe,
Apple,
Google,
RobloxCredit,
}

pub async fn get_subscription(
params: &GetSubscriptionParams,
Expand Down

0 comments on commit 328a2c0

Please sign in to comment.