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
97
98
99
100
101
102
103
104
105
106
107
108
109
//! Implements the send email verification API of the Firebase Auth.
//!
//! You can send an email verification for the current user by issuing an HTTP POST request to the Auth getOobConfirmationCode endpoint.
//!
//! See also [API reference](https://firebase.google.com/docs/reference/rest/auth#section-send-email-verification)
use ;
use crateApiKey;
use crateClient;
use crateEndpoint;
use crateLanguageCode;
use crateResult;
/// Request body payload for the send email verification API.
///
/// See also [API reference](https://firebase.google.com/docs/reference/rest/auth#section-send-email-verification).
/// Response payload for the the send email verification API.
///
/// See also [API reference](https://firebase.google.com/docs/reference/rest/auth#section-send-email-verification).
/// Sends an email verification to the specified user.
///
/// See also [API reference](https://firebase.google.com/docs/reference/rest/auth#section-send-email-verification).
///
/// ## Arguments
/// - `client` - HTTP client.
/// - `api_key` - Your Firebase project's API key.
/// - `request_payload` - Request body payload.
/// - `locale` - The BCP 47 language code, eg: en-US.
///
/// ## Errors
/// - `Error::InvalidHeaderValue` - Invalid header value.
/// - `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::SendEmailVerificationRequestBodyPayload::new(
/// "id-token".to_string(),
/// );
///
/// let response_payload = api::send_email_verification(
/// Client::new(),
/// ApiKey::new("your-firebase-project-api-key"),
/// request_payload,
/// None, // locale
/// ).await?;
/// ```
pub async