pub const NSID: &str = "chat.bsky.group.createGroup";
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct InputData {
pub members: Vec<crate::types::string::Did>,
pub name: String,
}
pub type Input = crate::types::Object<InputData>;
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct OutputData {
pub convo: crate::chat::bsky::convo::defs::ConvoView,
}
pub type Output = crate::types::Object<OutputData>;
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {
AccountSuspended(Option<String>),
BlockedActor(Option<String>),
BlockedSubject(Option<String>),
NewAccountCannotCreateGroup(Option<String>),
NotFollowedBySender(Option<String>),
RecipientNotFound(Option<String>),
UserForbidsGroups(Option<String>),
}
impl std::fmt::Display for Error {
fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Error::AccountSuspended(msg) => {
write!(_f, "AccountSuspended")?;
if let Some(msg) = msg {
write!(_f, ": {msg}")?;
}
}
Error::BlockedActor(msg) => {
write!(_f, "BlockedActor")?;
if let Some(msg) = msg {
write!(_f, ": {msg}")?;
}
}
Error::BlockedSubject(msg) => {
write!(_f, "BlockedSubject")?;
if let Some(msg) = msg {
write!(_f, ": {msg}")?;
}
}
Error::NewAccountCannotCreateGroup(msg) => {
write!(_f, "NewAccountCannotCreateGroup")?;
if let Some(msg) = msg {
write!(_f, ": {msg}")?;
}
}
Error::NotFollowedBySender(msg) => {
write!(_f, "NotFollowedBySender")?;
if let Some(msg) = msg {
write!(_f, ": {msg}")?;
}
}
Error::RecipientNotFound(msg) => {
write!(_f, "RecipientNotFound")?;
if let Some(msg) = msg {
write!(_f, ": {msg}")?;
}
}
Error::UserForbidsGroups(msg) => {
write!(_f, "UserForbidsGroups")?;
if let Some(msg) = msg {
write!(_f, ": {msg}")?;
}
}
}
Ok(())
}
}