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
60
61
62
63
// 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 own About text, display name and picture.
#[derive(Clone, Debug)]
pub struct ProfileResource {
http: HttpClient,
}
impl ProfileResource {
pub(crate) fn new(http: HttpClient) -> Self {
Self { http }
}
/// Update the About text or display name
///
/// WhatsApp cannot be read back here, so this answers 204. `about` and `name` are two changes on WhatsApp.
///
/// `PATCH /v1/accounts/{accountId}/profile`
///
/// 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::ProfileUpdateParams) -> Request<()> {
let parts = RequestParts::new(Method::Patch, format!("/v1/accounts/{}/profile", encode_path(account_id)))
.body(¶ms)
.no_content();
self.http.request(parts)
}
/// Set the profile picture
///
/// JPEG, from an https URL or base64.
///
/// `PUT /v1/accounts/{accountId}/profile/picture`
///
/// Safe to repeat: retried on timeouts, network errors, `429` and `5xx`.
pub fn set_picture(
&self,
account_id: &str,
params: impl Into<types::ProfileSetPictureParams>,
) -> Request<types::Picture> {
let params = params.into();
let parts = RequestParts::new(Method::Put, format!("/v1/accounts/{}/profile/picture", encode_path(account_id)))
.body(¶ms)
.retryable();
self.http.request(parts)
}
/// Delete the profile picture
///
/// Remove the account's profile picture.
///
/// `DELETE /v1/accounts/{accountId}/profile/picture`
///
/// Safe to repeat: retried on timeouts, network errors, `429` and `5xx`.
pub fn delete_picture(&self, account_id: &str) -> Request<()> {
let parts = RequestParts::new(Method::Delete, format!("/v1/accounts/{}/profile/picture", encode_path(account_id)))
.retryable()
.no_content();
self.http.request(parts)
}
}