openapi_github/apis/
apps_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 [`apps_slash_add_repo_to_installation_for_authenticated_user`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AppsSlashAddRepoToInstallationForAuthenticatedUserError {
22    Status403(models::BasicError),
23    Status404(models::BasicError),
24    UnknownValue(serde_json::Value),
25}
26
27/// struct for typed errors of method [`apps_slash_check_token`]
28#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum AppsSlashCheckTokenError {
31    Status404(models::BasicError),
32    Status422(models::ValidationError),
33    UnknownValue(serde_json::Value),
34}
35
36/// struct for typed errors of method [`apps_slash_create_from_manifest`]
37#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum AppsSlashCreateFromManifestError {
40    Status404(models::BasicError),
41    Status422(models::ValidationErrorSimple),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`apps_slash_create_installation_access_token`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum AppsSlashCreateInstallationAccessTokenError {
49    Status401(models::BasicError),
50    Status403(models::BasicError),
51    Status404(models::BasicError),
52    Status422(models::ValidationError),
53    UnknownValue(serde_json::Value),
54}
55
56/// struct for typed errors of method [`apps_slash_delete_authorization`]
57#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum AppsSlashDeleteAuthorizationError {
60    Status422(models::ValidationError),
61    UnknownValue(serde_json::Value),
62}
63
64/// struct for typed errors of method [`apps_slash_delete_installation`]
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum AppsSlashDeleteInstallationError {
68    Status404(models::BasicError),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`apps_slash_delete_token`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum AppsSlashDeleteTokenError {
76    Status422(models::ValidationError),
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`apps_slash_get_authenticated`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum AppsSlashGetAuthenticatedError {
84    UnknownValue(serde_json::Value),
85}
86
87/// struct for typed errors of method [`apps_slash_get_by_slug`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum AppsSlashGetBySlugError {
91    Status403(models::BasicError),
92    Status404(models::BasicError),
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`apps_slash_get_installation`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum AppsSlashGetInstallationError {
100    Status404(models::BasicError),
101    UnknownValue(serde_json::Value),
102}
103
104/// struct for typed errors of method [`apps_slash_get_org_installation`]
105#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum AppsSlashGetOrgInstallationError {
108    UnknownValue(serde_json::Value),
109}
110
111/// struct for typed errors of method [`apps_slash_get_repo_installation`]
112#[derive(Debug, Clone, Serialize, Deserialize)]
113#[serde(untagged)]
114pub enum AppsSlashGetRepoInstallationError {
115    Status404(models::BasicError),
116    UnknownValue(serde_json::Value),
117}
118
119/// struct for typed errors of method [`apps_slash_get_subscription_plan_for_account`]
120#[derive(Debug, Clone, Serialize, Deserialize)]
121#[serde(untagged)]
122pub enum AppsSlashGetSubscriptionPlanForAccountError {
123    Status401(models::BasicError),
124    Status404(models::BasicError),
125    UnknownValue(serde_json::Value),
126}
127
128/// struct for typed errors of method [`apps_slash_get_subscription_plan_for_account_stubbed`]
129#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum AppsSlashGetSubscriptionPlanForAccountStubbedError {
132    Status401(models::BasicError),
133    Status404(),
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`apps_slash_get_user_installation`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum AppsSlashGetUserInstallationError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`apps_slash_get_webhook_config_for_app`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum AppsSlashGetWebhookConfigForAppError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`apps_slash_get_webhook_delivery`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum AppsSlashGetWebhookDeliveryError {
155    Status400(models::BasicError),
156    Status422(models::ValidationError),
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`apps_slash_list_accounts_for_plan`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum AppsSlashListAccountsForPlanError {
164    Status401(models::BasicError),
165    Status404(models::BasicError),
166    Status422(models::ValidationError),
167    UnknownValue(serde_json::Value),
168}
169
170/// struct for typed errors of method [`apps_slash_list_accounts_for_plan_stubbed`]
171#[derive(Debug, Clone, Serialize, Deserialize)]
172#[serde(untagged)]
173pub enum AppsSlashListAccountsForPlanStubbedError {
174    Status401(models::BasicError),
175    UnknownValue(serde_json::Value),
176}
177
178/// struct for typed errors of method [`apps_slash_list_installation_repos_for_authenticated_user`]
179#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum AppsSlashListInstallationReposForAuthenticatedUserError {
182    Status403(models::BasicError),
183    Status404(models::BasicError),
184    UnknownValue(serde_json::Value),
185}
186
187/// struct for typed errors of method [`apps_slash_list_installation_requests_for_authenticated_app`]
188#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum AppsSlashListInstallationRequestsForAuthenticatedAppError {
191    Status401(models::BasicError),
192    UnknownValue(serde_json::Value),
193}
194
195/// struct for typed errors of method [`apps_slash_list_installations`]
196#[derive(Debug, Clone, Serialize, Deserialize)]
197#[serde(untagged)]
198pub enum AppsSlashListInstallationsError {
199    UnknownValue(serde_json::Value),
200}
201
202/// struct for typed errors of method [`apps_slash_list_installations_for_authenticated_user`]
203#[derive(Debug, Clone, Serialize, Deserialize)]
204#[serde(untagged)]
205pub enum AppsSlashListInstallationsForAuthenticatedUserError {
206    Status401(models::BasicError),
207    Status403(models::BasicError),
208    UnknownValue(serde_json::Value),
209}
210
211/// struct for typed errors of method [`apps_slash_list_plans`]
212#[derive(Debug, Clone, Serialize, Deserialize)]
213#[serde(untagged)]
214pub enum AppsSlashListPlansError {
215    Status401(models::BasicError),
216    Status404(models::BasicError),
217    UnknownValue(serde_json::Value),
218}
219
220/// struct for typed errors of method [`apps_slash_list_plans_stubbed`]
221#[derive(Debug, Clone, Serialize, Deserialize)]
222#[serde(untagged)]
223pub enum AppsSlashListPlansStubbedError {
224    Status401(models::BasicError),
225    UnknownValue(serde_json::Value),
226}
227
228/// struct for typed errors of method [`apps_slash_list_repos_accessible_to_installation`]
229#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum AppsSlashListReposAccessibleToInstallationError {
232    Status401(models::BasicError),
233    Status403(models::BasicError),
234    UnknownValue(serde_json::Value),
235}
236
237/// struct for typed errors of method [`apps_slash_list_subscriptions_for_authenticated_user`]
238#[derive(Debug, Clone, Serialize, Deserialize)]
239#[serde(untagged)]
240pub enum AppsSlashListSubscriptionsForAuthenticatedUserError {
241    Status401(models::BasicError),
242    Status404(models::BasicError),
243    UnknownValue(serde_json::Value),
244}
245
246/// struct for typed errors of method [`apps_slash_list_subscriptions_for_authenticated_user_stubbed`]
247#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum AppsSlashListSubscriptionsForAuthenticatedUserStubbedError {
250    Status401(models::BasicError),
251    UnknownValue(serde_json::Value),
252}
253
254/// struct for typed errors of method [`apps_slash_list_webhook_deliveries`]
255#[derive(Debug, Clone, Serialize, Deserialize)]
256#[serde(untagged)]
257pub enum AppsSlashListWebhookDeliveriesError {
258    Status400(models::BasicError),
259    Status422(models::ValidationError),
260    UnknownValue(serde_json::Value),
261}
262
263/// struct for typed errors of method [`apps_slash_redeliver_webhook_delivery`]
264#[derive(Debug, Clone, Serialize, Deserialize)]
265#[serde(untagged)]
266pub enum AppsSlashRedeliverWebhookDeliveryError {
267    Status400(models::BasicError),
268    Status422(models::ValidationError),
269    UnknownValue(serde_json::Value),
270}
271
272/// struct for typed errors of method [`apps_slash_remove_repo_from_installation_for_authenticated_user`]
273#[derive(Debug, Clone, Serialize, Deserialize)]
274#[serde(untagged)]
275pub enum AppsSlashRemoveRepoFromInstallationForAuthenticatedUserError {
276    Status403(models::BasicError),
277    Status404(models::BasicError),
278    Status422(),
279    UnknownValue(serde_json::Value),
280}
281
282/// struct for typed errors of method [`apps_slash_reset_token`]
283#[derive(Debug, Clone, Serialize, Deserialize)]
284#[serde(untagged)]
285pub enum AppsSlashResetTokenError {
286    Status422(models::ValidationError),
287    UnknownValue(serde_json::Value),
288}
289
290/// struct for typed errors of method [`apps_slash_revoke_installation_access_token`]
291#[derive(Debug, Clone, Serialize, Deserialize)]
292#[serde(untagged)]
293pub enum AppsSlashRevokeInstallationAccessTokenError {
294    UnknownValue(serde_json::Value),
295}
296
297/// struct for typed errors of method [`apps_slash_scope_token`]
298#[derive(Debug, Clone, Serialize, Deserialize)]
299#[serde(untagged)]
300pub enum AppsSlashScopeTokenError {
301    Status401(models::BasicError),
302    Status403(models::BasicError),
303    Status404(models::BasicError),
304    Status422(models::ValidationError),
305    UnknownValue(serde_json::Value),
306}
307
308/// struct for typed errors of method [`apps_slash_suspend_installation`]
309#[derive(Debug, Clone, Serialize, Deserialize)]
310#[serde(untagged)]
311pub enum AppsSlashSuspendInstallationError {
312    Status404(models::BasicError),
313    UnknownValue(serde_json::Value),
314}
315
316/// struct for typed errors of method [`apps_slash_unsuspend_installation`]
317#[derive(Debug, Clone, Serialize, Deserialize)]
318#[serde(untagged)]
319pub enum AppsSlashUnsuspendInstallationError {
320    Status404(models::BasicError),
321    UnknownValue(serde_json::Value),
322}
323
324/// struct for typed errors of method [`apps_slash_update_webhook_config_for_app`]
325#[derive(Debug, Clone, Serialize, Deserialize)]
326#[serde(untagged)]
327pub enum AppsSlashUpdateWebhookConfigForAppError {
328    UnknownValue(serde_json::Value),
329}
330
331
332/// Add a single repository to an installation. The authenticated user must have admin access to the repository.
333pub async fn apps_slash_add_repo_to_installation_for_authenticated_user(configuration: &configuration::Configuration, installation_id: i32, repository_id: i32) -> Result<(), Error<AppsSlashAddRepoToInstallationForAuthenticatedUserError>> {
334    let local_var_configuration = configuration;
335
336    let local_var_client = &local_var_configuration.client;
337
338    let local_var_uri_str = format!("{}/user/installations/{installation_id}/repositories/{repository_id}", local_var_configuration.base_path, installation_id=installation_id, repository_id=repository_id);
339    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
340
341    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
342        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
343    }
344
345    let local_var_req = local_var_req_builder.build()?;
346    let local_var_resp = local_var_client.execute(local_var_req).await?;
347
348    let local_var_status = local_var_resp.status();
349    let local_var_content = local_var_resp.text().await?;
350
351    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
352        Ok(())
353    } else {
354        let local_var_entity: Option<AppsSlashAddRepoToInstallationForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
355        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
356        Err(Error::ResponseError(local_var_error))
357    }
358}
359
360/// OAuth applications and GitHub applications with OAuth authorizations can use this API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) to use this endpoint, where the username is the application `client_id` and the password is its `client_secret`. Invalid tokens will return `404 NOT FOUND`.
361pub async fn apps_slash_check_token(configuration: &configuration::Configuration, client_id: &str, apps_check_token_request: models::AppsCheckTokenRequest) -> Result<models::Authorization, Error<AppsSlashCheckTokenError>> {
362    let local_var_configuration = configuration;
363
364    let local_var_client = &local_var_configuration.client;
365
366    let local_var_uri_str = format!("{}/applications/{client_id}/token", local_var_configuration.base_path, client_id=crate::apis::urlencode(client_id));
367    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
368
369    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
370        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
371    }
372    local_var_req_builder = local_var_req_builder.json(&apps_check_token_request);
373
374    let local_var_req = local_var_req_builder.build()?;
375    let local_var_resp = local_var_client.execute(local_var_req).await?;
376
377    let local_var_status = local_var_resp.status();
378    let local_var_content = local_var_resp.text().await?;
379
380    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
381        serde_json::from_str(&local_var_content).map_err(Error::from)
382    } else {
383        let local_var_entity: Option<AppsSlashCheckTokenError> = serde_json::from_str(&local_var_content).ok();
384        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
385        Err(Error::ResponseError(local_var_error))
386    }
387}
388
389/// Use this endpoint to complete the handshake necessary when implementing the [GitHub App Manifest flow](https://docs.github.com/apps/building-github-apps/creating-github-apps-from-a-manifest/). When you create a GitHub App with the manifest flow, you receive a temporary `code` used to retrieve the GitHub App's `id`, `pem` (private key), and `webhook_secret`.
390pub async fn apps_slash_create_from_manifest(configuration: &configuration::Configuration, code: &str) -> Result<models::AppsCreateFromManifest201Response, Error<AppsSlashCreateFromManifestError>> {
391    let local_var_configuration = configuration;
392
393    let local_var_client = &local_var_configuration.client;
394
395    let local_var_uri_str = format!("{}/app-manifests/{code}/conversions", local_var_configuration.base_path, code=crate::apis::urlencode(code));
396    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
397
398    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
399        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
400    }
401
402    let local_var_req = local_var_req_builder.build()?;
403    let local_var_resp = local_var_client.execute(local_var_req).await?;
404
405    let local_var_status = local_var_resp.status();
406    let local_var_content = local_var_resp.text().await?;
407
408    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
409        serde_json::from_str(&local_var_content).map_err(Error::from)
410    } else {
411        let local_var_entity: Option<AppsSlashCreateFromManifestError> = serde_json::from_str(&local_var_content).ok();
412        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
413        Err(Error::ResponseError(local_var_error))
414    }
415}
416
417/// Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access.  Optionally, you can use the `repositories` or `repository_ids` body parameters to specify individual repositories that the installation access token can access. If you don't use `repositories` or `repository_ids` to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner.  Optionally, use the `permissions` body parameter to specify the permissions that the installation access token should have. If `permissions` is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted.  When using the repository or permission parameters to reduce the access of the token, the complexity of the token is increased due to both the number of permissions in the request and the number of repositories the token will have access to. If the complexity is too large, the token will fail to be issued. If this occurs, the error message will indicate the maximum number of repositories that should be requested. For the average application requesting 8 permissions, this limit is around 5000 repositories. With fewer permissions requested, more repositories are supported.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
418pub async fn apps_slash_create_installation_access_token(configuration: &configuration::Configuration, installation_id: i32, apps_create_installation_access_token_request: Option<models::AppsCreateInstallationAccessTokenRequest>) -> Result<models::InstallationToken, Error<AppsSlashCreateInstallationAccessTokenError>> {
419    let local_var_configuration = configuration;
420
421    let local_var_client = &local_var_configuration.client;
422
423    let local_var_uri_str = format!("{}/app/installations/{installation_id}/access_tokens", local_var_configuration.base_path, installation_id=installation_id);
424    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
425
426    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
427        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
428    }
429    local_var_req_builder = local_var_req_builder.json(&apps_create_installation_access_token_request);
430
431    let local_var_req = local_var_req_builder.build()?;
432    let local_var_resp = local_var_client.execute(local_var_req).await?;
433
434    let local_var_status = local_var_resp.status();
435    let local_var_content = local_var_resp.text().await?;
436
437    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
438        serde_json::from_str(&local_var_content).map_err(Error::from)
439    } else {
440        let local_var_entity: Option<AppsSlashCreateInstallationAccessTokenError> = serde_json::from_str(&local_var_content).ok();
441        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
442        Err(Error::ResponseError(local_var_error))
443    }
444}
445
446/// OAuth and GitHub application owners can revoke a grant for their application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. You must also provide a valid OAuth `access_token` as an input parameter and the grant for the token's owner will be deleted. Deleting an application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized).
447pub async fn apps_slash_delete_authorization(configuration: &configuration::Configuration, client_id: &str, apps_delete_authorization_request: models::AppsDeleteAuthorizationRequest) -> Result<(), Error<AppsSlashDeleteAuthorizationError>> {
448    let local_var_configuration = configuration;
449
450    let local_var_client = &local_var_configuration.client;
451
452    let local_var_uri_str = format!("{}/applications/{client_id}/grant", local_var_configuration.base_path, client_id=crate::apis::urlencode(client_id));
453    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
454
455    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
456        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
457    }
458    local_var_req_builder = local_var_req_builder.json(&apps_delete_authorization_request);
459
460    let local_var_req = local_var_req_builder.build()?;
461    let local_var_resp = local_var_client.execute(local_var_req).await?;
462
463    let local_var_status = local_var_resp.status();
464    let local_var_content = local_var_resp.text().await?;
465
466    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
467        Ok(())
468    } else {
469        let local_var_entity: Option<AppsSlashDeleteAuthorizationError> = serde_json::from_str(&local_var_content).ok();
470        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
471        Err(Error::ResponseError(local_var_error))
472    }
473}
474
475/// Uninstalls a GitHub App on a user, organization, or business account. If you prefer to temporarily suspend an app's access to your account's resources, then we recommend the \"[Suspend an app installation](https://docs.github.com/rest/apps/apps#suspend-an-app-installation)\" endpoint.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
476pub async fn apps_slash_delete_installation(configuration: &configuration::Configuration, installation_id: i32) -> Result<(), Error<AppsSlashDeleteInstallationError>> {
477    let local_var_configuration = configuration;
478
479    let local_var_client = &local_var_configuration.client;
480
481    let local_var_uri_str = format!("{}/app/installations/{installation_id}", local_var_configuration.base_path, installation_id=installation_id);
482    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
483
484    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
485        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
486    }
487
488    let local_var_req = local_var_req_builder.build()?;
489    let local_var_resp = local_var_client.execute(local_var_req).await?;
490
491    let local_var_status = local_var_resp.status();
492    let local_var_content = local_var_resp.text().await?;
493
494    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
495        Ok(())
496    } else {
497        let local_var_entity: Option<AppsSlashDeleteInstallationError> = serde_json::from_str(&local_var_content).ok();
498        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
499        Err(Error::ResponseError(local_var_error))
500    }
501}
502
503/// OAuth  or GitHub application owners can revoke a single token for an OAuth application or a GitHub application with an OAuth authorization. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the application's `client_id` and `client_secret` as the username and password.
504pub async fn apps_slash_delete_token(configuration: &configuration::Configuration, client_id: &str, apps_delete_authorization_request: models::AppsDeleteAuthorizationRequest) -> Result<(), Error<AppsSlashDeleteTokenError>> {
505    let local_var_configuration = configuration;
506
507    let local_var_client = &local_var_configuration.client;
508
509    let local_var_uri_str = format!("{}/applications/{client_id}/token", local_var_configuration.base_path, client_id=crate::apis::urlencode(client_id));
510    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
511
512    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
513        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
514    }
515    local_var_req_builder = local_var_req_builder.json(&apps_delete_authorization_request);
516
517    let local_var_req = local_var_req_builder.build()?;
518    let local_var_resp = local_var_client.execute(local_var_req).await?;
519
520    let local_var_status = local_var_resp.status();
521    let local_var_content = local_var_resp.text().await?;
522
523    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
524        Ok(())
525    } else {
526        let local_var_entity: Option<AppsSlashDeleteTokenError> = serde_json::from_str(&local_var_content).ok();
527        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
528        Err(Error::ResponseError(local_var_error))
529    }
530}
531
532/// Returns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the `installations_count` in the response. For more details about your app's installations, see the \"[List installations for the authenticated app](https://docs.github.com/rest/apps/apps#list-installations-for-the-authenticated-app)\" endpoint.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
533pub async fn apps_slash_get_authenticated(configuration: &configuration::Configuration, ) -> Result<models::Integration, Error<AppsSlashGetAuthenticatedError>> {
534    let local_var_configuration = configuration;
535
536    let local_var_client = &local_var_configuration.client;
537
538    let local_var_uri_str = format!("{}/app", local_var_configuration.base_path);
539    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
540
541    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
542        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
543    }
544
545    let local_var_req = local_var_req_builder.build()?;
546    let local_var_resp = local_var_client.execute(local_var_req).await?;
547
548    let local_var_status = local_var_resp.status();
549    let local_var_content = local_var_resp.text().await?;
550
551    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
552        serde_json::from_str(&local_var_content).map_err(Error::from)
553    } else {
554        let local_var_entity: Option<AppsSlashGetAuthenticatedError> = serde_json::from_str(&local_var_content).ok();
555        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
556        Err(Error::ResponseError(local_var_error))
557    }
558}
559
560/// **Note**: The `:app_slug` is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., `https://github.com/settings/apps/:app_slug`).
561pub async fn apps_slash_get_by_slug(configuration: &configuration::Configuration, app_slug: &str) -> Result<models::Integration, Error<AppsSlashGetBySlugError>> {
562    let local_var_configuration = configuration;
563
564    let local_var_client = &local_var_configuration.client;
565
566    let local_var_uri_str = format!("{}/apps/{app_slug}", local_var_configuration.base_path, app_slug=crate::apis::urlencode(app_slug));
567    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
568
569    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
570        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
571    }
572
573    let local_var_req = local_var_req_builder.build()?;
574    let local_var_resp = local_var_client.execute(local_var_req).await?;
575
576    let local_var_status = local_var_resp.status();
577    let local_var_content = local_var_resp.text().await?;
578
579    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
580        serde_json::from_str(&local_var_content).map_err(Error::from)
581    } else {
582        let local_var_entity: Option<AppsSlashGetBySlugError> = serde_json::from_str(&local_var_content).ok();
583        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
584        Err(Error::ResponseError(local_var_error))
585    }
586}
587
588/// Enables an authenticated GitHub App to find an installation's information using the installation id.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
589pub async fn apps_slash_get_installation(configuration: &configuration::Configuration, installation_id: i32) -> Result<models::Installation, Error<AppsSlashGetInstallationError>> {
590    let local_var_configuration = configuration;
591
592    let local_var_client = &local_var_configuration.client;
593
594    let local_var_uri_str = format!("{}/app/installations/{installation_id}", local_var_configuration.base_path, installation_id=installation_id);
595    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
596
597    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
598        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
599    }
600
601    let local_var_req = local_var_req_builder.build()?;
602    let local_var_resp = local_var_client.execute(local_var_req).await?;
603
604    let local_var_status = local_var_resp.status();
605    let local_var_content = local_var_resp.text().await?;
606
607    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
608        serde_json::from_str(&local_var_content).map_err(Error::from)
609    } else {
610        let local_var_entity: Option<AppsSlashGetInstallationError> = serde_json::from_str(&local_var_content).ok();
611        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
612        Err(Error::ResponseError(local_var_error))
613    }
614}
615
616/// Enables an authenticated GitHub App to find the organization's installation information.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
617pub async fn apps_slash_get_org_installation(configuration: &configuration::Configuration, org: &str) -> Result<models::Installation, Error<AppsSlashGetOrgInstallationError>> {
618    let local_var_configuration = configuration;
619
620    let local_var_client = &local_var_configuration.client;
621
622    let local_var_uri_str = format!("{}/orgs/{org}/installation", local_var_configuration.base_path, org=crate::apis::urlencode(org));
623    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
624
625    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
626        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
627    }
628
629    let local_var_req = local_var_req_builder.build()?;
630    let local_var_resp = local_var_client.execute(local_var_req).await?;
631
632    let local_var_status = local_var_resp.status();
633    let local_var_content = local_var_resp.text().await?;
634
635    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
636        serde_json::from_str(&local_var_content).map_err(Error::from)
637    } else {
638        let local_var_entity: Option<AppsSlashGetOrgInstallationError> = serde_json::from_str(&local_var_content).ok();
639        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
640        Err(Error::ResponseError(local_var_error))
641    }
642}
643
644/// Enables an authenticated GitHub App to find the repository's installation information. The installation's account type will be either an organization or a user account, depending which account the repository belongs to.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
645pub async fn apps_slash_get_repo_installation(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::Installation, Error<AppsSlashGetRepoInstallationError>> {
646    let local_var_configuration = configuration;
647
648    let local_var_client = &local_var_configuration.client;
649
650    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/installation", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
651    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
652
653    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
654        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
655    }
656
657    let local_var_req = local_var_req_builder.build()?;
658    let local_var_resp = local_var_client.execute(local_var_req).await?;
659
660    let local_var_status = local_var_resp.status();
661    let local_var_content = local_var_resp.text().await?;
662
663    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
664        serde_json::from_str(&local_var_content).map_err(Error::from)
665    } else {
666        let local_var_entity: Option<AppsSlashGetRepoInstallationError> = serde_json::from_str(&local_var_content).ok();
667        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
668        Err(Error::ResponseError(local_var_error))
669    }
670}
671
672/// Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.  GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
673pub async fn apps_slash_get_subscription_plan_for_account(configuration: &configuration::Configuration, account_id: i32) -> Result<models::MarketplacePurchase, Error<AppsSlashGetSubscriptionPlanForAccountError>> {
674    let local_var_configuration = configuration;
675
676    let local_var_client = &local_var_configuration.client;
677
678    let local_var_uri_str = format!("{}/marketplace_listing/accounts/{account_id}", local_var_configuration.base_path, account_id=account_id);
679    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
680
681    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
682        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
683    }
684
685    let local_var_req = local_var_req_builder.build()?;
686    let local_var_resp = local_var_client.execute(local_var_req).await?;
687
688    let local_var_status = local_var_resp.status();
689    let local_var_content = local_var_resp.text().await?;
690
691    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
692        serde_json::from_str(&local_var_content).map_err(Error::from)
693    } else {
694        let local_var_entity: Option<AppsSlashGetSubscriptionPlanForAccountError> = serde_json::from_str(&local_var_content).ok();
695        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
696        Err(Error::ResponseError(local_var_error))
697    }
698}
699
700/// Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.  GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
701pub async fn apps_slash_get_subscription_plan_for_account_stubbed(configuration: &configuration::Configuration, account_id: i32) -> Result<models::MarketplacePurchase, Error<AppsSlashGetSubscriptionPlanForAccountStubbedError>> {
702    let local_var_configuration = configuration;
703
704    let local_var_client = &local_var_configuration.client;
705
706    let local_var_uri_str = format!("{}/marketplace_listing/stubbed/accounts/{account_id}", local_var_configuration.base_path, account_id=account_id);
707    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
708
709    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
710        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
711    }
712
713    let local_var_req = local_var_req_builder.build()?;
714    let local_var_resp = local_var_client.execute(local_var_req).await?;
715
716    let local_var_status = local_var_resp.status();
717    let local_var_content = local_var_resp.text().await?;
718
719    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
720        serde_json::from_str(&local_var_content).map_err(Error::from)
721    } else {
722        let local_var_entity: Option<AppsSlashGetSubscriptionPlanForAccountStubbedError> = serde_json::from_str(&local_var_content).ok();
723        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
724        Err(Error::ResponseError(local_var_error))
725    }
726}
727
728/// Enables an authenticated GitHub App to find the user’s installation information.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
729pub async fn apps_slash_get_user_installation(configuration: &configuration::Configuration, username: &str) -> Result<models::Installation, Error<AppsSlashGetUserInstallationError>> {
730    let local_var_configuration = configuration;
731
732    let local_var_client = &local_var_configuration.client;
733
734    let local_var_uri_str = format!("{}/users/{username}/installation", local_var_configuration.base_path, username=crate::apis::urlencode(username));
735    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
736
737    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
738        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
739    }
740
741    let local_var_req = local_var_req_builder.build()?;
742    let local_var_resp = local_var_client.execute(local_var_req).await?;
743
744    let local_var_status = local_var_resp.status();
745    let local_var_content = local_var_resp.text().await?;
746
747    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
748        serde_json::from_str(&local_var_content).map_err(Error::from)
749    } else {
750        let local_var_entity: Option<AppsSlashGetUserInstallationError> = serde_json::from_str(&local_var_content).ok();
751        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
752        Err(Error::ResponseError(local_var_error))
753    }
754}
755
756/// Returns the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see \"[Creating a GitHub App](/developers/apps/creating-a-github-app).\"  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
757pub async fn apps_slash_get_webhook_config_for_app(configuration: &configuration::Configuration, ) -> Result<models::WebhookConfig, Error<AppsSlashGetWebhookConfigForAppError>> {
758    let local_var_configuration = configuration;
759
760    let local_var_client = &local_var_configuration.client;
761
762    let local_var_uri_str = format!("{}/app/hook/config", local_var_configuration.base_path);
763    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
764
765    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
766        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
767    }
768
769    let local_var_req = local_var_req_builder.build()?;
770    let local_var_resp = local_var_client.execute(local_var_req).await?;
771
772    let local_var_status = local_var_resp.status();
773    let local_var_content = local_var_resp.text().await?;
774
775    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
776        serde_json::from_str(&local_var_content).map_err(Error::from)
777    } else {
778        let local_var_entity: Option<AppsSlashGetWebhookConfigForAppError> = serde_json::from_str(&local_var_content).ok();
779        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
780        Err(Error::ResponseError(local_var_error))
781    }
782}
783
784/// Returns a delivery for the webhook configured for a GitHub App.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
785pub async fn apps_slash_get_webhook_delivery(configuration: &configuration::Configuration, delivery_id: i32) -> Result<models::HookDelivery, Error<AppsSlashGetWebhookDeliveryError>> {
786    let local_var_configuration = configuration;
787
788    let local_var_client = &local_var_configuration.client;
789
790    let local_var_uri_str = format!("{}/app/hook/deliveries/{delivery_id}", local_var_configuration.base_path, delivery_id=delivery_id);
791    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
792
793    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
794        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
795    }
796
797    let local_var_req = local_var_req_builder.build()?;
798    let local_var_resp = local_var_client.execute(local_var_req).await?;
799
800    let local_var_status = local_var_resp.status();
801    let local_var_content = local_var_resp.text().await?;
802
803    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
804        serde_json::from_str(&local_var_content).map_err(Error::from)
805    } else {
806        let local_var_entity: Option<AppsSlashGetWebhookDeliveryError> = serde_json::from_str(&local_var_content).ok();
807        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
808        Err(Error::ResponseError(local_var_error))
809    }
810}
811
812/// Returns user and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.  GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
813pub async fn apps_slash_list_accounts_for_plan(configuration: &configuration::Configuration, plan_id: i32, sort: Option<&str>, direction: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::MarketplacePurchase>, Error<AppsSlashListAccountsForPlanError>> {
814    let local_var_configuration = configuration;
815
816    let local_var_client = &local_var_configuration.client;
817
818    let local_var_uri_str = format!("{}/marketplace_listing/plans/{plan_id}/accounts", local_var_configuration.base_path, plan_id=plan_id);
819    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
820
821    if let Some(ref local_var_str) = sort {
822        local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
823    }
824    if let Some(ref local_var_str) = direction {
825        local_var_req_builder = local_var_req_builder.query(&[("direction", &local_var_str.to_string())]);
826    }
827    if let Some(ref local_var_str) = per_page {
828        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
829    }
830    if let Some(ref local_var_str) = page {
831        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
832    }
833    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
834        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
835    }
836
837    let local_var_req = local_var_req_builder.build()?;
838    let local_var_resp = local_var_client.execute(local_var_req).await?;
839
840    let local_var_status = local_var_resp.status();
841    let local_var_content = local_var_resp.text().await?;
842
843    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
844        serde_json::from_str(&local_var_content).map_err(Error::from)
845    } else {
846        let local_var_entity: Option<AppsSlashListAccountsForPlanError> = serde_json::from_str(&local_var_content).ok();
847        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
848        Err(Error::ResponseError(local_var_error))
849    }
850}
851
852/// Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change.  GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
853pub async fn apps_slash_list_accounts_for_plan_stubbed(configuration: &configuration::Configuration, plan_id: i32, sort: Option<&str>, direction: Option<&str>, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::MarketplacePurchase>, Error<AppsSlashListAccountsForPlanStubbedError>> {
854    let local_var_configuration = configuration;
855
856    let local_var_client = &local_var_configuration.client;
857
858    let local_var_uri_str = format!("{}/marketplace_listing/stubbed/plans/{plan_id}/accounts", local_var_configuration.base_path, plan_id=plan_id);
859    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
860
861    if let Some(ref local_var_str) = sort {
862        local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
863    }
864    if let Some(ref local_var_str) = direction {
865        local_var_req_builder = local_var_req_builder.query(&[("direction", &local_var_str.to_string())]);
866    }
867    if let Some(ref local_var_str) = per_page {
868        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
869    }
870    if let Some(ref local_var_str) = page {
871        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
872    }
873    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
874        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
875    }
876
877    let local_var_req = local_var_req_builder.build()?;
878    let local_var_resp = local_var_client.execute(local_var_req).await?;
879
880    let local_var_status = local_var_resp.status();
881    let local_var_content = local_var_resp.text().await?;
882
883    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
884        serde_json::from_str(&local_var_content).map_err(Error::from)
885    } else {
886        let local_var_entity: Option<AppsSlashListAccountsForPlanStubbedError> = serde_json::from_str(&local_var_content).ok();
887        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
888        Err(Error::ResponseError(local_var_error))
889    }
890}
891
892/// List repositories that the authenticated user has explicit permission (`:read`, `:write`, or `:admin`) to access for an installation.  The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.  The access the user has to each repository is included in the hash under the `permissions` key.
893pub async fn apps_slash_list_installation_repos_for_authenticated_user(configuration: &configuration::Configuration, installation_id: i32, per_page: Option<i32>, page: Option<i32>) -> Result<models::AppsListInstallationReposForAuthenticatedUser200Response, Error<AppsSlashListInstallationReposForAuthenticatedUserError>> {
894    let local_var_configuration = configuration;
895
896    let local_var_client = &local_var_configuration.client;
897
898    let local_var_uri_str = format!("{}/user/installations/{installation_id}/repositories", local_var_configuration.base_path, installation_id=installation_id);
899    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
900
901    if let Some(ref local_var_str) = per_page {
902        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
903    }
904    if let Some(ref local_var_str) = page {
905        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
906    }
907    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
908        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
909    }
910
911    let local_var_req = local_var_req_builder.build()?;
912    let local_var_resp = local_var_client.execute(local_var_req).await?;
913
914    let local_var_status = local_var_resp.status();
915    let local_var_content = local_var_resp.text().await?;
916
917    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
918        serde_json::from_str(&local_var_content).map_err(Error::from)
919    } else {
920        let local_var_entity: Option<AppsSlashListInstallationReposForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
921        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
922        Err(Error::ResponseError(local_var_error))
923    }
924}
925
926/// Lists all the pending installation requests for the authenticated GitHub App.
927pub async fn apps_slash_list_installation_requests_for_authenticated_app(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::IntegrationInstallationRequest>, Error<AppsSlashListInstallationRequestsForAuthenticatedAppError>> {
928    let local_var_configuration = configuration;
929
930    let local_var_client = &local_var_configuration.client;
931
932    let local_var_uri_str = format!("{}/app/installation-requests", local_var_configuration.base_path);
933    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
934
935    if let Some(ref local_var_str) = per_page {
936        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
937    }
938    if let Some(ref local_var_str) = page {
939        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
940    }
941    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
942        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
943    }
944
945    let local_var_req = local_var_req_builder.build()?;
946    let local_var_resp = local_var_client.execute(local_var_req).await?;
947
948    let local_var_status = local_var_resp.status();
949    let local_var_content = local_var_resp.text().await?;
950
951    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
952        serde_json::from_str(&local_var_content).map_err(Error::from)
953    } else {
954        let local_var_entity: Option<AppsSlashListInstallationRequestsForAuthenticatedAppError> = serde_json::from_str(&local_var_content).ok();
955        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
956        Err(Error::ResponseError(local_var_error))
957    }
958}
959
960/// You must use a [JWT](https://docs.github.com/enterprise-server@3.9/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.  The permissions the installation has are included under the `permissions` key.
961pub async fn apps_slash_list_installations(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>, since: Option<String>, outdated: Option<&str>) -> Result<Vec<models::Installation>, Error<AppsSlashListInstallationsError>> {
962    let local_var_configuration = configuration;
963
964    let local_var_client = &local_var_configuration.client;
965
966    let local_var_uri_str = format!("{}/app/installations", local_var_configuration.base_path);
967    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
968
969    if let Some(ref local_var_str) = per_page {
970        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
971    }
972    if let Some(ref local_var_str) = page {
973        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
974    }
975    if let Some(ref local_var_str) = since {
976        local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]);
977    }
978    if let Some(ref local_var_str) = outdated {
979        local_var_req_builder = local_var_req_builder.query(&[("outdated", &local_var_str.to_string())]);
980    }
981    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
982        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
983    }
984
985    let local_var_req = local_var_req_builder.build()?;
986    let local_var_resp = local_var_client.execute(local_var_req).await?;
987
988    let local_var_status = local_var_resp.status();
989    let local_var_content = local_var_resp.text().await?;
990
991    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
992        serde_json::from_str(&local_var_content).map_err(Error::from)
993    } else {
994        let local_var_entity: Option<AppsSlashListInstallationsError> = serde_json::from_str(&local_var_content).ok();
995        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
996        Err(Error::ResponseError(local_var_error))
997    }
998}
999
1000/// Lists installations of your GitHub App that the authenticated user has explicit permission (`:read`, `:write`, or `:admin`) to access.  The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.  You can find the permissions for the installation under the `permissions` key.
1001pub async fn apps_slash_list_installations_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<models::OrgsListAppInstallations200Response, Error<AppsSlashListInstallationsForAuthenticatedUserError>> {
1002    let local_var_configuration = configuration;
1003
1004    let local_var_client = &local_var_configuration.client;
1005
1006    let local_var_uri_str = format!("{}/user/installations", local_var_configuration.base_path);
1007    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1008
1009    if let Some(ref local_var_str) = per_page {
1010        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1011    }
1012    if let Some(ref local_var_str) = page {
1013        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1014    }
1015    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1016        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1017    }
1018
1019    let local_var_req = local_var_req_builder.build()?;
1020    let local_var_resp = local_var_client.execute(local_var_req).await?;
1021
1022    let local_var_status = local_var_resp.status();
1023    let local_var_content = local_var_resp.text().await?;
1024
1025    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1026        serde_json::from_str(&local_var_content).map_err(Error::from)
1027    } else {
1028        let local_var_entity: Option<AppsSlashListInstallationsForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1029        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1030        Err(Error::ResponseError(local_var_error))
1031    }
1032}
1033
1034/// Lists all plans that are part of your GitHub Marketplace listing.  GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
1035pub async fn apps_slash_list_plans(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::MarketplaceListingPlan>, Error<AppsSlashListPlansError>> {
1036    let local_var_configuration = configuration;
1037
1038    let local_var_client = &local_var_configuration.client;
1039
1040    let local_var_uri_str = format!("{}/marketplace_listing/plans", local_var_configuration.base_path);
1041    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1042
1043    if let Some(ref local_var_str) = per_page {
1044        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1045    }
1046    if let Some(ref local_var_str) = page {
1047        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1048    }
1049    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1050        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1051    }
1052
1053    let local_var_req = local_var_req_builder.build()?;
1054    let local_var_resp = local_var_client.execute(local_var_req).await?;
1055
1056    let local_var_status = local_var_resp.status();
1057    let local_var_content = local_var_resp.text().await?;
1058
1059    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1060        serde_json::from_str(&local_var_content).map_err(Error::from)
1061    } else {
1062        let local_var_entity: Option<AppsSlashListPlansError> = serde_json::from_str(&local_var_content).ok();
1063        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1064        Err(Error::ResponseError(local_var_error))
1065    }
1066}
1067
1068/// Lists all plans that are part of your GitHub Marketplace listing.  GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint.
1069pub async fn apps_slash_list_plans_stubbed(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::MarketplaceListingPlan>, Error<AppsSlashListPlansStubbedError>> {
1070    let local_var_configuration = configuration;
1071
1072    let local_var_client = &local_var_configuration.client;
1073
1074    let local_var_uri_str = format!("{}/marketplace_listing/stubbed/plans", local_var_configuration.base_path);
1075    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1076
1077    if let Some(ref local_var_str) = per_page {
1078        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1079    }
1080    if let Some(ref local_var_str) = page {
1081        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1082    }
1083    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1084        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1085    }
1086
1087    let local_var_req = local_var_req_builder.build()?;
1088    let local_var_resp = local_var_client.execute(local_var_req).await?;
1089
1090    let local_var_status = local_var_resp.status();
1091    let local_var_content = local_var_resp.text().await?;
1092
1093    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1094        serde_json::from_str(&local_var_content).map_err(Error::from)
1095    } else {
1096        let local_var_entity: Option<AppsSlashListPlansStubbedError> = serde_json::from_str(&local_var_content).ok();
1097        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1098        Err(Error::ResponseError(local_var_error))
1099    }
1100}
1101
1102/// List repositories that an app installation can access.
1103pub async fn apps_slash_list_repos_accessible_to_installation(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<models::AppsListReposAccessibleToInstallation200Response, Error<AppsSlashListReposAccessibleToInstallationError>> {
1104    let local_var_configuration = configuration;
1105
1106    let local_var_client = &local_var_configuration.client;
1107
1108    let local_var_uri_str = format!("{}/installation/repositories", local_var_configuration.base_path);
1109    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1110
1111    if let Some(ref local_var_str) = per_page {
1112        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1113    }
1114    if let Some(ref local_var_str) = page {
1115        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1116    }
1117    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1118        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1119    }
1120
1121    let local_var_req = local_var_req_builder.build()?;
1122    let local_var_resp = local_var_client.execute(local_var_req).await?;
1123
1124    let local_var_status = local_var_resp.status();
1125    let local_var_content = local_var_resp.text().await?;
1126
1127    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1128        serde_json::from_str(&local_var_content).map_err(Error::from)
1129    } else {
1130        let local_var_entity: Option<AppsSlashListReposAccessibleToInstallationError> = serde_json::from_str(&local_var_content).ok();
1131        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1132        Err(Error::ResponseError(local_var_error))
1133    }
1134}
1135
1136/// Lists the active subscriptions for the authenticated user.
1137pub async fn apps_slash_list_subscriptions_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::UserMarketplacePurchase>, Error<AppsSlashListSubscriptionsForAuthenticatedUserError>> {
1138    let local_var_configuration = configuration;
1139
1140    let local_var_client = &local_var_configuration.client;
1141
1142    let local_var_uri_str = format!("{}/user/marketplace_purchases", local_var_configuration.base_path);
1143    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1144
1145    if let Some(ref local_var_str) = per_page {
1146        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1147    }
1148    if let Some(ref local_var_str) = page {
1149        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1150    }
1151    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1152        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1153    }
1154
1155    let local_var_req = local_var_req_builder.build()?;
1156    let local_var_resp = local_var_client.execute(local_var_req).await?;
1157
1158    let local_var_status = local_var_resp.status();
1159    let local_var_content = local_var_resp.text().await?;
1160
1161    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1162        serde_json::from_str(&local_var_content).map_err(Error::from)
1163    } else {
1164        let local_var_entity: Option<AppsSlashListSubscriptionsForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1165        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1166        Err(Error::ResponseError(local_var_error))
1167    }
1168}
1169
1170/// Lists the active subscriptions for the authenticated user.
1171pub async fn apps_slash_list_subscriptions_for_authenticated_user_stubbed(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::UserMarketplacePurchase>, Error<AppsSlashListSubscriptionsForAuthenticatedUserStubbedError>> {
1172    let local_var_configuration = configuration;
1173
1174    let local_var_client = &local_var_configuration.client;
1175
1176    let local_var_uri_str = format!("{}/user/marketplace_purchases/stubbed", local_var_configuration.base_path);
1177    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1178
1179    if let Some(ref local_var_str) = per_page {
1180        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1181    }
1182    if let Some(ref local_var_str) = page {
1183        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1184    }
1185    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1186        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1187    }
1188
1189    let local_var_req = local_var_req_builder.build()?;
1190    let local_var_resp = local_var_client.execute(local_var_req).await?;
1191
1192    let local_var_status = local_var_resp.status();
1193    let local_var_content = local_var_resp.text().await?;
1194
1195    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1196        serde_json::from_str(&local_var_content).map_err(Error::from)
1197    } else {
1198        let local_var_entity: Option<AppsSlashListSubscriptionsForAuthenticatedUserStubbedError> = serde_json::from_str(&local_var_content).ok();
1199        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1200        Err(Error::ResponseError(local_var_error))
1201    }
1202}
1203
1204/// Returns a list of webhook deliveries for the webhook configured for a GitHub App.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
1205pub async fn apps_slash_list_webhook_deliveries(configuration: &configuration::Configuration, per_page: Option<i32>, cursor: Option<&str>, redelivery: Option<bool>) -> Result<Vec<models::HookDeliveryItem>, Error<AppsSlashListWebhookDeliveriesError>> {
1206    let local_var_configuration = configuration;
1207
1208    let local_var_client = &local_var_configuration.client;
1209
1210    let local_var_uri_str = format!("{}/app/hook/deliveries", local_var_configuration.base_path);
1211    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1212
1213    if let Some(ref local_var_str) = per_page {
1214        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1215    }
1216    if let Some(ref local_var_str) = cursor {
1217        local_var_req_builder = local_var_req_builder.query(&[("cursor", &local_var_str.to_string())]);
1218    }
1219    if let Some(ref local_var_str) = redelivery {
1220        local_var_req_builder = local_var_req_builder.query(&[("redelivery", &local_var_str.to_string())]);
1221    }
1222    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1223        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1224    }
1225
1226    let local_var_req = local_var_req_builder.build()?;
1227    let local_var_resp = local_var_client.execute(local_var_req).await?;
1228
1229    let local_var_status = local_var_resp.status();
1230    let local_var_content = local_var_resp.text().await?;
1231
1232    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1233        serde_json::from_str(&local_var_content).map_err(Error::from)
1234    } else {
1235        let local_var_entity: Option<AppsSlashListWebhookDeliveriesError> = serde_json::from_str(&local_var_content).ok();
1236        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1237        Err(Error::ResponseError(local_var_error))
1238    }
1239}
1240
1241/// Redeliver a delivery for the webhook configured for a GitHub App.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
1242pub async fn apps_slash_redeliver_webhook_delivery(configuration: &configuration::Configuration, delivery_id: i32) -> Result<serde_json::Value, Error<AppsSlashRedeliverWebhookDeliveryError>> {
1243    let local_var_configuration = configuration;
1244
1245    let local_var_client = &local_var_configuration.client;
1246
1247    let local_var_uri_str = format!("{}/app/hook/deliveries/{delivery_id}/attempts", local_var_configuration.base_path, delivery_id=delivery_id);
1248    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1249
1250    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1251        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1252    }
1253
1254    let local_var_req = local_var_req_builder.build()?;
1255    let local_var_resp = local_var_client.execute(local_var_req).await?;
1256
1257    let local_var_status = local_var_resp.status();
1258    let local_var_content = local_var_resp.text().await?;
1259
1260    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1261        serde_json::from_str(&local_var_content).map_err(Error::from)
1262    } else {
1263        let local_var_entity: Option<AppsSlashRedeliverWebhookDeliveryError> = serde_json::from_str(&local_var_content).ok();
1264        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1265        Err(Error::ResponseError(local_var_error))
1266    }
1267}
1268
1269/// Remove a single repository from an installation. The authenticated user must have admin access to the repository. The installation must have the `repository_selection` of `selected`.
1270pub async fn apps_slash_remove_repo_from_installation_for_authenticated_user(configuration: &configuration::Configuration, installation_id: i32, repository_id: i32) -> Result<(), Error<AppsSlashRemoveRepoFromInstallationForAuthenticatedUserError>> {
1271    let local_var_configuration = configuration;
1272
1273    let local_var_client = &local_var_configuration.client;
1274
1275    let local_var_uri_str = format!("{}/user/installations/{installation_id}/repositories/{repository_id}", local_var_configuration.base_path, installation_id=installation_id, repository_id=repository_id);
1276    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1277
1278    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1279        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1280    }
1281
1282    let local_var_req = local_var_req_builder.build()?;
1283    let local_var_resp = local_var_client.execute(local_var_req).await?;
1284
1285    let local_var_status = local_var_resp.status();
1286    let local_var_content = local_var_resp.text().await?;
1287
1288    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1289        Ok(())
1290    } else {
1291        let local_var_entity: Option<AppsSlashRemoveRepoFromInstallationForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1292        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1293        Err(Error::ResponseError(local_var_error))
1294    }
1295}
1296
1297/// OAuth applications and GitHub applications with OAuth authorizations can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the \"token\" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`.
1298pub async fn apps_slash_reset_token(configuration: &configuration::Configuration, client_id: &str, apps_check_token_request: models::AppsCheckTokenRequest) -> Result<models::Authorization, Error<AppsSlashResetTokenError>> {
1299    let local_var_configuration = configuration;
1300
1301    let local_var_client = &local_var_configuration.client;
1302
1303    let local_var_uri_str = format!("{}/applications/{client_id}/token", local_var_configuration.base_path, client_id=crate::apis::urlencode(client_id));
1304    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1305
1306    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1307        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1308    }
1309    local_var_req_builder = local_var_req_builder.json(&apps_check_token_request);
1310
1311    let local_var_req = local_var_req_builder.build()?;
1312    let local_var_resp = local_var_client.execute(local_var_req).await?;
1313
1314    let local_var_status = local_var_resp.status();
1315    let local_var_content = local_var_resp.text().await?;
1316
1317    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1318        serde_json::from_str(&local_var_content).map_err(Error::from)
1319    } else {
1320        let local_var_entity: Option<AppsSlashResetTokenError> = serde_json::from_str(&local_var_content).ok();
1321        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1322        Err(Error::ResponseError(local_var_error))
1323    }
1324}
1325
1326/// Revokes the installation token you're using to authenticate as an installation and access this endpoint.  Once an installation token is revoked, the token is invalidated and cannot be used. Other endpoints that require the revoked installation token must have a new installation token to work. You can create a new token using the \"[Create an installation access token for an app](https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app)\" endpoint.
1327pub async fn apps_slash_revoke_installation_access_token(configuration: &configuration::Configuration, ) -> Result<(), Error<AppsSlashRevokeInstallationAccessTokenError>> {
1328    let local_var_configuration = configuration;
1329
1330    let local_var_client = &local_var_configuration.client;
1331
1332    let local_var_uri_str = format!("{}/installation/token", local_var_configuration.base_path);
1333    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1334
1335    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1336        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1337    }
1338
1339    let local_var_req = local_var_req_builder.build()?;
1340    let local_var_resp = local_var_client.execute(local_var_req).await?;
1341
1342    let local_var_status = local_var_resp.status();
1343    let local_var_content = local_var_resp.text().await?;
1344
1345    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1346        Ok(())
1347    } else {
1348        let local_var_entity: Option<AppsSlashRevokeInstallationAccessTokenError> = serde_json::from_str(&local_var_content).ok();
1349        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1350        Err(Error::ResponseError(local_var_error))
1351    }
1352}
1353
1354/// Use a non-scoped user access token to create a repository-scoped and/or permission-scoped user access token. You can specify which repositories the token can access and which permissions are granted to the token.  Invalid tokens will return `404 NOT FOUND`.  You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the `client_id` and `client_secret` of the GitHub App as the username and password.
1355pub async fn apps_slash_scope_token(configuration: &configuration::Configuration, client_id: &str, apps_scope_token_request: models::AppsScopeTokenRequest) -> Result<models::Authorization, Error<AppsSlashScopeTokenError>> {
1356    let local_var_configuration = configuration;
1357
1358    let local_var_client = &local_var_configuration.client;
1359
1360    let local_var_uri_str = format!("{}/applications/{client_id}/token/scoped", local_var_configuration.base_path, client_id=crate::apis::urlencode(client_id));
1361    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1362
1363    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1364        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1365    }
1366    local_var_req_builder = local_var_req_builder.json(&apps_scope_token_request);
1367
1368    let local_var_req = local_var_req_builder.build()?;
1369    let local_var_resp = local_var_client.execute(local_var_req).await?;
1370
1371    let local_var_status = local_var_resp.status();
1372    let local_var_content = local_var_resp.text().await?;
1373
1374    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1375        serde_json::from_str(&local_var_content).map_err(Error::from)
1376    } else {
1377        let local_var_entity: Option<AppsSlashScopeTokenError> = serde_json::from_str(&local_var_content).ok();
1378        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1379        Err(Error::ResponseError(local_var_error))
1380    }
1381}
1382
1383/// Suspends a GitHub App on a user, organization, or business account, which blocks the app from accessing the account's resources. When a GitHub App is suspended, the app's access to the GitHub API or webhook events is blocked for that account.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
1384pub async fn apps_slash_suspend_installation(configuration: &configuration::Configuration, installation_id: i32) -> Result<(), Error<AppsSlashSuspendInstallationError>> {
1385    let local_var_configuration = configuration;
1386
1387    let local_var_client = &local_var_configuration.client;
1388
1389    let local_var_uri_str = format!("{}/app/installations/{installation_id}/suspended", local_var_configuration.base_path, installation_id=installation_id);
1390    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1391
1392    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1393        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1394    }
1395
1396    let local_var_req = local_var_req_builder.build()?;
1397    let local_var_resp = local_var_client.execute(local_var_req).await?;
1398
1399    let local_var_status = local_var_resp.status();
1400    let local_var_content = local_var_resp.text().await?;
1401
1402    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1403        Ok(())
1404    } else {
1405        let local_var_entity: Option<AppsSlashSuspendInstallationError> = serde_json::from_str(&local_var_content).ok();
1406        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1407        Err(Error::ResponseError(local_var_error))
1408    }
1409}
1410
1411/// Removes a GitHub App installation suspension.  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
1412pub async fn apps_slash_unsuspend_installation(configuration: &configuration::Configuration, installation_id: i32) -> Result<(), Error<AppsSlashUnsuspendInstallationError>> {
1413    let local_var_configuration = configuration;
1414
1415    let local_var_client = &local_var_configuration.client;
1416
1417    let local_var_uri_str = format!("{}/app/installations/{installation_id}/suspended", local_var_configuration.base_path, installation_id=installation_id);
1418    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1419
1420    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1421        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1422    }
1423
1424    let local_var_req = local_var_req_builder.build()?;
1425    let local_var_resp = local_var_client.execute(local_var_req).await?;
1426
1427    let local_var_status = local_var_resp.status();
1428    let local_var_content = local_var_resp.text().await?;
1429
1430    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1431        Ok(())
1432    } else {
1433        let local_var_entity: Option<AppsSlashUnsuspendInstallationError> = serde_json::from_str(&local_var_content).ok();
1434        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1435        Err(Error::ResponseError(local_var_error))
1436    }
1437}
1438
1439/// Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see \"[Creating a GitHub App](/developers/apps/creating-a-github-app).\"  You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint.
1440pub async fn apps_slash_update_webhook_config_for_app(configuration: &configuration::Configuration, apps_update_webhook_config_for_app_request: models::AppsUpdateWebhookConfigForAppRequest) -> Result<models::WebhookConfig, Error<AppsSlashUpdateWebhookConfigForAppError>> {
1441    let local_var_configuration = configuration;
1442
1443    let local_var_client = &local_var_configuration.client;
1444
1445    let local_var_uri_str = format!("{}/app/hook/config", local_var_configuration.base_path);
1446    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
1447
1448    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1449        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1450    }
1451    local_var_req_builder = local_var_req_builder.json(&apps_update_webhook_config_for_app_request);
1452
1453    let local_var_req = local_var_req_builder.build()?;
1454    let local_var_resp = local_var_client.execute(local_var_req).await?;
1455
1456    let local_var_status = local_var_resp.status();
1457    let local_var_content = local_var_resp.text().await?;
1458
1459    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1460        serde_json::from_str(&local_var_content).map_err(Error::from)
1461    } else {
1462        let local_var_entity: Option<AppsSlashUpdateWebhookConfigForAppError> = serde_json::from_str(&local_var_content).ok();
1463        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1464        Err(Error::ResponseError(local_var_error))
1465    }
1466}
1467