atproto blogging
at main 183 lines 5.8 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.feed.getTimeline 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[derive( 9 serde::Serialize, 10 serde::Deserialize, 11 Debug, 12 Clone, 13 PartialEq, 14 Eq, 15 jacquard_derive::IntoStatic 16)] 17#[serde(rename_all = "camelCase")] 18pub struct GetTimeline<'a> { 19 #[serde(skip_serializing_if = "std::option::Option::is_none")] 20 #[serde(borrow)] 21 pub algorithm: std::option::Option<jacquard_common::CowStr<'a>>, 22 #[serde(skip_serializing_if = "std::option::Option::is_none")] 23 #[serde(borrow)] 24 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 25 ///(default: 50, min: 1, max: 100) 26 #[serde(skip_serializing_if = "std::option::Option::is_none")] 27 pub limit: std::option::Option<i64>, 28} 29 30pub mod get_timeline_state { 31 32 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 33 #[allow(unused)] 34 use ::core::marker::PhantomData; 35 mod sealed { 36 pub trait Sealed {} 37 } 38 /// State trait tracking which required fields have been set 39 pub trait State: sealed::Sealed {} 40 /// Empty state - all required fields are unset 41 pub struct Empty(()); 42 impl sealed::Sealed for Empty {} 43 impl State for Empty {} 44 /// Marker types for field names 45 #[allow(non_camel_case_types)] 46 pub mod members {} 47} 48 49/// Builder for constructing an instance of this type 50pub struct GetTimelineBuilder<'a, S: get_timeline_state::State> { 51 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 52 __unsafe_private_named: ( 53 ::core::option::Option<jacquard_common::CowStr<'a>>, 54 ::core::option::Option<jacquard_common::CowStr<'a>>, 55 ::core::option::Option<i64>, 56 ), 57 _phantom: ::core::marker::PhantomData<&'a ()>, 58} 59 60impl<'a> GetTimeline<'a> { 61 /// Create a new builder for this type 62 pub fn new() -> GetTimelineBuilder<'a, get_timeline_state::Empty> { 63 GetTimelineBuilder::new() 64 } 65} 66 67impl<'a> GetTimelineBuilder<'a, get_timeline_state::Empty> { 68 /// Create a new builder with all fields unset 69 pub fn new() -> Self { 70 GetTimelineBuilder { 71 _phantom_state: ::core::marker::PhantomData, 72 __unsafe_private_named: (None, None, None), 73 _phantom: ::core::marker::PhantomData, 74 } 75 } 76} 77 78impl<'a, S: get_timeline_state::State> GetTimelineBuilder<'a, S> { 79 /// Set the `algorithm` field (optional) 80 pub fn algorithm( 81 mut self, 82 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 83 ) -> Self { 84 self.__unsafe_private_named.0 = value.into(); 85 self 86 } 87 /// Set the `algorithm` field to an Option value (optional) 88 pub fn maybe_algorithm( 89 mut self, 90 value: Option<jacquard_common::CowStr<'a>>, 91 ) -> Self { 92 self.__unsafe_private_named.0 = value; 93 self 94 } 95} 96 97impl<'a, S: get_timeline_state::State> GetTimelineBuilder<'a, S> { 98 /// Set the `cursor` field (optional) 99 pub fn cursor( 100 mut self, 101 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 102 ) -> Self { 103 self.__unsafe_private_named.1 = value.into(); 104 self 105 } 106 /// Set the `cursor` field to an Option value (optional) 107 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 108 self.__unsafe_private_named.1 = value; 109 self 110 } 111} 112 113impl<'a, S: get_timeline_state::State> GetTimelineBuilder<'a, S> { 114 /// Set the `limit` field (optional) 115 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self { 116 self.__unsafe_private_named.2 = value.into(); 117 self 118 } 119 /// Set the `limit` field to an Option value (optional) 120 pub fn maybe_limit(mut self, value: Option<i64>) -> Self { 121 self.__unsafe_private_named.2 = value; 122 self 123 } 124} 125 126impl<'a, S> GetTimelineBuilder<'a, S> 127where 128 S: get_timeline_state::State, 129{ 130 /// Build the final struct 131 pub fn build(self) -> GetTimeline<'a> { 132 GetTimeline { 133 algorithm: self.__unsafe_private_named.0, 134 cursor: self.__unsafe_private_named.1, 135 limit: self.__unsafe_private_named.2, 136 } 137 } 138} 139 140#[jacquard_derive::lexicon] 141#[derive( 142 serde::Serialize, 143 serde::Deserialize, 144 Debug, 145 Clone, 146 PartialEq, 147 Eq, 148 jacquard_derive::IntoStatic 149)] 150#[serde(rename_all = "camelCase")] 151pub struct GetTimelineOutput<'a> { 152 #[serde(skip_serializing_if = "std::option::Option::is_none")] 153 #[serde(borrow)] 154 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 155 #[serde(borrow)] 156 pub feed: Vec<crate::app_bsky::feed::FeedViewPost<'a>>, 157} 158 159/// Response type for 160///app.bsky.feed.getTimeline 161pub struct GetTimelineResponse; 162impl jacquard_common::xrpc::XrpcResp for GetTimelineResponse { 163 const NSID: &'static str = "app.bsky.feed.getTimeline"; 164 const ENCODING: &'static str = "application/json"; 165 type Output<'de> = GetTimelineOutput<'de>; 166 type Err<'de> = jacquard_common::xrpc::GenericError<'de>; 167} 168 169impl<'a> jacquard_common::xrpc::XrpcRequest for GetTimeline<'a> { 170 const NSID: &'static str = "app.bsky.feed.getTimeline"; 171 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 172 type Response = GetTimelineResponse; 173} 174 175/// Endpoint type for 176///app.bsky.feed.getTimeline 177pub struct GetTimelineRequest; 178impl jacquard_common::xrpc::XrpcEndpoint for GetTimelineRequest { 179 const PATH: &'static str = "/xrpc/app.bsky.feed.getTimeline"; 180 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 181 type Request<'de> = GetTimeline<'de>; 182 type Response = GetTimelineResponse; 183}