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 DisputesApi<'a> {
pub(crate) client: &'a Client,
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct ListDisputesParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetDisputeParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
impl<'a> DisputesApi<'a> {
pub async fn list_disputes(
&self,
params: ListDisputesParams,
) -> Result<SdkListDisputesResponseValue200ApplicationJson, Error> {
self.list_disputes_with_options(params, None).await
}
pub async fn list_disputes_with_options(
&self,
params: ListDisputesParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkListDisputesResponseValue200ApplicationJson, Error> {
self.list_disputes_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn list_disputes_raw(
&self,
params: ListDisputesParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkListDisputesResponseValue200ApplicationJson>, Error> {
let path = "/v2/disputes".to_string();
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("listDisputes".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(method, &path, ¶ms, options, "GET /v2/disputes")
.await
}
pub async fn get_dispute(
&self,
dispute: &str,
params: GetDisputeParams,
) -> Result<SdkGetDisputeResponseValue200ApplicationJson, Error> {
self.get_dispute_with_options(dispute, params, None).await
}
pub async fn get_dispute_with_options(
&self,
dispute: &str,
params: GetDisputeParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkGetDisputeResponseValue200ApplicationJson, Error> {
self.get_dispute_raw(dispute, params, options)
.await
.map(|response| response.data)
}
pub async fn get_dispute_raw(
&self,
dispute: &str,
params: GetDisputeParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkGetDisputeResponseValue200ApplicationJson>, Error> {
let dispute = crate::client::path_segment(dispute);
let path = format!("/v2/disputes/{dispute}");
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("getDispute".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/disputes/{dispute}",
)
.await
}
}