fireblocks_sdk/apis/
workspace_management_api.rs

1// Fireblocks API
2//
3// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.  - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
4//
5// The version of the OpenAPI document: 1.8.0
6// Contact: developers@fireblocks.com
7// Generated by: https://openapi-generator.tech
8
9use {
10    super::{configuration, Error},
11    crate::{apis::ResponseContent, models},
12    async_trait::async_trait,
13    reqwest,
14    serde::{Deserialize, Serialize},
15    std::sync::Arc,
16};
17
18#[async_trait]
19pub trait WorkspaceManagementApi: Send + Sync {
20    async fn create_api_user(
21        &self,
22        params: CreateApiUserParams,
23    ) -> Result<(), Error<CreateApiUserError>>;
24    async fn create_console_user(
25        &self,
26        params: CreateConsoleUserParams,
27    ) -> Result<(), Error<CreateConsoleUserError>>;
28    async fn create_user_group(
29        &self,
30        params: CreateUserGroupParams,
31    ) -> Result<models::CreateUserGroupResponse, Error<CreateUserGroupError>>;
32    async fn delete_user_group(
33        &self,
34        params: DeleteUserGroupParams,
35    ) -> Result<(), Error<DeleteUserGroupError>>;
36    async fn get_api_users(&self) -> Result<models::GetApiUsersResponse, Error<GetApiUsersError>>;
37    async fn get_audit_logs(
38        &self,
39        params: GetAuditLogsParams,
40    ) -> Result<models::GetAuditLogsResponse, Error<GetAuditLogsError>>;
41    async fn get_audits(
42        &self,
43        params: GetAuditsParams,
44    ) -> Result<models::GetAuditLogsResponseDto, Error<GetAuditsError>>;
45    async fn get_console_users(
46        &self,
47    ) -> Result<models::GetConsoleUsersResponse, Error<GetConsoleUsersError>>;
48    async fn get_ota_status(
49        &self,
50    ) -> Result<models::GetOtaStatusResponse, Error<GetOtaStatusError>>;
51    async fn get_user_group(
52        &self,
53        params: GetUserGroupParams,
54    ) -> Result<models::UserGroupResponse, Error<GetUserGroupError>>;
55    async fn get_user_groups(
56        &self,
57    ) -> Result<Vec<models::UserGroupResponse>, Error<GetUserGroupsError>>;
58    async fn get_users(&self) -> Result<Vec<models::UserResponse>, Error<GetUsersError>>;
59    async fn get_whitelist_ip_addresses(
60        &self,
61        params: GetWhitelistIpAddressesParams,
62    ) -> Result<models::GetWhitelistIpAddressesResponse, Error<GetWhitelistIpAddressesError>>;
63    async fn get_workspace_status(
64        &self,
65    ) -> Result<models::GetWorkspaceStatusResponse, Error<GetWorkspaceStatusError>>;
66    async fn reset_device(&self, params: ResetDeviceParams) -> Result<(), Error<ResetDeviceError>>;
67    async fn set_ota_status(
68        &self,
69        params: SetOtaStatusParams,
70    ) -> Result<models::SetOtaStatusResponse, Error<SetOtaStatusError>>;
71    async fn update_user_group(
72        &self,
73        params: UpdateUserGroupParams,
74    ) -> Result<models::UserGroupCreateResponse, Error<UpdateUserGroupError>>;
75}
76
77pub struct WorkspaceManagementApiClient {
78    configuration: Arc<configuration::Configuration>,
79}
80
81impl WorkspaceManagementApiClient {
82    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
83        Self { configuration }
84    }
85}
86
87/// struct for passing parameters to the method [`create_api_user`]
88#[derive(Clone, Debug)]
89#[cfg_attr(feature = "bon", derive(::bon::Builder))]
90pub struct CreateApiUserParams {
91    /// A unique identifier for the request. If the request is sent multiple
92    /// times with the same idempotency key, the server will return the same
93    /// response as the first request. The idempotency key is valid for 24
94    /// hours.
95    pub idempotency_key: Option<String>,
96    pub create_api_user: Option<models::CreateApiUser>,
97}
98
99/// struct for passing parameters to the method [`create_console_user`]
100#[derive(Clone, Debug)]
101#[cfg_attr(feature = "bon", derive(::bon::Builder))]
102pub struct CreateConsoleUserParams {
103    /// A unique identifier for the request. If the request is sent multiple
104    /// times with the same idempotency key, the server will return the same
105    /// response as the first request. The idempotency key is valid for 24
106    /// hours.
107    pub idempotency_key: Option<String>,
108    pub create_console_user: Option<models::CreateConsoleUser>,
109}
110
111/// struct for passing parameters to the method [`create_user_group`]
112#[derive(Clone, Debug)]
113#[cfg_attr(feature = "bon", derive(::bon::Builder))]
114pub struct CreateUserGroupParams {
115    pub user_group_create_request: models::UserGroupCreateRequest,
116    /// A unique identifier for the request. If the request is sent multiple
117    /// times with the same idempotency key, the server will return the same
118    /// response as the first request. The idempotency key is valid for 24
119    /// hours.
120    pub idempotency_key: Option<String>,
121}
122
123/// struct for passing parameters to the method [`delete_user_group`]
124#[derive(Clone, Debug)]
125#[cfg_attr(feature = "bon", derive(::bon::Builder))]
126pub struct DeleteUserGroupParams {
127    /// The ID of the user group
128    pub group_id: String,
129}
130
131/// struct for passing parameters to the method [`get_audit_logs`]
132#[derive(Clone, Debug)]
133#[cfg_attr(feature = "bon", derive(::bon::Builder))]
134pub struct GetAuditLogsParams {
135    /// The last time period to fetch audit logs
136    pub time_period: Option<String>,
137    /// The next id to start fetch audit logs from
138    pub cursor: Option<String>,
139}
140
141/// struct for passing parameters to the method [`get_audits`]
142#[derive(Clone, Debug)]
143#[cfg_attr(feature = "bon", derive(::bon::Builder))]
144pub struct GetAuditsParams {
145    /// The last time period to fetch audit logs
146    pub time_period: Option<String>,
147}
148
149/// struct for passing parameters to the method [`get_user_group`]
150#[derive(Clone, Debug)]
151#[cfg_attr(feature = "bon", derive(::bon::Builder))]
152pub struct GetUserGroupParams {
153    /// The ID of the user group
154    pub group_id: String,
155}
156
157/// struct for passing parameters to the method [`get_whitelist_ip_addresses`]
158#[derive(Clone, Debug)]
159#[cfg_attr(feature = "bon", derive(::bon::Builder))]
160pub struct GetWhitelistIpAddressesParams {
161    /// The ID of the api user
162    pub user_id: String,
163}
164
165/// struct for passing parameters to the method [`reset_device`]
166#[derive(Clone, Debug)]
167#[cfg_attr(feature = "bon", derive(::bon::Builder))]
168pub struct ResetDeviceParams {
169    /// The ID of the console user
170    pub id: String,
171    /// A unique identifier for the request. If the request is sent multiple
172    /// times with the same idempotency key, the server will return the same
173    /// response as the first request. The idempotency key is valid for 24
174    /// hours.
175    pub idempotency_key: Option<String>,
176}
177
178/// struct for passing parameters to the method [`set_ota_status`]
179#[derive(Clone, Debug)]
180#[cfg_attr(feature = "bon", derive(::bon::Builder))]
181pub struct SetOtaStatusParams {
182    pub set_ota_status_request: models::SetOtaStatusRequest,
183    /// A unique identifier for the request. If the request is sent multiple
184    /// times with the same idempotency key, the server will return the same
185    /// response as the first request. The idempotency key is valid for 24
186    /// hours.
187    pub idempotency_key: Option<String>,
188}
189
190/// struct for passing parameters to the method [`update_user_group`]
191#[derive(Clone, Debug)]
192#[cfg_attr(feature = "bon", derive(::bon::Builder))]
193pub struct UpdateUserGroupParams {
194    /// The ID of the user group
195    pub group_id: String,
196    pub user_group_update_request: models::UserGroupUpdateRequest,
197    /// A unique identifier for the request. If the request is sent multiple
198    /// times with the same idempotency key, the server will return the same
199    /// response as the first request. The idempotency key is valid for 24
200    /// hours.
201    pub idempotency_key: Option<String>,
202}
203
204#[async_trait]
205impl WorkspaceManagementApi for WorkspaceManagementApiClient {
206    /// Create a new API key in your workspace. Learn more about Fireblocks API Keys management in the following [guide](https://developers.fireblocks.com/docs/manage-api-keys). </br>Endpoint Permission: Admin, Non-Signing Admin.
207    async fn create_api_user(
208        &self,
209        params: CreateApiUserParams,
210    ) -> Result<(), Error<CreateApiUserError>> {
211        let CreateApiUserParams {
212            idempotency_key,
213            create_api_user,
214        } = params;
215
216        let local_var_configuration = &self.configuration;
217
218        let local_var_client = &local_var_configuration.client;
219
220        let local_var_uri_str =
221            format!("{}/management/api_users", local_var_configuration.base_path);
222        let mut local_var_req_builder =
223            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
224
225        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
226            local_var_req_builder = local_var_req_builder
227                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
228        }
229        if let Some(local_var_param_value) = idempotency_key {
230            local_var_req_builder =
231                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
232        }
233        local_var_req_builder = local_var_req_builder.json(&create_api_user);
234
235        let local_var_req = local_var_req_builder.build()?;
236        let local_var_resp = local_var_client.execute(local_var_req).await?;
237
238        let local_var_status = local_var_resp.status();
239        let local_var_content = local_var_resp.text().await?;
240
241        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
242            Ok(())
243        } else {
244            let local_var_entity: Option<CreateApiUserError> =
245                serde_json::from_str(&local_var_content).ok();
246            let local_var_error = ResponseContent {
247                status: local_var_status,
248                content: local_var_content,
249                entity: local_var_entity,
250            };
251            Err(Error::ResponseError(local_var_error))
252        }
253    }
254
255    /// Create console users in your workspace - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Learn more about Fireblocks Users management in the following [guide](https://developers.fireblocks.com/docs/manage-users). </br>Endpoint Permission: Admin, Non-Signing Admin.
256    async fn create_console_user(
257        &self,
258        params: CreateConsoleUserParams,
259    ) -> Result<(), Error<CreateConsoleUserError>> {
260        let CreateConsoleUserParams {
261            idempotency_key,
262            create_console_user,
263        } = params;
264
265        let local_var_configuration = &self.configuration;
266
267        let local_var_client = &local_var_configuration.client;
268
269        let local_var_uri_str = format!("{}/management/users", local_var_configuration.base_path);
270        let mut local_var_req_builder =
271            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
272
273        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
274            local_var_req_builder = local_var_req_builder
275                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
276        }
277        if let Some(local_var_param_value) = idempotency_key {
278            local_var_req_builder =
279                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
280        }
281        local_var_req_builder = local_var_req_builder.json(&create_console_user);
282
283        let local_var_req = local_var_req_builder.build()?;
284        let local_var_resp = local_var_client.execute(local_var_req).await?;
285
286        let local_var_status = local_var_resp.status();
287        let local_var_content = local_var_resp.text().await?;
288
289        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
290            Ok(())
291        } else {
292            let local_var_entity: Option<CreateConsoleUserError> =
293                serde_json::from_str(&local_var_content).ok();
294            let local_var_error = ResponseContent {
295                status: local_var_status,
296                content: local_var_content,
297                entity: local_var_entity,
298            };
299            Err(Error::ResponseError(local_var_error))
300        }
301    }
302
303    /// Create a new user group.  - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. Learn more about Fireblocks Users management in the following [guide](https://developers.fireblocks.com/docs/manage-users). </br>Endpoint Permission: Admin, Non-Signing Admin.
304    async fn create_user_group(
305        &self,
306        params: CreateUserGroupParams,
307    ) -> Result<models::CreateUserGroupResponse, Error<CreateUserGroupError>> {
308        let CreateUserGroupParams {
309            user_group_create_request,
310            idempotency_key,
311        } = params;
312
313        let local_var_configuration = &self.configuration;
314
315        let local_var_client = &local_var_configuration.client;
316
317        let local_var_uri_str = format!(
318            "{}/management/user_groups",
319            local_var_configuration.base_path
320        );
321        let mut local_var_req_builder =
322            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
323
324        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
325            local_var_req_builder = local_var_req_builder
326                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
327        }
328        if let Some(local_var_param_value) = idempotency_key {
329            local_var_req_builder =
330                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
331        }
332        local_var_req_builder = local_var_req_builder.json(&user_group_create_request);
333
334        let local_var_req = local_var_req_builder.build()?;
335        let local_var_resp = local_var_client.execute(local_var_req).await?;
336
337        let local_var_status = local_var_resp.status();
338        let local_var_content = local_var_resp.text().await?;
339
340        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
341            serde_json::from_str(&local_var_content).map_err(Error::from)
342        } else {
343            let local_var_entity: Option<CreateUserGroupError> =
344                serde_json::from_str(&local_var_content).ok();
345            let local_var_error = ResponseContent {
346                status: local_var_status,
347                content: local_var_content,
348                entity: local_var_entity,
349            };
350            Err(Error::ResponseError(local_var_error))
351        }
352    }
353
354    /// Delete a user group by ID.</br> - Please note that this endpoint is
355    /// available only for API keys with Admin/Non Signing Admin permissions.
356    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
357    async fn delete_user_group(
358        &self,
359        params: DeleteUserGroupParams,
360    ) -> Result<(), Error<DeleteUserGroupError>> {
361        let DeleteUserGroupParams { group_id } = params;
362
363        let local_var_configuration = &self.configuration;
364
365        let local_var_client = &local_var_configuration.client;
366
367        let local_var_uri_str = format!(
368            "{}/management/user_groups/{groupId}",
369            local_var_configuration.base_path,
370            groupId = crate::apis::urlencode(group_id)
371        );
372        let mut local_var_req_builder =
373            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
374
375        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
376            local_var_req_builder = local_var_req_builder
377                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
378        }
379
380        let local_var_req = local_var_req_builder.build()?;
381        let local_var_resp = local_var_client.execute(local_var_req).await?;
382
383        let local_var_status = local_var_resp.status();
384        let local_var_content = local_var_resp.text().await?;
385
386        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
387            Ok(())
388        } else {
389            let local_var_entity: Option<DeleteUserGroupError> =
390                serde_json::from_str(&local_var_content).ok();
391            let local_var_error = ResponseContent {
392                status: local_var_status,
393                content: local_var_content,
394                entity: local_var_entity,
395            };
396            Err(Error::ResponseError(local_var_error))
397        }
398    }
399
400    /// List all API keys in your workspace. - Please note that this endpoint is
401    /// available only for API keys with Admin/Non Signing Admin permissions.
402    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
403    async fn get_api_users(&self) -> Result<models::GetApiUsersResponse, Error<GetApiUsersError>> {
404        let local_var_configuration = &self.configuration;
405
406        let local_var_client = &local_var_configuration.client;
407
408        let local_var_uri_str =
409            format!("{}/management/api_users", local_var_configuration.base_path);
410        let mut local_var_req_builder =
411            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
412
413        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
414            local_var_req_builder = local_var_req_builder
415                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
416        }
417
418        let local_var_req = local_var_req_builder.build()?;
419        let local_var_resp = local_var_client.execute(local_var_req).await?;
420
421        let local_var_status = local_var_resp.status();
422        let local_var_content = local_var_resp.text().await?;
423
424        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
425            serde_json::from_str(&local_var_content).map_err(Error::from)
426        } else {
427            let local_var_entity: Option<GetApiUsersError> =
428                serde_json::from_str(&local_var_content).ok();
429            let local_var_error = ResponseContent {
430                status: local_var_status,
431                content: local_var_content,
432                entity: local_var_entity,
433            };
434            Err(Error::ResponseError(local_var_error))
435        }
436    }
437
438    /// Get Audit logs for the last Day/Week.  - Please note that this endpoint
439    /// is available only for API keys with Admin/Non Signing Admin permissions.
440    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
441    async fn get_audit_logs(
442        &self,
443        params: GetAuditLogsParams,
444    ) -> Result<models::GetAuditLogsResponse, Error<GetAuditLogsError>> {
445        let GetAuditLogsParams {
446            time_period,
447            cursor,
448        } = params;
449
450        let local_var_configuration = &self.configuration;
451
452        let local_var_client = &local_var_configuration.client;
453
454        let local_var_uri_str = format!(
455            "{}/management/audit_logs",
456            local_var_configuration.base_path
457        );
458        let mut local_var_req_builder =
459            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
460
461        if let Some(ref local_var_str) = time_period {
462            local_var_req_builder =
463                local_var_req_builder.query(&[("timePeriod", &local_var_str.to_string())]);
464        }
465        if let Some(ref local_var_str) = cursor {
466            local_var_req_builder =
467                local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
468        }
469        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
470            local_var_req_builder = local_var_req_builder
471                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
472        }
473
474        let local_var_req = local_var_req_builder.build()?;
475        let local_var_resp = local_var_client.execute(local_var_req).await?;
476
477        let local_var_status = local_var_resp.status();
478        let local_var_content = local_var_resp.text().await?;
479
480        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
481            serde_json::from_str(&local_var_content).map_err(Error::from)
482        } else {
483            let local_var_entity: Option<GetAuditLogsError> =
484                serde_json::from_str(&local_var_content).ok();
485            let local_var_error = ResponseContent {
486                status: local_var_status,
487                content: local_var_content,
488                entity: local_var_entity,
489            };
490            Err(Error::ResponseError(local_var_error))
491        }
492    }
493
494    /// Deprecated. Please use the `GET /management/audit_logs` endpoint
495    /// instead. </br>Endpoint Permission: Admin, Non-Signing Admin.
496    async fn get_audits(
497        &self,
498        params: GetAuditsParams,
499    ) -> Result<models::GetAuditLogsResponseDto, Error<GetAuditsError>> {
500        let GetAuditsParams { time_period } = params;
501
502        let local_var_configuration = &self.configuration;
503
504        let local_var_client = &local_var_configuration.client;
505
506        let local_var_uri_str = format!("{}/audits", local_var_configuration.base_path);
507        let mut local_var_req_builder =
508            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
509
510        if let Some(ref local_var_str) = time_period {
511            local_var_req_builder =
512                local_var_req_builder.query(&[("timePeriod", &local_var_str.to_string())]);
513        }
514        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
515            local_var_req_builder = local_var_req_builder
516                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
517        }
518
519        let local_var_req = local_var_req_builder.build()?;
520        let local_var_resp = local_var_client.execute(local_var_req).await?;
521
522        let local_var_status = local_var_resp.status();
523        let local_var_content = local_var_resp.text().await?;
524
525        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
526            serde_json::from_str(&local_var_content).map_err(Error::from)
527        } else {
528            let local_var_entity: Option<GetAuditsError> =
529                serde_json::from_str(&local_var_content).ok();
530            let local_var_error = ResponseContent {
531                status: local_var_status,
532                content: local_var_content,
533                entity: local_var_entity,
534            };
535            Err(Error::ResponseError(local_var_error))
536        }
537    }
538
539    /// Get console users for your workspace. - Please note that this endpoint
540    /// is available only for API keys with Admin/Non Signing Admin permissions.
541    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
542    async fn get_console_users(
543        &self,
544    ) -> Result<models::GetConsoleUsersResponse, Error<GetConsoleUsersError>> {
545        let local_var_configuration = &self.configuration;
546
547        let local_var_client = &local_var_configuration.client;
548
549        let local_var_uri_str = format!("{}/management/users", local_var_configuration.base_path);
550        let mut local_var_req_builder =
551            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
552
553        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
554            local_var_req_builder = local_var_req_builder
555                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
556        }
557
558        let local_var_req = local_var_req_builder.build()?;
559        let local_var_resp = local_var_client.execute(local_var_req).await?;
560
561        let local_var_status = local_var_resp.status();
562        let local_var_content = local_var_resp.text().await?;
563
564        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
565            serde_json::from_str(&local_var_content).map_err(Error::from)
566        } else {
567            let local_var_entity: Option<GetConsoleUsersError> =
568                serde_json::from_str(&local_var_content).ok();
569            let local_var_error = ResponseContent {
570                status: local_var_status,
571                content: local_var_content,
572                entity: local_var_entity,
573            };
574            Err(Error::ResponseError(local_var_error))
575        }
576    }
577
578    /// Returns current One Time Address status. Learn more about [One Time Addresses](https://support.fireblocks.io/hc/en-us/articles/4409104568338-One-Time-Address-OTA-feature) - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. </br>Endpoint Permission: Admin, Non-Signing Admin.
579    async fn get_ota_status(
580        &self,
581    ) -> Result<models::GetOtaStatusResponse, Error<GetOtaStatusError>> {
582        let local_var_configuration = &self.configuration;
583
584        let local_var_client = &local_var_configuration.client;
585
586        let local_var_uri_str = format!("{}/management/ota", local_var_configuration.base_path);
587        let mut local_var_req_builder =
588            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
589
590        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
591            local_var_req_builder = local_var_req_builder
592                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
593        }
594
595        let local_var_req = local_var_req_builder.build()?;
596        let local_var_resp = local_var_client.execute(local_var_req).await?;
597
598        let local_var_status = local_var_resp.status();
599        let local_var_content = local_var_resp.text().await?;
600
601        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
602            serde_json::from_str(&local_var_content).map_err(Error::from)
603        } else {
604            let local_var_entity: Option<GetOtaStatusError> =
605                serde_json::from_str(&local_var_content).ok();
606            let local_var_error = ResponseContent {
607                status: local_var_status,
608                content: local_var_content,
609                entity: local_var_entity,
610            };
611            Err(Error::ResponseError(local_var_error))
612        }
613    }
614
615    /// Get a user group by ID  - Please note that this endpoint is available
616    /// only for API keys with Admin/Non Signing Admin permissions.
617    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
618    async fn get_user_group(
619        &self,
620        params: GetUserGroupParams,
621    ) -> Result<models::UserGroupResponse, Error<GetUserGroupError>> {
622        let GetUserGroupParams { group_id } = params;
623
624        let local_var_configuration = &self.configuration;
625
626        let local_var_client = &local_var_configuration.client;
627
628        let local_var_uri_str = format!(
629            "{}/management/user_groups/{groupId}",
630            local_var_configuration.base_path,
631            groupId = crate::apis::urlencode(group_id)
632        );
633        let mut local_var_req_builder =
634            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
635
636        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
637            local_var_req_builder = local_var_req_builder
638                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
639        }
640
641        let local_var_req = local_var_req_builder.build()?;
642        let local_var_resp = local_var_client.execute(local_var_req).await?;
643
644        let local_var_status = local_var_resp.status();
645        let local_var_content = local_var_resp.text().await?;
646
647        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
648            serde_json::from_str(&local_var_content).map_err(Error::from)
649        } else {
650            let local_var_entity: Option<GetUserGroupError> =
651                serde_json::from_str(&local_var_content).ok();
652            let local_var_error = ResponseContent {
653                status: local_var_status,
654                content: local_var_content,
655                entity: local_var_entity,
656            };
657            Err(Error::ResponseError(local_var_error))
658        }
659    }
660
661    /// Get all user groups in your workspace  - Please note that this endpoint
662    /// is available only for API keys with Admin/Non Signing Admin permissions.
663    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
664    async fn get_user_groups(
665        &self,
666    ) -> Result<Vec<models::UserGroupResponse>, Error<GetUserGroupsError>> {
667        let local_var_configuration = &self.configuration;
668
669        let local_var_client = &local_var_configuration.client;
670
671        let local_var_uri_str = format!(
672            "{}/management/user_groups",
673            local_var_configuration.base_path
674        );
675        let mut local_var_req_builder =
676            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
677
678        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
679            local_var_req_builder = local_var_req_builder
680                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
681        }
682
683        let local_var_req = local_var_req_builder.build()?;
684        let local_var_resp = local_var_client.execute(local_var_req).await?;
685
686        let local_var_status = local_var_resp.status();
687        let local_var_content = local_var_resp.text().await?;
688
689        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
690            serde_json::from_str(&local_var_content).map_err(Error::from)
691        } else {
692            let local_var_entity: Option<GetUserGroupsError> =
693                serde_json::from_str(&local_var_content).ok();
694            let local_var_error = ResponseContent {
695                status: local_var_status,
696                content: local_var_content,
697                entity: local_var_entity,
698            };
699            Err(Error::ResponseError(local_var_error))
700        }
701    }
702
703    /// DEPRECATED - please use `GET /management/users` instead </br>Endpoint
704    /// Permission: Admin, Non-Signing Admin.
705    async fn get_users(&self) -> Result<Vec<models::UserResponse>, Error<GetUsersError>> {
706        let local_var_configuration = &self.configuration;
707
708        let local_var_client = &local_var_configuration.client;
709
710        let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
711        let mut local_var_req_builder =
712            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
713
714        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
715            local_var_req_builder = local_var_req_builder
716                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
717        }
718
719        let local_var_req = local_var_req_builder.build()?;
720        let local_var_resp = local_var_client.execute(local_var_req).await?;
721
722        let local_var_status = local_var_resp.status();
723        let local_var_content = local_var_resp.text().await?;
724
725        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
726            serde_json::from_str(&local_var_content).map_err(Error::from)
727        } else {
728            let local_var_entity: Option<GetUsersError> =
729                serde_json::from_str(&local_var_content).ok();
730            let local_var_error = ResponseContent {
731                status: local_var_status,
732                content: local_var_content,
733                entity: local_var_entity,
734            };
735            Err(Error::ResponseError(local_var_error))
736        }
737    }
738
739    /// Get a list of the whitelisted IP addresses for a specific API Key -
740    /// Please note that this endpoint is available only for API keys with
741    /// Admin/Non Signing Admin permissions. </br>Endpoint Permission: Admin,
742    /// Non-Signing Admin.
743    async fn get_whitelist_ip_addresses(
744        &self,
745        params: GetWhitelistIpAddressesParams,
746    ) -> Result<models::GetWhitelistIpAddressesResponse, Error<GetWhitelistIpAddressesError>> {
747        let GetWhitelistIpAddressesParams { user_id } = params;
748
749        let local_var_configuration = &self.configuration;
750
751        let local_var_client = &local_var_configuration.client;
752
753        let local_var_uri_str = format!(
754            "{}/management/api_users/{userId}/whitelist_ip_addresses",
755            local_var_configuration.base_path,
756            userId = crate::apis::urlencode(user_id)
757        );
758        let mut local_var_req_builder =
759            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
760
761        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
762            local_var_req_builder = local_var_req_builder
763                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
764        }
765
766        let local_var_req = local_var_req_builder.build()?;
767        let local_var_resp = local_var_client.execute(local_var_req).await?;
768
769        let local_var_status = local_var_resp.status();
770        let local_var_content = local_var_resp.text().await?;
771
772        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
773            serde_json::from_str(&local_var_content).map_err(Error::from)
774        } else {
775            let local_var_entity: Option<GetWhitelistIpAddressesError> =
776                serde_json::from_str(&local_var_content).ok();
777            let local_var_error = ResponseContent {
778                status: local_var_status,
779                content: local_var_content,
780                entity: local_var_entity,
781            };
782            Err(Error::ResponseError(local_var_error))
783        }
784    }
785
786    /// Returns current workspace status (Beta). **Note**: - This endpoint is
787    /// now in Beta, disabled for general availability at this time. - Please
788    /// note that this endpoint is available only for API keys with Admin/Non
789    /// Signing Admin permissions.  </br>Endpoint Permission: Admin, Non-Signing
790    /// Admin.
791    async fn get_workspace_status(
792        &self,
793    ) -> Result<models::GetWorkspaceStatusResponse, Error<GetWorkspaceStatusError>> {
794        let local_var_configuration = &self.configuration;
795
796        let local_var_client = &local_var_configuration.client;
797
798        let local_var_uri_str = format!(
799            "{}/management/workspace_status",
800            local_var_configuration.base_path
801        );
802        let mut local_var_req_builder =
803            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
804
805        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
806            local_var_req_builder = local_var_req_builder
807                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
808        }
809
810        let local_var_req = local_var_req_builder.build()?;
811        let local_var_resp = local_var_client.execute(local_var_req).await?;
812
813        let local_var_status = local_var_resp.status();
814        let local_var_content = local_var_resp.text().await?;
815
816        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
817            serde_json::from_str(&local_var_content).map_err(Error::from)
818        } else {
819            let local_var_entity: Option<GetWorkspaceStatusError> =
820                serde_json::from_str(&local_var_content).ok();
821            let local_var_error = ResponseContent {
822                status: local_var_status,
823                content: local_var_content,
824                entity: local_var_entity,
825            };
826            Err(Error::ResponseError(local_var_error))
827        }
828    }
829
830    /// Resets mobile device for given console user, that user will need to do
831    /// mobile onboarding again. - Please note that this endpoint is available
832    /// only for API keys with Admin/Non Signing Admin permissions.
833    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
834    async fn reset_device(&self, params: ResetDeviceParams) -> Result<(), Error<ResetDeviceError>> {
835        let ResetDeviceParams {
836            id,
837            idempotency_key,
838        } = params;
839
840        let local_var_configuration = &self.configuration;
841
842        let local_var_client = &local_var_configuration.client;
843
844        let local_var_uri_str = format!(
845            "{}/management/users/{id}/reset_device",
846            local_var_configuration.base_path,
847            id = crate::apis::urlencode(id)
848        );
849        let mut local_var_req_builder =
850            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
851
852        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
853            local_var_req_builder = local_var_req_builder
854                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
855        }
856        if let Some(local_var_param_value) = idempotency_key {
857            local_var_req_builder =
858                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
859        }
860
861        let local_var_req = local_var_req_builder.build()?;
862        let local_var_resp = local_var_client.execute(local_var_req).await?;
863
864        let local_var_status = local_var_resp.status();
865        let local_var_content = local_var_resp.text().await?;
866
867        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
868            Ok(())
869        } else {
870            let local_var_entity: Option<ResetDeviceError> =
871                serde_json::from_str(&local_var_content).ok();
872            let local_var_error = ResponseContent {
873                status: local_var_status,
874                content: local_var_content,
875                entity: local_var_entity,
876            };
877            Err(Error::ResponseError(local_var_error))
878        }
879    }
880
881    /// Enable or disable transactions to One Time Addresses (Non Whitelisted addresses). Learn more about [One Time Addresses](https://support.fireblocks.io/hc/en-us/articles/4409104568338-One-Time-Address-OTA-feature) - Please note that this endpoint is available only for API keys with Admin/Non Signing Admin permissions. </br>Endpoint Permission: Admin, Non-Signing Admin.
882    async fn set_ota_status(
883        &self,
884        params: SetOtaStatusParams,
885    ) -> Result<models::SetOtaStatusResponse, Error<SetOtaStatusError>> {
886        let SetOtaStatusParams {
887            set_ota_status_request,
888            idempotency_key,
889        } = params;
890
891        let local_var_configuration = &self.configuration;
892
893        let local_var_client = &local_var_configuration.client;
894
895        let local_var_uri_str = format!("{}/management/ota", local_var_configuration.base_path);
896        let mut local_var_req_builder =
897            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
898
899        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
900            local_var_req_builder = local_var_req_builder
901                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
902        }
903        if let Some(local_var_param_value) = idempotency_key {
904            local_var_req_builder =
905                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
906        }
907        local_var_req_builder = local_var_req_builder.json(&set_ota_status_request);
908
909        let local_var_req = local_var_req_builder.build()?;
910        let local_var_resp = local_var_client.execute(local_var_req).await?;
911
912        let local_var_status = local_var_resp.status();
913        let local_var_content = local_var_resp.text().await?;
914
915        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
916            serde_json::from_str(&local_var_content).map_err(Error::from)
917        } else {
918            let local_var_entity: Option<SetOtaStatusError> =
919                serde_json::from_str(&local_var_content).ok();
920            let local_var_error = ResponseContent {
921                status: local_var_status,
922                content: local_var_content,
923                entity: local_var_entity,
924            };
925            Err(Error::ResponseError(local_var_error))
926        }
927    }
928
929    /// Update a user group by ID - Please note that this endpoint is available
930    /// only for API keys with Admin permissions. </br>Endpoint Permission:
931    /// Admin, Non-Signing Admin.
932    async fn update_user_group(
933        &self,
934        params: UpdateUserGroupParams,
935    ) -> Result<models::UserGroupCreateResponse, Error<UpdateUserGroupError>> {
936        let UpdateUserGroupParams {
937            group_id,
938            user_group_update_request,
939            idempotency_key,
940        } = params;
941
942        let local_var_configuration = &self.configuration;
943
944        let local_var_client = &local_var_configuration.client;
945
946        let local_var_uri_str = format!(
947            "{}/management/user_groups/{groupId}",
948            local_var_configuration.base_path,
949            groupId = crate::apis::urlencode(group_id)
950        );
951        let mut local_var_req_builder =
952            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
953
954        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
955            local_var_req_builder = local_var_req_builder
956                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
957        }
958        if let Some(local_var_param_value) = idempotency_key {
959            local_var_req_builder =
960                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
961        }
962        local_var_req_builder = local_var_req_builder.json(&user_group_update_request);
963
964        let local_var_req = local_var_req_builder.build()?;
965        let local_var_resp = local_var_client.execute(local_var_req).await?;
966
967        let local_var_status = local_var_resp.status();
968        let local_var_content = local_var_resp.text().await?;
969
970        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
971            serde_json::from_str(&local_var_content).map_err(Error::from)
972        } else {
973            let local_var_entity: Option<UpdateUserGroupError> =
974                serde_json::from_str(&local_var_content).ok();
975            let local_var_error = ResponseContent {
976                status: local_var_status,
977                content: local_var_content,
978                entity: local_var_entity,
979            };
980            Err(Error::ResponseError(local_var_error))
981        }
982    }
983}
984
985/// struct for typed errors of method [`create_api_user`]
986#[derive(Debug, Clone, Serialize, Deserialize)]
987#[serde(untagged)]
988pub enum CreateApiUserError {
989    Status400(),
990    Status401(models::ErrorResponse),
991    Status403(models::ErrorResponse),
992    Status5XX(models::ErrorResponse),
993    DefaultResponse(models::ErrorSchema),
994    UnknownValue(serde_json::Value),
995}
996
997/// struct for typed errors of method [`create_console_user`]
998#[derive(Debug, Clone, Serialize, Deserialize)]
999#[serde(untagged)]
1000pub enum CreateConsoleUserError {
1001    Status400(),
1002    Status401(models::ErrorResponse),
1003    Status403(models::ErrorResponse),
1004    Status5XX(models::ErrorResponse),
1005    DefaultResponse(models::ErrorSchema),
1006    UnknownValue(serde_json::Value),
1007}
1008
1009/// struct for typed errors of method [`create_user_group`]
1010#[derive(Debug, Clone, Serialize, Deserialize)]
1011#[serde(untagged)]
1012pub enum CreateUserGroupError {
1013    DefaultResponse(models::ErrorSchema),
1014    UnknownValue(serde_json::Value),
1015}
1016
1017/// struct for typed errors of method [`delete_user_group`]
1018#[derive(Debug, Clone, Serialize, Deserialize)]
1019#[serde(untagged)]
1020pub enum DeleteUserGroupError {
1021    DefaultResponse(models::ErrorSchema),
1022    UnknownValue(serde_json::Value),
1023}
1024
1025/// struct for typed errors of method [`get_api_users`]
1026#[derive(Debug, Clone, Serialize, Deserialize)]
1027#[serde(untagged)]
1028pub enum GetApiUsersError {
1029    Status401(models::ErrorResponse),
1030    Status403(models::ErrorResponse),
1031    Status5XX(models::ErrorResponse),
1032    DefaultResponse(models::ErrorSchema),
1033    UnknownValue(serde_json::Value),
1034}
1035
1036/// struct for typed errors of method [`get_audit_logs`]
1037#[derive(Debug, Clone, Serialize, Deserialize)]
1038#[serde(untagged)]
1039pub enum GetAuditLogsError {
1040    DefaultResponse(models::ErrorSchema),
1041    UnknownValue(serde_json::Value),
1042}
1043
1044/// struct for typed errors of method [`get_audits`]
1045#[derive(Debug, Clone, Serialize, Deserialize)]
1046#[serde(untagged)]
1047pub enum GetAuditsError {
1048    DefaultResponse(models::ErrorSchema),
1049    UnknownValue(serde_json::Value),
1050}
1051
1052/// struct for typed errors of method [`get_console_users`]
1053#[derive(Debug, Clone, Serialize, Deserialize)]
1054#[serde(untagged)]
1055pub enum GetConsoleUsersError {
1056    Status401(models::ErrorResponse),
1057    Status403(models::ErrorResponse),
1058    Status5XX(models::ErrorResponse),
1059    DefaultResponse(models::ErrorSchema),
1060    UnknownValue(serde_json::Value),
1061}
1062
1063/// struct for typed errors of method [`get_ota_status`]
1064#[derive(Debug, Clone, Serialize, Deserialize)]
1065#[serde(untagged)]
1066pub enum GetOtaStatusError {
1067    Status404(),
1068    UnknownValue(serde_json::Value),
1069}
1070
1071/// struct for typed errors of method [`get_user_group`]
1072#[derive(Debug, Clone, Serialize, Deserialize)]
1073#[serde(untagged)]
1074pub enum GetUserGroupError {
1075    DefaultResponse(models::ErrorSchema),
1076    UnknownValue(serde_json::Value),
1077}
1078
1079/// struct for typed errors of method [`get_user_groups`]
1080#[derive(Debug, Clone, Serialize, Deserialize)]
1081#[serde(untagged)]
1082pub enum GetUserGroupsError {
1083    DefaultResponse(models::ErrorSchema),
1084    UnknownValue(serde_json::Value),
1085}
1086
1087/// struct for typed errors of method [`get_users`]
1088#[derive(Debug, Clone, Serialize, Deserialize)]
1089#[serde(untagged)]
1090pub enum GetUsersError {
1091    DefaultResponse(models::ErrorSchema),
1092    UnknownValue(serde_json::Value),
1093}
1094
1095/// struct for typed errors of method [`get_whitelist_ip_addresses`]
1096#[derive(Debug, Clone, Serialize, Deserialize)]
1097#[serde(untagged)]
1098pub enum GetWhitelistIpAddressesError {
1099    Status401(models::ErrorResponse),
1100    Status403(models::ErrorResponse),
1101    Status5XX(models::ErrorResponse),
1102    DefaultResponse(models::ErrorSchema),
1103    UnknownValue(serde_json::Value),
1104}
1105
1106/// struct for typed errors of method [`get_workspace_status`]
1107#[derive(Debug, Clone, Serialize, Deserialize)]
1108#[serde(untagged)]
1109pub enum GetWorkspaceStatusError {
1110    Status404(),
1111    UnknownValue(serde_json::Value),
1112}
1113
1114/// struct for typed errors of method [`reset_device`]
1115#[derive(Debug, Clone, Serialize, Deserialize)]
1116#[serde(untagged)]
1117pub enum ResetDeviceError {
1118    Status401(models::ErrorResponse),
1119    Status403(models::ErrorResponse),
1120    Status5XX(models::ErrorResponse),
1121    DefaultResponse(models::ErrorSchema),
1122    UnknownValue(serde_json::Value),
1123}
1124
1125/// struct for typed errors of method [`set_ota_status`]
1126#[derive(Debug, Clone, Serialize, Deserialize)]
1127#[serde(untagged)]
1128pub enum SetOtaStatusError {
1129    Status400(),
1130    Status409(),
1131    Status500(),
1132    UnknownValue(serde_json::Value),
1133}
1134
1135/// struct for typed errors of method [`update_user_group`]
1136#[derive(Debug, Clone, Serialize, Deserialize)]
1137#[serde(untagged)]
1138pub enum UpdateUserGroupError {
1139    DefaultResponse(models::ErrorSchema),
1140    UnknownValue(serde_json::Value),
1141}