use crate::client::Client;
#[allow(unused_imports)]
use crate::enums::*;
use crate::error::Error;
#[allow(unused_imports)]
use crate::models::*;
#[allow(unused_imports)]
use serde::Serialize;
pub struct WalletSettingsApi<'a> {
pub(crate) client: &'a Client,
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct ReplaceParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkReplaceWalletSettingsRequestApplicationJson,
}
impl ReplaceParams {
#[allow(deprecated)]
pub fn new(body: SdkReplaceWalletSettingsRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
impl<'a> WalletSettingsApi<'a> {
pub async fn get(
&self,
params: GetParams,
) -> Result<SdkGetWalletSettingsResponseValue200ApplicationJson, Error> {
self.get_with_options(params, None).await
}
pub async fn get_with_options(
&self,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkGetWalletSettingsResponseValue200ApplicationJson, Error> {
self.get_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn get_raw(
&self,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkGetWalletSettingsResponseValue200ApplicationJson>, Error>
{
let path = "/v2/wallet/settings".to_string();
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("getWalletSettings".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/wallet/settings",
)
.await
}
pub async fn replace(
&self,
params: ReplaceParams,
) -> Result<SdkReplaceWalletSettingsResponseValue200ApplicationJson, Error> {
self.replace_with_options(params, None).await
}
pub async fn replace_with_options(
&self,
params: ReplaceParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkReplaceWalletSettingsResponseValue200ApplicationJson, Error> {
self.replace_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn replace_raw(
&self,
params: ReplaceParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkReplaceWalletSettingsResponseValue200ApplicationJson>, Error>
{
let path = "/v2/wallet/settings".to_string();
let method = http::Method::PUT;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("replaceWalletSettings".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"PUT /v2/wallet/settings",
)
.await
}
}