2024-04-09 19:48:18 +02:00
|
|
|
use url::{ParseError, Url};
|
|
|
|
|
|
2024-05-19 07:17:13 +02:00
|
|
|
pub fn generate_object_id(domain: &str, uuid: &str) -> Result<Url, ParseError> {
|
|
|
|
|
let id: String = uuid::Uuid::new_v4().to_string();
|
|
|
|
|
Url::parse(&format!("https://{}/apbridge/object/{}", domain, id))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn generate_user_id(domain: &str, uuid: &str) -> Result<Url, ParseError> {
|
|
|
|
|
let id: String = uuid::Uuid::new_v4().to_string();
|
|
|
|
|
Url::parse(&format!("https://{}/apbridge/user/{}", domain, id))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn generate_random_object_id(domain: &str) -> Result<Url, ParseError> {
|
|
|
|
|
let id: String = uuid::Uuid::new_v4().to_string();
|
|
|
|
|
Url::parse(&format!("https://{}/apbridge/object/{}", domain, id))
|
2024-04-09 19:48:18 +02:00
|
|
|
}
|
2024-05-05 18:18:39 +02:00
|
|
|
|
|
|
|
|
/// Generate a follow accept id
|
|
|
|
|
pub fn generate_follow_accept_id(domain: &str, db_id: i32) -> Result<Url, ParseError> {
|
2024-05-19 07:17:13 +02:00
|
|
|
Url::parse(&format!("https://{}/apbridge/activity/follow/{}", domain, db_id))
|
2024-05-05 18:18:39 +02:00
|
|
|
}
|