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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
use anyhow::Result;
use crate::Client;
pub struct UsersApi {
pub client: Client,
}
impl UsersApi {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
UsersApi { client }
}
/**
* Get a user's profile.
*
* This function performs a `GET` to the `/user/profile` endpoint.
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_user_profile(&self) -> Result<crate::types::GetUserProfileResponse> {
let url = "/user/profile".to_string();
self.client.get(&url, None).await
}
/**
* Update a user's profile.
*
* This function performs a `PATCH` to the `/user/profile` endpoint.
*
* **This endpoint allows you to update your current profile details.**
*
* Any one or more of the parameters can be updated via the PATCH `/user/profile` endpoint. You must include at least one when you PATCH.
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn patch_user_profile(
&self,
body: &crate::types::UserProfile,
) -> Result<crate::types::UserProfile> {
let url = "/user/profile".to_string();
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Get a user's account information.
*
* This function performs a `GET` to the `/user/account` endpoint.
*
* **This endpoint allows you to retrieve your user account details.**
*
* Your user's account information includes the user's account type and reputation.
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_user_account(&self) -> Result<crate::types::GetUserAccountResponse> {
let url = "/user/account".to_string();
self.client.get(&url, None).await
}
/**
* Retrieve your account email address.
*
* This function performs a `GET` to the `/user/email` endpoint.
*
* **This endpoint allows you to retrieve the email address currently on file for your account.**
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_user_email(&self) -> Result<crate::types::GetUserEmailResponse> {
let url = "/user/email".to_string();
self.client.get(&url, None).await
}
/**
* Update your account email address.
*
* This function performs a `PUT` to the `/user/email` endpoint.
*
* **This endpoint allows you to update the email address currently on file for your account.**
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn put_user_email(
&self,
body: &crate::types::PutUserEmailRequest,
) -> Result<crate::types::GetUserEmailResponse> {
let url = "/user/email".to_string();
self.client
.put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Retrieve your username.
*
* This function performs a `GET` to the `/user/username` endpoint.
*
* **This endpoint allows you to retrieve your current account username.**
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_user_username(&self) -> Result<crate::types::Users> {
let url = "/user/username".to_string();
self.client.get(&url, None).await
}
/**
* Update your username.
*
* This function performs a `PUT` to the `/user/username` endpoint.
*
* **This endpoint allows you to update the username for your account.**
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn put_user_username(
&self,
body: &crate::types::PutUserUsernameRequest,
) -> Result<crate::types::PutUserUsernameResponse> {
let url = "/user/username".to_string();
self.client
.put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Retrieve your credit balance.
*
* This function performs a `GET` to the `/user/credits` endpoint.
*
* **This endpoint allows you to retrieve the current credit balance for your account.**
*
* Each account has a credit balance, which is a base number of emails it can send before receiving per-email charges. For more information about credits and billing, see [Billing and Plan details information](https://sendgrid.com/docs/ui/account-and-settings/billing/).
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_user_credits(&self) -> Result<crate::types::GetUserCreditsResponse> {
let url = "/user/credits".to_string();
self.client.get(&url, None).await
}
/**
* Update your password.
*
* This function performs a `PUT` to the `/user/password` endpoint.
*
* **This endpoint allows you to update your password.**
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn put_user_password(
&self,
body: &crate::types::PutUserPasswordRequest,
) -> Result<crate::types::Help> {
let url = "/user/password".to_string();
self.client
.put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
}