use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct ListsGetAList<'a> {
client: &'a crate::Client,
account_id: Result<types::ListsAccountId, String>,
list_id: Result<types::ListsListId, String>,
}
impl<'a> ListsGetAList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `ListsAccountId` for account_id failed".to_string());
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsListId>,
{
self.list_id = value
.try_into()
.map_err(|_| "conversion to `ListsListId` for list_id failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
list_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/rules/lists/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "lists_get_a_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ListsUpdateAList<'a> {
client: &'a crate::Client,
account_id: Result<types::ListsAccountId, String>,
list_id: Result<types::ListsListId, String>,
body: Result<types::builder::ListsUpdateAListBody, String>,
}
impl<'a> ListsUpdateAList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `ListsAccountId` for account_id failed".to_string());
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsListId>,
{
self.list_id = value
.try_into()
.map_err(|_| "conversion to `ListsListId` for list_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsUpdateAListBody>,
<V as std::convert::TryInto<types::ListsUpdateAListBody>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ListsUpdateAListBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ListsUpdateAListBody,
) -> types::builder::ListsUpdateAListBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
list_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::ListsUpdateAListBody::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/rules/lists/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "lists_update_a_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ListsDeleteAList<'a> {
client: &'a crate::Client,
account_id: Result<types::ListsAccountId, String>,
list_id: Result<types::ListsListId, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> ListsDeleteAList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `ListsAccountId` for account_id failed".to_string());
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsListId>,
{
self.list_id = value
.try_into()
.map_err(|_| "conversion to `ListsListId` for list_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
list_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/rules/lists/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "lists_delete_a_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ListsGetListItems<'a> {
client: &'a crate::Client,
account_id: Result<types::ListsAccountId, String>,
list_id: Result<types::ListsListId, String>,
cursor: Result<::std::string::String, String>,
per_page: Result<::std::num::NonZeroU64, String>,
search: Result<::std::string::String, String>,
}
impl<'a> ListsGetListItems<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
cursor: Err("cursor was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
search: Err("search was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `ListsAccountId` for account_id failed".to_string());
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsListId>,
{
self.list_id = value
.try_into()
.map_err(|_| "conversion to `ListsListId` for list_id failed".to_string());
self
}
pub fn cursor<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.cursor = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for cursor failed".to_string()
});
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.per_page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for per_page failed".to_string()
});
self
}
pub fn search<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.search = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for search failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
list_id,
cursor,
per_page,
search,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let cursor = cursor.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let search = search.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/rules/lists/{}/items",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("cursor", &cursor))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("search", &search))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "lists_get_list_items",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ListsUpdateAllListItems<'a> {
client: &'a crate::Client,
account_id: Result<types::ListsAccountId, String>,
list_id: Result<types::ListsListId, String>,
body: Result<types::ListsItemsUpdateRequestCollection, String>,
}
impl<'a> ListsUpdateAllListItems<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `ListsAccountId` for account_id failed".to_string());
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsListId>,
{
self.list_id = value
.try_into()
.map_err(|_| "conversion to `ListsListId` for list_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsItemsUpdateRequestCollection>,
{
self.body = value.try_into().map_err(|_| {
"conversion to `ListsItemsUpdateRequestCollection` for body failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
list_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/rules/lists/{}/items",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "lists_update_all_list_items",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ListsCreateListItems<'a> {
client: &'a crate::Client,
account_id: Result<types::ListsAccountId, String>,
list_id: Result<types::ListsListId, String>,
body: Result<types::ListsItemsUpdateRequestCollection, String>,
}
impl<'a> ListsCreateListItems<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `ListsAccountId` for account_id failed".to_string());
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsListId>,
{
self.list_id = value
.try_into()
.map_err(|_| "conversion to `ListsListId` for list_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsItemsUpdateRequestCollection>,
{
self.body = value.try_into().map_err(|_| {
"conversion to `ListsItemsUpdateRequestCollection` for body failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
list_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/rules/lists/{}/items",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "lists_create_list_items",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ListsDeleteListItems<'a> {
client: &'a crate::Client,
account_id: Result<types::ListsAccountId, String>,
list_id: Result<types::ListsListId, String>,
body: Result<types::builder::ListsDeleteListItemsBody, String>,
}
impl<'a> ListsDeleteListItems<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `ListsAccountId` for account_id failed".to_string());
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsListId>,
{
self.list_id = value
.try_into()
.map_err(|_| "conversion to `ListsListId` for list_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsDeleteListItemsBody>,
<V as std::convert::TryInto<types::ListsDeleteListItemsBody>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ListsDeleteListItemsBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ListsDeleteListItemsBody,
) -> types::builder::ListsDeleteListItemsBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
list_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::ListsDeleteListItemsBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/rules/lists/{}/items",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "lists_delete_list_items",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ListsGetAListItem<'a> {
client: &'a crate::Client,
account_id: Result<types::ListsAccountId, String>,
list_id: Result<types::ListsListId, String>,
item_id: Result<types::ListsItemId, String>,
}
impl<'a> ListsGetAListItem<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
item_id: Err("item_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `ListsAccountId` for account_id failed".to_string());
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsListId>,
{
self.list_id = value
.try_into()
.map_err(|_| "conversion to `ListsListId` for list_id failed".to_string());
self
}
pub fn item_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsItemId>,
{
self.item_id = value
.try_into()
.map_err(|_| "conversion to `ListsItemId` for item_id failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
list_id,
item_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let item_id = item_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/rules/lists/{}/items/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_id.to_string()),
encode_path(&item_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "lists_get_a_list_item",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ListsGetBulkOperationStatus<'a> {
client: &'a crate::Client,
account_id: Result<types::ListsAccountId, String>,
operation_id: Result<types::ListsOperationId, String>,
}
impl<'a> ListsGetBulkOperationStatus<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
operation_id: Err("operation_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `ListsAccountId` for account_id failed".to_string());
self
}
pub fn operation_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ListsOperationId>,
{
self.operation_id = value.try_into().map_err(|_| {
"conversion to `ListsOperationId` for operation_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
operation_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let operation_id = operation_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/rules/lists/bulk_operations/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&operation_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "lists_get_bulk_operation_status",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}