ic_radix_rs/apis/
state_api.rs

1/*
2 * Radix Gateway API - Babylon
3 *
4 * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission.  It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up.  The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network.  This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own.  ## Migration guide  Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases).  ## Integration and forward compatibility guarantees  All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects.  When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out.  On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway.  The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare.
5 *
6 * The version of the OpenAPI document: v1.5.2
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use std::str::FromStr;
12
13use anyhow::Result;
14
15use super::{configuration, Error, StatusCode};
16use crate::{
17    apis::ResponseContent,
18    client::Client,
19    invoke,
20    invoker::{self, Invoker},
21    models,
22};
23
24/// struct for typed errors of method [`account_authorized_depositors_page`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum AccountAuthorizedDepositorsPageError {
28    Status4XX(models::ErrorResponse),
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`account_resource_preferences_page`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum AccountResourcePreferencesPageError {
36    Status4XX(models::ErrorResponse),
37    UnknownValue(serde_json::Value),
38}
39
40/// struct for typed errors of method [`entity_fungible_resource_vault_page`]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum EntityFungibleResourceVaultPageError {
44    Status4XX(models::ErrorResponse),
45    UnknownValue(serde_json::Value),
46}
47
48/// struct for typed errors of method [`entity_fungibles_page`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum EntityFungiblesPageError {
52    Status4XX(models::ErrorResponse),
53    UnknownValue(serde_json::Value),
54}
55
56/// struct for typed errors of method [`entity_metadata_page`]
57#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum EntityMetadataPageError {
60    Status4XX(models::ErrorResponse),
61    UnknownValue(serde_json::Value),
62}
63
64/// struct for typed errors of method [`entity_non_fungible_ids_page`]
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum EntityNonFungibleIdsPageError {
68    Status4XX(models::ErrorResponse),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`entity_non_fungible_resource_vault_page`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum EntityNonFungibleResourceVaultPageError {
76    Status4XX(models::ErrorResponse),
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`entity_non_fungibles_page`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum EntityNonFungiblesPageError {
84    Status4XX(models::ErrorResponse),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`entity_schema_page`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum EntitySchemaPageError {
92    Status4XX(models::ErrorResponse),
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`key_value_store_data`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum KeyValueStoreDataError {
100    Status4XX(models::ErrorResponse),
101    UnknownValue(serde_json::Value),
102}
103
104/// struct for typed errors of method [`key_value_store_keys`]
105#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum KeyValueStoreKeysError {
108    Status4XX(models::ErrorResponse),
109    UnknownValue(serde_json::Value),
110}
111
112/// struct for typed errors of method [`non_fungible_data`]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum NonFungibleDataError {
116    Status4XX(models::ErrorResponse),
117    UnknownValue(serde_json::Value),
118}
119
120/// struct for typed errors of method [`non_fungible_ids`]
121#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum NonFungibleIdsError {
124    Status4XX(models::ErrorResponse),
125    UnknownValue(serde_json::Value),
126}
127
128/// struct for typed errors of method [`non_fungible_location`]
129#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum NonFungibleLocationError {
132    Status4XX(models::ErrorResponse),
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`package_blueprint_page`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum PackageBlueprintPageError {
140    Status4XX(models::ErrorResponse),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`package_code_page`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum PackageCodePageError {
148    Status4XX(models::ErrorResponse),
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`state_entity_details`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum StateEntityDetailsError {
156    Status4XX(models::ErrorResponse),
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`state_validators_list`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum StateValidatorsListError {
164    Status4XX(models::ErrorResponse),
165    UnknownValue(serde_json::Value),
166}
167
168/// Returns paginable collection of authorized depositors for given account.
169pub async fn account_authorized_depositors_page<T: Client>(
170    configuration: &configuration::Configuration<T>,
171    state_account_authorized_depositors_page_request: models::StateAccountAuthorizedDepositorsPageRequest,
172) -> Result<models::StateAccountAuthorizedDepositorsPageResponse> {
173    invoke!(
174        configuration,
175        state_account_authorized_depositors_page_request,
176        "/state/account/page/authorized-depositors"
177    )
178}
179
180/// Returns paginable collection of resource preference rules for given account.
181pub async fn account_resource_preferences_page<T: Client>(
182    configuration: &configuration::Configuration<T>,
183    state_account_resource_preferences_page_request: models::StateAccountResourcePreferencesPageRequest,
184) -> Result<models::StateAccountResourcePreferencesPageResponse> {
185    invoke!(
186        configuration,
187        state_account_resource_preferences_page_request,
188        "/state/account/page/resource-preferences"
189    )
190}
191
192/// Returns vaults for fungible resource owned by a given global entity. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.
193pub async fn entity_fungible_resource_vault_page<T: Client>(
194    configuration: &configuration::Configuration<T>,
195    state_entity_fungible_resource_vaults_page_request: models::StateEntityFungibleResourceVaultsPageRequest,
196) -> Result<models::StateEntityFungibleResourceVaultsPageResponse> {
197    invoke!(
198        configuration,
199        state_entity_fungible_resource_vaults_page_request,
200        "/state/entity/page/fungible-vaults/"
201    )
202}
203
204/// Returns the total amount of each fungible resource owned by a given global entity. Result can be aggregated globally or per vault. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.
205pub async fn entity_fungibles_page<T: Client>(
206    configuration: &configuration::Configuration<T>,
207    state_entity_fungibles_page_request: models::StateEntityFungiblesPageRequest,
208) -> Result<models::StateEntityFungiblesPageResponse> {
209    invoke!(
210        configuration,
211        state_entity_fungibles_page_request,
212        "/state/entity/page/fungibles/"
213    )
214}
215
216/// Returns all the metadata properties associated with a given global entity. The returned response is in a paginated format, ordered by first appearance on the ledger.
217pub async fn entity_metadata_page<T: Client>(
218    configuration: &configuration::Configuration<T>,
219    state_entity_metadata_page_request: models::StateEntityMetadataPageRequest,
220) -> Result<models::StateEntityMetadataPageResponse> {
221    invoke!(
222        configuration,
223        state_entity_metadata_page_request,
224        "/state/entity/page/metadata"
225    )
226}
227
228/// Returns all non-fungible IDs of a given non-fungible resource owned by a given entity. The returned response is in a paginated format, ordered by the resource's first appearence on the ledger.
229pub async fn entity_non_fungible_ids_page<T: Client>(
230    configuration: &configuration::Configuration<T>,
231    state_entity_non_fungible_ids_page_request: models::StateEntityNonFungibleIdsPageRequest,
232) -> Result<models::StateEntityNonFungibleIdsPageResponse> {
233    invoke!(
234        configuration,
235        state_entity_non_fungible_ids_page_request,
236        "/state/entity/page/non-fungible-vault/ids"
237    )
238}
239
240/// Returns vaults for non fungible resource owned by a given global entity. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.
241pub async fn entity_non_fungible_resource_vault_page<T: Client>(
242    configuration: &configuration::Configuration<T>,
243    state_entity_non_fungible_resource_vaults_page_request: models::StateEntityNonFungibleResourceVaultsPageRequest,
244) -> Result<models::StateEntityNonFungibleResourceVaultsPageResponse> {
245    invoke!(
246        configuration,
247        state_entity_non_fungible_resource_vaults_page_request,
248        "/state/entity/page/non-fungible-vaults/"
249    )
250}
251
252/// Returns the total amount of each non-fungible resource owned by a given global entity. Result can be aggregated globally or per vault. The returned response is in a paginated format, ordered by the resource's first appearance on the ledger.
253pub async fn entity_non_fungibles_page<T: Client>(
254    configuration: &configuration::Configuration<T>,
255    state_entity_non_fungibles_page_request: models::StateEntityNonFungiblesPageRequest,
256) -> Result<models::StateEntityNonFungiblesPageResponse> {
257    invoke!(
258        configuration,
259        state_entity_non_fungibles_page_request,
260        "/state/entity/page/non-fungibles/"
261    )
262}
263
264/// Returns all the schemas associated with a given global entity. The returned response is in a paginated format, ordered by first appearance on the ledger.
265pub async fn entity_schema_page<T: Client>(
266    configuration: &configuration::Configuration<T>,
267    state_entity_schema_page_request: models::StateEntitySchemaPageRequest,
268) -> Result<models::StateEntitySchemaPageResponse> {
269    invoke!(
270        configuration,
271        state_entity_schema_page_request,
272        "/state/entity/page/schemas"
273    )
274}
275
276/// Returns data (value) associated with a given key of a given key-value store. [Check detailed documentation for explanation](#section/How-to-query-the-content-of-a-key-value-store-inside-a-component)
277pub async fn key_value_store_data<T: Client>(
278    configuration: &configuration::Configuration<T>,
279    state_key_value_store_data_request: models::StateKeyValueStoreDataRequest,
280) -> Result<models::StateKeyValueStoreDataResponse> {
281    invoke!(
282        configuration,
283        state_key_value_store_data_request,
284        "/state/key-value-store/data"
285    )
286}
287
288/// Allows to iterate over key value store keys.
289pub async fn key_value_store_keys<T: Client>(
290    configuration: &configuration::Configuration<T>,
291    state_key_value_store_keys_request: models::StateKeyValueStoreKeysRequest,
292) -> Result<models::StateKeyValueStoreKeysResponse> {
293    invoke!(
294        configuration,
295        state_key_value_store_keys_request,
296        "/state/key-value-store/keys"
297    )
298}
299
300/// Returns data associated with a given non-fungible ID of a given non-fungible resource.
301pub async fn non_fungible_data<T: Client>(
302    configuration: &configuration::Configuration<T>,
303    state_non_fungible_data_request: models::StateNonFungibleDataRequest,
304) -> Result<models::StateNonFungibleDataResponse> {
305    invoke!(
306        configuration,
307        state_non_fungible_data_request,
308        "/state/non-fungible/data"
309    )
310}
311
312/// Returns the non-fungible IDs of a given non-fungible resource. Returned response is in a paginated format, ordered by their first appearance on the ledger.
313pub async fn non_fungible_ids<T: Client>(
314    configuration: &configuration::Configuration<T>,
315    state_non_fungible_ids_request: models::StateNonFungibleIdsRequest,
316) -> Result<models::StateNonFungibleIdsResponse> {
317    invoke!(
318        configuration,
319        state_non_fungible_ids_request,
320        "/state/non-fungible/ids"
321    )
322}
323
324/// Returns location of a given non-fungible ID.
325pub async fn non_fungible_location<T: Client>(
326    configuration: &configuration::Configuration<T>,
327    state_non_fungible_location_request: models::StateNonFungibleLocationRequest,
328) -> Result<models::StateNonFungibleLocationResponse> {
329    invoke!(
330        configuration,
331        state_non_fungible_location_request,
332        "/state/non-fungible/location"
333    )
334}
335
336/// Returns all the blueprints associated with a given package entity. The returned response is in a paginated format, ordered by first appearance on the ledger.
337pub async fn package_blueprint_page<T: Client>(
338    configuration: &configuration::Configuration<T>,
339    state_package_blueprint_page_request: models::StatePackageBlueprintPageRequest,
340) -> Result<models::StatePackageBlueprintPageResponse> {
341    invoke!(
342        configuration,
343        state_package_blueprint_page_request,
344        "/state/package/page/blueprints"
345    )
346}
347
348/// Returns all the codes associated with a given package entity. The returned response is in a paginated format, ordered by first appearance on the ledger.
349pub async fn package_code_page<T: Client>(
350    configuration: &configuration::Configuration<T>,
351    state_package_code_page_request: models::StatePackageCodePageRequest,
352) -> Result<models::StatePackageCodePageResponse> {
353    invoke!(
354        configuration,
355        state_package_code_page_request,
356        "/state/package/page/codes"
357    )
358}
359
360/// Returns detailed information for collection of entities. Aggregate resources globally by default.
361pub async fn state_entity_details<T: Client>(
362    configuration: &configuration::Configuration<T>,
363    state_entity_details_request: models::StateEntityDetailsRequest,
364) -> Result<models::StateEntityDetailsResponse> {
365    invoke!(
366        configuration,
367        state_entity_details_request,
368        "/state/entity/details"
369    )
370}
371
372pub async fn state_validators_list<T: Client>(
373    configuration: &configuration::Configuration<T>,
374    state_validators_list_request: models::StateValidatorsListRequest,
375) -> Result<models::StateValidatorsListResponse> {
376    invoke!(
377        configuration,
378        state_validators_list_request,
379        "/state/validators/list"
380    )
381}