fortnox 0.1.3

A library for integrating with Fortnox.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{Article, Error, Gateway, BASE_URL};
use serde::Deserialize;

impl Gateway {
    pub async fn get_article<'a>(&self, article_number: &'a str) -> Result<Article, Error> {
        #[derive(Deserialize)]
        #[serde(rename_all = "PascalCase")]
        struct Response {
            article: Article,
        }

        let url = format!("{}/articles/{}", BASE_URL, &article_number);
        let res: Response = self.get(&url).await?;
        Ok(res.article)
    }
}