#[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::ident::AtIdentifier;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
use crate::app_rocksky::actor::NeighbourViewBasic;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetActorNeighbours<S: BosStr = DefaultStr> {
pub did: AtIdentifier<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetActorNeighboursOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub neighbours: Option<Vec<NeighbourViewBasic<S>>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct GetActorNeighboursResponse;
impl jacquard_common::xrpc::XrpcResp for GetActorNeighboursResponse {
const NSID: &'static str = "app.rocksky.actor.getActorNeighbours";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetActorNeighboursOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetActorNeighbours<S> {
const NSID: &'static str = "app.rocksky.actor.getActorNeighbours";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetActorNeighboursResponse;
}
pub struct GetActorNeighboursRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetActorNeighboursRequest {
const PATH: &'static str = "/xrpc/app.rocksky.actor.getActorNeighbours";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetActorNeighbours<S>;
type Response = GetActorNeighboursResponse;
}
pub mod get_actor_neighbours_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 Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Did = Unset;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct did(());
}
}
pub struct GetActorNeighboursBuilder<S: BosStr, St: get_actor_neighbours_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtIdentifier<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetActorNeighbours<S> {
pub fn new() -> GetActorNeighboursBuilder<S, get_actor_neighbours_state::Empty> {
GetActorNeighboursBuilder::new()
}
}
impl<S: BosStr> GetActorNeighboursBuilder<S, get_actor_neighbours_state::Empty> {
pub fn new() -> Self {
GetActorNeighboursBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetActorNeighboursBuilder<S, St>
where
St: get_actor_neighbours_state::State,
St::Did: get_actor_neighbours_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<AtIdentifier<S>>,
) -> GetActorNeighboursBuilder<S, get_actor_neighbours_state::SetDid<St>> {
self._fields.0 = Option::Some(value.into());
GetActorNeighboursBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetActorNeighboursBuilder<S, St>
where
St: get_actor_neighbours_state::State,
St::Did: get_actor_neighbours_state::IsSet,
{
pub fn build(self) -> GetActorNeighbours<S> {
GetActorNeighbours {
did: self._fields.0.unwrap(),
}
}
}