Skip to content

Commit

Permalink
Update codegen for LexRefUnion, update api
Browse files Browse the repository at this point in the history
  • Loading branch information
sugyan committed Apr 27, 2023
1 parent 78b43ad commit 29b2992
Show file tree
Hide file tree
Showing 95 changed files with 586 additions and 238 deletions.
8 changes: 4 additions & 4 deletions atrium-api/src/app/bsky/actor/defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! A reference to an actor in the network.
// app.bsky.actor.defs#profileView
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ProfileView {
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -23,7 +23,7 @@ pub struct ProfileView {
}

// app.bsky.actor.defs#profileViewBasic
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ProfileViewBasic {
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -39,7 +39,7 @@ pub struct ProfileViewBasic {
}

// app.bsky.actor.defs#profileViewDetailed
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ProfileViewDetailed {
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -67,7 +67,7 @@ pub struct ProfileViewDetailed {
}

// app.bsky.actor.defs#viewerState
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ViewerState {
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
2 changes: 1 addition & 1 deletion atrium-api/src/app/bsky/actor/get_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub trait GetProfile: crate::xrpc::XrpcClient {
}
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
pub actor: String,
Expand Down
4 changes: 2 additions & 2 deletions atrium-api/src/app/bsky/actor/get_profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ pub trait GetProfiles: crate::xrpc::XrpcClient {
}
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
pub actors: Vec<String>,
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Output {
pub profiles: Vec<crate::app::bsky::actor::defs::ProfileViewDetailed>,
Expand Down
4 changes: 2 additions & 2 deletions atrium-api/src/app/bsky/actor/get_suggestions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub trait GetSuggestions: crate::xrpc::XrpcClient {
}
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -25,7 +25,7 @@ pub struct Parameters {
pub limit: Option<i32>,
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Output {
pub actors: Vec<crate::app::bsky::actor::defs::ProfileView>,
Expand Down
2 changes: 1 addition & 1 deletion atrium-api/src/app/bsky/actor/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! Definitions for the `app.bsky.actor.profile` namespace.
// app.bsky.actor.profile
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Record {
// pub avatar: ...,
Expand Down
4 changes: 2 additions & 2 deletions atrium-api/src/app/bsky/actor/search_actors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub trait SearchActors: crate::xrpc::XrpcClient {
}
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -27,7 +27,7 @@ pub struct Parameters {
pub term: Option<String>,
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Output {
pub actors: Vec<crate::app::bsky::actor::defs::ProfileView>,
Expand Down
4 changes: 2 additions & 2 deletions atrium-api/src/app/bsky/actor/search_actors_typeahead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub trait SearchActorsTypeahead: crate::xrpc::XrpcClient {
}
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -25,7 +25,7 @@ pub struct Parameters {
pub term: Option<String>,
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Output {
pub actors: Vec<crate::app::bsky::actor::defs::ProfileViewBasic>,
Expand Down
8 changes: 4 additions & 4 deletions atrium-api/src/app/bsky/embed/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
//! A representation of some externally linked content, embedded in another form of content
// app.bsky.embed.external
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Main {
pub external: External,
}

// app.bsky.embed.external#external
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct External {
pub description: String,
Expand All @@ -20,14 +20,14 @@ pub struct External {
}

// app.bsky.embed.external#view
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct View {
pub external: ViewExternal,
}

// app.bsky.embed.external#viewExternal
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ViewExternal {
pub description: String,
Expand Down
8 changes: 4 additions & 4 deletions atrium-api/src/app/bsky/embed/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
//! A set of images embedded in some other form of content
// app.bsky.embed.images
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Main {
pub images: Vec<Image>,
}

// app.bsky.embed.images#image
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Image {
pub alt: String,
// pub image: ...,
}

// app.bsky.embed.images#view
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct View {
pub images: Vec<ViewImage>,
}

// app.bsky.embed.images#viewImage
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ViewImage {
pub alt: String,
Expand Down
37 changes: 31 additions & 6 deletions atrium-api/src/app/bsky/embed/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,61 @@
//! A representation of a record embedded in another form of content
// app.bsky.embed.record
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Main {
pub record: crate::com::atproto::repo::strong_ref::Main,
}

// app.bsky.embed.record#view
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct View {
// pub record: ...,
pub record: Box<ViewRecordEnum>,
}

// app.bsky.embed.record#viewNotFound
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ViewNotFound {
pub uri: String,
}

// app.bsky.embed.record#viewRecord
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ViewRecord {
pub author: crate::app::bsky::actor::defs::ProfileViewBasic,
pub cid: String,
// pub embeds: Vec<...>
#[serde(skip_serializing_if = "Option::is_none")]
pub embeds: Option<Vec<ViewRecordEmbedsItem>>,
pub indexed_at: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<crate::com::atproto::label::defs::Label>>,
pub uri: String,
pub value: crate::records::Record,
}

#[allow(clippy::large_enum_variant)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(tag = "$type")]
pub enum ViewRecordEmbedsItem {
#[serde(rename = "app.bsky.embed.images#view")]
AppBskyEmbedImagesView(crate::app::bsky::embed::images::View),
#[serde(rename = "app.bsky.embed.external#view")]
AppBskyEmbedExternalView(crate::app::bsky::embed::external::View),
#[serde(rename = "app.bsky.embed.record#view")]
AppBskyEmbedRecordView(crate::app::bsky::embed::record::View),
#[serde(rename = "app.bsky.embed.recordWithMedia#view")]
AppBskyEmbedRecordWithMediaView(crate::app::bsky::embed::record_with_media::View),
}

#[allow(clippy::large_enum_variant)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(tag = "$type")]
pub enum ViewRecordEnum {
#[serde(rename = "app.bsky.embed.record#viewRecord")]
ViewRecord(ViewRecord),
#[serde(rename = "app.bsky.embed.record#viewNotFound")]
ViewNotFound(ViewNotFound),
}
28 changes: 24 additions & 4 deletions atrium-api/src/app/bsky/embed/record_with_media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,37 @@
//! A representation of a record embedded in another form of content, alongside other compatible embeds
// app.bsky.embed.recordWithMedia
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Main {
// pub media: ...,
pub media: Box<MainMediaEnum>,
pub record: crate::app::bsky::embed::record::Main,
}

// app.bsky.embed.recordWithMedia#view
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Default)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct View {
// pub media: ...,
pub media: Box<ViewMediaEnum>,
pub record: crate::app::bsky::embed::record::View,
}

#[allow(clippy::large_enum_variant)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(tag = "$type")]
pub enum MainMediaEnum {
#[serde(rename = "app.bsky.embed.images")]
AppBskyEmbedImagesMain(crate::app::bsky::embed::images::Main),
#[serde(rename = "app.bsky.embed.external")]
AppBskyEmbedExternalMain(crate::app::bsky::embed::external::Main),
}

#[allow(clippy::large_enum_variant)]
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
#[serde(tag = "$type")]
pub enum ViewMediaEnum {
#[serde(rename = "app.bsky.embed.images#view")]
AppBskyEmbedImagesView(crate::app::bsky::embed::images::View),
#[serde(rename = "app.bsky.embed.external#view")]
AppBskyEmbedExternalView(crate::app::bsky::embed::external::View),
}
Loading

0 comments on commit 29b2992

Please sign in to comment.