#[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::collab::SessionView;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetResourceSessions<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 GetResourceSessionsOutput<S: BosStr = DefaultStr> {
pub sessions: Vec<SessionView<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct GetResourceSessionsResponse;
impl jacquard_common::xrpc::XrpcResp for GetResourceSessionsResponse {
const NSID: &'static str = "sh.weaver.collab.getResourceSessions";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetResourceSessionsOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetResourceSessions<S> {
const NSID: &'static str = "sh.weaver.collab.getResourceSessions";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetResourceSessionsResponse;
}
pub struct GetResourceSessionsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetResourceSessionsRequest {
const PATH: &'static str = "/xrpc/sh.weaver.collab.getResourceSessions";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetResourceSessions<S>;
type Response = GetResourceSessionsResponse;
}
pub mod get_resource_sessions_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 GetResourceSessionsBuilder<
S: BosStr,
St: get_resource_sessions_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetResourceSessions<S> {
pub fn new() -> GetResourceSessionsBuilder<S, get_resource_sessions_state::Empty> {
GetResourceSessionsBuilder::new()
}
}
impl<S: BosStr> GetResourceSessionsBuilder<S, get_resource_sessions_state::Empty> {
pub fn new() -> Self {
GetResourceSessionsBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetResourceSessionsBuilder<S, St>
where
St: get_resource_sessions_state::State,
St::Resource: get_resource_sessions_state::IsUnset,
{
pub fn resource(
mut self,
value: impl Into<AtUri<S>>,
) -> GetResourceSessionsBuilder<S, get_resource_sessions_state::SetResource<St>> {
self._fields.0 = Option::Some(value.into());
GetResourceSessionsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetResourceSessionsBuilder<S, St>
where
St: get_resource_sessions_state::State,
St::Resource: get_resource_sessions_state::IsSet,
{
pub fn build(self) -> GetResourceSessions<S> {
GetResourceSessions {
resource: self._fields.0.unwrap(),
}
}
}