Skip to main content

wekan_cli/client/cards/
export.rs

1use crate::client::{
2    WekanClient,
3    exports::{ExportError, ExportFormat, ExportMetadata, ExportOptions},
4};
5use std::fs::File;
6impl WekanClient {
7    pub async fn export_card(
8        &self,
9        board: &str,
10        list: &str,
11        card: &str,
12        options: ExportOptions<'_>,
13        file: &mut File,
14    ) -> Result<ExportMetadata, ExportError> {
15        if !matches!(options.format, ExportFormat::Xlsx | ExportFormat::Pdf) {
16            return Err(super::super::exports::protocol("card exports require xlsx or pdf").into());
17        }
18        let route = options.format.suffix()[0];
19        self.export_resource(
20            &[board, "lists", list, "cards", card, route],
21            options,
22            file,
23            false,
24        )
25        .await
26    }
27}