#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::types::string::Did;
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};
use crate::com_whtwnd::blog::BlogEntry;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetAuthorPosts<'a> {
#[serde(borrow)]
pub author: Did<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetAuthorPostsOutput<'a> {
#[serde(borrow)]
pub post: Vec<BlogEntry<'a>>,
}
pub struct GetAuthorPostsResponse;
impl jacquard_common::xrpc::XrpcResp for GetAuthorPostsResponse {
const NSID: &'static str = "com.whtwnd.blog.getAuthorPosts";
const ENCODING: &'static str = "application/json";
type Output<'de> = GetAuthorPostsOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for GetAuthorPosts<'a> {
const NSID: &'static str = "com.whtwnd.blog.getAuthorPosts";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetAuthorPostsResponse;
}
pub struct GetAuthorPostsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetAuthorPostsRequest {
const PATH: &'static str = "/xrpc/com.whtwnd.blog.getAuthorPosts";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<'de> = GetAuthorPosts<'de>;
type Response = GetAuthorPostsResponse;
}
pub mod get_author_posts_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 Author;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Author = Unset;
}
pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAuthor<S> {}
impl<S: State> State for SetAuthor<S> {
type Author = Set<members::author>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct author(());
}
}
pub struct GetAuthorPostsBuilder<'a, S: get_author_posts_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Did<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> GetAuthorPosts<'a> {
pub fn new() -> GetAuthorPostsBuilder<'a, get_author_posts_state::Empty> {
GetAuthorPostsBuilder::new()
}
}
impl<'a> GetAuthorPostsBuilder<'a, get_author_posts_state::Empty> {
pub fn new() -> Self {
GetAuthorPostsBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> GetAuthorPostsBuilder<'a, S>
where
S: get_author_posts_state::State,
S::Author: get_author_posts_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<Did<'a>>,
) -> GetAuthorPostsBuilder<'a, get_author_posts_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
GetAuthorPostsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> GetAuthorPostsBuilder<'a, S>
where
S: get_author_posts_state::State,
S::Author: get_author_posts_state::IsSet,
{
pub fn build(self) -> GetAuthorPosts<'a> {
GetAuthorPosts {
author: self._fields.0.unwrap(),
}
}
}