wuapi 0.5.0

Rust SDK for wuapi, a WhatsApp API for developers. Link numbers by QR or pairing code, send and receive messages, manage chats, contacts, groups and channels, split them into projects and verify webhooks.
Documentation
// Generated by wuapi-codegen from the OpenAPI spec. Do not edit: run `bun run codegen`.

use crate::http::{HttpClient, Method, Request, RequestParts, encode_path};
use crate::types;

/// WhatsApp Status posts. A story is stored as a message whose `chatId` is `stories`.
#[derive(Clone, Debug)]
pub struct StoriesResource {
    http: HttpClient,
}

impl StoriesResource {
    pub(crate) fn new(http: HttpClient) -> Self {
        Self { http }
    }

    /// Post a story
    ///
    /// Queued like any send and stored as an outbound message with `chatId: stories`. The outcome arrives as `message.sent` or `message.failed`.
    ///
    /// `POST /v1/accounts/{accountId}/stories`
    ///
    /// Sends `Idempotency-Key` (a random key, or your own with `.idempotency_key(..)`), so it is retried on timeouts, network errors, `429` and `5xx` without repeating its effect.
    pub fn create(
        &self,
        account_id: &str,
        params: impl Into<types::StoriesCreateParams>,
    ) -> Request<types::Message> {
        let params = params.into();
        let parts = RequestParts::new(Method::Post, format!("/v1/accounts/{}/stories", encode_path(account_id)))
            .body(&params)
            .keyed();
        self.http.request(parts)
    }
}