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 HighlightsApi<'a> {
pub(crate) client: &'a Client,
}
#[derive(Debug, Clone, Serialize)]
pub struct ListParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub page: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
impl Default for ListParams {
#[allow(deprecated)]
fn default() -> Self {
Self {
limit: Some(15),
page: Some(1),
pagination: Some(true),
x_store: Default::default(),
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct CreateParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkCreateHighlightRequestMultipartFormData,
}
impl CreateParams {
#[allow(deprecated)]
pub fn new(body: SdkCreateHighlightRequestMultipartFormData) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct SearchParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub page: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pagination: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkSearchHighlightsRequestApplicationJson,
}
impl SearchParams {
#[allow(deprecated)]
pub fn new(body: SdkSearchHighlightsRequestApplicationJson) -> Self {
Self {
limit: Some(15),
page: Some(1),
pagination: Some(true),
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct ReorderParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkReorderHighlightsRequestApplicationJson,
}
impl ReorderParams {
#[allow(deprecated)]
pub fn new(body: SdkReorderHighlightsRequestApplicationJson) -> 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, Serialize)]
pub struct ReplaceParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkReplaceHighlightRequestApplicationJson,
}
impl ReplaceParams {
#[allow(deprecated)]
pub fn new(body: SdkReplaceHighlightRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct UpdateParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkUpdateHighlightRequestApplicationJson,
}
impl UpdateParams {
#[allow(deprecated)]
pub fn new(body: SdkUpdateHighlightRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct DeleteParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
impl<'a> HighlightsApi<'a> {
pub async fn list(
&self,
params: ListParams,
) -> Result<SdkListHighlightsResponseValue200ApplicationJson, Error> {
self.list_with_options(params, None).await
}
pub async fn list_with_options(
&self,
params: ListParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkListHighlightsResponseValue200ApplicationJson, 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<SdkListHighlightsResponseValue200ApplicationJson>, Error> {
let path = "/v2/highlights".to_string();
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("listHighlights".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/highlights",
)
.await
}
pub async fn create(
&self,
params: CreateParams,
) -> Result<SdkCreateHighlightResponseValue201ApplicationJson, Error> {
self.create_with_options(params, None).await
}
pub async fn create_with_options(
&self,
params: CreateParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkCreateHighlightResponseValue201ApplicationJson, Error> {
self.create_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn create_raw(
&self,
params: CreateParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkCreateHighlightResponseValue201ApplicationJson>, Error> {
let path = "/v2/highlights".to_string();
let method = http::Method::POST;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("createHighlight".to_string());
merged.body_encoding = crate::BodyEncoding::Multipart;
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"POST /v2/highlights",
)
.await
}
pub async fn search(
&self,
params: SearchParams,
) -> Result<SdkSearchHighlightsResponseValue200ApplicationJson, Error> {
self.search_with_options(params, None).await
}
pub async fn search_with_options(
&self,
params: SearchParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkSearchHighlightsResponseValue200ApplicationJson, Error> {
self.search_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn search_raw(
&self,
params: SearchParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkSearchHighlightsResponseValue200ApplicationJson>, Error> {
let path = "/v2/highlights/search".to_string();
let method = http::Method::POST;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("searchHighlights".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"POST /v2/highlights/search",
)
.await
}
pub async fn reorder(
&self,
params: ReorderParams,
) -> Result<SdkReorderHighlightsResponseValue200ApplicationJson, Error> {
self.reorder_with_options(params, None).await
}
pub async fn reorder_with_options(
&self,
params: ReorderParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkReorderHighlightsResponseValue200ApplicationJson, Error> {
self.reorder_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn reorder_raw(
&self,
params: ReorderParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkReorderHighlightsResponseValue200ApplicationJson>, Error>
{
let path = "/v2/highlights/reorder".to_string();
let method = http::Method::PATCH;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("reorderHighlights".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"PATCH /v2/highlights/reorder",
)
.await
}
pub async fn get(
&self,
highlight: &str,
params: GetParams,
) -> Result<SdkGetHighlightResponseValue200ApplicationJson, Error> {
self.get_with_options(highlight, params, None).await
}
pub async fn get_with_options(
&self,
highlight: &str,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkGetHighlightResponseValue200ApplicationJson, Error> {
self.get_raw(highlight, params, options)
.await
.map(|response| response.data)
}
pub async fn get_raw(
&self,
highlight: &str,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkGetHighlightResponseValue200ApplicationJson>, Error> {
let highlight = crate::client::path_segment(highlight);
let path = format!("/v2/highlights/{highlight}");
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("getHighlight".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/highlights/{highlight}",
)
.await
}
pub async fn replace(
&self,
highlight: &str,
params: ReplaceParams,
) -> Result<SdkReplaceHighlightResponseValue200ApplicationJson, Error> {
self.replace_with_options(highlight, params, None).await
}
pub async fn replace_with_options(
&self,
highlight: &str,
params: ReplaceParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkReplaceHighlightResponseValue200ApplicationJson, Error> {
self.replace_raw(highlight, params, options)
.await
.map(|response| response.data)
}
pub async fn replace_raw(
&self,
highlight: &str,
params: ReplaceParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkReplaceHighlightResponseValue200ApplicationJson>, Error> {
let highlight = crate::client::path_segment(highlight);
let path = format!("/v2/highlights/{highlight}");
let method = http::Method::PUT;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("replaceHighlight".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"PUT /v2/highlights/{highlight}",
)
.await
}
pub async fn update(
&self,
highlight: &str,
params: UpdateParams,
) -> Result<SdkUpdateHighlightResponseValue200ApplicationJson, Error> {
self.update_with_options(highlight, params, None).await
}
pub async fn update_with_options(
&self,
highlight: &str,
params: UpdateParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkUpdateHighlightResponseValue200ApplicationJson, Error> {
self.update_raw(highlight, params, options)
.await
.map(|response| response.data)
}
pub async fn update_raw(
&self,
highlight: &str,
params: UpdateParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkUpdateHighlightResponseValue200ApplicationJson>, Error> {
let highlight = crate::client::path_segment(highlight);
let path = format!("/v2/highlights/{highlight}");
let method = http::Method::PATCH;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("updateHighlight".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"PATCH /v2/highlights/{highlight}",
)
.await
}
pub async fn delete(
&self,
highlight: &str,
params: DeleteParams,
) -> Result<SdkDeleteHighlightResponseValue200ApplicationJson, Error> {
self.delete_with_options(highlight, params, None).await
}
pub async fn delete_with_options(
&self,
highlight: &str,
params: DeleteParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkDeleteHighlightResponseValue200ApplicationJson, Error> {
self.delete_raw(highlight, params, options)
.await
.map(|response| response.data)
}
pub async fn delete_raw(
&self,
highlight: &str,
params: DeleteParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkDeleteHighlightResponseValue200ApplicationJson>, Error> {
let highlight = crate::client::path_segment(highlight);
let path = format!("/v2/highlights/{highlight}");
let method = http::Method::DELETE;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("deleteHighlight".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"DELETE /v2/highlights/{highlight}",
)
.await
}
}