1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum MigrationsSlashCancelImportError {
22 Status503(models::BasicError),
23 UnknownValue(serde_json::Value),
24}
25
26#[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#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum MigrationsSlashDeleteArchiveForOrgError {
40 Status404(models::BasicError),
41 UnknownValue(serde_json::Value),
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum MigrationsSlashDownloadArchiveForOrgError {
48 Status404(models::BasicError),
49 UnknownValue(serde_json::Value),
50}
51
52#[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#[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#[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#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum MigrationsSlashGetLargeFilesError {
83 Status503(models::BasicError),
84 UnknownValue(serde_json::Value),
85}
86
87#[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#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum MigrationsSlashGetStatusForOrgError {
101 Status404(models::BasicError),
102 UnknownValue(serde_json::Value),
103}
104
105#[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#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum MigrationsSlashListForOrgError {
118 UnknownValue(serde_json::Value),
119}
120
121#[derive(Debug, Clone, Serialize, Deserialize)]
123#[serde(untagged)]
124pub enum MigrationsSlashListReposForAuthenticatedUserError {
125 Status404(models::BasicError),
126 UnknownValue(serde_json::Value),
127}
128
129#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum MigrationsSlashListReposForOrgError {
133 Status404(models::BasicError),
134 UnknownValue(serde_json::Value),
135}
136
137#[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#[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#[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#[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#[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#[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#[derive(Debug, Clone, Serialize, Deserialize)]
197#[serde(untagged)]
198pub enum MigrationsSlashUnlockRepoForOrgError {
199 Status404(models::BasicError),
200 UnknownValue(serde_json::Value),
201}
202
203#[derive(Debug, Clone, Serialize, Deserialize)]
205#[serde(untagged)]
206pub enum MigrationsSlashUpdateImportError {
207 Status503(models::BasicError),
208 UnknownValue(serde_json::Value),
209}
210
211
212pub 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
240pub 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
268pub 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
296pub 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
324pub 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
352pub 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
383pub 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
411pub 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
439pub 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
473pub 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
507pub 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
541pub 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
581pub 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
615pub 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
649pub 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
678pub 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
707pub 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
736pub 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
765pub 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
794pub 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
822pub 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
850pub 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