openapi_github/apis/
dependabot_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 [`dependabot_slash_add_selected_repo_to_org_secret`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DependabotSlashAddSelectedRepoToOrgSecretError {
22    Status409(),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`dependabot_slash_create_or_update_org_secret`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum DependabotSlashCreateOrUpdateOrgSecretError {
30    UnknownValue(serde_json::Value),
31}
32
33/// struct for typed errors of method [`dependabot_slash_create_or_update_repo_secret`]
34#[derive(Debug, Clone, Serialize, Deserialize)]
35#[serde(untagged)]
36pub enum DependabotSlashCreateOrUpdateRepoSecretError {
37    UnknownValue(serde_json::Value),
38}
39
40/// struct for typed errors of method [`dependabot_slash_delete_org_secret`]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum DependabotSlashDeleteOrgSecretError {
44    UnknownValue(serde_json::Value),
45}
46
47/// struct for typed errors of method [`dependabot_slash_delete_repo_secret`]
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum DependabotSlashDeleteRepoSecretError {
51    UnknownValue(serde_json::Value),
52}
53
54/// struct for typed errors of method [`dependabot_slash_get_alert`]
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum DependabotSlashGetAlertError {
58    Status403(models::BasicError),
59    Status404(models::BasicError),
60    UnknownValue(serde_json::Value),
61}
62
63/// struct for typed errors of method [`dependabot_slash_get_org_public_key`]
64#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum DependabotSlashGetOrgPublicKeyError {
67    UnknownValue(serde_json::Value),
68}
69
70/// struct for typed errors of method [`dependabot_slash_get_org_secret`]
71#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum DependabotSlashGetOrgSecretError {
74    UnknownValue(serde_json::Value),
75}
76
77/// struct for typed errors of method [`dependabot_slash_get_repo_public_key`]
78#[derive(Debug, Clone, Serialize, Deserialize)]
79#[serde(untagged)]
80pub enum DependabotSlashGetRepoPublicKeyError {
81    UnknownValue(serde_json::Value),
82}
83
84/// struct for typed errors of method [`dependabot_slash_get_repo_secret`]
85#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum DependabotSlashGetRepoSecretError {
88    UnknownValue(serde_json::Value),
89}
90
91/// struct for typed errors of method [`dependabot_slash_list_alerts_for_enterprise`]
92#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum DependabotSlashListAlertsForEnterpriseError {
95    Status403(models::BasicError),
96    Status404(models::BasicError),
97    Status422(models::ValidationErrorSimple),
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`dependabot_slash_list_alerts_for_org`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum DependabotSlashListAlertsForOrgError {
105    Status400(models::BasicError),
106    Status403(models::BasicError),
107    Status404(models::BasicError),
108    Status422(models::ValidationErrorSimple),
109    UnknownValue(serde_json::Value),
110}
111
112/// struct for typed errors of method [`dependabot_slash_list_alerts_for_repo`]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum DependabotSlashListAlertsForRepoError {
116    Status400(models::BasicError),
117    Status403(models::BasicError),
118    Status404(models::BasicError),
119    Status422(models::ValidationErrorSimple),
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`dependabot_slash_list_org_secrets`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum DependabotSlashListOrgSecretsError {
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`dependabot_slash_list_repo_secrets`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum DependabotSlashListRepoSecretsError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`dependabot_slash_list_selected_repos_for_org_secret`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum DependabotSlashListSelectedReposForOrgSecretError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`dependabot_slash_remove_selected_repo_from_org_secret`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum DependabotSlashRemoveSelectedRepoFromOrgSecretError {
148    Status409(),
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`dependabot_slash_set_selected_repos_for_org_secret`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum DependabotSlashSetSelectedReposForOrgSecretError {
156    UnknownValue(serde_json::Value),
157}
158
159/// struct for typed errors of method [`dependabot_slash_update_alert`]
160#[derive(Debug, Clone, Serialize, Deserialize)]
161#[serde(untagged)]
162pub enum DependabotSlashUpdateAlertError {
163    Status400(models::BasicError),
164    Status403(models::BasicError),
165    Status404(models::BasicError),
166    Status409(models::BasicError),
167    Status422(models::ValidationErrorSimple),
168    UnknownValue(serde_json::Value),
169}
170
171
172/// Adds a repository to an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret).  OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
173pub async fn dependabot_slash_add_selected_repo_to_org_secret(configuration: &configuration::Configuration, org: &str, secret_name: &str, repository_id: i32) -> Result<(), Error<DependabotSlashAddSelectedRepoToOrgSecretError>> {
174    let local_var_configuration = configuration;
175
176    let local_var_client = &local_var_configuration.client;
177
178    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), secret_name=crate::apis::urlencode(secret_name), repository_id=repository_id);
179    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
180
181    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
182        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
183    }
184
185    let local_var_req = local_var_req_builder.build()?;
186    let local_var_resp = local_var_client.execute(local_var_req).await?;
187
188    let local_var_status = local_var_resp.status();
189    let local_var_content = local_var_resp.text().await?;
190
191    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
192        Ok(())
193    } else {
194        let local_var_entity: Option<DependabotSlashAddSelectedRepoToOrgSecretError> = serde_json::from_str(&local_var_content).ok();
195        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
196        Err(Error::ResponseError(local_var_error))
197    }
198}
199
200/// Creates or updates an organization secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `dependabot_secrets` organization permission to use this endpoint.  #### Example encrypting a secret using Node.js  Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library.  ``` const sodium = require('tweetsodium');  const key = \"base64-encoded-public-key\"; const value = \"plain-text-secret\";  // Convert the message and key to Uint8Array's (Buffer implements that interface) const messageBytes = Buffer.from(value); const keyBytes = Buffer.from(key, 'base64');  // Encrypt using LibSodium. const encryptedBytes = sodium.seal(messageBytes, keyBytes);  // Base64 the encrypted secret const encrypted = Buffer.from(encryptedBytes).toString('base64');  console.log(encrypted); ```   #### Example encrypting a secret using Python  Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/latest/public/#nacl-public-sealedbox) with Python 3.  ``` from base64 import b64encode from nacl import encoding, public  def encrypt(public_key: str, secret_value: str) -> str:   \"\"\"Encrypt a Unicode string using the public key.\"\"\"   public_key = public.PublicKey(public_key.encode(\"utf-8\"), encoding.Base64Encoder())   sealed_box = public.SealedBox(public_key)   encrypted = sealed_box.encrypt(secret_value.encode(\"utf-8\"))   return b64encode(encrypted).decode(\"utf-8\") ```  #### Example encrypting a secret using C#  Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package.  ``` var secretValue = System.Text.Encoding.UTF8.GetBytes(\"mySecret\"); var publicKey = Convert.FromBase64String(\"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=\");  var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);  Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox)); ```  #### Example encrypting a secret using Ruby  Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem.  ```ruby require \"rbnacl\" require \"base64\"  key = Base64.decode64(\"+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=\") public_key = RbNaCl::PublicKey.new(key)  box = RbNaCl::Boxes::Sealed.from_public_key(public_key) encrypted_secret = box.encrypt(\"my_secret\")  # Print the base64 encoded secret puts Base64.strict_encode64(encrypted_secret) ```
201pub async fn dependabot_slash_create_or_update_org_secret(configuration: &configuration::Configuration, org: &str, secret_name: &str, dependabot_create_or_update_org_secret_request: models::DependabotCreateOrUpdateOrgSecretRequest) -> Result<serde_json::Value, Error<DependabotSlashCreateOrUpdateOrgSecretError>> {
202    let local_var_configuration = configuration;
203
204    let local_var_client = &local_var_configuration.client;
205
206    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/secrets/{secret_name}", local_var_configuration.base_path, org=crate::apis::urlencode(org), secret_name=crate::apis::urlencode(secret_name));
207    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
208
209    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
210        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
211    }
212    local_var_req_builder = local_var_req_builder.json(&dependabot_create_or_update_org_secret_request);
213
214    let local_var_req = local_var_req_builder.build()?;
215    let local_var_resp = local_var_client.execute(local_var_req).await?;
216
217    let local_var_status = local_var_resp.status();
218    let local_var_content = local_var_resp.text().await?;
219
220    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
221        serde_json::from_str(&local_var_content).map_err(Error::from)
222    } else {
223        let local_var_entity: Option<DependabotSlashCreateOrUpdateOrgSecretError> = serde_json::from_str(&local_var_content).ok();
224        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
225        Err(Error::ResponseError(local_var_error))
226    }
227}
228
229/// Creates or updates a repository secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). For more information, see \"[Encrypting secrets for the REST API](https://docs.github.com/rest/guides/encrypting-secrets-for-the-rest-api).\"  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
230pub async fn dependabot_slash_create_or_update_repo_secret(configuration: &configuration::Configuration, owner: &str, repo: &str, secret_name: &str, dependabot_create_or_update_repo_secret_request: models::DependabotCreateOrUpdateRepoSecretRequest) -> Result<serde_json::Value, Error<DependabotSlashCreateOrUpdateRepoSecretError>> {
231    let local_var_configuration = configuration;
232
233    let local_var_client = &local_var_configuration.client;
234
235    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/dependabot/secrets/{secret_name}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), secret_name=crate::apis::urlencode(secret_name));
236    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
237
238    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
239        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
240    }
241    local_var_req_builder = local_var_req_builder.json(&dependabot_create_or_update_repo_secret_request);
242
243    let local_var_req = local_var_req_builder.build()?;
244    let local_var_resp = local_var_client.execute(local_var_req).await?;
245
246    let local_var_status = local_var_resp.status();
247    let local_var_content = local_var_resp.text().await?;
248
249    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
250        serde_json::from_str(&local_var_content).map_err(Error::from)
251    } else {
252        let local_var_entity: Option<DependabotSlashCreateOrUpdateRepoSecretError> = serde_json::from_str(&local_var_content).ok();
253        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
254        Err(Error::ResponseError(local_var_error))
255    }
256}
257
258/// Deletes a secret in an organization using the secret name.  OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
259pub async fn dependabot_slash_delete_org_secret(configuration: &configuration::Configuration, org: &str, secret_name: &str) -> Result<(), Error<DependabotSlashDeleteOrgSecretError>> {
260    let local_var_configuration = configuration;
261
262    let local_var_client = &local_var_configuration.client;
263
264    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/secrets/{secret_name}", local_var_configuration.base_path, org=crate::apis::urlencode(org), secret_name=crate::apis::urlencode(secret_name));
265    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
266
267    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
268        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
269    }
270
271    let local_var_req = local_var_req_builder.build()?;
272    let local_var_resp = local_var_client.execute(local_var_req).await?;
273
274    let local_var_status = local_var_resp.status();
275    let local_var_content = local_var_resp.text().await?;
276
277    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
278        Ok(())
279    } else {
280        let local_var_entity: Option<DependabotSlashDeleteOrgSecretError> = serde_json::from_str(&local_var_content).ok();
281        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
282        Err(Error::ResponseError(local_var_error))
283    }
284}
285
286/// Deletes a secret in a repository using the secret name.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
287pub async fn dependabot_slash_delete_repo_secret(configuration: &configuration::Configuration, owner: &str, repo: &str, secret_name: &str) -> Result<(), Error<DependabotSlashDeleteRepoSecretError>> {
288    let local_var_configuration = configuration;
289
290    let local_var_client = &local_var_configuration.client;
291
292    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/dependabot/secrets/{secret_name}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), secret_name=crate::apis::urlencode(secret_name));
293    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
294
295    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
296        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
297    }
298
299    let local_var_req = local_var_req_builder.build()?;
300    let local_var_resp = local_var_client.execute(local_var_req).await?;
301
302    let local_var_status = local_var_resp.status();
303    let local_var_content = local_var_resp.text().await?;
304
305    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
306        Ok(())
307    } else {
308        let local_var_entity: Option<DependabotSlashDeleteRepoSecretError> = serde_json::from_str(&local_var_content).ok();
309        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
310        Err(Error::ResponseError(local_var_error))
311    }
312}
313
314/// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead.
315pub async fn dependabot_slash_get_alert(configuration: &configuration::Configuration, owner: &str, repo: &str, alert_number: i32) -> Result<models::DependabotAlert, Error<DependabotSlashGetAlertError>> {
316    let local_var_configuration = configuration;
317
318    let local_var_client = &local_var_configuration.client;
319
320    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/dependabot/alerts/{alert_number}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), alert_number=alert_number);
321    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
322
323    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
324        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
325    }
326
327    let local_var_req = local_var_req_builder.build()?;
328    let local_var_resp = local_var_client.execute(local_var_req).await?;
329
330    let local_var_status = local_var_resp.status();
331    let local_var_content = local_var_resp.text().await?;
332
333    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
334        serde_json::from_str(&local_var_content).map_err(Error::from)
335    } else {
336        let local_var_entity: Option<DependabotSlashGetAlertError> = serde_json::from_str(&local_var_content).ok();
337        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
338        Err(Error::ResponseError(local_var_error))
339    }
340}
341
342/// Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets.  OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
343pub async fn dependabot_slash_get_org_public_key(configuration: &configuration::Configuration, org: &str) -> Result<models::DependabotPublicKey, Error<DependabotSlashGetOrgPublicKeyError>> {
344    let local_var_configuration = configuration;
345
346    let local_var_client = &local_var_configuration.client;
347
348    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/secrets/public-key", local_var_configuration.base_path, org=crate::apis::urlencode(org));
349    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
350
351    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
352        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
353    }
354
355    let local_var_req = local_var_req_builder.build()?;
356    let local_var_resp = local_var_client.execute(local_var_req).await?;
357
358    let local_var_status = local_var_resp.status();
359    let local_var_content = local_var_resp.text().await?;
360
361    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
362        serde_json::from_str(&local_var_content).map_err(Error::from)
363    } else {
364        let local_var_entity: Option<DependabotSlashGetOrgPublicKeyError> = serde_json::from_str(&local_var_content).ok();
365        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
366        Err(Error::ResponseError(local_var_error))
367    }
368}
369
370/// Gets a single organization secret without revealing its encrypted value.  OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
371pub async fn dependabot_slash_get_org_secret(configuration: &configuration::Configuration, org: &str, secret_name: &str) -> Result<models::OrganizationDependabotSecret, Error<DependabotSlashGetOrgSecretError>> {
372    let local_var_configuration = configuration;
373
374    let local_var_client = &local_var_configuration.client;
375
376    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/secrets/{secret_name}", local_var_configuration.base_path, org=crate::apis::urlencode(org), secret_name=crate::apis::urlencode(secret_name));
377    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
378
379    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
380        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
381    }
382
383    let local_var_req = local_var_req_builder.build()?;
384    let local_var_resp = local_var_client.execute(local_var_req).await?;
385
386    let local_var_status = local_var_resp.status();
387    let local_var_content = local_var_resp.text().await?;
388
389    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
390        serde_json::from_str(&local_var_content).map_err(Error::from)
391    } else {
392        let local_var_entity: Option<DependabotSlashGetOrgSecretError> = serde_json::from_str(&local_var_content).ok();
393        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
394        Err(Error::ResponseError(local_var_error))
395    }
396}
397
398/// Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with read access to the repository can use this endpoint.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint if the repository is private.
399pub async fn dependabot_slash_get_repo_public_key(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::DependabotPublicKey, Error<DependabotSlashGetRepoPublicKeyError>> {
400    let local_var_configuration = configuration;
401
402    let local_var_client = &local_var_configuration.client;
403
404    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/dependabot/secrets/public-key", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
405    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
406
407    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
408        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
409    }
410
411    let local_var_req = local_var_req_builder.build()?;
412    let local_var_resp = local_var_client.execute(local_var_req).await?;
413
414    let local_var_status = local_var_resp.status();
415    let local_var_content = local_var_resp.text().await?;
416
417    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
418        serde_json::from_str(&local_var_content).map_err(Error::from)
419    } else {
420        let local_var_entity: Option<DependabotSlashGetRepoPublicKeyError> = serde_json::from_str(&local_var_content).ok();
421        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
422        Err(Error::ResponseError(local_var_error))
423    }
424}
425
426/// Gets a single repository secret without revealing its encrypted value.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
427pub async fn dependabot_slash_get_repo_secret(configuration: &configuration::Configuration, owner: &str, repo: &str, secret_name: &str) -> Result<models::DependabotSecret, Error<DependabotSlashGetRepoSecretError>> {
428    let local_var_configuration = configuration;
429
430    let local_var_client = &local_var_configuration.client;
431
432    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/dependabot/secrets/{secret_name}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), secret_name=crate::apis::urlencode(secret_name));
433    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
434
435    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
436        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
437    }
438
439    let local_var_req = local_var_req_builder.build()?;
440    let local_var_resp = local_var_client.execute(local_var_req).await?;
441
442    let local_var_status = local_var_resp.status();
443    let local_var_content = local_var_resp.text().await?;
444
445    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
446        serde_json::from_str(&local_var_content).map_err(Error::from)
447    } else {
448        let local_var_entity: Option<DependabotSlashGetRepoSecretError> = serde_json::from_str(&local_var_content).ok();
449        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
450        Err(Error::ResponseError(local_var_error))
451    }
452}
453
454/// Lists Dependabot alerts for repositories that are owned by the specified enterprise.  The authenticated user must be a member of the enterprise to use this endpoint.  Alerts are only returned for organizations in the enterprise for which you are an organization owner or a security manager. For more information about security managers, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"  OAuth app tokens and personal access tokens (classic) need the `repo` or `security_events` scope to use this endpoint.
455pub async fn dependabot_slash_list_alerts_for_enterprise(configuration: &configuration::Configuration, enterprise: &str, state: Option<&str>, severity: Option<&str>, ecosystem: Option<&str>, package: Option<&str>, scope: Option<&str>, sort: Option<&str>, direction: Option<&str>, before: Option<&str>, after: Option<&str>, first: Option<i32>, last: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::DependabotAlertWithRepository>, Error<DependabotSlashListAlertsForEnterpriseError>> {
456    let local_var_configuration = configuration;
457
458    let local_var_client = &local_var_configuration.client;
459
460    let local_var_uri_str = format!("{}/enterprises/{enterprise}/dependabot/alerts", local_var_configuration.base_path, enterprise=crate::apis::urlencode(enterprise));
461    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
462
463    if let Some(ref local_var_str) = state {
464        local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]);
465    }
466    if let Some(ref local_var_str) = severity {
467        local_var_req_builder = local_var_req_builder.query(&[("severity", &local_var_str.to_string())]);
468    }
469    if let Some(ref local_var_str) = ecosystem {
470        local_var_req_builder = local_var_req_builder.query(&[("ecosystem", &local_var_str.to_string())]);
471    }
472    if let Some(ref local_var_str) = package {
473        local_var_req_builder = local_var_req_builder.query(&[("package", &local_var_str.to_string())]);
474    }
475    if let Some(ref local_var_str) = scope {
476        local_var_req_builder = local_var_req_builder.query(&[("scope", &local_var_str.to_string())]);
477    }
478    if let Some(ref local_var_str) = sort {
479        local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
480    }
481    if let Some(ref local_var_str) = direction {
482        local_var_req_builder = local_var_req_builder.query(&[("direction", &local_var_str.to_string())]);
483    }
484    if let Some(ref local_var_str) = before {
485        local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
486    }
487    if let Some(ref local_var_str) = after {
488        local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
489    }
490    if let Some(ref local_var_str) = first {
491        local_var_req_builder = local_var_req_builder.query(&[("first", &local_var_str.to_string())]);
492    }
493    if let Some(ref local_var_str) = last {
494        local_var_req_builder = local_var_req_builder.query(&[("last", &local_var_str.to_string())]);
495    }
496    if let Some(ref local_var_str) = per_page {
497        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
498    }
499    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
500        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
501    }
502
503    let local_var_req = local_var_req_builder.build()?;
504    let local_var_resp = local_var_client.execute(local_var_req).await?;
505
506    let local_var_status = local_var_resp.status();
507    let local_var_content = local_var_resp.text().await?;
508
509    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
510        serde_json::from_str(&local_var_content).map_err(Error::from)
511    } else {
512        let local_var_entity: Option<DependabotSlashListAlertsForEnterpriseError> = serde_json::from_str(&local_var_content).ok();
513        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
514        Err(Error::ResponseError(local_var_error))
515    }
516}
517
518/// Lists Dependabot alerts for an organization.  The authenticated user must be an owner or security manager for the organization to use this endpoint.  OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead.
519pub async fn dependabot_slash_list_alerts_for_org(configuration: &configuration::Configuration, org: &str, state: Option<&str>, severity: Option<&str>, ecosystem: Option<&str>, package: Option<&str>, scope: Option<&str>, sort: Option<&str>, direction: Option<&str>, before: Option<&str>, after: Option<&str>, first: Option<i32>, last: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::DependabotAlertWithRepository>, Error<DependabotSlashListAlertsForOrgError>> {
520    let local_var_configuration = configuration;
521
522    let local_var_client = &local_var_configuration.client;
523
524    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/alerts", local_var_configuration.base_path, org=crate::apis::urlencode(org));
525    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
526
527    if let Some(ref local_var_str) = state {
528        local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]);
529    }
530    if let Some(ref local_var_str) = severity {
531        local_var_req_builder = local_var_req_builder.query(&[("severity", &local_var_str.to_string())]);
532    }
533    if let Some(ref local_var_str) = ecosystem {
534        local_var_req_builder = local_var_req_builder.query(&[("ecosystem", &local_var_str.to_string())]);
535    }
536    if let Some(ref local_var_str) = package {
537        local_var_req_builder = local_var_req_builder.query(&[("package", &local_var_str.to_string())]);
538    }
539    if let Some(ref local_var_str) = scope {
540        local_var_req_builder = local_var_req_builder.query(&[("scope", &local_var_str.to_string())]);
541    }
542    if let Some(ref local_var_str) = sort {
543        local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
544    }
545    if let Some(ref local_var_str) = direction {
546        local_var_req_builder = local_var_req_builder.query(&[("direction", &local_var_str.to_string())]);
547    }
548    if let Some(ref local_var_str) = before {
549        local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
550    }
551    if let Some(ref local_var_str) = after {
552        local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
553    }
554    if let Some(ref local_var_str) = first {
555        local_var_req_builder = local_var_req_builder.query(&[("first", &local_var_str.to_string())]);
556    }
557    if let Some(ref local_var_str) = last {
558        local_var_req_builder = local_var_req_builder.query(&[("last", &local_var_str.to_string())]);
559    }
560    if let Some(ref local_var_str) = per_page {
561        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
562    }
563    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
564        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
565    }
566
567    let local_var_req = local_var_req_builder.build()?;
568    let local_var_resp = local_var_client.execute(local_var_req).await?;
569
570    let local_var_status = local_var_resp.status();
571    let local_var_content = local_var_resp.text().await?;
572
573    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
574        serde_json::from_str(&local_var_content).map_err(Error::from)
575    } else {
576        let local_var_entity: Option<DependabotSlashListAlertsForOrgError> = serde_json::from_str(&local_var_content).ok();
577        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
578        Err(Error::ResponseError(local_var_error))
579    }
580}
581
582/// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead.
583pub async fn dependabot_slash_list_alerts_for_repo(configuration: &configuration::Configuration, owner: &str, repo: &str, state: Option<&str>, severity: Option<&str>, ecosystem: Option<&str>, package: Option<&str>, manifest: Option<&str>, scope: Option<&str>, sort: Option<&str>, direction: Option<&str>, page: Option<i32>, per_page: Option<i32>, before: Option<&str>, after: Option<&str>, first: Option<i32>, last: Option<i32>) -> Result<Vec<models::DependabotAlert>, Error<DependabotSlashListAlertsForRepoError>> {
584    let local_var_configuration = configuration;
585
586    let local_var_client = &local_var_configuration.client;
587
588    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/dependabot/alerts", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
589    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
590
591    if let Some(ref local_var_str) = state {
592        local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]);
593    }
594    if let Some(ref local_var_str) = severity {
595        local_var_req_builder = local_var_req_builder.query(&[("severity", &local_var_str.to_string())]);
596    }
597    if let Some(ref local_var_str) = ecosystem {
598        local_var_req_builder = local_var_req_builder.query(&[("ecosystem", &local_var_str.to_string())]);
599    }
600    if let Some(ref local_var_str) = package {
601        local_var_req_builder = local_var_req_builder.query(&[("package", &local_var_str.to_string())]);
602    }
603    if let Some(ref local_var_str) = manifest {
604        local_var_req_builder = local_var_req_builder.query(&[("manifest", &local_var_str.to_string())]);
605    }
606    if let Some(ref local_var_str) = scope {
607        local_var_req_builder = local_var_req_builder.query(&[("scope", &local_var_str.to_string())]);
608    }
609    if let Some(ref local_var_str) = sort {
610        local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
611    }
612    if let Some(ref local_var_str) = direction {
613        local_var_req_builder = local_var_req_builder.query(&[("direction", &local_var_str.to_string())]);
614    }
615    if let Some(ref local_var_str) = page {
616        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
617    }
618    if let Some(ref local_var_str) = per_page {
619        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
620    }
621    if let Some(ref local_var_str) = before {
622        local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
623    }
624    if let Some(ref local_var_str) = after {
625        local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
626    }
627    if let Some(ref local_var_str) = first {
628        local_var_req_builder = local_var_req_builder.query(&[("first", &local_var_str.to_string())]);
629    }
630    if let Some(ref local_var_str) = last {
631        local_var_req_builder = local_var_req_builder.query(&[("last", &local_var_str.to_string())]);
632    }
633    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
634        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
635    }
636
637    let local_var_req = local_var_req_builder.build()?;
638    let local_var_resp = local_var_client.execute(local_var_req).await?;
639
640    let local_var_status = local_var_resp.status();
641    let local_var_content = local_var_resp.text().await?;
642
643    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
644        serde_json::from_str(&local_var_content).map_err(Error::from)
645    } else {
646        let local_var_entity: Option<DependabotSlashListAlertsForRepoError> = serde_json::from_str(&local_var_content).ok();
647        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
648        Err(Error::ResponseError(local_var_error))
649    }
650}
651
652/// Lists all secrets available in an organization without revealing their encrypted values.  OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
653pub async fn dependabot_slash_list_org_secrets(configuration: &configuration::Configuration, org: &str, per_page: Option<i32>, page: Option<i32>) -> Result<models::DependabotListOrgSecrets200Response, Error<DependabotSlashListOrgSecretsError>> {
654    let local_var_configuration = configuration;
655
656    let local_var_client = &local_var_configuration.client;
657
658    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/secrets", local_var_configuration.base_path, org=crate::apis::urlencode(org));
659    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
660
661    if let Some(ref local_var_str) = per_page {
662        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
663    }
664    if let Some(ref local_var_str) = page {
665        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
666    }
667    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
668        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
669    }
670
671    let local_var_req = local_var_req_builder.build()?;
672    let local_var_resp = local_var_client.execute(local_var_req).await?;
673
674    let local_var_status = local_var_resp.status();
675    let local_var_content = local_var_resp.text().await?;
676
677    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
678        serde_json::from_str(&local_var_content).map_err(Error::from)
679    } else {
680        let local_var_entity: Option<DependabotSlashListOrgSecretsError> = serde_json::from_str(&local_var_content).ok();
681        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
682        Err(Error::ResponseError(local_var_error))
683    }
684}
685
686/// Lists all secrets available in a repository without revealing their encrypted values.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
687pub async fn dependabot_slash_list_repo_secrets(configuration: &configuration::Configuration, owner: &str, repo: &str, per_page: Option<i32>, page: Option<i32>) -> Result<models::DependabotListRepoSecrets200Response, Error<DependabotSlashListRepoSecretsError>> {
688    let local_var_configuration = configuration;
689
690    let local_var_client = &local_var_configuration.client;
691
692    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/dependabot/secrets", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
693    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
694
695    if let Some(ref local_var_str) = per_page {
696        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
697    }
698    if let Some(ref local_var_str) = page {
699        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
700    }
701    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
702        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
703    }
704
705    let local_var_req = local_var_req_builder.build()?;
706    let local_var_resp = local_var_client.execute(local_var_req).await?;
707
708    let local_var_status = local_var_resp.status();
709    let local_var_content = local_var_resp.text().await?;
710
711    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
712        serde_json::from_str(&local_var_content).map_err(Error::from)
713    } else {
714        let local_var_entity: Option<DependabotSlashListRepoSecretsError> = serde_json::from_str(&local_var_content).ok();
715        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
716        Err(Error::ResponseError(local_var_error))
717    }
718}
719
720/// Lists all repositories that have been selected when the `visibility` for repository access to a secret is set to `selected`.  OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
721pub async fn dependabot_slash_list_selected_repos_for_org_secret(configuration: &configuration::Configuration, org: &str, secret_name: &str, page: Option<i32>, per_page: Option<i32>) -> Result<models::ActionsListSelectedReposForOrgSecret200Response, Error<DependabotSlashListSelectedReposForOrgSecretError>> {
722    let local_var_configuration = configuration;
723
724    let local_var_client = &local_var_configuration.client;
725
726    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/secrets/{secret_name}/repositories", local_var_configuration.base_path, org=crate::apis::urlencode(org), secret_name=crate::apis::urlencode(secret_name));
727    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
728
729    if let Some(ref local_var_str) = page {
730        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
731    }
732    if let Some(ref local_var_str) = per_page {
733        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
734    }
735    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
736        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
737    }
738
739    let local_var_req = local_var_req_builder.build()?;
740    let local_var_resp = local_var_client.execute(local_var_req).await?;
741
742    let local_var_status = local_var_resp.status();
743    let local_var_content = local_var_resp.text().await?;
744
745    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
746        serde_json::from_str(&local_var_content).map_err(Error::from)
747    } else {
748        let local_var_entity: Option<DependabotSlashListSelectedReposForOrgSecretError> = serde_json::from_str(&local_var_content).ok();
749        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
750        Err(Error::ResponseError(local_var_error))
751    }
752}
753
754/// Removes a repository from an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret).  OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
755pub async fn dependabot_slash_remove_selected_repo_from_org_secret(configuration: &configuration::Configuration, org: &str, secret_name: &str, repository_id: i32) -> Result<(), Error<DependabotSlashRemoveSelectedRepoFromOrgSecretError>> {
756    let local_var_configuration = configuration;
757
758    let local_var_client = &local_var_configuration.client;
759
760    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), secret_name=crate::apis::urlencode(secret_name), repository_id=repository_id);
761    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
762
763    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
764        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
765    }
766
767    let local_var_req = local_var_req_builder.build()?;
768    let local_var_resp = local_var_client.execute(local_var_req).await?;
769
770    let local_var_status = local_var_resp.status();
771    let local_var_content = local_var_resp.text().await?;
772
773    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
774        Ok(())
775    } else {
776        let local_var_entity: Option<DependabotSlashRemoveSelectedRepoFromOrgSecretError> = serde_json::from_str(&local_var_content).ok();
777        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
778        Err(Error::ResponseError(local_var_error))
779    }
780}
781
782/// Replaces all repositories for an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret).  OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.
783pub async fn dependabot_slash_set_selected_repos_for_org_secret(configuration: &configuration::Configuration, org: &str, secret_name: &str, dependabot_set_selected_repos_for_org_secret_request: models::DependabotSetSelectedReposForOrgSecretRequest) -> Result<(), Error<DependabotSlashSetSelectedReposForOrgSecretError>> {
784    let local_var_configuration = configuration;
785
786    let local_var_client = &local_var_configuration.client;
787
788    let local_var_uri_str = format!("{}/orgs/{org}/dependabot/secrets/{secret_name}/repositories", local_var_configuration.base_path, org=crate::apis::urlencode(org), secret_name=crate::apis::urlencode(secret_name));
789    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
790
791    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
792        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
793    }
794    local_var_req_builder = local_var_req_builder.json(&dependabot_set_selected_repos_for_org_secret_request);
795
796    let local_var_req = local_var_req_builder.build()?;
797    let local_var_resp = local_var_client.execute(local_var_req).await?;
798
799    let local_var_status = local_var_resp.status();
800    let local_var_content = local_var_resp.text().await?;
801
802    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
803        Ok(())
804    } else {
805        let local_var_entity: Option<DependabotSlashSetSelectedReposForOrgSecretError> = serde_json::from_str(&local_var_content).ok();
806        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
807        Err(Error::ResponseError(local_var_error))
808    }
809}
810
811/// The authenticated user must have access to security alerts for the repository to use this endpoint. For more information, see \"[Granting access to security alerts](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository#granting-access-to-security-alerts).\"  OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead.
812pub async fn dependabot_slash_update_alert(configuration: &configuration::Configuration, owner: &str, repo: &str, alert_number: i32, dependabot_update_alert_request: models::DependabotUpdateAlertRequest) -> Result<models::DependabotAlert, Error<DependabotSlashUpdateAlertError>> {
813    let local_var_configuration = configuration;
814
815    let local_var_client = &local_var_configuration.client;
816
817    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/dependabot/alerts/{alert_number}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), alert_number=alert_number);
818    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
819
820    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
821        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
822    }
823    local_var_req_builder = local_var_req_builder.json(&dependabot_update_alert_request);
824
825    let local_var_req = local_var_req_builder.build()?;
826    let local_var_resp = local_var_client.execute(local_var_req).await?;
827
828    let local_var_status = local_var_resp.status();
829    let local_var_content = local_var_resp.text().await?;
830
831    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
832        serde_json::from_str(&local_var_content).map_err(Error::from)
833    } else {
834        let local_var_entity: Option<DependabotSlashUpdateAlertError> = serde_json::from_str(&local_var_content).ok();
835        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
836        Err(Error::ResponseError(local_var_error))
837    }
838}
839