divviup_client/
aggregator.rs1use crate::Protocol;
2use serde::{Deserialize, Serialize};
3use time::OffsetDateTime;
4use url::Url;
5use uuid::Uuid;
6
7#[derive(Serialize, Deserialize, Debug, Clone, Copy, Eq, PartialEq)]
8pub enum Role {
9 Leader,
10 Helper,
11 Either,
12}
13
14#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
15pub struct Aggregator {
16 pub id: Uuid,
17 pub account_id: Option<Uuid>,
19 #[serde(with = "::time::serde::rfc3339")]
20 pub created_at: OffsetDateTime,
21 #[serde(with = "::time::serde::rfc3339")]
22 pub updated_at: OffsetDateTime,
23 #[serde(default, with = "::time::serde::rfc3339::option")]
25 pub deleted_at: Option<OffsetDateTime>,
26 pub role: Role,
27 pub name: String,
28 pub dap_url: Url,
29 pub api_url: Url,
30 pub is_first_party: bool,
31 pub vdafs: Vec<String>,
32 pub query_types: Vec<String>,
33 pub protocol: Protocol,
34 pub features: Vec<String>,
35}
36
37#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
38pub struct NewAggregator {
39 pub name: String,
40 pub api_url: Url,
41 pub bearer_token: String,
42}
43
44#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
45pub struct NewSharedAggregator {
46 pub name: String,
47 pub api_url: Url,
48 pub is_first_party: bool,
49 pub bearer_token: String,
50}
51
52#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
53#[serde(tag = "type")]
54pub enum CollectorAuthenticationToken {
56 Bearer { token: String },
57}