openapi_github/apis/
users_api.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`users_slash_add_email_for_authenticated_user`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum UsersSlashAddEmailForAuthenticatedUserError {
22    Status401(models::BasicError),
23    Status403(models::BasicError),
24    Status404(models::BasicError),
25    Status422(models::ValidationError),
26    UnknownValue(serde_json::Value),
27}
28
29/// struct for typed errors of method [`users_slash_add_social_account_for_authenticated_user`]
30#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum UsersSlashAddSocialAccountForAuthenticatedUserError {
33    Status401(models::BasicError),
34    Status403(models::BasicError),
35    Status404(models::BasicError),
36    Status422(models::ValidationError),
37    UnknownValue(serde_json::Value),
38}
39
40/// struct for typed errors of method [`users_slash_block`]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum UsersSlashBlockError {
44    Status401(models::BasicError),
45    Status403(models::BasicError),
46    Status404(models::BasicError),
47    Status422(models::ValidationError),
48    UnknownValue(serde_json::Value),
49}
50
51/// struct for typed errors of method [`users_slash_check_blocked`]
52#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum UsersSlashCheckBlockedError {
55    Status401(models::BasicError),
56    Status403(models::BasicError),
57    Status404(models::BasicError),
58    UnknownValue(serde_json::Value),
59}
60
61/// struct for typed errors of method [`users_slash_check_following_for_user`]
62#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum UsersSlashCheckFollowingForUserError {
65    Status404(),
66    UnknownValue(serde_json::Value),
67}
68
69/// struct for typed errors of method [`users_slash_check_person_is_followed_by_authenticated`]
70#[derive(Debug, Clone, Serialize, Deserialize)]
71#[serde(untagged)]
72pub enum UsersSlashCheckPersonIsFollowedByAuthenticatedError {
73    Status401(models::BasicError),
74    Status403(models::BasicError),
75    Status404(models::BasicError),
76    UnknownValue(serde_json::Value),
77}
78
79/// struct for typed errors of method [`users_slash_create_gpg_key_for_authenticated_user`]
80#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum UsersSlashCreateGpgKeyForAuthenticatedUserError {
83    Status401(models::BasicError),
84    Status403(models::BasicError),
85    Status404(models::BasicError),
86    Status422(models::ValidationError),
87    UnknownValue(serde_json::Value),
88}
89
90/// struct for typed errors of method [`users_slash_create_public_ssh_key_for_authenticated_user`]
91#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum UsersSlashCreatePublicSshKeyForAuthenticatedUserError {
94    Status401(models::BasicError),
95    Status403(models::BasicError),
96    Status404(models::BasicError),
97    Status422(models::ValidationError),
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`users_slash_create_ssh_signing_key_for_authenticated_user`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum UsersSlashCreateSshSigningKeyForAuthenticatedUserError {
105    Status401(models::BasicError),
106    Status403(models::BasicError),
107    Status404(models::BasicError),
108    Status422(models::ValidationError),
109    UnknownValue(serde_json::Value),
110}
111
112/// struct for typed errors of method [`users_slash_delete_email_for_authenticated_user`]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum UsersSlashDeleteEmailForAuthenticatedUserError {
116    Status401(models::BasicError),
117    Status403(models::BasicError),
118    Status404(models::BasicError),
119    Status422(models::ValidationError),
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`users_slash_delete_gpg_key_for_authenticated_user`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum UsersSlashDeleteGpgKeyForAuthenticatedUserError {
127    Status401(models::BasicError),
128    Status403(models::BasicError),
129    Status404(models::BasicError),
130    Status422(models::ValidationError),
131    UnknownValue(serde_json::Value),
132}
133
134/// struct for typed errors of method [`users_slash_delete_public_ssh_key_for_authenticated_user`]
135#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum UsersSlashDeletePublicSshKeyForAuthenticatedUserError {
138    Status401(models::BasicError),
139    Status403(models::BasicError),
140    Status404(models::BasicError),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`users_slash_delete_social_account_for_authenticated_user`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum UsersSlashDeleteSocialAccountForAuthenticatedUserError {
148    Status401(models::BasicError),
149    Status403(models::BasicError),
150    Status404(models::BasicError),
151    Status422(models::ValidationError),
152    UnknownValue(serde_json::Value),
153}
154
155/// struct for typed errors of method [`users_slash_delete_ssh_signing_key_for_authenticated_user`]
156#[derive(Debug, Clone, Serialize, Deserialize)]
157#[serde(untagged)]
158pub enum UsersSlashDeleteSshSigningKeyForAuthenticatedUserError {
159    Status401(models::BasicError),
160    Status403(models::BasicError),
161    Status404(models::BasicError),
162    UnknownValue(serde_json::Value),
163}
164
165/// struct for typed errors of method [`users_slash_follow`]
166#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum UsersSlashFollowError {
169    Status401(models::BasicError),
170    Status403(models::BasicError),
171    Status404(models::BasicError),
172    UnknownValue(serde_json::Value),
173}
174
175/// struct for typed errors of method [`users_slash_get_authenticated`]
176#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum UsersSlashGetAuthenticatedError {
179    Status401(models::BasicError),
180    Status403(models::BasicError),
181    UnknownValue(serde_json::Value),
182}
183
184/// struct for typed errors of method [`users_slash_get_by_username`]
185#[derive(Debug, Clone, Serialize, Deserialize)]
186#[serde(untagged)]
187pub enum UsersSlashGetByUsernameError {
188    Status404(models::BasicError),
189    UnknownValue(serde_json::Value),
190}
191
192/// struct for typed errors of method [`users_slash_get_context_for_user`]
193#[derive(Debug, Clone, Serialize, Deserialize)]
194#[serde(untagged)]
195pub enum UsersSlashGetContextForUserError {
196    Status404(models::BasicError),
197    Status422(models::ValidationError),
198    UnknownValue(serde_json::Value),
199}
200
201/// struct for typed errors of method [`users_slash_get_gpg_key_for_authenticated_user`]
202#[derive(Debug, Clone, Serialize, Deserialize)]
203#[serde(untagged)]
204pub enum UsersSlashGetGpgKeyForAuthenticatedUserError {
205    Status401(models::BasicError),
206    Status403(models::BasicError),
207    Status404(models::BasicError),
208    UnknownValue(serde_json::Value),
209}
210
211/// struct for typed errors of method [`users_slash_get_public_ssh_key_for_authenticated_user`]
212#[derive(Debug, Clone, Serialize, Deserialize)]
213#[serde(untagged)]
214pub enum UsersSlashGetPublicSshKeyForAuthenticatedUserError {
215    Status401(models::BasicError),
216    Status403(models::BasicError),
217    Status404(models::BasicError),
218    UnknownValue(serde_json::Value),
219}
220
221/// struct for typed errors of method [`users_slash_get_ssh_signing_key_for_authenticated_user`]
222#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum UsersSlashGetSshSigningKeyForAuthenticatedUserError {
225    Status401(models::BasicError),
226    Status403(models::BasicError),
227    Status404(models::BasicError),
228    UnknownValue(serde_json::Value),
229}
230
231/// struct for typed errors of method [`users_slash_list`]
232#[derive(Debug, Clone, Serialize, Deserialize)]
233#[serde(untagged)]
234pub enum UsersSlashListError {
235    UnknownValue(serde_json::Value),
236}
237
238/// struct for typed errors of method [`users_slash_list_blocked_by_authenticated_user`]
239#[derive(Debug, Clone, Serialize, Deserialize)]
240#[serde(untagged)]
241pub enum UsersSlashListBlockedByAuthenticatedUserError {
242    Status401(models::BasicError),
243    Status403(models::BasicError),
244    Status404(models::BasicError),
245    UnknownValue(serde_json::Value),
246}
247
248/// struct for typed errors of method [`users_slash_list_emails_for_authenticated_user`]
249#[derive(Debug, Clone, Serialize, Deserialize)]
250#[serde(untagged)]
251pub enum UsersSlashListEmailsForAuthenticatedUserError {
252    Status401(models::BasicError),
253    Status403(models::BasicError),
254    Status404(models::BasicError),
255    UnknownValue(serde_json::Value),
256}
257
258/// struct for typed errors of method [`users_slash_list_followed_by_authenticated_user`]
259#[derive(Debug, Clone, Serialize, Deserialize)]
260#[serde(untagged)]
261pub enum UsersSlashListFollowedByAuthenticatedUserError {
262    Status401(models::BasicError),
263    Status403(models::BasicError),
264    UnknownValue(serde_json::Value),
265}
266
267/// struct for typed errors of method [`users_slash_list_followers_for_authenticated_user`]
268#[derive(Debug, Clone, Serialize, Deserialize)]
269#[serde(untagged)]
270pub enum UsersSlashListFollowersForAuthenticatedUserError {
271    Status401(models::BasicError),
272    Status403(models::BasicError),
273    UnknownValue(serde_json::Value),
274}
275
276/// struct for typed errors of method [`users_slash_list_followers_for_user`]
277#[derive(Debug, Clone, Serialize, Deserialize)]
278#[serde(untagged)]
279pub enum UsersSlashListFollowersForUserError {
280    UnknownValue(serde_json::Value),
281}
282
283/// struct for typed errors of method [`users_slash_list_following_for_user`]
284#[derive(Debug, Clone, Serialize, Deserialize)]
285#[serde(untagged)]
286pub enum UsersSlashListFollowingForUserError {
287    UnknownValue(serde_json::Value),
288}
289
290/// struct for typed errors of method [`users_slash_list_gpg_keys_for_authenticated_user`]
291#[derive(Debug, Clone, Serialize, Deserialize)]
292#[serde(untagged)]
293pub enum UsersSlashListGpgKeysForAuthenticatedUserError {
294    Status401(models::BasicError),
295    Status403(models::BasicError),
296    Status404(models::BasicError),
297    UnknownValue(serde_json::Value),
298}
299
300/// struct for typed errors of method [`users_slash_list_gpg_keys_for_user`]
301#[derive(Debug, Clone, Serialize, Deserialize)]
302#[serde(untagged)]
303pub enum UsersSlashListGpgKeysForUserError {
304    UnknownValue(serde_json::Value),
305}
306
307/// struct for typed errors of method [`users_slash_list_public_emails_for_authenticated_user`]
308#[derive(Debug, Clone, Serialize, Deserialize)]
309#[serde(untagged)]
310pub enum UsersSlashListPublicEmailsForAuthenticatedUserError {
311    Status401(models::BasicError),
312    Status403(models::BasicError),
313    Status404(models::BasicError),
314    UnknownValue(serde_json::Value),
315}
316
317/// struct for typed errors of method [`users_slash_list_public_keys_for_user`]
318#[derive(Debug, Clone, Serialize, Deserialize)]
319#[serde(untagged)]
320pub enum UsersSlashListPublicKeysForUserError {
321    UnknownValue(serde_json::Value),
322}
323
324/// struct for typed errors of method [`users_slash_list_public_ssh_keys_for_authenticated_user`]
325#[derive(Debug, Clone, Serialize, Deserialize)]
326#[serde(untagged)]
327pub enum UsersSlashListPublicSshKeysForAuthenticatedUserError {
328    Status401(models::BasicError),
329    Status403(models::BasicError),
330    Status404(models::BasicError),
331    UnknownValue(serde_json::Value),
332}
333
334/// struct for typed errors of method [`users_slash_list_social_accounts_for_authenticated_user`]
335#[derive(Debug, Clone, Serialize, Deserialize)]
336#[serde(untagged)]
337pub enum UsersSlashListSocialAccountsForAuthenticatedUserError {
338    Status401(models::BasicError),
339    Status403(models::BasicError),
340    Status404(models::BasicError),
341    UnknownValue(serde_json::Value),
342}
343
344/// struct for typed errors of method [`users_slash_list_social_accounts_for_user`]
345#[derive(Debug, Clone, Serialize, Deserialize)]
346#[serde(untagged)]
347pub enum UsersSlashListSocialAccountsForUserError {
348    UnknownValue(serde_json::Value),
349}
350
351/// struct for typed errors of method [`users_slash_list_ssh_signing_keys_for_authenticated_user`]
352#[derive(Debug, Clone, Serialize, Deserialize)]
353#[serde(untagged)]
354pub enum UsersSlashListSshSigningKeysForAuthenticatedUserError {
355    Status401(models::BasicError),
356    Status403(models::BasicError),
357    Status404(models::BasicError),
358    UnknownValue(serde_json::Value),
359}
360
361/// struct for typed errors of method [`users_slash_list_ssh_signing_keys_for_user`]
362#[derive(Debug, Clone, Serialize, Deserialize)]
363#[serde(untagged)]
364pub enum UsersSlashListSshSigningKeysForUserError {
365    UnknownValue(serde_json::Value),
366}
367
368/// struct for typed errors of method [`users_slash_set_primary_email_visibility_for_authenticated_user`]
369#[derive(Debug, Clone, Serialize, Deserialize)]
370#[serde(untagged)]
371pub enum UsersSlashSetPrimaryEmailVisibilityForAuthenticatedUserError {
372    Status401(models::BasicError),
373    Status403(models::BasicError),
374    Status404(models::BasicError),
375    Status422(models::ValidationError),
376    UnknownValue(serde_json::Value),
377}
378
379/// struct for typed errors of method [`users_slash_unblock`]
380#[derive(Debug, Clone, Serialize, Deserialize)]
381#[serde(untagged)]
382pub enum UsersSlashUnblockError {
383    Status401(models::BasicError),
384    Status403(models::BasicError),
385    Status404(models::BasicError),
386    UnknownValue(serde_json::Value),
387}
388
389/// struct for typed errors of method [`users_slash_unfollow`]
390#[derive(Debug, Clone, Serialize, Deserialize)]
391#[serde(untagged)]
392pub enum UsersSlashUnfollowError {
393    Status401(models::BasicError),
394    Status403(models::BasicError),
395    Status404(models::BasicError),
396    UnknownValue(serde_json::Value),
397}
398
399/// struct for typed errors of method [`users_slash_update_authenticated`]
400#[derive(Debug, Clone, Serialize, Deserialize)]
401#[serde(untagged)]
402pub enum UsersSlashUpdateAuthenticatedError {
403    Status401(models::BasicError),
404    Status403(models::BasicError),
405    Status404(models::BasicError),
406    Status422(models::ValidationError),
407    UnknownValue(serde_json::Value),
408}
409
410
411/// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint.
412pub async fn users_slash_add_email_for_authenticated_user(configuration: &configuration::Configuration, users_add_email_for_authenticated_user_request: Option<models::UsersAddEmailForAuthenticatedUserRequest>) -> Result<Vec<models::Email>, Error<UsersSlashAddEmailForAuthenticatedUserError>> {
413    let local_var_configuration = configuration;
414
415    let local_var_client = &local_var_configuration.client;
416
417    let local_var_uri_str = format!("{}/user/emails", local_var_configuration.base_path);
418    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
419
420    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
421        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
422    }
423    local_var_req_builder = local_var_req_builder.json(&users_add_email_for_authenticated_user_request);
424
425    let local_var_req = local_var_req_builder.build()?;
426    let local_var_resp = local_var_client.execute(local_var_req).await?;
427
428    let local_var_status = local_var_resp.status();
429    let local_var_content = local_var_resp.text().await?;
430
431    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
432        serde_json::from_str(&local_var_content).map_err(Error::from)
433    } else {
434        let local_var_entity: Option<UsersSlashAddEmailForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
435        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
436        Err(Error::ResponseError(local_var_error))
437    }
438}
439
440/// Add one or more social accounts to the authenticated user's profile.  OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint.
441pub async fn users_slash_add_social_account_for_authenticated_user(configuration: &configuration::Configuration, users_add_social_account_for_authenticated_user_request: models::UsersAddSocialAccountForAuthenticatedUserRequest) -> Result<Vec<models::SocialAccount>, Error<UsersSlashAddSocialAccountForAuthenticatedUserError>> {
442    let local_var_configuration = configuration;
443
444    let local_var_client = &local_var_configuration.client;
445
446    let local_var_uri_str = format!("{}/user/social_accounts", local_var_configuration.base_path);
447    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
448
449    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
450        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
451    }
452    local_var_req_builder = local_var_req_builder.json(&users_add_social_account_for_authenticated_user_request);
453
454    let local_var_req = local_var_req_builder.build()?;
455    let local_var_resp = local_var_client.execute(local_var_req).await?;
456
457    let local_var_status = local_var_resp.status();
458    let local_var_content = local_var_resp.text().await?;
459
460    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
461        serde_json::from_str(&local_var_content).map_err(Error::from)
462    } else {
463        let local_var_entity: Option<UsersSlashAddSocialAccountForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
464        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
465        Err(Error::ResponseError(local_var_error))
466    }
467}
468
469/// Blocks the given user and returns a 204. If the authenticated user cannot block the given user a 422 is returned.
470pub async fn users_slash_block(configuration: &configuration::Configuration, username: &str) -> Result<(), Error<UsersSlashBlockError>> {
471    let local_var_configuration = configuration;
472
473    let local_var_client = &local_var_configuration.client;
474
475    let local_var_uri_str = format!("{}/user/blocks/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
476    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
477
478    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
479        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
480    }
481
482    let local_var_req = local_var_req_builder.build()?;
483    let local_var_resp = local_var_client.execute(local_var_req).await?;
484
485    let local_var_status = local_var_resp.status();
486    let local_var_content = local_var_resp.text().await?;
487
488    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
489        Ok(())
490    } else {
491        let local_var_entity: Option<UsersSlashBlockError> = serde_json::from_str(&local_var_content).ok();
492        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
493        Err(Error::ResponseError(local_var_error))
494    }
495}
496
497/// Returns a 204 if the given user is blocked by the authenticated user. Returns a 404 if the given user is not blocked by the authenticated user, or if the given user account has been identified as spam by GitHub.
498pub async fn users_slash_check_blocked(configuration: &configuration::Configuration, username: &str) -> Result<(), Error<UsersSlashCheckBlockedError>> {
499    let local_var_configuration = configuration;
500
501    let local_var_client = &local_var_configuration.client;
502
503    let local_var_uri_str = format!("{}/user/blocks/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
504    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
505
506    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
507        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
508    }
509
510    let local_var_req = local_var_req_builder.build()?;
511    let local_var_resp = local_var_client.execute(local_var_req).await?;
512
513    let local_var_status = local_var_resp.status();
514    let local_var_content = local_var_resp.text().await?;
515
516    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
517        Ok(())
518    } else {
519        let local_var_entity: Option<UsersSlashCheckBlockedError> = serde_json::from_str(&local_var_content).ok();
520        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
521        Err(Error::ResponseError(local_var_error))
522    }
523}
524
525/// 
526pub async fn users_slash_check_following_for_user(configuration: &configuration::Configuration, username: &str, target_user: &str) -> Result<(), Error<UsersSlashCheckFollowingForUserError>> {
527    let local_var_configuration = configuration;
528
529    let local_var_client = &local_var_configuration.client;
530
531    let local_var_uri_str = format!("{}/users/{username}/following/{target_user}", local_var_configuration.base_path, username=crate::apis::urlencode(username), target_user=crate::apis::urlencode(target_user));
532    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
533
534    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
535        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
536    }
537
538    let local_var_req = local_var_req_builder.build()?;
539    let local_var_resp = local_var_client.execute(local_var_req).await?;
540
541    let local_var_status = local_var_resp.status();
542    let local_var_content = local_var_resp.text().await?;
543
544    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
545        Ok(())
546    } else {
547        let local_var_entity: Option<UsersSlashCheckFollowingForUserError> = serde_json::from_str(&local_var_content).ok();
548        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
549        Err(Error::ResponseError(local_var_error))
550    }
551}
552
553/// 
554pub async fn users_slash_check_person_is_followed_by_authenticated(configuration: &configuration::Configuration, username: &str) -> Result<(), Error<UsersSlashCheckPersonIsFollowedByAuthenticatedError>> {
555    let local_var_configuration = configuration;
556
557    let local_var_client = &local_var_configuration.client;
558
559    let local_var_uri_str = format!("{}/user/following/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
560    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
561
562    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
563        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
564    }
565
566    let local_var_req = local_var_req_builder.build()?;
567    let local_var_resp = local_var_client.execute(local_var_req).await?;
568
569    let local_var_status = local_var_resp.status();
570    let local_var_content = local_var_resp.text().await?;
571
572    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
573        Ok(())
574    } else {
575        let local_var_entity: Option<UsersSlashCheckPersonIsFollowedByAuthenticatedError> = serde_json::from_str(&local_var_content).ok();
576        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
577        Err(Error::ResponseError(local_var_error))
578    }
579}
580
581/// Adds a GPG key to the authenticated user's GitHub account.  OAuth app tokens and personal access tokens (classic) need the `write:gpg_key` scope to use this endpoint.
582pub async fn users_slash_create_gpg_key_for_authenticated_user(configuration: &configuration::Configuration, users_create_gpg_key_for_authenticated_user_request: models::UsersCreateGpgKeyForAuthenticatedUserRequest) -> Result<models::GpgKey, Error<UsersSlashCreateGpgKeyForAuthenticatedUserError>> {
583    let local_var_configuration = configuration;
584
585    let local_var_client = &local_var_configuration.client;
586
587    let local_var_uri_str = format!("{}/user/gpg_keys", local_var_configuration.base_path);
588    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
589
590    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
591        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
592    }
593    local_var_req_builder = local_var_req_builder.json(&users_create_gpg_key_for_authenticated_user_request);
594
595    let local_var_req = local_var_req_builder.build()?;
596    let local_var_resp = local_var_client.execute(local_var_req).await?;
597
598    let local_var_status = local_var_resp.status();
599    let local_var_content = local_var_resp.text().await?;
600
601    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
602        serde_json::from_str(&local_var_content).map_err(Error::from)
603    } else {
604        let local_var_entity: Option<UsersSlashCreateGpgKeyForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
605        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
606        Err(Error::ResponseError(local_var_error))
607    }
608}
609
610/// Adds a public SSH key to the authenticated user's GitHub account.  OAuth app tokens and personal access tokens (classic) need the `write:gpg_key` scope to use this endpoint.
611pub async fn users_slash_create_public_ssh_key_for_authenticated_user(configuration: &configuration::Configuration, users_create_public_ssh_key_for_authenticated_user_request: models::UsersCreatePublicSshKeyForAuthenticatedUserRequest) -> Result<models::Key, Error<UsersSlashCreatePublicSshKeyForAuthenticatedUserError>> {
612    let local_var_configuration = configuration;
613
614    let local_var_client = &local_var_configuration.client;
615
616    let local_var_uri_str = format!("{}/user/keys", local_var_configuration.base_path);
617    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
618
619    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
620        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
621    }
622    local_var_req_builder = local_var_req_builder.json(&users_create_public_ssh_key_for_authenticated_user_request);
623
624    let local_var_req = local_var_req_builder.build()?;
625    let local_var_resp = local_var_client.execute(local_var_req).await?;
626
627    let local_var_status = local_var_resp.status();
628    let local_var_content = local_var_resp.text().await?;
629
630    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
631        serde_json::from_str(&local_var_content).map_err(Error::from)
632    } else {
633        let local_var_entity: Option<UsersSlashCreatePublicSshKeyForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
634        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
635        Err(Error::ResponseError(local_var_error))
636    }
637}
638
639/// Creates an SSH signing key for the authenticated user's GitHub account.  OAuth app tokens and personal access tokens (classic) need the `write:ssh_signing_key` scope to use this endpoint.
640pub async fn users_slash_create_ssh_signing_key_for_authenticated_user(configuration: &configuration::Configuration, users_create_ssh_signing_key_for_authenticated_user_request: models::UsersCreateSshSigningKeyForAuthenticatedUserRequest) -> Result<models::SshSigningKey, Error<UsersSlashCreateSshSigningKeyForAuthenticatedUserError>> {
641    let local_var_configuration = configuration;
642
643    let local_var_client = &local_var_configuration.client;
644
645    let local_var_uri_str = format!("{}/user/ssh_signing_keys", local_var_configuration.base_path);
646    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
647
648    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
649        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
650    }
651    local_var_req_builder = local_var_req_builder.json(&users_create_ssh_signing_key_for_authenticated_user_request);
652
653    let local_var_req = local_var_req_builder.build()?;
654    let local_var_resp = local_var_client.execute(local_var_req).await?;
655
656    let local_var_status = local_var_resp.status();
657    let local_var_content = local_var_resp.text().await?;
658
659    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
660        serde_json::from_str(&local_var_content).map_err(Error::from)
661    } else {
662        let local_var_entity: Option<UsersSlashCreateSshSigningKeyForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
663        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
664        Err(Error::ResponseError(local_var_error))
665    }
666}
667
668/// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint.
669pub async fn users_slash_delete_email_for_authenticated_user(configuration: &configuration::Configuration, users_delete_email_for_authenticated_user_request: Option<models::UsersDeleteEmailForAuthenticatedUserRequest>) -> Result<(), Error<UsersSlashDeleteEmailForAuthenticatedUserError>> {
670    let local_var_configuration = configuration;
671
672    let local_var_client = &local_var_configuration.client;
673
674    let local_var_uri_str = format!("{}/user/emails", local_var_configuration.base_path);
675    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
676
677    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
678        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
679    }
680    local_var_req_builder = local_var_req_builder.json(&users_delete_email_for_authenticated_user_request);
681
682    let local_var_req = local_var_req_builder.build()?;
683    let local_var_resp = local_var_client.execute(local_var_req).await?;
684
685    let local_var_status = local_var_resp.status();
686    let local_var_content = local_var_resp.text().await?;
687
688    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
689        Ok(())
690    } else {
691        let local_var_entity: Option<UsersSlashDeleteEmailForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
692        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
693        Err(Error::ResponseError(local_var_error))
694    }
695}
696
697/// Removes a GPG key from the authenticated user's GitHub account.  OAuth app tokens and personal access tokens (classic) need the `admin:gpg_key` scope to use this endpoint.
698pub async fn users_slash_delete_gpg_key_for_authenticated_user(configuration: &configuration::Configuration, gpg_key_id: i32) -> Result<(), Error<UsersSlashDeleteGpgKeyForAuthenticatedUserError>> {
699    let local_var_configuration = configuration;
700
701    let local_var_client = &local_var_configuration.client;
702
703    let local_var_uri_str = format!("{}/user/gpg_keys/{gpg_key_id}", local_var_configuration.base_path, gpg_key_id=gpg_key_id);
704    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
705
706    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
707        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
708    }
709
710    let local_var_req = local_var_req_builder.build()?;
711    let local_var_resp = local_var_client.execute(local_var_req).await?;
712
713    let local_var_status = local_var_resp.status();
714    let local_var_content = local_var_resp.text().await?;
715
716    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
717        Ok(())
718    } else {
719        let local_var_entity: Option<UsersSlashDeleteGpgKeyForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
720        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
721        Err(Error::ResponseError(local_var_error))
722    }
723}
724
725/// Removes a public SSH key from the authenticated user's GitHub account.  OAuth app tokens and personal access tokens (classic) need the `admin:public_key` scope to use this endpoint.
726pub async fn users_slash_delete_public_ssh_key_for_authenticated_user(configuration: &configuration::Configuration, key_id: i32) -> Result<(), Error<UsersSlashDeletePublicSshKeyForAuthenticatedUserError>> {
727    let local_var_configuration = configuration;
728
729    let local_var_client = &local_var_configuration.client;
730
731    let local_var_uri_str = format!("{}/user/keys/{key_id}", local_var_configuration.base_path, key_id=key_id);
732    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
733
734    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
735        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
736    }
737
738    let local_var_req = local_var_req_builder.build()?;
739    let local_var_resp = local_var_client.execute(local_var_req).await?;
740
741    let local_var_status = local_var_resp.status();
742    let local_var_content = local_var_resp.text().await?;
743
744    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
745        Ok(())
746    } else {
747        let local_var_entity: Option<UsersSlashDeletePublicSshKeyForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
748        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
749        Err(Error::ResponseError(local_var_error))
750    }
751}
752
753/// Deletes one or more social accounts from the authenticated user's profile.  OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint.
754pub async fn users_slash_delete_social_account_for_authenticated_user(configuration: &configuration::Configuration, users_delete_social_account_for_authenticated_user_request: models::UsersDeleteSocialAccountForAuthenticatedUserRequest) -> Result<(), Error<UsersSlashDeleteSocialAccountForAuthenticatedUserError>> {
755    let local_var_configuration = configuration;
756
757    let local_var_client = &local_var_configuration.client;
758
759    let local_var_uri_str = format!("{}/user/social_accounts", local_var_configuration.base_path);
760    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
761
762    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
763        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
764    }
765    local_var_req_builder = local_var_req_builder.json(&users_delete_social_account_for_authenticated_user_request);
766
767    let local_var_req = local_var_req_builder.build()?;
768    let local_var_resp = local_var_client.execute(local_var_req).await?;
769
770    let local_var_status = local_var_resp.status();
771    let local_var_content = local_var_resp.text().await?;
772
773    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
774        Ok(())
775    } else {
776        let local_var_entity: Option<UsersSlashDeleteSocialAccountForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
777        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
778        Err(Error::ResponseError(local_var_error))
779    }
780}
781
782/// Deletes an SSH signing key from the authenticated user's GitHub account.  OAuth app tokens and personal access tokens (classic) need the `admin:ssh_signing_key` scope to use this endpoint.
783pub async fn users_slash_delete_ssh_signing_key_for_authenticated_user(configuration: &configuration::Configuration, ssh_signing_key_id: i32) -> Result<(), Error<UsersSlashDeleteSshSigningKeyForAuthenticatedUserError>> {
784    let local_var_configuration = configuration;
785
786    let local_var_client = &local_var_configuration.client;
787
788    let local_var_uri_str = format!("{}/user/ssh_signing_keys/{ssh_signing_key_id}", local_var_configuration.base_path, ssh_signing_key_id=ssh_signing_key_id);
789    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
790
791    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
792        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
793    }
794
795    let local_var_req = local_var_req_builder.build()?;
796    let local_var_resp = local_var_client.execute(local_var_req).await?;
797
798    let local_var_status = local_var_resp.status();
799    let local_var_content = local_var_resp.text().await?;
800
801    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
802        Ok(())
803    } else {
804        let local_var_entity: Option<UsersSlashDeleteSshSigningKeyForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
805        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
806        Err(Error::ResponseError(local_var_error))
807    }
808}
809
810/// Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see \"[HTTP verbs](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#http-method).\"  OAuth app tokens and personal access tokens (classic) need the `user:follow` scope to use this endpoint.
811pub async fn users_slash_follow(configuration: &configuration::Configuration, username: &str) -> Result<(), Error<UsersSlashFollowError>> {
812    let local_var_configuration = configuration;
813
814    let local_var_client = &local_var_configuration.client;
815
816    let local_var_uri_str = format!("{}/user/following/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
817    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
818
819    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
820        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
821    }
822
823    let local_var_req = local_var_req_builder.build()?;
824    let local_var_resp = local_var_client.execute(local_var_req).await?;
825
826    let local_var_status = local_var_resp.status();
827    let local_var_content = local_var_resp.text().await?;
828
829    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
830        Ok(())
831    } else {
832        let local_var_entity: Option<UsersSlashFollowError> = serde_json::from_str(&local_var_content).ok();
833        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
834        Err(Error::ResponseError(local_var_error))
835    }
836}
837
838/// OAuth app tokens and personal access tokens (classic) need the `user` scope in order for the response to include private profile information.
839pub async fn users_slash_get_authenticated(configuration: &configuration::Configuration, ) -> Result<models::UsersGetAuthenticated200Response, Error<UsersSlashGetAuthenticatedError>> {
840    let local_var_configuration = configuration;
841
842    let local_var_client = &local_var_configuration.client;
843
844    let local_var_uri_str = format!("{}/user", local_var_configuration.base_path);
845    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
846
847    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
848        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
849    }
850
851    let local_var_req = local_var_req_builder.build()?;
852    let local_var_resp = local_var_client.execute(local_var_req).await?;
853
854    let local_var_status = local_var_resp.status();
855    let local_var_content = local_var_resp.text().await?;
856
857    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
858        serde_json::from_str(&local_var_content).map_err(Error::from)
859    } else {
860        let local_var_entity: Option<UsersSlashGetAuthenticatedError> = serde_json::from_str(&local_var_content).ok();
861        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
862        Err(Error::ResponseError(local_var_error))
863    }
864}
865
866/// Provides publicly available information about someone with a GitHub account.  The `email` key in the following response is the publicly visible email address from your GitHub [profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address for `email`, then it will have a value of `null`. You only see publicly visible email addresses when authenticated with GitHub. For more information, see [Authentication](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#authentication).  The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see \"[Emails API](https://docs.github.com/rest/users/emails)\".
867pub async fn users_slash_get_by_username(configuration: &configuration::Configuration, username: &str) -> Result<models::UsersGetAuthenticated200Response, Error<UsersSlashGetByUsernameError>> {
868    let local_var_configuration = configuration;
869
870    let local_var_client = &local_var_configuration.client;
871
872    let local_var_uri_str = format!("{}/users/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
873    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
874
875    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
876        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
877    }
878
879    let local_var_req = local_var_req_builder.build()?;
880    let local_var_resp = local_var_client.execute(local_var_req).await?;
881
882    let local_var_status = local_var_resp.status();
883    let local_var_content = local_var_resp.text().await?;
884
885    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
886        serde_json::from_str(&local_var_content).map_err(Error::from)
887    } else {
888        let local_var_entity: Option<UsersSlashGetByUsernameError> = serde_json::from_str(&local_var_content).ok();
889        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
890        Err(Error::ResponseError(local_var_error))
891    }
892}
893
894/// Provides hovercard information. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations.    The `subject_type` and `subject_id` parameters provide context for the person's hovercard, which returns more information than without the parameters. For example, if you wanted to find out more about `octocat` who owns the `Spoon-Knife` repository, you would use a `subject_type` value of `repository` and a `subject_id` value of `1300192` (the ID of the `Spoon-Knife` repository).  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
895pub async fn users_slash_get_context_for_user(configuration: &configuration::Configuration, username: &str, subject_type: Option<&str>, subject_id: Option<&str>) -> Result<models::Hovercard, Error<UsersSlashGetContextForUserError>> {
896    let local_var_configuration = configuration;
897
898    let local_var_client = &local_var_configuration.client;
899
900    let local_var_uri_str = format!("{}/users/{username}/hovercard", local_var_configuration.base_path, username=crate::apis::urlencode(username));
901    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
902
903    if let Some(ref local_var_str) = subject_type {
904        local_var_req_builder = local_var_req_builder.query(&[("subject_type", &local_var_str.to_string())]);
905    }
906    if let Some(ref local_var_str) = subject_id {
907        local_var_req_builder = local_var_req_builder.query(&[("subject_id", &local_var_str.to_string())]);
908    }
909    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
910        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
911    }
912
913    let local_var_req = local_var_req_builder.build()?;
914    let local_var_resp = local_var_client.execute(local_var_req).await?;
915
916    let local_var_status = local_var_resp.status();
917    let local_var_content = local_var_resp.text().await?;
918
919    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
920        serde_json::from_str(&local_var_content).map_err(Error::from)
921    } else {
922        let local_var_entity: Option<UsersSlashGetContextForUserError> = serde_json::from_str(&local_var_content).ok();
923        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
924        Err(Error::ResponseError(local_var_error))
925    }
926}
927
928/// View extended details for a single GPG key.  OAuth app tokens and personal access tokens (classic) need the `read:gpg_key` scope to use this endpoint.
929pub async fn users_slash_get_gpg_key_for_authenticated_user(configuration: &configuration::Configuration, gpg_key_id: i32) -> Result<models::GpgKey, Error<UsersSlashGetGpgKeyForAuthenticatedUserError>> {
930    let local_var_configuration = configuration;
931
932    let local_var_client = &local_var_configuration.client;
933
934    let local_var_uri_str = format!("{}/user/gpg_keys/{gpg_key_id}", local_var_configuration.base_path, gpg_key_id=gpg_key_id);
935    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
936
937    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
938        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
939    }
940
941    let local_var_req = local_var_req_builder.build()?;
942    let local_var_resp = local_var_client.execute(local_var_req).await?;
943
944    let local_var_status = local_var_resp.status();
945    let local_var_content = local_var_resp.text().await?;
946
947    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
948        serde_json::from_str(&local_var_content).map_err(Error::from)
949    } else {
950        let local_var_entity: Option<UsersSlashGetGpgKeyForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
951        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
952        Err(Error::ResponseError(local_var_error))
953    }
954}
955
956/// View extended details for a single public SSH key.  OAuth app tokens and personal access tokens (classic) need the `read:public_key` scope to use this endpoint.
957pub async fn users_slash_get_public_ssh_key_for_authenticated_user(configuration: &configuration::Configuration, key_id: i32) -> Result<models::Key, Error<UsersSlashGetPublicSshKeyForAuthenticatedUserError>> {
958    let local_var_configuration = configuration;
959
960    let local_var_client = &local_var_configuration.client;
961
962    let local_var_uri_str = format!("{}/user/keys/{key_id}", local_var_configuration.base_path, key_id=key_id);
963    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
964
965    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
966        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
967    }
968
969    let local_var_req = local_var_req_builder.build()?;
970    let local_var_resp = local_var_client.execute(local_var_req).await?;
971
972    let local_var_status = local_var_resp.status();
973    let local_var_content = local_var_resp.text().await?;
974
975    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
976        serde_json::from_str(&local_var_content).map_err(Error::from)
977    } else {
978        let local_var_entity: Option<UsersSlashGetPublicSshKeyForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
979        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
980        Err(Error::ResponseError(local_var_error))
981    }
982}
983
984/// Gets extended details for an SSH signing key.  OAuth app tokens and personal access tokens (classic) need the `read:ssh_signing_key` scope to use this endpoint.
985pub async fn users_slash_get_ssh_signing_key_for_authenticated_user(configuration: &configuration::Configuration, ssh_signing_key_id: i32) -> Result<models::SshSigningKey, Error<UsersSlashGetSshSigningKeyForAuthenticatedUserError>> {
986    let local_var_configuration = configuration;
987
988    let local_var_client = &local_var_configuration.client;
989
990    let local_var_uri_str = format!("{}/user/ssh_signing_keys/{ssh_signing_key_id}", local_var_configuration.base_path, ssh_signing_key_id=ssh_signing_key_id);
991    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
992
993    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
994        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
995    }
996
997    let local_var_req = local_var_req_builder.build()?;
998    let local_var_resp = local_var_client.execute(local_var_req).await?;
999
1000    let local_var_status = local_var_resp.status();
1001    let local_var_content = local_var_resp.text().await?;
1002
1003    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1004        serde_json::from_str(&local_var_content).map_err(Error::from)
1005    } else {
1006        let local_var_entity: Option<UsersSlashGetSshSigningKeyForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1007        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1008        Err(Error::ResponseError(local_var_error))
1009    }
1010}
1011
1012/// Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts.  Note: Pagination is powered exclusively by the `since` parameter. Use the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers) to get the URL for the next page of users.
1013pub async fn users_slash_list(configuration: &configuration::Configuration, since: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::SimpleUser>, Error<UsersSlashListError>> {
1014    let local_var_configuration = configuration;
1015
1016    let local_var_client = &local_var_configuration.client;
1017
1018    let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
1019    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1020
1021    if let Some(ref local_var_str) = since {
1022        local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]);
1023    }
1024    if let Some(ref local_var_str) = per_page {
1025        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1026    }
1027    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1028        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1029    }
1030
1031    let local_var_req = local_var_req_builder.build()?;
1032    let local_var_resp = local_var_client.execute(local_var_req).await?;
1033
1034    let local_var_status = local_var_resp.status();
1035    let local_var_content = local_var_resp.text().await?;
1036
1037    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1038        serde_json::from_str(&local_var_content).map_err(Error::from)
1039    } else {
1040        let local_var_entity: Option<UsersSlashListError> = serde_json::from_str(&local_var_content).ok();
1041        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1042        Err(Error::ResponseError(local_var_error))
1043    }
1044}
1045
1046/// List the users you've blocked on your personal account.
1047pub async fn users_slash_list_blocked_by_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SimpleUser>, Error<UsersSlashListBlockedByAuthenticatedUserError>> {
1048    let local_var_configuration = configuration;
1049
1050    let local_var_client = &local_var_configuration.client;
1051
1052    let local_var_uri_str = format!("{}/user/blocks", local_var_configuration.base_path);
1053    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1054
1055    if let Some(ref local_var_str) = per_page {
1056        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1057    }
1058    if let Some(ref local_var_str) = page {
1059        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1060    }
1061    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1062        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1063    }
1064
1065    let local_var_req = local_var_req_builder.build()?;
1066    let local_var_resp = local_var_client.execute(local_var_req).await?;
1067
1068    let local_var_status = local_var_resp.status();
1069    let local_var_content = local_var_resp.text().await?;
1070
1071    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1072        serde_json::from_str(&local_var_content).map_err(Error::from)
1073    } else {
1074        let local_var_entity: Option<UsersSlashListBlockedByAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1075        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1076        Err(Error::ResponseError(local_var_error))
1077    }
1078}
1079
1080/// Lists all of your email addresses, and specifies which one is visible to the public.  OAuth app tokens and personal access tokens (classic) need the `user:email` scope to use this endpoint.
1081pub async fn users_slash_list_emails_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Email>, Error<UsersSlashListEmailsForAuthenticatedUserError>> {
1082    let local_var_configuration = configuration;
1083
1084    let local_var_client = &local_var_configuration.client;
1085
1086    let local_var_uri_str = format!("{}/user/emails", local_var_configuration.base_path);
1087    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1088
1089    if let Some(ref local_var_str) = per_page {
1090        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1091    }
1092    if let Some(ref local_var_str) = page {
1093        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1094    }
1095    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1096        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1097    }
1098
1099    let local_var_req = local_var_req_builder.build()?;
1100    let local_var_resp = local_var_client.execute(local_var_req).await?;
1101
1102    let local_var_status = local_var_resp.status();
1103    let local_var_content = local_var_resp.text().await?;
1104
1105    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1106        serde_json::from_str(&local_var_content).map_err(Error::from)
1107    } else {
1108        let local_var_entity: Option<UsersSlashListEmailsForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1109        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1110        Err(Error::ResponseError(local_var_error))
1111    }
1112}
1113
1114/// Lists the people who the authenticated user follows.
1115pub async fn users_slash_list_followed_by_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SimpleUser>, Error<UsersSlashListFollowedByAuthenticatedUserError>> {
1116    let local_var_configuration = configuration;
1117
1118    let local_var_client = &local_var_configuration.client;
1119
1120    let local_var_uri_str = format!("{}/user/following", local_var_configuration.base_path);
1121    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1122
1123    if let Some(ref local_var_str) = per_page {
1124        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1125    }
1126    if let Some(ref local_var_str) = page {
1127        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1128    }
1129    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1130        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1131    }
1132
1133    let local_var_req = local_var_req_builder.build()?;
1134    let local_var_resp = local_var_client.execute(local_var_req).await?;
1135
1136    let local_var_status = local_var_resp.status();
1137    let local_var_content = local_var_resp.text().await?;
1138
1139    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1140        serde_json::from_str(&local_var_content).map_err(Error::from)
1141    } else {
1142        let local_var_entity: Option<UsersSlashListFollowedByAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1143        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1144        Err(Error::ResponseError(local_var_error))
1145    }
1146}
1147
1148/// Lists the people following the authenticated user.
1149pub async fn users_slash_list_followers_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SimpleUser>, Error<UsersSlashListFollowersForAuthenticatedUserError>> {
1150    let local_var_configuration = configuration;
1151
1152    let local_var_client = &local_var_configuration.client;
1153
1154    let local_var_uri_str = format!("{}/user/followers", local_var_configuration.base_path);
1155    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1156
1157    if let Some(ref local_var_str) = per_page {
1158        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1159    }
1160    if let Some(ref local_var_str) = page {
1161        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1162    }
1163    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1164        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1165    }
1166
1167    let local_var_req = local_var_req_builder.build()?;
1168    let local_var_resp = local_var_client.execute(local_var_req).await?;
1169
1170    let local_var_status = local_var_resp.status();
1171    let local_var_content = local_var_resp.text().await?;
1172
1173    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1174        serde_json::from_str(&local_var_content).map_err(Error::from)
1175    } else {
1176        let local_var_entity: Option<UsersSlashListFollowersForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1177        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1178        Err(Error::ResponseError(local_var_error))
1179    }
1180}
1181
1182/// Lists the people following the specified user.
1183pub async fn users_slash_list_followers_for_user(configuration: &configuration::Configuration, username: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SimpleUser>, Error<UsersSlashListFollowersForUserError>> {
1184    let local_var_configuration = configuration;
1185
1186    let local_var_client = &local_var_configuration.client;
1187
1188    let local_var_uri_str = format!("{}/users/{username}/followers", local_var_configuration.base_path, username=crate::apis::urlencode(username));
1189    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1190
1191    if let Some(ref local_var_str) = per_page {
1192        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1193    }
1194    if let Some(ref local_var_str) = page {
1195        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1196    }
1197    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1198        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1199    }
1200
1201    let local_var_req = local_var_req_builder.build()?;
1202    let local_var_resp = local_var_client.execute(local_var_req).await?;
1203
1204    let local_var_status = local_var_resp.status();
1205    let local_var_content = local_var_resp.text().await?;
1206
1207    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1208        serde_json::from_str(&local_var_content).map_err(Error::from)
1209    } else {
1210        let local_var_entity: Option<UsersSlashListFollowersForUserError> = serde_json::from_str(&local_var_content).ok();
1211        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1212        Err(Error::ResponseError(local_var_error))
1213    }
1214}
1215
1216/// Lists the people who the specified user follows.
1217pub async fn users_slash_list_following_for_user(configuration: &configuration::Configuration, username: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SimpleUser>, Error<UsersSlashListFollowingForUserError>> {
1218    let local_var_configuration = configuration;
1219
1220    let local_var_client = &local_var_configuration.client;
1221
1222    let local_var_uri_str = format!("{}/users/{username}/following", local_var_configuration.base_path, username=crate::apis::urlencode(username));
1223    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1224
1225    if let Some(ref local_var_str) = per_page {
1226        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1227    }
1228    if let Some(ref local_var_str) = page {
1229        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1230    }
1231    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1232        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1233    }
1234
1235    let local_var_req = local_var_req_builder.build()?;
1236    let local_var_resp = local_var_client.execute(local_var_req).await?;
1237
1238    let local_var_status = local_var_resp.status();
1239    let local_var_content = local_var_resp.text().await?;
1240
1241    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1242        serde_json::from_str(&local_var_content).map_err(Error::from)
1243    } else {
1244        let local_var_entity: Option<UsersSlashListFollowingForUserError> = serde_json::from_str(&local_var_content).ok();
1245        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1246        Err(Error::ResponseError(local_var_error))
1247    }
1248}
1249
1250/// Lists the current user's GPG keys.  OAuth app tokens and personal access tokens (classic) need the `read:gpg_key` scope to use this endpoint.
1251pub async fn users_slash_list_gpg_keys_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::GpgKey>, Error<UsersSlashListGpgKeysForAuthenticatedUserError>> {
1252    let local_var_configuration = configuration;
1253
1254    let local_var_client = &local_var_configuration.client;
1255
1256    let local_var_uri_str = format!("{}/user/gpg_keys", local_var_configuration.base_path);
1257    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1258
1259    if let Some(ref local_var_str) = per_page {
1260        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1261    }
1262    if let Some(ref local_var_str) = page {
1263        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1264    }
1265    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1266        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1267    }
1268
1269    let local_var_req = local_var_req_builder.build()?;
1270    let local_var_resp = local_var_client.execute(local_var_req).await?;
1271
1272    let local_var_status = local_var_resp.status();
1273    let local_var_content = local_var_resp.text().await?;
1274
1275    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1276        serde_json::from_str(&local_var_content).map_err(Error::from)
1277    } else {
1278        let local_var_entity: Option<UsersSlashListGpgKeysForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1279        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1280        Err(Error::ResponseError(local_var_error))
1281    }
1282}
1283
1284/// Lists the GPG keys for a user. This information is accessible by anyone.
1285pub async fn users_slash_list_gpg_keys_for_user(configuration: &configuration::Configuration, username: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::GpgKey>, Error<UsersSlashListGpgKeysForUserError>> {
1286    let local_var_configuration = configuration;
1287
1288    let local_var_client = &local_var_configuration.client;
1289
1290    let local_var_uri_str = format!("{}/users/{username}/gpg_keys", local_var_configuration.base_path, username=crate::apis::urlencode(username));
1291    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1292
1293    if let Some(ref local_var_str) = per_page {
1294        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1295    }
1296    if let Some(ref local_var_str) = page {
1297        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1298    }
1299    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1300        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1301    }
1302
1303    let local_var_req = local_var_req_builder.build()?;
1304    let local_var_resp = local_var_client.execute(local_var_req).await?;
1305
1306    let local_var_status = local_var_resp.status();
1307    let local_var_content = local_var_resp.text().await?;
1308
1309    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1310        serde_json::from_str(&local_var_content).map_err(Error::from)
1311    } else {
1312        let local_var_entity: Option<UsersSlashListGpgKeysForUserError> = serde_json::from_str(&local_var_content).ok();
1313        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1314        Err(Error::ResponseError(local_var_error))
1315    }
1316}
1317
1318/// Lists your publicly visible email address, which you can set with the [Set primary email visibility for the authenticated user](https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user) endpoint.  OAuth app tokens and personal access tokens (classic) need the `user:email` scope to use this endpoint.
1319pub async fn users_slash_list_public_emails_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Email>, Error<UsersSlashListPublicEmailsForAuthenticatedUserError>> {
1320    let local_var_configuration = configuration;
1321
1322    let local_var_client = &local_var_configuration.client;
1323
1324    let local_var_uri_str = format!("{}/user/public_emails", local_var_configuration.base_path);
1325    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1326
1327    if let Some(ref local_var_str) = per_page {
1328        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1329    }
1330    if let Some(ref local_var_str) = page {
1331        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1332    }
1333    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1334        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1335    }
1336
1337    let local_var_req = local_var_req_builder.build()?;
1338    let local_var_resp = local_var_client.execute(local_var_req).await?;
1339
1340    let local_var_status = local_var_resp.status();
1341    let local_var_content = local_var_resp.text().await?;
1342
1343    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1344        serde_json::from_str(&local_var_content).map_err(Error::from)
1345    } else {
1346        let local_var_entity: Option<UsersSlashListPublicEmailsForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1347        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1348        Err(Error::ResponseError(local_var_error))
1349    }
1350}
1351
1352/// Lists the _verified_ public SSH keys for a user. This is accessible by anyone.
1353pub async fn users_slash_list_public_keys_for_user(configuration: &configuration::Configuration, username: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::KeySimple>, Error<UsersSlashListPublicKeysForUserError>> {
1354    let local_var_configuration = configuration;
1355
1356    let local_var_client = &local_var_configuration.client;
1357
1358    let local_var_uri_str = format!("{}/users/{username}/keys", local_var_configuration.base_path, username=crate::apis::urlencode(username));
1359    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1360
1361    if let Some(ref local_var_str) = per_page {
1362        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1363    }
1364    if let Some(ref local_var_str) = page {
1365        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1366    }
1367    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1368        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1369    }
1370
1371    let local_var_req = local_var_req_builder.build()?;
1372    let local_var_resp = local_var_client.execute(local_var_req).await?;
1373
1374    let local_var_status = local_var_resp.status();
1375    let local_var_content = local_var_resp.text().await?;
1376
1377    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1378        serde_json::from_str(&local_var_content).map_err(Error::from)
1379    } else {
1380        let local_var_entity: Option<UsersSlashListPublicKeysForUserError> = serde_json::from_str(&local_var_content).ok();
1381        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1382        Err(Error::ResponseError(local_var_error))
1383    }
1384}
1385
1386/// Lists the public SSH keys for the authenticated user's GitHub account.  OAuth app tokens and personal access tokens (classic) need the `read:public_key` scope to use this endpoint.
1387pub async fn users_slash_list_public_ssh_keys_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Key>, Error<UsersSlashListPublicSshKeysForAuthenticatedUserError>> {
1388    let local_var_configuration = configuration;
1389
1390    let local_var_client = &local_var_configuration.client;
1391
1392    let local_var_uri_str = format!("{}/user/keys", local_var_configuration.base_path);
1393    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1394
1395    if let Some(ref local_var_str) = per_page {
1396        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1397    }
1398    if let Some(ref local_var_str) = page {
1399        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1400    }
1401    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1402        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1403    }
1404
1405    let local_var_req = local_var_req_builder.build()?;
1406    let local_var_resp = local_var_client.execute(local_var_req).await?;
1407
1408    let local_var_status = local_var_resp.status();
1409    let local_var_content = local_var_resp.text().await?;
1410
1411    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1412        serde_json::from_str(&local_var_content).map_err(Error::from)
1413    } else {
1414        let local_var_entity: Option<UsersSlashListPublicSshKeysForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1415        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1416        Err(Error::ResponseError(local_var_error))
1417    }
1418}
1419
1420/// Lists all of your social accounts.
1421pub async fn users_slash_list_social_accounts_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SocialAccount>, Error<UsersSlashListSocialAccountsForAuthenticatedUserError>> {
1422    let local_var_configuration = configuration;
1423
1424    let local_var_client = &local_var_configuration.client;
1425
1426    let local_var_uri_str = format!("{}/user/social_accounts", local_var_configuration.base_path);
1427    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1428
1429    if let Some(ref local_var_str) = per_page {
1430        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1431    }
1432    if let Some(ref local_var_str) = page {
1433        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1434    }
1435    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1436        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1437    }
1438
1439    let local_var_req = local_var_req_builder.build()?;
1440    let local_var_resp = local_var_client.execute(local_var_req).await?;
1441
1442    let local_var_status = local_var_resp.status();
1443    let local_var_content = local_var_resp.text().await?;
1444
1445    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1446        serde_json::from_str(&local_var_content).map_err(Error::from)
1447    } else {
1448        let local_var_entity: Option<UsersSlashListSocialAccountsForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1449        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1450        Err(Error::ResponseError(local_var_error))
1451    }
1452}
1453
1454/// Lists social media accounts for a user. This endpoint is accessible by anyone.
1455pub async fn users_slash_list_social_accounts_for_user(configuration: &configuration::Configuration, username: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SocialAccount>, Error<UsersSlashListSocialAccountsForUserError>> {
1456    let local_var_configuration = configuration;
1457
1458    let local_var_client = &local_var_configuration.client;
1459
1460    let local_var_uri_str = format!("{}/users/{username}/social_accounts", local_var_configuration.base_path, username=crate::apis::urlencode(username));
1461    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1462
1463    if let Some(ref local_var_str) = per_page {
1464        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1465    }
1466    if let Some(ref local_var_str) = page {
1467        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1468    }
1469    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1470        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1471    }
1472
1473    let local_var_req = local_var_req_builder.build()?;
1474    let local_var_resp = local_var_client.execute(local_var_req).await?;
1475
1476    let local_var_status = local_var_resp.status();
1477    let local_var_content = local_var_resp.text().await?;
1478
1479    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1480        serde_json::from_str(&local_var_content).map_err(Error::from)
1481    } else {
1482        let local_var_entity: Option<UsersSlashListSocialAccountsForUserError> = serde_json::from_str(&local_var_content).ok();
1483        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1484        Err(Error::ResponseError(local_var_error))
1485    }
1486}
1487
1488/// Lists the SSH signing keys for the authenticated user's GitHub account.  OAuth app tokens and personal access tokens (classic) need the `read:ssh_signing_key` scope to use this endpoint.
1489pub async fn users_slash_list_ssh_signing_keys_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SshSigningKey>, Error<UsersSlashListSshSigningKeysForAuthenticatedUserError>> {
1490    let local_var_configuration = configuration;
1491
1492    let local_var_client = &local_var_configuration.client;
1493
1494    let local_var_uri_str = format!("{}/user/ssh_signing_keys", local_var_configuration.base_path);
1495    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1496
1497    if let Some(ref local_var_str) = per_page {
1498        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1499    }
1500    if let Some(ref local_var_str) = page {
1501        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1502    }
1503    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1504        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1505    }
1506
1507    let local_var_req = local_var_req_builder.build()?;
1508    let local_var_resp = local_var_client.execute(local_var_req).await?;
1509
1510    let local_var_status = local_var_resp.status();
1511    let local_var_content = local_var_resp.text().await?;
1512
1513    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1514        serde_json::from_str(&local_var_content).map_err(Error::from)
1515    } else {
1516        let local_var_entity: Option<UsersSlashListSshSigningKeysForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1517        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1518        Err(Error::ResponseError(local_var_error))
1519    }
1520}
1521
1522/// Lists the SSH signing keys for a user. This operation is accessible by anyone.
1523pub async fn users_slash_list_ssh_signing_keys_for_user(configuration: &configuration::Configuration, username: &str, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::SshSigningKey>, Error<UsersSlashListSshSigningKeysForUserError>> {
1524    let local_var_configuration = configuration;
1525
1526    let local_var_client = &local_var_configuration.client;
1527
1528    let local_var_uri_str = format!("{}/users/{username}/ssh_signing_keys", local_var_configuration.base_path, username=crate::apis::urlencode(username));
1529    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1530
1531    if let Some(ref local_var_str) = per_page {
1532        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1533    }
1534    if let Some(ref local_var_str) = page {
1535        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1536    }
1537    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1538        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1539    }
1540
1541    let local_var_req = local_var_req_builder.build()?;
1542    let local_var_resp = local_var_client.execute(local_var_req).await?;
1543
1544    let local_var_status = local_var_resp.status();
1545    let local_var_content = local_var_resp.text().await?;
1546
1547    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1548        serde_json::from_str(&local_var_content).map_err(Error::from)
1549    } else {
1550        let local_var_entity: Option<UsersSlashListSshSigningKeysForUserError> = serde_json::from_str(&local_var_content).ok();
1551        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1552        Err(Error::ResponseError(local_var_error))
1553    }
1554}
1555
1556/// Sets the visibility for your primary email addresses.
1557pub async fn users_slash_set_primary_email_visibility_for_authenticated_user(configuration: &configuration::Configuration, users_set_primary_email_visibility_for_authenticated_user_request: models::UsersSetPrimaryEmailVisibilityForAuthenticatedUserRequest) -> Result<Vec<models::Email>, Error<UsersSlashSetPrimaryEmailVisibilityForAuthenticatedUserError>> {
1558    let local_var_configuration = configuration;
1559
1560    let local_var_client = &local_var_configuration.client;
1561
1562    let local_var_uri_str = format!("{}/user/email/visibility", local_var_configuration.base_path);
1563    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1564
1565    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1566        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1567    }
1568    local_var_req_builder = local_var_req_builder.json(&users_set_primary_email_visibility_for_authenticated_user_request);
1569
1570    let local_var_req = local_var_req_builder.build()?;
1571    let local_var_resp = local_var_client.execute(local_var_req).await?;
1572
1573    let local_var_status = local_var_resp.status();
1574    let local_var_content = local_var_resp.text().await?;
1575
1576    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1577        serde_json::from_str(&local_var_content).map_err(Error::from)
1578    } else {
1579        let local_var_entity: Option<UsersSlashSetPrimaryEmailVisibilityForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1580        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1581        Err(Error::ResponseError(local_var_error))
1582    }
1583}
1584
1585/// Unblocks the given user and returns a 204.
1586pub async fn users_slash_unblock(configuration: &configuration::Configuration, username: &str) -> Result<(), Error<UsersSlashUnblockError>> {
1587    let local_var_configuration = configuration;
1588
1589    let local_var_client = &local_var_configuration.client;
1590
1591    let local_var_uri_str = format!("{}/user/blocks/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
1592    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1593
1594    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1595        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1596    }
1597
1598    let local_var_req = local_var_req_builder.build()?;
1599    let local_var_resp = local_var_client.execute(local_var_req).await?;
1600
1601    let local_var_status = local_var_resp.status();
1602    let local_var_content = local_var_resp.text().await?;
1603
1604    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1605        Ok(())
1606    } else {
1607        let local_var_entity: Option<UsersSlashUnblockError> = serde_json::from_str(&local_var_content).ok();
1608        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1609        Err(Error::ResponseError(local_var_error))
1610    }
1611}
1612
1613/// OAuth app tokens and personal access tokens (classic) need the `user:follow` scope to use this endpoint.
1614pub async fn users_slash_unfollow(configuration: &configuration::Configuration, username: &str) -> Result<(), Error<UsersSlashUnfollowError>> {
1615    let local_var_configuration = configuration;
1616
1617    let local_var_client = &local_var_configuration.client;
1618
1619    let local_var_uri_str = format!("{}/user/following/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
1620    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1621
1622    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1623        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1624    }
1625
1626    let local_var_req = local_var_req_builder.build()?;
1627    let local_var_resp = local_var_client.execute(local_var_req).await?;
1628
1629    let local_var_status = local_var_resp.status();
1630    let local_var_content = local_var_resp.text().await?;
1631
1632    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1633        Ok(())
1634    } else {
1635        let local_var_entity: Option<UsersSlashUnfollowError> = serde_json::from_str(&local_var_content).ok();
1636        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1637        Err(Error::ResponseError(local_var_error))
1638    }
1639}
1640
1641/// **Note:** If your email is set to private and you send an `email` parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API.
1642pub async fn users_slash_update_authenticated(configuration: &configuration::Configuration, users_update_authenticated_request: Option<models::UsersUpdateAuthenticatedRequest>) -> Result<models::PrivateUser, Error<UsersSlashUpdateAuthenticatedError>> {
1643    let local_var_configuration = configuration;
1644
1645    let local_var_client = &local_var_configuration.client;
1646
1647    let local_var_uri_str = format!("{}/user", local_var_configuration.base_path);
1648    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1649
1650    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1651        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1652    }
1653    local_var_req_builder = local_var_req_builder.json(&users_update_authenticated_request);
1654
1655    let local_var_req = local_var_req_builder.build()?;
1656    let local_var_resp = local_var_client.execute(local_var_req).await?;
1657
1658    let local_var_status = local_var_resp.status();
1659    let local_var_content = local_var_resp.text().await?;
1660
1661    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1662        serde_json::from_str(&local_var_content).map_err(Error::from)
1663    } else {
1664        let local_var_entity: Option<UsersSlashUpdateAuthenticatedError> = serde_json::from_str(&local_var_content).ok();
1665        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1666        Err(Error::ResponseError(local_var_error))
1667    }
1668}
1669