async_mpesa/
qr.rs

1use crate::{
2    client::Client,
3    config::Config,
4    error::MpesaError,
5    types::{QRRequest, QRResponse}
6};
7
8/// Client to call the qr code generator API
9pub struct QR<'m, C: Config> {
10    client: &'m Client<C>,
11}
12
13impl <'m, C: Config> QR<'m, C> {
14    pub fn new(client: &'m Client<C>) -> Self {
15        Self { client }
16    }
17
18    /// Creates a request for the provided parameters
19    pub async fn create(
20        &self,
21        request: QRRequest,
22    ) -> Result<QRResponse, MpesaError> {
23        self.client.post("/qrcode/v1/generate", request).await
24    }
25}