#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::AtUri;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
use crate::sh_weaver::actor::ProfileViewBasic;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetResourceParticipants<S: BosStr = DefaultStr> {
pub resource: AtUri<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetResourceParticipantsOutput<S: BosStr = DefaultStr> {
pub owner: ProfileViewBasic<S>,
pub participants: Vec<ProfileViewBasic<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer_can_edit: Option<bool>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct GetResourceParticipantsResponse;
impl jacquard_common::xrpc::XrpcResp for GetResourceParticipantsResponse {
const NSID: &'static str = "sh.weaver.collab.getResourceParticipants";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetResourceParticipantsOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetResourceParticipants<S> {
const NSID: &'static str = "sh.weaver.collab.getResourceParticipants";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetResourceParticipantsResponse;
}
pub struct GetResourceParticipantsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetResourceParticipantsRequest {
const PATH: &'static str = "/xrpc/sh.weaver.collab.getResourceParticipants";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetResourceParticipants<S>;
type Response = GetResourceParticipantsResponse;
}
pub mod get_resource_participants_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Resource;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Resource = Unset;
}
pub struct SetResource<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetResource<St> {}
impl<St: State> State for SetResource<St> {
type Resource = Set<members::resource>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct resource(());
}
}
pub struct GetResourceParticipantsBuilder<
S: BosStr,
St: get_resource_participants_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetResourceParticipants<S> {
pub fn new() -> GetResourceParticipantsBuilder<
S,
get_resource_participants_state::Empty,
> {
GetResourceParticipantsBuilder::new()
}
}
impl<
S: BosStr,
> GetResourceParticipantsBuilder<S, get_resource_participants_state::Empty> {
pub fn new() -> Self {
GetResourceParticipantsBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetResourceParticipantsBuilder<S, St>
where
St: get_resource_participants_state::State,
St::Resource: get_resource_participants_state::IsUnset,
{
pub fn resource(
mut self,
value: impl Into<AtUri<S>>,
) -> GetResourceParticipantsBuilder<
S,
get_resource_participants_state::SetResource<St>,
> {
self._fields.0 = Option::Some(value.into());
GetResourceParticipantsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetResourceParticipantsBuilder<S, St>
where
St: get_resource_participants_state::State,
St::Resource: get_resource_participants_state::IsSet,
{
pub fn build(self) -> GetResourceParticipants<S> {
GetResourceParticipants {
resource: self._fields.0.unwrap(),
}
}
}