use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct McpPortalsApiListPortals<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<::std::num::NonZeroU64, String>,
search: Result<::std::string::String, String>,
}
impl<'a> McpPortalsApiListPortals<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
page: Err("page 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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for page 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,
page,
per_page,
search,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let search = search.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/portals",
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"),
)
.query(&progenitor_client::QueryParam::new("page", &page))
.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: "mcp_portals_api_list_portals",
};
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 McpPortalsApiCreatePortals<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<types::builder::McpPortalsApiCreatePortalsBody, String>,
}
impl<'a> McpPortalsApiCreatePortals<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiCreatePortalsBody>,
<V as std::convert::TryInto<types::McpPortalsApiCreatePortalsBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `McpPortalsApiCreatePortalsBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::McpPortalsApiCreatePortalsBody,
) -> types::builder::McpPortalsApiCreatePortalsBody,
{
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::McpPortalsApiCreatePortalsBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/portals",
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: "mcp_portals_api_create_portals",
};
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() {
201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct McpPortalsApiFetchGateways<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::McpPortalsApiFetchGatewaysId, String>,
}
impl<'a> McpPortalsApiFetchGateways<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiFetchGatewaysId>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `McpPortalsApiFetchGatewaysId` for 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,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/portals/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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: "mcp_portals_api_fetch_gateways",
};
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 McpPortalsApiUpdatePortals<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::McpPortalsApiUpdatePortalsId, String>,
body: Result<types::builder::McpPortalsApiUpdatePortalsBody, String>,
}
impl<'a> McpPortalsApiUpdatePortals<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiUpdatePortalsId>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `McpPortalsApiUpdatePortalsId` for id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiUpdatePortalsBody>,
<V as std::convert::TryInto<types::McpPortalsApiUpdatePortalsBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `McpPortalsApiUpdatePortalsBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::McpPortalsApiUpdatePortalsBody,
) -> types::builder::McpPortalsApiUpdatePortalsBody,
{
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,
id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::McpPortalsApiUpdatePortalsBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/portals/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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: "mcp_portals_api_update_portals",
};
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 McpPortalsApiDeletePortals<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::McpPortalsApiDeletePortalsId, String>,
}
impl<'a> McpPortalsApiDeletePortals<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiDeletePortalsId>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `McpPortalsApiDeletePortalsId` for 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,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/portals/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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: "mcp_portals_api_delete_portals",
};
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 McpPortalsApiListServers<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
page: Result<::std::num::NonZeroU64, String>,
per_page: Result<::std::num::NonZeroU64, String>,
search: Result<::std::string::String, String>,
}
impl<'a> McpPortalsApiListServers<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
page: Err("page 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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::num::NonZeroU64>,
{
self.page = value.try_into().map_err(|_| {
"conversion to `:: std :: num :: NonZeroU64` for page 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,
page,
per_page,
search,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let search = search.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/servers",
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"),
)
.query(&progenitor_client::QueryParam::new("page", &page))
.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: "mcp_portals_api_list_servers",
};
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 McpPortalsApiCreateServers<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<types::builder::McpPortalsApiCreateServersBody, String>,
}
impl<'a> McpPortalsApiCreateServers<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiCreateServersBody>,
<V as std::convert::TryInto<types::McpPortalsApiCreateServersBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `McpPortalsApiCreateServersBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::McpPortalsApiCreateServersBody,
) -> types::builder::McpPortalsApiCreateServersBody,
{
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::McpPortalsApiCreateServersBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/servers",
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: "mcp_portals_api_create_servers",
};
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() {
201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct McpPortalsApiFetchServers<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::McpPortalsApiFetchServersId, String>,
}
impl<'a> McpPortalsApiFetchServers<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiFetchServersId>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `McpPortalsApiFetchServersId` for 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,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/servers/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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: "mcp_portals_api_fetch_servers",
};
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 McpPortalsApiUpdateServers<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::McpPortalsApiUpdateServersId, String>,
body: Result<types::builder::McpPortalsApiUpdateServersBody, String>,
}
impl<'a> McpPortalsApiUpdateServers<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiUpdateServersId>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `McpPortalsApiUpdateServersId` for id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiUpdateServersBody>,
<V as std::convert::TryInto<types::McpPortalsApiUpdateServersBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `McpPortalsApiUpdateServersBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::McpPortalsApiUpdateServersBody,
) -> types::builder::McpPortalsApiUpdateServersBody,
{
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,
id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::McpPortalsApiUpdateServersBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/servers/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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: "mcp_portals_api_update_servers",
};
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 McpPortalsApiDeleteServers<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::McpPortalsApiDeleteServersId, String>,
}
impl<'a> McpPortalsApiDeleteServers<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiDeleteServersId>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `McpPortalsApiDeleteServersId` for 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,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/servers/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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: "mcp_portals_api_delete_servers",
};
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 McpPortalsApiSyncServer<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
id: Result<types::McpPortalsApiSyncServerId, String>,
}
impl<'a> McpPortalsApiSyncServer<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::McpPortalsApiSyncServerId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `McpPortalsApiSyncServerId` for 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,
id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/ai-controls/mcp/servers/{}/sync",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "mcp_portals_api_sync_server",
};
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)),
}
}
}