From 00143033489e11ae231ff9a6b967d2be2b34253b Mon Sep 17 00:00:00 2001 From: phil Date: Sun, 9 Aug 2026 14:38:02 -0400 Subject: [PATCH] more setup --- moots-lexicons/rustfmt.toml | 2 + .../src/com_bad_example/graph/get_mutuals.rs | 291 ------------------ readme.md | 7 + 3 files changed, 9 insertions(+), 291 deletions(-) create mode 100644 moots-lexicons/rustfmt.toml delete mode 100644 moots-lexicons/src/com_bad_example/graph/get_mutuals.rs diff --git a/moots-lexicons/rustfmt.toml b/moots-lexicons/rustfmt.toml new file mode 100644 index 0000000..28cbf09 --- /dev/null +++ b/moots-lexicons/rustfmt.toml @@ -0,0 +1,2 @@ +# generated code in here +disable_all_formatting = true diff --git a/moots-lexicons/src/com_bad_example/graph/get_mutuals.rs b/moots-lexicons/src/com_bad_example/graph/get_mutuals.rs deleted file mode 100644 index 120e65c..0000000 --- a/moots-lexicons/src/com_bad_example/graph/get_mutuals.rs +++ /dev/null @@ -1,291 +0,0 @@ -// @generated by jacquard-lexicon. DO NOT EDIT. -// -// Lexicon: com.bad-example.graph.getMutuals -// -// This file was automatically generated from Lexicon schemas. -// Any manual changes will be overwritten on the next regeneration. - -#[derive( - serde::Serialize, - serde::Deserialize, - Debug, - Clone, - PartialEq, - Eq, - jacquard_derive::IntoStatic -)] - -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: serde::Deserialize<'de> + jacquard_common::BosStr") -)] -pub struct GetMutuals { - #[serde(skip_serializing_if = "core::option::Option::is_none")] - pub cursor: core::option::Option, - pub did: jacquard_common::types::string::Did, - /// Defaults to `50`. Min: 1. Max: 100. - #[serde(default = "_default_limit")] - #[serde(skip_serializing_if = "core::option::Option::is_none")] - pub limit: core::option::Option, -} - - -#[derive( - serde::Serialize, - serde::Deserialize, - Debug, - Clone, - PartialEq, - Eq, - jacquard_derive::IntoStatic -)] - -#[serde( - rename_all = "camelCase", - bound(deserialize = "S: serde::Deserialize<'de> + jacquard_common::BosStr") -)] -pub struct GetMutualsOutput { - #[serde(skip_serializing_if = "core::option::Option::is_none")] - pub cursor: core::option::Option, - pub mutuals: Vec>, - #[serde(flatten, default, skip_serializing_if = "core::option::Option::is_none")] - pub extra_data: core::option::Option< - alloc::collections::BTreeMap< - jacquard_common::deps::smol_str::SmolStr, - jacquard_common::types::value::Data, - >, - >, -} - - -#[derive( - serde::Serialize, - serde::Deserialize, - Debug, - Clone, - PartialEq, - Eq, - thiserror::Error, - miette::Diagnostic -)] - -#[serde(tag = "error", content = "message")] -pub enum GetMutualsError { - /// The requested account is unknown to this service. - #[serde(rename = "AccountNotFound")] - AccountNotFound(core::option::Option), - /// The requested account is known to have been deleted. - #[serde(rename = "AccountGone")] - AccountGone(core::option::Option), - /// Catch-all for unknown error codes. - #[serde(untagged)] - Other { - error: jacquard_common::deps::smol_str::SmolStr, - message: Option, - }, -} - -impl core::fmt::Display for GetMutualsError { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - match self { - Self::AccountNotFound(msg) => { - write!(f, "AccountNotFound")?; - if let Some(msg) = msg { - write!(f, ": {}", msg)?; - } - Ok(()) - } - Self::AccountGone(msg) => { - write!(f, "AccountGone")?; - if let Some(msg) = msg { - write!(f, ": {}", msg)?; - } - Ok(()) - } - Self::Other { error, message } => { - write!(f, "{}", error)?; - if let Some(msg) = message { - write!(f, ": {}", msg)?; - } - Ok(()) - } - } - } -} - -/** Response marker for the `com.bad-example.graph.getMutuals` query. - -Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output`, which is `GetMutualsOutput` for this endpoint.*/ -pub struct GetMutualsResponse; -impl jacquard_common::xrpc::XrpcResp for GetMutualsResponse { - const NSID: &'static str = "com.bad-example.graph.getMutuals"; - const ENCODING: &'static str = "application/json"; - type Output = GetMutualsOutput; - type Err = GetMutualsError; -} - -impl jacquard_common::xrpc::XrpcRequest for GetMutuals { - const NSID: &'static str = "com.bad-example.graph.getMutuals"; - const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; - type Response = GetMutualsResponse; -} - -/** Endpoint marker for the `com.bad-example.graph.getMutuals` query. - -Path: `/xrpc/com.bad-example.graph.getMutuals`. The request payload type is `GetMutuals`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/ -pub struct GetMutualsRequest; -impl jacquard_common::xrpc::XrpcEndpoint for GetMutualsRequest { - const PATH: &'static str = "/xrpc/com.bad-example.graph.getMutuals"; - const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; - type Request = GetMutuals; - type Response = GetMutualsResponse; -} - -fn _default_limit() -> core::option::Option { - Some(50i64) -} - -pub mod get_mutuals_state { - - pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; - #[allow(unused)] - use ::core::marker::PhantomData; - mod sealed { - pub trait Sealed {} - } - /// State trait tracking which required fields have been set - pub trait State: sealed::Sealed { - type Did; - } - /// Empty state - all required fields are unset - pub struct Empty(()); - impl sealed::Sealed for Empty {} - impl State for Empty { - type Did = Unset; - } - ///State transition - sets the `did` field to Set - pub struct SetDid(PhantomData St>); - impl sealed::Sealed for SetDid {} - impl State for SetDid { - type Did = Set; - } - /// Marker types for field names - #[allow(non_camel_case_types)] - pub mod members { - ///Marker type for the `did` field - pub struct did(()); - } -} - -/// Builder for constructing an instance of this type. -pub struct GetMutualsBuilder< - St: get_mutuals_state::State, - S: jacquard_common::BosStr = jacquard_common::DefaultStr, -> { - _state: ::core::marker::PhantomData St>, - _fields: ( - core::option::Option, - core::option::Option>, - core::option::Option, - ), - _type: ::core::marker::PhantomData S>, -} - -impl GetMutuals { - /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed - pub fn new() -> GetMutualsBuilder< - get_mutuals_state::Empty, - jacquard_common::DefaultStr, - > { - GetMutualsBuilder::new() - } -} - -impl GetMutuals { - /// Create a new builder for this type - pub fn builder() -> GetMutualsBuilder { - GetMutualsBuilder::builder() - } -} - -impl GetMutualsBuilder { - /// Create a new builder with all fields unset, using the default string type, if needed - pub fn new() -> Self { - GetMutualsBuilder { - _state: ::core::marker::PhantomData, - _fields: (None, None, None), - _type: ::core::marker::PhantomData, - } - } -} - -impl GetMutualsBuilder { - /// Create a new builder with all fields unset - pub fn builder() -> Self { - GetMutualsBuilder { - _state: ::core::marker::PhantomData, - _fields: (None, None, None), - _type: ::core::marker::PhantomData, - } - } -} - -impl GetMutualsBuilder { - /// Set the `cursor` field (optional) - pub fn cursor(mut self, value: impl Into>) -> Self { - self._fields.0 = value.into(); - self - } - /// Set the `cursor` field to an Option value (optional) - pub fn maybe_cursor(mut self, value: Option) -> Self { - self._fields.0 = value; - self - } -} - -impl GetMutualsBuilder -where - St: get_mutuals_state::State, - St::Did: get_mutuals_state::IsUnset, -{ - /// Set the `did` field (required) - pub fn did( - mut self, - value: impl Into>, - ) -> GetMutualsBuilder, S> { - self._fields.1 = ::core::option::Option::Some(value.into()); - GetMutualsBuilder { - _state: ::core::marker::PhantomData, - _fields: self._fields, - _type: ::core::marker::PhantomData, - } - } -} - -impl GetMutualsBuilder { - /// Set the `limit` field (optional) - pub fn limit(mut self, value: impl Into>) -> Self { - self._fields.2 = value.into(); - self - } - /// Set the `limit` field to an Option value (optional) - pub fn maybe_limit(mut self, value: Option) -> Self { - self._fields.2 = value; - self - } -} - -impl GetMutualsBuilder -where - St: get_mutuals_state::State, - St::Did: get_mutuals_state::IsSet, -{ - /// Build the final struct. - pub fn build(self) -> GetMutuals { - GetMutuals { - cursor: self._fields.0, - did: self._fields.1.unwrap(), - limit: self._fields.2, - } - } -} \ No newline at end of file diff --git a/readme.md b/readme.md index 1c1dd5b..73a89e6 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,10 @@ # mutuals index: hubble-sync tutorial wip + + +## codegen for lexicons + +```bash +cargo run -p moots-lexgen +``` -- 2.51.2