1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! List meetings query.

use crate::api::rcos::meetings::MeetingType;
use crate::api::rcos::prelude::*;
use crate::api::rcos::send_query;
use crate::error::TelescopeError;
use chrono::{DateTime, Utc};

/// Type representing public RCOS meetings.
#[derive(GraphQLQuery)]
#[graphql(
    schema_path = "graphql/rcos/schema.json",
    query_path = "graphql/rcos/meetings/get.graphql",
    response_derives = "Debug,Clone,Serialize"
)]
pub struct Meetings;

use self::meetings::{MeetingsMeetings, Variables};

impl Meetings {
    /// Get the meetings between two times, optionally filter to finalized meetings only.
    pub async fn get(
        start: DateTime<Utc>,
        end: DateTime<Utc>,
        include_drafts: bool,
        accept_types: Vec<MeetingType>,
    ) -> Result<Vec<MeetingsMeetings>, TelescopeError> {
        Ok(send_query::<Self>(Variables {
            start,
            end,
            include_drafts,
            accept_types,
        })
        .await?
        .meetings)
    }
}