activitypub/src/versia/objects.rs

429 lines
12 KiB
Rust
Raw Normal View History

2024-05-13 21:31:33 +02:00
extern crate serde; // 1.0.68
extern crate serde_derive; // 1.0.68
use std::{
collections::HashMap,
fmt::{Display, Formatter},
};
use serde::{ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer};
use time::{
format_description::well_known::{iso8601, Iso8601},
OffsetDateTime,
};
2024-05-09 23:09:10 +02:00
use url::Url;
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
use uuid::Uuid;
2024-05-09 23:09:10 +02:00
2024-05-13 21:31:33 +02:00
const FORMAT: Iso8601<6651332276412969266533270467398074368> = Iso8601::<
{
iso8601::Config::DEFAULT
.set_year_is_six_digits(false)
.encode()
},
>;
2024-08-28 15:24:22 +02:00
time::serde::format_description!(iso_versia, OffsetDateTime, FORMAT);
2024-05-13 21:31:33 +02:00
fn sort_alphabetically<T: Serialize, S: serde::Serializer>(
value: &T,
serializer: S,
) -> Result<S::Ok, S::Error> {
let value = serde_json::to_value(value).map_err(serde::ser::Error::custom)?;
value.serialize(serializer)
}
#[derive(Serialize)]
pub struct SortAlphabetically<T: Serialize>(#[serde(serialize_with = "sort_alphabetically")] pub T);
#[derive(Debug, Serialize, Deserialize, Clone)]
2024-08-28 15:24:22 +02:00
pub enum VersiaType {
2024-05-09 23:10:36 +02:00
User,
2024-05-13 21:31:33 +02:00
Note,
Patch,
Like,
Dislike,
Follow,
FollowAccept,
FollowReject,
Undo,
Extension,
ServerMetadata,
2024-05-09 23:09:10 +02:00
}
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
#[derive(Debug, Serialize, Deserialize, Clone)]
pub enum CategoryType {
Microblog,
Forum,
Blog,
Image,
Video,
Audio,
Messaging,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum VisibilityType {
Public,
Unlisted,
Followers,
Direct,
}
2024-05-13 22:08:23 +02:00
#[derive(Debug, Serialize, Deserialize, Clone)]
2024-08-28 15:24:22 +02:00
pub enum VersiaExtensions {
#[serde(rename = "pub.versia:microblogging/Announce")]
2024-05-13 22:08:23 +02:00
Announce,
#[serde(rename = "pub.versia:custom_emojis")]
2024-05-13 22:08:23 +02:00
CustomEmojis,
#[serde(rename = "pub.versia:reactions/Reaction")]
2024-05-13 22:08:23 +02:00
Reaction,
#[serde(rename = "pub.versia:reactions")]
2024-05-13 22:08:23 +02:00
Reactions,
#[serde(rename = "pub.versia:polls")]
2024-05-13 22:08:23 +02:00
Polls,
#[serde(rename = "pub.versia:is_cat")]
2024-05-13 22:08:23 +02:00
IsCat,
#[serde(rename = "pub.versia:server_endorsement/Endorsement")]
2024-05-13 22:08:23 +02:00
Endorsement,
#[serde(rename = "pub.versia:server_endorsement")]
2024-05-13 22:08:23 +02:00
EndorsementCollection,
#[serde(rename = "pub.versia:reports/Report")]
2024-05-13 22:08:23 +02:00
Report,
#[serde(rename = "pub.versia:vanity")]
2024-05-13 22:08:23 +02:00
Vanity,
}
2024-05-13 21:31:33 +02:00
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct PublicKey {
2024-07-16 19:35:04 +02:00
pub public_key: String,
pub actor: Url,
2024-05-13 21:31:33 +02:00
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ContentHash {
md5: Option<String>,
sha1: Option<String>,
sha256: Option<String>,
sha512: Option<String>,
}
2024-07-16 19:35:04 +02:00
#[derive(Debug, Clone, Default)]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub struct ContentFormat {
2024-07-16 19:35:04 +02:00
pub x: HashMap<String, ContentEntry>,
2024-05-13 21:31:33 +02:00
}
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
impl ContentFormat {
pub async fn select_rich_text(&self) -> anyhow::Result<String> {
if let Some(entry) = self.x.get("text/x.misskeymarkdown") {
return Ok(entry.content.clone());
}
if let Some(entry) = self.x.get("text/html") {
return Ok(entry.content.clone());
}
if let Some(entry) = self.x.get("text/markdown") {
return Ok(entry.content.clone());
}
if let Some(entry) = self.x.get("text/plain") {
return Ok(entry.content.clone());
}
Ok(self.x.clone().values().next().unwrap().content.clone())
}
pub async fn select_rich_img(&self) -> anyhow::Result<String> {
if let Some(entry) = self.x.get("image/webp") {
return Ok(entry.content.clone());
}
if let Some(entry) = self.x.get("image/png") {
return Ok(entry.content.clone());
}
if let Some(entry) = self.x.get("image/avif") {
return Ok(entry.content.clone());
}
if let Some(entry) = self.x.get("image/jxl") {
return Ok(entry.content.clone());
}
if let Some(entry) = self.x.get("image/jpeg") {
return Ok(entry.content.clone());
}
if let Some(entry) = self.x.get("image/gif") {
return Ok(entry.content.clone());
}
if let Some(entry) = self.x.get("image/bmp") {
return Ok(entry.content.clone());
}
Ok(self.x.clone().values().next().unwrap().content.clone())
}
2024-07-21 19:37:08 +02:00
pub async fn select_rich_img_touple(&self) -> anyhow::Result<(String, String)> {
if let Some(entry) = self.x.get("image/webp") {
return Ok(("image/webp".to_string(), entry.content.clone()));
}
if let Some(entry) = self.x.get("image/png") {
return Ok(("image/png".to_string(), entry.content.clone()));
}
if let Some(entry) = self.x.get("image/avif") {
return Ok(("image/avif".to_string(), entry.content.clone()));
}
if let Some(entry) = self.x.get("image/jxl") {
return Ok(("image/jxl".to_string(), entry.content.clone()));
}
if let Some(entry) = self.x.get("image/jpeg") {
return Ok(("image/jpeg".to_string(), entry.content.clone()));
}
if let Some(entry) = self.x.get("image/gif") {
return Ok(("image/gif".to_string(), entry.content.clone()));
}
if let Some(entry) = self.x.get("image/bmp") {
return Ok(("image/bmp".to_string(), entry.content.clone()));
}
let touple = self.x.iter().next().unwrap();
Ok((touple.0.clone(), touple.1.content.clone()))
}
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
}
2024-05-13 21:31:33 +02:00
impl Serialize for ContentFormat {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut seq = serializer.serialize_map(Some(self.x.len()))?;
for (k, v) in &self.x {
seq.serialize_entry(&k.to_string(), &v)?;
}
seq.end()
}
}
impl<'de> Deserialize<'de> for ContentFormat {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let map = HashMap::deserialize(deserializer)?;
Ok(ContentFormat { x: map })
}
}
#[derive(Debug, Serialize, Deserialize, Clone)]
2024-07-16 19:35:04 +02:00
pub struct FieldKV {
2024-07-21 19:37:08 +02:00
pub key: ContentFormat,
pub value: ContentFormat,
2024-05-13 21:31:33 +02:00
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ContentEntry {
content: String,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-05-13 21:31:33 +02:00
description: Option<String>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-05-13 21:31:33 +02:00
size: Option<u64>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-05-13 21:31:33 +02:00
hash: Option<ContentHash>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-05-13 21:31:33 +02:00
blurhash: Option<String>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-05-13 21:31:33 +02:00
fps: Option<u64>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-05-13 21:31:33 +02:00
width: Option<u64>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-05-13 21:31:33 +02:00
height: Option<u64>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-05-13 21:31:33 +02:00
duration: Option<u64>,
}
2024-07-16 19:35:04 +02:00
impl ContentEntry {
pub fn from_string(string: String) -> ContentEntry {
ContentEntry {
content: string,
description: None,
size: None,
hash: None,
blurhash: None,
fps: None,
width: None,
height: None,
duration: None,
}
}
}
2024-05-13 21:31:33 +02:00
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct User {
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub public_key: PublicKey,
2024-05-13 21:31:33 +02:00
#[serde(rename = "type")]
2024-08-28 15:24:22 +02:00
pub rtype: VersiaType,
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub id: Uuid,
pub uri: Url,
2024-08-28 15:24:22 +02:00
#[serde(with = "iso_versia")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub created_at: OffsetDateTime,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub display_name: Option<String>,
pub inbox: Url,
pub outbox: Url,
pub featured: Url,
pub followers: Url,
pub following: Url,
pub likes: Url,
pub dislikes: Url,
pub username: String,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub bio: Option<ContentFormat>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub avatar: Option<ContentFormat>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub header: Option<ContentFormat>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub fields: Option<Vec<FieldKV>>,
pub indexable: bool,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-07-21 19:37:08 +02:00
pub extensions: Option<ExtensionSpecs>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ExtensionSpecs {
#[serde(rename = "pub.versia:custom_emojis")]
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
2024-07-21 19:37:08 +02:00
pub custom_emojis: Option<CustomEmojis>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CustomEmojis {
pub emojis: Vec<CustomEmoji>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CustomEmoji {
pub name: String,
pub url: ContentFormat,
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct DeviceInfo {
name: String,
version: String,
url: Url,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct LinkPreview {
description: String,
title: String,
link: Url,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
image: Option<Url>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
icon: Option<Url>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Note {
#[serde(rename = "type")]
2024-08-28 15:24:22 +02:00
pub rtype: VersiaType,
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub id: Uuid,
pub uri: Url,
pub author: Url,
2024-08-28 15:24:22 +02:00
#[serde(with = "iso_versia")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub created_at: OffsetDateTime,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub category: Option<CategoryType>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub content: Option<ContentFormat>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub device: Option<DeviceInfo>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub previews: Option<Vec<LinkPreview>>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub group: Option<String>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub attachments: Option<Vec<ContentFormat>>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub replies_to: Option<Url>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub quotes: Option<Url>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub mentions: Option<Vec<Url>>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub subject: Option<String>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub is_sensitive: Option<bool>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub visibility: Option<VisibilityType>,
//TODO extensions
}
2024-07-27 16:24:04 +02:00
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Patch {
#[serde(rename = "type")]
2024-08-28 15:24:22 +02:00
pub rtype: VersiaType,
2024-07-27 16:24:04 +02:00
pub id: Uuid,
pub uri: Url,
pub author: Url,
2024-08-28 15:24:22 +02:00
#[serde(with = "iso_versia")]
2024-07-27 16:24:04 +02:00
pub created_at: OffsetDateTime,
2024-08-28 15:24:22 +02:00
#[serde(with = "iso_versia")]
2024-07-27 16:24:04 +02:00
pub patched_at: OffsetDateTime,
#[serde(skip_serializing_if = "Option::is_none")]
pub category: Option<CategoryType>,
#[serde(skip_serializing_if = "Option::is_none")]
pub content: Option<ContentFormat>,
#[serde(skip_serializing_if = "Option::is_none")]
pub device: Option<DeviceInfo>,
#[serde(skip_serializing_if = "Option::is_none")]
pub previews: Option<Vec<LinkPreview>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub group: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub attachments: Option<Vec<ContentFormat>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub replies_to: Option<Url>,
#[serde(skip_serializing_if = "Option::is_none")]
pub quotes: Option<Url>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mentions: Option<Vec<Url>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub subject: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub is_sensitive: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub visibility: Option<VisibilityType>,
//TODO extensions
}
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Outbox {
pub first: Url,
pub last: Url,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub next: Option<Url>,
2024-07-26 00:26:13 +02:00
#[serde(skip_serializing_if = "Option::is_none")]
feat: basic AP <-> lysand conversion (#4) * feat: Update API domain variable name * save changes, fake commit * feat: function to receive lysand note * [feat]: lysand to ap for posts and users * feat: Add .env file to gitignore and update dependencies The commit adds the `.env` file to the `.gitignore` and updates the dependencies in the `Cargo.toml` and `Cargo.lock` files. This change ensures that sensitive environment variables are not committed to the repository and keeps the dependencies up to date. * feat: Add db_post_from_url function The commit adds the `db_post_from_url` function to the `conversion.rs` file. This function retrieves a post from the database based on a given URL. If the post is not found in the database, it fetches the post from the URL, saves it to the database, and returns the post. This change enhances the functionality of the codebase by providing a convenient way to retrieve and store posts. * feat: Update dependencies and add async-recursion crate * fix: Refactor lysand note handling in conversion.rs The commit refactors the lysand note handling in the `conversion.rs` file. It updates the `receive_lysand_note` function to properly handle quoting and replying to notes. This change improves the functionality and readability of the codebase. * fix: use example as default user * me oopid * fix: Refactor lysand note handling in conversion.rs * fix: fix post printing * fix: Refactor lysand note handling in conversion.rs * fix: Refactor lysand note handling in conversion.rs * fix: make nix-bootstrap executable * fix: remove unused linux only import * fix: make person stop screaming at me :( * feat: remove test code * fix: update deps * fix: rm build.rs fully * feat: standard user to apservice * fix: format files
2024-06-18 03:56:25 +02:00
pub prev: Option<Url>,
pub items: Vec<Note>,
2024-05-09 23:10:36 +02:00
}
2024-07-27 16:24:04 +02:00
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Follow {
#[serde(rename = "type")]
2024-08-28 15:24:22 +02:00
pub rtype: VersiaType,
2024-07-27 16:24:04 +02:00
pub id: Uuid,
pub uri: Url,
pub author: Url,
2024-08-28 15:24:22 +02:00
#[serde(with = "iso_versia")]
2024-07-27 16:24:04 +02:00
pub created_at: OffsetDateTime,
pub followee: Url,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct FollowResult {
#[serde(rename = "type")]
2024-08-28 15:24:22 +02:00
pub rtype: VersiaType,
2024-07-27 16:24:04 +02:00
pub id: Uuid,
pub uri: Url,
pub author: Url,
2024-08-28 15:24:22 +02:00
#[serde(with = "iso_versia")]
2024-07-27 16:24:04 +02:00
pub created_at: OffsetDateTime,
pub follower: Url,
}