/* * VRChat API Documentation * * * Contact: vrchatapi.lpv0t@aries.fyi * Generated by: https://openapi-generator.tech */ use reqwest; #[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; /// struct for typed errors of method [`accept_friend_request`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum AcceptFriendRequestError { Status401(crate::models::Error), Status404(crate::models::Error), UnknownValue(serde_json::Value), } /// struct for typed errors of method [`clear_notifications`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ClearNotificationsError { Status401(crate::models::Error), UnknownValue(serde_json::Value), } /// struct for typed errors of method [`delete_notification`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum DeleteNotificationError { Status401(crate::models::Error), UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_notifications`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetNotificationsError { Status401(crate::models::Error), UnknownValue(serde_json::Value), } /// struct for typed errors of method [`mark_notification_as_read`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum MarkNotificationAsReadError { Status401(crate::models::Error), UnknownValue(serde_json::Value), } /// Accept a friend request by notification `frq_` ID. Friend requests can be found using the NotificationsAPI `getNotifications` by filtering of type `friendRequest`. pub async fn accept_friend_request(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, notification_id: &str) -> Result> { let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/accept", configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); crate::request(configuration, local_var_req_builder, None::<()>).await } /// Clear **all** notifications. pub async fn clear_notifications(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { let local_var_uri_str = format!("{}/auth/user/notifications/clear", configuration.base_path); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); crate::request(configuration, local_var_req_builder, None::<()>).await } /// Delete a notification. pub async fn delete_notification(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, notification_id: &str) -> Result> { let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/hide", configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); crate::request(configuration, local_var_req_builder, None::<()>).await } /// Retrieve all of the current user's notifications. pub async fn get_notifications(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, r#type: Option<&str>, sent: Option, hidden: Option, after: Option<&str>, n: Option, offset: Option) -> Result, Error> { let local_var_uri_str = format!("{}/auth/user/notifications", configuration.base_path); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = r#type { local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sent { local_var_req_builder = local_var_req_builder.query(&[("sent", &local_var_str.to_string())]); } if let Some(ref local_var_str) = hidden { local_var_req_builder = local_var_req_builder.query(&[("hidden", &local_var_str.to_string())]); } if let Some(ref local_var_str) = after { local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } crate::request(configuration, local_var_req_builder, None::<()>).await } /// Mark a notification as seen. pub async fn mark_notification_as_read(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, notification_id: &str) -> Result> { let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/see", configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); crate::request(configuration, local_var_req_builder, None::<()>).await }