sideko_rest_api 0.9.2

Rust API Client
Documentation
# asset

## Module Functions

### Delete Asset <a name="delete"></a>

Delete a media asset in your organization

**API Endpoint**: `DELETE /organization/asset/{id}`

#### Parameters

| Parameter | Required | Description | Example                                              |
| --------- | :------: | ----------- | ---------------------------------------------------- |
| `id`      ||             | `"3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string()` |

#### Example Snippet

```rust
let client = sideko_rest_api::SidekoClient::default()
    .with_api_key_auth(&std::env::var("API_KEY").unwrap())
    .with_cookie_auth(&std::env::var("API_KEY").unwrap());
let res = client
    .asset()
    .delete(sideko_rest_api::resources::asset::DeleteRequest {
        id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(),
    })
    .await;
```

### List Assets <a name="list"></a>

Get all media assets for an organization

**API Endpoint**: `GET /organization/asset`

#### Parameters

| Parameter | Required | Description | Example                |
| --------- | :------: | ----------- | ---------------------- |
| `name`    ||             | `"string".to_string()` |
| `page`    ||             | `123`                  |

#### Example Snippet

```rust
let client = sideko_rest_api::SidekoClient::default()
    .with_api_key_auth(&std::env::var("API_KEY").unwrap())
    .with_cookie_auth(&std::env::var("API_KEY").unwrap());
let res = client
    .asset()
    .list(sideko_rest_api::resources::asset::ListRequest {
        ..Default::default()
    })
    .await;
```

#### Response

##### Type

[ListAssetsPage](/src/models/list_assets_page.rs)

##### Example

```rust
ListAssetsPage {pagination: Pagination {page: 123, page_count: 123, page_limit: 123, total_count: 123}, results: vec![Asset {extension: "string".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), name: "string".to_string(), url: "http://www.example.com".to_string()}]}
```

### Update Asset <a name="patch"></a>

Update a media asset in your organization

**API Endpoint**: `PATCH /organization/asset/{id}`

#### Parameters

| Parameter | Required | Description                        | Example                                              |
| --------- | :------: | ---------------------------------- | ---------------------------------------------------- |
| `id`      ||                                    | `"3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string()` |
| `name`    || Asset name (without any extension) | `"string".to_string()`                               |

#### Example Snippet

```rust
let client = sideko_rest_api::SidekoClient::default()
    .with_api_key_auth(&std::env::var("API_KEY").unwrap())
    .with_cookie_auth(&std::env::var("API_KEY").unwrap());
let res = client
    .asset()
    .patch(sideko_rest_api::resources::asset::PatchRequest {
        id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(),
        ..Default::default()
    })
    .await;
```

#### Response

##### Type

[Asset](/src/models/asset.rs)

##### Example

```rust
Asset {extension: "string".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), name: "string".to_string(), url: "http://www.example.com".to_string()}
```

### Upload Asset <a name="create"></a>

Add a media asset like logos or other media to an organization

**API Endpoint**: `POST /organization/asset`

#### Parameters

| Parameter | Required | Description | Example                                              |
| --------- | :------: | ----------- | ---------------------------------------------------- |
| `file`    ||             | `UploadFile::from_path("uploads/file.pdf").unwrap()` |

#### Example Snippet

```rust
let client = sideko_rest_api::SidekoClient::default()
    .with_api_key_auth(&std::env::var("API_KEY").unwrap())
    .with_cookie_auth(&std::env::var("API_KEY").unwrap());
let res = client
    .asset()
    .create(sideko_rest_api::resources::asset::CreateRequest {
        file: sideko_rest_api::UploadFile::from_path("uploads/image.png").unwrap(),
    })
    .await;
```

#### Response

##### Type

Vec of [Asset](/src/models/asset.rs)

##### Example

```rust
vec![Asset {extension: "string".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), name: "string".to_string(), url: "http://www.example.com".to_string()}]
```