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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// 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;
/// The linked number's privacy settings.
#[derive(Clone, Debug)]
pub struct PrivacyResource {
http: HttpClient,
}
impl PrivacyResource {
pub(crate) fn new(http: HttpClient) -> Self {
Self { http }
}
/// Get privacy settings
///
/// The account's privacy settings, read live from WhatsApp.
///
/// `GET /v1/accounts/{accountId}/privacy`
///
/// Safe to repeat: retried on timeouts, network errors, `429` and `5xx`.
pub fn get(&self, account_id: &str) -> Request<types::PrivacySettings> {
let parts = RequestParts::new(Method::Get, format!("/v1/accounts/{}/privacy", encode_path(account_id)))
.retryable();
self.http.request(parts)
}
/// Change privacy settings
///
/// Change one or more settings. Each setting is one change on WhatsApp. Returns every setting after the change.
///
/// `PATCH /v1/accounts/{accountId}/privacy`
///
/// Not idempotent: retried only when the request never reached the API or was refused with `429`.
pub fn update(
&self,
account_id: &str,
params: types::PrivacyUpdateParams,
) -> Request<types::PrivacySettings> {
let parts = RequestParts::new(Method::Patch, format!("/v1/accounts/{}/privacy", encode_path(account_id)))
.body(¶ms);
self.http.request(parts)
}
/// Get story privacy
///
/// Who sees the account's stories.
///
/// `GET /v1/accounts/{accountId}/privacy/stories`
///
/// Safe to repeat: retried on timeouts, network errors, `429` and `5xx`.
pub fn get_story_privacy(&self, account_id: &str) -> Request<types::StoryPrivacy> {
let parts = RequestParts::new(Method::Get, format!("/v1/accounts/{}/privacy/stories", encode_path(account_id)))
.retryable();
self.http.request(parts)
}
}