nest_data_source_api/
data_source.rs1use crate::api::ApiError;
2use crate::batch_messages::{
3 ActivityBatchRequest, ActivityBatchResponse, ParticipantBatchRequest, ParticipantBatchResponse,
4};
5use crate::messages::{ActivityRequest, ActivityResponse, ParticipantRequest, ParticipantResponse};
6use async_trait::async_trait;
7
8#[async_trait]
9pub trait DataSource: Send + Sync + 'static {
10 async fn create_local_participant(
12 &self,
13 request: ParticipantRequest,
14 ) -> Result<Option<ParticipantResponse>, ApiError>;
15
16 async fn create_local_participant_batch(
18 &self,
19 request: ParticipantBatchRequest,
20 ) -> Result<Option<ParticipantBatchResponse>, ApiError>;
21
22 async fn update_local_participant(
24 &self,
25 request: ParticipantRequest,
26 ) -> Result<Option<ParticipantResponse>, ApiError>;
27
28 async fn update_local_participant_batch(
30 &self,
31 request: ParticipantBatchRequest,
32 ) -> Result<Option<ParticipantBatchResponse>, ApiError>;
33
34 async fn delete_local_participant(
36 &self,
37 request: ParticipantRequest,
38 ) -> Result<Option<ParticipantResponse>, ApiError>;
39
40 async fn delete_local_participant_batch(
42 &self,
43 request: ParticipantBatchRequest,
44 ) -> Result<Option<ParticipantBatchResponse>, ApiError>;
45
46 async fn local_participant_details(
48 &self,
49 request: ParticipantRequest,
50 ) -> Result<Option<ParticipantResponse>, ApiError>;
51
52 async fn local_participant_details_batch(
54 &self,
55 request: ParticipantBatchRequest,
56 ) -> Result<Option<ParticipantBatchResponse>, ApiError>;
57
58 async fn create_participant_activity(
60 &self,
61 request: ActivityRequest,
62 ) -> Result<Option<ActivityResponse>, ApiError>;
63
64 async fn create_participant_activity_batch(
66 &self,
67 request: ActivityBatchRequest,
68 ) -> Result<Option<ActivityBatchResponse>, ApiError>;
69
70 async fn update_participant_activity(
72 &self,
73 request: ActivityRequest,
74 ) -> Result<Option<ActivityResponse>, ApiError>;
75
76 async fn update_participant_activity_batch(
78 &self,
79 request: ActivityBatchRequest,
80 ) -> Result<Option<ActivityBatchResponse>, ApiError>;
81
82 async fn delete_participant_activity(
84 &self,
85 request: ActivityRequest,
86 ) -> Result<Option<ActivityResponse>, ApiError>;
87
88 async fn delete_participant_activity_batch(
90 &self,
91 request: ActivityBatchRequest,
92 ) -> Result<Option<ActivityBatchResponse>, ApiError>;
93
94 async fn participant_activity_details(
97 &self,
98 request: ActivityRequest,
99 ) -> Result<Option<ActivityResponse>, ApiError>;
100
101 async fn participant_activity_details_batch(
103 &self,
104 request: ActivityBatchRequest,
105 ) -> Result<Option<ActivityBatchResponse>, ApiError>;
106
107 async fn participant_activity_progress(
110 &self,
111 request: ActivityRequest,
112 ) -> Result<Option<ActivityResponse>, ApiError>;
113
114 async fn participant_activity_progress_batch(
116 &self,
117 request: ActivityBatchRequest,
118 ) -> Result<Option<ActivityBatchResponse>, ApiError>;
119
120 async fn participant_activity_result(
124 &self,
125 request: ActivityRequest,
126 ) -> Result<Option<ActivityResponse>, ApiError>;
127
128 async fn participant_activity_result_batch(
130 &self,
131 request: ActivityBatchRequest,
132 ) -> Result<Option<ActivityBatchResponse>, ApiError>;
133
134 }