JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Automatically populate the target instance field from the request using MessageTarget trait

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨37da513

⁨giterated-models/src/messages/discovery.rs⁩ - ⁨726⁩ bytes
Raw
1 use chrono::{DateTime, Utc};
2 use serde::{Deserialize, Serialize};
3
4 use crate::model::discovery::DiscoveryItem;
5
6 use super::MessageTarget;
7
8 #[derive(Clone, Hash, PartialEq, Eq, Debug, Serialize, Deserialize)]
9 pub struct DiscoveryOffer {
10 pub earliest: DateTime<Utc>,
11 pub hashes: Vec<u128>,
12 }
13
14 #[derive(Clone, Hash, PartialEq, Eq, Debug, Serialize, Deserialize)]
15 pub struct DiscoveryRequest {
16 pub since: DateTime<Utc>,
17 pub hashes: Vec<u128>,
18 }
19
20 impl MessageTarget for DiscoveryRequest {
21 fn target(&self) -> Option<crate::model::instance::Instance> {
22 None
23 }
24 }
25
26 #[derive(Clone, Hash, PartialEq, Eq, Debug, Serialize, Deserialize)]
27 pub struct Discoveries {
28 pub discoveries: Vec<DiscoveryItem>,
29 }
30