openapi_github/apis/
packages_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 [`packages_slash_delete_package_for_authenticated_user`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum PackagesSlashDeletePackageForAuthenticatedUserError {
22    Status401(models::BasicError),
23    Status403(models::BasicError),
24    Status404(models::BasicError),
25    UnknownValue(serde_json::Value),
26}
27
28/// struct for typed errors of method [`packages_slash_delete_package_for_org`]
29#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum PackagesSlashDeletePackageForOrgError {
32    Status401(models::BasicError),
33    Status403(models::BasicError),
34    Status404(models::BasicError),
35    UnknownValue(serde_json::Value),
36}
37
38/// struct for typed errors of method [`packages_slash_delete_package_for_user`]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum PackagesSlashDeletePackageForUserError {
42    Status401(models::BasicError),
43    Status403(models::BasicError),
44    Status404(models::BasicError),
45    UnknownValue(serde_json::Value),
46}
47
48/// struct for typed errors of method [`packages_slash_delete_package_version_for_authenticated_user`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum PackagesSlashDeletePackageVersionForAuthenticatedUserError {
52    Status401(models::BasicError),
53    Status403(models::BasicError),
54    Status404(models::BasicError),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`packages_slash_delete_package_version_for_org`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum PackagesSlashDeletePackageVersionForOrgError {
62    Status401(models::BasicError),
63    Status403(models::BasicError),
64    Status404(models::BasicError),
65    UnknownValue(serde_json::Value),
66}
67
68/// struct for typed errors of method [`packages_slash_delete_package_version_for_user`]
69#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum PackagesSlashDeletePackageVersionForUserError {
72    Status401(models::BasicError),
73    Status403(models::BasicError),
74    Status404(models::BasicError),
75    UnknownValue(serde_json::Value),
76}
77
78/// struct for typed errors of method [`packages_slash_get_all_package_versions_for_package_owned_by_authenticated_user`]
79#[derive(Debug, Clone, Serialize, Deserialize)]
80#[serde(untagged)]
81pub enum PackagesSlashGetAllPackageVersionsForPackageOwnedByAuthenticatedUserError {
82    Status401(models::BasicError),
83    Status403(models::BasicError),
84    Status404(models::BasicError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`packages_slash_get_all_package_versions_for_package_owned_by_org`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PackagesSlashGetAllPackageVersionsForPackageOwnedByOrgError {
92    Status401(models::BasicError),
93    Status403(models::BasicError),
94    Status404(models::BasicError),
95    UnknownValue(serde_json::Value),
96}
97
98/// struct for typed errors of method [`packages_slash_get_all_package_versions_for_package_owned_by_user`]
99#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum PackagesSlashGetAllPackageVersionsForPackageOwnedByUserError {
102    Status401(models::BasicError),
103    Status403(models::BasicError),
104    Status404(models::BasicError),
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`packages_slash_get_package_for_authenticated_user`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum PackagesSlashGetPackageForAuthenticatedUserError {
112    UnknownValue(serde_json::Value),
113}
114
115/// struct for typed errors of method [`packages_slash_get_package_for_organization`]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum PackagesSlashGetPackageForOrganizationError {
119    UnknownValue(serde_json::Value),
120}
121
122/// struct for typed errors of method [`packages_slash_get_package_for_user`]
123#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum PackagesSlashGetPackageForUserError {
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`packages_slash_get_package_version_for_authenticated_user`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum PackagesSlashGetPackageVersionForAuthenticatedUserError {
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`packages_slash_get_package_version_for_organization`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum PackagesSlashGetPackageVersionForOrganizationError {
140    UnknownValue(serde_json::Value),
141}
142
143/// struct for typed errors of method [`packages_slash_get_package_version_for_user`]
144#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum PackagesSlashGetPackageVersionForUserError {
147    UnknownValue(serde_json::Value),
148}
149
150/// struct for typed errors of method [`packages_slash_list_docker_migration_conflicting_packages_for_authenticated_user`]
151#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum PackagesSlashListDockerMigrationConflictingPackagesForAuthenticatedUserError {
154    UnknownValue(serde_json::Value),
155}
156
157/// struct for typed errors of method [`packages_slash_list_docker_migration_conflicting_packages_for_organization`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum PackagesSlashListDockerMigrationConflictingPackagesForOrganizationError {
161    Status401(models::BasicError),
162    Status403(models::BasicError),
163    UnknownValue(serde_json::Value),
164}
165
166/// struct for typed errors of method [`packages_slash_list_docker_migration_conflicting_packages_for_user`]
167#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum PackagesSlashListDockerMigrationConflictingPackagesForUserError {
170    Status401(models::BasicError),
171    Status403(models::BasicError),
172    UnknownValue(serde_json::Value),
173}
174
175/// struct for typed errors of method [`packages_slash_list_packages_for_authenticated_user`]
176#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum PackagesSlashListPackagesForAuthenticatedUserError {
179    Status400(),
180    UnknownValue(serde_json::Value),
181}
182
183/// struct for typed errors of method [`packages_slash_list_packages_for_organization`]
184#[derive(Debug, Clone, Serialize, Deserialize)]
185#[serde(untagged)]
186pub enum PackagesSlashListPackagesForOrganizationError {
187    Status400(),
188    Status401(models::BasicError),
189    Status403(models::BasicError),
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`packages_slash_list_packages_for_user`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum PackagesSlashListPackagesForUserError {
197    Status400(),
198    Status401(models::BasicError),
199    Status403(models::BasicError),
200    UnknownValue(serde_json::Value),
201}
202
203/// struct for typed errors of method [`packages_slash_restore_package_for_authenticated_user`]
204#[derive(Debug, Clone, Serialize, Deserialize)]
205#[serde(untagged)]
206pub enum PackagesSlashRestorePackageForAuthenticatedUserError {
207    Status401(models::BasicError),
208    Status403(models::BasicError),
209    Status404(models::BasicError),
210    UnknownValue(serde_json::Value),
211}
212
213/// struct for typed errors of method [`packages_slash_restore_package_for_org`]
214#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum PackagesSlashRestorePackageForOrgError {
217    Status401(models::BasicError),
218    Status403(models::BasicError),
219    Status404(models::BasicError),
220    UnknownValue(serde_json::Value),
221}
222
223/// struct for typed errors of method [`packages_slash_restore_package_for_user`]
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum PackagesSlashRestorePackageForUserError {
227    Status401(models::BasicError),
228    Status403(models::BasicError),
229    Status404(models::BasicError),
230    UnknownValue(serde_json::Value),
231}
232
233/// struct for typed errors of method [`packages_slash_restore_package_version_for_authenticated_user`]
234#[derive(Debug, Clone, Serialize, Deserialize)]
235#[serde(untagged)]
236pub enum PackagesSlashRestorePackageVersionForAuthenticatedUserError {
237    Status401(models::BasicError),
238    Status403(models::BasicError),
239    Status404(models::BasicError),
240    UnknownValue(serde_json::Value),
241}
242
243/// struct for typed errors of method [`packages_slash_restore_package_version_for_org`]
244#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum PackagesSlashRestorePackageVersionForOrgError {
247    Status401(models::BasicError),
248    Status403(models::BasicError),
249    Status404(models::BasicError),
250    UnknownValue(serde_json::Value),
251}
252
253/// struct for typed errors of method [`packages_slash_restore_package_version_for_user`]
254#[derive(Debug, Clone, Serialize, Deserialize)]
255#[serde(untagged)]
256pub enum PackagesSlashRestorePackageVersionForUserError {
257    Status401(models::BasicError),
258    Status403(models::BasicError),
259    Status404(models::BasicError),
260    UnknownValue(serde_json::Value),
261}
262
263
264/// Deletes a package owned by the authenticated user. You cannot delete a public package if any version of the package has more than 5,000 downloads. In this scenario, contact GitHub support for further assistance.  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `delete:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, `repo` scope is also required. For the list these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
265pub async fn packages_slash_delete_package_for_authenticated_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str) -> Result<(), Error<PackagesSlashDeletePackageForAuthenticatedUserError>> {
266    let local_var_configuration = configuration;
267
268    let local_var_client = &local_var_configuration.client;
269
270    let local_var_uri_str = format!("{}/user/packages/{package_type}/{package_name}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name));
271    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
272
273    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
274        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
275    }
276
277    let local_var_req = local_var_req_builder.build()?;
278    let local_var_resp = local_var_client.execute(local_var_req).await?;
279
280    let local_var_status = local_var_resp.status();
281    let local_var_content = local_var_resp.text().await?;
282
283    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
284        Ok(())
285    } else {
286        let local_var_entity: Option<PackagesSlashDeletePackageForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
287        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
288        Err(Error::ResponseError(local_var_error))
289    }
290}
291
292/// Deletes an entire package in an organization. You cannot delete a public package if any version of the package has more than 5,000 downloads. In this scenario, contact GitHub support for further assistance.  The authenticated user must have admin permissions in the organization to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must also have admin permissions to the package. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#granular-permissions-for-userorganization-scoped-packages).\"  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `delete:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
293pub async fn packages_slash_delete_package_for_org(configuration: &configuration::Configuration, package_type: &str, package_name: &str, org: &str) -> Result<(), Error<PackagesSlashDeletePackageForOrgError>> {
294    let local_var_configuration = configuration;
295
296    let local_var_client = &local_var_configuration.client;
297
298    let local_var_uri_str = format!("{}/orgs/{org}/packages/{package_type}/{package_name}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), org=crate::apis::urlencode(org));
299    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
300
301    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
302        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
303    }
304
305    let local_var_req = local_var_req_builder.build()?;
306    let local_var_resp = local_var_client.execute(local_var_req).await?;
307
308    let local_var_status = local_var_resp.status();
309    let local_var_content = local_var_resp.text().await?;
310
311    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
312        Ok(())
313    } else {
314        let local_var_entity: Option<PackagesSlashDeletePackageForOrgError> = serde_json::from_str(&local_var_content).ok();
315        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
316        Err(Error::ResponseError(local_var_error))
317    }
318}
319
320/// Deletes an entire package for a user. You cannot delete a public package if any version of the package has more than 5,000 downloads. In this scenario, contact GitHub support for further assistance.  If the `package_type` belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#granular-permissions-for-userorganization-scoped-packages).\"  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `delete:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
321pub async fn packages_slash_delete_package_for_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, username: &str) -> Result<(), Error<PackagesSlashDeletePackageForUserError>> {
322    let local_var_configuration = configuration;
323
324    let local_var_client = &local_var_configuration.client;
325
326    let local_var_uri_str = format!("{}/users/{username}/packages/{package_type}/{package_name}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), username=crate::apis::urlencode(username));
327    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
328
329    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
330        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
331    }
332
333    let local_var_req = local_var_req_builder.build()?;
334    let local_var_resp = local_var_client.execute(local_var_req).await?;
335
336    let local_var_status = local_var_resp.status();
337    let local_var_content = local_var_resp.text().await?;
338
339    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
340        Ok(())
341    } else {
342        let local_var_entity: Option<PackagesSlashDeletePackageForUserError> = serde_json::from_str(&local_var_content).ok();
343        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
344        Err(Error::ResponseError(local_var_error))
345    }
346}
347
348/// Deletes a specific package version for a package owned by the authenticated user.  If the package is public and the package version has more than 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.  The authenticated user must have admin permissions in the organization to use this endpoint.  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `delete:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
349pub async fn packages_slash_delete_package_version_for_authenticated_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, package_version_id: i32) -> Result<(), Error<PackagesSlashDeletePackageVersionForAuthenticatedUserError>> {
350    let local_var_configuration = configuration;
351
352    let local_var_client = &local_var_configuration.client;
353
354    let local_var_uri_str = format!("{}/user/packages/{package_type}/{package_name}/versions/{package_version_id}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), package_version_id=package_version_id);
355    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
356
357    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
358        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
359    }
360
361    let local_var_req = local_var_req_builder.build()?;
362    let local_var_resp = local_var_client.execute(local_var_req).await?;
363
364    let local_var_status = local_var_resp.status();
365    let local_var_content = local_var_resp.text().await?;
366
367    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
368        Ok(())
369    } else {
370        let local_var_entity: Option<PackagesSlashDeletePackageVersionForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
371        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
372        Err(Error::ResponseError(local_var_error))
373    }
374}
375
376/// Deletes a specific package version in an organization. If the package is public and the package version has more than 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.  The authenticated user must have admin permissions in the organization to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must also have admin permissions to the package. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#granular-permissions-for-userorganization-scoped-packages).\"  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `delete:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
377pub async fn packages_slash_delete_package_version_for_org(configuration: &configuration::Configuration, package_type: &str, package_name: &str, org: &str, package_version_id: i32) -> Result<(), Error<PackagesSlashDeletePackageVersionForOrgError>> {
378    let local_var_configuration = configuration;
379
380    let local_var_client = &local_var_configuration.client;
381
382    let local_var_uri_str = format!("{}/orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), org=crate::apis::urlencode(org), package_version_id=package_version_id);
383    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
384
385    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
386        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
387    }
388
389    let local_var_req = local_var_req_builder.build()?;
390    let local_var_resp = local_var_client.execute(local_var_req).await?;
391
392    let local_var_status = local_var_resp.status();
393    let local_var_content = local_var_resp.text().await?;
394
395    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
396        Ok(())
397    } else {
398        let local_var_entity: Option<PackagesSlashDeletePackageVersionForOrgError> = serde_json::from_str(&local_var_content).ok();
399        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
400        Err(Error::ResponseError(local_var_error))
401    }
402}
403
404/// Deletes a specific package version for a user. If the package is public and the package version has more than 5,000 downloads, you cannot delete the package version. In this scenario, contact GitHub support for further assistance.  If the `package_type` belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#granular-permissions-for-userorganization-scoped-packages).\"  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `delete:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
405pub async fn packages_slash_delete_package_version_for_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, username: &str, package_version_id: i32) -> Result<(), Error<PackagesSlashDeletePackageVersionForUserError>> {
406    let local_var_configuration = configuration;
407
408    let local_var_client = &local_var_configuration.client;
409
410    let local_var_uri_str = format!("{}/users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), username=crate::apis::urlencode(username), package_version_id=package_version_id);
411    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
412
413    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
414        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
415    }
416
417    let local_var_req = local_var_req_builder.build()?;
418    let local_var_resp = local_var_client.execute(local_var_req).await?;
419
420    let local_var_status = local_var_resp.status();
421    let local_var_content = local_var_resp.text().await?;
422
423    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
424        Ok(())
425    } else {
426        let local_var_entity: Option<PackagesSlashDeletePackageVersionForUserError> = serde_json::from_str(&local_var_content).ok();
427        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
428        Err(Error::ResponseError(local_var_error))
429    }
430}
431
432/// Lists package versions for a package owned by the authenticated user.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
433pub async fn packages_slash_get_all_package_versions_for_package_owned_by_authenticated_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, page: Option<i32>, per_page: Option<i32>, state: Option<&str>) -> Result<Vec<models::PackageVersion>, Error<PackagesSlashGetAllPackageVersionsForPackageOwnedByAuthenticatedUserError>> {
434    let local_var_configuration = configuration;
435
436    let local_var_client = &local_var_configuration.client;
437
438    let local_var_uri_str = format!("{}/user/packages/{package_type}/{package_name}/versions", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name));
439    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
440
441    if let Some(ref local_var_str) = page {
442        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
443    }
444    if let Some(ref local_var_str) = per_page {
445        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
446    }
447    if let Some(ref local_var_str) = state {
448        local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]);
449    }
450    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
451        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
452    }
453
454    let local_var_req = local_var_req_builder.build()?;
455    let local_var_resp = local_var_client.execute(local_var_req).await?;
456
457    let local_var_status = local_var_resp.status();
458    let local_var_content = local_var_resp.text().await?;
459
460    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
461        serde_json::from_str(&local_var_content).map_err(Error::from)
462    } else {
463        let local_var_entity: Option<PackagesSlashGetAllPackageVersionsForPackageOwnedByAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
464        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
465        Err(Error::ResponseError(local_var_error))
466    }
467}
468
469/// Lists package versions for a package owned by an organization.  OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint if the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
470pub async fn packages_slash_get_all_package_versions_for_package_owned_by_org(configuration: &configuration::Configuration, package_type: &str, package_name: &str, org: &str, page: Option<i32>, per_page: Option<i32>, state: Option<&str>) -> Result<Vec<models::PackageVersion>, Error<PackagesSlashGetAllPackageVersionsForPackageOwnedByOrgError>> {
471    let local_var_configuration = configuration;
472
473    let local_var_client = &local_var_configuration.client;
474
475    let local_var_uri_str = format!("{}/orgs/{org}/packages/{package_type}/{package_name}/versions", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), org=crate::apis::urlencode(org));
476    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
477
478    if let Some(ref local_var_str) = page {
479        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
480    }
481    if let Some(ref local_var_str) = per_page {
482        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
483    }
484    if let Some(ref local_var_str) = state {
485        local_var_req_builder = local_var_req_builder.query(&[("state", &local_var_str.to_string())]);
486    }
487    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
488        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
489    }
490
491    let local_var_req = local_var_req_builder.build()?;
492    let local_var_resp = local_var_client.execute(local_var_req).await?;
493
494    let local_var_status = local_var_resp.status();
495    let local_var_content = local_var_resp.text().await?;
496
497    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
498        serde_json::from_str(&local_var_content).map_err(Error::from)
499    } else {
500        let local_var_entity: Option<PackagesSlashGetAllPackageVersionsForPackageOwnedByOrgError> = serde_json::from_str(&local_var_content).ok();
501        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
502        Err(Error::ResponseError(local_var_error))
503    }
504}
505
506/// Lists package versions for a public package owned by a specified user.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
507pub async fn packages_slash_get_all_package_versions_for_package_owned_by_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, username: &str) -> Result<Vec<models::PackageVersion>, Error<PackagesSlashGetAllPackageVersionsForPackageOwnedByUserError>> {
508    let local_var_configuration = configuration;
509
510    let local_var_client = &local_var_configuration.client;
511
512    let local_var_uri_str = format!("{}/users/{username}/packages/{package_type}/{package_name}/versions", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), username=crate::apis::urlencode(username));
513    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
514
515    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
516        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
517    }
518
519    let local_var_req = local_var_req_builder.build()?;
520    let local_var_resp = local_var_client.execute(local_var_req).await?;
521
522    let local_var_status = local_var_resp.status();
523    let local_var_content = local_var_resp.text().await?;
524
525    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
526        serde_json::from_str(&local_var_content).map_err(Error::from)
527    } else {
528        let local_var_entity: Option<PackagesSlashGetAllPackageVersionsForPackageOwnedByUserError> = serde_json::from_str(&local_var_content).ok();
529        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
530        Err(Error::ResponseError(local_var_error))
531    }
532}
533
534/// Gets a specific package for a package owned by the authenticated user.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
535pub async fn packages_slash_get_package_for_authenticated_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str) -> Result<models::Package, Error<PackagesSlashGetPackageForAuthenticatedUserError>> {
536    let local_var_configuration = configuration;
537
538    let local_var_client = &local_var_configuration.client;
539
540    let local_var_uri_str = format!("{}/user/packages/{package_type}/{package_name}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name));
541    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
542
543    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
544        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
545    }
546
547    let local_var_req = local_var_req_builder.build()?;
548    let local_var_resp = local_var_client.execute(local_var_req).await?;
549
550    let local_var_status = local_var_resp.status();
551    let local_var_content = local_var_resp.text().await?;
552
553    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
554        serde_json::from_str(&local_var_content).map_err(Error::from)
555    } else {
556        let local_var_entity: Option<PackagesSlashGetPackageForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
557        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
558        Err(Error::ResponseError(local_var_error))
559    }
560}
561
562/// Gets a specific package in an organization.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
563pub async fn packages_slash_get_package_for_organization(configuration: &configuration::Configuration, package_type: &str, package_name: &str, org: &str) -> Result<models::Package, Error<PackagesSlashGetPackageForOrganizationError>> {
564    let local_var_configuration = configuration;
565
566    let local_var_client = &local_var_configuration.client;
567
568    let local_var_uri_str = format!("{}/orgs/{org}/packages/{package_type}/{package_name}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), org=crate::apis::urlencode(org));
569    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
570
571    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
572        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
573    }
574
575    let local_var_req = local_var_req_builder.build()?;
576    let local_var_resp = local_var_client.execute(local_var_req).await?;
577
578    let local_var_status = local_var_resp.status();
579    let local_var_content = local_var_resp.text().await?;
580
581    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
582        serde_json::from_str(&local_var_content).map_err(Error::from)
583    } else {
584        let local_var_entity: Option<PackagesSlashGetPackageForOrganizationError> = serde_json::from_str(&local_var_content).ok();
585        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
586        Err(Error::ResponseError(local_var_error))
587    }
588}
589
590/// Gets a specific package metadata for a public package owned by a user.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
591pub async fn packages_slash_get_package_for_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, username: &str) -> Result<models::Package, Error<PackagesSlashGetPackageForUserError>> {
592    let local_var_configuration = configuration;
593
594    let local_var_client = &local_var_configuration.client;
595
596    let local_var_uri_str = format!("{}/users/{username}/packages/{package_type}/{package_name}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), username=crate::apis::urlencode(username));
597    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
598
599    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
600        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
601    }
602
603    let local_var_req = local_var_req_builder.build()?;
604    let local_var_resp = local_var_client.execute(local_var_req).await?;
605
606    let local_var_status = local_var_resp.status();
607    let local_var_content = local_var_resp.text().await?;
608
609    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
610        serde_json::from_str(&local_var_content).map_err(Error::from)
611    } else {
612        let local_var_entity: Option<PackagesSlashGetPackageForUserError> = serde_json::from_str(&local_var_content).ok();
613        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
614        Err(Error::ResponseError(local_var_error))
615    }
616}
617
618/// Gets a specific package version for a package owned by the authenticated user.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
619pub async fn packages_slash_get_package_version_for_authenticated_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, package_version_id: i32) -> Result<models::PackageVersion, Error<PackagesSlashGetPackageVersionForAuthenticatedUserError>> {
620    let local_var_configuration = configuration;
621
622    let local_var_client = &local_var_configuration.client;
623
624    let local_var_uri_str = format!("{}/user/packages/{package_type}/{package_name}/versions/{package_version_id}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), package_version_id=package_version_id);
625    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
626
627    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
628        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
629    }
630
631    let local_var_req = local_var_req_builder.build()?;
632    let local_var_resp = local_var_client.execute(local_var_req).await?;
633
634    let local_var_status = local_var_resp.status();
635    let local_var_content = local_var_resp.text().await?;
636
637    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
638        serde_json::from_str(&local_var_content).map_err(Error::from)
639    } else {
640        let local_var_entity: Option<PackagesSlashGetPackageVersionForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
641        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
642        Err(Error::ResponseError(local_var_error))
643    }
644}
645
646/// Gets a specific package version in an organization.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
647pub async fn packages_slash_get_package_version_for_organization(configuration: &configuration::Configuration, package_type: &str, package_name: &str, org: &str, package_version_id: i32) -> Result<models::PackageVersion, Error<PackagesSlashGetPackageVersionForOrganizationError>> {
648    let local_var_configuration = configuration;
649
650    let local_var_client = &local_var_configuration.client;
651
652    let local_var_uri_str = format!("{}/orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), org=crate::apis::urlencode(org), package_version_id=package_version_id);
653    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
654
655    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
656        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
657    }
658
659    let local_var_req = local_var_req_builder.build()?;
660    let local_var_resp = local_var_client.execute(local_var_req).await?;
661
662    let local_var_status = local_var_resp.status();
663    let local_var_content = local_var_resp.text().await?;
664
665    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
666        serde_json::from_str(&local_var_content).map_err(Error::from)
667    } else {
668        let local_var_entity: Option<PackagesSlashGetPackageVersionForOrganizationError> = serde_json::from_str(&local_var_content).ok();
669        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
670        Err(Error::ResponseError(local_var_error))
671    }
672}
673
674/// Gets a specific package version for a public package owned by a specified user.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
675pub async fn packages_slash_get_package_version_for_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, package_version_id: i32, username: &str) -> Result<models::PackageVersion, Error<PackagesSlashGetPackageVersionForUserError>> {
676    let local_var_configuration = configuration;
677
678    let local_var_client = &local_var_configuration.client;
679
680    let local_var_uri_str = format!("{}/users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), package_version_id=package_version_id, username=crate::apis::urlencode(username));
681    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
682
683    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
684        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
685    }
686
687    let local_var_req = local_var_req_builder.build()?;
688    let local_var_resp = local_var_client.execute(local_var_req).await?;
689
690    let local_var_status = local_var_resp.status();
691    let local_var_content = local_var_resp.text().await?;
692
693    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
694        serde_json::from_str(&local_var_content).map_err(Error::from)
695    } else {
696        let local_var_entity: Option<PackagesSlashGetPackageVersionForUserError> = serde_json::from_str(&local_var_content).ok();
697        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
698        Err(Error::ResponseError(local_var_error))
699    }
700}
701
702/// Lists all packages that are owned by the authenticated user within the user's namespace, and that encountered a conflict during a Docker migration.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint.
703pub async fn packages_slash_list_docker_migration_conflicting_packages_for_authenticated_user(configuration: &configuration::Configuration, ) -> Result<Vec<models::Package>, Error<PackagesSlashListDockerMigrationConflictingPackagesForAuthenticatedUserError>> {
704    let local_var_configuration = configuration;
705
706    let local_var_client = &local_var_configuration.client;
707
708    let local_var_uri_str = format!("{}/user/docker/conflicts", local_var_configuration.base_path);
709    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
710
711    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
712        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
713    }
714
715    let local_var_req = local_var_req_builder.build()?;
716    let local_var_resp = local_var_client.execute(local_var_req).await?;
717
718    let local_var_status = local_var_resp.status();
719    let local_var_content = local_var_resp.text().await?;
720
721    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
722        serde_json::from_str(&local_var_content).map_err(Error::from)
723    } else {
724        let local_var_entity: Option<PackagesSlashListDockerMigrationConflictingPackagesForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
725        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
726        Err(Error::ResponseError(local_var_error))
727    }
728}
729
730/// Lists all packages that are in a specific organization, are readable by the requesting user, and that encountered a conflict during a Docker migration.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint.
731pub async fn packages_slash_list_docker_migration_conflicting_packages_for_organization(configuration: &configuration::Configuration, org: &str) -> Result<Vec<models::Package>, Error<PackagesSlashListDockerMigrationConflictingPackagesForOrganizationError>> {
732    let local_var_configuration = configuration;
733
734    let local_var_client = &local_var_configuration.client;
735
736    let local_var_uri_str = format!("{}/orgs/{org}/docker/conflicts", local_var_configuration.base_path, org=crate::apis::urlencode(org));
737    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
738
739    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
740        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
741    }
742
743    let local_var_req = local_var_req_builder.build()?;
744    let local_var_resp = local_var_client.execute(local_var_req).await?;
745
746    let local_var_status = local_var_resp.status();
747    let local_var_content = local_var_resp.text().await?;
748
749    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
750        serde_json::from_str(&local_var_content).map_err(Error::from)
751    } else {
752        let local_var_entity: Option<PackagesSlashListDockerMigrationConflictingPackagesForOrganizationError> = serde_json::from_str(&local_var_content).ok();
753        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
754        Err(Error::ResponseError(local_var_error))
755    }
756}
757
758/// Lists all packages that are in a specific user's namespace, that the requesting user has access to, and that encountered a conflict during Docker migration.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint.
759pub async fn packages_slash_list_docker_migration_conflicting_packages_for_user(configuration: &configuration::Configuration, username: &str) -> Result<Vec<models::Package>, Error<PackagesSlashListDockerMigrationConflictingPackagesForUserError>> {
760    let local_var_configuration = configuration;
761
762    let local_var_client = &local_var_configuration.client;
763
764    let local_var_uri_str = format!("{}/users/{username}/docker/conflicts", local_var_configuration.base_path, username=crate::apis::urlencode(username));
765    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
766
767    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
768        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
769    }
770
771    let local_var_req = local_var_req_builder.build()?;
772    let local_var_resp = local_var_client.execute(local_var_req).await?;
773
774    let local_var_status = local_var_resp.status();
775    let local_var_content = local_var_resp.text().await?;
776
777    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
778        serde_json::from_str(&local_var_content).map_err(Error::from)
779    } else {
780        let local_var_entity: Option<PackagesSlashListDockerMigrationConflictingPackagesForUserError> = serde_json::from_str(&local_var_content).ok();
781        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
782        Err(Error::ResponseError(local_var_error))
783    }
784}
785
786/// Lists packages owned by the authenticated user within the user's namespace.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
787pub async fn packages_slash_list_packages_for_authenticated_user(configuration: &configuration::Configuration, package_type: &str, visibility: Option<&str>, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::Package>, Error<PackagesSlashListPackagesForAuthenticatedUserError>> {
788    let local_var_configuration = configuration;
789
790    let local_var_client = &local_var_configuration.client;
791
792    let local_var_uri_str = format!("{}/user/packages", local_var_configuration.base_path);
793    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
794
795    local_var_req_builder = local_var_req_builder.query(&[("package_type", &package_type.to_string())]);
796    if let Some(ref local_var_str) = visibility {
797        local_var_req_builder = local_var_req_builder.query(&[("visibility", &local_var_str.to_string())]);
798    }
799    if let Some(ref local_var_str) = page {
800        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
801    }
802    if let Some(ref local_var_str) = per_page {
803        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
804    }
805    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
806        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
807    }
808
809    let local_var_req = local_var_req_builder.build()?;
810    let local_var_resp = local_var_client.execute(local_var_req).await?;
811
812    let local_var_status = local_var_resp.status();
813    let local_var_content = local_var_resp.text().await?;
814
815    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
816        serde_json::from_str(&local_var_content).map_err(Error::from)
817    } else {
818        let local_var_entity: Option<PackagesSlashListPackagesForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
819        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
820        Err(Error::ResponseError(local_var_error))
821    }
822}
823
824/// Lists packages in an organization readable by the user.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
825pub async fn packages_slash_list_packages_for_organization(configuration: &configuration::Configuration, package_type: &str, org: &str, visibility: Option<&str>, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::Package>, Error<PackagesSlashListPackagesForOrganizationError>> {
826    let local_var_configuration = configuration;
827
828    let local_var_client = &local_var_configuration.client;
829
830    let local_var_uri_str = format!("{}/orgs/{org}/packages", local_var_configuration.base_path, org=crate::apis::urlencode(org));
831    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
832
833    local_var_req_builder = local_var_req_builder.query(&[("package_type", &package_type.to_string())]);
834    if let Some(ref local_var_str) = visibility {
835        local_var_req_builder = local_var_req_builder.query(&[("visibility", &local_var_str.to_string())]);
836    }
837    if let Some(ref local_var_str) = page {
838        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
839    }
840    if let Some(ref local_var_str) = per_page {
841        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
842    }
843    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
844        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
845    }
846
847    let local_var_req = local_var_req_builder.build()?;
848    let local_var_resp = local_var_client.execute(local_var_req).await?;
849
850    let local_var_status = local_var_resp.status();
851    let local_var_content = local_var_resp.text().await?;
852
853    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
854        serde_json::from_str(&local_var_content).map_err(Error::from)
855    } else {
856        let local_var_entity: Option<PackagesSlashListPackagesForOrganizationError> = serde_json::from_str(&local_var_content).ok();
857        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
858        Err(Error::ResponseError(local_var_error))
859    }
860}
861
862/// Lists all packages in a user's namespace for which the requesting user has access.  OAuth app tokens and personal access tokens (classic) need the `read:packages` scope to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
863pub async fn packages_slash_list_packages_for_user(configuration: &configuration::Configuration, package_type: &str, username: &str, visibility: Option<&str>, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::Package>, Error<PackagesSlashListPackagesForUserError>> {
864    let local_var_configuration = configuration;
865
866    let local_var_client = &local_var_configuration.client;
867
868    let local_var_uri_str = format!("{}/users/{username}/packages", local_var_configuration.base_path, username=crate::apis::urlencode(username));
869    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
870
871    local_var_req_builder = local_var_req_builder.query(&[("package_type", &package_type.to_string())]);
872    if let Some(ref local_var_str) = visibility {
873        local_var_req_builder = local_var_req_builder.query(&[("visibility", &local_var_str.to_string())]);
874    }
875    if let Some(ref local_var_str) = page {
876        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
877    }
878    if let Some(ref local_var_str) = per_page {
879        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
880    }
881    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
882        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
883    }
884
885    let local_var_req = local_var_req_builder.build()?;
886    let local_var_resp = local_var_client.execute(local_var_req).await?;
887
888    let local_var_status = local_var_resp.status();
889    let local_var_content = local_var_resp.text().await?;
890
891    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
892        serde_json::from_str(&local_var_content).map_err(Error::from)
893    } else {
894        let local_var_entity: Option<PackagesSlashListPackagesForUserError> = serde_json::from_str(&local_var_content).ok();
895        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
896        Err(Error::ResponseError(local_var_error))
897    }
898}
899
900/// Restores a package owned by the authenticated user.  You can restore a deleted package under the following conditions:   - The package was deleted within the last 30 days.   - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `write:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
901pub async fn packages_slash_restore_package_for_authenticated_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, token: Option<&str>) -> Result<(), Error<PackagesSlashRestorePackageForAuthenticatedUserError>> {
902    let local_var_configuration = configuration;
903
904    let local_var_client = &local_var_configuration.client;
905
906    let local_var_uri_str = format!("{}/user/packages/{package_type}/{package_name}/restore", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name));
907    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
908
909    if let Some(ref local_var_str) = token {
910        local_var_req_builder = local_var_req_builder.query(&[("token", &local_var_str.to_string())]);
911    }
912    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
913        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
914    }
915
916    let local_var_req = local_var_req_builder.build()?;
917    let local_var_resp = local_var_client.execute(local_var_req).await?;
918
919    let local_var_status = local_var_resp.status();
920    let local_var_content = local_var_resp.text().await?;
921
922    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
923        Ok(())
924    } else {
925        let local_var_entity: Option<PackagesSlashRestorePackageForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
926        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
927        Err(Error::ResponseError(local_var_error))
928    }
929}
930
931/// Restores an entire package in an organization.  You can restore a deleted package under the following conditions:   - The package was deleted within the last 30 days.   - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.  The authenticated user must have admin permissions in the organization to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must also have admin permissions to the package. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#granular-permissions-for-userorganization-scoped-packages).\"  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `write:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
932pub async fn packages_slash_restore_package_for_org(configuration: &configuration::Configuration, package_type: &str, package_name: &str, org: &str, token: Option<&str>) -> Result<(), Error<PackagesSlashRestorePackageForOrgError>> {
933    let local_var_configuration = configuration;
934
935    let local_var_client = &local_var_configuration.client;
936
937    let local_var_uri_str = format!("{}/orgs/{org}/packages/{package_type}/{package_name}/restore", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), org=crate::apis::urlencode(org));
938    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
939
940    if let Some(ref local_var_str) = token {
941        local_var_req_builder = local_var_req_builder.query(&[("token", &local_var_str.to_string())]);
942    }
943    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
944        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
945    }
946
947    let local_var_req = local_var_req_builder.build()?;
948    let local_var_resp = local_var_client.execute(local_var_req).await?;
949
950    let local_var_status = local_var_resp.status();
951    let local_var_content = local_var_resp.text().await?;
952
953    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
954        Ok(())
955    } else {
956        let local_var_entity: Option<PackagesSlashRestorePackageForOrgError> = serde_json::from_str(&local_var_content).ok();
957        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
958        Err(Error::ResponseError(local_var_error))
959    }
960}
961
962/// Restores an entire package for a user.  You can restore a deleted package under the following conditions:   - The package was deleted within the last 30 days.   - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.  If the `package_type` belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#granular-permissions-for-userorganization-scoped-packages).\"  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `write:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
963pub async fn packages_slash_restore_package_for_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, username: &str, token: Option<&str>) -> Result<(), Error<PackagesSlashRestorePackageForUserError>> {
964    let local_var_configuration = configuration;
965
966    let local_var_client = &local_var_configuration.client;
967
968    let local_var_uri_str = format!("{}/users/{username}/packages/{package_type}/{package_name}/restore", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), username=crate::apis::urlencode(username));
969    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
970
971    if let Some(ref local_var_str) = token {
972        local_var_req_builder = local_var_req_builder.query(&[("token", &local_var_str.to_string())]);
973    }
974    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
975        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
976    }
977
978    let local_var_req = local_var_req_builder.build()?;
979    let local_var_resp = local_var_client.execute(local_var_req).await?;
980
981    let local_var_status = local_var_resp.status();
982    let local_var_content = local_var_resp.text().await?;
983
984    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
985        Ok(())
986    } else {
987        let local_var_entity: Option<PackagesSlashRestorePackageForUserError> = serde_json::from_str(&local_var_content).ok();
988        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
989        Err(Error::ResponseError(local_var_error))
990    }
991}
992
993/// Restores a package version owned by the authenticated user.  You can restore a deleted package version under the following conditions:   - The package was deleted within the last 30 days.   - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `write:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
994pub async fn packages_slash_restore_package_version_for_authenticated_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, package_version_id: i32) -> Result<(), Error<PackagesSlashRestorePackageVersionForAuthenticatedUserError>> {
995    let local_var_configuration = configuration;
996
997    let local_var_client = &local_var_configuration.client;
998
999    let local_var_uri_str = format!("{}/user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), package_version_id=package_version_id);
1000    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1001
1002    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1003        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1004    }
1005
1006    let local_var_req = local_var_req_builder.build()?;
1007    let local_var_resp = local_var_client.execute(local_var_req).await?;
1008
1009    let local_var_status = local_var_resp.status();
1010    let local_var_content = local_var_resp.text().await?;
1011
1012    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1013        Ok(())
1014    } else {
1015        let local_var_entity: Option<PackagesSlashRestorePackageVersionForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
1016        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1017        Err(Error::ResponseError(local_var_error))
1018    }
1019}
1020
1021/// Restores a specific package version in an organization.  You can restore a deleted package under the following conditions:   - The package was deleted within the last 30 days.   - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.  The authenticated user must have admin permissions in the organization to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must also have admin permissions to the package. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#granular-permissions-for-userorganization-scoped-packages).\"  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `write:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
1022pub async fn packages_slash_restore_package_version_for_org(configuration: &configuration::Configuration, package_type: &str, package_name: &str, org: &str, package_version_id: i32) -> Result<(), Error<PackagesSlashRestorePackageVersionForOrgError>> {
1023    let local_var_configuration = configuration;
1024
1025    let local_var_client = &local_var_configuration.client;
1026
1027    let local_var_uri_str = format!("{}/orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), org=crate::apis::urlencode(org), package_version_id=package_version_id);
1028    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1029
1030    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1031        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1032    }
1033
1034    let local_var_req = local_var_req_builder.build()?;
1035    let local_var_resp = local_var_client.execute(local_var_req).await?;
1036
1037    let local_var_status = local_var_resp.status();
1038    let local_var_content = local_var_resp.text().await?;
1039
1040    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1041        Ok(())
1042    } else {
1043        let local_var_entity: Option<PackagesSlashRestorePackageVersionForOrgError> = serde_json::from_str(&local_var_content).ok();
1044        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1045        Err(Error::ResponseError(local_var_error))
1046    }
1047}
1048
1049/// Restores a specific package version for a user.  You can restore a deleted package under the following conditions:   - The package was deleted within the last 30 days.   - The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.  If the `package_type` belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#granular-permissions-for-userorganization-scoped-packages).\"  OAuth app tokens and personal access tokens (classic) need the `read:packages` and `write:packages` scopes to use this endpoint. If the `package_type` belongs to a GitHub Packages registry that only supports repository-scoped permissions, the `repo` scope is also required. For the list of these registries, see \"[About permissions for GitHub Packages](https://docs.github.com/packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"
1050pub async fn packages_slash_restore_package_version_for_user(configuration: &configuration::Configuration, package_type: &str, package_name: &str, username: &str, package_version_id: i32) -> Result<(), Error<PackagesSlashRestorePackageVersionForUserError>> {
1051    let local_var_configuration = configuration;
1052
1053    let local_var_client = &local_var_configuration.client;
1054
1055    let local_var_uri_str = format!("{}/users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore", local_var_configuration.base_path, package_type=crate::apis::urlencode(package_type), package_name=crate::apis::urlencode(package_name), username=crate::apis::urlencode(username), package_version_id=package_version_id);
1056    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1057
1058    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1059        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1060    }
1061
1062    let local_var_req = local_var_req_builder.build()?;
1063    let local_var_resp = local_var_client.execute(local_var_req).await?;
1064
1065    let local_var_status = local_var_resp.status();
1066    let local_var_content = local_var_resp.text().await?;
1067
1068    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1069        Ok(())
1070    } else {
1071        let local_var_entity: Option<PackagesSlashRestorePackageVersionForUserError> = serde_json::from_str(&local_var_content).ok();
1072        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1073        Err(Error::ResponseError(local_var_error))
1074    }
1075}
1076