1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Identifier {
7 #[serde(rename = "type")]
8 pub identifier_type: String,
9 pub value: String,
10}
11
12impl Identifier {
13 pub fn new(identifier_type: &str, value: &str) -> Self {
14 Self {
15 identifier_type: identifier_type.to_string(),
16 value: value.to_string(),
17 }
18 }
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct Group {
24 #[serde(rename = "type")]
25 pub group_type: String,
26 pub id: String,
27 pub name: String,
28}
29
30impl Group {
31 pub fn new(group_type: &str, id: &str, name: &str) -> Self {
32 Self {
33 group_type: group_type.to_string(),
34 id: id.to_string(),
35 name: name.to_string(),
36 }
37 }
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42pub struct InvitationTarget {
43 #[serde(rename = "type")]
44 pub target_type: String,
45 pub value: String,
46}
47
48impl InvitationTarget {
49 pub fn new(target_type: &str, value: &str) -> Self {
50 Self {
51 target_type: target_type.to_string(),
52 value: value.to_string(),
53 }
54 }
55}
56
57#[derive(Debug, Clone, Serialize, Deserialize)]
59#[serde(rename_all = "camelCase")]
60pub struct InvitationAcceptance {
61 pub id: String,
62 pub account_id: String,
63 pub project_id: String,
64 pub accepted_at: String,
65 pub target: InvitationTarget,
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(rename_all = "camelCase")]
71pub struct Invitation {
72 pub id: String,
73 pub account_id: String,
74 pub click_throughs: u32,
75 pub configuration_attributes: Option<HashMap<String, serde_json::Value>>,
76 pub attributes: Option<HashMap<String, serde_json::Value>>,
77 pub created_at: String,
78 pub deactivated: bool,
79 pub delivery_count: u32,
80 pub delivery_types: Vec<String>,
81 pub foreign_creator_id: String,
82 pub invitation_type: String,
83 pub modified_at: Option<String>,
84 pub status: String,
85 pub target: Vec<InvitationTarget>,
86 pub views: u32,
87 pub widget_configuration_id: String,
88 pub project_id: String,
89 pub groups: Vec<Group>,
90 pub accepts: Vec<InvitationAcceptance>,
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize)]
95pub struct InvitationsResponse {
96 pub invitations: Option<Vec<Invitation>>,
97}