Skip to main content

jacquard_api/app_bsky/actor/
get_profiles.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.actor.getProfiles
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::types::ident::AtIdentifier;
14use jacquard_derive::{IntoStatic, lexicon};
15use serde::{Serialize, Deserialize};
16use crate::app_bsky::actor::ProfileViewDetailed;
17
18#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
19#[serde(rename_all = "camelCase")]
20pub struct GetProfiles<'a> {
21    #[serde(borrow)]
22    pub actors: Vec<AtIdentifier<'a>>,
23}
24
25
26#[lexicon]
27#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
28#[serde(rename_all = "camelCase")]
29pub struct GetProfilesOutput<'a> {
30    #[serde(borrow)]
31    pub profiles: Vec<ProfileViewDetailed<'a>>,
32}
33
34/// Response type for app.bsky.actor.getProfiles
35pub struct GetProfilesResponse;
36impl jacquard_common::xrpc::XrpcResp for GetProfilesResponse {
37    const NSID: &'static str = "app.bsky.actor.getProfiles";
38    const ENCODING: &'static str = "application/json";
39    type Output<'de> = GetProfilesOutput<'de>;
40    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
41}
42
43impl<'a> jacquard_common::xrpc::XrpcRequest for GetProfiles<'a> {
44    const NSID: &'static str = "app.bsky.actor.getProfiles";
45    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
46    type Response = GetProfilesResponse;
47}
48
49/// Endpoint type for app.bsky.actor.getProfiles
50pub struct GetProfilesRequest;
51impl jacquard_common::xrpc::XrpcEndpoint for GetProfilesRequest {
52    const PATH: &'static str = "/xrpc/app.bsky.actor.getProfiles";
53    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
54    type Request<'de> = GetProfiles<'de>;
55    type Response = GetProfilesResponse;
56}
57
58pub mod get_profiles_state {
59
60    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
61    #[allow(unused)]
62    use ::core::marker::PhantomData;
63    mod sealed {
64        pub trait Sealed {}
65    }
66    /// State trait tracking which required fields have been set
67    pub trait State: sealed::Sealed {
68        type Actors;
69    }
70    /// Empty state - all required fields are unset
71    pub struct Empty(());
72    impl sealed::Sealed for Empty {}
73    impl State for Empty {
74        type Actors = Unset;
75    }
76    ///State transition - sets the `actors` field to Set
77    pub struct SetActors<S: State = Empty>(PhantomData<fn() -> S>);
78    impl<S: State> sealed::Sealed for SetActors<S> {}
79    impl<S: State> State for SetActors<S> {
80        type Actors = Set<members::actors>;
81    }
82    /// Marker types for field names
83    #[allow(non_camel_case_types)]
84    pub mod members {
85        ///Marker type for the `actors` field
86        pub struct actors(());
87    }
88}
89
90/// Builder for constructing an instance of this type
91pub struct GetProfilesBuilder<'a, S: get_profiles_state::State> {
92    _state: PhantomData<fn() -> S>,
93    _fields: (Option<Vec<AtIdentifier<'a>>>,),
94    _lifetime: PhantomData<&'a ()>,
95}
96
97impl<'a> GetProfiles<'a> {
98    /// Create a new builder for this type
99    pub fn new() -> GetProfilesBuilder<'a, get_profiles_state::Empty> {
100        GetProfilesBuilder::new()
101    }
102}
103
104impl<'a> GetProfilesBuilder<'a, get_profiles_state::Empty> {
105    /// Create a new builder with all fields unset
106    pub fn new() -> Self {
107        GetProfilesBuilder {
108            _state: PhantomData,
109            _fields: (None,),
110            _lifetime: PhantomData,
111        }
112    }
113}
114
115impl<'a, S> GetProfilesBuilder<'a, S>
116where
117    S: get_profiles_state::State,
118    S::Actors: get_profiles_state::IsUnset,
119{
120    /// Set the `actors` field (required)
121    pub fn actors(
122        mut self,
123        value: impl Into<Vec<AtIdentifier<'a>>>,
124    ) -> GetProfilesBuilder<'a, get_profiles_state::SetActors<S>> {
125        self._fields.0 = Option::Some(value.into());
126        GetProfilesBuilder {
127            _state: PhantomData,
128            _fields: self._fields,
129            _lifetime: PhantomData,
130        }
131    }
132}
133
134impl<'a, S> GetProfilesBuilder<'a, S>
135where
136    S: get_profiles_state::State,
137    S::Actors: get_profiles_state::IsSet,
138{
139    /// Build the final struct
140    pub fn build(self) -> GetProfiles<'a> {
141        GetProfiles {
142            actors: self._fields.0.unwrap(),
143        }
144    }
145}