1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// 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`.
///
/// An image or video story takes `media.url` or `media.uploadId` (a file uploaded with `POST /v1/uploads`).
///
/// `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(¶ms)
.keyed();
self.http.request(parts)
}
}