use mogh_resolver::Resolve;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use crate::entities::{NoData, ResourceTarget, user::User};
use super::KomodoWriteRequest;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/PushRecentlyViewed",
description = "Add a resource to calling user's recently viewed.",
request_body(content = PushRecentlyViewed),
responses(
(status = 200, description = "Successful", body = PushRecentlyViewedResponse),
(status = 500, description = "Failed", body = mogh_error::Serror),
),
)]
pub fn push_recently_viewed() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(PushRecentlyViewedResponse)]
#[error(mogh_error::Error)]
pub struct PushRecentlyViewed {
pub resource: ResourceTarget,
}
#[typeshare]
pub type PushRecentlyViewedResponse = NoData;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/SetLastSeenUpdate",
description = "Set the time the calling user most recently opened the UI updates dropdown.",
request_body(content = SetLastSeenUpdate),
responses(
(status = 200, description = "Successful", body = SetLastSeenUpdateResponse),
(status = 500, description = "Failed", body = mogh_error::Serror),
),
)]
pub fn set_last_seen_update() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(SetLastSeenUpdateResponse)]
#[error(mogh_error::Error)]
pub struct SetLastSeenUpdate {}
#[typeshare]
pub type SetLastSeenUpdateResponse = NoData;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/DeleteUser",
description = "**Admin only.** Delete a user.",
request_body(content = DeleteUser),
responses(
(status = 200, description = "The deleted user", body = DeleteUserResponse),
),
)]
pub fn delete_user() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(DeleteUserResponse)]
#[error(mogh_error::Error)]
pub struct DeleteUser {
#[serde(alias = "username", alias = "id")]
pub user: String,
}
#[typeshare]
pub type DeleteUserResponse = User;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CreateLocalUser",
description = "**Admin only.** Create a local user.",
request_body(content = CreateLocalUser),
responses(
(status = 200, description = "The new user", body = CreateLocalUserResponse),
),
)]
pub fn create_local_user() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(CreateLocalUserResponse)]
#[error(mogh_error::Error)]
pub struct CreateLocalUser {
pub username: String,
pub password: String,
}
#[typeshare]
pub type CreateLocalUserResponse = User;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/CreateServiceUser",
description = "**Admin only.** Create a service user.",
request_body(content = CreateServiceUser),
responses(
(status = 200, description = "The new service user", body = CreateServiceUserResponse),
),
)]
pub fn create_service_user() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(CreateServiceUserResponse)]
#[error(mogh_error::Error)]
pub struct CreateServiceUser {
pub username: String,
pub description: String,
}
#[typeshare]
pub type CreateServiceUserResponse = User;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/UpdateServiceUserDescription",
description = "**Admin only.** Update a service user's description.",
request_body(content = UpdateServiceUserDescription),
responses(
(status = 200, description = "The updated user", body = UpdateServiceUserDescriptionResponse),
),
)]
pub fn update_service_user_description() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(UpdateServiceUserDescriptionResponse)]
#[error(mogh_error::Error)]
pub struct UpdateServiceUserDescription {
pub username: String,
pub description: String,
}
#[typeshare]
pub type UpdateServiceUserDescriptionResponse = User;