use reqwest;
use super::ResponseContent;
use super::{Error, configuration};
#[derive(Clone, Debug, Default)]
pub struct CreateIncomingWebhookParams {
pub create_incoming_webhook_request: crate::openapi::models::CreateIncomingWebhookRequest,
}
#[derive(Clone, Debug, Default)]
pub struct CreateOutgoingWebhookParams {
pub create_outgoing_webhook_request: crate::openapi::models::CreateOutgoingWebhookRequest,
}
#[derive(Clone, Debug, Default)]
pub struct DeleteIncomingWebhookParams {
pub hook_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct DeleteOutgoingWebhookParams {
pub hook_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct GetIncomingWebhookParams {
pub hook_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct GetIncomingWebhooksParams {
pub page: Option<i32>,
pub per_page: Option<i32>,
pub team_id: Option<String>,
}
#[derive(Clone, Debug, Default)]
pub struct GetOutgoingWebhookParams {
pub hook_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct GetOutgoingWebhooksParams {
pub page: Option<i32>,
pub per_page: Option<i32>,
pub team_id: Option<String>,
pub channel_id: Option<String>,
}
#[derive(Clone, Debug, Default)]
pub struct RegenOutgoingHookTokenParams {
pub hook_id: String,
}
#[derive(Clone, Debug, Default)]
pub struct UpdateIncomingWebhookParams {
pub hook_id: String,
pub update_incoming_webhook_request: crate::openapi::models::UpdateIncomingWebhookRequest,
}
#[derive(Clone, Debug, Default)]
pub struct UpdateOutgoingWebhookParams {
pub hook_id: String,
pub update_outgoing_webhook_request: crate::openapi::models::UpdateOutgoingWebhookRequest,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum CreateIncomingWebhookError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum CreateOutgoingWebhookError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status404(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum DeleteIncomingWebhookError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status404(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum DeleteOutgoingWebhookError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status404(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetIncomingWebhookError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status404(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetIncomingWebhooksError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetOutgoingWebhookError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status404(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum GetOutgoingWebhooksError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status404(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum RegenOutgoingHookTokenError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status404(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum UpdateIncomingWebhookError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status404(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
pub enum UpdateOutgoingWebhookError {
Status400(crate::openapi::models::AppError),
Status401(crate::openapi::models::AppError),
Status403(crate::openapi::models::AppError),
Status404(crate::openapi::models::AppError),
UnknownValue(serde_json::Value),
}
pub async fn create_incoming_webhook(
configuration: &configuration::Configuration,
params: CreateIncomingWebhookParams,
) -> Result<crate::openapi::models::IncomingWebhook, Error<CreateIncomingWebhookError>> {
let local_var_configuration = configuration;
let create_incoming_webhook_request = params.create_incoming_webhook_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/incoming",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&create_incoming_webhook_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CreateIncomingWebhookError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn create_outgoing_webhook(
configuration: &configuration::Configuration,
params: CreateOutgoingWebhookParams,
) -> Result<crate::openapi::models::OutgoingWebhook, Error<CreateOutgoingWebhookError>> {
let local_var_configuration = configuration;
let create_outgoing_webhook_request = params.create_outgoing_webhook_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/outgoing",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&create_outgoing_webhook_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CreateOutgoingWebhookError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn delete_incoming_webhook(
configuration: &configuration::Configuration,
params: DeleteIncomingWebhookParams,
) -> Result<crate::openapi::models::StatusOk, Error<DeleteIncomingWebhookError>> {
let local_var_configuration = configuration;
let hook_id = params.hook_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/incoming/{hook_id}",
local_var_configuration.base_path,
hook_id = super::urlencode(hook_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DeleteIncomingWebhookError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn delete_outgoing_webhook(
configuration: &configuration::Configuration,
params: DeleteOutgoingWebhookParams,
) -> Result<crate::openapi::models::StatusOk, Error<DeleteOutgoingWebhookError>> {
let local_var_configuration = configuration;
let hook_id = params.hook_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/outgoing/{hook_id}",
local_var_configuration.base_path,
hook_id = super::urlencode(hook_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DeleteOutgoingWebhookError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_incoming_webhook(
configuration: &configuration::Configuration,
params: GetIncomingWebhookParams,
) -> Result<crate::openapi::models::IncomingWebhook, Error<GetIncomingWebhookError>> {
let local_var_configuration = configuration;
let hook_id = params.hook_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/incoming/{hook_id}",
local_var_configuration.base_path,
hook_id = super::urlencode(hook_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetIncomingWebhookError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_incoming_webhooks(
configuration: &configuration::Configuration,
params: GetIncomingWebhooksParams,
) -> Result<Vec<crate::openapi::models::IncomingWebhook>, Error<GetIncomingWebhooksError>> {
let local_var_configuration = configuration;
let page = params.page;
let per_page = params.per_page;
let team_id = params.team_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/incoming",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = page {
local_var_req_builder =
local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder =
local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = team_id {
local_var_req_builder =
local_var_req_builder.query(&[("team_id", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetIncomingWebhooksError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_outgoing_webhook(
configuration: &configuration::Configuration,
params: GetOutgoingWebhookParams,
) -> Result<crate::openapi::models::OutgoingWebhook, Error<GetOutgoingWebhookError>> {
let local_var_configuration = configuration;
let hook_id = params.hook_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/outgoing/{hook_id}",
local_var_configuration.base_path,
hook_id = super::urlencode(hook_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetOutgoingWebhookError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_outgoing_webhooks(
configuration: &configuration::Configuration,
params: GetOutgoingWebhooksParams,
) -> Result<Vec<crate::openapi::models::OutgoingWebhook>, Error<GetOutgoingWebhooksError>> {
let local_var_configuration = configuration;
let page = params.page;
let per_page = params.per_page;
let team_id = params.team_id;
let channel_id = params.channel_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/outgoing",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = page {
local_var_req_builder =
local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = per_page {
local_var_req_builder =
local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = team_id {
local_var_req_builder =
local_var_req_builder.query(&[("team_id", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = channel_id {
local_var_req_builder =
local_var_req_builder.query(&[("channel_id", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetOutgoingWebhooksError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn regen_outgoing_hook_token(
configuration: &configuration::Configuration,
params: RegenOutgoingHookTokenParams,
) -> Result<crate::openapi::models::StatusOk, Error<RegenOutgoingHookTokenError>> {
let local_var_configuration = configuration;
let hook_id = params.hook_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/outgoing/{hook_id}/regen_token",
local_var_configuration.base_path,
hook_id = super::urlencode(hook_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<RegenOutgoingHookTokenError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn update_incoming_webhook(
configuration: &configuration::Configuration,
params: UpdateIncomingWebhookParams,
) -> Result<crate::openapi::models::IncomingWebhook, Error<UpdateIncomingWebhookError>> {
let local_var_configuration = configuration;
let hook_id = params.hook_id;
let update_incoming_webhook_request = params.update_incoming_webhook_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/incoming/{hook_id}",
local_var_configuration.base_path,
hook_id = super::urlencode(hook_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&update_incoming_webhook_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdateIncomingWebhookError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
pub async fn update_outgoing_webhook(
configuration: &configuration::Configuration,
params: UpdateOutgoingWebhookParams,
) -> Result<crate::openapi::models::OutgoingWebhook, Error<UpdateOutgoingWebhookError>> {
let local_var_configuration = configuration;
let hook_id = params.hook_id;
let update_outgoing_webhook_request = params.update_outgoing_webhook_request;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/api/v4/hooks/outgoing/{hook_id}",
local_var_configuration.base_path,
hook_id = super::urlencode(hook_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&update_outgoing_webhook_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdateOutgoingWebhookError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}