1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17#[derive(Clone, Debug)]
19pub struct ListAnsweredScorecardsParams {
20 pub public_api_base_request_v2_answered_scorecards_filter: models::PublicApiBaseRequestV2AnsweredScorecardsFilter
21}
22
23#[derive(Clone, Debug)]
25pub struct ListInteractionStatsParams {
26 pub public_api_base_request_v2_multiple_users_with_dates: models::PublicApiBaseRequestV2MultipleUsersWithDates
27}
28
29#[derive(Clone, Debug)]
31pub struct ListMultipleUsersAggregateActivityParams {
32 pub public_api_base_request_v2_multiple_users_with_dates: models::PublicApiBaseRequestV2MultipleUsersWithDates
33}
34
35#[derive(Clone, Debug)]
37pub struct ListMultipleUsersAggregateByPeriodParams {
38 pub request_with_time_period: models::RequestWithTimePeriod
39}
40
41#[derive(Clone, Debug)]
43pub struct ListMultipleUsersDayByDayActivityParams {
44 pub public_api_base_request_v2_multiple_users_with_dates: models::PublicApiBaseRequestV2MultipleUsersWithDates
45}
46
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum ListAnsweredScorecardsError {
52 Status400(models::ErrorResponse),
53 Status401(models::ErrorResponse),
54 Status404(models::ErrorResponse),
55 Status429(models::ErrorResponse),
56 Status500(models::ErrorResponse),
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ListInteractionStatsError {
64 Status400(models::ErrorResponse),
65 Status401(models::ErrorResponse),
66 Status404(models::ErrorResponse),
67 Status429(models::ErrorResponse),
68 Status500(models::ErrorResponse),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum ListMultipleUsersAggregateActivityError {
76 Status400(models::ErrorResponse),
77 Status401(models::ErrorResponse),
78 Status404(models::ErrorResponse),
79 Status429(models::ErrorResponse),
80 Status500(models::ErrorResponse),
81 UnknownValue(serde_json::Value),
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum ListMultipleUsersAggregateByPeriodError {
88 Status400(models::ErrorResponse),
89 Status401(models::ErrorResponse),
90 Status404(models::ErrorResponse),
91 Status429(models::ErrorResponse),
92 Status500(models::ErrorResponse),
93 UnknownValue(serde_json::Value),
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum ListMultipleUsersDayByDayActivityError {
100 Status400(models::ErrorResponse),
101 Status401(models::ErrorResponse),
102 Status404(models::ErrorResponse),
103 Status429(models::ErrorResponse),
104 Status500(models::ErrorResponse),
105 UnknownValue(serde_json::Value),
106}
107
108
109pub async fn list_answered_scorecards(configuration: &configuration::Configuration, params: ListAnsweredScorecardsParams) -> Result<models::AnsweredScorecards, Error<ListAnsweredScorecardsError>> {
111 let local_var_configuration = configuration;
112
113 let public_api_base_request_v2_answered_scorecards_filter = params.public_api_base_request_v2_answered_scorecards_filter;
115
116
117 let local_var_client = &local_var_configuration.client;
118
119 let local_var_uri_str = format!("{}/v2/stats/activity/scorecards", local_var_configuration.base_path);
120 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
121
122 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
123 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
124 }
125 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
126 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
127 };
128 local_var_req_builder = local_var_req_builder.json(&public_api_base_request_v2_answered_scorecards_filter);
129
130 let local_var_req = local_var_req_builder.build()?;
131 let local_var_resp = local_var_client.execute(local_var_req).await?;
132
133 let local_var_status = local_var_resp.status();
134 let local_var_content = local_var_resp.text().await?;
135
136 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
137 serde_json::from_str(&local_var_content).map_err(Error::from)
138 } else {
139 let local_var_entity: Option<ListAnsweredScorecardsError> = serde_json::from_str(&local_var_content).ok();
140 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
141 Err(Error::ResponseError(local_var_error))
142 }
143}
144
145pub async fn list_interaction_stats(configuration: &configuration::Configuration, params: ListInteractionStatsParams) -> Result<models::CompanyUsersIntercationStatsResponse, Error<ListInteractionStatsError>> {
147 let local_var_configuration = configuration;
148
149 let public_api_base_request_v2_multiple_users_with_dates = params.public_api_base_request_v2_multiple_users_with_dates;
151
152
153 let local_var_client = &local_var_configuration.client;
154
155 let local_var_uri_str = format!("{}/v2/stats/interaction", local_var_configuration.base_path);
156 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
157
158 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
159 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
160 }
161 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
162 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
163 };
164 local_var_req_builder = local_var_req_builder.json(&public_api_base_request_v2_multiple_users_with_dates);
165
166 let local_var_req = local_var_req_builder.build()?;
167 let local_var_resp = local_var_client.execute(local_var_req).await?;
168
169 let local_var_status = local_var_resp.status();
170 let local_var_content = local_var_resp.text().await?;
171
172 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
173 serde_json::from_str(&local_var_content).map_err(Error::from)
174 } else {
175 let local_var_entity: Option<ListInteractionStatsError> = serde_json::from_str(&local_var_content).ok();
176 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
177 Err(Error::ResponseError(local_var_error))
178 }
179}
180
181pub async fn list_multiple_users_aggregate_activity(configuration: &configuration::Configuration, params: ListMultipleUsersAggregateActivityParams) -> Result<models::CompanyUsersAggregateActivityResponse, Error<ListMultipleUsersAggregateActivityError>> {
183 let local_var_configuration = configuration;
184
185 let public_api_base_request_v2_multiple_users_with_dates = params.public_api_base_request_v2_multiple_users_with_dates;
187
188
189 let local_var_client = &local_var_configuration.client;
190
191 let local_var_uri_str = format!("{}/v2/stats/activity/aggregate", local_var_configuration.base_path);
192 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
193
194 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
195 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
196 }
197 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
198 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
199 };
200 local_var_req_builder = local_var_req_builder.json(&public_api_base_request_v2_multiple_users_with_dates);
201
202 let local_var_req = local_var_req_builder.build()?;
203 let local_var_resp = local_var_client.execute(local_var_req).await?;
204
205 let local_var_status = local_var_resp.status();
206 let local_var_content = local_var_resp.text().await?;
207
208 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
209 serde_json::from_str(&local_var_content).map_err(Error::from)
210 } else {
211 let local_var_entity: Option<ListMultipleUsersAggregateActivityError> = serde_json::from_str(&local_var_content).ok();
212 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
213 Err(Error::ResponseError(local_var_error))
214 }
215}
216
217pub async fn list_multiple_users_aggregate_by_period(configuration: &configuration::Configuration, params: ListMultipleUsersAggregateByPeriodParams) -> Result<models::UsersAggregateByPeriodActivity, Error<ListMultipleUsersAggregateByPeriodError>> {
219 let local_var_configuration = configuration;
220
221 let request_with_time_period = params.request_with_time_period;
223
224
225 let local_var_client = &local_var_configuration.client;
226
227 let local_var_uri_str = format!("{}/v2/stats/activity/aggregate-by-period", local_var_configuration.base_path);
228 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
229
230 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
231 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
232 }
233 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
234 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
235 };
236 local_var_req_builder = local_var_req_builder.json(&request_with_time_period);
237
238 let local_var_req = local_var_req_builder.build()?;
239 let local_var_resp = local_var_client.execute(local_var_req).await?;
240
241 let local_var_status = local_var_resp.status();
242 let local_var_content = local_var_resp.text().await?;
243
244 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
245 serde_json::from_str(&local_var_content).map_err(Error::from)
246 } else {
247 let local_var_entity: Option<ListMultipleUsersAggregateByPeriodError> = serde_json::from_str(&local_var_content).ok();
248 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
249 Err(Error::ResponseError(local_var_error))
250 }
251}
252
253pub async fn list_multiple_users_day_by_day_activity(configuration: &configuration::Configuration, params: ListMultipleUsersDayByDayActivityParams) -> Result<models::UsersDayByDayActivity, Error<ListMultipleUsersDayByDayActivityError>> {
255 let local_var_configuration = configuration;
256
257 let public_api_base_request_v2_multiple_users_with_dates = params.public_api_base_request_v2_multiple_users_with_dates;
259
260
261 let local_var_client = &local_var_configuration.client;
262
263 let local_var_uri_str = format!("{}/v2/stats/activity/day-by-day", local_var_configuration.base_path);
264 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
265
266 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
267 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
268 }
269 if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
270 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
271 };
272 local_var_req_builder = local_var_req_builder.json(&public_api_base_request_v2_multiple_users_with_dates);
273
274 let local_var_req = local_var_req_builder.build()?;
275 let local_var_resp = local_var_client.execute(local_var_req).await?;
276
277 let local_var_status = local_var_resp.status();
278 let local_var_content = local_var_resp.text().await?;
279
280 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
281 serde_json::from_str(&local_var_content).map_err(Error::from)
282 } else {
283 let local_var_entity: Option<ListMultipleUsersDayByDayActivityError> = serde_json::from_str(&local_var_content).ok();
284 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
285 Err(Error::ResponseError(local_var_error))
286 }
287}
288