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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! Implements the delete account API of the Firebase Auth.
//!
//! You can delete a current user by issuing an HTTP POST request to the Auth deleteAccount endpoint.
//!
//! See also [API reference](https://firebase.google.com/docs/reference/rest/auth#section-delete-account)
use ;
use crateApiKey;
use crateClient;
use crateEndpoint;
use crateResult;
/// Request body payload for the delete account API.
///
/// See also [API reference](https://firebase.google.com/docs/reference/rest/auth#section-delete-account).
/// Response payload for the delete account API.
///
/// See also [API reference](https://firebase.google.com/docs/reference/rest/auth#section-delete-account).
/// Deletes the account of the user specified by the given ID token.
///
/// See also [API reference](https://firebase.google.com/docs/reference/rest/auth#section-delete-account).
///
/// ## Arguments
/// - `client` - HTTP client.
/// - `api_key` - Your Firebase project's API key.
/// - `request_payload` - Request body payload.
///
/// ## Errors
/// - `Error::HttpRequestError` - Failed to send a request.
/// - `Error::ReadResponseTextFailed` - Failed to read the response body as text.
/// - `Error::DeserializeResponseJsonFailed` - Failed to deserialize the response body as JSON.
/// - `Error::DeserializeErrorResponseJsonFailed` - Failed to deserialize the error response body as JSON.
/// - `Error::InvalidIdToken` - Invalid ID token.
/// - `Error::ApiError` - API error on the Firebase Auth.
///
/// ## Common error codes
/// - INVALID_ID_TOKEN:The user's credential is no longer valid. The user must sign in again.
/// - USER_NOT_FOUND: There is no user record corresponding to this identifier. The user may have been deleted.
///
/// ## Example
/// ```
/// use fars::api;
/// use fars::Client;
/// use fars::ApiKey;
///
/// let request_payload = api::DeleteAccountRequestBodyPayload::new(
/// "id-token".to_string(),
/// );
///
/// let response_payload = api::delete_account(
/// Client::new(),
/// ApiKey::new("your-firebase-project-api-key"),
/// request_payload,
/// ).await?;
/// ```
pub async