harvest-api 5.0.0

Harvest client, generated from the OpenAPI spec.
Documentation
use serde_json::json;
use crate::model::*;
use crate::HarvestClient;
/**Create this with the associated client method.

That method takes required values as arguments. Set optional values using builder methods on this struct.*/
pub struct DeleteInvoicePaymentRequest<'a> {
    pub(crate) client: &'a HarvestClient,
    pub invoice_id: String,
    pub payment_id: String,
}
impl<'a> DeleteInvoicePaymentRequest<'a> {
    pub async fn send(self) -> anyhow::Result<()> {
        let mut r = self
            .client
            .client
            .delete(
                &format!(
                    "/invoices/{invoice_id}/payments/{payment_id}", invoice_id = self
                    .invoice_id, payment_id = self.payment_id
                ),
            );
        r = self.client.authenticate(r);
        let res = r.send().await.unwrap().error_for_status();
        match res {
            Ok(res) => Ok(()),
            Err(res) => {
                let text = res.text().await.map_err(|e| anyhow::anyhow!("{:?}", e))?;
                Err(anyhow::anyhow!("{:?}", text))
            }
        }
    }
}