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