1use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum DeleteCommentError {
21 Status400(models::JsonErrorResponseNull),
22 Status401(models::JsonErrorResponseNull),
23 Status403(models::JsonErrorResponseNull),
24 Status404(models::JsonErrorResponseNull),
25 Status409(models::JsonErrorResponseNull),
26 Status429(models::JsonErrorResponseNull),
27 Status500(models::JsonErrorResponseNull),
28 UnknownValue(serde_json::Value),
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum DeleteFileViewError {
35 Status400(models::JsonErrorResponseNull),
36 Status401(models::JsonErrorResponseNull),
37 Status403(models::JsonErrorResponseNull),
38 Status404(models::JsonErrorResponseNull),
39 Status409(models::JsonErrorResponseNull),
40 Status429(models::JsonErrorResponseNull),
41 Status500(models::JsonErrorResponseNull),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum DeleteReviewerError {
49 Status400(models::JsonErrorResponseNull),
50 Status401(models::JsonErrorResponseNull),
51 Status403(models::JsonErrorResponseNull),
52 Status404(models::JsonErrorResponseNull),
53 Status409(models::JsonErrorResponseNull),
54 Status429(models::JsonErrorResponseNull),
55 Status500(models::JsonErrorResponseNull),
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum GetActivitiesError {
63 Status400(models::JsonErrorResponseNull),
64 Status401(models::JsonErrorResponseNull),
65 Status403(models::JsonErrorResponseNull),
66 Status404(models::JsonErrorResponseNull),
67 Status409(models::JsonErrorResponseNull),
68 Status429(models::JsonErrorResponseNull),
69 Status500(models::JsonErrorResponseNull),
70 UnknownValue(serde_json::Value),
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum GetCodeOwnersError {
77 Status400(models::JsonErrorResponseNull),
78 Status401(models::JsonErrorResponseNull),
79 Status403(models::JsonErrorResponseNull),
80 Status404(models::JsonErrorResponseNull),
81 Status409(models::JsonErrorResponseNull),
82 Status429(models::JsonErrorResponseNull),
83 Status500(models::JsonErrorResponseNull),
84 UnknownValue(serde_json::Value),
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum GetFileViewsError {
91 Status400(models::JsonErrorResponseNull),
92 Status401(models::JsonErrorResponseNull),
93 Status403(models::JsonErrorResponseNull),
94 Status404(models::JsonErrorResponseNull),
95 Status409(models::JsonErrorResponseNull),
96 Status429(models::JsonErrorResponseNull),
97 Status500(models::JsonErrorResponseNull),
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum GetMetadataError {
105 Status400(models::JsonErrorResponseNull),
106 Status401(models::JsonErrorResponseNull),
107 Status403(models::JsonErrorResponseNull),
108 Status404(models::JsonErrorResponseNull),
109 Status409(models::JsonErrorResponseNull),
110 Status429(models::JsonErrorResponseNull),
111 Status500(models::JsonErrorResponseNull),
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum GetPullRequestChecksError {
119 Status400(models::JsonErrorResponseNull),
120 Status401(models::JsonErrorResponseNull),
121 Status403(models::JsonErrorResponseNull),
122 Status404(models::JsonErrorResponseNull),
123 Status409(models::JsonErrorResponseNull),
124 Status429(models::JsonErrorResponseNull),
125 Status500(models::JsonErrorResponseNull),
126 UnknownValue(serde_json::Value),
127}
128
129#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum GetPullRequestCommitsError {
133 Status400(models::JsonErrorResponseNull),
134 Status401(models::JsonErrorResponseNull),
135 Status403(models::JsonErrorResponseNull),
136 Status404(models::JsonErrorResponseNull),
137 Status409(models::JsonErrorResponseNull),
138 Status429(models::JsonErrorResponseNull),
139 Status500(models::JsonErrorResponseNull),
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum GetPullreqError {
147 Status400(models::JsonErrorResponseNull),
148 Status401(models::JsonErrorResponseNull),
149 Status403(models::JsonErrorResponseNull),
150 Status404(models::JsonErrorResponseNull),
151 Status409(models::JsonErrorResponseNull),
152 Status429(models::JsonErrorResponseNull),
153 Status500(models::JsonErrorResponseNull),
154 UnknownValue(serde_json::Value),
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum GetPullreqsError {
161 Status400(models::JsonErrorResponseNull),
162 Status401(models::JsonErrorResponseNull),
163 Status403(models::JsonErrorResponseNull),
164 Status404(models::JsonErrorResponseNull),
165 Status409(models::JsonErrorResponseNull),
166 Status429(models::JsonErrorResponseNull),
167 Status500(models::JsonErrorResponseNull),
168 UnknownValue(serde_json::Value),
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum GetReviewersError {
175 Status400(models::JsonErrorResponseNull),
176 Status401(models::JsonErrorResponseNull),
177 Status403(models::JsonErrorResponseNull),
178 Status404(models::JsonErrorResponseNull),
179 Status409(models::JsonErrorResponseNull),
180 Status429(models::JsonErrorResponseNull),
181 Status500(models::JsonErrorResponseNull),
182 UnknownValue(serde_json::Value),
183}
184
185#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum PatchCommentError {
189 Status400(models::JsonErrorResponseNull),
190 Status401(models::JsonErrorResponseNull),
191 Status403(models::JsonErrorResponseNull),
192 Status404(models::JsonErrorResponseNull),
193 Status409(models::JsonErrorResponseNull),
194 Status429(models::JsonErrorResponseNull),
195 Status500(models::JsonErrorResponseNull),
196 UnknownValue(serde_json::Value),
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum PatchPullreqError {
203 Status400(models::JsonErrorResponseNull),
204 Status401(models::JsonErrorResponseNull),
205 Status403(models::JsonErrorResponseNull),
206 Status404(models::JsonErrorResponseNull),
207 Status409(models::JsonErrorResponseNull),
208 Status429(models::JsonErrorResponseNull),
209 Status500(models::JsonErrorResponseNull),
210 UnknownValue(serde_json::Value),
211}
212
213#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum PostApplySuggestionsError {
217 Status400(models::JsonErrorResponseNull),
218 Status401(models::JsonErrorResponseNull),
219 Status403(models::JsonErrorResponseNull),
220 Status404(models::JsonErrorResponseNull),
221 Status409(models::JsonErrorResponseNull),
222 Status422(models::RuleCheckOutput),
223 Status429(models::JsonErrorResponseNull),
224 Status500(models::JsonErrorResponseNull),
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum PostCommentError {
232 Status400(models::JsonErrorResponseNull),
233 Status401(models::JsonErrorResponseNull),
234 Status403(models::JsonErrorResponseNull),
235 Status404(models::JsonErrorResponseNull),
236 Status409(models::JsonErrorResponseNull),
237 Status429(models::JsonErrorResponseNull),
238 Status500(models::JsonErrorResponseNull),
239 UnknownValue(serde_json::Value),
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum PostDiffError {
246 Status400(models::JsonErrorResponseNull),
247 Status401(models::JsonErrorResponseNull),
248 Status403(models::JsonErrorResponseNull),
249 Status404(models::JsonErrorResponseNull),
250 Status409(models::JsonErrorResponseNull),
251 Status429(models::JsonErrorResponseNull),
252 Status500(models::JsonErrorResponseNull),
253 UnknownValue(serde_json::Value),
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum PostMergeError {
260 Status400(models::JsonErrorResponseNull),
261 Status401(models::JsonErrorResponseNull),
262 Status403(models::JsonErrorResponseNull),
263 Status404(models::JsonErrorResponseNull),
264 Status409(models::JsonErrorResponseNull),
265 Status422(models::RuleCheckOutput),
266 Status429(models::JsonErrorResponseNull),
267 Status500(models::JsonErrorResponseNull),
268 UnknownValue(serde_json::Value),
269}
270
271#[derive(Debug, Clone, Serialize, Deserialize)]
273#[serde(untagged)]
274pub enum PostPullreqError {
275 Status400(models::JsonErrorResponseNull),
276 Status401(models::JsonErrorResponseNull),
277 Status403(models::JsonErrorResponseNull),
278 Status404(models::JsonErrorResponseNull),
279 Status409(models::JsonErrorResponseNull),
280 Status429(models::JsonErrorResponseNull),
281 Status500(models::JsonErrorResponseNull),
282 UnknownValue(serde_json::Value),
283}
284
285#[derive(Debug, Clone, Serialize, Deserialize)]
287#[serde(untagged)]
288pub enum PostReviewsError {
289 Status400(models::JsonErrorResponseNull),
290 Status401(models::JsonErrorResponseNull),
291 Status403(models::JsonErrorResponseNull),
292 Status404(models::JsonErrorResponseNull),
293 Status409(models::JsonErrorResponseNull),
294 Status429(models::JsonErrorResponseNull),
295 Status500(models::JsonErrorResponseNull),
296 UnknownValue(serde_json::Value),
297}
298
299#[derive(Debug, Clone, Serialize, Deserialize)]
301#[serde(untagged)]
302pub enum PostStateError {
303 Status400(models::JsonErrorResponseNull),
304 Status401(models::JsonErrorResponseNull),
305 Status403(models::JsonErrorResponseNull),
306 Status404(models::JsonErrorResponseNull),
307 Status409(models::JsonErrorResponseNull),
308 Status429(models::JsonErrorResponseNull),
309 Status500(models::JsonErrorResponseNull),
310 UnknownValue(serde_json::Value),
311}
312
313#[derive(Debug, Clone, Serialize, Deserialize)]
315#[serde(untagged)]
316pub enum PutCommentStatusError {
317 Status400(models::JsonErrorResponseNull),
318 Status401(models::JsonErrorResponseNull),
319 Status403(models::JsonErrorResponseNull),
320 Status404(models::JsonErrorResponseNull),
321 Status409(models::JsonErrorResponseNull),
322 Status429(models::JsonErrorResponseNull),
323 Status500(models::JsonErrorResponseNull),
324 UnknownValue(serde_json::Value),
325}
326
327#[derive(Debug, Clone, Serialize, Deserialize)]
329#[serde(untagged)]
330pub enum PutFileViewsError {
331 Status400(models::JsonErrorResponseNull),
332 Status401(models::JsonErrorResponseNull),
333 Status403(models::JsonErrorResponseNull),
334 Status404(models::JsonErrorResponseNull),
335 Status409(models::JsonErrorResponseNull),
336 Status429(models::JsonErrorResponseNull),
337 Status500(models::JsonErrorResponseNull),
338 UnknownValue(serde_json::Value),
339}
340
341#[derive(Debug, Clone, Serialize, Deserialize)]
343#[serde(untagged)]
344pub enum PutReviewerError {
345 Status400(models::JsonErrorResponseNull),
346 Status401(models::JsonErrorResponseNull),
347 Status403(models::JsonErrorResponseNull),
348 Status404(models::JsonErrorResponseNull),
349 Status409(models::JsonErrorResponseNull),
350 Status429(models::JsonErrorResponseNull),
351 Status500(models::JsonErrorResponseNull),
352 UnknownValue(serde_json::Value),
353}
354
355pub async fn delete_comment(
356 configuration: &configuration::Configuration,
357 repo_ref: &str,
358 pullreq_number: i64,
359 pullreq_comment_id: i64,
360) -> Result<(), Error<DeleteCommentError>> {
361 let p_path_repo_ref = repo_ref;
363 let p_path_pullreq_number = pullreq_number;
364 let p_path_pullreq_comment_id = pullreq_comment_id;
365
366 let uri_str = format!(
367 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/comments/{pullreq_comment_id}",
368 configuration.base_path,
369 repo_ref = crate::apis::urlencode(p_path_repo_ref),
370 pullreq_number = p_path_pullreq_number,
371 pullreq_comment_id = p_path_pullreq_comment_id
372 );
373 let mut req_builder = configuration
374 .client
375 .request(reqwest::Method::DELETE, &uri_str);
376
377 if let Some(ref apikey) = configuration.api_key {
378 let key = apikey.key.clone();
379 let value = match apikey.prefix {
380 Some(ref prefix) => format!("{} {}", prefix, key),
381 None => key,
382 };
383 req_builder = req_builder.query(&[("access_token", value)]);
384 }
385 if let Some(ref user_agent) = configuration.user_agent {
386 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
387 }
388 if let Some(ref auth_conf) = configuration.basic_auth {
389 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
390 };
391 if let Some(ref token) = configuration.bearer_access_token {
392 req_builder = req_builder.bearer_auth(token.to_owned());
393 };
394
395 let req = req_builder.build()?;
396 let resp = configuration.client.execute(req).await?;
397
398 let status = resp.status();
399
400 if !status.is_client_error() && !status.is_server_error() {
401 Ok(())
402 } else {
403 let content = resp.text().await?;
404 let entity: Option<DeleteCommentError> = serde_json::from_str(&content).ok();
405 Err(Error::ResponseError(ResponseContent {
406 status,
407 content,
408 entity,
409 }))
410 }
411}
412
413pub async fn delete_file_view(
414 configuration: &configuration::Configuration,
415 repo_ref: &str,
416 pullreq_number: i64,
417 path: &str,
418) -> Result<(), Error<DeleteFileViewError>> {
419 let p_path_repo_ref = repo_ref;
421 let p_path_pullreq_number = pullreq_number;
422 let p_path_path = path;
423
424 let uri_str = format!(
425 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/file-views/{path}",
426 configuration.base_path,
427 repo_ref = crate::apis::urlencode(p_path_repo_ref),
428 pullreq_number = p_path_pullreq_number,
429 path = crate::apis::urlencode(p_path_path)
430 );
431 let mut req_builder = configuration
432 .client
433 .request(reqwest::Method::DELETE, &uri_str);
434
435 if let Some(ref apikey) = configuration.api_key {
436 let key = apikey.key.clone();
437 let value = match apikey.prefix {
438 Some(ref prefix) => format!("{} {}", prefix, key),
439 None => key,
440 };
441 req_builder = req_builder.query(&[("access_token", value)]);
442 }
443 if let Some(ref user_agent) = configuration.user_agent {
444 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
445 }
446 if let Some(ref auth_conf) = configuration.basic_auth {
447 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
448 };
449 if let Some(ref token) = configuration.bearer_access_token {
450 req_builder = req_builder.bearer_auth(token.to_owned());
451 };
452
453 let req = req_builder.build()?;
454 let resp = configuration.client.execute(req).await?;
455
456 let status = resp.status();
457
458 if !status.is_client_error() && !status.is_server_error() {
459 Ok(())
460 } else {
461 let content = resp.text().await?;
462 let entity: Option<DeleteFileViewError> = serde_json::from_str(&content).ok();
463 Err(Error::ResponseError(ResponseContent {
464 status,
465 content,
466 entity,
467 }))
468 }
469}
470
471pub async fn delete_reviewer(
472 configuration: &configuration::Configuration,
473 repo_ref: &str,
474 pullreq_number: i64,
475 pullreq_reviewer_id: i64,
476) -> Result<(), Error<DeleteReviewerError>> {
477 let p_path_repo_ref = repo_ref;
479 let p_path_pullreq_number = pullreq_number;
480 let p_path_pullreq_reviewer_id = pullreq_reviewer_id;
481
482 let uri_str = format!(
483 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/reviewers/{pullreq_reviewer_id}",
484 configuration.base_path,
485 repo_ref = crate::apis::urlencode(p_path_repo_ref),
486 pullreq_number = p_path_pullreq_number,
487 pullreq_reviewer_id = p_path_pullreq_reviewer_id
488 );
489 let mut req_builder = configuration
490 .client
491 .request(reqwest::Method::DELETE, &uri_str);
492
493 if let Some(ref apikey) = configuration.api_key {
494 let key = apikey.key.clone();
495 let value = match apikey.prefix {
496 Some(ref prefix) => format!("{} {}", prefix, key),
497 None => key,
498 };
499 req_builder = req_builder.query(&[("access_token", value)]);
500 }
501 if let Some(ref user_agent) = configuration.user_agent {
502 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
503 }
504 if let Some(ref auth_conf) = configuration.basic_auth {
505 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
506 };
507 if let Some(ref token) = configuration.bearer_access_token {
508 req_builder = req_builder.bearer_auth(token.to_owned());
509 };
510
511 let req = req_builder.build()?;
512 let resp = configuration.client.execute(req).await?;
513
514 let status = resp.status();
515
516 if !status.is_client_error() && !status.is_server_error() {
517 Ok(())
518 } else {
519 let content = resp.text().await?;
520 let entity: Option<DeleteReviewerError> = serde_json::from_str(&content).ok();
521 Err(Error::ResponseError(ResponseContent {
522 status,
523 content,
524 entity,
525 }))
526 }
527}
528
529pub async fn get_activities(
530 configuration: &configuration::Configuration,
531 repo_ref: &str,
532 pullreq_number: i64,
533 page: Option<i64>,
534 size: Option<i64>,
535 query: Option<&str>,
536 after: Option<i64>,
537 before: Option<i64>,
538 types: Option<Vec<models::PullreqActivityType>>,
539 kinds: Option<Vec<models::PullreqActivityKind>>,
540) -> Result<Vec<models::PullreqActivityRelations>, Error<GetActivitiesError>> {
541 let p_path_repo_ref = repo_ref;
543 let p_path_pullreq_number = pullreq_number;
544 let p_query_page = page;
545 let p_query_size = size;
546 let p_query_query = query;
547 let p_query_after = after;
548 let p_query_before = before;
549 let p_query_types = types;
550 let p_query_kinds = kinds;
551
552 let uri_str = format!(
553 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/activities",
554 configuration.base_path,
555 repo_ref = crate::apis::urlencode(p_path_repo_ref),
556 pullreq_number = p_path_pullreq_number
557 );
558 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
559
560 if let Some(ref param_value) = p_query_page {
561 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
562 }
563 if let Some(ref param_value) = p_query_size {
564 req_builder = req_builder.query(&[("size", ¶m_value.to_string())]);
565 }
566 if let Some(ref param_value) = p_query_query {
567 req_builder = req_builder.query(&[("query", ¶m_value.to_string())]);
568 }
569 if let Some(ref param_value) = p_query_after {
570 req_builder = req_builder.query(&[("after", ¶m_value.to_string())]);
571 }
572 if let Some(ref param_value) = p_query_before {
573 req_builder = req_builder.query(&[("before", ¶m_value.to_string())]);
574 }
575 if let Some(ref param_value) = p_query_types {
576 req_builder = match "multi" {
577 "multi" => req_builder.query(
578 ¶m_value
579 .iter()
580 .map(|p| ("types".to_owned(), p.to_string()))
581 .collect::<Vec<(std::string::String, std::string::String)>>(),
582 ),
583 _ => req_builder.query(&[(
584 "types",
585 ¶m_value
586 .iter()
587 .map(|p| p.to_string())
588 .collect::<Vec<String>>()
589 .join(",")
590 .to_string(),
591 )]),
592 };
593 }
594 if let Some(ref param_value) = p_query_kinds {
595 req_builder = match "multi" {
596 "multi" => req_builder.query(
597 ¶m_value
598 .iter()
599 .map(|p| ("kinds".to_owned(), p.to_string()))
600 .collect::<Vec<(std::string::String, std::string::String)>>(),
601 ),
602 _ => req_builder.query(&[(
603 "kinds",
604 ¶m_value
605 .iter()
606 .map(|p| p.to_string())
607 .collect::<Vec<String>>()
608 .join(",")
609 .to_string(),
610 )]),
611 };
612 }
613 if let Some(ref apikey) = configuration.api_key {
614 let key = apikey.key.clone();
615 let value = match apikey.prefix {
616 Some(ref prefix) => format!("{} {}", prefix, key),
617 None => key,
618 };
619 req_builder = req_builder.query(&[("access_token", value)]);
620 }
621 if let Some(ref user_agent) = configuration.user_agent {
622 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
623 }
624 if let Some(ref auth_conf) = configuration.basic_auth {
625 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
626 };
627 if let Some(ref token) = configuration.bearer_access_token {
628 req_builder = req_builder.bearer_auth(token.to_owned());
629 };
630
631 let req = req_builder.build()?;
632 let resp = configuration.client.execute(req).await?;
633
634 let status = resp.status();
635 let content_type = resp
636 .headers()
637 .get("content-type")
638 .and_then(|v| v.to_str().ok())
639 .unwrap_or("application/octet-stream");
640 let content_type = super::ContentType::from(content_type);
641
642 if !status.is_client_error() && !status.is_server_error() {
643 let content = resp.text().await?;
644 match content_type {
645 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
646 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullreqActivityRelations>`"))),
647 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PullreqActivityRelations>`")))),
648 }
649 } else {
650 let content = resp.text().await?;
651 let entity: Option<GetActivitiesError> = serde_json::from_str(&content).ok();
652 Err(Error::ResponseError(ResponseContent {
653 status,
654 content,
655 entity,
656 }))
657 }
658}
659
660pub async fn get_code_owners(
661 configuration: &configuration::Configuration,
662 repo_ref: &str,
663 pullreq_number: i64,
664) -> Result<models::CodeOwnerEvaluation, Error<GetCodeOwnersError>> {
665 let p_path_repo_ref = repo_ref;
667 let p_path_pullreq_number = pullreq_number;
668
669 let uri_str = format!(
670 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/codeowners",
671 configuration.base_path,
672 repo_ref = crate::apis::urlencode(p_path_repo_ref),
673 pullreq_number = p_path_pullreq_number
674 );
675 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
676
677 if let Some(ref apikey) = configuration.api_key {
678 let key = apikey.key.clone();
679 let value = match apikey.prefix {
680 Some(ref prefix) => format!("{} {}", prefix, key),
681 None => key,
682 };
683 req_builder = req_builder.query(&[("access_token", value)]);
684 }
685 if let Some(ref user_agent) = configuration.user_agent {
686 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
687 }
688 if let Some(ref auth_conf) = configuration.basic_auth {
689 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
690 };
691 if let Some(ref token) = configuration.bearer_access_token {
692 req_builder = req_builder.bearer_auth(token.to_owned());
693 };
694
695 let req = req_builder.build()?;
696 let resp = configuration.client.execute(req).await?;
697
698 let status = resp.status();
699 let content_type = resp
700 .headers()
701 .get("content-type")
702 .and_then(|v| v.to_str().ok())
703 .unwrap_or("application/octet-stream");
704 let content_type = super::ContentType::from(content_type);
705
706 if !status.is_client_error() && !status.is_server_error() {
707 let content = resp.text().await?;
708 match content_type {
709 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
710 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CodeOwnerEvaluation`"))),
711 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CodeOwnerEvaluation`")))),
712 }
713 } else {
714 let content = resp.text().await?;
715 let entity: Option<GetCodeOwnersError> = serde_json::from_str(&content).ok();
716 Err(Error::ResponseError(ResponseContent {
717 status,
718 content,
719 entity,
720 }))
721 }
722}
723
724pub async fn get_file_views(
725 configuration: &configuration::Configuration,
726 repo_ref: &str,
727 pullreq_number: i64,
728) -> Result<Vec<models::PullreqFileViewModel>, Error<GetFileViewsError>> {
729 let p_path_repo_ref = repo_ref;
731 let p_path_pullreq_number = pullreq_number;
732
733 let uri_str = format!(
734 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/file-views",
735 configuration.base_path,
736 repo_ref = crate::apis::urlencode(p_path_repo_ref),
737 pullreq_number = p_path_pullreq_number
738 );
739 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
740
741 if let Some(ref apikey) = configuration.api_key {
742 let key = apikey.key.clone();
743 let value = match apikey.prefix {
744 Some(ref prefix) => format!("{} {}", prefix, key),
745 None => key,
746 };
747 req_builder = req_builder.query(&[("access_token", value)]);
748 }
749 if let Some(ref user_agent) = configuration.user_agent {
750 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
751 }
752 if let Some(ref auth_conf) = configuration.basic_auth {
753 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
754 };
755 if let Some(ref token) = configuration.bearer_access_token {
756 req_builder = req_builder.bearer_auth(token.to_owned());
757 };
758
759 let req = req_builder.build()?;
760 let resp = configuration.client.execute(req).await?;
761
762 let status = resp.status();
763 let content_type = resp
764 .headers()
765 .get("content-type")
766 .and_then(|v| v.to_str().ok())
767 .unwrap_or("application/octet-stream");
768 let content_type = super::ContentType::from(content_type);
769
770 if !status.is_client_error() && !status.is_server_error() {
771 let content = resp.text().await?;
772 match content_type {
773 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
774 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullreqFileViewModel>`"))),
775 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PullreqFileViewModel>`")))),
776 }
777 } else {
778 let content = resp.text().await?;
779 let entity: Option<GetFileViewsError> = serde_json::from_str(&content).ok();
780 Err(Error::ResponseError(ResponseContent {
781 status,
782 content,
783 entity,
784 }))
785 }
786}
787
788pub async fn get_metadata(
789 configuration: &configuration::Configuration,
790 repo_ref: &str,
791 pullreq_number: i64,
792) -> Result<models::PullreqWithDiffStats, Error<GetMetadataError>> {
793 let p_path_repo_ref = repo_ref;
795 let p_path_pullreq_number = pullreq_number;
796
797 let uri_str = format!(
798 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/metadata",
799 configuration.base_path,
800 repo_ref = crate::apis::urlencode(p_path_repo_ref),
801 pullreq_number = p_path_pullreq_number
802 );
803 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
804
805 if let Some(ref apikey) = configuration.api_key {
806 let key = apikey.key.clone();
807 let value = match apikey.prefix {
808 Some(ref prefix) => format!("{} {}", prefix, key),
809 None => key,
810 };
811 req_builder = req_builder.query(&[("access_token", value)]);
812 }
813 if let Some(ref user_agent) = configuration.user_agent {
814 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
815 }
816 if let Some(ref auth_conf) = configuration.basic_auth {
817 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
818 };
819 if let Some(ref token) = configuration.bearer_access_token {
820 req_builder = req_builder.bearer_auth(token.to_owned());
821 };
822
823 let req = req_builder.build()?;
824 let resp = configuration.client.execute(req).await?;
825
826 let status = resp.status();
827 let content_type = resp
828 .headers()
829 .get("content-type")
830 .and_then(|v| v.to_str().ok())
831 .unwrap_or("application/octet-stream");
832 let content_type = super::ContentType::from(content_type);
833
834 if !status.is_client_error() && !status.is_server_error() {
835 let content = resp.text().await?;
836 match content_type {
837 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
838 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqWithDiffStats`"))),
839 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqWithDiffStats`")))),
840 }
841 } else {
842 let content = resp.text().await?;
843 let entity: Option<GetMetadataError> = serde_json::from_str(&content).ok();
844 Err(Error::ResponseError(ResponseContent {
845 status,
846 content,
847 entity,
848 }))
849 }
850}
851
852pub async fn get_pull_request_checks(
853 configuration: &configuration::Configuration,
854 repo_ref: &str,
855 pullreq_number: i64,
856) -> Result<models::PullreqChecksOutput, Error<GetPullRequestChecksError>> {
857 let p_path_repo_ref = repo_ref;
859 let p_path_pullreq_number = pullreq_number;
860
861 let uri_str = format!(
862 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/checks",
863 configuration.base_path,
864 repo_ref = crate::apis::urlencode(p_path_repo_ref),
865 pullreq_number = p_path_pullreq_number
866 );
867 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
868
869 if let Some(ref apikey) = configuration.api_key {
870 let key = apikey.key.clone();
871 let value = match apikey.prefix {
872 Some(ref prefix) => format!("{} {}", prefix, key),
873 None => key,
874 };
875 req_builder = req_builder.query(&[("access_token", value)]);
876 }
877 if let Some(ref user_agent) = configuration.user_agent {
878 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
879 }
880 if let Some(ref auth_conf) = configuration.basic_auth {
881 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
882 };
883 if let Some(ref token) = configuration.bearer_access_token {
884 req_builder = req_builder.bearer_auth(token.to_owned());
885 };
886
887 let req = req_builder.build()?;
888 let resp = configuration.client.execute(req).await?;
889
890 let status = resp.status();
891 let content_type = resp
892 .headers()
893 .get("content-type")
894 .and_then(|v| v.to_str().ok())
895 .unwrap_or("application/octet-stream");
896 let content_type = super::ContentType::from(content_type);
897
898 if !status.is_client_error() && !status.is_server_error() {
899 let content = resp.text().await?;
900 match content_type {
901 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
902 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqChecksOutput`"))),
903 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqChecksOutput`")))),
904 }
905 } else {
906 let content = resp.text().await?;
907 let entity: Option<GetPullRequestChecksError> = serde_json::from_str(&content).ok();
908 Err(Error::ResponseError(ResponseContent {
909 status,
910 content,
911 entity,
912 }))
913 }
914}
915
916pub async fn get_pull_request_commits(
917 configuration: &configuration::Configuration,
918 repo_ref: &str,
919 pullreq_number: i64,
920 page: Option<i64>,
921 size: Option<i64>,
922) -> Result<Vec<models::Commit>, Error<GetPullRequestCommitsError>> {
923 let p_path_repo_ref = repo_ref;
925 let p_path_pullreq_number = pullreq_number;
926 let p_query_page = page;
927 let p_query_size = size;
928
929 let uri_str = format!(
930 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/commits",
931 configuration.base_path,
932 repo_ref = crate::apis::urlencode(p_path_repo_ref),
933 pullreq_number = p_path_pullreq_number
934 );
935 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
936
937 if let Some(ref param_value) = p_query_page {
938 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
939 }
940 if let Some(ref param_value) = p_query_size {
941 req_builder = req_builder.query(&[("size", ¶m_value.to_string())]);
942 }
943 if let Some(ref apikey) = configuration.api_key {
944 let key = apikey.key.clone();
945 let value = match apikey.prefix {
946 Some(ref prefix) => format!("{} {}", prefix, key),
947 None => key,
948 };
949 req_builder = req_builder.query(&[("access_token", value)]);
950 }
951 if let Some(ref user_agent) = configuration.user_agent {
952 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
953 }
954 if let Some(ref auth_conf) = configuration.basic_auth {
955 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
956 };
957 if let Some(ref token) = configuration.bearer_access_token {
958 req_builder = req_builder.bearer_auth(token.to_owned());
959 };
960
961 let req = req_builder.build()?;
962 let resp = configuration.client.execute(req).await?;
963
964 let status = resp.status();
965 let content_type = resp
966 .headers()
967 .get("content-type")
968 .and_then(|v| v.to_str().ok())
969 .unwrap_or("application/octet-stream");
970 let content_type = super::ContentType::from(content_type);
971
972 if !status.is_client_error() && !status.is_server_error() {
973 let content = resp.text().await?;
974 match content_type {
975 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
976 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Commit>`"))),
977 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Commit>`")))),
978 }
979 } else {
980 let content = resp.text().await?;
981 let entity: Option<GetPullRequestCommitsError> = serde_json::from_str(&content).ok();
982 Err(Error::ResponseError(ResponseContent {
983 status,
984 content,
985 entity,
986 }))
987 }
988}
989
990pub async fn get_pullreq(
991 configuration: &configuration::Configuration,
992 repo_ref: &str,
993 pullreq_number: i64,
994) -> Result<models::PullreqWithDiffStats, Error<GetPullreqError>> {
995 let p_path_repo_ref = repo_ref;
997 let p_path_pullreq_number = pullreq_number;
998
999 let uri_str = format!(
1000 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}",
1001 configuration.base_path,
1002 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1003 pullreq_number = p_path_pullreq_number
1004 );
1005 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1006
1007 if let Some(ref apikey) = configuration.api_key {
1008 let key = apikey.key.clone();
1009 let value = match apikey.prefix {
1010 Some(ref prefix) => format!("{} {}", prefix, key),
1011 None => key,
1012 };
1013 req_builder = req_builder.query(&[("access_token", value)]);
1014 }
1015 if let Some(ref user_agent) = configuration.user_agent {
1016 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1017 }
1018 if let Some(ref auth_conf) = configuration.basic_auth {
1019 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1020 };
1021 if let Some(ref token) = configuration.bearer_access_token {
1022 req_builder = req_builder.bearer_auth(token.to_owned());
1023 };
1024
1025 let req = req_builder.build()?;
1026 let resp = configuration.client.execute(req).await?;
1027
1028 let status = resp.status();
1029 let content_type = resp
1030 .headers()
1031 .get("content-type")
1032 .and_then(|v| v.to_str().ok())
1033 .unwrap_or("application/octet-stream");
1034 let content_type = super::ContentType::from(content_type);
1035
1036 if !status.is_client_error() && !status.is_server_error() {
1037 let content = resp.text().await?;
1038 match content_type {
1039 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1040 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqWithDiffStats`"))),
1041 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqWithDiffStats`")))),
1042 }
1043 } else {
1044 let content = resp.text().await?;
1045 let entity: Option<GetPullreqError> = serde_json::from_str(&content).ok();
1046 Err(Error::ResponseError(ResponseContent {
1047 status,
1048 content,
1049 entity,
1050 }))
1051 }
1052}
1053
1054pub async fn get_pullreqs(
1055 configuration: &configuration::Configuration,
1056 repo_ref: &str,
1057 page: Option<i64>,
1058 size: Option<i64>,
1059 query: Option<&str>,
1060 created_by: Option<Vec<i64>>,
1061 source_repo_ref: Option<&str>,
1062 source_branch: Option<&str>,
1063 target_branch: Option<&str>,
1064 states: Option<Vec<models::PullreqState>>,
1065 sort: Option<models::PullreqSort>,
1066 order: Option<models::OrderOption>,
1067 created_gt: Option<i64>,
1068 created_lt: Option<i64>,
1069) -> Result<Vec<models::PullreqWithDiffStats>, Error<GetPullreqsError>> {
1070 let p_path_repo_ref = repo_ref;
1072 let p_query_page = page;
1073 let p_query_size = size;
1074 let p_query_query = query;
1075 let p_query_created_by = created_by;
1076 let p_query_source_repo_ref = source_repo_ref;
1077 let p_query_source_branch = source_branch;
1078 let p_query_target_branch = target_branch;
1079 let p_query_states = states;
1080 let p_query_sort = sort;
1081 let p_query_order = order;
1082 let p_query_created_gt = created_gt;
1083 let p_query_created_lt = created_lt;
1084
1085 let uri_str = format!(
1086 "{}/repos/{repo_ref}/+/pullreq",
1087 configuration.base_path,
1088 repo_ref = crate::apis::urlencode(p_path_repo_ref)
1089 );
1090 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1091
1092 if let Some(ref param_value) = p_query_page {
1093 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1094 }
1095 if let Some(ref param_value) = p_query_size {
1096 req_builder = req_builder.query(&[("size", ¶m_value.to_string())]);
1097 }
1098 if let Some(ref param_value) = p_query_query {
1099 req_builder = req_builder.query(&[("query", ¶m_value.to_string())]);
1100 }
1101 if let Some(ref param_value) = p_query_created_by {
1102 req_builder = match "multi" {
1103 "multi" => req_builder.query(
1104 ¶m_value
1105 .iter()
1106 .map(|p| ("created_by".to_owned(), p.to_string()))
1107 .collect::<Vec<(std::string::String, std::string::String)>>(),
1108 ),
1109 _ => req_builder.query(&[(
1110 "created_by",
1111 ¶m_value
1112 .iter()
1113 .map(|p| p.to_string())
1114 .collect::<Vec<String>>()
1115 .join(",")
1116 .to_string(),
1117 )]),
1118 };
1119 }
1120 if let Some(ref param_value) = p_query_source_repo_ref {
1121 req_builder = req_builder.query(&[("source_repo_ref", ¶m_value.to_string())]);
1122 }
1123 if let Some(ref param_value) = p_query_source_branch {
1124 req_builder = req_builder.query(&[("source_branch", ¶m_value.to_string())]);
1125 }
1126 if let Some(ref param_value) = p_query_target_branch {
1127 req_builder = req_builder.query(&[("target_branch", ¶m_value.to_string())]);
1128 }
1129 if let Some(ref param_value) = p_query_states {
1130 req_builder = match "multi" {
1131 "multi" => req_builder.query(
1132 ¶m_value
1133 .iter()
1134 .map(|p| ("states".to_owned(), p.to_string()))
1135 .collect::<Vec<(std::string::String, std::string::String)>>(),
1136 ),
1137 _ => req_builder.query(&[(
1138 "states",
1139 ¶m_value
1140 .iter()
1141 .map(|p| p.to_string())
1142 .collect::<Vec<String>>()
1143 .join(",")
1144 .to_string(),
1145 )]),
1146 };
1147 }
1148 if let Some(ref param_value) = p_query_sort {
1149 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
1150 }
1151 if let Some(ref param_value) = p_query_order {
1152 req_builder = req_builder.query(&[("order", ¶m_value.to_string())]);
1153 }
1154 if let Some(ref param_value) = p_query_created_gt {
1155 req_builder = req_builder.query(&[("created_gt", ¶m_value.to_string())]);
1156 }
1157 if let Some(ref param_value) = p_query_created_lt {
1158 req_builder = req_builder.query(&[("created_lt", ¶m_value.to_string())]);
1159 }
1160 if let Some(ref apikey) = configuration.api_key {
1161 let key = apikey.key.clone();
1162 let value = match apikey.prefix {
1163 Some(ref prefix) => format!("{} {}", prefix, key),
1164 None => key,
1165 };
1166 req_builder = req_builder.query(&[("access_token", value)]);
1167 }
1168 if let Some(ref user_agent) = configuration.user_agent {
1169 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1170 }
1171 if let Some(ref auth_conf) = configuration.basic_auth {
1172 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1173 };
1174 if let Some(ref token) = configuration.bearer_access_token {
1175 req_builder = req_builder.bearer_auth(token.to_owned());
1176 };
1177
1178 let req = req_builder.build()?;
1179 let resp = configuration.client.execute(req).await?;
1180
1181 let status = resp.status();
1182 let content_type = resp
1183 .headers()
1184 .get("content-type")
1185 .and_then(|v| v.to_str().ok())
1186 .unwrap_or("application/octet-stream");
1187 let content_type = super::ContentType::from(content_type);
1188
1189 if !status.is_client_error() && !status.is_server_error() {
1190 let content = resp.text().await?;
1191 match content_type {
1192 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1193 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullreqWithDiffStats>`"))),
1194 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PullreqWithDiffStats>`")))),
1195 }
1196 } else {
1197 let content = resp.text().await?;
1198 let entity: Option<GetPullreqsError> = serde_json::from_str(&content).ok();
1199 Err(Error::ResponseError(ResponseContent {
1200 status,
1201 content,
1202 entity,
1203 }))
1204 }
1205}
1206
1207pub async fn get_reviewers(
1208 configuration: &configuration::Configuration,
1209 repo_ref: &str,
1210 pullreq_number: i64,
1211) -> Result<Vec<models::PullreqReviewerUser>, Error<GetReviewersError>> {
1212 let p_path_repo_ref = repo_ref;
1214 let p_path_pullreq_number = pullreq_number;
1215
1216 let uri_str = format!(
1217 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/reviewers",
1218 configuration.base_path,
1219 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1220 pullreq_number = p_path_pullreq_number
1221 );
1222 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1223
1224 if let Some(ref apikey) = configuration.api_key {
1225 let key = apikey.key.clone();
1226 let value = match apikey.prefix {
1227 Some(ref prefix) => format!("{} {}", prefix, key),
1228 None => key,
1229 };
1230 req_builder = req_builder.query(&[("access_token", value)]);
1231 }
1232 if let Some(ref user_agent) = configuration.user_agent {
1233 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1234 }
1235 if let Some(ref auth_conf) = configuration.basic_auth {
1236 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1237 };
1238 if let Some(ref token) = configuration.bearer_access_token {
1239 req_builder = req_builder.bearer_auth(token.to_owned());
1240 };
1241
1242 let req = req_builder.build()?;
1243 let resp = configuration.client.execute(req).await?;
1244
1245 let status = resp.status();
1246 let content_type = resp
1247 .headers()
1248 .get("content-type")
1249 .and_then(|v| v.to_str().ok())
1250 .unwrap_or("application/octet-stream");
1251 let content_type = super::ContentType::from(content_type);
1252
1253 if !status.is_client_error() && !status.is_server_error() {
1254 let content = resp.text().await?;
1255 match content_type {
1256 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1257 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PullreqReviewerUser>`"))),
1258 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PullreqReviewerUser>`")))),
1259 }
1260 } else {
1261 let content = resp.text().await?;
1262 let entity: Option<GetReviewersError> = serde_json::from_str(&content).ok();
1263 Err(Error::ResponseError(ResponseContent {
1264 status,
1265 content,
1266 entity,
1267 }))
1268 }
1269}
1270
1271pub async fn patch_comment(
1272 configuration: &configuration::Configuration,
1273 repo_ref: &str,
1274 pullreq_number: i64,
1275 pullreq_comment_id: i64,
1276 pullreq_comment_update_input: models::PullreqCommentUpdateInput,
1277) -> Result<models::PullreqActivityModel, Error<PatchCommentError>> {
1278 let p_path_repo_ref = repo_ref;
1280 let p_path_pullreq_number = pullreq_number;
1281 let p_path_pullreq_comment_id = pullreq_comment_id;
1282 let p_body_pullreq_comment_update_input = pullreq_comment_update_input;
1283
1284 let uri_str = format!(
1285 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/comments/{pullreq_comment_id}",
1286 configuration.base_path,
1287 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1288 pullreq_number = p_path_pullreq_number,
1289 pullreq_comment_id = p_path_pullreq_comment_id
1290 );
1291 let mut req_builder = configuration
1292 .client
1293 .request(reqwest::Method::PATCH, &uri_str);
1294
1295 if let Some(ref apikey) = configuration.api_key {
1296 let key = apikey.key.clone();
1297 let value = match apikey.prefix {
1298 Some(ref prefix) => format!("{} {}", prefix, key),
1299 None => key,
1300 };
1301 req_builder = req_builder.query(&[("access_token", value)]);
1302 }
1303 if let Some(ref user_agent) = configuration.user_agent {
1304 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1305 }
1306 if let Some(ref auth_conf) = configuration.basic_auth {
1307 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1308 };
1309 if let Some(ref token) = configuration.bearer_access_token {
1310 req_builder = req_builder.bearer_auth(token.to_owned());
1311 };
1312 req_builder = req_builder.json(&p_body_pullreq_comment_update_input);
1313
1314 let req = req_builder.build()?;
1315 let resp = configuration.client.execute(req).await?;
1316
1317 let status = resp.status();
1318 let content_type = resp
1319 .headers()
1320 .get("content-type")
1321 .and_then(|v| v.to_str().ok())
1322 .unwrap_or("application/octet-stream");
1323 let content_type = super::ContentType::from(content_type);
1324
1325 if !status.is_client_error() && !status.is_server_error() {
1326 let content = resp.text().await?;
1327 match content_type {
1328 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1329 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqActivityModel`"))),
1330 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqActivityModel`")))),
1331 }
1332 } else {
1333 let content = resp.text().await?;
1334 let entity: Option<PatchCommentError> = serde_json::from_str(&content).ok();
1335 Err(Error::ResponseError(ResponseContent {
1336 status,
1337 content,
1338 entity,
1339 }))
1340 }
1341}
1342
1343pub async fn patch_pullreq(
1344 configuration: &configuration::Configuration,
1345 repo_ref: &str,
1346 pullreq_number: i64,
1347 pullreq_update_input: models::PullreqUpdateInput,
1348) -> Result<models::PullreqModel, Error<PatchPullreqError>> {
1349 let p_path_repo_ref = repo_ref;
1351 let p_path_pullreq_number = pullreq_number;
1352 let p_body_pullreq_update_input = pullreq_update_input;
1353
1354 let uri_str = format!(
1355 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}",
1356 configuration.base_path,
1357 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1358 pullreq_number = p_path_pullreq_number
1359 );
1360 let mut req_builder = configuration
1361 .client
1362 .request(reqwest::Method::PATCH, &uri_str);
1363
1364 if let Some(ref apikey) = configuration.api_key {
1365 let key = apikey.key.clone();
1366 let value = match apikey.prefix {
1367 Some(ref prefix) => format!("{} {}", prefix, key),
1368 None => key,
1369 };
1370 req_builder = req_builder.query(&[("access_token", value)]);
1371 }
1372 if let Some(ref user_agent) = configuration.user_agent {
1373 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1374 }
1375 if let Some(ref auth_conf) = configuration.basic_auth {
1376 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1377 };
1378 if let Some(ref token) = configuration.bearer_access_token {
1379 req_builder = req_builder.bearer_auth(token.to_owned());
1380 };
1381 req_builder = req_builder.json(&p_body_pullreq_update_input);
1382
1383 let req = req_builder.build()?;
1384 let resp = configuration.client.execute(req).await?;
1385
1386 let status = resp.status();
1387 let content_type = resp
1388 .headers()
1389 .get("content-type")
1390 .and_then(|v| v.to_str().ok())
1391 .unwrap_or("application/octet-stream");
1392 let content_type = super::ContentType::from(content_type);
1393
1394 if !status.is_client_error() && !status.is_server_error() {
1395 let content = resp.text().await?;
1396 match content_type {
1397 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1398 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqModel`"))),
1399 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqModel`")))),
1400 }
1401 } else {
1402 let content = resp.text().await?;
1403 let entity: Option<PatchPullreqError> = serde_json::from_str(&content).ok();
1404 Err(Error::ResponseError(ResponseContent {
1405 status,
1406 content,
1407 entity,
1408 }))
1409 }
1410}
1411
1412pub async fn post_apply_suggestions(
1413 configuration: &configuration::Configuration,
1414 repo_ref: &str,
1415 pullreq_number: i64,
1416 pullreq_apply_suggestions_input: models::PullreqApplySuggestionsInput,
1417) -> Result<models::PullreqApplySuggestionsOutput, Error<PostApplySuggestionsError>> {
1418 let p_path_repo_ref = repo_ref;
1420 let p_path_pullreq_number = pullreq_number;
1421 let p_body_pullreq_apply_suggestions_input = pullreq_apply_suggestions_input;
1422
1423 let uri_str = format!(
1424 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/comments/apply-suggestions",
1425 configuration.base_path,
1426 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1427 pullreq_number = p_path_pullreq_number
1428 );
1429 let mut req_builder = configuration
1430 .client
1431 .request(reqwest::Method::POST, &uri_str);
1432
1433 if let Some(ref apikey) = configuration.api_key {
1434 let key = apikey.key.clone();
1435 let value = match apikey.prefix {
1436 Some(ref prefix) => format!("{} {}", prefix, key),
1437 None => key,
1438 };
1439 req_builder = req_builder.query(&[("access_token", value)]);
1440 }
1441 if let Some(ref user_agent) = configuration.user_agent {
1442 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1443 }
1444 if let Some(ref auth_conf) = configuration.basic_auth {
1445 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1446 };
1447 if let Some(ref token) = configuration.bearer_access_token {
1448 req_builder = req_builder.bearer_auth(token.to_owned());
1449 };
1450 req_builder = req_builder.json(&p_body_pullreq_apply_suggestions_input);
1451
1452 let req = req_builder.build()?;
1453 let resp = configuration.client.execute(req).await?;
1454
1455 let status = resp.status();
1456 let content_type = resp
1457 .headers()
1458 .get("content-type")
1459 .and_then(|v| v.to_str().ok())
1460 .unwrap_or("application/octet-stream");
1461 let content_type = super::ContentType::from(content_type);
1462
1463 if !status.is_client_error() && !status.is_server_error() {
1464 let content = resp.text().await?;
1465 match content_type {
1466 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1467 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqApplySuggestionsOutput`"))),
1468 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqApplySuggestionsOutput`")))),
1469 }
1470 } else {
1471 let content = resp.text().await?;
1472 let entity: Option<PostApplySuggestionsError> = serde_json::from_str(&content).ok();
1473 Err(Error::ResponseError(ResponseContent {
1474 status,
1475 content,
1476 entity,
1477 }))
1478 }
1479}
1480
1481pub async fn post_comment(
1482 configuration: &configuration::Configuration,
1483 repo_ref: &str,
1484 pullreq_number: i64,
1485 pullreq_comment_create_input: models::PullreqCommentCreateInput,
1486) -> Result<models::PullreqActivityModel, Error<PostCommentError>> {
1487 let p_path_repo_ref = repo_ref;
1489 let p_path_pullreq_number = pullreq_number;
1490 let p_body_pullreq_comment_create_input = pullreq_comment_create_input;
1491
1492 let uri_str = format!(
1493 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/comments",
1494 configuration.base_path,
1495 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1496 pullreq_number = p_path_pullreq_number
1497 );
1498 let mut req_builder = configuration
1499 .client
1500 .request(reqwest::Method::POST, &uri_str);
1501
1502 if let Some(ref apikey) = configuration.api_key {
1503 let key = apikey.key.clone();
1504 let value = match apikey.prefix {
1505 Some(ref prefix) => format!("{} {}", prefix, key),
1506 None => key,
1507 };
1508 req_builder = req_builder.query(&[("access_token", value)]);
1509 }
1510 if let Some(ref user_agent) = configuration.user_agent {
1511 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1512 }
1513 if let Some(ref auth_conf) = configuration.basic_auth {
1514 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1515 };
1516 if let Some(ref token) = configuration.bearer_access_token {
1517 req_builder = req_builder.bearer_auth(token.to_owned());
1518 };
1519 req_builder = req_builder.json(&p_body_pullreq_comment_create_input);
1520
1521 let req = req_builder.build()?;
1522 let resp = configuration.client.execute(req).await?;
1523
1524 let status = resp.status();
1525 let content_type = resp
1526 .headers()
1527 .get("content-type")
1528 .and_then(|v| v.to_str().ok())
1529 .unwrap_or("application/octet-stream");
1530 let content_type = super::ContentType::from(content_type);
1531
1532 if !status.is_client_error() && !status.is_server_error() {
1533 let content = resp.text().await?;
1534 match content_type {
1535 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1536 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqActivityModel`"))),
1537 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqActivityModel`")))),
1538 }
1539 } else {
1540 let content = resp.text().await?;
1541 let entity: Option<PostCommentError> = serde_json::from_str(&content).ok();
1542 Err(Error::ResponseError(ResponseContent {
1543 status,
1544 content,
1545 entity,
1546 }))
1547 }
1548}
1549
1550pub async fn post_diff(
1551 configuration: &configuration::Configuration,
1552 repo_ref: &str,
1553 pullreq_number: i64,
1554 commit_diff_file: Vec<models::CommitDiffFile>,
1555) -> Result<Vec<i32>, Error<PostDiffError>> {
1556 let p_path_repo_ref = repo_ref;
1558 let p_path_pullreq_number = pullreq_number;
1559 let p_body_commit_diff_file = commit_diff_file;
1560
1561 let uri_str = format!(
1562 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/diff",
1563 configuration.base_path,
1564 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1565 pullreq_number = p_path_pullreq_number
1566 );
1567 let mut req_builder = configuration
1568 .client
1569 .request(reqwest::Method::POST, &uri_str);
1570
1571 if let Some(ref apikey) = configuration.api_key {
1572 let key = apikey.key.clone();
1573 let value = match apikey.prefix {
1574 Some(ref prefix) => format!("{} {}", prefix, key),
1575 None => key,
1576 };
1577 req_builder = req_builder.query(&[("access_token", value)]);
1578 }
1579 if let Some(ref user_agent) = configuration.user_agent {
1580 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1581 }
1582 if let Some(ref auth_conf) = configuration.basic_auth {
1583 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1584 };
1585 if let Some(ref token) = configuration.bearer_access_token {
1586 req_builder = req_builder.bearer_auth(token.to_owned());
1587 };
1588 req_builder = req_builder.json(&p_body_commit_diff_file);
1589
1590 let req = req_builder.build()?;
1591 let resp = configuration.client.execute(req).await?;
1592
1593 let status = resp.status();
1594 let content_type = resp
1595 .headers()
1596 .get("content-type")
1597 .and_then(|v| v.to_str().ok())
1598 .unwrap_or("application/octet-stream");
1599 let content_type = super::ContentType::from(content_type);
1600
1601 if !status.is_client_error() && !status.is_server_error() {
1602 let content = resp.text().await?;
1603 match content_type {
1604 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1605 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<i32>`"))),
1606 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<i32>`")))),
1607 }
1608 } else {
1609 let content = resp.text().await?;
1610 let entity: Option<PostDiffError> = serde_json::from_str(&content).ok();
1611 Err(Error::ResponseError(ResponseContent {
1612 status,
1613 content,
1614 entity,
1615 }))
1616 }
1617}
1618
1619pub async fn post_merge(
1620 configuration: &configuration::Configuration,
1621 repo_ref: &str,
1622 pullreq_number: i64,
1623 pullreq_merge_input: models::PullreqMergeInput,
1624) -> Result<models::PullreqMergeOutput, Error<PostMergeError>> {
1625 let p_path_repo_ref = repo_ref;
1627 let p_path_pullreq_number = pullreq_number;
1628 let p_body_pullreq_merge_input = pullreq_merge_input;
1629
1630 let uri_str = format!(
1631 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/merge",
1632 configuration.base_path,
1633 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1634 pullreq_number = p_path_pullreq_number
1635 );
1636 let mut req_builder = configuration
1637 .client
1638 .request(reqwest::Method::POST, &uri_str);
1639
1640 if let Some(ref apikey) = configuration.api_key {
1641 let key = apikey.key.clone();
1642 let value = match apikey.prefix {
1643 Some(ref prefix) => format!("{} {}", prefix, key),
1644 None => key,
1645 };
1646 req_builder = req_builder.query(&[("access_token", value)]);
1647 }
1648 if let Some(ref user_agent) = configuration.user_agent {
1649 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1650 }
1651 if let Some(ref auth_conf) = configuration.basic_auth {
1652 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1653 };
1654 if let Some(ref token) = configuration.bearer_access_token {
1655 req_builder = req_builder.bearer_auth(token.to_owned());
1656 };
1657 req_builder = req_builder.json(&p_body_pullreq_merge_input);
1658
1659 let req = req_builder.build()?;
1660 let resp = configuration.client.execute(req).await?;
1661
1662 let status = resp.status();
1663 let content_type = resp
1664 .headers()
1665 .get("content-type")
1666 .and_then(|v| v.to_str().ok())
1667 .unwrap_or("application/octet-stream");
1668 let content_type = super::ContentType::from(content_type);
1669
1670 if !status.is_client_error() && !status.is_server_error() {
1671 let content = resp.text().await?;
1672 match content_type {
1673 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1674 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqMergeOutput`"))),
1675 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqMergeOutput`")))),
1676 }
1677 } else {
1678 let content = resp.text().await?;
1679 let entity: Option<PostMergeError> = serde_json::from_str(&content).ok();
1680 Err(Error::ResponseError(ResponseContent {
1681 status,
1682 content,
1683 entity,
1684 }))
1685 }
1686}
1687
1688pub async fn post_pullreq(
1689 configuration: &configuration::Configuration,
1690 repo_ref: &str,
1691 pullreq_create_input: models::PullreqCreateInput,
1692) -> Result<models::PullreqModel, Error<PostPullreqError>> {
1693 let p_path_repo_ref = repo_ref;
1695 let p_body_pullreq_create_input = pullreq_create_input;
1696
1697 let uri_str = format!(
1698 "{}/repos/{repo_ref}/+/pullreq",
1699 configuration.base_path,
1700 repo_ref = crate::apis::urlencode(p_path_repo_ref)
1701 );
1702 let mut req_builder = configuration
1703 .client
1704 .request(reqwest::Method::POST, &uri_str);
1705
1706 if let Some(ref apikey) = configuration.api_key {
1707 let key = apikey.key.clone();
1708 let value = match apikey.prefix {
1709 Some(ref prefix) => format!("{} {}", prefix, key),
1710 None => key,
1711 };
1712 req_builder = req_builder.query(&[("access_token", value)]);
1713 }
1714 if let Some(ref user_agent) = configuration.user_agent {
1715 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1716 }
1717 if let Some(ref auth_conf) = configuration.basic_auth {
1718 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1719 };
1720 if let Some(ref token) = configuration.bearer_access_token {
1721 req_builder = req_builder.bearer_auth(token.to_owned());
1722 };
1723 req_builder = req_builder.json(&p_body_pullreq_create_input);
1724
1725 let req = req_builder.build()?;
1726 let resp = configuration.client.execute(req).await?;
1727
1728 let status = resp.status();
1729 let content_type = resp
1730 .headers()
1731 .get("content-type")
1732 .and_then(|v| v.to_str().ok())
1733 .unwrap_or("application/octet-stream");
1734 let content_type = super::ContentType::from(content_type);
1735
1736 if !status.is_client_error() && !status.is_server_error() {
1737 let content = resp.text().await?;
1738 match content_type {
1739 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1740 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqModel`"))),
1741 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqModel`")))),
1742 }
1743 } else {
1744 let content = resp.text().await?;
1745 let entity: Option<PostPullreqError> = serde_json::from_str(&content).ok();
1746 Err(Error::ResponseError(ResponseContent {
1747 status,
1748 content,
1749 entity,
1750 }))
1751 }
1752}
1753
1754pub async fn post_reviews(
1755 configuration: &configuration::Configuration,
1756 repo_ref: &str,
1757 pullreq_number: i64,
1758 pullreq_review_submit_input: models::PullreqReviewSubmitInput,
1759) -> Result<models::PullreqReviewModel, Error<PostReviewsError>> {
1760 let p_path_repo_ref = repo_ref;
1762 let p_path_pullreq_number = pullreq_number;
1763 let p_body_pullreq_review_submit_input = pullreq_review_submit_input;
1764
1765 let uri_str = format!(
1766 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/reviews",
1767 configuration.base_path,
1768 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1769 pullreq_number = p_path_pullreq_number
1770 );
1771 let mut req_builder = configuration
1772 .client
1773 .request(reqwest::Method::POST, &uri_str);
1774
1775 if let Some(ref apikey) = configuration.api_key {
1776 let key = apikey.key.clone();
1777 let value = match apikey.prefix {
1778 Some(ref prefix) => format!("{} {}", prefix, key),
1779 None => key,
1780 };
1781 req_builder = req_builder.query(&[("access_token", value)]);
1782 }
1783 if let Some(ref user_agent) = configuration.user_agent {
1784 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1785 }
1786 if let Some(ref auth_conf) = configuration.basic_auth {
1787 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1788 };
1789 if let Some(ref token) = configuration.bearer_access_token {
1790 req_builder = req_builder.bearer_auth(token.to_owned());
1791 };
1792 req_builder = req_builder.json(&p_body_pullreq_review_submit_input);
1793
1794 let req = req_builder.build()?;
1795 let resp = configuration.client.execute(req).await?;
1796
1797 let status = resp.status();
1798 let content_type = resp
1799 .headers()
1800 .get("content-type")
1801 .and_then(|v| v.to_str().ok())
1802 .unwrap_or("application/octet-stream");
1803 let content_type = super::ContentType::from(content_type);
1804
1805 if !status.is_client_error() && !status.is_server_error() {
1806 let content = resp.text().await?;
1807 match content_type {
1808 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1809 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqReviewModel`"))),
1810 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqReviewModel`")))),
1811 }
1812 } else {
1813 let content = resp.text().await?;
1814 let entity: Option<PostReviewsError> = serde_json::from_str(&content).ok();
1815 Err(Error::ResponseError(ResponseContent {
1816 status,
1817 content,
1818 entity,
1819 }))
1820 }
1821}
1822
1823pub async fn post_state(
1824 configuration: &configuration::Configuration,
1825 repo_ref: &str,
1826 pullreq_number: i64,
1827 pullreq_state_update_input: models::PullreqStateUpdateInput,
1828) -> Result<models::PullreqModel, Error<PostStateError>> {
1829 let p_path_repo_ref = repo_ref;
1831 let p_path_pullreq_number = pullreq_number;
1832 let p_body_pullreq_state_update_input = pullreq_state_update_input;
1833
1834 let uri_str = format!(
1835 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/state",
1836 configuration.base_path,
1837 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1838 pullreq_number = p_path_pullreq_number
1839 );
1840 let mut req_builder = configuration
1841 .client
1842 .request(reqwest::Method::POST, &uri_str);
1843
1844 if let Some(ref apikey) = configuration.api_key {
1845 let key = apikey.key.clone();
1846 let value = match apikey.prefix {
1847 Some(ref prefix) => format!("{} {}", prefix, key),
1848 None => key,
1849 };
1850 req_builder = req_builder.query(&[("access_token", value)]);
1851 }
1852 if let Some(ref user_agent) = configuration.user_agent {
1853 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1854 }
1855 if let Some(ref auth_conf) = configuration.basic_auth {
1856 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1857 };
1858 if let Some(ref token) = configuration.bearer_access_token {
1859 req_builder = req_builder.bearer_auth(token.to_owned());
1860 };
1861 req_builder = req_builder.json(&p_body_pullreq_state_update_input);
1862
1863 let req = req_builder.build()?;
1864 let resp = configuration.client.execute(req).await?;
1865
1866 let status = resp.status();
1867 let content_type = resp
1868 .headers()
1869 .get("content-type")
1870 .and_then(|v| v.to_str().ok())
1871 .unwrap_or("application/octet-stream");
1872 let content_type = super::ContentType::from(content_type);
1873
1874 if !status.is_client_error() && !status.is_server_error() {
1875 let content = resp.text().await?;
1876 match content_type {
1877 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1878 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqModel`"))),
1879 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqModel`")))),
1880 }
1881 } else {
1882 let content = resp.text().await?;
1883 let entity: Option<PostStateError> = serde_json::from_str(&content).ok();
1884 Err(Error::ResponseError(ResponseContent {
1885 status,
1886 content,
1887 entity,
1888 }))
1889 }
1890}
1891
1892pub async fn put_comment_status(
1893 configuration: &configuration::Configuration,
1894 repo_ref: &str,
1895 pullreq_number: i64,
1896 pullreq_comment_id: i64,
1897 pullreq_comment_status_input: models::PullreqCommentStatusInput,
1898) -> Result<models::PullreqActivityModel, Error<PutCommentStatusError>> {
1899 let p_path_repo_ref = repo_ref;
1901 let p_path_pullreq_number = pullreq_number;
1902 let p_path_pullreq_comment_id = pullreq_comment_id;
1903 let p_body_pullreq_comment_status_input = pullreq_comment_status_input;
1904
1905 let uri_str = format!(
1906 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/comments/{pullreq_comment_id}/status",
1907 configuration.base_path,
1908 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1909 pullreq_number = p_path_pullreq_number,
1910 pullreq_comment_id = p_path_pullreq_comment_id
1911 );
1912 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1913
1914 if let Some(ref apikey) = configuration.api_key {
1915 let key = apikey.key.clone();
1916 let value = match apikey.prefix {
1917 Some(ref prefix) => format!("{} {}", prefix, key),
1918 None => key,
1919 };
1920 req_builder = req_builder.query(&[("access_token", value)]);
1921 }
1922 if let Some(ref user_agent) = configuration.user_agent {
1923 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1924 }
1925 if let Some(ref auth_conf) = configuration.basic_auth {
1926 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1927 };
1928 if let Some(ref token) = configuration.bearer_access_token {
1929 req_builder = req_builder.bearer_auth(token.to_owned());
1930 };
1931 req_builder = req_builder.json(&p_body_pullreq_comment_status_input);
1932
1933 let req = req_builder.build()?;
1934 let resp = configuration.client.execute(req).await?;
1935
1936 let status = resp.status();
1937 let content_type = resp
1938 .headers()
1939 .get("content-type")
1940 .and_then(|v| v.to_str().ok())
1941 .unwrap_or("application/octet-stream");
1942 let content_type = super::ContentType::from(content_type);
1943
1944 if !status.is_client_error() && !status.is_server_error() {
1945 let content = resp.text().await?;
1946 match content_type {
1947 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1948 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqActivityModel`"))),
1949 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqActivityModel`")))),
1950 }
1951 } else {
1952 let content = resp.text().await?;
1953 let entity: Option<PutCommentStatusError> = serde_json::from_str(&content).ok();
1954 Err(Error::ResponseError(ResponseContent {
1955 status,
1956 content,
1957 entity,
1958 }))
1959 }
1960}
1961
1962pub async fn put_file_views(
1963 configuration: &configuration::Configuration,
1964 repo_ref: &str,
1965 pullreq_number: i64,
1966 pullreq_file_view_create_input: models::PullreqFileViewCreateInput,
1967) -> Result<models::PullreqFileViewModel, Error<PutFileViewsError>> {
1968 let p_path_repo_ref = repo_ref;
1970 let p_path_pullreq_number = pullreq_number;
1971 let p_body_pullreq_file_view_create_input = pullreq_file_view_create_input;
1972
1973 let uri_str = format!(
1974 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/file-views",
1975 configuration.base_path,
1976 repo_ref = crate::apis::urlencode(p_path_repo_ref),
1977 pullreq_number = p_path_pullreq_number
1978 );
1979 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1980
1981 if let Some(ref apikey) = configuration.api_key {
1982 let key = apikey.key.clone();
1983 let value = match apikey.prefix {
1984 Some(ref prefix) => format!("{} {}", prefix, key),
1985 None => key,
1986 };
1987 req_builder = req_builder.query(&[("access_token", value)]);
1988 }
1989 if let Some(ref user_agent) = configuration.user_agent {
1990 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1991 }
1992 if let Some(ref auth_conf) = configuration.basic_auth {
1993 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1994 };
1995 if let Some(ref token) = configuration.bearer_access_token {
1996 req_builder = req_builder.bearer_auth(token.to_owned());
1997 };
1998 req_builder = req_builder.json(&p_body_pullreq_file_view_create_input);
1999
2000 let req = req_builder.build()?;
2001 let resp = configuration.client.execute(req).await?;
2002
2003 let status = resp.status();
2004 let content_type = resp
2005 .headers()
2006 .get("content-type")
2007 .and_then(|v| v.to_str().ok())
2008 .unwrap_or("application/octet-stream");
2009 let content_type = super::ContentType::from(content_type);
2010
2011 if !status.is_client_error() && !status.is_server_error() {
2012 let content = resp.text().await?;
2013 match content_type {
2014 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2015 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqFileViewModel`"))),
2016 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqFileViewModel`")))),
2017 }
2018 } else {
2019 let content = resp.text().await?;
2020 let entity: Option<PutFileViewsError> = serde_json::from_str(&content).ok();
2021 Err(Error::ResponseError(ResponseContent {
2022 status,
2023 content,
2024 entity,
2025 }))
2026 }
2027}
2028
2029pub async fn put_reviewer(
2030 configuration: &configuration::Configuration,
2031 repo_ref: &str,
2032 pullreq_number: i64,
2033 pullreq_reviewer_add_input: models::PullreqReviewerAddInput,
2034) -> Result<models::PullreqReviewerUser, Error<PutReviewerError>> {
2035 let p_path_repo_ref = repo_ref;
2037 let p_path_pullreq_number = pullreq_number;
2038 let p_body_pullreq_reviewer_add_input = pullreq_reviewer_add_input;
2039
2040 let uri_str = format!(
2041 "{}/repos/{repo_ref}/+/pullreq/{pullreq_number}/reviewers",
2042 configuration.base_path,
2043 repo_ref = crate::apis::urlencode(p_path_repo_ref),
2044 pullreq_number = p_path_pullreq_number
2045 );
2046 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2047
2048 if let Some(ref apikey) = configuration.api_key {
2049 let key = apikey.key.clone();
2050 let value = match apikey.prefix {
2051 Some(ref prefix) => format!("{} {}", prefix, key),
2052 None => key,
2053 };
2054 req_builder = req_builder.query(&[("access_token", value)]);
2055 }
2056 if let Some(ref user_agent) = configuration.user_agent {
2057 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2058 }
2059 if let Some(ref auth_conf) = configuration.basic_auth {
2060 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
2061 };
2062 if let Some(ref token) = configuration.bearer_access_token {
2063 req_builder = req_builder.bearer_auth(token.to_owned());
2064 };
2065 req_builder = req_builder.json(&p_body_pullreq_reviewer_add_input);
2066
2067 let req = req_builder.build()?;
2068 let resp = configuration.client.execute(req).await?;
2069
2070 let status = resp.status();
2071 let content_type = resp
2072 .headers()
2073 .get("content-type")
2074 .and_then(|v| v.to_str().ok())
2075 .unwrap_or("application/octet-stream");
2076 let content_type = super::ContentType::from(content_type);
2077
2078 if !status.is_client_error() && !status.is_server_error() {
2079 let content = resp.text().await?;
2080 match content_type {
2081 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2082 ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PullreqReviewerUser`"))),
2083 ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PullreqReviewerUser`")))),
2084 }
2085 } else {
2086 let content = resp.text().await?;
2087 let entity: Option<PutReviewerError> = serde_json::from_str(&content).ok();
2088 Err(Error::ResponseError(ResponseContent {
2089 status,
2090 content,
2091 entity,
2092 }))
2093 }
2094}