Skip to main content

google_workspace_apis/utils/
request.rs

1use std::collections::HashMap;
2
3use chrono::DateTime;
4
5use crate::auth::client::GoogleClient;
6
7pub struct Request<'a> {
8    pub client: &'a mut GoogleClient,
9    pub url: String,
10    pub method: reqwest::Method,
11    pub params: HashMap<String, String>,
12    pub body: Option<String>,
13}
14
15impl<'a> Request<'a> {
16    pub fn new(client: &'a mut GoogleClient) -> Self {
17        Self {
18            client,
19            url: "".to_string(),
20            method: reqwest::Method::GET,
21            params: HashMap::new(),
22            body: None,
23        }
24    }
25}
26
27pub trait PaginationRequestTrait {
28    fn max_results(self, max: i64) -> Self;
29    fn page_token(self, token: &str) -> Self;
30}
31
32pub trait TimeRequestTrait {
33    fn time_min(self, max: DateTime<chrono::Utc>) -> Self;
34    fn time_max(self, token: DateTime<chrono::Utc>) -> Self;
35}