Skip to main content

rbx_ds_cloud/api/
endpoint_structs.rs

1//! Structs used as Arguments for the Roblox API
2
3use clap::{Args, ValueEnum};
4
5#[derive(Args, Debug)]
6/// List all Datastores in the specified "universe" or game
7pub struct ListDataStores {
8    /// The value of DataModel.GameId, which is visible in the URL on the universe's Configure page.
9    #[clap(short, long, value_parser)]
10    pub universe_id: u64,
11
12    /// API key of Roblox Open Cloud
13    #[clap(short, long, value_parser)]
14    pub api_key: String,
15
16    /// (INTEGER) Maximum number of items to return
17    #[clap(short, long, value_parser)]
18    pub limit: u64,
19
20    /// (Optional) Return only data stores with this prefix
21    #[clap(short, long, value_parser)]
22    pub prefix: Option<String>,
23
24    /// (Optional) Cursor for the next set of data
25    #[clap(short, long, value_parser)]
26    pub cursor: Option<String>,
27}
28
29#[derive(Args, Debug)]
30/// Returns a list of entry keys within a data store.
31pub struct ListEntries {
32    /// The value of DataModel.GameId, which is visible in the URL on the universe's Configure page.
33    #[clap(short, long, value_parser)]
34    pub universe_id: u64,
35
36    /// API key of Roblox Open Cloud
37    #[clap(short, long, value_parser)]
38    pub api_key: String,
39
40    /// Name of the data store
41    #[clap(short, long, value_parser)]
42    pub datastore_name: String,
43
44    /// If true, return keys from all scopes
45    #[clap(short = 'o', long, value_parser)]
46    pub all_scopes: Option<bool>,
47
48    /// (Optional) If "None", defaults to global, similar to Lua API
49    #[clap(short, long, value_parser)]
50    pub scope: Option<String>,
51
52    /// (Optional) Return only keys with this prefix
53    #[clap(short, long, value_parser)]
54    pub prefix: Option<String>,
55
56    /// (INTEGER) Maximum number of items to return
57    #[clap(short, long, value_parser)]
58    pub limit: u64,
59
60    /// (Optional) Provide to request the next set of data
61    #[clap(short, long, value_parser)]
62    pub cursor: Option<String>,
63}
64
65#[derive(Args, Debug)]
66/// Returns the value associated with an entry.
67pub struct GetEntry {
68    /// The value of DataModel.GameId, which is visible in the URL on the universe's Configure page.
69    #[clap(short, long, value_parser)]
70    pub universe_id: u64,
71
72    /// API key of Roblox Open Cloud
73    #[clap(short, long, value_parser)]
74    pub api_key: String,
75
76    /// Name of the data store
77    #[clap(short, long, value_parser)]
78    pub datastore_name: String,
79
80    /// (Optional) If "None", defaults to global, similar to Lua API
81    #[clap(short, long, value_parser)]
82    pub scope: Option<String>,
83
84    /// The key which identifies the entry
85    #[clap(short, long, value_parser)]
86    pub key: String,
87}
88
89#[derive(Args, Debug)]
90/// Returns the versions and metadata of an Entry of a datastore
91pub struct ListEntryVersions {
92    /// The value of DataModel.GameId, which is visible in the URL on the universe's Configure page.
93    #[clap(short, long, value_parser)]
94    pub universe_id: u64,
95
96    /// API key of Roblox Open Cloud
97    #[clap(short, long, value_parser)]
98    pub api_key: String,
99
100    /// Name of the data store
101    #[clap(short, long, value_parser)]
102    pub datastore_name: String,
103
104    /// (Optional) If "None", defaults to global, similar to Lua API
105    #[clap(short, long, value_parser)]
106    pub scope: Option<String>,
107
108    /// The key which identifies the entry
109    #[clap(short, long, value_parser)]
110    pub key: String,
111
112    /// (Optional) Start time constraint (ISO UTC Datetime)
113    #[clap(short = 't', long, value_parser)]
114    pub start_time: Option<String>,
115
116    /// (Optional) End time constraint (ISO UTC Datetime)
117    #[clap(short = 'e', long, value_parser)]
118    pub end_time: Option<String>,
119
120    /// Sort order
121    #[clap(short = 'o', long, value_enum)]
122    pub sort_order: SortOrder,
123
124    /// (INTEGER) Maximum number of items to return
125    #[clap(short, long, value_parser)]
126    pub limit: u64,
127
128    /// (Optional) Cursor for the next set of data
129    #[clap(short, long, value_parser)]
130    pub cursor: Option<String>,
131}
132
133#[derive(Args, Debug)]
134/// Returns the metadata of a specific version of an entry.
135pub struct GetEntryVersion {
136    /// The value of DataModel.GameId, which is visible in the URL on the universe's Configure page.
137    #[clap(short, long, value_parser)]
138    pub universe_id: u64,
139
140    /// API key of Roblox Open Cloud
141    #[clap(short, long, value_parser)]
142    pub api_key: String,
143
144    /// Name of the data store
145    #[clap(short, long, value_parser)]
146    pub datastore_name: String,
147
148    /// (Optional) If "None", defaults to global, similar to Lua API
149    #[clap(short, long, value_parser)]
150    pub scope: Option<String>,
151
152    /// The key which identifies the entry
153    #[clap(short, long, value_parser)]
154    pub key: String,
155
156    /// The version of the key
157    #[clap(short, long, value_parser)]
158    pub version_id: String,
159}
160
161#[derive(Args, Debug)]
162/// Sets the value, metadata and user IDs associated with an entry.
163pub struct SetEntry {
164    /// The value of DataModel.GameId, which is visible in the URL on the universe's Configure page.
165    #[clap(short, long, value_parser)]
166    pub universe_id: u64,
167
168    /// API key of Roblox Open Cloud
169    #[clap(short, long, value_parser)]
170    pub api_key: String,
171
172    /// Name of the data store
173    #[clap(short, long, value_parser)]
174    pub datastore_name: String,
175
176    /// (Optional) If "None", defaults to global, similar to Lua API
177    #[clap(short, long, value_parser)]
178    pub scope: Option<String>,
179
180    /// The key which identifies the entry
181    #[clap(short, long, value_parser)]
182    pub key: String,
183
184    /// (Optional) Only update if current version matches this
185    #[clap(short = 'i', long, value_parser)]
186    pub match_version: Option<String>,
187
188    /// (Optional) Only create the entry if it does not exist
189    #[clap(short, long, value_parser)]
190    pub exclusive_create: Option<bool>,
191
192    /// JSON-stringified or stringify-able data (Limit: 4MB)
193    #[clap(short = 'D', long, value_parser)]
194    pub data: String,
195
196    /// (Optional) Associated UserID (can be multiple)
197    #[clap(short = 'U', long, value_parser)]
198    pub user_ids: Option<Vec<u64>>,
199
200    /// (Optional) JSON-stringified attributes data
201    #[clap(short = 't', long, value_parser)]
202    pub attributes: Option<String>,
203}
204
205#[derive(Args, Debug)]
206/// Increments the value for an entry by a given amount, or create a new entry with that amount.
207pub struct IncrementEntry {
208    /// The value of DataModel.GameId, which is visible in the URL on the universe's Configure page.
209    #[clap(short, long, value_parser)]
210    pub universe_id: u64,
211
212    /// API key of Roblox Open Cloud
213    #[clap(short, long, value_parser)]
214    pub api_key: String,
215
216    /// Name of the data store
217    #[clap(short, long, value_parser)]
218    pub datastore_name: String,
219
220    /// (Optional) If "None", defaults to global, similar to Lua API
221    #[clap(short, long, value_parser)]
222    pub scope: Option<String>,
223
224    /// The key which identifies the entry
225    #[clap(short, long, value_parser)]
226    pub key: String,
227
228    /// The amount by which the entry should be incremented
229    #[clap(short, long, value_parser)]
230    pub increment_by: f64,
231
232    /// (Optional) Comma-separated list of Roblox user IDs
233    #[clap(short = 'U', long, value_parser)]
234    pub user_ids: Option<Vec<u64>>,
235
236    /// (Optional) JSON-stringified attributes data
237    #[clap(short = 't', long, value_parser)]
238    pub attributes: Option<String>,
239}
240
241#[derive(Args, Debug)]
242/// Marks the entry as deleted by creating a tombstone version. Entries are deleted permanently after 30 days.
243pub struct DeleteEntry {
244    /// The value of DataModel.GameId, which is visible in the URL on the universe's Configure page.
245    #[clap(short, long, value_parser)]
246    pub universe_id: u64,
247
248    /// API key of Roblox Open Cloud
249    #[clap(short, long, value_parser)]
250    pub api_key: String,
251
252    /// Name of the data store
253    #[clap(short, long, value_parser)]
254    pub datastore_name: String,
255
256    /// (Optional) If "None", defaults to global, similar to Lua API
257    #[clap(short, long, value_parser)]
258    pub scope: Option<String>,
259
260    /// The key which identifies the entry
261    #[clap(short, long, value_parser)]
262    pub key: String,
263}
264
265#[derive(Debug, Clone, ValueEnum)]
266/// An Enum for the ListEntryVersions API
267pub enum SortOrder {
268    Ascending,
269    Descending,
270}