use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use crate::client::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
#[derive(Clone, Debug)]
pub struct DeleteModerationVoteParams {
pub comment_id: String,
pub vote_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetApiCommentsParams {
pub page: Option<f64>,
pub count: Option<f64>,
pub text_search: Option<String>,
pub by_ip_from_comment: Option<String>,
pub filters: Option<String>,
pub search_filters: Option<String>,
pub sorts: Option<String>,
pub demo: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetApiExportStatusParams {
pub batch_job_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetApiIdsParams {
pub text_search: Option<String>,
pub by_ip_from_comment: Option<String>,
pub filters: Option<String>,
pub search_filters: Option<String>,
pub after_id: Option<String>,
pub demo: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetBanUsersFromCommentParams {
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetCommentBanStatusParams {
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetCommentChildrenParams {
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetCountParams {
pub text_search: Option<String>,
pub by_ip_from_comment: Option<String>,
pub filter: Option<String>,
pub search_filters: Option<String>,
pub demo: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetCountsParams {
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetLogsParams {
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetManualBadgesParams {
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetManualBadgesForUserParams {
pub badges_user_id: Option<String>,
pub comment_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetModerationCommentParams {
pub comment_id: String,
pub include_email: Option<bool>,
pub include_ip: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetModerationCommentTextParams {
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetPreBanSummaryParams {
pub comment_id: String,
pub include_by_user_id_and_email: Option<bool>,
pub include_by_ip: Option<bool>,
pub include_by_email_domain: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetSearchCommentsSummaryParams {
pub value: Option<String>,
pub filters: Option<String>,
pub search_filters: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetSearchPagesParams {
pub value: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetSearchSitesParams {
pub value: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetSearchSuggestParams {
pub text_search: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetSearchUsersParams {
pub value: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetTrustFactorParams {
pub user_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetUserBanPreferenceParams {
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetUserInternalProfileParams {
pub comment_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostAdjustCommentVotesParams {
pub comment_id: String,
pub adjust_comment_votes_params: models::AdjustCommentVotesParams,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostApiExportParams {
pub text_search: Option<String>,
pub by_ip_from_comment: Option<String>,
pub filters: Option<String>,
pub search_filters: Option<String>,
pub sorts: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostBanUserFromCommentParams {
pub comment_id: String,
pub ban_email: Option<bool>,
pub ban_email_domain: Option<bool>,
pub ban_ip: Option<bool>,
pub delete_all_users_comments: Option<bool>,
pub banned_until: Option<String>,
pub is_shadow_ban: Option<bool>,
pub update_id: Option<String>,
pub ban_reason: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostBanUserUndoParams {
pub ban_user_undo_params: models::BanUserUndoParams,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostBulkPreBanSummaryParams {
pub bulk_pre_ban_params: models::BulkPreBanParams,
pub include_by_user_id_and_email: Option<bool>,
pub include_by_ip: Option<bool>,
pub include_by_email_domain: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostCommentsByIdsParams {
pub comments_by_ids_params: models::CommentsByIdsParams,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostFlagCommentParams {
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostRemoveCommentParams {
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostRestoreDeletedCommentParams {
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostSetCommentApprovalStatusParams {
pub comment_id: String,
pub approved: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostSetCommentReviewStatusParams {
pub comment_id: String,
pub reviewed: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostSetCommentSpamStatusParams {
pub comment_id: String,
pub spam: Option<bool>,
pub perm_not_spam: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostSetCommentTextParams {
pub comment_id: String,
pub set_comment_text_params: models::SetCommentTextParams,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostUnFlagCommentParams {
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PostVoteParams {
pub comment_id: String,
pub direction: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PutAwardBadgeParams {
pub badge_id: String,
pub user_id: Option<String>,
pub comment_id: Option<String>,
pub broadcast_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PutCloseThreadParams {
pub url_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PutRemoveBadgeParams {
pub badge_id: String,
pub user_id: Option<String>,
pub comment_id: Option<String>,
pub broadcast_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PutReopenThreadParams {
pub url_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct SetTrustFactorParams {
pub user_id: Option<String>,
pub trust_factor: Option<String>,
pub sso: Option<String>
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteModerationVoteError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetApiCommentsError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetApiExportStatusError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetApiIdsError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBanUsersFromCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCommentBanStatusError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCommentChildrenError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCountError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCountsError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetLogsError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetManualBadgesError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetManualBadgesForUserError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetModerationCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetModerationCommentTextError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetPreBanSummaryError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSearchCommentsSummaryError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSearchPagesError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSearchSitesError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSearchSuggestError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSearchUsersError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTrustFactorError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserBanPreferenceError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserInternalProfileError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostAdjustCommentVotesError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostApiExportError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostBanUserFromCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostBanUserUndoError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostBulkPreBanSummaryError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostCommentsByIdsError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostFlagCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostRemoveCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostRestoreDeletedCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostSetCommentApprovalStatusError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostSetCommentReviewStatusError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostSetCommentSpamStatusError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostSetCommentTextError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostUnFlagCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PostVoteError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PutAwardBadgeError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PutCloseThreadError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PutRemoveBadgeError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PutReopenThreadError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetTrustFactorError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
pub async fn delete_moderation_vote(configuration: &configuration::Configuration, params: DeleteModerationVoteParams) -> Result<models::VoteDeleteResponse, Error<DeleteModerationVoteError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/vote/{commentId}/{voteId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id), voteId=crate::client::apis::urlencode(params.vote_id));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VoteDeleteResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VoteDeleteResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteModerationVoteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_api_comments(configuration: &configuration::Configuration, params: GetApiCommentsParams) -> Result<models::ModerationApiGetCommentsResponse, Error<GetApiCommentsError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/api/comments", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.page {
req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.count {
req_builder = req_builder.query(&[("count", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.text_search {
req_builder = req_builder.query(&[("text-search", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.by_ip_from_comment {
req_builder = req_builder.query(&[("byIPFromComment", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.filters {
req_builder = req_builder.query(&[("filters", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.search_filters {
req_builder = req_builder.query(&[("searchFilters", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sorts {
req_builder = req_builder.query(&[("sorts", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.demo {
req_builder = req_builder.query(&[("demo", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationApiGetCommentsResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationApiGetCommentsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetApiCommentsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_api_export_status(configuration: &configuration::Configuration, params: GetApiExportStatusParams) -> Result<models::ModerationExportStatusResponse, Error<GetApiExportStatusError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/api/export/status", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.batch_job_id {
req_builder = req_builder.query(&[("batchJobId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationExportStatusResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationExportStatusResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetApiExportStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_api_ids(configuration: &configuration::Configuration, params: GetApiIdsParams) -> Result<models::ModerationApiGetCommentIdsResponse, Error<GetApiIdsError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/api/ids", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.text_search {
req_builder = req_builder.query(&[("text-search", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.by_ip_from_comment {
req_builder = req_builder.query(&[("byIPFromComment", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.filters {
req_builder = req_builder.query(&[("filters", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.search_filters {
req_builder = req_builder.query(&[("searchFilters", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.after_id {
req_builder = req_builder.query(&[("afterId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.demo {
req_builder = req_builder.query(&[("demo", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationApiGetCommentIdsResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationApiGetCommentIdsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetApiIdsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_ban_users_from_comment(configuration: &configuration::Configuration, params: GetBanUsersFromCommentParams) -> Result<models::GetBannedUsersFromCommentResponse, Error<GetBanUsersFromCommentError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/ban-users/from-comment/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBannedUsersFromCommentResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetBannedUsersFromCommentResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetBanUsersFromCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_comment_ban_status(configuration: &configuration::Configuration, params: GetCommentBanStatusParams) -> Result<models::GetCommentBanStatusResponse, Error<GetCommentBanStatusError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/get-comment-ban-status/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCommentBanStatusResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCommentBanStatusResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCommentBanStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_comment_children(configuration: &configuration::Configuration, params: GetCommentChildrenParams) -> Result<models::ModerationApiChildCommentsResponse, Error<GetCommentChildrenError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/comment-children/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationApiChildCommentsResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationApiChildCommentsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCommentChildrenError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_count(configuration: &configuration::Configuration, params: GetCountParams) -> Result<models::ModerationApiCountCommentsResponse, Error<GetCountError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/count", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.text_search {
req_builder = req_builder.query(&[("text-search", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.by_ip_from_comment {
req_builder = req_builder.query(&[("byIPFromComment", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.search_filters {
req_builder = req_builder.query(&[("searchFilters", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.demo {
req_builder = req_builder.query(&[("demo", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationApiCountCommentsResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationApiCountCommentsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_counts(configuration: &configuration::Configuration, params: GetCountsParams) -> Result<models::GetBannedUsersCountResponse, Error<GetCountsError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/banned-users/counts", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetBannedUsersCountResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetBannedUsersCountResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCountsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_logs(configuration: &configuration::Configuration, params: GetLogsParams) -> Result<models::ModerationApiGetLogsResponse, Error<GetLogsError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/logs/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationApiGetLogsResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationApiGetLogsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetLogsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_manual_badges(configuration: &configuration::Configuration, params: GetManualBadgesParams) -> Result<models::GetTenantManualBadgesResponse, Error<GetManualBadgesError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/get-manual-badges", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTenantManualBadgesResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetTenantManualBadgesResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetManualBadgesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_manual_badges_for_user(configuration: &configuration::Configuration, params: GetManualBadgesForUserParams) -> Result<models::GetUserManualBadgesResponse, Error<GetManualBadgesForUserError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/get-manual-badges-for-user", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.badges_user_id {
req_builder = req_builder.query(&[("badgesUserId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.comment_id {
req_builder = req_builder.query(&[("commentId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUserManualBadgesResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetUserManualBadgesResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetManualBadgesForUserError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_moderation_comment(configuration: &configuration::Configuration, params: GetModerationCommentParams) -> Result<models::ModerationApiCommentResponse, Error<GetModerationCommentError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/comment/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.include_email {
req_builder = req_builder.query(&[("includeEmail", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_ip {
req_builder = req_builder.query(&[("includeIP", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationApiCommentResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationApiCommentResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetModerationCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_moderation_comment_text(configuration: &configuration::Configuration, params: GetModerationCommentTextParams) -> Result<models::GetCommentTextResponse, Error<GetModerationCommentTextError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/get-comment-text/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCommentTextResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCommentTextResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetModerationCommentTextError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_pre_ban_summary(configuration: &configuration::Configuration, params: GetPreBanSummaryParams) -> Result<models::PreBanSummary, Error<GetPreBanSummaryError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/pre-ban-summary/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.include_by_user_id_and_email {
req_builder = req_builder.query(&[("includeByUserIdAndEmail", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_by_ip {
req_builder = req_builder.query(&[("includeByIP", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_by_email_domain {
req_builder = req_builder.query(&[("includeByEmailDomain", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PreBanSummary`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PreBanSummary`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetPreBanSummaryError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_search_comments_summary(configuration: &configuration::Configuration, params: GetSearchCommentsSummaryParams) -> Result<models::ModerationCommentSearchResponse, Error<GetSearchCommentsSummaryError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/search/comments/summary", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.value {
req_builder = req_builder.query(&[("value", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.filters {
req_builder = req_builder.query(&[("filters", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.search_filters {
req_builder = req_builder.query(&[("searchFilters", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationCommentSearchResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationCommentSearchResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetSearchCommentsSummaryError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_search_pages(configuration: &configuration::Configuration, params: GetSearchPagesParams) -> Result<models::ModerationPageSearchResponse, Error<GetSearchPagesError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/search/pages", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.value {
req_builder = req_builder.query(&[("value", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationPageSearchResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationPageSearchResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetSearchPagesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_search_sites(configuration: &configuration::Configuration, params: GetSearchSitesParams) -> Result<models::ModerationSiteSearchResponse, Error<GetSearchSitesError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/search/sites", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.value {
req_builder = req_builder.query(&[("value", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationSiteSearchResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationSiteSearchResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetSearchSitesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_search_suggest(configuration: &configuration::Configuration, params: GetSearchSuggestParams) -> Result<models::ModerationSuggestResponse, Error<GetSearchSuggestError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/search/suggest", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.text_search {
req_builder = req_builder.query(&[("text-search", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationSuggestResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationSuggestResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetSearchSuggestError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_search_users(configuration: &configuration::Configuration, params: GetSearchUsersParams) -> Result<models::ModerationUserSearchResponse, Error<GetSearchUsersError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/search/users", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.value {
req_builder = req_builder.query(&[("value", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationUserSearchResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationUserSearchResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetSearchUsersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_trust_factor(configuration: &configuration::Configuration, params: GetTrustFactorParams) -> Result<models::GetUserTrustFactorResponse, Error<GetTrustFactorError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/get-trust-factor", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.user_id {
req_builder = req_builder.query(&[("userId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUserTrustFactorResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetUserTrustFactorResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTrustFactorError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_user_ban_preference(configuration: &configuration::Configuration, params: GetUserBanPreferenceParams) -> Result<models::ApiModerateGetUserBanPreferencesResponse, Error<GetUserBanPreferenceError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/user-ban-preference", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApiModerateGetUserBanPreferencesResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApiModerateGetUserBanPreferencesResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserBanPreferenceError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_user_internal_profile(configuration: &configuration::Configuration, params: GetUserInternalProfileParams) -> Result<models::GetUserInternalProfileResponse, Error<GetUserInternalProfileError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/get-user-internal-profile", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.comment_id {
req_builder = req_builder.query(&[("commentId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetUserInternalProfileResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetUserInternalProfileResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserInternalProfileError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_adjust_comment_votes(configuration: &configuration::Configuration, params: PostAdjustCommentVotesParams) -> Result<models::AdjustVotesResponse, Error<PostAdjustCommentVotesError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/adjust-comment-votes/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(¶ms.adjust_comment_votes_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AdjustVotesResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AdjustVotesResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostAdjustCommentVotesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_api_export(configuration: &configuration::Configuration, params: PostApiExportParams) -> Result<models::ModerationExportResponse, Error<PostApiExportError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/api/export", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.text_search {
req_builder = req_builder.query(&[("text-search", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.by_ip_from_comment {
req_builder = req_builder.query(&[("byIPFromComment", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.filters {
req_builder = req_builder.query(&[("filters", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.search_filters {
req_builder = req_builder.query(&[("searchFilters", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sorts {
req_builder = req_builder.query(&[("sorts", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationExportResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationExportResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostApiExportError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_ban_user_from_comment(configuration: &configuration::Configuration, params: PostBanUserFromCommentParams) -> Result<models::BanUserFromCommentResult, Error<PostBanUserFromCommentError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/ban-user/from-comment/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.ban_email {
req_builder = req_builder.query(&[("banEmail", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.ban_email_domain {
req_builder = req_builder.query(&[("banEmailDomain", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.ban_ip {
req_builder = req_builder.query(&[("banIP", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.delete_all_users_comments {
req_builder = req_builder.query(&[("deleteAllUsersComments", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.banned_until {
req_builder = req_builder.query(&[("bannedUntil", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.is_shadow_ban {
req_builder = req_builder.query(&[("isShadowBan", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.update_id {
req_builder = req_builder.query(&[("updateId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.ban_reason {
req_builder = req_builder.query(&[("banReason", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BanUserFromCommentResult`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BanUserFromCommentResult`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostBanUserFromCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_ban_user_undo(configuration: &configuration::Configuration, params: PostBanUserUndoParams) -> Result<models::ApiEmptyResponse, Error<PostBanUserUndoError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/ban-user/undo", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(¶ms.ban_user_undo_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApiEmptyResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApiEmptyResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostBanUserUndoError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_bulk_pre_ban_summary(configuration: &configuration::Configuration, params: PostBulkPreBanSummaryParams) -> Result<models::BulkPreBanSummary, Error<PostBulkPreBanSummaryError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/bulk-pre-ban-summary", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.include_by_user_id_and_email {
req_builder = req_builder.query(&[("includeByUserIdAndEmail", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_by_ip {
req_builder = req_builder.query(&[("includeByIP", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_by_email_domain {
req_builder = req_builder.query(&[("includeByEmailDomain", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(¶ms.bulk_pre_ban_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BulkPreBanSummary`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BulkPreBanSummary`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostBulkPreBanSummaryError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_comments_by_ids(configuration: &configuration::Configuration, params: PostCommentsByIdsParams) -> Result<models::ModerationApiChildCommentsResponse, Error<PostCommentsByIdsError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/comments-by-ids", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(¶ms.comments_by_ids_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ModerationApiChildCommentsResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ModerationApiChildCommentsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostCommentsByIdsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_flag_comment(configuration: &configuration::Configuration, params: PostFlagCommentParams) -> Result<models::ApiEmptyResponse, Error<PostFlagCommentError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/flag-comment/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApiEmptyResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApiEmptyResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostFlagCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_remove_comment(configuration: &configuration::Configuration, params: PostRemoveCommentParams) -> Result<models::PostRemoveCommentResponse, Error<PostRemoveCommentError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/remove-comment/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PostRemoveCommentResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PostRemoveCommentResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostRemoveCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_restore_deleted_comment(configuration: &configuration::Configuration, params: PostRestoreDeletedCommentParams) -> Result<models::ApiEmptyResponse, Error<PostRestoreDeletedCommentError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/restore-deleted-comment/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApiEmptyResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApiEmptyResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostRestoreDeletedCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_set_comment_approval_status(configuration: &configuration::Configuration, params: PostSetCommentApprovalStatusParams) -> Result<models::SetCommentApprovedResponse, Error<PostSetCommentApprovalStatusError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/set-comment-approval-status/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.approved {
req_builder = req_builder.query(&[("approved", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SetCommentApprovedResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SetCommentApprovedResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostSetCommentApprovalStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_set_comment_review_status(configuration: &configuration::Configuration, params: PostSetCommentReviewStatusParams) -> Result<models::ApiEmptyResponse, Error<PostSetCommentReviewStatusError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/set-comment-review-status/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.reviewed {
req_builder = req_builder.query(&[("reviewed", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApiEmptyResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApiEmptyResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostSetCommentReviewStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_set_comment_spam_status(configuration: &configuration::Configuration, params: PostSetCommentSpamStatusParams) -> Result<models::ApiEmptyResponse, Error<PostSetCommentSpamStatusError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/set-comment-spam-status/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.spam {
req_builder = req_builder.query(&[("spam", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.perm_not_spam {
req_builder = req_builder.query(&[("permNotSpam", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApiEmptyResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApiEmptyResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostSetCommentSpamStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_set_comment_text(configuration: &configuration::Configuration, params: PostSetCommentTextParams) -> Result<models::SetCommentTextResponse, Error<PostSetCommentTextError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/set-comment-text/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(¶ms.set_comment_text_params);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SetCommentTextResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SetCommentTextResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostSetCommentTextError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_un_flag_comment(configuration: &configuration::Configuration, params: PostUnFlagCommentParams) -> Result<models::ApiEmptyResponse, Error<PostUnFlagCommentError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/un-flag-comment/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApiEmptyResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApiEmptyResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostUnFlagCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn post_vote(configuration: &configuration::Configuration, params: PostVoteParams) -> Result<models::VoteResponse, Error<PostVoteError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/vote/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.direction {
req_builder = req_builder.query(&[("direction", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::VoteResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::VoteResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PostVoteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn put_award_badge(configuration: &configuration::Configuration, params: PutAwardBadgeParams) -> Result<models::AwardUserBadgeResponse, Error<PutAwardBadgeError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/award-badge", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
req_builder = req_builder.query(&[("badgeId", ¶ms.badge_id.to_string())]);
if let Some(ref param_value) = params.user_id {
req_builder = req_builder.query(&[("userId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.comment_id {
req_builder = req_builder.query(&[("commentId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.broadcast_id {
req_builder = req_builder.query(&[("broadcastId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AwardUserBadgeResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AwardUserBadgeResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PutAwardBadgeError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn put_close_thread(configuration: &configuration::Configuration, params: PutCloseThreadParams) -> Result<models::ApiEmptyResponse, Error<PutCloseThreadError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/close-thread", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApiEmptyResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApiEmptyResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PutCloseThreadError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn put_remove_badge(configuration: &configuration::Configuration, params: PutRemoveBadgeParams) -> Result<models::RemoveUserBadgeResponse, Error<PutRemoveBadgeError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/remove-badge", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
req_builder = req_builder.query(&[("badgeId", ¶ms.badge_id.to_string())]);
if let Some(ref param_value) = params.user_id {
req_builder = req_builder.query(&[("userId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.comment_id {
req_builder = req_builder.query(&[("commentId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.broadcast_id {
req_builder = req_builder.query(&[("broadcastId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RemoveUserBadgeResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RemoveUserBadgeResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PutRemoveBadgeError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn put_reopen_thread(configuration: &configuration::Configuration, params: PutReopenThreadParams) -> Result<models::ApiEmptyResponse, Error<PutReopenThreadError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/reopen-thread", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApiEmptyResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ApiEmptyResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PutReopenThreadError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn set_trust_factor(configuration: &configuration::Configuration, params: SetTrustFactorParams) -> Result<models::SetUserTrustFactorResponse, Error<SetTrustFactorError>> {
let uri_str = format!("{}/auth/my-account/moderate-comments/set-trust-factor", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref param_value) = params.user_id {
req_builder = req_builder.query(&[("userId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.trust_factor {
req_builder = req_builder.query(&[("trustFactor", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SetUserTrustFactorResponse`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SetUserTrustFactorResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<SetTrustFactorError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}