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::{Error, configuration},
11    crate::{
12        apis::{ContentType, ResponseContent},
13        models,
14    },
15    async_trait::async_trait,
16    reqwest,
17    serde::{Deserialize, Serialize, de::Error as _},
18    std::sync::Arc,
19};
20
21#[async_trait]
22pub trait WorkspaceManagementApi: Send + Sync {
23    /// POST /management/api_users
24    ///
25    /// 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.
26    async fn create_api_user(
27        &self,
28        params: CreateApiUserParams,
29    ) -> Result<(), Error<CreateApiUserError>>;
30
31    /// POST /management/users
32    ///
33    /// 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.
34    async fn create_console_user(
35        &self,
36        params: CreateConsoleUserParams,
37    ) -> Result<(), Error<CreateConsoleUserError>>;
38
39    /// POST /management/user_groups
40    ///
41    /// Create a new user group. Users with the Viewer role cannot be added to
42    /// groups. </br>Endpoint Permission: Admin, Non-Signing Admin.
43    async fn create_user_group(
44        &self,
45        params: CreateUserGroupParams,
46    ) -> Result<models::CreateUserGroupResponse, Error<CreateUserGroupError>>;
47
48    /// DELETE /management/user_groups/{groupId}
49    ///
50    /// Delete a user group by ID.</br> - Please note that this endpoint is
51    /// available only for API keys with Admin/Non Signing Admin permissions.
52    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
53    async fn delete_user_group(
54        &self,
55        params: DeleteUserGroupParams,
56    ) -> Result<(), Error<DeleteUserGroupError>>;
57
58    /// GET /management/api_users
59    ///
60    /// List all API keys in your workspace. - Please note that this endpoint is
61    /// available only for API keys with Admin/Non Signing Admin permissions.
62    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
63    async fn get_api_users(&self) -> Result<models::GetApiUsersResponse, Error<GetApiUsersError>>;
64
65    /// GET /management/audit_logs
66    ///
67    /// Get Audit logs for the last Day/Week.  - Please note that this endpoint
68    /// is available only for API keys with Admin/Non Signing Admin permissions.
69    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
70    async fn get_audit_logs(
71        &self,
72        params: GetAuditLogsParams,
73    ) -> Result<models::GetAuditLogsResponse, Error<GetAuditLogsError>>;
74
75    /// GET /audits
76    ///
77    /// Deprecated. Please use the `GET /management/audit_logs` endpoint
78    /// instead. </br>Endpoint Permission: Admin, Non-Signing Admin.
79    async fn get_audits(
80        &self,
81        params: GetAuditsParams,
82    ) -> Result<models::GetAuditLogsResponseDto, Error<GetAuditsError>>;
83
84    /// GET /management/users
85    ///
86    /// Get console users for your workspace. - Please note that this endpoint
87    /// is available only for API keys with Admin/Non Signing Admin permissions.
88    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
89    async fn get_console_users(
90        &self,
91    ) -> Result<models::GetConsoleUsersResponse, Error<GetConsoleUsersError>>;
92
93    /// GET /management/ota
94    ///
95    /// 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.
96    async fn get_ota_status(
97        &self,
98    ) -> Result<models::GetOtaStatusResponse, Error<GetOtaStatusError>>;
99
100    /// GET /management/user_groups/{groupId}
101    ///
102    /// Get a user group by ID  - Please note that this endpoint is available
103    /// only for API keys with Admin/Non Signing Admin permissions.
104    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
105    async fn get_user_group(
106        &self,
107        params: GetUserGroupParams,
108    ) -> Result<models::UserGroupResponse, Error<GetUserGroupError>>;
109
110    /// GET /management/user_groups
111    ///
112    /// Get all user groups in your workspace  - Please note that this endpoint
113    /// is available only for API keys with Admin/Non Signing Admin permissions.
114    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
115    async fn get_user_groups(
116        &self,
117    ) -> Result<Vec<models::UserGroupResponse>, Error<GetUserGroupsError>>;
118
119    /// GET /users
120    ///
121    /// DEPRECATED - please use `GET /management/users` instead </br>Endpoint
122    /// Permission: Admin, Non-Signing Admin.
123    async fn get_users(&self) -> Result<Vec<models::UserResponse>, Error<GetUsersError>>;
124
125    /// GET /management/api_users/{userId}/whitelist_ip_addresses
126    ///
127    /// Get a list of the whitelisted IP addresses for a specific API Key -
128    /// Please note that this endpoint is available only for API keys with
129    /// Admin/Non Signing Admin permissions. </br>Endpoint Permission: Admin,
130    /// Non-Signing Admin.
131    async fn get_whitelist_ip_addresses(
132        &self,
133        params: GetWhitelistIpAddressesParams,
134    ) -> Result<models::GetWhitelistIpAddressesResponse, Error<GetWhitelistIpAddressesError>>;
135
136    /// GET /management/workspace_status
137    ///
138    /// Returns current workspace status (Beta). **Note**: - This endpoint is
139    /// now in Beta, disabled for general availability at this time. - Please
140    /// note that this endpoint is available only for API keys with Admin/Non
141    /// Signing Admin permissions.  </br>Endpoint Permission: Admin, Non-Signing
142    /// Admin.
143    async fn get_workspace_status(
144        &self,
145    ) -> Result<models::GetWorkspaceStatusResponse, Error<GetWorkspaceStatusError>>;
146
147    /// POST /management/users/{id}/reset_device
148    ///
149    /// Resets mobile device for given console user, that user will need to do
150    /// mobile onboarding again. - Please note that this endpoint is available
151    /// only for API keys with Admin/Non Signing Admin permissions.
152    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
153    async fn reset_device(&self, params: ResetDeviceParams) -> Result<(), Error<ResetDeviceError>>;
154
155    /// PUT /management/ota
156    ///
157    /// 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.
158    async fn set_ota_status(
159        &self,
160        params: SetOtaStatusParams,
161    ) -> Result<models::SetOtaStatusResponse, Error<SetOtaStatusError>>;
162
163    /// PUT /management/user_groups/{groupId}
164    ///
165    /// Update a user group by ID - Please note that this endpoint is available
166    /// only for API keys with Admin permissions. </br>Endpoint Permission:
167    /// Admin, Non-Signing Admin.
168    async fn update_user_group(
169        &self,
170        params: UpdateUserGroupParams,
171    ) -> Result<models::UserGroupCreateResponse, Error<UpdateUserGroupError>>;
172}
173
174pub struct WorkspaceManagementApiClient {
175    configuration: Arc<configuration::Configuration>,
176}
177
178impl WorkspaceManagementApiClient {
179    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
180        Self { configuration }
181    }
182}
183
184/// struct for passing parameters to the method
185/// [`WorkspaceManagementApi::create_api_user`]
186#[derive(Clone, Debug)]
187#[cfg_attr(feature = "bon", derive(::bon::Builder))]
188pub struct CreateApiUserParams {
189    /// A unique identifier for the request. If the request is sent multiple
190    /// times with the same idempotency key, the server will return the same
191    /// response as the first request. The idempotency key is valid for 24
192    /// hours.
193    pub idempotency_key: Option<String>,
194    pub create_api_user: Option<models::CreateApiUser>,
195}
196
197/// struct for passing parameters to the method
198/// [`WorkspaceManagementApi::create_console_user`]
199#[derive(Clone, Debug)]
200#[cfg_attr(feature = "bon", derive(::bon::Builder))]
201pub struct CreateConsoleUserParams {
202    /// A unique identifier for the request. If the request is sent multiple
203    /// times with the same idempotency key, the server will return the same
204    /// response as the first request. The idempotency key is valid for 24
205    /// hours.
206    pub idempotency_key: Option<String>,
207    pub create_console_user: Option<models::CreateConsoleUser>,
208}
209
210/// struct for passing parameters to the method
211/// [`WorkspaceManagementApi::create_user_group`]
212#[derive(Clone, Debug)]
213#[cfg_attr(feature = "bon", derive(::bon::Builder))]
214pub struct CreateUserGroupParams {
215    pub user_group_create_request: models::UserGroupCreateRequest,
216    /// A unique identifier for the request. If the request is sent multiple
217    /// times with the same idempotency key, the server will return the same
218    /// response as the first request. The idempotency key is valid for 24
219    /// hours.
220    pub idempotency_key: Option<String>,
221}
222
223/// struct for passing parameters to the method
224/// [`WorkspaceManagementApi::delete_user_group`]
225#[derive(Clone, Debug)]
226#[cfg_attr(feature = "bon", derive(::bon::Builder))]
227pub struct DeleteUserGroupParams {
228    /// The ID of the user group
229    pub group_id: String,
230}
231
232/// struct for passing parameters to the method
233/// [`WorkspaceManagementApi::get_audit_logs`]
234#[derive(Clone, Debug)]
235#[cfg_attr(feature = "bon", derive(::bon::Builder))]
236pub struct GetAuditLogsParams {
237    /// The last time period to fetch audit logs
238    pub time_period: Option<String>,
239    /// The next id to start fetch audit logs from
240    pub cursor: Option<String>,
241}
242
243/// struct for passing parameters to the method
244/// [`WorkspaceManagementApi::get_audits`]
245#[derive(Clone, Debug)]
246#[cfg_attr(feature = "bon", derive(::bon::Builder))]
247pub struct GetAuditsParams {
248    /// The last time period to fetch audit logs
249    pub time_period: Option<String>,
250}
251
252/// struct for passing parameters to the method
253/// [`WorkspaceManagementApi::get_user_group`]
254#[derive(Clone, Debug)]
255#[cfg_attr(feature = "bon", derive(::bon::Builder))]
256pub struct GetUserGroupParams {
257    /// The ID of the user group
258    pub group_id: String,
259}
260
261/// struct for passing parameters to the method
262/// [`WorkspaceManagementApi::get_whitelist_ip_addresses`]
263#[derive(Clone, Debug)]
264#[cfg_attr(feature = "bon", derive(::bon::Builder))]
265pub struct GetWhitelistIpAddressesParams {
266    /// The ID of the api user
267    pub user_id: String,
268}
269
270/// struct for passing parameters to the method
271/// [`WorkspaceManagementApi::reset_device`]
272#[derive(Clone, Debug)]
273#[cfg_attr(feature = "bon", derive(::bon::Builder))]
274pub struct ResetDeviceParams {
275    /// The ID of the console user
276    pub id: String,
277    /// A unique identifier for the request. If the request is sent multiple
278    /// times with the same idempotency key, the server will return the same
279    /// response as the first request. The idempotency key is valid for 24
280    /// hours.
281    pub idempotency_key: Option<String>,
282}
283
284/// struct for passing parameters to the method
285/// [`WorkspaceManagementApi::set_ota_status`]
286#[derive(Clone, Debug)]
287#[cfg_attr(feature = "bon", derive(::bon::Builder))]
288pub struct SetOtaStatusParams {
289    pub set_ota_status_request: models::SetOtaStatusRequest,
290    /// A unique identifier for the request. If the request is sent multiple
291    /// times with the same idempotency key, the server will return the same
292    /// response as the first request. The idempotency key is valid for 24
293    /// hours.
294    pub idempotency_key: Option<String>,
295}
296
297/// struct for passing parameters to the method
298/// [`WorkspaceManagementApi::update_user_group`]
299#[derive(Clone, Debug)]
300#[cfg_attr(feature = "bon", derive(::bon::Builder))]
301pub struct UpdateUserGroupParams {
302    /// The ID of the user group
303    pub group_id: String,
304    pub user_group_update_request: models::UserGroupUpdateRequest,
305    /// A unique identifier for the request. If the request is sent multiple
306    /// times with the same idempotency key, the server will return the same
307    /// response as the first request. The idempotency key is valid for 24
308    /// hours.
309    pub idempotency_key: Option<String>,
310}
311
312#[async_trait]
313impl WorkspaceManagementApi for WorkspaceManagementApiClient {
314    /// 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.
315    async fn create_api_user(
316        &self,
317        params: CreateApiUserParams,
318    ) -> Result<(), Error<CreateApiUserError>> {
319        let CreateApiUserParams {
320            idempotency_key,
321            create_api_user,
322        } = params;
323
324        let local_var_configuration = &self.configuration;
325
326        let local_var_client = &local_var_configuration.client;
327
328        let local_var_uri_str =
329            format!("{}/management/api_users", local_var_configuration.base_path);
330        let mut local_var_req_builder =
331            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
332
333        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
334            local_var_req_builder = local_var_req_builder
335                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
336        }
337        if let Some(local_var_param_value) = idempotency_key {
338            local_var_req_builder =
339                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
340        }
341        local_var_req_builder = local_var_req_builder.json(&create_api_user);
342
343        let local_var_req = local_var_req_builder.build()?;
344        let local_var_resp = local_var_client.execute(local_var_req).await?;
345
346        let local_var_status = local_var_resp.status();
347        let local_var_content = local_var_resp.text().await?;
348
349        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
350            Ok(())
351        } else {
352            let local_var_entity: Option<CreateApiUserError> =
353                serde_json::from_str(&local_var_content).ok();
354            let local_var_error = ResponseContent {
355                status: local_var_status,
356                content: local_var_content,
357                entity: local_var_entity,
358            };
359            Err(Error::ResponseError(local_var_error))
360        }
361    }
362
363    /// 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.
364    async fn create_console_user(
365        &self,
366        params: CreateConsoleUserParams,
367    ) -> Result<(), Error<CreateConsoleUserError>> {
368        let CreateConsoleUserParams {
369            idempotency_key,
370            create_console_user,
371        } = params;
372
373        let local_var_configuration = &self.configuration;
374
375        let local_var_client = &local_var_configuration.client;
376
377        let local_var_uri_str = format!("{}/management/users", local_var_configuration.base_path);
378        let mut local_var_req_builder =
379            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
380
381        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
382            local_var_req_builder = local_var_req_builder
383                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
384        }
385        if let Some(local_var_param_value) = idempotency_key {
386            local_var_req_builder =
387                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
388        }
389        local_var_req_builder = local_var_req_builder.json(&create_console_user);
390
391        let local_var_req = local_var_req_builder.build()?;
392        let local_var_resp = local_var_client.execute(local_var_req).await?;
393
394        let local_var_status = local_var_resp.status();
395        let local_var_content = local_var_resp.text().await?;
396
397        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
398            Ok(())
399        } else {
400            let local_var_entity: Option<CreateConsoleUserError> =
401                serde_json::from_str(&local_var_content).ok();
402            let local_var_error = ResponseContent {
403                status: local_var_status,
404                content: local_var_content,
405                entity: local_var_entity,
406            };
407            Err(Error::ResponseError(local_var_error))
408        }
409    }
410
411    /// Create a new user group. Users with the Viewer role cannot be added to
412    /// groups. </br>Endpoint Permission: Admin, Non-Signing Admin.
413    async fn create_user_group(
414        &self,
415        params: CreateUserGroupParams,
416    ) -> Result<models::CreateUserGroupResponse, Error<CreateUserGroupError>> {
417        let CreateUserGroupParams {
418            user_group_create_request,
419            idempotency_key,
420        } = params;
421
422        let local_var_configuration = &self.configuration;
423
424        let local_var_client = &local_var_configuration.client;
425
426        let local_var_uri_str = format!(
427            "{}/management/user_groups",
428            local_var_configuration.base_path
429        );
430        let mut local_var_req_builder =
431            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
432
433        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
434            local_var_req_builder = local_var_req_builder
435                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
436        }
437        if let Some(local_var_param_value) = idempotency_key {
438            local_var_req_builder =
439                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
440        }
441        local_var_req_builder = local_var_req_builder.json(&user_group_create_request);
442
443        let local_var_req = local_var_req_builder.build()?;
444        let local_var_resp = local_var_client.execute(local_var_req).await?;
445
446        let local_var_status = local_var_resp.status();
447        let local_var_content_type = local_var_resp
448            .headers()
449            .get("content-type")
450            .and_then(|v| v.to_str().ok())
451            .unwrap_or("application/octet-stream");
452        let local_var_content_type = super::ContentType::from(local_var_content_type);
453        let local_var_content = local_var_resp.text().await?;
454
455        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
456            match local_var_content_type {
457                ContentType::Json => {
458                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
459                }
460                ContentType::Text => {
461                    return Err(Error::from(serde_json::Error::custom(
462                        "Received `text/plain` content type response that cannot be converted to \
463                         `models::CreateUserGroupResponse`",
464                    )));
465                }
466                ContentType::Unsupported(local_var_unknown_type) => {
467                    return Err(Error::from(serde_json::Error::custom(format!(
468                        "Received `{local_var_unknown_type}` content type response that cannot be \
469                         converted to `models::CreateUserGroupResponse`"
470                    ))));
471                }
472            }
473        } else {
474            let local_var_entity: Option<CreateUserGroupError> =
475                serde_json::from_str(&local_var_content).ok();
476            let local_var_error = ResponseContent {
477                status: local_var_status,
478                content: local_var_content,
479                entity: local_var_entity,
480            };
481            Err(Error::ResponseError(local_var_error))
482        }
483    }
484
485    /// Delete a user group by ID.</br> - Please note that this endpoint is
486    /// available only for API keys with Admin/Non Signing Admin permissions.
487    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
488    async fn delete_user_group(
489        &self,
490        params: DeleteUserGroupParams,
491    ) -> Result<(), Error<DeleteUserGroupError>> {
492        let DeleteUserGroupParams { group_id } = params;
493
494        let local_var_configuration = &self.configuration;
495
496        let local_var_client = &local_var_configuration.client;
497
498        let local_var_uri_str = format!(
499            "{}/management/user_groups/{groupId}",
500            local_var_configuration.base_path,
501            groupId = crate::apis::urlencode(group_id)
502        );
503        let mut local_var_req_builder =
504            local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
505
506        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
507            local_var_req_builder = local_var_req_builder
508                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
509        }
510
511        let local_var_req = local_var_req_builder.build()?;
512        let local_var_resp = local_var_client.execute(local_var_req).await?;
513
514        let local_var_status = local_var_resp.status();
515        let local_var_content = local_var_resp.text().await?;
516
517        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
518            Ok(())
519        } else {
520            let local_var_entity: Option<DeleteUserGroupError> =
521                serde_json::from_str(&local_var_content).ok();
522            let local_var_error = ResponseContent {
523                status: local_var_status,
524                content: local_var_content,
525                entity: local_var_entity,
526            };
527            Err(Error::ResponseError(local_var_error))
528        }
529    }
530
531    /// List all API keys in your workspace. - Please note that this endpoint is
532    /// available only for API keys with Admin/Non Signing Admin permissions.
533    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
534    async fn get_api_users(&self) -> Result<models::GetApiUsersResponse, Error<GetApiUsersError>> {
535        let local_var_configuration = &self.configuration;
536
537        let local_var_client = &local_var_configuration.client;
538
539        let local_var_uri_str =
540            format!("{}/management/api_users", local_var_configuration.base_path);
541        let mut local_var_req_builder =
542            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
543
544        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
545            local_var_req_builder = local_var_req_builder
546                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
547        }
548
549        let local_var_req = local_var_req_builder.build()?;
550        let local_var_resp = local_var_client.execute(local_var_req).await?;
551
552        let local_var_status = local_var_resp.status();
553        let local_var_content_type = local_var_resp
554            .headers()
555            .get("content-type")
556            .and_then(|v| v.to_str().ok())
557            .unwrap_or("application/octet-stream");
558        let local_var_content_type = super::ContentType::from(local_var_content_type);
559        let local_var_content = local_var_resp.text().await?;
560
561        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
562            match local_var_content_type {
563                ContentType::Json => {
564                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
565                }
566                ContentType::Text => {
567                    return Err(Error::from(serde_json::Error::custom(
568                        "Received `text/plain` content type response that cannot be converted to \
569                         `models::GetApiUsersResponse`",
570                    )));
571                }
572                ContentType::Unsupported(local_var_unknown_type) => {
573                    return Err(Error::from(serde_json::Error::custom(format!(
574                        "Received `{local_var_unknown_type}` content type response that cannot be \
575                         converted to `models::GetApiUsersResponse`"
576                    ))));
577                }
578            }
579        } else {
580            let local_var_entity: Option<GetApiUsersError> =
581                serde_json::from_str(&local_var_content).ok();
582            let local_var_error = ResponseContent {
583                status: local_var_status,
584                content: local_var_content,
585                entity: local_var_entity,
586            };
587            Err(Error::ResponseError(local_var_error))
588        }
589    }
590
591    /// Get Audit logs for the last Day/Week.  - Please note that this endpoint
592    /// is available only for API keys with Admin/Non Signing Admin permissions.
593    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
594    async fn get_audit_logs(
595        &self,
596        params: GetAuditLogsParams,
597    ) -> Result<models::GetAuditLogsResponse, Error<GetAuditLogsError>> {
598        let GetAuditLogsParams {
599            time_period,
600            cursor,
601        } = params;
602
603        let local_var_configuration = &self.configuration;
604
605        let local_var_client = &local_var_configuration.client;
606
607        let local_var_uri_str = format!(
608            "{}/management/audit_logs",
609            local_var_configuration.base_path
610        );
611        let mut local_var_req_builder =
612            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
613
614        if let Some(ref param_value) = time_period {
615            local_var_req_builder =
616                local_var_req_builder.query(&[("timePeriod", &param_value.to_string())]);
617        }
618        if let Some(ref param_value) = cursor {
619            local_var_req_builder =
620                local_var_req_builder.query(&[("cursor", &param_value.to_string())]);
621        }
622        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
623            local_var_req_builder = local_var_req_builder
624                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
625        }
626
627        let local_var_req = local_var_req_builder.build()?;
628        let local_var_resp = local_var_client.execute(local_var_req).await?;
629
630        let local_var_status = local_var_resp.status();
631        let local_var_content_type = local_var_resp
632            .headers()
633            .get("content-type")
634            .and_then(|v| v.to_str().ok())
635            .unwrap_or("application/octet-stream");
636        let local_var_content_type = super::ContentType::from(local_var_content_type);
637        let local_var_content = local_var_resp.text().await?;
638
639        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
640            match local_var_content_type {
641                ContentType::Json => {
642                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
643                }
644                ContentType::Text => {
645                    return Err(Error::from(serde_json::Error::custom(
646                        "Received `text/plain` content type response that cannot be converted to \
647                         `models::GetAuditLogsResponse`",
648                    )));
649                }
650                ContentType::Unsupported(local_var_unknown_type) => {
651                    return Err(Error::from(serde_json::Error::custom(format!(
652                        "Received `{local_var_unknown_type}` content type response that cannot be \
653                         converted to `models::GetAuditLogsResponse`"
654                    ))));
655                }
656            }
657        } else {
658            let local_var_entity: Option<GetAuditLogsError> =
659                serde_json::from_str(&local_var_content).ok();
660            let local_var_error = ResponseContent {
661                status: local_var_status,
662                content: local_var_content,
663                entity: local_var_entity,
664            };
665            Err(Error::ResponseError(local_var_error))
666        }
667    }
668
669    /// Deprecated. Please use the `GET /management/audit_logs` endpoint
670    /// instead. </br>Endpoint Permission: Admin, Non-Signing Admin.
671    async fn get_audits(
672        &self,
673        params: GetAuditsParams,
674    ) -> Result<models::GetAuditLogsResponseDto, Error<GetAuditsError>> {
675        let GetAuditsParams { time_period } = params;
676
677        let local_var_configuration = &self.configuration;
678
679        let local_var_client = &local_var_configuration.client;
680
681        let local_var_uri_str = format!("{}/audits", local_var_configuration.base_path);
682        let mut local_var_req_builder =
683            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
684
685        if let Some(ref param_value) = time_period {
686            local_var_req_builder =
687                local_var_req_builder.query(&[("timePeriod", &param_value.to_string())]);
688        }
689        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
690            local_var_req_builder = local_var_req_builder
691                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
692        }
693
694        let local_var_req = local_var_req_builder.build()?;
695        let local_var_resp = local_var_client.execute(local_var_req).await?;
696
697        let local_var_status = local_var_resp.status();
698        let local_var_content_type = local_var_resp
699            .headers()
700            .get("content-type")
701            .and_then(|v| v.to_str().ok())
702            .unwrap_or("application/octet-stream");
703        let local_var_content_type = super::ContentType::from(local_var_content_type);
704        let local_var_content = local_var_resp.text().await?;
705
706        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
707            match local_var_content_type {
708                ContentType::Json => {
709                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
710                }
711                ContentType::Text => {
712                    return Err(Error::from(serde_json::Error::custom(
713                        "Received `text/plain` content type response that cannot be converted to \
714                         `models::GetAuditLogsResponseDto`",
715                    )));
716                }
717                ContentType::Unsupported(local_var_unknown_type) => {
718                    return Err(Error::from(serde_json::Error::custom(format!(
719                        "Received `{local_var_unknown_type}` content type response that cannot be \
720                         converted to `models::GetAuditLogsResponseDto`"
721                    ))));
722                }
723            }
724        } else {
725            let local_var_entity: Option<GetAuditsError> =
726                serde_json::from_str(&local_var_content).ok();
727            let local_var_error = ResponseContent {
728                status: local_var_status,
729                content: local_var_content,
730                entity: local_var_entity,
731            };
732            Err(Error::ResponseError(local_var_error))
733        }
734    }
735
736    /// Get console users for your workspace. - Please note that this endpoint
737    /// is available only for API keys with Admin/Non Signing Admin permissions.
738    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
739    async fn get_console_users(
740        &self,
741    ) -> Result<models::GetConsoleUsersResponse, Error<GetConsoleUsersError>> {
742        let local_var_configuration = &self.configuration;
743
744        let local_var_client = &local_var_configuration.client;
745
746        let local_var_uri_str = format!("{}/management/users", local_var_configuration.base_path);
747        let mut local_var_req_builder =
748            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
749
750        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
751            local_var_req_builder = local_var_req_builder
752                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
753        }
754
755        let local_var_req = local_var_req_builder.build()?;
756        let local_var_resp = local_var_client.execute(local_var_req).await?;
757
758        let local_var_status = local_var_resp.status();
759        let local_var_content_type = local_var_resp
760            .headers()
761            .get("content-type")
762            .and_then(|v| v.to_str().ok())
763            .unwrap_or("application/octet-stream");
764        let local_var_content_type = super::ContentType::from(local_var_content_type);
765        let local_var_content = local_var_resp.text().await?;
766
767        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
768            match local_var_content_type {
769                ContentType::Json => {
770                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
771                }
772                ContentType::Text => {
773                    return Err(Error::from(serde_json::Error::custom(
774                        "Received `text/plain` content type response that cannot be converted to \
775                         `models::GetConsoleUsersResponse`",
776                    )));
777                }
778                ContentType::Unsupported(local_var_unknown_type) => {
779                    return Err(Error::from(serde_json::Error::custom(format!(
780                        "Received `{local_var_unknown_type}` content type response that cannot be \
781                         converted to `models::GetConsoleUsersResponse`"
782                    ))));
783                }
784            }
785        } else {
786            let local_var_entity: Option<GetConsoleUsersError> =
787                serde_json::from_str(&local_var_content).ok();
788            let local_var_error = ResponseContent {
789                status: local_var_status,
790                content: local_var_content,
791                entity: local_var_entity,
792            };
793            Err(Error::ResponseError(local_var_error))
794        }
795    }
796
797    /// 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.
798    async fn get_ota_status(
799        &self,
800    ) -> Result<models::GetOtaStatusResponse, Error<GetOtaStatusError>> {
801        let local_var_configuration = &self.configuration;
802
803        let local_var_client = &local_var_configuration.client;
804
805        let local_var_uri_str = format!("{}/management/ota", local_var_configuration.base_path);
806        let mut local_var_req_builder =
807            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
808
809        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
810            local_var_req_builder = local_var_req_builder
811                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
812        }
813
814        let local_var_req = local_var_req_builder.build()?;
815        let local_var_resp = local_var_client.execute(local_var_req).await?;
816
817        let local_var_status = local_var_resp.status();
818        let local_var_content_type = local_var_resp
819            .headers()
820            .get("content-type")
821            .and_then(|v| v.to_str().ok())
822            .unwrap_or("application/octet-stream");
823        let local_var_content_type = super::ContentType::from(local_var_content_type);
824        let local_var_content = local_var_resp.text().await?;
825
826        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
827            match local_var_content_type {
828                ContentType::Json => {
829                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
830                }
831                ContentType::Text => {
832                    return Err(Error::from(serde_json::Error::custom(
833                        "Received `text/plain` content type response that cannot be converted to \
834                         `models::GetOtaStatusResponse`",
835                    )));
836                }
837                ContentType::Unsupported(local_var_unknown_type) => {
838                    return Err(Error::from(serde_json::Error::custom(format!(
839                        "Received `{local_var_unknown_type}` content type response that cannot be \
840                         converted to `models::GetOtaStatusResponse`"
841                    ))));
842                }
843            }
844        } else {
845            let local_var_entity: Option<GetOtaStatusError> =
846                serde_json::from_str(&local_var_content).ok();
847            let local_var_error = ResponseContent {
848                status: local_var_status,
849                content: local_var_content,
850                entity: local_var_entity,
851            };
852            Err(Error::ResponseError(local_var_error))
853        }
854    }
855
856    /// Get a user group by ID  - Please note that this endpoint is available
857    /// only for API keys with Admin/Non Signing Admin permissions.
858    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
859    async fn get_user_group(
860        &self,
861        params: GetUserGroupParams,
862    ) -> Result<models::UserGroupResponse, Error<GetUserGroupError>> {
863        let GetUserGroupParams { group_id } = params;
864
865        let local_var_configuration = &self.configuration;
866
867        let local_var_client = &local_var_configuration.client;
868
869        let local_var_uri_str = format!(
870            "{}/management/user_groups/{groupId}",
871            local_var_configuration.base_path,
872            groupId = crate::apis::urlencode(group_id)
873        );
874        let mut local_var_req_builder =
875            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
876
877        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
878            local_var_req_builder = local_var_req_builder
879                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
880        }
881
882        let local_var_req = local_var_req_builder.build()?;
883        let local_var_resp = local_var_client.execute(local_var_req).await?;
884
885        let local_var_status = local_var_resp.status();
886        let local_var_content_type = local_var_resp
887            .headers()
888            .get("content-type")
889            .and_then(|v| v.to_str().ok())
890            .unwrap_or("application/octet-stream");
891        let local_var_content_type = super::ContentType::from(local_var_content_type);
892        let local_var_content = local_var_resp.text().await?;
893
894        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
895            match local_var_content_type {
896                ContentType::Json => {
897                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
898                }
899                ContentType::Text => {
900                    return Err(Error::from(serde_json::Error::custom(
901                        "Received `text/plain` content type response that cannot be converted to \
902                         `models::UserGroupResponse`",
903                    )));
904                }
905                ContentType::Unsupported(local_var_unknown_type) => {
906                    return Err(Error::from(serde_json::Error::custom(format!(
907                        "Received `{local_var_unknown_type}` content type response that cannot be \
908                         converted to `models::UserGroupResponse`"
909                    ))));
910                }
911            }
912        } else {
913            let local_var_entity: Option<GetUserGroupError> =
914                serde_json::from_str(&local_var_content).ok();
915            let local_var_error = ResponseContent {
916                status: local_var_status,
917                content: local_var_content,
918                entity: local_var_entity,
919            };
920            Err(Error::ResponseError(local_var_error))
921        }
922    }
923
924    /// Get all user groups in your workspace  - Please note that this endpoint
925    /// is available only for API keys with Admin/Non Signing Admin permissions.
926    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
927    async fn get_user_groups(
928        &self,
929    ) -> Result<Vec<models::UserGroupResponse>, Error<GetUserGroupsError>> {
930        let local_var_configuration = &self.configuration;
931
932        let local_var_client = &local_var_configuration.client;
933
934        let local_var_uri_str = format!(
935            "{}/management/user_groups",
936            local_var_configuration.base_path
937        );
938        let mut local_var_req_builder =
939            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
940
941        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
942            local_var_req_builder = local_var_req_builder
943                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
944        }
945
946        let local_var_req = local_var_req_builder.build()?;
947        let local_var_resp = local_var_client.execute(local_var_req).await?;
948
949        let local_var_status = local_var_resp.status();
950        let local_var_content_type = local_var_resp
951            .headers()
952            .get("content-type")
953            .and_then(|v| v.to_str().ok())
954            .unwrap_or("application/octet-stream");
955        let local_var_content_type = super::ContentType::from(local_var_content_type);
956        let local_var_content = local_var_resp.text().await?;
957
958        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
959            match local_var_content_type {
960                ContentType::Json => {
961                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
962                }
963                ContentType::Text => {
964                    return Err(Error::from(serde_json::Error::custom(
965                        "Received `text/plain` content type response that cannot be converted to \
966                         `Vec&lt;models::UserGroupResponse&gt;`",
967                    )));
968                }
969                ContentType::Unsupported(local_var_unknown_type) => {
970                    return Err(Error::from(serde_json::Error::custom(format!(
971                        "Received `{local_var_unknown_type}` content type response that cannot be \
972                         converted to `Vec&lt;models::UserGroupResponse&gt;`"
973                    ))));
974                }
975            }
976        } else {
977            let local_var_entity: Option<GetUserGroupsError> =
978                serde_json::from_str(&local_var_content).ok();
979            let local_var_error = ResponseContent {
980                status: local_var_status,
981                content: local_var_content,
982                entity: local_var_entity,
983            };
984            Err(Error::ResponseError(local_var_error))
985        }
986    }
987
988    /// DEPRECATED - please use `GET /management/users` instead </br>Endpoint
989    /// Permission: Admin, Non-Signing Admin.
990    async fn get_users(&self) -> Result<Vec<models::UserResponse>, Error<GetUsersError>> {
991        let local_var_configuration = &self.configuration;
992
993        let local_var_client = &local_var_configuration.client;
994
995        let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
996        let mut local_var_req_builder =
997            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
998
999        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1000            local_var_req_builder = local_var_req_builder
1001                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1002        }
1003
1004        let local_var_req = local_var_req_builder.build()?;
1005        let local_var_resp = local_var_client.execute(local_var_req).await?;
1006
1007        let local_var_status = local_var_resp.status();
1008        let local_var_content_type = local_var_resp
1009            .headers()
1010            .get("content-type")
1011            .and_then(|v| v.to_str().ok())
1012            .unwrap_or("application/octet-stream");
1013        let local_var_content_type = super::ContentType::from(local_var_content_type);
1014        let local_var_content = local_var_resp.text().await?;
1015
1016        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1017            match local_var_content_type {
1018                ContentType::Json => {
1019                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1020                }
1021                ContentType::Text => {
1022                    return Err(Error::from(serde_json::Error::custom(
1023                        "Received `text/plain` content type response that cannot be converted to \
1024                         `Vec&lt;models::UserResponse&gt;`",
1025                    )));
1026                }
1027                ContentType::Unsupported(local_var_unknown_type) => {
1028                    return Err(Error::from(serde_json::Error::custom(format!(
1029                        "Received `{local_var_unknown_type}` content type response that cannot be \
1030                         converted to `Vec&lt;models::UserResponse&gt;`"
1031                    ))));
1032                }
1033            }
1034        } else {
1035            let local_var_entity: Option<GetUsersError> =
1036                serde_json::from_str(&local_var_content).ok();
1037            let local_var_error = ResponseContent {
1038                status: local_var_status,
1039                content: local_var_content,
1040                entity: local_var_entity,
1041            };
1042            Err(Error::ResponseError(local_var_error))
1043        }
1044    }
1045
1046    /// Get a list of the whitelisted IP addresses for a specific API Key -
1047    /// Please note that this endpoint is available only for API keys with
1048    /// Admin/Non Signing Admin permissions. </br>Endpoint Permission: Admin,
1049    /// Non-Signing Admin.
1050    async fn get_whitelist_ip_addresses(
1051        &self,
1052        params: GetWhitelistIpAddressesParams,
1053    ) -> Result<models::GetWhitelistIpAddressesResponse, Error<GetWhitelistIpAddressesError>> {
1054        let GetWhitelistIpAddressesParams { user_id } = params;
1055
1056        let local_var_configuration = &self.configuration;
1057
1058        let local_var_client = &local_var_configuration.client;
1059
1060        let local_var_uri_str = format!(
1061            "{}/management/api_users/{userId}/whitelist_ip_addresses",
1062            local_var_configuration.base_path,
1063            userId = crate::apis::urlencode(user_id)
1064        );
1065        let mut local_var_req_builder =
1066            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1067
1068        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1069            local_var_req_builder = local_var_req_builder
1070                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1071        }
1072
1073        let local_var_req = local_var_req_builder.build()?;
1074        let local_var_resp = local_var_client.execute(local_var_req).await?;
1075
1076        let local_var_status = local_var_resp.status();
1077        let local_var_content_type = local_var_resp
1078            .headers()
1079            .get("content-type")
1080            .and_then(|v| v.to_str().ok())
1081            .unwrap_or("application/octet-stream");
1082        let local_var_content_type = super::ContentType::from(local_var_content_type);
1083        let local_var_content = local_var_resp.text().await?;
1084
1085        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1086            match local_var_content_type {
1087                ContentType::Json => {
1088                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1089                }
1090                ContentType::Text => {
1091                    return Err(Error::from(serde_json::Error::custom(
1092                        "Received `text/plain` content type response that cannot be converted to \
1093                         `models::GetWhitelistIpAddressesResponse`",
1094                    )));
1095                }
1096                ContentType::Unsupported(local_var_unknown_type) => {
1097                    return Err(Error::from(serde_json::Error::custom(format!(
1098                        "Received `{local_var_unknown_type}` content type response that cannot be \
1099                         converted to `models::GetWhitelistIpAddressesResponse`"
1100                    ))));
1101                }
1102            }
1103        } else {
1104            let local_var_entity: Option<GetWhitelistIpAddressesError> =
1105                serde_json::from_str(&local_var_content).ok();
1106            let local_var_error = ResponseContent {
1107                status: local_var_status,
1108                content: local_var_content,
1109                entity: local_var_entity,
1110            };
1111            Err(Error::ResponseError(local_var_error))
1112        }
1113    }
1114
1115    /// Returns current workspace status (Beta). **Note**: - This endpoint is
1116    /// now in Beta, disabled for general availability at this time. - Please
1117    /// note that this endpoint is available only for API keys with Admin/Non
1118    /// Signing Admin permissions.  </br>Endpoint Permission: Admin, Non-Signing
1119    /// Admin.
1120    async fn get_workspace_status(
1121        &self,
1122    ) -> Result<models::GetWorkspaceStatusResponse, Error<GetWorkspaceStatusError>> {
1123        let local_var_configuration = &self.configuration;
1124
1125        let local_var_client = &local_var_configuration.client;
1126
1127        let local_var_uri_str = format!(
1128            "{}/management/workspace_status",
1129            local_var_configuration.base_path
1130        );
1131        let mut local_var_req_builder =
1132            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1133
1134        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1135            local_var_req_builder = local_var_req_builder
1136                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1137        }
1138
1139        let local_var_req = local_var_req_builder.build()?;
1140        let local_var_resp = local_var_client.execute(local_var_req).await?;
1141
1142        let local_var_status = local_var_resp.status();
1143        let local_var_content_type = local_var_resp
1144            .headers()
1145            .get("content-type")
1146            .and_then(|v| v.to_str().ok())
1147            .unwrap_or("application/octet-stream");
1148        let local_var_content_type = super::ContentType::from(local_var_content_type);
1149        let local_var_content = local_var_resp.text().await?;
1150
1151        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1152            match local_var_content_type {
1153                ContentType::Json => {
1154                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1155                }
1156                ContentType::Text => {
1157                    return Err(Error::from(serde_json::Error::custom(
1158                        "Received `text/plain` content type response that cannot be converted to \
1159                         `models::GetWorkspaceStatusResponse`",
1160                    )));
1161                }
1162                ContentType::Unsupported(local_var_unknown_type) => {
1163                    return Err(Error::from(serde_json::Error::custom(format!(
1164                        "Received `{local_var_unknown_type}` content type response that cannot be \
1165                         converted to `models::GetWorkspaceStatusResponse`"
1166                    ))));
1167                }
1168            }
1169        } else {
1170            let local_var_entity: Option<GetWorkspaceStatusError> =
1171                serde_json::from_str(&local_var_content).ok();
1172            let local_var_error = ResponseContent {
1173                status: local_var_status,
1174                content: local_var_content,
1175                entity: local_var_entity,
1176            };
1177            Err(Error::ResponseError(local_var_error))
1178        }
1179    }
1180
1181    /// Resets mobile device for given console user, that user will need to do
1182    /// mobile onboarding again. - Please note that this endpoint is available
1183    /// only for API keys with Admin/Non Signing Admin permissions.
1184    /// </br>Endpoint Permission: Admin, Non-Signing Admin.
1185    async fn reset_device(&self, params: ResetDeviceParams) -> Result<(), Error<ResetDeviceError>> {
1186        let ResetDeviceParams {
1187            id,
1188            idempotency_key,
1189        } = params;
1190
1191        let local_var_configuration = &self.configuration;
1192
1193        let local_var_client = &local_var_configuration.client;
1194
1195        let local_var_uri_str = format!(
1196            "{}/management/users/{id}/reset_device",
1197            local_var_configuration.base_path,
1198            id = crate::apis::urlencode(id)
1199        );
1200        let mut local_var_req_builder =
1201            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1202
1203        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1204            local_var_req_builder = local_var_req_builder
1205                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1206        }
1207        if let Some(local_var_param_value) = idempotency_key {
1208            local_var_req_builder =
1209                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1210        }
1211
1212        let local_var_req = local_var_req_builder.build()?;
1213        let local_var_resp = local_var_client.execute(local_var_req).await?;
1214
1215        let local_var_status = local_var_resp.status();
1216        let local_var_content = local_var_resp.text().await?;
1217
1218        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1219            Ok(())
1220        } else {
1221            let local_var_entity: Option<ResetDeviceError> =
1222                serde_json::from_str(&local_var_content).ok();
1223            let local_var_error = ResponseContent {
1224                status: local_var_status,
1225                content: local_var_content,
1226                entity: local_var_entity,
1227            };
1228            Err(Error::ResponseError(local_var_error))
1229        }
1230    }
1231
1232    /// 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.
1233    async fn set_ota_status(
1234        &self,
1235        params: SetOtaStatusParams,
1236    ) -> Result<models::SetOtaStatusResponse, Error<SetOtaStatusError>> {
1237        let SetOtaStatusParams {
1238            set_ota_status_request,
1239            idempotency_key,
1240        } = params;
1241
1242        let local_var_configuration = &self.configuration;
1243
1244        let local_var_client = &local_var_configuration.client;
1245
1246        let local_var_uri_str = format!("{}/management/ota", local_var_configuration.base_path);
1247        let mut local_var_req_builder =
1248            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1249
1250        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1251            local_var_req_builder = local_var_req_builder
1252                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1253        }
1254        if let Some(local_var_param_value) = idempotency_key {
1255            local_var_req_builder =
1256                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1257        }
1258        local_var_req_builder = local_var_req_builder.json(&set_ota_status_request);
1259
1260        let local_var_req = local_var_req_builder.build()?;
1261        let local_var_resp = local_var_client.execute(local_var_req).await?;
1262
1263        let local_var_status = local_var_resp.status();
1264        let local_var_content_type = local_var_resp
1265            .headers()
1266            .get("content-type")
1267            .and_then(|v| v.to_str().ok())
1268            .unwrap_or("application/octet-stream");
1269        let local_var_content_type = super::ContentType::from(local_var_content_type);
1270        let local_var_content = local_var_resp.text().await?;
1271
1272        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1273            match local_var_content_type {
1274                ContentType::Json => {
1275                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1276                }
1277                ContentType::Text => {
1278                    return Err(Error::from(serde_json::Error::custom(
1279                        "Received `text/plain` content type response that cannot be converted to \
1280                         `models::SetOtaStatusResponse`",
1281                    )));
1282                }
1283                ContentType::Unsupported(local_var_unknown_type) => {
1284                    return Err(Error::from(serde_json::Error::custom(format!(
1285                        "Received `{local_var_unknown_type}` content type response that cannot be \
1286                         converted to `models::SetOtaStatusResponse`"
1287                    ))));
1288                }
1289            }
1290        } else {
1291            let local_var_entity: Option<SetOtaStatusError> =
1292                serde_json::from_str(&local_var_content).ok();
1293            let local_var_error = ResponseContent {
1294                status: local_var_status,
1295                content: local_var_content,
1296                entity: local_var_entity,
1297            };
1298            Err(Error::ResponseError(local_var_error))
1299        }
1300    }
1301
1302    /// Update a user group by ID - Please note that this endpoint is available
1303    /// only for API keys with Admin permissions. </br>Endpoint Permission:
1304    /// Admin, Non-Signing Admin.
1305    async fn update_user_group(
1306        &self,
1307        params: UpdateUserGroupParams,
1308    ) -> Result<models::UserGroupCreateResponse, Error<UpdateUserGroupError>> {
1309        let UpdateUserGroupParams {
1310            group_id,
1311            user_group_update_request,
1312            idempotency_key,
1313        } = params;
1314
1315        let local_var_configuration = &self.configuration;
1316
1317        let local_var_client = &local_var_configuration.client;
1318
1319        let local_var_uri_str = format!(
1320            "{}/management/user_groups/{groupId}",
1321            local_var_configuration.base_path,
1322            groupId = crate::apis::urlencode(group_id)
1323        );
1324        let mut local_var_req_builder =
1325            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1326
1327        if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1328            local_var_req_builder = local_var_req_builder
1329                .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1330        }
1331        if let Some(local_var_param_value) = idempotency_key {
1332            local_var_req_builder =
1333                local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1334        }
1335        local_var_req_builder = local_var_req_builder.json(&user_group_update_request);
1336
1337        let local_var_req = local_var_req_builder.build()?;
1338        let local_var_resp = local_var_client.execute(local_var_req).await?;
1339
1340        let local_var_status = local_var_resp.status();
1341        let local_var_content_type = local_var_resp
1342            .headers()
1343            .get("content-type")
1344            .and_then(|v| v.to_str().ok())
1345            .unwrap_or("application/octet-stream");
1346        let local_var_content_type = super::ContentType::from(local_var_content_type);
1347        let local_var_content = local_var_resp.text().await?;
1348
1349        if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1350            match local_var_content_type {
1351                ContentType::Json => {
1352                    crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1353                }
1354                ContentType::Text => {
1355                    return Err(Error::from(serde_json::Error::custom(
1356                        "Received `text/plain` content type response that cannot be converted to \
1357                         `models::UserGroupCreateResponse`",
1358                    )));
1359                }
1360                ContentType::Unsupported(local_var_unknown_type) => {
1361                    return Err(Error::from(serde_json::Error::custom(format!(
1362                        "Received `{local_var_unknown_type}` content type response that cannot be \
1363                         converted to `models::UserGroupCreateResponse`"
1364                    ))));
1365                }
1366            }
1367        } else {
1368            let local_var_entity: Option<UpdateUserGroupError> =
1369                serde_json::from_str(&local_var_content).ok();
1370            let local_var_error = ResponseContent {
1371                status: local_var_status,
1372                content: local_var_content,
1373                entity: local_var_entity,
1374            };
1375            Err(Error::ResponseError(local_var_error))
1376        }
1377    }
1378}
1379
1380/// struct for typed errors of method
1381/// [`WorkspaceManagementApi::create_api_user`]
1382#[derive(Debug, Clone, Serialize, Deserialize)]
1383#[serde(untagged)]
1384pub enum CreateApiUserError {
1385    Status400(),
1386    Status401(models::ErrorResponse),
1387    Status403(models::ErrorResponse),
1388    Status5XX(models::ErrorResponse),
1389    DefaultResponse(models::ErrorSchema),
1390    UnknownValue(serde_json::Value),
1391}
1392
1393/// struct for typed errors of method
1394/// [`WorkspaceManagementApi::create_console_user`]
1395#[derive(Debug, Clone, Serialize, Deserialize)]
1396#[serde(untagged)]
1397pub enum CreateConsoleUserError {
1398    Status400(),
1399    Status401(models::ErrorResponse),
1400    Status403(models::ErrorResponse),
1401    Status5XX(models::ErrorResponse),
1402    DefaultResponse(models::ErrorSchema),
1403    UnknownValue(serde_json::Value),
1404}
1405
1406/// struct for typed errors of method
1407/// [`WorkspaceManagementApi::create_user_group`]
1408#[derive(Debug, Clone, Serialize, Deserialize)]
1409#[serde(untagged)]
1410pub enum CreateUserGroupError {
1411    DefaultResponse(models::ErrorSchema),
1412    UnknownValue(serde_json::Value),
1413}
1414
1415/// struct for typed errors of method
1416/// [`WorkspaceManagementApi::delete_user_group`]
1417#[derive(Debug, Clone, Serialize, Deserialize)]
1418#[serde(untagged)]
1419pub enum DeleteUserGroupError {
1420    DefaultResponse(models::ErrorSchema),
1421    UnknownValue(serde_json::Value),
1422}
1423
1424/// struct for typed errors of method [`WorkspaceManagementApi::get_api_users`]
1425#[derive(Debug, Clone, Serialize, Deserialize)]
1426#[serde(untagged)]
1427pub enum GetApiUsersError {
1428    Status401(models::ErrorResponse),
1429    Status403(models::ErrorResponse),
1430    Status5XX(models::ErrorResponse),
1431    DefaultResponse(models::ErrorSchema),
1432    UnknownValue(serde_json::Value),
1433}
1434
1435/// struct for typed errors of method [`WorkspaceManagementApi::get_audit_logs`]
1436#[derive(Debug, Clone, Serialize, Deserialize)]
1437#[serde(untagged)]
1438pub enum GetAuditLogsError {
1439    DefaultResponse(models::ErrorSchema),
1440    UnknownValue(serde_json::Value),
1441}
1442
1443/// struct for typed errors of method [`WorkspaceManagementApi::get_audits`]
1444#[derive(Debug, Clone, Serialize, Deserialize)]
1445#[serde(untagged)]
1446pub enum GetAuditsError {
1447    DefaultResponse(models::ErrorSchema),
1448    UnknownValue(serde_json::Value),
1449}
1450
1451/// struct for typed errors of method
1452/// [`WorkspaceManagementApi::get_console_users`]
1453#[derive(Debug, Clone, Serialize, Deserialize)]
1454#[serde(untagged)]
1455pub enum GetConsoleUsersError {
1456    Status401(models::ErrorResponse),
1457    Status403(models::ErrorResponse),
1458    Status5XX(models::ErrorResponse),
1459    DefaultResponse(models::ErrorSchema),
1460    UnknownValue(serde_json::Value),
1461}
1462
1463/// struct for typed errors of method [`WorkspaceManagementApi::get_ota_status`]
1464#[derive(Debug, Clone, Serialize, Deserialize)]
1465#[serde(untagged)]
1466pub enum GetOtaStatusError {
1467    Status404(),
1468    UnknownValue(serde_json::Value),
1469}
1470
1471/// struct for typed errors of method [`WorkspaceManagementApi::get_user_group`]
1472#[derive(Debug, Clone, Serialize, Deserialize)]
1473#[serde(untagged)]
1474pub enum GetUserGroupError {
1475    DefaultResponse(models::ErrorSchema),
1476    UnknownValue(serde_json::Value),
1477}
1478
1479/// struct for typed errors of method
1480/// [`WorkspaceManagementApi::get_user_groups`]
1481#[derive(Debug, Clone, Serialize, Deserialize)]
1482#[serde(untagged)]
1483pub enum GetUserGroupsError {
1484    DefaultResponse(models::ErrorSchema),
1485    UnknownValue(serde_json::Value),
1486}
1487
1488/// struct for typed errors of method [`WorkspaceManagementApi::get_users`]
1489#[derive(Debug, Clone, Serialize, Deserialize)]
1490#[serde(untagged)]
1491pub enum GetUsersError {
1492    DefaultResponse(models::ErrorSchema),
1493    UnknownValue(serde_json::Value),
1494}
1495
1496/// struct for typed errors of method
1497/// [`WorkspaceManagementApi::get_whitelist_ip_addresses`]
1498#[derive(Debug, Clone, Serialize, Deserialize)]
1499#[serde(untagged)]
1500pub enum GetWhitelistIpAddressesError {
1501    Status401(models::ErrorResponse),
1502    Status403(models::ErrorResponse),
1503    Status5XX(models::ErrorResponse),
1504    DefaultResponse(models::ErrorSchema),
1505    UnknownValue(serde_json::Value),
1506}
1507
1508/// struct for typed errors of method
1509/// [`WorkspaceManagementApi::get_workspace_status`]
1510#[derive(Debug, Clone, Serialize, Deserialize)]
1511#[serde(untagged)]
1512pub enum GetWorkspaceStatusError {
1513    Status404(),
1514    UnknownValue(serde_json::Value),
1515}
1516
1517/// struct for typed errors of method [`WorkspaceManagementApi::reset_device`]
1518#[derive(Debug, Clone, Serialize, Deserialize)]
1519#[serde(untagged)]
1520pub enum ResetDeviceError {
1521    Status401(models::ErrorResponse),
1522    Status403(models::ErrorResponse),
1523    Status5XX(models::ErrorResponse),
1524    DefaultResponse(models::ErrorSchema),
1525    UnknownValue(serde_json::Value),
1526}
1527
1528/// struct for typed errors of method [`WorkspaceManagementApi::set_ota_status`]
1529#[derive(Debug, Clone, Serialize, Deserialize)]
1530#[serde(untagged)]
1531pub enum SetOtaStatusError {
1532    Status400(),
1533    Status409(),
1534    Status500(),
1535    UnknownValue(serde_json::Value),
1536}
1537
1538/// struct for typed errors of method
1539/// [`WorkspaceManagementApi::update_user_group`]
1540#[derive(Debug, Clone, Serialize, Deserialize)]
1541#[serde(untagged)]
1542pub enum UpdateUserGroupError {
1543    DefaultResponse(models::ErrorSchema),
1544    UnknownValue(serde_json::Value),
1545}