Skip to content

Commit b8ded15

Browse files
authored
Add archival (#69)
* Add archive and restore * Add get and get-operation * Docs and version bump * Fix CI
1 parent cc4a8cd commit b8ded15

File tree

9 files changed

+311
-18
lines changed

9 files changed

+311
-18
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515

1616
- name: Rust
17-
run: rustup toolchain install stable --profile minimal --component clippy rustfmt --no-self-update
17+
run: rustup toolchain install stable --profile minimal --component clippy,rustfmt --no-self-update
1818

1919
- name: Rust Cache
2020
uses: Swatinem/rust-cache@v2

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rbxcloud"
3-
version = "0.15.1"
3+
version = "0.16.0"
44
description = "CLI and SDK for the Roblox Open Cloud APIs"
55
authors = ["Stephen Leitnick"]
66
license = "MIT"

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2024 Stephen Leitnick
1+
Copyright 2025 Stephen Leitnick
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Possible use-cases:
2323
| :white_check_mark: | Messaging |
2424
| :white_check_mark: | Place Publishing |
2525

26-
| | API v2 (Beta) |
26+
| | API v2 |
2727
| -- | -- |
2828
| :white_check_mark: | Groups |
2929
| :white_check_mark: | Universes |
@@ -34,6 +34,7 @@ Possible use-cases:
3434
| :white_check_mark: | User Notifications |
3535
| :white_check_mark: | User |
3636
| :x: | Creator Store |
37+
| :x: | Luau Execution |
3738

3839
- :white_check_mark: = Supported
3940
- :x: = Not yet supported

docs/cli/cli-assets.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Assets API
2+
3+
## Get
4+
Get information on a given asset.
5+
```
6+
Usage: rbxcloud.exe assets get [OPTIONS] --asset-id <ASSET_ID> --api-key <API_KEY>
7+
8+
Options:
9+
-i, --asset-id <ASSET_ID> Asset ID
10+
-m, --read-mask <READ_MASK>
11+
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
12+
-h, --help Print help
13+
```
14+
15+
## Create
16+
Create a new asset.
17+
```
18+
Usage: rbxcloud.exe assets create [OPTIONS] --display-name <DISPLAY_NAME> --description <DESCRIPTION> --creator-id <CREATOR_ID> --creator-type <CREATOR_TYPE> --filepath <FILEPATH> --api-key <API_KEY>
19+
20+
Options:
21+
-t, --asset-type <ASSET_TYPE>
22+
Asset type [possible values: audio-mp3, audio-ogg, audio-flac, audio-wav, decal-png, decal-jpeg, decal-bmp, decal-tga, model-fbx]
23+
-n, --display-name <DISPLAY_NAME>
24+
Display name
25+
-d, --description <DESCRIPTION>
26+
Description
27+
-e, --expected-price <EXPECTED_PRICE>
28+
Expected Robux price
29+
-i, --creator-id <CREATOR_ID>
30+
Creator ID
31+
-c, --creator-type <CREATOR_TYPE>
32+
Creator type [possible values: user, group]
33+
-f, --filepath <FILEPATH>
34+
File (full or relative path)
35+
-a, --api-key <API_KEY>
36+
Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
37+
-h, --help
38+
Print help
39+
```
40+
41+
## Update
42+
Update an asset.
43+
```
44+
Usage: rbxcloud.exe assets update [OPTIONS] --asset-id <ASSET_ID> --filepath <FILEPATH> --api-key <API_KEY>
45+
46+
Options:
47+
-t, --asset-type <ASSET_TYPE> Asset type [possible values: audio-mp3, audio-ogg, audio-flac, audio-wav, decal-png, decal-jpeg, decal-bmp, decal-tga, model-fbx]
48+
-i, --asset-id <ASSET_ID> Asset ID
49+
-f, --filepath <FILEPATH> File (full or relative path)
50+
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
51+
-h, --help Print help
52+
```
53+
54+
## Archive
55+
Archive an asset.
56+
```
57+
Usage: rbxcloud.exe assets archive --asset-id <ASSET_ID> --api-key <API_KEY>
58+
59+
Options:
60+
-i, --asset-id <ASSET_ID> Asset ID
61+
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
62+
-h, --help Print help
63+
```
64+
65+
## Restore
66+
Restore an archived asset.
67+
```
68+
Usage: rbxcloud.exe assets restore --asset-id <ASSET_ID> --api-key <API_KEY>
69+
70+
Options:
71+
-i, --asset-id <ASSET_ID> Asset ID
72+
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
73+
-h, --help Print help
74+
```
75+
76+
## Get Operation
77+
Get information on an asset operation.
78+
```
79+
Usage: rbxcloud.exe assets get-operation --operation-id <OPERATION_ID> --api-key <API_KEY>
80+
81+
Options:
82+
-i, --operation-id <OPERATION_ID> Operation ID
83+
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
84+
-h, --help Print help
85+
86+
```

src/cli/assets_cli.rs

Lines changed: 82 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rbxcloud::rbx::{
99
AssetCreation, AssetCreationContext, AssetCreator, AssetGroupCreator, AssetType,
1010
AssetUserCreator,
1111
},
12-
CreateAsset, GetAsset, RbxCloud, UpdateAsset,
12+
ArchiveAsset, CreateAsset, GetAsset, GetAssetOperation, RbxCloud, UpdateAsset,
1313
},
1414
};
1515

