74 lines
2.5 KiB
Rust
74 lines
2.5 KiB
Rust
use super::*;
|
|
|
|
impl SpacetimeClient {
|
|
pub async fn list_asset_history(
|
|
&self,
|
|
input: module_assets::AssetHistoryListInput,
|
|
) -> Result<Vec<AssetHistoryEntryRecord>, SpacetimeClientError> {
|
|
let procedure_input = input.into();
|
|
|
|
self.call_after_connect(
|
|
"list_asset_history_and_return",
|
|
move |connection, sender| {
|
|
connection.procedures().list_asset_history_and_return_then(
|
|
procedure_input,
|
|
move |_, result| {
|
|
let mapped = result
|
|
.map_err(SpacetimeClientError::from_sdk_error)
|
|
.and_then(map_asset_history_list_result);
|
|
send_once(&sender, mapped);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
.await
|
|
}
|
|
|
|
pub async fn confirm_asset_object(
|
|
&self,
|
|
input: module_assets::AssetObjectUpsertInput,
|
|
) -> Result<AssetObjectRecord, SpacetimeClientError> {
|
|
let procedure_input = input.into();
|
|
|
|
self.call_after_connect(
|
|
"confirm_asset_object_and_return",
|
|
move |connection, sender| {
|
|
connection
|
|
.procedures()
|
|
.confirm_asset_object_and_return_then(procedure_input, move |_, result| {
|
|
let mapped = result
|
|
.map_err(SpacetimeClientError::from_sdk_error)
|
|
.and_then(map_procedure_result);
|
|
send_once(&sender, mapped);
|
|
});
|
|
},
|
|
)
|
|
.await
|
|
}
|
|
|
|
pub async fn bind_asset_object_to_entity(
|
|
&self,
|
|
input: module_assets::AssetEntityBindingInput,
|
|
) -> Result<AssetEntityBindingRecord, SpacetimeClientError> {
|
|
let procedure_input = input.into();
|
|
|
|
self.call_after_connect(
|
|
"bind_asset_object_to_entity_and_return",
|
|
move |connection, sender| {
|
|
connection
|
|
.procedures()
|
|
.bind_asset_object_to_entity_and_return_then(
|
|
procedure_input,
|
|
move |_, result| {
|
|
let mapped = result
|
|
.map_err(SpacetimeClientError::from_sdk_error)
|
|
.and_then(map_entity_binding_procedure_result);
|
|
send_once(&sender, mapped);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
.await
|
|
}
|
|
}
|