pub mod get_recipe;
pub mod get_recipes;
pub mod recipe;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::blue_recipes::actor::ProfileViewBasic;
use crate::blue_recipes::feed::recipe::Recipe;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct NotFoundRecipe<'a> {
pub not_found: bool,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RecipeView<'a> {
#[serde(borrow)]
pub author: ProfileViewBasic<'a>,
#[serde(borrow)]
pub cid: Cid<'a>,
pub indexed_at: Datetime,
#[serde(borrow)]
pub record: Recipe<'a>,
#[serde(borrow)]
pub uri: AtUri<'a>,
}
impl<'a> LexiconSchema for NotFoundRecipe<'a> {
fn nsid() -> &'static str {
"blue.recipes.feed.defs"
}
fn def_name() -> &'static str {
"notFoundRecipe"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_blue_recipes_feed_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for RecipeView<'a> {
fn nsid() -> &'static str {
"blue.recipes.feed.defs"
}
fn def_name() -> &'static str {
"recipeView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_blue_recipes_feed_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod not_found_recipe_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;
type NotFound;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type NotFound = Unset;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Uri = Set<members::uri>;
type NotFound = S::NotFound;
}
pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetNotFound<S> {}
impl<S: State> State for SetNotFound<S> {
type Uri = S::Uri;
type NotFound = Set<members::not_found>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct not_found(());
}
}
pub struct NotFoundRecipeBuilder<'a, S: not_found_recipe_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<bool>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> NotFoundRecipe<'a> {
pub fn new() -> NotFoundRecipeBuilder<'a, not_found_recipe_state::Empty> {
NotFoundRecipeBuilder::new()
}
}
impl<'a> NotFoundRecipeBuilder<'a, not_found_recipe_state::Empty> {
pub fn new() -> Self {
NotFoundRecipeBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotFoundRecipeBuilder<'a, S>
where
S: not_found_recipe_state::State,
S::NotFound: not_found_recipe_state::IsUnset,
{
pub fn not_found(
mut self,
value: impl Into<bool>,
) -> NotFoundRecipeBuilder<'a, not_found_recipe_state::SetNotFound<S>> {
self._fields.0 = Option::Some(value.into());
NotFoundRecipeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotFoundRecipeBuilder<'a, S>
where
S: not_found_recipe_state::State,
S::Uri: not_found_recipe_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> NotFoundRecipeBuilder<'a, not_found_recipe_state::SetUri<S>> {
self._fields.1 = Option::Some(value.into());
NotFoundRecipeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> NotFoundRecipeBuilder<'a, S>
where
S: not_found_recipe_state::State,
S::Uri: not_found_recipe_state::IsSet,
S::NotFound: not_found_recipe_state::IsSet,
{
pub fn build(self) -> NotFoundRecipe<'a> {
NotFoundRecipe {
not_found: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> NotFoundRecipe<'a> {
NotFoundRecipe {
not_found: self._fields.0.unwrap(),
uri: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_blue_recipes_feed_defs() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("blue.recipes.feed.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("notFoundRecipe"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("uri"), SmolStr::new_static("notFound")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("notFound"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("recipeView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Response model for fetching multiple recipes.",
),
),
required: Some(
vec![
SmolStr::new_static("uri"), SmolStr::new_static("cid"),
SmolStr::new_static("author"), SmolStr::new_static("record"),
SmolStr::new_static("indexedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("author"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"blue.recipes.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("indexedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("blue.recipes.feed.recipe"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod recipe_view_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;
type Cid;
type Author;
type Record;
type IndexedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
type Cid = Unset;
type Author = Unset;
type Record = Unset;
type IndexedAt = Unset;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Uri = Set<members::uri>;
type Cid = S::Cid;
type Author = S::Author;
type Record = S::Record;
type IndexedAt = S::IndexedAt;
}
pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCid<S> {}
impl<S: State> State for SetCid<S> {
type Uri = S::Uri;
type Cid = Set<members::cid>;
type Author = S::Author;
type Record = S::Record;
type IndexedAt = S::IndexedAt;
}
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 Uri = S::Uri;
type Cid = S::Cid;
type Author = Set<members::author>;
type Record = S::Record;
type IndexedAt = S::IndexedAt;
}
pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRecord<S> {}
impl<S: State> State for SetRecord<S> {
type Uri = S::Uri;
type Cid = S::Cid;
type Author = S::Author;
type Record = Set<members::record>;
type IndexedAt = S::IndexedAt;
}
pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
impl<S: State> State for SetIndexedAt<S> {
type Uri = S::Uri;
type Cid = S::Cid;
type Author = S::Author;
type Record = S::Record;
type IndexedAt = Set<members::indexed_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
pub struct cid(());
pub struct author(());
pub struct record(());
pub struct indexed_at(());
}
}
pub struct RecipeViewBuilder<'a, S: recipe_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<ProfileViewBasic<'a>>,
Option<Cid<'a>>,
Option<Datetime>,
Option<Recipe<'a>>,
Option<AtUri<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> RecipeView<'a> {
pub fn new() -> RecipeViewBuilder<'a, recipe_view_state::Empty> {
RecipeViewBuilder::new()
}
}
impl<'a> RecipeViewBuilder<'a, recipe_view_state::Empty> {
pub fn new() -> Self {
RecipeViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecipeViewBuilder<'a, S>
where
S: recipe_view_state::State,
S::Author: recipe_view_state::IsUnset,
{
pub fn author(
mut self,
value: impl Into<ProfileViewBasic<'a>>,
) -> RecipeViewBuilder<'a, recipe_view_state::SetAuthor<S>> {
self._fields.0 = Option::Some(value.into());
RecipeViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecipeViewBuilder<'a, S>
where
S: recipe_view_state::State,
S::Cid: recipe_view_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<'a>>,
) -> RecipeViewBuilder<'a, recipe_view_state::SetCid<S>> {
self._fields.1 = Option::Some(value.into());
RecipeViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecipeViewBuilder<'a, S>
where
S: recipe_view_state::State,
S::IndexedAt: recipe_view_state::IsUnset,
{
pub fn indexed_at(
mut self,
value: impl Into<Datetime>,
) -> RecipeViewBuilder<'a, recipe_view_state::SetIndexedAt<S>> {
self._fields.2 = Option::Some(value.into());
RecipeViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecipeViewBuilder<'a, S>
where
S: recipe_view_state::State,
S::Record: recipe_view_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<Recipe<'a>>,
) -> RecipeViewBuilder<'a, recipe_view_state::SetRecord<S>> {
self._fields.3 = Option::Some(value.into());
RecipeViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecipeViewBuilder<'a, S>
where
S: recipe_view_state::State,
S::Uri: recipe_view_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> RecipeViewBuilder<'a, recipe_view_state::SetUri<S>> {
self._fields.4 = Option::Some(value.into());
RecipeViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> RecipeViewBuilder<'a, S>
where
S: recipe_view_state::State,
S::Uri: recipe_view_state::IsSet,
S::Cid: recipe_view_state::IsSet,
S::Author: recipe_view_state::IsSet,
S::Record: recipe_view_state::IsSet,
S::IndexedAt: recipe_view_state::IsSet,
{
pub fn build(self) -> RecipeView<'a> {
RecipeView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
record: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> RecipeView<'a> {
RecipeView {
author: self._fields.0.unwrap(),
cid: self._fields.1.unwrap(),
indexed_at: self._fields.2.unwrap(),
record: self._fields.3.unwrap(),
uri: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}