use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use crate::client::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
use tokio::fs::File as TokioFile;
use tokio_util::codec::{BytesCodec, FramedRead};
#[derive(Clone, Debug)]
pub struct BlockFromCommentPublicParams {
pub tenant_id: String,
pub comment_id: String,
pub public_block_from_comment_params: models::PublicBlockFromCommentParams,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct CheckedCommentsForBlockedParams {
pub tenant_id: String,
pub comment_ids: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct CreateCommentPublicParams {
pub tenant_id: String,
pub url_id: String,
pub broadcast_id: String,
pub comment_data: models::CommentData,
pub session_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct CreateFeedPostPublicParams {
pub tenant_id: String,
pub create_feed_post_params: models::CreateFeedPostParams,
pub broadcast_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct CreateV1PageReactParams {
pub tenant_id: String,
pub url_id: String,
pub title: Option<String>
}
#[derive(Clone, Debug)]
pub struct CreateV2PageReactParams {
pub tenant_id: String,
pub url_id: String,
pub id: String,
pub title: Option<String>
}
#[derive(Clone, Debug)]
pub struct DeleteCommentPublicParams {
pub tenant_id: String,
pub comment_id: String,
pub broadcast_id: String,
pub edit_key: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct DeleteCommentVoteParams {
pub tenant_id: String,
pub comment_id: String,
pub vote_id: String,
pub url_id: String,
pub broadcast_id: String,
pub edit_key: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct DeleteFeedPostPublicParams {
pub tenant_id: String,
pub post_id: String,
pub broadcast_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct DeleteV1PageReactParams {
pub tenant_id: String,
pub url_id: String
}
#[derive(Clone, Debug)]
pub struct DeleteV2PageReactParams {
pub tenant_id: String,
pub url_id: String,
pub id: String
}
#[derive(Clone, Debug)]
pub struct FlagCommentPublicParams {
pub tenant_id: String,
pub comment_id: String,
pub is_flagged: bool,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetCommentTextParams {
pub tenant_id: String,
pub comment_id: String,
pub edit_key: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetCommentVoteUserNamesParams {
pub tenant_id: String,
pub comment_id: String,
pub dir: i32,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetCommentsForUserParams {
pub user_id: Option<String>,
pub direction: Option<models::SortDirections>,
pub replies_to_user_id: Option<String>,
pub page: Option<f64>,
pub includei10n: Option<bool>,
pub locale: Option<String>,
pub is_crawler: Option<bool>
}
#[derive(Clone, Debug)]
pub struct GetCommentsPublicParams {
pub tenant_id: String,
pub url_id: String,
pub page: Option<i32>,
pub direction: Option<models::SortDirections>,
pub sso: Option<String>,
pub skip: Option<i32>,
pub skip_children: Option<i32>,
pub limit: Option<i32>,
pub limit_children: Option<i32>,
pub count_children: Option<bool>,
pub fetch_page_for_comment_id: Option<String>,
pub include_config: Option<bool>,
pub count_all: Option<bool>,
pub includei10n: Option<bool>,
pub locale: Option<String>,
pub modules: Option<String>,
pub is_crawler: Option<bool>,
pub include_notification_count: Option<bool>,
pub as_tree: Option<bool>,
pub max_tree_depth: Option<i32>,
pub use_full_translation_ids: Option<bool>,
pub parent_id: Option<String>,
pub search_text: Option<String>,
pub hash_tags: Option<Vec<String>>,
pub user_id: Option<String>,
pub custom_config_str: Option<String>,
pub after_comment_id: Option<String>,
pub before_comment_id: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetEventLogParams {
pub tenant_id: String,
pub url_id: String,
pub user_id_ws: String,
pub start_time: i64,
pub end_time: Option<i64>
}
#[derive(Clone, Debug)]
pub struct GetFeedPostsPublicParams {
pub tenant_id: String,
pub after_id: Option<String>,
pub limit: Option<i32>,
pub tags: Option<Vec<String>>,
pub sso: Option<String>,
pub is_crawler: Option<bool>,
pub include_user_info: Option<bool>
}
#[derive(Clone, Debug)]
pub struct GetFeedPostsStatsParams {
pub tenant_id: String,
pub post_ids: Vec<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetGifLargeParams {
pub tenant_id: String,
pub large_internal_url_sanitized: String
}
#[derive(Clone, Debug)]
pub struct GetGifsSearchParams {
pub tenant_id: String,
pub search: String,
pub locale: Option<String>,
pub rating: Option<String>,
pub page: Option<f64>
}
#[derive(Clone, Debug)]
pub struct GetGifsTrendingParams {
pub tenant_id: String,
pub locale: Option<String>,
pub rating: Option<String>,
pub page: Option<f64>
}
#[derive(Clone, Debug)]
pub struct GetGlobalEventLogParams {
pub tenant_id: String,
pub url_id: String,
pub user_id_ws: String,
pub start_time: i64,
pub end_time: Option<i64>
}
#[derive(Clone, Debug)]
pub struct GetOfflineUsersParams {
pub tenant_id: String,
pub url_id: String,
pub after_name: Option<String>,
pub after_user_id: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetOnlineUsersParams {
pub tenant_id: String,
pub url_id: String,
pub after_name: Option<String>,
pub after_user_id: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetPagesPublicParams {
pub tenant_id: String,
pub cursor: Option<String>,
pub limit: Option<i32>,
pub q: Option<String>,
pub sort_by: Option<models::PagesSortBy>,
pub has_comments: Option<bool>
}
#[derive(Clone, Debug)]
pub struct GetTranslationsParams {
pub namespace: String,
pub component: String,
pub locale: Option<String>,
pub use_full_translation_ids: Option<bool>
}
#[derive(Clone, Debug)]
pub struct GetUserNotificationCountParams {
pub tenant_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetUserNotificationsParams {
pub tenant_id: String,
pub url_id: Option<String>,
pub page_size: Option<i32>,
pub after_id: Option<String>,
pub include_context: Option<bool>,
pub after_created_at: Option<i64>,
pub unread_only: Option<bool>,
pub dm_only: Option<bool>,
pub no_dm: Option<bool>,
pub include_translations: Option<bool>,
pub include_tenant_notifications: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetUserPresenceStatusesParams {
pub tenant_id: String,
pub url_id_ws: String,
pub user_ids: String
}
#[derive(Clone, Debug)]
pub struct GetUserReactsPublicParams {
pub tenant_id: String,
pub post_ids: Option<Vec<String>>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct GetUsersInfoParams {
pub tenant_id: String,
pub ids: String
}
#[derive(Clone, Debug)]
pub struct GetV1PageLikesParams {
pub tenant_id: String,
pub url_id: String
}
#[derive(Clone, Debug)]
pub struct GetV2PageReactUsersParams {
pub tenant_id: String,
pub url_id: String,
pub id: String
}
#[derive(Clone, Debug)]
pub struct GetV2PageReactsParams {
pub tenant_id: String,
pub url_id: String
}
#[derive(Clone, Debug)]
pub struct LockCommentParams {
pub tenant_id: String,
pub comment_id: String,
pub broadcast_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct PinCommentParams {
pub tenant_id: String,
pub comment_id: String,
pub broadcast_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct ReactFeedPostPublicParams {
pub tenant_id: String,
pub post_id: String,
pub react_body_params: models::ReactBodyParams,
pub is_undo: Option<bool>,
pub broadcast_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct ResetUserNotificationCountParams {
pub tenant_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct ResetUserNotificationsParams {
pub tenant_id: String,
pub after_id: Option<String>,
pub after_created_at: Option<i64>,
pub unread_only: Option<bool>,
pub dm_only: Option<bool>,
pub no_dm: Option<bool>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct SearchUsersParams {
pub tenant_id: String,
pub url_id: String,
pub username_starts_with: Option<String>,
pub mention_group_ids: Option<Vec<String>>,
pub sso: Option<String>,
pub search_section: Option<String>
}
#[derive(Clone, Debug)]
pub struct SetCommentTextParams {
pub tenant_id: String,
pub comment_id: String,
pub broadcast_id: String,
pub comment_text_update_request: models::CommentTextUpdateRequest,
pub edit_key: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct UnBlockCommentPublicParams {
pub tenant_id: String,
pub comment_id: String,
pub public_block_from_comment_params: models::PublicBlockFromCommentParams,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct UnLockCommentParams {
pub tenant_id: String,
pub comment_id: String,
pub broadcast_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct UnPinCommentParams {
pub tenant_id: String,
pub comment_id: String,
pub broadcast_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct UpdateFeedPostPublicParams {
pub tenant_id: String,
pub post_id: String,
pub update_feed_post_params: models::UpdateFeedPostParams,
pub broadcast_id: Option<String>,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct UpdateUserNotificationCommentSubscriptionStatusParams {
pub tenant_id: String,
pub notification_id: String,
pub opted_in_or_out: String,
pub comment_id: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct UpdateUserNotificationPageSubscriptionStatusParams {
pub tenant_id: String,
pub url_id: String,
pub url: String,
pub page_title: String,
pub subscribed_or_unsubscribed: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct UpdateUserNotificationStatusParams {
pub tenant_id: String,
pub notification_id: String,
pub new_status: String,
pub sso: Option<String>
}
#[derive(Clone, Debug)]
pub struct UploadImageParams {
pub tenant_id: String,
pub file: std::path::PathBuf,
pub size_preset: Option<models::SizePreset>,
pub url_id: Option<String>
}
#[derive(Clone, Debug)]
pub struct VoteCommentParams {
pub tenant_id: String,
pub comment_id: String,
pub url_id: String,
pub broadcast_id: String,
pub vote_body_params: models::VoteBodyParams,
pub session_id: Option<String>,
pub sso: Option<String>
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BlockFromCommentPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CheckedCommentsForBlockedError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateCommentPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateFeedPostPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateV1PageReactError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateV2PageReactError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteCommentPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteCommentVoteError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteFeedPostPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteV1PageReactError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteV2PageReactError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FlagCommentPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCommentTextError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCommentVoteUserNamesError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCommentsForUserError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCommentsPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetEventLogError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFeedPostsPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFeedPostsStatsError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetGifLargeError {
Status422(models::ApiError),
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetGifsSearchError {
Status422(models::ApiError),
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetGifsTrendingError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetGlobalEventLogError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetOfflineUsersError {
Status403(models::ApiError),
Status422(models::ApiError),
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetOnlineUsersError {
Status403(models::ApiError),
Status422(models::ApiError),
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetPagesPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTranslationsError {
Status422(models::ApiError),
Status500(models::ApiError),
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserNotificationCountError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserNotificationsError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserPresenceStatusesError {
Status422(models::ApiError),
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserReactsPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUsersInfoError {
Status422(models::ApiError),
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetV1PageLikesError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetV2PageReactUsersError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetV2PageReactsError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LockCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LogoutPublicError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PinCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ReactFeedPostPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ResetUserNotificationCountError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ResetUserNotificationsError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SearchUsersError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetCommentTextError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnBlockCommentPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnLockCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnPinCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateFeedPostPublicError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateUserNotificationCommentSubscriptionStatusError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateUserNotificationPageSubscriptionStatusError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateUserNotificationStatusError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UploadImageError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum VoteCommentError {
DefaultResponse(models::ApiError),
UnknownValue(serde_json::Value),
}
pub async fn block_from_comment_public(configuration: &configuration::Configuration, params: BlockFromCommentPublicParams) -> Result<models::BlockSuccess, Error<BlockFromCommentPublicError>> {
let uri_str = format!("{}/block-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);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_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());
}
req_builder = req_builder.json(¶ms.public_block_from_comment_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::BlockSuccess`"))),
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::BlockSuccess`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<BlockFromCommentPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn checked_comments_for_blocked(configuration: &configuration::Configuration, params: CheckedCommentsForBlockedParams) -> Result<models::CheckBlockedCommentsResponse, Error<CheckedCommentsForBlockedError>> {
let uri_str = format!("{}/check-blocked-comments", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_id.to_string())]);
req_builder = req_builder.query(&[("commentIds", ¶ms.comment_ids.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::CheckBlockedCommentsResponse`"))),
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::CheckBlockedCommentsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CheckedCommentsForBlockedError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn create_comment_public(configuration: &configuration::Configuration, params: CreateCommentPublicParams) -> Result<models::SaveCommentsResponseWithPresence, Error<CreateCommentPublicError>> {
let uri_str = format!("{}/comments/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
req_builder = req_builder.query(&[("broadcastId", ¶ms.broadcast_id.to_string())]);
if let Some(ref param_value) = params.session_id {
req_builder = req_builder.query(&[("sessionId", ¶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.comment_data);
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::SaveCommentsResponseWithPresence`"))),
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::SaveCommentsResponseWithPresence`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateCommentPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn create_feed_post_public(configuration: &configuration::Configuration, params: CreateFeedPostPublicParams) -> Result<models::CreateFeedPostResponse, Error<CreateFeedPostPublicError>> {
let uri_str = format!("{}/feed-posts/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
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());
}
req_builder = req_builder.json(¶ms.create_feed_post_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::CreateFeedPostResponse`"))),
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::CreateFeedPostResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateFeedPostPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn create_v1_page_react(configuration: &configuration::Configuration, params: CreateV1PageReactParams) -> Result<models::CreateV1PageReact, Error<CreateV1PageReactError>> {
let uri_str = format!("{}/page-reacts/v1/likes/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
if let Some(ref param_value) = params.title {
req_builder = req_builder.query(&[("title", ¶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::CreateV1PageReact`"))),
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::CreateV1PageReact`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateV1PageReactError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn create_v2_page_react(configuration: &configuration::Configuration, params: CreateV2PageReactParams) -> Result<models::CreateV1PageReact, Error<CreateV2PageReactError>> {
let uri_str = format!("{}/page-reacts/v2/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
req_builder = req_builder.query(&[("id", ¶ms.id.to_string())]);
if let Some(ref param_value) = params.title {
req_builder = req_builder.query(&[("title", ¶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::CreateV1PageReact`"))),
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::CreateV1PageReact`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateV2PageReactError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn delete_comment_public(configuration: &configuration::Configuration, params: DeleteCommentPublicParams) -> Result<models::PublicApiDeleteCommentResponse, Error<DeleteCommentPublicError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
req_builder = req_builder.query(&[("broadcastId", ¶ms.broadcast_id.to_string())]);
if let Some(ref param_value) = params.edit_key {
req_builder = req_builder.query(&[("editKey", ¶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::PublicApiDeleteCommentResponse`"))),
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::PublicApiDeleteCommentResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteCommentPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn delete_comment_vote(configuration: &configuration::Configuration, params: DeleteCommentVoteParams) -> Result<models::VoteDeleteResponse, Error<DeleteCommentVoteError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}/vote/{voteId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), 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);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
req_builder = req_builder.query(&[("broadcastId", ¶ms.broadcast_id.to_string())]);
if let Some(ref param_value) = params.edit_key {
req_builder = req_builder.query(&[("editKey", ¶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::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<DeleteCommentVoteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn delete_feed_post_public(configuration: &configuration::Configuration, params: DeleteFeedPostPublicParams) -> Result<models::DeleteFeedPostPublicResponse, Error<DeleteFeedPostPublicError>> {
let uri_str = format!("{}/feed-posts/{tenantId}/{postId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), postId=crate::client::apis::urlencode(params.post_id));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
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::DeleteFeedPostPublicResponse`"))),
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::DeleteFeedPostPublicResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteFeedPostPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn delete_v1_page_react(configuration: &configuration::Configuration, params: DeleteV1PageReactParams) -> Result<models::CreateV1PageReact, Error<DeleteV1PageReactError>> {
let uri_str = format!("{}/page-reacts/v1/likes/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.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::CreateV1PageReact`"))),
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::CreateV1PageReact`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteV1PageReactError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn delete_v2_page_react(configuration: &configuration::Configuration, params: DeleteV2PageReactParams) -> Result<models::CreateV1PageReact, Error<DeleteV2PageReactError>> {
let uri_str = format!("{}/page-reacts/v2/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
req_builder = req_builder.query(&[("id", ¶ms.id.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::CreateV1PageReact`"))),
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::CreateV1PageReact`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteV2PageReactError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn flag_comment_public(configuration: &configuration::Configuration, params: FlagCommentPublicParams) -> Result<models::ApiEmptyResponse, Error<FlagCommentPublicError>> {
let uri_str = format!("{}/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);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_id.to_string())]);
req_builder = req_builder.query(&[("isFlagged", ¶ms.is_flagged.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<FlagCommentPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_comment_text(configuration: &configuration::Configuration, params: GetCommentTextParams) -> Result<models::PublicApiGetCommentTextResponse, Error<GetCommentTextError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}/text", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), 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.edit_key {
req_builder = req_builder.query(&[("editKey", ¶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::PublicApiGetCommentTextResponse`"))),
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::PublicApiGetCommentTextResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCommentTextError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_comment_vote_user_names(configuration: &configuration::Configuration, params: GetCommentVoteUserNamesParams) -> Result<models::GetCommentVoteUserNamesSuccessResponse, Error<GetCommentVoteUserNamesError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}/votes", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("dir", ¶ms.dir.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::GetCommentVoteUserNamesSuccessResponse`"))),
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::GetCommentVoteUserNamesSuccessResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCommentVoteUserNamesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_comments_for_user(configuration: &configuration::Configuration, params: GetCommentsForUserParams) -> Result<models::GetCommentsForUserResponse, Error<GetCommentsForUserError>> {
let uri_str = format!("{}/comments-for-user", 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.direction {
req_builder = req_builder.query(&[("direction", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.replies_to_user_id {
req_builder = req_builder.query(&[("repliesToUserId", ¶m_value.to_string())]);
}
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.includei10n {
req_builder = req_builder.query(&[("includei10n", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.locale {
req_builder = req_builder.query(&[("locale", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.is_crawler {
req_builder = req_builder.query(&[("isCrawler", ¶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::GetCommentsForUserResponse`"))),
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::GetCommentsForUserResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCommentsForUserError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_comments_public(configuration: &configuration::Configuration, params: GetCommentsPublicParams) -> Result<models::GetCommentsResponseWithPresencePublicComment, Error<GetCommentsPublicError>> {
let uri_str = format!("{}/comments/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
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.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 param_value) = params.skip {
req_builder = req_builder.query(&[("skip", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.skip_children {
req_builder = req_builder.query(&[("skipChildren", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.limit_children {
req_builder = req_builder.query(&[("limitChildren", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.count_children {
req_builder = req_builder.query(&[("countChildren", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.fetch_page_for_comment_id {
req_builder = req_builder.query(&[("fetchPageForCommentId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_config {
req_builder = req_builder.query(&[("includeConfig", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.count_all {
req_builder = req_builder.query(&[("countAll", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.includei10n {
req_builder = req_builder.query(&[("includei10n", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.locale {
req_builder = req_builder.query(&[("locale", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.modules {
req_builder = req_builder.query(&[("modules", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.is_crawler {
req_builder = req_builder.query(&[("isCrawler", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_notification_count {
req_builder = req_builder.query(&[("includeNotificationCount", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.as_tree {
req_builder = req_builder.query(&[("asTree", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.max_tree_depth {
req_builder = req_builder.query(&[("maxTreeDepth", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.use_full_translation_ids {
req_builder = req_builder.query(&[("useFullTranslationIds", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.parent_id {
req_builder = req_builder.query(&[("parentId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.search_text {
req_builder = req_builder.query(&[("searchText", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.hash_tags {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("hashTags".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("hashTags", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").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.custom_config_str {
req_builder = req_builder.query(&[("customConfigStr", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.after_comment_id {
req_builder = req_builder.query(&[("afterCommentId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.before_comment_id {
req_builder = req_builder.query(&[("beforeCommentId", ¶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::GetCommentsResponseWithPresencePublicComment`"))),
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::GetCommentsResponseWithPresencePublicComment`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCommentsPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_event_log(configuration: &configuration::Configuration, params: GetEventLogParams) -> Result<models::GetEventLogResponse, Error<GetEventLogError>> {
let uri_str = format!("{}/event-log/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
req_builder = req_builder.query(&[("userIdWS", ¶ms.user_id_ws.to_string())]);
req_builder = req_builder.query(&[("startTime", ¶ms.start_time.to_string())]);
if let Some(ref param_value) = params.end_time {
req_builder = req_builder.query(&[("endTime", ¶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::GetEventLogResponse`"))),
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::GetEventLogResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetEventLogError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_feed_posts_public(configuration: &configuration::Configuration, params: GetFeedPostsPublicParams) -> Result<models::PublicFeedPostsResponse, Error<GetFeedPostsPublicError>> {
let uri_str = format!("{}/feed-posts/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
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.limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.tags {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("tags".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("tags", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.is_crawler {
req_builder = req_builder.query(&[("isCrawler", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_user_info {
req_builder = req_builder.query(&[("includeUserInfo", ¶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::PublicFeedPostsResponse`"))),
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::PublicFeedPostsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetFeedPostsPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_feed_posts_stats(configuration: &configuration::Configuration, params: GetFeedPostsStatsParams) -> Result<models::FeedPostsStatsResponse, Error<GetFeedPostsStatsError>> {
let uri_str = format!("{}/feed-posts/{tenantId}/stats", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = match "multi" {
"multi" => req_builder.query(¶ms.post_ids.into_iter().map(|p| ("postIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("postIds", ¶ms.post_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").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::FeedPostsStatsResponse`"))),
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::FeedPostsStatsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetFeedPostsStatsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_gif_large(configuration: &configuration::Configuration, params: GetGifLargeParams) -> Result<models::GifGetLargeResponse, Error<GetGifLargeError>> {
let uri_str = format!("{}/gifs/get-large/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("largeInternalURLSanitized", ¶ms.large_internal_url_sanitized.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::GifGetLargeResponse`"))),
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::GifGetLargeResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetGifLargeError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_gifs_search(configuration: &configuration::Configuration, params: GetGifsSearchParams) -> Result<models::GetGifsSearchResponse, Error<GetGifsSearchError>> {
let uri_str = format!("{}/gifs/search/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("search", ¶ms.search.to_string())]);
if let Some(ref param_value) = params.locale {
req_builder = req_builder.query(&[("locale", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.rating {
req_builder = req_builder.query(&[("rating", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.page {
req_builder = req_builder.query(&[("page", ¶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::GetGifsSearchResponse`"))),
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::GetGifsSearchResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetGifsSearchError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_gifs_trending(configuration: &configuration::Configuration, params: GetGifsTrendingParams) -> Result<models::GetGifsTrendingResponse, Error<GetGifsTrendingError>> {
let uri_str = format!("{}/gifs/trending/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.locale {
req_builder = req_builder.query(&[("locale", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.rating {
req_builder = req_builder.query(&[("rating", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.page {
req_builder = req_builder.query(&[("page", ¶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::GetGifsTrendingResponse`"))),
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::GetGifsTrendingResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetGifsTrendingError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_global_event_log(configuration: &configuration::Configuration, params: GetGlobalEventLogParams) -> Result<models::GetEventLogResponse, Error<GetGlobalEventLogError>> {
let uri_str = format!("{}/event-log/global/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
req_builder = req_builder.query(&[("userIdWS", ¶ms.user_id_ws.to_string())]);
req_builder = req_builder.query(&[("startTime", ¶ms.start_time.to_string())]);
if let Some(ref param_value) = params.end_time {
req_builder = req_builder.query(&[("endTime", ¶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::GetEventLogResponse`"))),
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::GetEventLogResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetGlobalEventLogError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_offline_users(configuration: &configuration::Configuration, params: GetOfflineUsersParams) -> Result<models::PageUsersOfflineResponse, Error<GetOfflineUsersError>> {
let uri_str = format!("{}/pages/{tenantId}/users/offline", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
if let Some(ref param_value) = params.after_name {
req_builder = req_builder.query(&[("afterName", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.after_user_id {
req_builder = req_builder.query(&[("afterUserId", ¶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::PageUsersOfflineResponse`"))),
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::PageUsersOfflineResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetOfflineUsersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_online_users(configuration: &configuration::Configuration, params: GetOnlineUsersParams) -> Result<models::PageUsersOnlineResponse, Error<GetOnlineUsersError>> {
let uri_str = format!("{}/pages/{tenantId}/users/online", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
if let Some(ref param_value) = params.after_name {
req_builder = req_builder.query(&[("afterName", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.after_user_id {
req_builder = req_builder.query(&[("afterUserId", ¶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::PageUsersOnlineResponse`"))),
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::PageUsersOnlineResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetOnlineUsersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_pages_public(configuration: &configuration::Configuration, params: GetPagesPublicParams) -> Result<models::GetPublicPagesResponse, Error<GetPagesPublicError>> {
let uri_str = format!("{}/pages/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.cursor {
req_builder = req_builder.query(&[("cursor", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.q {
req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.sort_by {
req_builder = req_builder.query(&[("sortBy", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.has_comments {
req_builder = req_builder.query(&[("hasComments", ¶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::GetPublicPagesResponse`"))),
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::GetPublicPagesResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetPagesPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_translations(configuration: &configuration::Configuration, params: GetTranslationsParams) -> Result<models::GetTranslationsResponse, Error<GetTranslationsError>> {
let uri_str = format!("{}/translations/{namespace}/{component}", configuration.base_path, namespace=crate::client::apis::urlencode(params.namespace), component=crate::client::apis::urlencode(params.component));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.locale {
req_builder = req_builder.query(&[("locale", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.use_full_translation_ids {
req_builder = req_builder.query(&[("useFullTranslationIds", ¶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::GetTranslationsResponse`"))),
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::GetTranslationsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTranslationsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_user_notification_count(configuration: &configuration::Configuration, params: GetUserNotificationCountParams) -> Result<models::GetUserNotificationCountResponse, Error<GetUserNotificationCountError>> {
let uri_str = format!("{}/user-notifications/get-count", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_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::GetUserNotificationCountResponse`"))),
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::GetUserNotificationCountResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserNotificationCountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_user_notifications(configuration: &configuration::Configuration, params: GetUserNotificationsParams) -> Result<models::GetMyNotificationsResponse, Error<GetUserNotificationsError>> {
let uri_str = format!("{}/user-notifications", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_id.to_string())]);
if let Some(ref param_value) = params.url_id {
req_builder = req_builder.query(&[("urlId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.page_size {
req_builder = req_builder.query(&[("pageSize", ¶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.include_context {
req_builder = req_builder.query(&[("includeContext", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.after_created_at {
req_builder = req_builder.query(&[("afterCreatedAt", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.unread_only {
req_builder = req_builder.query(&[("unreadOnly", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.dm_only {
req_builder = req_builder.query(&[("dmOnly", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.no_dm {
req_builder = req_builder.query(&[("noDm", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_translations {
req_builder = req_builder.query(&[("includeTranslations", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.include_tenant_notifications {
req_builder = req_builder.query(&[("includeTenantNotifications", ¶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::GetMyNotificationsResponse`"))),
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::GetMyNotificationsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserNotificationsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_user_presence_statuses(configuration: &configuration::Configuration, params: GetUserPresenceStatusesParams) -> Result<models::GetUserPresenceStatusesResponse, Error<GetUserPresenceStatusesError>> {
let uri_str = format!("{}/user-presence-status", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_id.to_string())]);
req_builder = req_builder.query(&[("urlIdWS", ¶ms.url_id_ws.to_string())]);
req_builder = req_builder.query(&[("userIds", ¶ms.user_ids.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::GetUserPresenceStatusesResponse`"))),
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::GetUserPresenceStatusesResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserPresenceStatusesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_user_reacts_public(configuration: &configuration::Configuration, params: GetUserReactsPublicParams) -> Result<models::UserReactsResponse, Error<GetUserReactsPublicError>> {
let uri_str = format!("{}/feed-posts/{tenantId}/user-reacts", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = params.post_ids {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("postIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("postIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").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::UserReactsResponse`"))),
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::UserReactsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserReactsPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_users_info(configuration: &configuration::Configuration, params: GetUsersInfoParams) -> Result<models::PageUsersInfoResponse, Error<GetUsersInfoError>> {
let uri_str = format!("{}/pages/{tenantId}/users/info", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("ids", ¶ms.ids.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::PageUsersInfoResponse`"))),
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::PageUsersInfoResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetUsersInfoError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_v1_page_likes(configuration: &configuration::Configuration, params: GetV1PageLikesParams) -> Result<models::GetV1PageLikes, Error<GetV1PageLikesError>> {
let uri_str = format!("{}/page-reacts/v1/likes/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.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::GetV1PageLikes`"))),
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::GetV1PageLikes`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetV1PageLikesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_v2_page_react_users(configuration: &configuration::Configuration, params: GetV2PageReactUsersParams) -> Result<models::GetV2PageReactUsersResponse, Error<GetV2PageReactUsersError>> {
let uri_str = format!("{}/page-reacts/v2/{tenantId}/list", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
req_builder = req_builder.query(&[("id", ¶ms.id.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::GetV2PageReactUsersResponse`"))),
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::GetV2PageReactUsersResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetV2PageReactUsersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn get_v2_page_reacts(configuration: &configuration::Configuration, params: GetV2PageReactsParams) -> Result<models::GetV2PageReacts, Error<GetV2PageReactsError>> {
let uri_str = format!("{}/page-reacts/v2/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.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::GetV2PageReacts`"))),
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::GetV2PageReacts`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetV2PageReactsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn lock_comment(configuration: &configuration::Configuration, params: LockCommentParams) -> Result<models::ApiEmptyResponse, Error<LockCommentError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}/lock", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("broadcastId", ¶ms.broadcast_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<LockCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn logout_public(configuration: &configuration::Configuration) -> Result<models::ApiEmptyResponse, Error<LogoutPublicError>> {
let uri_str = format!("{}/auth/logout", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
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<LogoutPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn pin_comment(configuration: &configuration::Configuration, params: PinCommentParams) -> Result<models::ChangeCommentPinStatusResponse, Error<PinCommentError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}/pin", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("broadcastId", ¶ms.broadcast_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::ChangeCommentPinStatusResponse`"))),
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::ChangeCommentPinStatusResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PinCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn react_feed_post_public(configuration: &configuration::Configuration, params: ReactFeedPostPublicParams) -> Result<models::ReactFeedPostResponse, Error<ReactFeedPostPublicError>> {
let uri_str = format!("{}/feed-posts/{tenantId}/react/{postId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), postId=crate::client::apis::urlencode(params.post_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.is_undo {
req_builder = req_builder.query(&[("isUndo", ¶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());
}
req_builder = req_builder.json(¶ms.react_body_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::ReactFeedPostResponse`"))),
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::ReactFeedPostResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ReactFeedPostPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn reset_user_notification_count(configuration: &configuration::Configuration, params: ResetUserNotificationCountParams) -> Result<models::ResetUserNotificationsResponse, Error<ResetUserNotificationCountError>> {
let uri_str = format!("{}/user-notifications/reset-count", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_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::ResetUserNotificationsResponse`"))),
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::ResetUserNotificationsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ResetUserNotificationCountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn reset_user_notifications(configuration: &configuration::Configuration, params: ResetUserNotificationsParams) -> Result<models::ResetUserNotificationsResponse, Error<ResetUserNotificationsError>> {
let uri_str = format!("{}/user-notifications/reset", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_id.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.after_created_at {
req_builder = req_builder.query(&[("afterCreatedAt", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.unread_only {
req_builder = req_builder.query(&[("unreadOnly", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.dm_only {
req_builder = req_builder.query(&[("dmOnly", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.no_dm {
req_builder = req_builder.query(&[("noDm", ¶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::ResetUserNotificationsResponse`"))),
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::ResetUserNotificationsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ResetUserNotificationsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn search_users(configuration: &configuration::Configuration, params: SearchUsersParams) -> Result<models::SearchUsersResult, Error<SearchUsersError>> {
let uri_str = format!("{}/user-search/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
if let Some(ref param_value) = params.username_starts_with {
req_builder = req_builder.query(&[("usernameStartsWith", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.mention_group_ids {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("mentionGroupIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("mentionGroupIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = params.sso {
req_builder = req_builder.query(&[("sso", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.search_section {
req_builder = req_builder.query(&[("searchSection", ¶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::SearchUsersResult`"))),
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::SearchUsersResult`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<SearchUsersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn set_comment_text(configuration: &configuration::Configuration, params: SetCommentTextParams) -> Result<models::PublicApiSetCommentTextResponse, Error<SetCommentTextError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}/update-text", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("broadcastId", ¶ms.broadcast_id.to_string())]);
if let Some(ref param_value) = params.edit_key {
req_builder = req_builder.query(&[("editKey", ¶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.comment_text_update_request);
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::PublicApiSetCommentTextResponse`"))),
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::PublicApiSetCommentTextResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<SetCommentTextError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn un_block_comment_public(configuration: &configuration::Configuration, params: UnBlockCommentPublicParams) -> Result<models::UnblockSuccess, Error<UnBlockCommentPublicError>> {
let uri_str = format!("{}/block-from-comment/{commentId}", configuration.base_path, commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_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());
}
req_builder = req_builder.json(¶ms.public_block_from_comment_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::UnblockSuccess`"))),
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::UnblockSuccess`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UnBlockCommentPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn un_lock_comment(configuration: &configuration::Configuration, params: UnLockCommentParams) -> Result<models::ApiEmptyResponse, Error<UnLockCommentError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}/unlock", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("broadcastId", ¶ms.broadcast_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<UnLockCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn un_pin_comment(configuration: &configuration::Configuration, params: UnPinCommentParams) -> Result<models::ChangeCommentPinStatusResponse, Error<UnPinCommentError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}/unpin", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("broadcastId", ¶ms.broadcast_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::ChangeCommentPinStatusResponse`"))),
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::ChangeCommentPinStatusResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UnPinCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn update_feed_post_public(configuration: &configuration::Configuration, params: UpdateFeedPostPublicParams) -> Result<models::CreateFeedPostResponse, Error<UpdateFeedPostPublicError>> {
let uri_str = format!("{}/feed-posts/{tenantId}/{postId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), postId=crate::client::apis::urlencode(params.post_id));
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
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());
}
req_builder = req_builder.json(¶ms.update_feed_post_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::CreateFeedPostResponse`"))),
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::CreateFeedPostResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateFeedPostPublicError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn update_user_notification_comment_subscription_status(configuration: &configuration::Configuration, params: UpdateUserNotificationCommentSubscriptionStatusParams) -> Result<models::UpdateUserNotificationCommentSubscriptionStatusResponse, Error<UpdateUserNotificationCommentSubscriptionStatusError>> {
let uri_str = format!("{}/user-notifications/{notificationId}/mark-opted/{optedInOrOut}", configuration.base_path, notificationId=crate::client::apis::urlencode(params.notification_id), optedInOrOut=crate::client::apis::urlencode(params.opted_in_or_out));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_id.to_string())]);
req_builder = req_builder.query(&[("commentId", ¶ms.comment_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::UpdateUserNotificationCommentSubscriptionStatusResponse`"))),
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::UpdateUserNotificationCommentSubscriptionStatusResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateUserNotificationCommentSubscriptionStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn update_user_notification_page_subscription_status(configuration: &configuration::Configuration, params: UpdateUserNotificationPageSubscriptionStatusParams) -> Result<models::UpdateUserNotificationPageSubscriptionStatusResponse, Error<UpdateUserNotificationPageSubscriptionStatusError>> {
let uri_str = format!("{}/user-notifications/set-subscription-state/{subscribedOrUnsubscribed}", configuration.base_path, subscribedOrUnsubscribed=crate::client::apis::urlencode(params.subscribed_or_unsubscribed));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_id.to_string())]);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
req_builder = req_builder.query(&[("url", ¶ms.url.to_string())]);
req_builder = req_builder.query(&[("pageTitle", ¶ms.page_title.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::UpdateUserNotificationPageSubscriptionStatusResponse`"))),
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::UpdateUserNotificationPageSubscriptionStatusResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateUserNotificationPageSubscriptionStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn update_user_notification_status(configuration: &configuration::Configuration, params: UpdateUserNotificationStatusParams) -> Result<models::UpdateUserNotificationStatusResponse, Error<UpdateUserNotificationStatusError>> {
let uri_str = format!("{}/user-notifications/{notificationId}/mark/{newStatus}", configuration.base_path, notificationId=crate::client::apis::urlencode(params.notification_id), newStatus=crate::client::apis::urlencode(params.new_status));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("tenantId", ¶ms.tenant_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::UpdateUserNotificationStatusResponse`"))),
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::UpdateUserNotificationStatusResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateUserNotificationStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn upload_image(configuration: &configuration::Configuration, params: UploadImageParams) -> Result<models::UploadImageResponse, Error<UploadImageError>> {
let uri_str = format!("{}/upload-image/{tenantId}", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = params.size_preset {
req_builder = req_builder.query(&[("sizePreset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = params.url_id {
req_builder = req_builder.query(&[("urlId", ¶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 mut multipart_form = reqwest::multipart::Form::new();
let file = TokioFile::open(¶ms.file).await?;
let stream = FramedRead::new(file, BytesCodec::new());
let file_name = params.file.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_default();
let file_part = reqwest::multipart::Part::stream(reqwest::Body::wrap_stream(stream)).file_name(file_name);
multipart_form = multipart_form.part("file", file_part);
req_builder = req_builder.multipart(multipart_form);
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::UploadImageResponse`"))),
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::UploadImageResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UploadImageError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn vote_comment(configuration: &configuration::Configuration, params: VoteCommentParams) -> Result<models::VoteResponse, Error<VoteCommentError>> {
let uri_str = format!("{}/comments/{tenantId}/{commentId}/vote", configuration.base_path, tenantId=crate::client::apis::urlencode(params.tenant_id), commentId=crate::client::apis::urlencode(params.comment_id));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("urlId", ¶ms.url_id.to_string())]);
req_builder = req_builder.query(&[("broadcastId", ¶ms.broadcast_id.to_string())]);
if let Some(ref param_value) = params.session_id {
req_builder = req_builder.query(&[("sessionId", ¶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.vote_body_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::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<VoteCommentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}