Skip to content

Commit

Permalink
Merge pull request #14 from sugyan/feature/update-codegen
Browse files Browse the repository at this point in the history
Update API
  • Loading branch information
sugyan authored May 13, 2023
2 parents 747a1b4 + 226b841 commit dcb47f7
Show file tree
Hide file tree
Showing 25 changed files with 504 additions and 26 deletions.
2 changes: 2 additions & 0 deletions atrium-api/src/app/bsky/actor.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
pub mod defs;
pub mod get_preferences;
pub mod get_profile;
pub mod get_profiles;
pub mod get_suggestions;
pub mod profile;
pub mod put_preferences;
pub mod search_actors;
pub mod search_actors_typeahead;
25 changes: 25 additions & 0 deletions atrium-api/src/app/bsky/actor/defs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.actor.defs` namespace."]
#![doc = "A reference to an actor in the network."]
#[doc = "`app.bsky.actor.defs#adultContentPref`"]
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct AdultContentPref {
pub enabled: bool,
}
#[doc = "`app.bsky.actor.defs#contentLabelPref`"]
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ContentLabelPref {
pub label: String,
pub visibility: String,
}
#[doc = "`app.bsky.actor.defs#preferences`"]
pub type Preferences = Vec<Box<PreferencesItem>>;
#[doc = "`app.bsky.actor.defs#profileView`"]
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -76,4 +91,14 @@ pub struct ViewerState {
pub following: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub muted: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub muted_by_list: Option<crate::app::bsky::graph::defs::ListViewBasic>,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "$type")]
pub enum PreferencesItem {
#[serde(rename = "app.bsky.actor.defs#adultContentPref")]
AdultContentPref(AdultContentPref),
#[serde(rename = "app.bsky.actor.defs#contentLabelPref")]
ContentLabelPref(ContentLabelPref),
}
33 changes: 33 additions & 0 deletions atrium-api/src/app/bsky/actor/get_preferences.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.actor.getPreferences` namespace."]
#[doc = "`app.bsky.actor.getPreferences`"]
#[doc = "Get private preferences attached to the account."]
#[async_trait::async_trait]
pub trait GetPreferences: crate::xrpc::XrpcClient {
async fn get_preferences(
&self,
params: Parameters,
) -> Result<Output, Box<dyn std::error::Error>> {
let body = crate::xrpc::XrpcClient::send::<Error>(
self,
http::Method::GET,
"app.bsky.actor.getPreferences",
Some(serde_urlencoded::to_string(&params)?),
None,
None,
)
.await?;
serde_json::from_slice(&body).map_err(|e| e.into())
}
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Output {
pub preferences: crate::app::bsky::actor::defs::Preferences,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {}
27 changes: 27 additions & 0 deletions atrium-api/src/app/bsky/actor/put_preferences.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.actor.putPreferences` namespace."]
#[doc = "`app.bsky.actor.putPreferences`"]
#[doc = "Sets the private preferences attached to the account."]
#[async_trait::async_trait]
pub trait PutPreferences: crate::xrpc::XrpcClient {
async fn put_preferences(&self, input: Input) -> Result<(), Box<dyn std::error::Error>> {
let _ = crate::xrpc::XrpcClient::send::<Error>(
self,
http::Method::POST,
"app.bsky.actor.putPreferences",
None,
Some(serde_json::to_vec(&input)?),
Some(String::from("application/json")),
)
.await?;
Ok(())
}
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Input {
pub preferences: crate::app::bsky::actor::defs::Preferences,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {}
8 changes: 8 additions & 0 deletions atrium-api/src/app/bsky/graph.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
pub mod block;
pub mod defs;
pub mod follow;
pub mod get_blocks;
pub mod get_followers;
pub mod get_follows;
pub mod get_list;
pub mod get_list_mutes;
pub mod get_lists;
pub mod get_mutes;
pub mod list;
pub mod listitem;
pub mod mute_actor;
pub mod mute_actor_list;
pub mod unmute_actor;
pub mod unmute_actor_list;
52 changes: 52 additions & 0 deletions atrium-api/src/app/bsky/graph/defs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.graph.defs` namespace."]
#[doc = "`app.bsky.graph.defs#listItemView`"]
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ListItemView {
pub subject: crate::app::bsky::actor::defs::ProfileView,
}
#[doc = "`app.bsky.graph.defs#listPurpose`"]
pub type ListPurpose = String;
#[doc = "`app.bsky.graph.defs#listView`"]
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ListView {
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar: Option<String>,
pub creator: crate::app::bsky::actor::defs::ProfileView,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description_facets: Option<Vec<crate::app::bsky::richtext::facet::Main>>,
pub indexed_at: String,
pub name: String,
pub purpose: ListPurpose,
pub uri: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer: Option<ListViewerState>,
}
#[doc = "`app.bsky.graph.defs#listViewBasic`"]
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ListViewBasic {
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub indexed_at: Option<String>,
pub name: String,
pub purpose: ListPurpose,
pub uri: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub viewer: Option<ListViewerState>,
}
#[doc = "`app.bsky.graph.defs#listViewerState`"]
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ListViewerState {
#[serde(skip_serializing_if = "Option::is_none")]
pub muted: Option<bool>,
}
#[doc = "`app.bsky.graph.defs#modlist`"]
#[doc = "A list of actors to apply an aggregate moderation action (mute/block) on"]
pub struct Modlist;
39 changes: 39 additions & 0 deletions atrium-api/src/app/bsky/graph/get_list.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.graph.getList` namespace."]
#[doc = "`app.bsky.graph.getList`"]
#[doc = "Fetch a list of actors"]
#[async_trait::async_trait]
pub trait GetList: crate::xrpc::XrpcClient {
async fn get_list(&self, params: Parameters) -> Result<Output, Box<dyn std::error::Error>> {
let body = crate::xrpc::XrpcClient::send::<Error>(
self,
http::Method::GET,
"app.bsky.graph.getList",
Some(serde_urlencoded::to_string(&params)?),
None,
None,
)
.await?;
serde_json::from_slice(&body).map_err(|e| e.into())
}
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i32>,
pub list: String,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Output {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<String>,
pub items: Vec<crate::app::bsky::graph::defs::ListItemView>,
pub list: crate::app::bsky::graph::defs::ListView,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {}
40 changes: 40 additions & 0 deletions atrium-api/src/app/bsky/graph/get_list_mutes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.graph.getListMutes` namespace."]
#[doc = "`app.bsky.graph.getListMutes`"]
#[doc = "Which lists is the requester's account muting?"]
#[async_trait::async_trait]
pub trait GetListMutes: crate::xrpc::XrpcClient {
async fn get_list_mutes(
&self,
params: Parameters,
) -> Result<Output, Box<dyn std::error::Error>> {
let body = crate::xrpc::XrpcClient::send::<Error>(
self,
http::Method::GET,
"app.bsky.graph.getListMutes",
Some(serde_urlencoded::to_string(&params)?),
None,
None,
)
.await?;
serde_json::from_slice(&body).map_err(|e| e.into())
}
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i32>,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Output {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<String>,
pub lists: Vec<crate::app::bsky::graph::defs::ListView>,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {}
38 changes: 38 additions & 0 deletions atrium-api/src/app/bsky/graph/get_lists.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.graph.getLists` namespace."]
#[doc = "`app.bsky.graph.getLists`"]
#[doc = "Fetch a list of lists that belong to an actor"]
#[async_trait::async_trait]
pub trait GetLists: crate::xrpc::XrpcClient {
async fn get_lists(&self, params: Parameters) -> Result<Output, Box<dyn std::error::Error>> {
let body = crate::xrpc::XrpcClient::send::<Error>(
self,
http::Method::GET,
"app.bsky.graph.getLists",
Some(serde_urlencoded::to_string(&params)?),
None,
None,
)
.await?;
serde_json::from_slice(&body).map_err(|e| e.into())
}
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
pub actor: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i32>,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Output {
#[serde(skip_serializing_if = "Option::is_none")]
pub cursor: Option<String>,
pub lists: Vec<crate::app::bsky::graph::defs::ListView>,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {}
16 changes: 16 additions & 0 deletions atrium-api/src/app/bsky/graph/list.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.graph.list` namespace."]
#[doc = "`app.bsky.graph.list`"]
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Record {
#[serde(skip_serializing_if = "Option::is_none")]
pub avatar: Option<crate::blob::BlobRef>,
pub created_at: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description_facets: Option<Vec<crate::app::bsky::richtext::facet::Main>>,
pub name: String,
pub purpose: crate::app::bsky::graph::defs::ListPurpose,
}
10 changes: 10 additions & 0 deletions atrium-api/src/app/bsky/graph/listitem.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.graph.listitem` namespace."]
#[doc = "`app.bsky.graph.listitem`"]
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Record {
pub created_at: String,
pub list: String,
pub subject: String,
}
27 changes: 27 additions & 0 deletions atrium-api/src/app/bsky/graph/mute_actor_list.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.graph.muteActorList` namespace."]
#[doc = "`app.bsky.graph.muteActorList`"]
#[doc = "Mute a list of actors."]
#[async_trait::async_trait]
pub trait MuteActorList: crate::xrpc::XrpcClient {
async fn mute_actor_list(&self, input: Input) -> Result<(), Box<dyn std::error::Error>> {
let _ = crate::xrpc::XrpcClient::send::<Error>(
self,
http::Method::POST,
"app.bsky.graph.muteActorList",
None,
Some(serde_json::to_vec(&input)?),
Some(String::from("application/json")),
)
.await?;
Ok(())
}
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Input {
pub list: String,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {}
27 changes: 27 additions & 0 deletions atrium-api/src/app/bsky/graph/unmute_actor_list.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
#![doc = "Definitions for the `app.bsky.graph.unmuteActorList` namespace."]
#[doc = "`app.bsky.graph.unmuteActorList`"]
#[doc = "Unmute a list of actors."]
#[async_trait::async_trait]
pub trait UnmuteActorList: crate::xrpc::XrpcClient {
async fn unmute_actor_list(&self, input: Input) -> Result<(), Box<dyn std::error::Error>> {
let _ = crate::xrpc::XrpcClient::send::<Error>(
self,
http::Method::POST,
"app.bsky.graph.unmuteActorList",
None,
Some(serde_json::to_vec(&input)?),
Some(String::from("application/json")),
)
.await?;
Ok(())
}
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Input {
pub list: String,
}
#[derive(serde :: Serialize, serde :: Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {}
2 changes: 2 additions & 0 deletions atrium-api/src/com/atproto/admin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
pub mod defs;
pub mod disable_account_invites;
pub mod disable_invite_codes;
pub mod enable_account_invites;
pub mod get_invite_codes;
pub mod get_moderation_action;
pub mod get_moderation_actions;
Expand Down
Loading

0 comments on commit dcb47f7

Please sign in to comment.