use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct CloudforceOneRequestList<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
body: Result<types::builder::CloudforceOneRequestsRequestList, String>,
}
impl<'a> CloudforceOneRequestList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsRequestList>,
<V as std::convert::TryInto<types::CloudforceOneRequestsRequestList>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsRequestList` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsRequestList,
) -> types::builder::CloudforceOneRequestsRequestList,
{
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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsRequestList::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests",
client.baseurl,
encode_path(&account_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: "cloudforce_one_request_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 CloudforceOneRequestGet<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
}
impl<'a> CloudforceOneRequestGet<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_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,
request_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_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: "cloudforce_one_request_get",
};
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 CloudforceOneRequestUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
body: Result<types::builder::CloudforceOneRequestsRequestEdit, String>,
}
impl<'a> CloudforceOneRequestUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsRequestEdit>,
<V as std::convert::TryInto<types::CloudforceOneRequestsRequestEdit>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsRequestEdit` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsRequestEdit,
) -> types::builder::CloudforceOneRequestsRequestEdit,
{
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,
request_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsRequestEdit::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_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: "cloudforce_one_request_update",
};
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 CloudforceOneRequestDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
}
impl<'a> CloudforceOneRequestDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_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,
request_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "cloudforce_one_request_delete",
};
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 CloudforceOneRequestAssetList<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
body: Result<types::builder::CloudforceOneRequestsRequestAssetList, String>,
}
impl<'a> CloudforceOneRequestAssetList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsRequestAssetList>,
<V as std::convert::TryInto<types::CloudforceOneRequestsRequestAssetList>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsRequestAssetList` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsRequestAssetList,
)
-> types::builder::CloudforceOneRequestsRequestAssetList,
{
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,
request_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsRequestAssetList::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}/asset",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_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: "cloudforce_one_request_asset_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 CloudforceOneRequestAssetGet<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
asset_id: Result<types::CloudforceOneRequestsUuid, String>,
}
impl<'a> CloudforceOneRequestAssetGet<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_id was not initialized".to_string()),
asset_id: Err("asset_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn asset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.asset_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for asset_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,
request_id,
asset_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let asset_id = asset_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}/asset/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_id.to_string()),
encode_path(&asset_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: "cloudforce_one_request_asset_get",
};
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 CloudforceOneRequestAssetUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
asset_id: Result<types::CloudforceOneRequestsUuid, String>,
body: Result<types::builder::CloudforceOneRequestsRequestAssetEdit, String>,
}
impl<'a> CloudforceOneRequestAssetUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_id was not initialized".to_string()),
asset_id: Err("asset_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn asset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.asset_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for asset_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsRequestAssetEdit>,
<V as std::convert::TryInto<types::CloudforceOneRequestsRequestAssetEdit>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsRequestAssetEdit` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsRequestAssetEdit,
)
-> types::builder::CloudforceOneRequestsRequestAssetEdit,
{
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,
request_id,
asset_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let asset_id = asset_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsRequestAssetEdit::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}/asset/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_id.to_string()),
encode_path(&asset_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: "cloudforce_one_request_asset_update",
};
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 CloudforceOneRequestAssetDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
asset_id: Result<types::CloudforceOneRequestsUuid, String>,
}
impl<'a> CloudforceOneRequestAssetDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_id was not initialized".to_string()),
asset_id: Err("asset_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn asset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.asset_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for asset_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,
request_id,
asset_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let asset_id = asset_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}/asset/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_id.to_string()),
encode_path(&asset_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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "cloudforce_one_request_asset_delete",
};
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 CloudforceOneRequestAssetNew<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
body: Result<types::builder::CloudforceOneRequestsRequestAssetEdit, String>,
}
impl<'a> CloudforceOneRequestAssetNew<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsRequestAssetEdit>,
<V as std::convert::TryInto<types::CloudforceOneRequestsRequestAssetEdit>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsRequestAssetEdit` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsRequestAssetEdit,
)
-> types::builder::CloudforceOneRequestsRequestAssetEdit,
{
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,
request_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsRequestAssetEdit::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}/asset/new",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_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: "cloudforce_one_request_asset_new",
};
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 CloudforceOneRequestMessageList<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
body: Result<types::builder::CloudforceOneRequestsRequestMessageList, String>,
}
impl<'a> CloudforceOneRequestMessageList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsRequestMessageList>,
<V as std::convert::TryInto<types::CloudforceOneRequestsRequestMessageList>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsRequestMessageList` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsRequestMessageList,
)
-> types::builder::CloudforceOneRequestsRequestMessageList,
{
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,
request_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsRequestMessageList::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}/message",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_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: "cloudforce_one_request_message_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 CloudforceOneRequestMessageUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
message_id: Result<i64, String>,
body: Result<types::builder::CloudforceOneRequestsRequestMessageEdit, String>,
}
impl<'a> CloudforceOneRequestMessageUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_id was not initialized".to_string()),
message_id: Err("message_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn message_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.message_id = value
.try_into()
.map_err(|_| "conversion to `i64` for message_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsRequestMessageEdit>,
<V as std::convert::TryInto<types::CloudforceOneRequestsRequestMessageEdit>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsRequestMessageEdit` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsRequestMessageEdit,
)
-> types::builder::CloudforceOneRequestsRequestMessageEdit,
{
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,
request_id,
message_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let message_id = message_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsRequestMessageEdit::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}/message/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_id.to_string()),
encode_path(&message_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: "cloudforce_one_request_message_update",
};
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 CloudforceOneRequestMessageDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
message_id: Result<i64, String>,
}
impl<'a> CloudforceOneRequestMessageDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_id was not initialized".to_string()),
message_id: Err("message_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn message_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.message_id = value
.try_into()
.map_err(|_| "conversion to `i64` for message_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,
request_id,
message_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let message_id = message_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}/message/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_id.to_string()),
encode_path(&message_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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "cloudforce_one_request_message_delete",
};
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 CloudforceOneRequestMessageNew<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
request_id: Result<types::CloudforceOneRequestsUuid, String>,
body: Result<types::builder::CloudforceOneRequestsRequestMessageEdit, String>,
}
impl<'a> CloudforceOneRequestMessageNew<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
request_id: Err("request_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn request_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.request_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for request_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsRequestMessageEdit>,
<V as std::convert::TryInto<types::CloudforceOneRequestsRequestMessageEdit>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsRequestMessageEdit` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsRequestMessageEdit,
)
-> types::builder::CloudforceOneRequestsRequestMessageEdit,
{
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,
request_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let request_id = request_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsRequestMessageEdit::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/{}/message/new",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&request_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: "cloudforce_one_request_message_new",
};
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 CloudforceOneRequestConstants<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
}
impl<'a> CloudforceOneRequestConstants<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_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 } = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/constants",
client.baseurl,
encode_path(&account_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: "cloudforce_one_request_constants",
};
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 CloudforceOneRequestNew<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
body: Result<types::builder::CloudforceOneRequestsRequestEdit, String>,
}
impl<'a> CloudforceOneRequestNew<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsRequestEdit>,
<V as std::convert::TryInto<types::CloudforceOneRequestsRequestEdit>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsRequestEdit` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsRequestEdit,
) -> types::builder::CloudforceOneRequestsRequestEdit,
{
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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsRequestEdit::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/new",
client.baseurl,
encode_path(&account_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: "cloudforce_one_request_new",
};
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 CloudforceOnePriorityList<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
body: Result<types::builder::CloudforceOneRequestsPriorityList, String>,
}
impl<'a> CloudforceOnePriorityList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsPriorityList>,
<V as std::convert::TryInto<types::CloudforceOneRequestsPriorityList>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsPriorityList` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsPriorityList,
) -> types::builder::CloudforceOneRequestsPriorityList,
{
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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsPriorityList::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/priority",
client.baseurl,
encode_path(&account_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: "cloudforce_one_priority_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 CloudforceOnePriorityGet<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
priority_id: Result<types::CloudforceOneRequestsUuid, String>,
}
impl<'a> CloudforceOnePriorityGet<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
priority_id: Err("priority_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn priority_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.priority_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for priority_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,
priority_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let priority_id = priority_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/priority/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&priority_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: "cloudforce_one_priority_get",
};
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 CloudforceOnePriorityUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
priority_id: Result<types::CloudforceOneRequestsUuid, String>,
body: Result<types::builder::CloudforceOneRequestsPriorityEdit, String>,
}
impl<'a> CloudforceOnePriorityUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
priority_id: Err("priority_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn priority_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.priority_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for priority_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsPriorityEdit>,
<V as std::convert::TryInto<types::CloudforceOneRequestsPriorityEdit>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsPriorityEdit` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsPriorityEdit,
) -> types::builder::CloudforceOneRequestsPriorityEdit,
{
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,
priority_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let priority_id = priority_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsPriorityEdit::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/priority/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&priority_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: "cloudforce_one_priority_update",
};
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 CloudforceOnePriorityDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
priority_id: Result<types::CloudforceOneRequestsUuid, String>,
}
impl<'a> CloudforceOnePriorityDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
priority_id: Err("priority_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn priority_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsUuid>,
{
self.priority_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsUuid` for priority_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,
priority_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let priority_id = priority_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/priority/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&priority_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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "cloudforce_one_priority_delete",
};
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 CloudforceOnePriorityNew<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
body: Result<types::builder::CloudforceOneRequestsPriorityEdit, String>,
}
impl<'a> CloudforceOnePriorityNew<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_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::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsPriorityEdit>,
<V as std::convert::TryInto<types::CloudforceOneRequestsPriorityEdit>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CloudforceOneRequestsPriorityEdit` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CloudforceOneRequestsPriorityEdit,
) -> types::builder::CloudforceOneRequestsPriorityEdit,
{
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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CloudforceOneRequestsPriorityEdit::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/priority/new",
client.baseurl,
encode_path(&account_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: "cloudforce_one_priority_new",
};
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 CloudforceOnePriorityQuota<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
}
impl<'a> CloudforceOnePriorityQuota<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_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 } = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/priority/quota",
client.baseurl,
encode_path(&account_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: "cloudforce_one_priority_quota",
};
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 CloudforceOneRequestQuota<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
}
impl<'a> CloudforceOneRequestQuota<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_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 } = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/quota",
client.baseurl,
encode_path(&account_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: "cloudforce_one_request_quota",
};
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 CloudforceOneRequestTypes<'a> {
client: &'a crate::Client,
account_id: Result<types::CloudforceOneRequestsIdentifier, String>,
}
impl<'a> CloudforceOneRequestTypes<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CloudforceOneRequestsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CloudforceOneRequestsIdentifier` for account_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 } = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/cloudforce-one/requests/types",
client.baseurl,
encode_path(&account_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: "cloudforce_one_request_types",
};
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)),
}
}
}