mirror of
https://github.com/mii443/vrchatapi-rust.git
synced 2025-08-31 03:39:36 +00:00
112 lines
5.7 KiB
Rust
112 lines
5.7 KiB
Rust
/*
|
|
* 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<impl std::ops::Deref<Target = reqwest::Client> + Clone + core::fmt::Debug>, notification_id: &str) -> Result<crate::models::Success, Error<AcceptFriendRequestError>> {
|
|
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<impl std::ops::Deref<Target = reqwest::Client> + Clone + core::fmt::Debug>, ) -> Result<crate::models::Success, Error<ClearNotificationsError>> {
|
|
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<impl std::ops::Deref<Target = reqwest::Client> + Clone + core::fmt::Debug>, notification_id: &str) -> Result<crate::models::Notification, Error<DeleteNotificationError>> {
|
|
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<impl std::ops::Deref<Target = reqwest::Client> + Clone + core::fmt::Debug>, r#type: Option<&str>, sent: Option<bool>, hidden: Option<bool>, after: Option<&str>, n: Option<i32>, offset: Option<i32>) -> Result<Vec<crate::models::Notification>, Error<GetNotificationsError>> {
|
|
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<impl std::ops::Deref<Target = reqwest::Client> + Clone + core::fmt::Debug>, notification_id: &str) -> Result<crate::models::Notification, Error<MarkNotificationAsReadError>> {
|
|
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
|
|
}
|
|
|