async_openai/types/admin/
roles.rs1use crate::types::OpenAIError;
2use derive_builder::Builder;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
7#[serde(rename_all = "lowercase")]
8pub enum ListRolesOrder {
9 Asc,
11 Desc,
13}
14
15#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
17#[builder(name = "ListRolesQueryArgs")]
18#[builder(pattern = "mutable")]
19#[builder(setter(into, strip_option), default)]
20#[builder(derive(Debug))]
21#[builder(build_fn(error = "OpenAIError"))]
22pub struct ListRolesQuery {
23 #[serde(skip_serializing_if = "Option::is_none")]
25 pub limit: Option<u32>,
26 #[serde(skip_serializing_if = "Option::is_none")]
28 pub after: Option<String>,
29 #[serde(skip_serializing_if = "Option::is_none")]
31 pub order: Option<ListRolesOrder>,
32}
33
34#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
36pub struct Role {
37 pub object: String,
39 pub id: String,
41 pub name: String,
43 pub description: Option<String>,
45 pub permissions: Vec<String>,
47 pub resource_type: String,
49 pub predefined_role: bool,
51}
52
53#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
55pub struct PublicRoleListResource {
56 pub object: String,
58 pub data: Vec<Role>,
60 pub has_more: bool,
62 pub next: Option<String>,
64}
65
66#[derive(Debug, Serialize, Deserialize, Builder, Clone, PartialEq)]
68#[builder(name = "CreateOrganizationRoleRequestArgs")]
69#[builder(pattern = "mutable")]
70#[builder(setter(into, strip_option))]
71#[builder(derive(Debug))]
72#[builder(build_fn(error = "OpenAIError"))]
73pub struct PublicCreateOrganizationRoleBody {
74 pub role_name: String,
76 pub permissions: Vec<String>,
78 #[serde(skip_serializing_if = "Option::is_none")]
80 pub description: Option<String>,
81}
82
83#[derive(Debug, Serialize, Deserialize, Builder, Clone, PartialEq)]
85#[builder(name = "UpdateOrganizationRoleRequestArgs")]
86#[builder(pattern = "mutable")]
87#[builder(setter(into, strip_option))]
88#[builder(derive(Debug))]
89#[builder(build_fn(error = "OpenAIError"))]
90pub struct PublicUpdateOrganizationRoleBody {
91 #[serde(skip_serializing_if = "Option::is_none")]
93 pub permissions: Option<Vec<String>>,
94 #[serde(skip_serializing_if = "Option::is_none")]
96 pub description: Option<String>,
97 #[serde(skip_serializing_if = "Option::is_none")]
99 pub role_name: Option<String>,
100}
101
102#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
104pub struct RoleDeletedResource {
105 pub object: String,
107 pub id: String,
109 pub deleted: bool,
111}
112
113#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
115pub struct AssignedRoleDetails {
116 pub id: String,
118 pub name: String,
120 pub permissions: Vec<String>,
122 pub resource_type: String,
124 pub predefined_role: bool,
126 pub description: Option<String>,
128 pub created_at: Option<u64>,
130 pub updated_at: Option<u64>,
132 pub created_by: Option<String>,
134 #[serde(skip_serializing_if = "Option::is_none")]
136 pub created_by_user_obj: Option<serde_json::Value>,
137 #[serde(skip_serializing_if = "Option::is_none")]
139 pub metadata: Option<serde_json::Value>,
140}
141
142#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
144pub struct RoleListResource {
145 pub object: String,
147 pub data: Vec<AssignedRoleDetails>,
149 pub has_more: bool,
151 pub next: Option<String>,
153}
154
155#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
157pub struct DeletedRoleAssignmentResource {
158 pub object: String,
160 pub deleted: bool,
162}