sideko_rest_api 0.9.2

Rust API Client
Documentation
# service_account

## Module Functions

### Delete Service Account <a name="delete"></a>

**API Endpoint**: `DELETE /service_account/{id}`

#### Parameters

| Parameter | Required | Description        | Example                                              |
| --------- | :------: | ------------------ | ---------------------------------------------------- |
| `id`      || service account 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
    .service_account()
    .delete(sideko_rest_api::resources::service_account::DeleteRequest {
        id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(),
    })
    .await;
```

### List Service Accounts <a name="list"></a>

**API Endpoint**: `GET /service_account`

#### 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.service_account().list().await;
```

#### Response

##### Type

Vec of [User](/src/models/user.rs)

##### Example

```rust
vec![User {avatar_url: "http://www.example.com".to_string(), created_at: "1970-01-01T00:00:00".to_string(), email: "mail@example.com".to_string(), expiration: Some("1970-01-01T00:00:00".to_string()), first_name: "string".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), is_service_account: true, last_name: "string".to_string()}]
```

### Get Service Account <a name="get"></a>

**API Endpoint**: `GET /service_account/{id}`

#### Parameters

| Parameter | Required | Description        | Example                                              |
| --------- | :------: | ------------------ | ---------------------------------------------------- |
| `id`      || service account 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
    .service_account()
    .get(sideko_rest_api::resources::service_account::GetRequest {
        id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(),
    })
    .await;
```

#### Response

##### Type

[User](/src/models/user.rs)

##### Example

```rust
User {avatar_url: "http://www.example.com".to_string(), created_at: "1970-01-01T00:00:00".to_string(), email: "mail@example.com".to_string(), expiration: Some("1970-01-01T00:00:00".to_string()), first_name: "string".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), is_service_account: true, last_name: "string".to_string()}
```

### Create Service Account <a name="create"></a>

Create a new service account with a set of project permissions

**API Endpoint**: `POST /service_account`

#### Parameters

| Parameter      | Required | Description                                                                                                                               | Example                                                                                                                                                                                |
| -------------- | :------: | ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`         ||                                                                                                                                           | `"Documentation Publisher Service Account".to_string()`                                                                                                                                |
| `object_roles` ||                                                                                                                                           | `vec![ObjectRole {object_id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), object_type: ObjectTypeEnum::ApiProject, role_definition_id: RoleDefinitionIdEnum::ApiProjectAdmin}]` |
| `expiration`   || UTC datetime when the service account key should expire (ISO 8601 format without timezone), key never expires expiration is not specified | `"2025-01-01T00:00:00".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
    .service_account()
    .create(sideko_rest_api::resources::service_account::CreateRequest {
        expiration: Some("2025-01-01T00:00:00".to_string()),
        name: "Documentation Publisher Service Account".to_string(),
        object_roles: vec![
            sideko_rest_api::models::ObjectRole { object_id :
            "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), object_type :
            sideko_rest_api::models::ObjectTypeEnum::ApiProject, role_definition_id :
            sideko_rest_api::models::RoleDefinitionIdEnum::ApiProjectAdmin }
        ],
    })
    .await;
```

#### Response

##### Type

[UserApiKey](/src/models/user_api_key.rs)

##### Example

```rust
UserApiKey {avatar_url: "http://www.example.com".to_string(), created_at: "1970-01-01T00:00:00".to_string(), email: "mail@example.com".to_string(), expiration: Some("1970-01-01T00:00:00".to_string()), first_name: "string".to_string(), id: "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a".to_string(), is_service_account: true, last_name: "string".to_string(), api_key: "sideko_live_abc123".to_string()}
```