# RunsClient

## pub struct RunsClient

Client for run collection operations (list, get).

## Implementations

### impl RunsClient

#### pub async fn create(&self, create: RunCreate) -> Result<Run>

Create a new run.

Example

```rust
use chrono::Utc;
use nominal::core::RunCreate;
let run = client.runs()
    .create(
        RunCreate::new("orbit-raise-burn", Utc::now())
            .description("Three-impulse burn to GTO")
            .labels(["orbit", "production"])
            .assets(["ri.scout.cerulean-staging.asset.<uuid>"]),
    )
    .await?;
```

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

Get a run by RID.

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

Get multiple runs by RID.

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

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

List runs, sorted by creation date descending.

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

Search runs with a query, collecting all pages eagerly.

Example

```rust
use nominal::core::RunQuery;
let runs = client.runs()
    .search(RunQuery::and([
        RunQuery::label("production"),
        RunQuery::property("vehicle", "rocket"),
    ]))
    .await?;
```

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

Update run metadata. Returns the updated run.

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

Example

```rust
let run = client.runs()
    .update("ri.scout.cerulean-staging.run.<uuid>", RunUpdate::new().name("New Name").labels(["tag1", "tag2"]))
    .await?;
```

#### pub async fn add_data_sources<I, N>(&self, rid: &str, sources: I) -> Result<Run> where I: IntoIterator<Item = (N, DataSource)>, N: Into<String>

Attach data sources to a run under the given ref names.

Ref names should be stable across runs of the same type, since
checklists and templates use them to reference data sources.
Returns the updated run.

Example

```rust
use nominal::core::DataSource;
client.runs().add_data_sources("ri.scout.cerulean-staging.run.<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, ref_name: &str, dataset_rid: &str) -> Result<Run>

Attach a dataset to a run under the given ref name. See [`add_data_sources`](https://dev.nominal.io/rust-client/ref/rust/nominal/core/struct.RunsClient.md#method.add_data_sources "nominal::core::RunsClient::add_data_sources").

#### pub async fn add_video(&self, rid: &str, ref_name: &str, video_rid: &str) -> Result<Run>

Attach a video to a run under the given ref name. See [`add_data_sources`](https://dev.nominal.io/rust-client/ref/rust/nominal/core/struct.RunsClient.md#method.add_data_sources "nominal::core::RunsClient::add_data_sources").

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

Attach a connection to a run under the given ref name. See [`add_data_sources`](https://dev.nominal.io/rust-client/ref/rust/nominal/core/struct.RunsClient.md#method.add_data_sources "nominal::core::RunsClient::add_data_sources").

#### pub async fn add_attachments<I, S>(&self, rid: &str, attachment_rids: I) -> Result<()> where I: IntoIterator<Item = S>, S: AsRef<str>

Add attachments (by RID) that have already been uploaded to a run.

#### pub async fn remove_attachments<I, S>(&self, rid: &str, attachment_rids: I) -> Result<()> where I: IntoIterator<Item = S>, S: AsRef<str>

Remove attachments from a run. Does not delete them from Nominal.

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

Archive a run. Archived runs are hidden from the UI but not deleted.

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

Unarchive a run, restoring its visibility in the UI.

## Trait implementations

**Auto traits**: [`Send`](https://doc.rust-lang.org/1.98.1/core/marker/trait.Send.html), [`Sync`](https://doc.rust-lang.org/1.98.1/core/marker/trait.Sync.html), [`Unpin`](https://doc.rust-lang.org/1.98.1/core/marker/trait.Unpin.html), [`!UnwindSafe`](https://doc.rust-lang.org/1.98.1/core/panic/unwind_safe/trait.UnwindSafe.html), [`!RefUnwindSafe`](https://doc.rust-lang.org/1.98.1/core/panic/unwind_safe/trait.RefUnwindSafe.html)