@@ -75,8 +75,8 @@ pub enum AssetsCommands {
7575
api_key: String,
7676
},
7777

78-
/// Get asset information
79-
Get {
78+
/// Get asset operation information
79+
GetOperation {
8080
/// Operation ID
8181
#[clap(short = 'i', long, value_parser)]
8282
operation_id: String,
@@ -85,6 +85,42 @@ pub enum AssetsCommands {
8585
#[clap(short, long, value_parser, env = "RBXCLOUD_API_KEY")]
8686
api_key: String,
8787
},
88+
89+
/// Get asset information
90+
Get {
91+
/// Asset ID
92+
#[clap(short = 'i', long, value_parser)]
93+
asset_id: u64,
94+
95+
#[clap(short = 'm', long, value_parser)]
96+
read_mask: Option<String>,
97+
98+
/// Roblox Open Cloud API Key
99+
#[clap(short, long, value_parser, env = "RBXCLOUD_API_KEY")]
100+
api_key: String,
101+
},
102+
103+
/// Archive an asset
104+
Archive {
105+
/// Asset ID
106+
#[clap(short = 'i', long, value_parser)]
107+
asset_id: u64,
108+
109+
/// Roblox Open Cloud API Key
110+
#[clap(short, long, value_parser, env = "RBXCLOUD_API_KEY")]
111+
api_key: String,
112+
},
113+
114+
/// Restore an archived asset
115+
Restore {
116+
/// Asset ID
117+
#[clap(short = 'i', long, value_parser)]
118+
asset_id: u64,
119+
120+
/// Roblox Open Cloud API Key
121+
#[clap(short, long, value_parser, env = "RBXCLOUD_API_KEY")]
122+
api_key: String,
123+
},
88124
}
89125

90126
#[derive(Debug, Args)]
@@ -191,13 +227,54 @@ impl Assets {
191227
}
192228
}
193229

194-
AssetsCommands::Get {
230+
AssetsCommands::GetOperation {
195231
operation_id,
196232
api_key,
197233
} => {
198234
let rbx_cloud = RbxCloud::new(&api_key);
199235
let assets = rbx_cloud.assets();
200-
let res = assets.get(&GetAsset { operation_id }).await;
236+
let res = assets
237+
.get_operation(&GetAssetOperation { operation_id })
238+
.await;
239+
match res {
240+
Ok(data) => Ok(Some(format!("{data:#?}"))),
241+
Err(err) => Err(anyhow::anyhow!(err)),
242+
}
243+
}
244+
245+
AssetsCommands::Get {
246+
asset_id,
247+
read_mask,
248+
api_key,
249+
} => {
250+
let rbx_cloud = RbxCloud::new(&api_key);
251+
let assets = rbx_cloud.assets();
252+
let res = assets
253+
.get(&GetAsset {
254+
asset_id,
255+
read_mask,
256+
})
257+
.await;
258+
match res {
259+
Ok(data) => Ok(Some(format!("{data:#?}"))),
260+
Err(err) => Err(anyhow::anyhow!(err)),
261+
}
262+
}
263+
264+
AssetsCommands::Archive { asset_id, api_key } => {
265+
let rbx_cloud = RbxCloud::new(&api_key);
266+
let assets = rbx_cloud.assets();
267+
let res = assets.archive(&ArchiveAsset { asset_id }).await;
268+
match res {
269+
Ok(data) => Ok(Some(format!("{data:#?}"))),
270+
Err(err) => Err(anyhow::anyhow!(err)),
271+
}
272+
}
273+
274+
AssetsCommands::Restore { asset_id, api_key } => {
275+
let rbx_cloud = RbxCloud::new(&api_key);
276+
let assets = rbx_cloud.assets();
277+
let res = assets.restore(&ArchiveAsset { asset_id }).await;
201278
match res {
202279
Ok(data) => Ok(Some(format!("{data:#?}"))),
203280
Err(err) => Err(anyhow::anyhow!(err)),

0 commit comments

Comments
 (0)