Skip to main content

quicknode_sdk/admin/
teams.rs

1#[cfg(feature = "rust")]
2use bon::Builder;
3#[cfg(feature = "node")]
4use napi_derive::napi;
5#[cfg(feature = "python")]
6use pyo3::pyclass;
7#[cfg(feature = "python")]
8use pyo3_stub_gen::derive::gen_stub_pyclass;
9use serde::{Deserialize, Serialize};
10
11/// A team member or pending invitee.
12#[cfg_attr(feature = "python", gen_stub_pyclass)]
13#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
14#[cfg_attr(feature = "node", napi(object))]
15#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct TeamUser {
17    /// User identifier.
18    pub id: i64,
19    /// Display name.
20    pub full_name: Option<String>,
21    /// Email address.
22    pub email: String,
23    /// Team role (e.g. `admin`, `viewer`, `billing`).
24    pub role: Option<String>,
25    /// Membership status (e.g. `active`, `pending`).
26    pub status: Option<String>,
27    /// When the user was added.
28    pub created_at: Option<String>,
29    /// Profile photo URL.
30    pub photo_url: Option<String>,
31    /// Whether this user is the primary user on the account.
32    pub account_primary_user: Option<bool>,
33}
34
35/// Summary representation of a team in list responses.
36#[cfg_attr(feature = "python", gen_stub_pyclass)]
37#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
38#[cfg_attr(feature = "node", napi(object))]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct TeamSummary {
41    /// Team identifier.
42    pub id: i64,
43    /// Team name.
44    pub name: String,
45    /// Current member count.
46    pub members_count: Option<i64>,
47    /// Active team members.
48    #[serde(default)]
49    pub users: Vec<TeamUser>,
50}
51
52/// Full team detail including pending invites.
53#[cfg_attr(feature = "python", gen_stub_pyclass)]
54#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
55#[cfg_attr(feature = "node", napi(object))]
56#[derive(Debug, Clone, Serialize, Deserialize)]
57pub struct TeamDetail {
58    /// Team identifier.
59    pub id: i64,
60    /// Team name.
61    pub name: String,
62    /// Default role assigned to newly invited members.
63    pub default_role: Option<String>,
64    /// Current member count.
65    pub members_count: Option<i64>,
66    /// Active team members.
67    #[serde(default)]
68    pub users: Vec<TeamUser>,
69    /// Invites that have not yet been accepted.
70    #[serde(default)]
71    pub pending_invites: Vec<TeamUser>,
72}
73
74/// Response from `list_teams`.
75#[cfg_attr(feature = "python", gen_stub_pyclass)]
76#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
77#[cfg_attr(feature = "node", napi(object))]
78#[derive(Debug, Clone, Serialize, Deserialize)]
79pub struct ListTeamsResponse {
80    /// Teams on the account.
81    #[serde(default)]
82    pub data: Vec<TeamSummary>,
83    /// Error message when the request did not succeed.
84    pub error: Option<String>,
85}
86
87/// Parameters for `create_team`.
88#[cfg_attr(feature = "python", gen_stub_pyclass)]
89#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
90#[cfg_attr(feature = "node", napi(object))]
91#[cfg_attr(feature = "rust", derive(Builder))]
92#[derive(Debug, Clone, Default, Serialize)]
93pub struct CreateTeamRequest {
94    /// Team name.
95    pub name: String,
96}
97
98/// Inner data for `create_team` responses.
99#[cfg_attr(feature = "python", gen_stub_pyclass)]
100#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
101#[cfg_attr(feature = "node", napi(object))]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103pub struct CreateTeamData {
104    /// Team identifier.
105    pub id: i64,
106    /// Team name.
107    pub name: String,
108    /// Default role for newly invited members.
109    pub default_role: Option<String>,
110    /// Initial member count.
111    pub members_count: Option<i64>,
112}
113
114/// Response from `create_team`.
115#[cfg_attr(feature = "python", gen_stub_pyclass)]
116#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
117#[cfg_attr(feature = "node", napi(object))]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119pub struct CreateTeamResponse {
120    /// The newly created team.
121    pub data: Option<CreateTeamData>,
122    /// Error message when the request did not succeed.
123    pub error: Option<String>,
124}
125
126/// Response from `get_team`.
127#[cfg_attr(feature = "python", gen_stub_pyclass)]
128#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
129#[cfg_attr(feature = "node", napi(object))]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131pub struct GetTeamResponse {
132    /// The team's full detail.
133    pub data: Option<TeamDetail>,
134    /// Error message when the request did not succeed.
135    pub error: Option<String>,
136}
137
138/// Inner data for `delete_team` responses.
139#[cfg_attr(feature = "python", gen_stub_pyclass)]
140#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
141#[cfg_attr(feature = "node", napi(object))]
142#[derive(Debug, Clone, Serialize, Deserialize)]
143pub struct DeleteTeamData {
144    /// Human-readable confirmation message.
145    pub message: Option<String>,
146}
147
148/// Response from `delete_team`.
149#[cfg_attr(feature = "python", gen_stub_pyclass)]
150#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
151#[cfg_attr(feature = "node", napi(object))]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153pub struct DeleteTeamResponse {
154    /// Deletion result payload.
155    pub data: Option<DeleteTeamData>,
156    /// Error message when the request did not succeed.
157    pub error: Option<String>,
158}
159
160/// A team's endpoint association.
161#[cfg_attr(feature = "python", gen_stub_pyclass)]
162#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
163#[cfg_attr(feature = "node", napi(object))]
164#[derive(Debug, Clone, Serialize, Deserialize)]
165pub struct TeamEndpoint {
166    /// Endpoint identifier.
167    pub id: i64,
168    /// Endpoint subdomain.
169    pub subdomain: String,
170    /// Blockchain the endpoint serves.
171    pub chain: Option<String>,
172    /// Network within the chain.
173    pub network: Option<String>,
174}
175
176/// Response from `list_team_endpoints`.
177#[cfg_attr(feature = "python", gen_stub_pyclass)]
178#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
179#[cfg_attr(feature = "node", napi(object))]
180#[derive(Debug, Clone, Serialize, Deserialize)]
181pub struct ListTeamEndpointsResponse {
182    /// Endpoints accessible to the team.
183    #[serde(default)]
184    pub data: Vec<TeamEndpoint>,
185    /// Error message when the request did not succeed.
186    pub error: Option<String>,
187}
188
189/// Parameters for `update_team_endpoints`.
190#[cfg_attr(feature = "python", gen_stub_pyclass)]
191#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
192#[cfg_attr(feature = "node", napi(object))]
193#[cfg_attr(feature = "rust", derive(Builder))]
194#[derive(Debug, Clone, Default, Serialize)]
195pub struct UpdateTeamEndpointsRequest {
196    /// Endpoint ids to associate with the team; pass an empty array to remove all.
197    pub endpoint_ids: Vec<String>,
198}
199
200/// Inner data for `update_team_endpoints` responses.
201#[cfg_attr(feature = "python", gen_stub_pyclass)]
202#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
203#[cfg_attr(feature = "node", napi(object))]
204#[derive(Debug, Clone, Serialize, Deserialize)]
205pub struct UpdateTeamEndpointsData {
206    /// `true` when the association update succeeded.
207    pub success: Option<bool>,
208}
209
210/// Response from `update_team_endpoints`.
211#[cfg_attr(feature = "python", gen_stub_pyclass)]
212#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
213#[cfg_attr(feature = "node", napi(object))]
214#[derive(Debug, Clone, Serialize, Deserialize)]
215pub struct UpdateTeamEndpointsResponse {
216    /// Update result.
217    pub data: Option<UpdateTeamEndpointsData>,
218    /// Error message when the request did not succeed.
219    pub error: Option<String>,
220}
221
222/// Parameters for `invite_team_member`.
223#[cfg_attr(feature = "python", gen_stub_pyclass)]
224#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
225#[cfg_attr(feature = "node", napi(object))]
226#[cfg_attr(feature = "rust", derive(Builder))]
227#[derive(Debug, Clone, Default, Serialize)]
228pub struct InviteTeamMemberRequest {
229    /// Email address to invite.
230    pub email: String,
231    /// Full name (required for new users).
232    #[serde(skip_serializing_if = "Option::is_none")]
233    pub full_name: Option<String>,
234    /// Team role (`admin`, `viewer`, or `billing`); required for new users.
235    #[serde(skip_serializing_if = "Option::is_none")]
236    pub role: Option<String>,
237}
238
239/// Response from `invite_team_member`.
240#[cfg_attr(feature = "python", gen_stub_pyclass)]
241#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
242#[cfg_attr(feature = "node", napi(object))]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244pub struct InviteTeamMemberResponse {
245    /// The invited user and their invitation status.
246    pub data: Option<TeamUser>,
247    /// Error message when the request did not succeed.
248    pub error: Option<String>,
249}
250
251/// Parameters for `remove_team_member`.
252#[cfg_attr(feature = "python", gen_stub_pyclass)]
253#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
254#[cfg_attr(feature = "node", napi(object))]
255#[cfg_attr(feature = "rust", derive(Builder))]
256#[derive(Debug, Clone, Default, Serialize)]
257pub struct RemoveTeamMemberRequest {
258    /// When true, also delete the user entirely rather than just removing them from the team.
259    #[serde(skip_serializing_if = "Option::is_none")]
260    pub destroy_user: Option<bool>,
261}
262
263/// Shared message-shaped data wrapper for team operations.
264#[cfg_attr(feature = "python", gen_stub_pyclass)]
265#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
266#[cfg_attr(feature = "node", napi(object))]
267#[derive(Debug, Clone, Serialize, Deserialize)]
268pub struct TeamMessageData {
269    /// Human-readable confirmation message.
270    pub message: Option<String>,
271}
272
273/// Response from `remove_team_member`.
274#[cfg_attr(feature = "python", gen_stub_pyclass)]
275#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
276#[cfg_attr(feature = "node", napi(object))]
277#[derive(Debug, Clone, Serialize, Deserialize)]
278pub struct RemoveTeamMemberResponse {
279    /// Operation result message.
280    pub data: Option<TeamMessageData>,
281    /// Error message when the request did not succeed.
282    pub error: Option<String>,
283}
284
285/// Response from `resend_team_invite`.
286#[cfg_attr(feature = "python", gen_stub_pyclass)]
287#[cfg_attr(feature = "python", pyclass(get_all, set_all))]
288#[cfg_attr(feature = "node", napi(object))]
289#[derive(Debug, Clone, Serialize, Deserialize)]
290pub struct ResendTeamInviteResponse {
291    /// Operation result message.
292    pub data: Option<TeamMessageData>,
293    /// Error message when the request did not succeed.
294    pub error: Option<String>,
295}