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 StoreCustomDomainsApi<'a> {
pub(crate) client: &'a Client,
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct ListParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct ConnectParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkConnectCustomDomainRequestApplicationJson,
}
impl ConnectParams {
#[allow(deprecated)]
pub fn new(body: SdkConnectCustomDomainRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[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, Default, Serialize)]
pub struct DisconnectParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct RefreshParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
impl<'a> StoreCustomDomainsApi<'a> {
pub async fn list(
&self,
params: ListParams,
) -> Result<SdkListCustomDomainsResponseValue200ApplicationJson, Error> {
self.list_with_options(params, None).await
}
pub async fn list_with_options(
&self,
params: ListParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkListCustomDomainsResponseValue200ApplicationJson, Error> {
self.list_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn list_raw(
&self,
params: ListParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkListCustomDomainsResponseValue200ApplicationJson>, Error>
{
let path = "/v2/store/custom-domains".to_string();
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("listCustomDomains".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/store/custom-domains",
)
.await
}
pub async fn connect(
&self,
params: ConnectParams,
) -> Result<SdkConnectCustomDomainResponseValue201ApplicationJson, Error> {
self.connect_with_options(params, None).await
}
pub async fn connect_with_options(
&self,
params: ConnectParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkConnectCustomDomainResponseValue201ApplicationJson, Error> {
self.connect_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn connect_raw(
&self,
params: ConnectParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkConnectCustomDomainResponseValue201ApplicationJson>, Error>
{
let path = "/v2/store/custom-domains".to_string();
let method = http::Method::POST;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("connectCustomDomain".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"POST /v2/store/custom-domains",
)
.await
}
pub async fn get(
&self,
custom_domain: &str,
params: GetParams,
) -> Result<SdkGetCustomDomainResponseValue200ApplicationJson, Error> {
self.get_with_options(custom_domain, params, None).await
}
pub async fn get_with_options(
&self,
custom_domain: &str,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkGetCustomDomainResponseValue200ApplicationJson, Error> {
self.get_raw(custom_domain, params, options)
.await
.map(|response| response.data)
}
pub async fn get_raw(
&self,
custom_domain: &str,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkGetCustomDomainResponseValue200ApplicationJson>, Error> {
let custom_domain = crate::client::path_segment(custom_domain);
let path = format!("/v2/store/custom-domains/{custom_domain}");
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("getCustomDomain".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/store/custom-domains/{customDomain}",
)
.await
}
pub async fn disconnect(
&self,
custom_domain: &str,
params: DisconnectParams,
) -> Result<SdkDisconnectCustomDomainResponseValue200ApplicationJson, Error> {
self.disconnect_with_options(custom_domain, params, None)
.await
}
pub async fn disconnect_with_options(
&self,
custom_domain: &str,
params: DisconnectParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkDisconnectCustomDomainResponseValue200ApplicationJson, Error> {
self.disconnect_raw(custom_domain, params, options)
.await
.map(|response| response.data)
}
pub async fn disconnect_raw(
&self,
custom_domain: &str,
params: DisconnectParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkDisconnectCustomDomainResponseValue200ApplicationJson>, Error>
{
let custom_domain = crate::client::path_segment(custom_domain);
let path = format!("/v2/store/custom-domains/{custom_domain}");
let method = http::Method::DELETE;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("disconnectCustomDomain".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"DELETE /v2/store/custom-domains/{customDomain}",
)
.await
}
pub async fn refresh(
&self,
custom_domain: &str,
params: RefreshParams,
) -> Result<SdkRefreshCustomDomainStatusResponseValue200ApplicationJson, Error> {
self.refresh_with_options(custom_domain, params, None).await
}
pub async fn refresh_with_options(
&self,
custom_domain: &str,
params: RefreshParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkRefreshCustomDomainStatusResponseValue200ApplicationJson, Error> {
self.refresh_raw(custom_domain, params, options)
.await
.map(|response| response.data)
}
pub async fn refresh_raw(
&self,
custom_domain: &str,
params: RefreshParams,
options: Option<&crate::RequestOptions>,
) -> Result<
crate::RawResponse<SdkRefreshCustomDomainStatusResponseValue200ApplicationJson>,
Error,
> {
let custom_domain = crate::client::path_segment(custom_domain);
let path = format!("/v2/store/custom-domains/{custom_domain}/refresh");
let method = http::Method::POST;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("refreshCustomDomainStatus".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"POST /v2/store/custom-domains/{customDomain}/refresh",
)
.await
}
}