trieve_client/models/
set_user_api_key_request.rs

1/*
2 * Trieve API
3 *
4 * Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5 *
6 * The version of the OpenAPI document: 0.11.7
7 * Contact: developers@trieve.ai
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
14pub struct SetUserApiKeyRequest {
15    /// The dataset ids which the api key will have access to. If not provided or empty, the api key will have access to all datasets the auth'ed user has access to. If both dataset_ids and organization_ids are provided, the api key will have access to the intersection of the datasets and organizations.
16    #[serde(rename = "dataset_ids", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
17    pub dataset_ids: Option<Option<Vec<uuid::Uuid>>>,
18    /// The name which will be assigned to the new api key.
19    #[serde(rename = "name")]
20    pub name: String,
21    /// The organization ids which the api key will have access to. If not provided or empty, the api key will have access to all organizations the auth'ed user has access to.
22    #[serde(rename = "organization_ids", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
23    pub organization_ids: Option<Option<Vec<uuid::Uuid>>>,
24    /// The role which will be assigned to the new api key. Either 0 (read), 1 (read and write at the level of the currently auth'ed user). The auth'ed user must have a role greater than or equal to the role being assigned which means they must be an admin (1) or owner (2) of the organization to assign write permissions with a role of 1.
25    #[serde(rename = "role")]
26    pub role: i32,
27    /// The routes which the api key will have access to. If not provided or empty, the api key will have access to all routes the auth'ed user has access to. Specify the routes as a list of strings. For example, [\"GET /api/dataset\", \"POST /api/dataset\"].
28    #[serde(rename = "scopes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub scopes: Option<Option<Vec<String>>>,
30}
31
32impl SetUserApiKeyRequest {
33    pub fn new(name: String, role: i32) -> SetUserApiKeyRequest {
34        SetUserApiKeyRequest {
35            dataset_ids: None,
36            name,
37            organization_ids: None,
38            role,
39            scopes: None,
40        }
41    }
42}
43