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
use crate::actions::*;
use crate::ReturnType;
use lexoffice::model::Invoice;
use lexoffice::Client;
use lexoffice::Result;
use structopt::StructOpt;

/// invoice endpoint
#[derive(Debug, StructOpt)]
pub enum InvoiceOpt {
    /// queries a specific invoice by its id
    Get(ByIdOpt),
}

impl InvoiceOpt {
    pub async fn exec(&self, client: Client) -> Result<ReturnType<Invoice>> {
        let request = client.request::<Invoice>();
        let result = match self {
            //Self::New(x) => x.exec(request),
            //Self::Updatable(x) => x.exec(request),
            Self::Get(x) => ReturnType::Obj(x.exec(request).await?),
        };
        Ok(result)
    }
}