#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{AtUri, Datetime};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetPost<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub password: Option<S>,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetPostOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub additional: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub encrypt_cid: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub error_code: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub error_description: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<S>,
pub text: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub visibility: Option<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct GetPostResponse;
impl jacquard_common::xrpc::XrpcResp for GetPostResponse {
const NSID: &'static str = "uk.skyblur.post.getPost";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetPostOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetPost<S> {
const NSID: &'static str = "uk.skyblur.post.getPost";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = GetPostResponse;
}
pub struct GetPostRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetPostRequest {
const PATH: &'static str = "/xrpc/uk.skyblur.post.getPost";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<S: BosStr> = GetPost<S>;
type Response = GetPostResponse;
}
pub mod get_post_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 Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
}
}
pub struct GetPostBuilder<S: BosStr, St: get_post_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetPost<S> {
pub fn new() -> GetPostBuilder<S, get_post_state::Empty> {
GetPostBuilder::new()
}
}
impl<S: BosStr> GetPostBuilder<S, get_post_state::Empty> {
pub fn new() -> Self {
GetPostBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: get_post_state::State> GetPostBuilder<S, St> {
pub fn password(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_password(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> GetPostBuilder<S, St>
where
St: get_post_state::State,
St::Uri: get_post_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> GetPostBuilder<S, get_post_state::SetUri<St>> {
self._fields.1 = Option::Some(value.into());
GetPostBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetPostBuilder<S, St>
where
St: get_post_state::State,
St::Uri: get_post_state::IsSet,
{
pub fn build(self) -> GetPost<S> {
GetPost {
password: self._fields.0,
uri: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> GetPost<S> {
GetPost {
password: self._fields.0,
uri: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}