blob: eee59b0d2202da388452b9173596a09739a49a76 (
plain) (
tree)
|
|
// SPDX-FileCopyrightText: 2024 Eilertsens Kodeknekkeri
// SPDX-FileCopyrightText: 2024 Harald Eilertsen
//
// SPDX-License-Identifier: AGPL-3.0-or-later
use serde::Deserialize;
use std::error::Error;
#[derive(Debug, Deserialize)]
pub struct Client {
pub id: u32,
pub name: String,
pub contact: Option<String>,
pub address: Option<String>,
pub email: String,
pub phone: Option<String>,
pub vat: bool,
}
impl Client {
pub fn all() -> Result<Vec<Self>, Box<dyn Error>> {
Ok(ureq::get("http://faktura.ddev.site/api/clients")
.set("Accept", "application/json")
.call()?
.into_json()?)
}
}
|