AssetsClient#

pub struct AssetsClient#

Client for asset collection operations (list, get).

Implementations#

impl AssetsClient
pub async fn create(&self, create: AssetCreate) -> Result<Asset>#

Create a new asset.

pub async fn get(&self, rid: &str) -> Result<Asset>#

Get an asset by RID.

pub async fn get_batch<I, S>(&self, rids: I) -> Result<HashMap<String, Asset>> where I: IntoIterator<Item = S>, S: AsRef<str>#

Get multiple assets by RID.

Returns a map from RID string to Asset. RIDs not found in Nominal are omitted.

pub async fn list(&self) -> Result<Vec<Asset>>#

List assets, sorted by creation date descending.

pub async fn search(&self, query: AssetQuery) -> Result<Vec<Asset>>#

Search assets with a query, collecting all pages eagerly.

Example

use nominal::core::AssetQuery;
let assets = client.assets()
    .search(AssetQuery::and([
        AssetQuery::label("production"),
        AssetQuery::property("vehicle", "rocket"),
    ]))
    .await?;
pub async fn update(&self, rid: &str, update: AssetUpdate) -> Result<Asset>#

Update asset metadata. Returns the updated asset.

Only fields set on the update will be changed; the rest remain untouched.

Example

let asset = client.assets()
    .update("ri.scout.cerulean-staging.asset.<uuid>", AssetUpdate::new().name("New Name").labels(["tag1", "tag2"]))
    .await?;
pub async fn add_data_sources<I, N>(&self, rid: &str, sources: I) -> Result<Asset> where I: IntoIterator<Item = (N, DataSource)>, N: Into<String>#

Attach data sources to an asset under the given scope names.

Scope names should be stable across assets of the same type, since checklists and templates use them to reference data sources. Returns the updated asset.

Example

use nominal::core::DataSource;
client.assets().add_data_sources("ri.scout.cerulean-staging.asset.<uuid>", [
    ("flight-data", DataSource::dataset("ri.catalog.cerulean-staging.dataset.<uuid>")),
    ("cockpit-cam", DataSource::video("ri.catalog.cerulean-staging.video.<uuid>")),
]).await?;
pub async fn add_dataset(&self, rid: &str, name: &str, dataset_rid: &str) -> Result<Asset>#

Attach a dataset to an asset under the given scope name. See add_data_sources.

pub async fn add_dataset_with_tags<I, K, V>(&self, rid: &str, name: &str, dataset_rid: &str, tags: I) -> Result<Asset> where I: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<String>#

Attach a dataset to an asset with a series tag filter under the given scope name.

Series tags filter which series from the dataset are included in the asset’s data scope. Returns the updated asset.

Example

client.assets().add_dataset_with_tags(
    "ri.scout.cerulean-staging.asset.<uuid>",
    "flight-data",
    "ri.catalog.cerulean-staging.dataset.<uuid>",
    [("vehicle", "rocket-1"), ("phase", "ascent")],
).await?;
pub async fn add_video(&self, rid: &str, name: &str, video_rid: &str) -> Result<Asset>#

Attach a video to an asset under the given scope name. See add_data_sources.

pub async fn add_connection(&self, rid: &str, name: &str, connection_rid: &str) -> Result<Asset>#

Attach a connection to an asset under the given scope name. See add_data_sources.

pub async fn archive(&self, rid: &str) -> Result<()>#

Archive an asset. Archived assets are hidden from the UI but not deleted.

pub async fn unarchive(&self, rid: &str) -> Result<()>#

Unarchive an asset, restoring its visibility in the UI.

Trait implementations#

Auto traits: Send, Sync, Unpin, !UnwindSafe, !RefUnwindSafe