lichess_api/api/
bulk_pairings.rs1use futures::stream::StreamExt;
14
15use crate::client::LichessApi;
16use crate::error::Result;
17use crate::model::bulk_pairings::*;
18use crate::model::games::GameJson;
19
20impl LichessApi<reqwest::Client> {
21 pub async fn get_bulk_pairings(&self) -> Result<Vec<BulkPairing>> {
22 self.get_single_model(list::GetRequest::new()).await
23 }
24
25 pub async fn create_bulk_pairing(
26 &self,
27 form: create::CreateBulkPairingForm,
28 ) -> Result<BulkPairing> {
29 self.get_single_model(create::PostRequest::new(form)).await
30 }
31
32 pub async fn get_bulk_pairing(
33 &self,
34 request: impl Into<show::GetRequest>,
35 ) -> Result<BulkPairing> {
36 self.get_single_model(request.into()).await
37 }
38
39 pub async fn cancel_bulk_pairing(
40 &self,
41 request: impl Into<remove::DeleteRequest>,
42 ) -> Result<bool> {
43 self.get_ok(request.into()).await
44 }
45
46 pub async fn export_bulk_pairing_games(
47 &self,
48 id: &str,
49 query: games::GetQuery,
50 ) -> Result<impl StreamExt<Item = Result<GameJson>>> {
51 self.get_streamed_models(games::GetRequest::new(id, query))
52 .await
53 }
54
55 pub async fn start_bulk_pairing_clocks(
56 &self,
57 request: impl Into<start_clocks::PostRequest>,
58 ) -> Result<bool> {
59 self.get_ok(request.into()).await
60 }
61}