# Cheat sheet {.lead} {rust:struct}`NominalClient` has a client for each area of Nominal, such as `client.assets()` for assets and `client.catalog()` for datasets and channels. This project setup command and associated imports will prepare you to call any of the functions listed on this page. ```shell cargo new nominal-cheatsheet cd nominal-cheatsheet cargo add nominal chrono cargo add tokio --features full ``` ```rust use chrono::Utc; // chrono is the time library used by the nominal crate use nominal::core::*; // AssetCreate, RunQuery and the other types below let client = nominal::NominalClient::from_profile("default")?; ``` ## Assets | Action | Ref | Rust | | --- | :---: | --- | | Create an asset | {rust:method}`📄 ` | `client.assets().create(AssetCreate::new("Engine 1").labels(["prototype"])).await?` | | Get an asset by RID | {rust:method}`📄 ` | `client.assets().get("").await?` | | Search by label | {rust:method}`📄 ` | `client.assets().search(AssetQuery::label("prototype")).await?` | | Add a dataset under a [ref name](https://dev.nominal.io/platform/data-model/#data-scopes-and-ref-names) | {rust:method}`📄 ` | `client.assets().add_dataset(asset.rid(), "telemetry", dataset.rid()).await?` | | Replace labels | {rust:method}`📄 ` | `client.assets().update(asset.rid(), AssetUpdate::new().labels(["prototype", "flight"])).await?` | | Archive | {rust:method}`📄 ` | `client.assets().archive(asset.rid()).await?` | ## Runs | Action | Ref | Rust | | --- | :---: | --- | | Start a run on an asset now | {rust:method}`📄 ` | `client.runs().create(RunCreate::new("Engine test 1", Utc::now()).assets([asset.rid()])).await?` | | End an open run | {rust:method}`📄 ` | `client.runs().update(run.rid(), RunUpdate::new().end(Utc::now())).await?` | | Get a run by RID | {rust:method}`📄 ` | `client.runs().get("").await?` | | Search by label | {rust:method}`📄 ` | `client.runs().search(RunQuery::label("acceptance")).await?` | | Add a dataset to a run with no assets | {rust:method}`📄 ` | `client.runs().add_dataset(run.rid(), "telemetry", dataset.rid()).await?` | | Archive | {rust:method}`📄 ` | `client.runs().archive(run.rid()).await?` | ## Datasets and channels | Action | Ref | Rust | | --- | :---: | --- | | Create a dataset | {rust:method}`📄 ` | `client.catalog().create_dataset(DatasetCreate::new("Engine test 1")).await?` | | Get a dataset by RID | {rust:method}`📄 ` | `client.catalog().get_dataset("").await?` | | Search by part of the name | {rust:method}`📄 ` | `client.catalog().search_datasets(DatasetQuery::substring_match("Engine")).await?` | | List a dataset's channels | {rust:method}`📄 ` | `client.catalog().list_channels(dataset.rid()).await?` | | Archive | {rust:method}`📄 ` | `client.catalog().archive_dataset(dataset.rid()).await?` | ## Files and drives | Action | Ref | Rust | | --- | :---: | --- | | Upload a CSV into a new dataset | {rust:method}`📄 ` | `client.ingest().upload_csv("test.csv", DatasetCreate::new("Engine test 1"), CsvIngest::new(Timestamp::iso8601("timestamp"))).await?` | | Wait for the upload's ingest job | {rust:method}`📄 ` | `client.ingest().wait_for_ingest_job(job.rid()).await?` | | Get a drive by name | {rust:method}`📄 ` | `client.drives().get_by_id("test-reports").await?` | | List a drive folder | {rust:method}`📄 ` | `client.files(drive.rid()).list("reports", false).await?` | ## Workbooks | Action | Ref | Rust | | --- | :---: | --- | | Get a template by RID | {rust:method}`📄 ` | `client.templates().get("").await?` | | Create a workbook for a run | {rust:method}`📄 ` | `client.workbooks().create_from_template(&template, WorkbookDataScope::runs([run.rid()]), WorkbookCreate::new()).await?` | ## Beyond `NominalClient` - Stream points as your program produces them: [Stream data](stream.md) - Query your data with SQL: [Query data with SQL](sql.md) - Create events and checklists, and execute a checklist on a run: [Call the REST API directly](rest-api.md) - Create runs that select tagged data: [Simulation runs](../examples/simulation-runs.md)