openapi_github/apis/
migrations_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 [`migrations_slash_cancel_import`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum MigrationsSlashCancelImportError {
22    Status503(models::BasicError),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`migrations_slash_delete_archive_for_authenticated_user`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum MigrationsSlashDeleteArchiveForAuthenticatedUserError {
30    Status401(models::BasicError),
31    Status403(models::BasicError),
32    Status404(models::BasicError),
33    UnknownValue(serde_json::Value),
34}
35
36/// struct for typed errors of method [`migrations_slash_delete_archive_for_org`]
37#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum MigrationsSlashDeleteArchiveForOrgError {
40    Status404(models::BasicError),
41    UnknownValue(serde_json::Value),
42}
43
44/// struct for typed errors of method [`migrations_slash_download_archive_for_org`]
45#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum MigrationsSlashDownloadArchiveForOrgError {
48    Status404(models::BasicError),
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`migrations_slash_get_archive_for_authenticated_user`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum MigrationsSlashGetArchiveForAuthenticatedUserError {
56    Status401(models::BasicError),
57    Status403(models::BasicError),
58    UnknownValue(serde_json::Value),
59}
60
61/// struct for typed errors of method [`migrations_slash_get_commit_authors`]
62#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum MigrationsSlashGetCommitAuthorsError {
65    Status404(models::BasicError),
66    Status503(models::BasicError),
67    UnknownValue(serde_json::Value),
68}
69
70/// struct for typed errors of method [`migrations_slash_get_import_status`]
71#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum MigrationsSlashGetImportStatusError {
74    Status404(models::BasicError),
75    Status503(models::BasicError),
76    UnknownValue(serde_json::Value),
77}
78
79/// struct for typed errors of method [`migrations_slash_get_large_files`]
80#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum MigrationsSlashGetLargeFilesError {
83    Status503(models::BasicError),
84    UnknownValue(serde_json::Value),
85}
86
87/// struct for typed errors of method [`migrations_slash_get_status_for_authenticated_user`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum MigrationsSlashGetStatusForAuthenticatedUserError {
91    Status401(models::BasicError),
92    Status403(models::BasicError),
93    Status404(models::BasicError),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`migrations_slash_get_status_for_org`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum MigrationsSlashGetStatusForOrgError {
101    Status404(models::BasicError),
102    UnknownValue(serde_json::Value),
103}
104
105/// struct for typed errors of method [`migrations_slash_list_for_authenticated_user`]
106#[derive(Debug, Clone, Serialize, Deserialize)]
107#[serde(untagged)]
108pub enum MigrationsSlashListForAuthenticatedUserError {
109    Status401(models::BasicError),
110    Status403(models::BasicError),
111    UnknownValue(serde_json::Value),
112}
113
114/// struct for typed errors of method [`migrations_slash_list_for_org`]
115#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum MigrationsSlashListForOrgError {
118    UnknownValue(serde_json::Value),
119}
120
121/// struct for typed errors of method [`migrations_slash_list_repos_for_authenticated_user`]
122#[derive(Debug, Clone, Serialize, Deserialize)]
123#[serde(untagged)]
124pub enum MigrationsSlashListReposForAuthenticatedUserError {
125    Status404(models::BasicError),
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`migrations_slash_list_repos_for_org`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum MigrationsSlashListReposForOrgError {
133    Status404(models::BasicError),
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`migrations_slash_map_commit_author`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum MigrationsSlashMapCommitAuthorError {
141    Status404(models::BasicError),
142    Status422(models::ValidationError),
143    Status503(models::BasicError),
144    UnknownValue(serde_json::Value),
145}
146
147/// struct for typed errors of method [`migrations_slash_set_lfs_preference`]
148#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum MigrationsSlashSetLfsPreferenceError {
151    Status422(models::ValidationError),
152    Status503(models::BasicError),
153    UnknownValue(serde_json::Value),
154}
155
156/// struct for typed errors of method [`migrations_slash_start_for_authenticated_user`]
157#[derive(Debug, Clone, Serialize, Deserialize)]
158#[serde(untagged)]
159pub enum MigrationsSlashStartForAuthenticatedUserError {
160    Status401(models::BasicError),
161    Status403(models::BasicError),
162    Status422(models::ValidationError),
163    UnknownValue(serde_json::Value),
164}
165
166/// struct for typed errors of method [`migrations_slash_start_for_org`]
167#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum MigrationsSlashStartForOrgError {
170    Status404(models::BasicError),
171    Status422(models::ValidationError),
172    UnknownValue(serde_json::Value),
173}
174
175/// struct for typed errors of method [`migrations_slash_start_import`]
176#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum MigrationsSlashStartImportError {
179    Status404(models::BasicError),
180    Status422(models::ValidationError),
181    Status503(models::BasicError),
182    UnknownValue(serde_json::Value),
183}
184
185/// struct for typed errors of method [`migrations_slash_unlock_repo_for_authenticated_user`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum MigrationsSlashUnlockRepoForAuthenticatedUserError {
189    Status401(models::BasicError),
190    Status403(models::BasicError),
191    Status404(models::BasicError),
192    UnknownValue(serde_json::Value),
193}
194
195/// struct for typed errors of method [`migrations_slash_unlock_repo_for_org`]
196#[derive(Debug, Clone, Serialize, Deserialize)]
197#[serde(untagged)]
198pub enum MigrationsSlashUnlockRepoForOrgError {
199    Status404(models::BasicError),
200    UnknownValue(serde_json::Value),
201}
202
203/// struct for typed errors of method [`migrations_slash_update_import`]
204#[derive(Debug, Clone, Serialize, Deserialize)]
205#[serde(untagged)]
206pub enum MigrationsSlashUpdateImportError {
207    Status503(models::BasicError),
208    UnknownValue(serde_json::Value),
209}
210
211
212/// Stop an import for a repository.  **Warning:** Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the [changelog](https://gh.io/source-imports-api-deprecation). 
213pub async fn migrations_slash_cancel_import(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<(), Error<MigrationsSlashCancelImportError>> {
214    let local_var_configuration = configuration;
215
216    let local_var_client = &local_var_configuration.client;
217
218    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/import", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
219    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
220
221    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
222        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
223    }
224
225    let local_var_req = local_var_req_builder.build()?;
226    let local_var_resp = local_var_client.execute(local_var_req).await?;
227
228    let local_var_status = local_var_resp.status();
229    let local_var_content = local_var_resp.text().await?;
230
231    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
232        Ok(())
233    } else {
234        let local_var_entity: Option<MigrationsSlashCancelImportError> = serde_json::from_str(&local_var_content).ok();
235        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
236        Err(Error::ResponseError(local_var_error))
237    }
238}
239
240/// Deletes a previous migration archive. Downloadable migration archives are automatically deleted after seven days. Migration metadata, which is returned in the [List user migrations](https://docs.github.com/rest/migrations/users#list-user-migrations) and [Get a user migration status](https://docs.github.com/rest/migrations/users#get-a-user-migration-status) endpoints, will continue to be available even after an archive is deleted.
241pub async fn migrations_slash_delete_archive_for_authenticated_user(configuration: &configuration::Configuration, migration_id: i32) -> Result<(), Error<MigrationsSlashDeleteArchiveForAuthenticatedUserError>> {
242    let local_var_configuration = configuration;
243
244    let local_var_client = &local_var_configuration.client;
245
246    let local_var_uri_str = format!("{}/user/migrations/{migration_id}/archive", local_var_configuration.base_path, migration_id=migration_id);
247    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
248
249    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
250        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
251    }
252
253    let local_var_req = local_var_req_builder.build()?;
254    let local_var_resp = local_var_client.execute(local_var_req).await?;
255
256    let local_var_status = local_var_resp.status();
257    let local_var_content = local_var_resp.text().await?;
258
259    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
260        Ok(())
261    } else {
262        let local_var_entity: Option<MigrationsSlashDeleteArchiveForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
263        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
264        Err(Error::ResponseError(local_var_error))
265    }
266}
267
268/// Deletes a previous migration archive. Migration archives are automatically deleted after seven days.
269pub async fn migrations_slash_delete_archive_for_org(configuration: &configuration::Configuration, org: &str, migration_id: i32) -> Result<(), Error<MigrationsSlashDeleteArchiveForOrgError>> {
270    let local_var_configuration = configuration;
271
272    let local_var_client = &local_var_configuration.client;
273
274    let local_var_uri_str = format!("{}/orgs/{org}/migrations/{migration_id}/archive", local_var_configuration.base_path, org=crate::apis::urlencode(org), migration_id=migration_id);
275    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
276
277    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
278        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
279    }
280
281    let local_var_req = local_var_req_builder.build()?;
282    let local_var_resp = local_var_client.execute(local_var_req).await?;
283
284    let local_var_status = local_var_resp.status();
285    let local_var_content = local_var_resp.text().await?;
286
287    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
288        Ok(())
289    } else {
290        let local_var_entity: Option<MigrationsSlashDeleteArchiveForOrgError> = serde_json::from_str(&local_var_content).ok();
291        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
292        Err(Error::ResponseError(local_var_error))
293    }
294}
295
296/// Fetches the URL to a migration archive.
297pub async fn migrations_slash_download_archive_for_org(configuration: &configuration::Configuration, org: &str, migration_id: i32) -> Result<(), Error<MigrationsSlashDownloadArchiveForOrgError>> {
298    let local_var_configuration = configuration;
299
300    let local_var_client = &local_var_configuration.client;
301
302    let local_var_uri_str = format!("{}/orgs/{org}/migrations/{migration_id}/archive", local_var_configuration.base_path, org=crate::apis::urlencode(org), migration_id=migration_id);
303    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
304
305    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
306        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
307    }
308
309    let local_var_req = local_var_req_builder.build()?;
310    let local_var_resp = local_var_client.execute(local_var_req).await?;
311
312    let local_var_status = local_var_resp.status();
313    let local_var_content = local_var_resp.text().await?;
314
315    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
316        Ok(())
317    } else {
318        let local_var_entity: Option<MigrationsSlashDownloadArchiveForOrgError> = serde_json::from_str(&local_var_content).ok();
319        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
320        Err(Error::ResponseError(local_var_error))
321    }
322}
323
324/// Fetches the URL to download the migration archive as a `tar.gz` file. Depending on the resources your repository uses, the migration archive can contain JSON files with data for these objects:  *   attachments *   bases *   commit\\_comments *   issue\\_comments *   issue\\_events *   issues *   milestones *   organizations *   projects *   protected\\_branches *   pull\\_request\\_reviews *   pull\\_requests *   releases *   repositories *   review\\_comments *   schema *   users  The archive will also contain an `attachments` directory that includes all attachment files uploaded to GitHub.com and a `repositories` directory that contains the repository's Git data.
325pub async fn migrations_slash_get_archive_for_authenticated_user(configuration: &configuration::Configuration, migration_id: i32) -> Result<(), Error<MigrationsSlashGetArchiveForAuthenticatedUserError>> {
326    let local_var_configuration = configuration;
327
328    let local_var_client = &local_var_configuration.client;
329
330    let local_var_uri_str = format!("{}/user/migrations/{migration_id}/archive", local_var_configuration.base_path, migration_id=migration_id);
331    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
332
333    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
334        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
335    }
336
337    let local_var_req = local_var_req_builder.build()?;
338    let local_var_resp = local_var_client.execute(local_var_req).await?;
339
340    let local_var_status = local_var_resp.status();
341    let local_var_content = local_var_resp.text().await?;
342
343    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
344        Ok(())
345    } else {
346        let local_var_entity: Option<MigrationsSlashGetArchiveForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
347        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
348        Err(Error::ResponseError(local_var_error))
349    }
350}
351
352/// Each type of source control system represents authors in a different way. For example, a Git commit author has a display name and an email address, but a Subversion commit author just has a username. The GitHub Importer will make the author information valid, but the author might not be correct. For example, it will change the bare Subversion username `hubot` into something like `hubot <hubot@12341234-abab-fefe-8787-fedcba987654>`.  This endpoint and the [Map a commit author](https://docs.github.com/rest/migrations/source-imports#map-a-commit-author) endpoint allow you to provide correct Git author information.  **Warning:** Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the [changelog](https://gh.io/source-imports-api-deprecation).
353pub async fn migrations_slash_get_commit_authors(configuration: &configuration::Configuration, owner: &str, repo: &str, since: Option<i32>) -> Result<Vec<models::PorterAuthor>, Error<MigrationsSlashGetCommitAuthorsError>> {
354    let local_var_configuration = configuration;
355
356    let local_var_client = &local_var_configuration.client;
357
358    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/import/authors", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
359    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
360
361    if let Some(ref local_var_str) = since {
362        local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]);
363    }
364    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
365        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
366    }
367
368    let local_var_req = local_var_req_builder.build()?;
369    let local_var_resp = local_var_client.execute(local_var_req).await?;
370
371    let local_var_status = local_var_resp.status();
372    let local_var_content = local_var_resp.text().await?;
373
374    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
375        serde_json::from_str(&local_var_content).map_err(Error::from)
376    } else {
377        let local_var_entity: Option<MigrationsSlashGetCommitAuthorsError> = serde_json::from_str(&local_var_content).ok();
378        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
379        Err(Error::ResponseError(local_var_error))
380    }
381}
382
383/// View the progress of an import.  **Warning:** Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the [changelog](https://gh.io/source-imports-api-deprecation).  **Import status**  This section includes details about the possible values of the `status` field of the Import Progress response.  An import that does not have errors will progress through these steps:  *   `detecting` - the \"detection\" step of the import is in progress because the request did not include a `vcs` parameter. The import is identifying the type of source control present at the URL. *   `importing` - the \"raw\" step of the import is in progress. This is where commit data is fetched from the original repository. The import progress response will include `commit_count` (the total number of raw commits that will be imported) and `percent` (0 - 100, the current progress through the import). *   `mapping` - the \"rewrite\" step of the import is in progress. This is where SVN branches are converted to Git branches, and where author updates are applied. The import progress response does not include progress information. *   `pushing` - the \"push\" step of the import is in progress. This is where the importer updates the repository on GitHub. The import progress response will include `push_percent`, which is the percent value reported by `git push` when it is \"Writing objects\". *   `complete` - the import is complete, and the repository is ready on GitHub.  If there are problems, you will see one of these in the `status` field:  *   `auth_failed` - the import requires authentication in order to connect to the original repository. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/migrations/source-imports#update-an-import) section. *   `error` - the import encountered an error. The import progress response will include the `failed_step` and an error message. Contact [GitHub Support](https://support.github.com/contact?tags=dotcom-rest-api) for more information. *   `detection_needs_auth` - the importer requires authentication for the originating repository to continue detection. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/migrations/source-imports#update-an-import) section. *   `detection_found_nothing` - the importer didn't recognize any source control at the URL. To resolve, [Cancel the import](https://docs.github.com/rest/migrations/source-imports#cancel-an-import) and [retry](https://docs.github.com/rest/migrations/source-imports#start-an-import) with the correct URL. *   `detection_found_multiple` - the importer found several projects or repositories at the provided URL. When this is the case, the Import Progress response will also include a `project_choices` field with the possible project choices as values. To update project choice, please see the [Update an import](https://docs.github.com/rest/migrations/source-imports#update-an-import) section.  **The project_choices field**  When multiple projects are found at the provided URL, the response hash will include a `project_choices` field, the value of which is an array of hashes each representing a project choice. The exact key/value pairs of the project hashes will differ depending on the version control type.  **Git LFS related fields**  This section includes details about Git LFS related fields that may be present in the Import Progress response.  *   `use_lfs` - describes whether the import has been opted in or out of using Git LFS. The value can be `opt_in`, `opt_out`, or `undecided` if no action has been taken. *   `has_large_files` - the boolean value describing whether files larger than 100MB were found during the `importing` step. *   `large_files_size` - the total size in gigabytes of files larger than 100MB found in the originating repository. *   `large_files_count` - the total number of files larger than 100MB found in the originating repository. To see a list of these files, make a \"Get Large Files\" request.
384pub async fn migrations_slash_get_import_status(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<models::Import, Error<MigrationsSlashGetImportStatusError>> {
385    let local_var_configuration = configuration;
386
387    let local_var_client = &local_var_configuration.client;
388
389    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/import", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
390    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
391
392    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
393        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
394    }
395
396    let local_var_req = local_var_req_builder.build()?;
397    let local_var_resp = local_var_client.execute(local_var_req).await?;
398
399    let local_var_status = local_var_resp.status();
400    let local_var_content = local_var_resp.text().await?;
401
402    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
403        serde_json::from_str(&local_var_content).map_err(Error::from)
404    } else {
405        let local_var_entity: Option<MigrationsSlashGetImportStatusError> = serde_json::from_str(&local_var_content).ok();
406        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
407        Err(Error::ResponseError(local_var_error))
408    }
409}
410
411/// List files larger than 100MB found during the import  **Warning:** Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the [changelog](https://gh.io/source-imports-api-deprecation). 
412pub async fn migrations_slash_get_large_files(configuration: &configuration::Configuration, owner: &str, repo: &str) -> Result<Vec<models::PorterLargeFile>, Error<MigrationsSlashGetLargeFilesError>> {
413    let local_var_configuration = configuration;
414
415    let local_var_client = &local_var_configuration.client;
416
417    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/import/large_files", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
418    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
419
420    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
421        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
422    }
423
424    let local_var_req = local_var_req_builder.build()?;
425    let local_var_resp = local_var_client.execute(local_var_req).await?;
426
427    let local_var_status = local_var_resp.status();
428    let local_var_content = local_var_resp.text().await?;
429
430    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
431        serde_json::from_str(&local_var_content).map_err(Error::from)
432    } else {
433        let local_var_entity: Option<MigrationsSlashGetLargeFilesError> = serde_json::from_str(&local_var_content).ok();
434        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
435        Err(Error::ResponseError(local_var_error))
436    }
437}
438
439/// Fetches a single user migration. The response includes the `state` of the migration, which can be one of the following values:  *   `pending` - the migration hasn't started yet. *   `exporting` - the migration is in progress. *   `exported` - the migration finished successfully. *   `failed` - the migration failed.  Once the migration has been `exported` you can [download the migration archive](https://docs.github.com/rest/migrations/users#download-a-user-migration-archive).
440pub async fn migrations_slash_get_status_for_authenticated_user(configuration: &configuration::Configuration, migration_id: i32, exclude: Option<Vec<String>>) -> Result<models::Migration, Error<MigrationsSlashGetStatusForAuthenticatedUserError>> {
441    let local_var_configuration = configuration;
442
443    let local_var_client = &local_var_configuration.client;
444
445    let local_var_uri_str = format!("{}/user/migrations/{migration_id}", local_var_configuration.base_path, migration_id=migration_id);
446    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
447
448    if let Some(ref local_var_str) = exclude {
449        local_var_req_builder = match "multi" {
450            "multi" => local_var_req_builder.query(&local_var_str.iter().map(|p| ("exclude".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
451            _ => local_var_req_builder.query(&[("exclude", &local_var_str.iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
452        };
453    }
454    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
455        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
456    }
457
458    let local_var_req = local_var_req_builder.build()?;
459    let local_var_resp = local_var_client.execute(local_var_req).await?;
460
461    let local_var_status = local_var_resp.status();
462    let local_var_content = local_var_resp.text().await?;
463
464    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
465        serde_json::from_str(&local_var_content).map_err(Error::from)
466    } else {
467        let local_var_entity: Option<MigrationsSlashGetStatusForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
468        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
469        Err(Error::ResponseError(local_var_error))
470    }
471}
472
473/// Fetches the status of a migration.  The `state` of a migration can be one of the following values:  *   `pending`, which means the migration hasn't started yet. *   `exporting`, which means the migration is in progress. *   `exported`, which means the migration finished successfully. *   `failed`, which means the migration failed.
474pub async fn migrations_slash_get_status_for_org(configuration: &configuration::Configuration, org: &str, migration_id: i32, exclude: Option<Vec<String>>) -> Result<models::Migration, Error<MigrationsSlashGetStatusForOrgError>> {
475    let local_var_configuration = configuration;
476
477    let local_var_client = &local_var_configuration.client;
478
479    let local_var_uri_str = format!("{}/orgs/{org}/migrations/{migration_id}", local_var_configuration.base_path, org=crate::apis::urlencode(org), migration_id=migration_id);
480    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
481
482    if let Some(ref local_var_str) = exclude {
483        local_var_req_builder = match "multi" {
484            "multi" => local_var_req_builder.query(&local_var_str.iter().map(|p| ("exclude".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
485            _ => local_var_req_builder.query(&[("exclude", &local_var_str.iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
486        };
487    }
488    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
489        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
490    }
491
492    let local_var_req = local_var_req_builder.build()?;
493    let local_var_resp = local_var_client.execute(local_var_req).await?;
494
495    let local_var_status = local_var_resp.status();
496    let local_var_content = local_var_resp.text().await?;
497
498    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
499        serde_json::from_str(&local_var_content).map_err(Error::from)
500    } else {
501        let local_var_entity: Option<MigrationsSlashGetStatusForOrgError> = serde_json::from_str(&local_var_content).ok();
502        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
503        Err(Error::ResponseError(local_var_error))
504    }
505}
506
507/// Lists all migrations a user has started.
508pub async fn migrations_slash_list_for_authenticated_user(configuration: &configuration::Configuration, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::Migration>, Error<MigrationsSlashListForAuthenticatedUserError>> {
509    let local_var_configuration = configuration;
510
511    let local_var_client = &local_var_configuration.client;
512
513    let local_var_uri_str = format!("{}/user/migrations", local_var_configuration.base_path);
514    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
515
516    if let Some(ref local_var_str) = per_page {
517        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
518    }
519    if let Some(ref local_var_str) = page {
520        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
521    }
522    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
523        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
524    }
525
526    let local_var_req = local_var_req_builder.build()?;
527    let local_var_resp = local_var_client.execute(local_var_req).await?;
528
529    let local_var_status = local_var_resp.status();
530    let local_var_content = local_var_resp.text().await?;
531
532    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
533        serde_json::from_str(&local_var_content).map_err(Error::from)
534    } else {
535        let local_var_entity: Option<MigrationsSlashListForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
536        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
537        Err(Error::ResponseError(local_var_error))
538    }
539}
540
541/// Lists the most recent migrations, including both exports (which can be started through the REST API) and imports (which cannot be started using the REST API).  A list of `repositories` is only returned for export migrations.
542pub async fn migrations_slash_list_for_org(configuration: &configuration::Configuration, org: &str, per_page: Option<i32>, page: Option<i32>, exclude: Option<Vec<String>>) -> Result<Vec<models::Migration>, Error<MigrationsSlashListForOrgError>> {
543    let local_var_configuration = configuration;
544
545    let local_var_client = &local_var_configuration.client;
546
547    let local_var_uri_str = format!("{}/orgs/{org}/migrations", local_var_configuration.base_path, org=crate::apis::urlencode(org));
548    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
549
550    if let Some(ref local_var_str) = per_page {
551        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
552    }
553    if let Some(ref local_var_str) = page {
554        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
555    }
556    if let Some(ref local_var_str) = exclude {
557        local_var_req_builder = match "multi" {
558            "multi" => local_var_req_builder.query(&local_var_str.iter().map(|p| ("exclude".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
559            _ => local_var_req_builder.query(&[("exclude", &local_var_str.iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
560        };
561    }
562    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
563        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
564    }
565
566    let local_var_req = local_var_req_builder.build()?;
567    let local_var_resp = local_var_client.execute(local_var_req).await?;
568
569    let local_var_status = local_var_resp.status();
570    let local_var_content = local_var_resp.text().await?;
571
572    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
573        serde_json::from_str(&local_var_content).map_err(Error::from)
574    } else {
575        let local_var_entity: Option<MigrationsSlashListForOrgError> = serde_json::from_str(&local_var_content).ok();
576        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
577        Err(Error::ResponseError(local_var_error))
578    }
579}
580
581/// Lists all the repositories for this user migration.
582pub async fn migrations_slash_list_repos_for_authenticated_user(configuration: &configuration::Configuration, migration_id: i32, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::MinimalRepository>, Error<MigrationsSlashListReposForAuthenticatedUserError>> {
583    let local_var_configuration = configuration;
584
585    let local_var_client = &local_var_configuration.client;
586
587    let local_var_uri_str = format!("{}/user/migrations/{migration_id}/repositories", local_var_configuration.base_path, migration_id=migration_id);
588    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
589
590    if let Some(ref local_var_str) = per_page {
591        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
592    }
593    if let Some(ref local_var_str) = page {
594        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
595    }
596    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
597        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
598    }
599
600    let local_var_req = local_var_req_builder.build()?;
601    let local_var_resp = local_var_client.execute(local_var_req).await?;
602
603    let local_var_status = local_var_resp.status();
604    let local_var_content = local_var_resp.text().await?;
605
606    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
607        serde_json::from_str(&local_var_content).map_err(Error::from)
608    } else {
609        let local_var_entity: Option<MigrationsSlashListReposForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
610        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
611        Err(Error::ResponseError(local_var_error))
612    }
613}
614
615/// List all the repositories for this organization migration.
616pub async fn migrations_slash_list_repos_for_org(configuration: &configuration::Configuration, org: &str, migration_id: i32, per_page: Option<i32>, page: Option<i32>) -> Result<Vec<models::MinimalRepository>, Error<MigrationsSlashListReposForOrgError>> {
617    let local_var_configuration = configuration;
618
619    let local_var_client = &local_var_configuration.client;
620
621    let local_var_uri_str = format!("{}/orgs/{org}/migrations/{migration_id}/repositories", local_var_configuration.base_path, org=crate::apis::urlencode(org), migration_id=migration_id);
622    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
623
624    if let Some(ref local_var_str) = per_page {
625        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
626    }
627    if let Some(ref local_var_str) = page {
628        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
629    }
630    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
631        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
632    }
633
634    let local_var_req = local_var_req_builder.build()?;
635    let local_var_resp = local_var_client.execute(local_var_req).await?;
636
637    let local_var_status = local_var_resp.status();
638    let local_var_content = local_var_resp.text().await?;
639
640    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
641        serde_json::from_str(&local_var_content).map_err(Error::from)
642    } else {
643        let local_var_entity: Option<MigrationsSlashListReposForOrgError> = serde_json::from_str(&local_var_content).ok();
644        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
645        Err(Error::ResponseError(local_var_error))
646    }
647}
648
649/// Update an author's identity for the import. Your application can continue updating authors any time before you push new commits to the repository.  **Warning:** Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the [changelog](https://gh.io/source-imports-api-deprecation). 
650pub async fn migrations_slash_map_commit_author(configuration: &configuration::Configuration, owner: &str, repo: &str, author_id: i32, migrations_map_commit_author_request: Option<models::MigrationsMapCommitAuthorRequest>) -> Result<models::PorterAuthor, Error<MigrationsSlashMapCommitAuthorError>> {
651    let local_var_configuration = configuration;
652
653    let local_var_client = &local_var_configuration.client;
654
655    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/import/authors/{author_id}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo), author_id=author_id);
656    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
657
658    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
659        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
660    }
661    local_var_req_builder = local_var_req_builder.json(&migrations_map_commit_author_request);
662
663    let local_var_req = local_var_req_builder.build()?;
664    let local_var_resp = local_var_client.execute(local_var_req).await?;
665
666    let local_var_status = local_var_resp.status();
667    let local_var_content = local_var_resp.text().await?;
668
669    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
670        serde_json::from_str(&local_var_content).map_err(Error::from)
671    } else {
672        let local_var_entity: Option<MigrationsSlashMapCommitAuthorError> = serde_json::from_str(&local_var_content).ok();
673        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
674        Err(Error::ResponseError(local_var_error))
675    }
676}
677
678/// You can import repositories from Subversion, Mercurial, and TFS that include files larger than 100MB. This ability is powered by [Git LFS](https://git-lfs.com).  You can learn more about our LFS feature and working with large files [on our help site](https://docs.github.com/repositories/working-with-files/managing-large-files).  **Warning:** Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the [changelog](https://gh.io/source-imports-api-deprecation). 
679pub async fn migrations_slash_set_lfs_preference(configuration: &configuration::Configuration, owner: &str, repo: &str, migrations_set_lfs_preference_request: models::MigrationsSetLfsPreferenceRequest) -> Result<models::Import, Error<MigrationsSlashSetLfsPreferenceError>> {
680    let local_var_configuration = configuration;
681
682    let local_var_client = &local_var_configuration.client;
683
684    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/import/lfs", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
685    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
686
687    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
688        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
689    }
690    local_var_req_builder = local_var_req_builder.json(&migrations_set_lfs_preference_request);
691
692    let local_var_req = local_var_req_builder.build()?;
693    let local_var_resp = local_var_client.execute(local_var_req).await?;
694
695    let local_var_status = local_var_resp.status();
696    let local_var_content = local_var_resp.text().await?;
697
698    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
699        serde_json::from_str(&local_var_content).map_err(Error::from)
700    } else {
701        let local_var_entity: Option<MigrationsSlashSetLfsPreferenceError> = serde_json::from_str(&local_var_content).ok();
702        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
703        Err(Error::ResponseError(local_var_error))
704    }
705}
706
707/// Initiates the generation of a user migration archive.
708pub async fn migrations_slash_start_for_authenticated_user(configuration: &configuration::Configuration, migrations_start_for_authenticated_user_request: models::MigrationsStartForAuthenticatedUserRequest) -> Result<models::Migration, Error<MigrationsSlashStartForAuthenticatedUserError>> {
709    let local_var_configuration = configuration;
710
711    let local_var_client = &local_var_configuration.client;
712
713    let local_var_uri_str = format!("{}/user/migrations", local_var_configuration.base_path);
714    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
715
716    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
717        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
718    }
719    local_var_req_builder = local_var_req_builder.json(&migrations_start_for_authenticated_user_request);
720
721    let local_var_req = local_var_req_builder.build()?;
722    let local_var_resp = local_var_client.execute(local_var_req).await?;
723
724    let local_var_status = local_var_resp.status();
725    let local_var_content = local_var_resp.text().await?;
726
727    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
728        serde_json::from_str(&local_var_content).map_err(Error::from)
729    } else {
730        let local_var_entity: Option<MigrationsSlashStartForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
731        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
732        Err(Error::ResponseError(local_var_error))
733    }
734}
735
736/// Initiates the generation of a migration archive.
737pub async fn migrations_slash_start_for_org(configuration: &configuration::Configuration, org: &str, migrations_start_for_org_request: models::MigrationsStartForOrgRequest) -> Result<models::Migration, Error<MigrationsSlashStartForOrgError>> {
738    let local_var_configuration = configuration;
739
740    let local_var_client = &local_var_configuration.client;
741
742    let local_var_uri_str = format!("{}/orgs/{org}/migrations", local_var_configuration.base_path, org=crate::apis::urlencode(org));
743    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
744
745    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
746        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
747    }
748    local_var_req_builder = local_var_req_builder.json(&migrations_start_for_org_request);
749
750    let local_var_req = local_var_req_builder.build()?;
751    let local_var_resp = local_var_client.execute(local_var_req).await?;
752
753    let local_var_status = local_var_resp.status();
754    let local_var_content = local_var_resp.text().await?;
755
756    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
757        serde_json::from_str(&local_var_content).map_err(Error::from)
758    } else {
759        let local_var_entity: Option<MigrationsSlashStartForOrgError> = serde_json::from_str(&local_var_content).ok();
760        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
761        Err(Error::ResponseError(local_var_error))
762    }
763}
764
765/// Start a source import to a GitHub repository using GitHub Importer. Importing into a GitHub repository with GitHub Actions enabled is not supported and will return a status `422 Unprocessable Entity` response.  **Warning:** Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the [changelog](https://gh.io/source-imports-api-deprecation). 
766pub async fn migrations_slash_start_import(configuration: &configuration::Configuration, owner: &str, repo: &str, migrations_start_import_request: models::MigrationsStartImportRequest) -> Result<models::Import, Error<MigrationsSlashStartImportError>> {
767    let local_var_configuration = configuration;
768
769    let local_var_client = &local_var_configuration.client;
770
771    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/import", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
772    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
773
774    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
775        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
776    }
777    local_var_req_builder = local_var_req_builder.json(&migrations_start_import_request);
778
779    let local_var_req = local_var_req_builder.build()?;
780    let local_var_resp = local_var_client.execute(local_var_req).await?;
781
782    let local_var_status = local_var_resp.status();
783    let local_var_content = local_var_resp.text().await?;
784
785    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
786        serde_json::from_str(&local_var_content).map_err(Error::from)
787    } else {
788        let local_var_entity: Option<MigrationsSlashStartImportError> = serde_json::from_str(&local_var_content).ok();
789        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
790        Err(Error::ResponseError(local_var_error))
791    }
792}
793
794/// Unlocks a repository. You can lock repositories when you [start a user migration](https://docs.github.com/rest/migrations/users#start-a-user-migration). Once the migration is complete you can unlock each repository to begin using it again or [delete the repository](https://docs.github.com/rest/repos/repos#delete-a-repository) if you no longer need the source data. Returns a status of `404 Not Found` if the repository is not locked.
795pub async fn migrations_slash_unlock_repo_for_authenticated_user(configuration: &configuration::Configuration, migration_id: i32, repo_name: &str) -> Result<(), Error<MigrationsSlashUnlockRepoForAuthenticatedUserError>> {
796    let local_var_configuration = configuration;
797
798    let local_var_client = &local_var_configuration.client;
799
800    let local_var_uri_str = format!("{}/user/migrations/{migration_id}/repos/{repo_name}/lock", local_var_configuration.base_path, migration_id=migration_id, repo_name=crate::apis::urlencode(repo_name));
801    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
802
803    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
804        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
805    }
806
807    let local_var_req = local_var_req_builder.build()?;
808    let local_var_resp = local_var_client.execute(local_var_req).await?;
809
810    let local_var_status = local_var_resp.status();
811    let local_var_content = local_var_resp.text().await?;
812
813    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
814        Ok(())
815    } else {
816        let local_var_entity: Option<MigrationsSlashUnlockRepoForAuthenticatedUserError> = serde_json::from_str(&local_var_content).ok();
817        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
818        Err(Error::ResponseError(local_var_error))
819    }
820}
821
822/// Unlocks a repository that was locked for migration. You should unlock each migrated repository and [delete them](https://docs.github.com/rest/repos/repos#delete-a-repository) when the migration is complete and you no longer need the source data.
823pub async fn migrations_slash_unlock_repo_for_org(configuration: &configuration::Configuration, org: &str, migration_id: i32, repo_name: &str) -> Result<(), Error<MigrationsSlashUnlockRepoForOrgError>> {
824    let local_var_configuration = configuration;
825
826    let local_var_client = &local_var_configuration.client;
827
828    let local_var_uri_str = format!("{}/orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock", local_var_configuration.base_path, org=crate::apis::urlencode(org), migration_id=migration_id, repo_name=crate::apis::urlencode(repo_name));
829    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
830
831    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
832        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
833    }
834
835    let local_var_req = local_var_req_builder.build()?;
836    let local_var_resp = local_var_client.execute(local_var_req).await?;
837
838    let local_var_status = local_var_resp.status();
839    let local_var_content = local_var_resp.text().await?;
840
841    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
842        Ok(())
843    } else {
844        let local_var_entity: Option<MigrationsSlashUnlockRepoForOrgError> = serde_json::from_str(&local_var_content).ok();
845        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
846        Err(Error::ResponseError(local_var_error))
847    }
848}
849
850/// An import can be updated with credentials or a project choice by passing in the appropriate parameters in this API request. If no parameters are provided, the import will be restarted.  Some servers (e.g. TFS servers) can have several projects at a single URL. In those cases the import progress will have the status `detection_found_multiple` and the Import Progress response will include a `project_choices` array. You can select the project to import by providing one of the objects in the `project_choices` array in the update request.  **Warning:** Due to very low levels of usage and available alternatives, this endpoint is deprecated and will no longer be available from 00:00 UTC on April 12, 2024. For more details and alternatives, see the [changelog](https://gh.io/source-imports-api-deprecation).
851pub async fn migrations_slash_update_import(configuration: &configuration::Configuration, owner: &str, repo: &str, migrations_update_import_request: Option<models::MigrationsUpdateImportRequest>) -> Result<models::Import, Error<MigrationsSlashUpdateImportError>> {
852    let local_var_configuration = configuration;
853
854    let local_var_client = &local_var_configuration.client;
855
856    let local_var_uri_str = format!("{}/repos/{owner}/{repo}/import", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
857    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
858
859    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
860        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
861    }
862    local_var_req_builder = local_var_req_builder.json(&migrations_update_import_request);
863
864    let local_var_req = local_var_req_builder.build()?;
865    let local_var_resp = local_var_client.execute(local_var_req).await?;
866
867    let local_var_status = local_var_resp.status();
868    let local_var_content = local_var_resp.text().await?;
869
870    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
871        serde_json::from_str(&local_var_content).map_err(Error::from)
872    } else {
873        let local_var_entity: Option<MigrationsSlashUpdateImportError> = serde_json::from_str(&local_var_content).ok();
874        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
875        Err(Error::ResponseError(local_var_error))
876    }
877}
878