1#![allow(unused_mut)]
4#![allow(unused_variables)]
5#![allow(unused_imports)]
6#![allow(clippy::redundant_clone)]
7#![allow(clippy::too_many_arguments)]
8#![allow(clippy::module_inception)]
9pub mod models;
10#[derive(Clone)]
11pub struct Client {
12 endpoint: azure_core::http::Url,
13 credential: crate::Credential,
14 scopes: Vec<String>,
15 pipeline: azure_core::http::Pipeline,
16}
17#[derive(Clone)]
18pub struct ClientBuilder {
19 credential: crate::Credential,
20 endpoint: Option<azure_core::http::Url>,
21 scopes: Option<Vec<String>>,
22 options: azure_core::http::ClientOptions,
23}
24azure_core::static_url!(DEFAULT_ENDPOINT, "https://dev.azure.com");
25impl ClientBuilder {
26 #[doc = "Create a new instance of `ClientBuilder`."]
27 #[must_use]
28 pub fn new(credential: crate::Credential) -> Self {
29 Self {
30 credential,
31 endpoint: None,
32 scopes: None,
33 options: azure_core::http::ClientOptions::default(),
34 }
35 }
36 #[doc = "Set the endpoint."]
37 #[must_use]
38 pub fn endpoint(mut self, endpoint: impl Into<azure_core::http::Url>) -> Self {
39 self.endpoint = Some(endpoint.into());
40 self
41 }
42 #[doc = "Set the scopes."]
43 #[must_use]
44 pub fn scopes(mut self, scopes: &[&str]) -> Self {
45 self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
46 self
47 }
48 #[doc = "Set the retry options."]
49 #[must_use]
50 pub fn retry(mut self, retry: impl Into<azure_core::http::RetryOptions>) -> Self {
51 self.options.retry = Some(retry.into());
52 self
53 }
54 #[doc = "Set the transport options."]
55 #[must_use]
56 pub fn transport(mut self, transport: impl Into<azure_core::http::TransportOptions>) -> Self {
57 self.options.transport = Some(transport.into());
58 self
59 }
60 #[doc = "Set per-call policies."]
61 #[must_use]
62 pub fn per_call_policies(
63 mut self,
64 policies: impl Into<Vec<std::sync::Arc<dyn azure_core::http::policies::Policy>>>,
65 ) -> Self {
66 self.options.per_call_policies = policies.into();
67 self
68 }
69 #[doc = "Set per-try policies."]
70 #[must_use]
71 pub fn per_try_policies(
72 mut self,
73 policies: impl Into<Vec<std::sync::Arc<dyn azure_core::http::policies::Policy>>>,
74 ) -> Self {
75 self.options.per_try_policies = policies.into();
76 self
77 }
78 #[doc = "Convert the builder into a `Client` instance."]
79 pub fn build(self) -> Client {
80 let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
81 let scopes = self
82 .scopes
83 .unwrap_or_else(|| vec![crate::ADO_SCOPE.to_string()]);
84 Client::new(endpoint, self.credential, scopes, self.options)
85 }
86}
87impl Client {
88 pub(crate) fn endpoint(&self) -> &azure_core::http::Url {
89 &self.endpoint
90 }
91 pub(crate) fn token_credential(&self) -> &crate::Credential {
92 &self.credential
93 }
94 pub(crate) fn scopes(&self) -> Vec<&str> {
95 self.scopes.iter().map(String::as_str).collect()
96 }
97 pub(crate) async fn send(
98 &self,
99 request: &mut azure_core::http::Request,
100 ) -> azure_core::Result<azure_core::http::Response> {
101 let context = azure_core::http::Context::default();
102 self.pipeline.send(&context, request).await
103 }
104 #[doc = "Create a new `ClientBuilder`."]
105 #[must_use]
106 pub fn builder(credential: crate::Credential) -> ClientBuilder {
107 ClientBuilder::new(credential)
108 }
109 #[doc = "Create a new `Client`."]
110 #[must_use]
111 pub fn new(
112 endpoint: impl Into<azure_core::http::Url>,
113 credential: crate::Credential,
114 scopes: Vec<String>,
115 options: azure_core::http::ClientOptions,
116 ) -> Self {
117 let endpoint = endpoint.into();
118 let pipeline = azure_core::http::Pipeline::new(
119 option_env!("CARGO_PKG_NAME"),
120 option_env!("CARGO_PKG_VERSION"),
121 options,
122 Vec::new(),
123 Vec::new(),
124 );
125 Self {
126 endpoint,
127 credential,
128 scopes,
129 pipeline,
130 }
131 }
132 pub fn annotated_tags_client(&self) -> annotated_tags::Client {
133 annotated_tags::Client(self.clone())
134 }
135 pub fn blobs_client(&self) -> blobs::Client {
136 blobs::Client(self.clone())
137 }
138 pub fn cherry_picks_client(&self) -> cherry_picks::Client {
139 cherry_picks::Client(self.clone())
140 }
141 pub fn commits_client(&self) -> commits::Client {
142 commits::Client(self.clone())
143 }
144 pub fn diffs_client(&self) -> diffs::Client {
145 diffs::Client(self.clone())
146 }
147 pub fn forks_client(&self) -> forks::Client {
148 forks::Client(self.clone())
149 }
150 pub fn import_requests_client(&self) -> import_requests::Client {
151 import_requests::Client(self.clone())
152 }
153 pub fn items_client(&self) -> items::Client {
154 items::Client(self.clone())
155 }
156 pub fn merge_bases_client(&self) -> merge_bases::Client {
157 merge_bases::Client(self.clone())
158 }
159 pub fn merges_client(&self) -> merges::Client {
160 merges::Client(self.clone())
161 }
162 pub fn policy_configurations_client(&self) -> policy_configurations::Client {
163 policy_configurations::Client(self.clone())
164 }
165 pub fn pull_request_attachments_client(&self) -> pull_request_attachments::Client {
166 pull_request_attachments::Client(self.clone())
167 }
168 pub fn pull_request_comment_likes_client(&self) -> pull_request_comment_likes::Client {
169 pull_request_comment_likes::Client(self.clone())
170 }
171 pub fn pull_request_commits_client(&self) -> pull_request_commits::Client {
172 pull_request_commits::Client(self.clone())
173 }
174 pub fn pull_request_iteration_changes_client(&self) -> pull_request_iteration_changes::Client {
175 pull_request_iteration_changes::Client(self.clone())
176 }
177 pub fn pull_request_iteration_statuses_client(
178 &self,
179 ) -> pull_request_iteration_statuses::Client {
180 pull_request_iteration_statuses::Client(self.clone())
181 }
182 pub fn pull_request_iterations_client(&self) -> pull_request_iterations::Client {
183 pull_request_iterations::Client(self.clone())
184 }
185 pub fn pull_request_labels_client(&self) -> pull_request_labels::Client {
186 pull_request_labels::Client(self.clone())
187 }
188 pub fn pull_request_properties_client(&self) -> pull_request_properties::Client {
189 pull_request_properties::Client(self.clone())
190 }
191 pub fn pull_request_query_client(&self) -> pull_request_query::Client {
192 pull_request_query::Client(self.clone())
193 }
194 pub fn pull_request_reviewers_client(&self) -> pull_request_reviewers::Client {
195 pull_request_reviewers::Client(self.clone())
196 }
197 pub fn pull_request_share_client(&self) -> pull_request_share::Client {
198 pull_request_share::Client(self.clone())
199 }
200 pub fn pull_request_statuses_client(&self) -> pull_request_statuses::Client {
201 pull_request_statuses::Client(self.clone())
202 }
203 pub fn pull_request_thread_comments_client(&self) -> pull_request_thread_comments::Client {
204 pull_request_thread_comments::Client(self.clone())
205 }
206 pub fn pull_request_threads_client(&self) -> pull_request_threads::Client {
207 pull_request_threads::Client(self.clone())
208 }
209 pub fn pull_request_work_items_client(&self) -> pull_request_work_items::Client {
210 pull_request_work_items::Client(self.clone())
211 }
212 pub fn pull_requests_client(&self) -> pull_requests::Client {
213 pull_requests::Client(self.clone())
214 }
215 pub fn pushes_client(&self) -> pushes::Client {
216 pushes::Client(self.clone())
217 }
218 pub fn refs_client(&self) -> refs::Client {
219 refs::Client(self.clone())
220 }
221 pub fn refs_favorites_client(&self) -> refs_favorites::Client {
222 refs_favorites::Client(self.clone())
223 }
224 pub fn repositories_client(&self) -> repositories::Client {
225 repositories::Client(self.clone())
226 }
227 pub fn reverts_client(&self) -> reverts::Client {
228 reverts::Client(self.clone())
229 }
230 pub fn stats_client(&self) -> stats::Client {
231 stats::Client(self.clone())
232 }
233 pub fn statuses_client(&self) -> statuses::Client {
234 statuses::Client(self.clone())
235 }
236 pub fn suggestions_client(&self) -> suggestions::Client {
237 suggestions::Client(self.clone())
238 }
239 pub fn trees_client(&self) -> trees::Client {
240 trees::Client(self.clone())
241 }
242}
243pub mod repositories {
244 use super::models;
245 #[cfg(not(target_arch = "wasm32"))]
246 use futures::future::BoxFuture;
247 #[cfg(target_arch = "wasm32")]
248 use futures::future::LocalBoxFuture as BoxFuture;
249 pub struct Client(pub(crate) super::Client);
250 impl Client {
251 #[doc = "Retrieve a git repository."]
252 #[doc = ""]
253 #[doc = "Arguments:"]
254 #[doc = "* `organization`: The name of the Azure DevOps organization."]
255 #[doc = "* `repository_id`: The name or ID of the repository."]
256 #[doc = "* `include_parent`: Set to true to include parent repository. Only available in authenticated calls."]
257 #[doc = "* `project`: Project ID or project name"]
258 pub fn get_repository_with_parent(
259 &self,
260 organization: impl Into<String>,
261 repository_id: impl Into<String>,
262 include_parent: bool,
263 project: impl Into<String>,
264 ) -> get_repository_with_parent::RequestBuilder {
265 get_repository_with_parent::RequestBuilder {
266 client: self.0.clone(),
267 organization: organization.into(),
268 repository_id: repository_id.into(),
269 include_parent,
270 project: project.into(),
271 }
272 }
273 #[doc = "Retrieve deleted git repositories."]
274 #[doc = ""]
275 #[doc = "Arguments:"]
276 #[doc = "* `organization`: The name of the Azure DevOps organization."]
277 #[doc = "* `project`: Project ID or project name"]
278 pub fn get_deleted_repositories(
279 &self,
280 organization: impl Into<String>,
281 project: impl Into<String>,
282 ) -> get_deleted_repositories::RequestBuilder {
283 get_deleted_repositories::RequestBuilder {
284 client: self.0.clone(),
285 organization: organization.into(),
286 project: project.into(),
287 }
288 }
289 #[doc = "Retrieve soft-deleted git repositories from the recycle bin."]
290 #[doc = ""]
291 #[doc = "Arguments:"]
292 #[doc = "* `organization`: The name of the Azure DevOps organization."]
293 #[doc = "* `project`: Project ID or project name"]
294 pub fn get_recycle_bin_repositories(
295 &self,
296 organization: impl Into<String>,
297 project: impl Into<String>,
298 ) -> get_recycle_bin_repositories::RequestBuilder {
299 get_recycle_bin_repositories::RequestBuilder {
300 client: self.0.clone(),
301 organization: organization.into(),
302 project: project.into(),
303 }
304 }
305 #[doc = "Recover a soft-deleted Git repository. Recently deleted repositories go into a soft-delete state for a period of time before they are hard deleted and become unrecoverable."]
306 #[doc = ""]
307 #[doc = "Arguments:"]
308 #[doc = "* `organization`: The name of the Azure DevOps organization."]
309 #[doc = "* `project`: Project ID or project name"]
310 #[doc = "* `repository_id`: The ID of the repository."]
311 pub fn restore_repository_from_recycle_bin(
312 &self,
313 organization: impl Into<String>,
314 body: impl Into<models::GitRecycleBinRepositoryDetails>,
315 project: impl Into<String>,
316 repository_id: impl Into<String>,
317 ) -> restore_repository_from_recycle_bin::RequestBuilder {
318 restore_repository_from_recycle_bin::RequestBuilder {
319 client: self.0.clone(),
320 organization: organization.into(),
321 body: body.into(),
322 project: project.into(),
323 repository_id: repository_id.into(),
324 }
325 }
326 #[doc = "Destroy (hard delete) a soft-deleted Git repository."]
327 #[doc = ""]
328 #[doc = "Arguments:"]
329 #[doc = "* `organization`: The name of the Azure DevOps organization."]
330 #[doc = "* `project`: Project ID or project name"]
331 #[doc = "* `repository_id`: The ID of the repository."]
332 pub fn delete_repository_from_recycle_bin(
333 &self,
334 organization: impl Into<String>,
335 project: impl Into<String>,
336 repository_id: impl Into<String>,
337 ) -> delete_repository_from_recycle_bin::RequestBuilder {
338 delete_repository_from_recycle_bin::RequestBuilder {
339 client: self.0.clone(),
340 organization: organization.into(),
341 project: project.into(),
342 repository_id: repository_id.into(),
343 }
344 }
345 #[doc = "Retrieve git repositories."]
346 #[doc = ""]
347 #[doc = "Arguments:"]
348 #[doc = "* `organization`: The name of the Azure DevOps organization."]
349 #[doc = "* `project`: Project ID or project name"]
350 pub fn list(
351 &self,
352 organization: impl Into<String>,
353 project: impl Into<String>,
354 ) -> list::RequestBuilder {
355 list::RequestBuilder {
356 client: self.0.clone(),
357 organization: organization.into(),
358 project: project.into(),
359 include_links: None,
360 include_all_urls: None,
361 include_hidden: None,
362 }
363 }
364 #[doc = "Create a git repository in a team project."]
365 #[doc = ""]
366 #[doc = "Arguments:"]
367 #[doc = "* `organization`: The name of the Azure DevOps organization."]
368 #[doc = "* `body`: Specify the repo name, team project and/or parent repository. Team project information can be omitted from gitRepositoryToCreate if the request is project-scoped (i.e., includes project Id)."]
369 #[doc = "* `project`: Project ID or project name"]
370 pub fn create(
371 &self,
372 organization: impl Into<String>,
373 body: impl Into<models::GitRepositoryCreateOptions>,
374 project: impl Into<String>,
375 ) -> create::RequestBuilder {
376 create::RequestBuilder {
377 client: self.0.clone(),
378 organization: organization.into(),
379 body: body.into(),
380 project: project.into(),
381 source_ref: None,
382 }
383 }
384 #[doc = "Retrieve a git repository."]
385 #[doc = ""]
386 #[doc = "Arguments:"]
387 #[doc = "* `organization`: The name of the Azure DevOps organization."]
388 #[doc = "* `repository_id`: The name or ID of the repository."]
389 #[doc = "* `project`: Project ID or project name"]
390 pub fn get_repository(
391 &self,
392 organization: impl Into<String>,
393 repository_id: impl Into<String>,
394 project: impl Into<String>,
395 ) -> get_repository::RequestBuilder {
396 get_repository::RequestBuilder {
397 client: self.0.clone(),
398 organization: organization.into(),
399 repository_id: repository_id.into(),
400 project: project.into(),
401 }
402 }
403 #[doc = "Updates the Git repository with either a new repo name or a new default branch."]
404 #[doc = ""]
405 #[doc = "Arguments:"]
406 #[doc = "* `organization`: The name of the Azure DevOps organization."]
407 #[doc = "* `body`: Specify a new repo name or a new default branch of the repository"]
408 #[doc = "* `repository_id`: The ID of the repository."]
409 #[doc = "* `project`: Project ID or project name"]
410 pub fn update(
411 &self,
412 organization: impl Into<String>,
413 body: impl Into<models::GitRepository>,
414 repository_id: impl Into<String>,
415 project: impl Into<String>,
416 ) -> update::RequestBuilder {
417 update::RequestBuilder {
418 client: self.0.clone(),
419 organization: organization.into(),
420 body: body.into(),
421 repository_id: repository_id.into(),
422 project: project.into(),
423 }
424 }
425 #[doc = "Delete a git repository"]
426 #[doc = ""]
427 #[doc = "Arguments:"]
428 #[doc = "* `organization`: The name of the Azure DevOps organization."]
429 #[doc = "* `repository_id`: The ID of the repository."]
430 #[doc = "* `project`: Project ID or project name"]
431 pub fn delete(
432 &self,
433 organization: impl Into<String>,
434 repository_id: impl Into<String>,
435 project: impl Into<String>,
436 ) -> delete::RequestBuilder {
437 delete::RequestBuilder {
438 client: self.0.clone(),
439 organization: organization.into(),
440 repository_id: repository_id.into(),
441 project: project.into(),
442 }
443 }
444 }
445 pub mod get_repository_with_parent {
446 use super::models;
447 #[cfg(not(target_arch = "wasm32"))]
448 use futures::future::BoxFuture;
449 #[cfg(target_arch = "wasm32")]
450 use futures::future::LocalBoxFuture as BoxFuture;
451 #[derive(Debug)]
452 pub struct Response(azure_core::http::Response);
453 impl Response {
454 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRepository> {
455 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
456 let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
457 azure_core::error::Error::full(
458 azure_core::error::ErrorKind::DataConversion,
459 e,
460 format!(
461 "Failed to deserialize response:\n{}",
462 String::from_utf8_lossy(&bytes)
463 ),
464 )
465 })?;
466 Ok(body)
467 }
468 pub fn into_raw_response(self) -> azure_core::http::Response {
469 self.0
470 }
471 pub fn as_raw_response(&self) -> &azure_core::http::Response {
472 &self.0
473 }
474 }
475 impl From<Response> for azure_core::http::Response {
476 fn from(rsp: Response) -> Self {
477 rsp.into_raw_response()
478 }
479 }
480 impl AsRef<azure_core::http::Response> for Response {
481 fn as_ref(&self) -> &azure_core::http::Response {
482 self.as_raw_response()
483 }
484 }
485 #[derive(Clone)]
486 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
487 #[doc = r""]
488 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
489 #[doc = r" parameters can be chained."]
490 #[doc = r""]
491 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
492 #[doc = r" converts the [`RequestBuilder`] into a future,"]
493 #[doc = r" executes the request and returns a `Result` with the parsed"]
494 #[doc = r" response."]
495 #[doc = r""]
496 #[doc = r" If you need lower-level access to the raw response details"]
497 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
498 #[doc = r" can finalize the request using the"]
499 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
500 #[doc = r" that resolves to a lower-level [`Response`] value."]
501 pub struct RequestBuilder {
502 pub(crate) client: super::super::Client,
503 pub(crate) organization: String,
504 pub(crate) repository_id: String,
505 pub(crate) include_parent: bool,
506 pub(crate) project: String,
507 }
508 impl RequestBuilder {
509 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
510 #[doc = ""]
511 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
512 #[doc = "However, this function can provide more flexibility when required."]
513 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
514 Box::pin({
515 let this = self.clone();
516 async move {
517 let url = this.url()?;
518 let mut req =
519 azure_core::http::Request::new(url, azure_core::http::Method::Get);
520 if let Some(auth_header) = this
521 .client
522 .token_credential()
523 .http_authorization_header(&this.client.scopes())
524 .await?
525 {
526 req.insert_header(
527 azure_core::http::headers::AUTHORIZATION,
528 auth_header,
529 );
530 }
531 let include_parent = &this.include_parent;
532 req.url_mut()
533 .query_pairs_mut()
534 .append_pair("includeParent", &include_parent.to_string());
535 let req_body = azure_core::Bytes::new();
536 req.set_body(req_body);
537 Ok(Response(this.client.send(&mut req).await?))
538 }
539 })
540 }
541 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
542 let mut url = azure_core::http::Url::parse(&format!(
543 "{}/{}/{}/_apis/git/repositories/{}?includeParent={}",
544 self.client.endpoint(),
545 &self.organization,
546 &self.project,
547 &self.repository_id,
548 &self.include_parent
549 ))?;
550 let has_api_version_already = url
551 .query_pairs()
552 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
553 if !has_api_version_already {
554 url.query_pairs_mut().append_pair(
555 azure_core::http::headers::query_param::API_VERSION,
556 "7.1-preview",
557 );
558 }
559 Ok(url)
560 }
561 }
562 impl std::future::IntoFuture for RequestBuilder {
563 type Output = azure_core::Result<models::GitRepository>;
564 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRepository>>;
565 #[doc = "Returns a future that sends the request and returns the parsed response body."]
566 #[doc = ""]
567 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
568 #[doc = ""]
569 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
570 fn into_future(self) -> Self::IntoFuture {
571 Box::pin(async move { self.send().await?.into_raw_body().await })
572 }
573 }
574 }
575 pub mod get_deleted_repositories {
576 use super::models;
577 #[cfg(not(target_arch = "wasm32"))]
578 use futures::future::BoxFuture;
579 #[cfg(target_arch = "wasm32")]
580 use futures::future::LocalBoxFuture as BoxFuture;
581 #[derive(Debug)]
582 pub struct Response(azure_core::http::Response);
583 impl Response {
584 pub async fn into_raw_body(
585 self,
586 ) -> azure_core::Result<models::GitDeletedRepositoryList> {
587 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
588 let body: models::GitDeletedRepositoryList = serde_json::from_slice(&bytes)
589 .map_err(|e| {
590 azure_core::error::Error::full(
591 azure_core::error::ErrorKind::DataConversion,
592 e,
593 format!(
594 "Failed to deserialize response:\n{}",
595 String::from_utf8_lossy(&bytes)
596 ),
597 )
598 })?;
599 Ok(body)
600 }
601 pub fn into_raw_response(self) -> azure_core::http::Response {
602 self.0
603 }
604 pub fn as_raw_response(&self) -> &azure_core::http::Response {
605 &self.0
606 }
607 }
608 impl From<Response> for azure_core::http::Response {
609 fn from(rsp: Response) -> Self {
610 rsp.into_raw_response()
611 }
612 }
613 impl AsRef<azure_core::http::Response> for Response {
614 fn as_ref(&self) -> &azure_core::http::Response {
615 self.as_raw_response()
616 }
617 }
618 #[derive(Clone)]
619 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
620 #[doc = r""]
621 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
622 #[doc = r" parameters can be chained."]
623 #[doc = r""]
624 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
625 #[doc = r" converts the [`RequestBuilder`] into a future,"]
626 #[doc = r" executes the request and returns a `Result` with the parsed"]
627 #[doc = r" response."]
628 #[doc = r""]
629 #[doc = r" If you need lower-level access to the raw response details"]
630 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
631 #[doc = r" can finalize the request using the"]
632 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
633 #[doc = r" that resolves to a lower-level [`Response`] value."]
634 pub struct RequestBuilder {
635 pub(crate) client: super::super::Client,
636 pub(crate) organization: String,
637 pub(crate) project: String,
638 }
639 impl RequestBuilder {
640 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
641 #[doc = ""]
642 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
643 #[doc = "However, this function can provide more flexibility when required."]
644 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
645 Box::pin({
646 let this = self.clone();
647 async move {
648 let url = this.url()?;
649 let mut req =
650 azure_core::http::Request::new(url, azure_core::http::Method::Get);
651 if let Some(auth_header) = this
652 .client
653 .token_credential()
654 .http_authorization_header(&this.client.scopes())
655 .await?
656 {
657 req.insert_header(
658 azure_core::http::headers::AUTHORIZATION,
659 auth_header,
660 );
661 }
662 let req_body = azure_core::Bytes::new();
663 req.set_body(req_body);
664 Ok(Response(this.client.send(&mut req).await?))
665 }
666 })
667 }
668 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
669 let mut url = azure_core::http::Url::parse(&format!(
670 "{}/{}/{}/_apis/git/deletedrepositories",
671 self.client.endpoint(),
672 &self.organization,
673 &self.project
674 ))?;
675 let has_api_version_already = url
676 .query_pairs()
677 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
678 if !has_api_version_already {
679 url.query_pairs_mut().append_pair(
680 azure_core::http::headers::query_param::API_VERSION,
681 "7.1-preview",
682 );
683 }
684 Ok(url)
685 }
686 }
687 impl std::future::IntoFuture for RequestBuilder {
688 type Output = azure_core::Result<models::GitDeletedRepositoryList>;
689 type IntoFuture =
690 BoxFuture<'static, azure_core::Result<models::GitDeletedRepositoryList>>;
691 #[doc = "Returns a future that sends the request and returns the parsed response body."]
692 #[doc = ""]
693 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
694 #[doc = ""]
695 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
696 fn into_future(self) -> Self::IntoFuture {
697 Box::pin(async move { self.send().await?.into_raw_body().await })
698 }
699 }
700 }
701 pub mod get_recycle_bin_repositories {
702 use super::models;
703 #[cfg(not(target_arch = "wasm32"))]
704 use futures::future::BoxFuture;
705 #[cfg(target_arch = "wasm32")]
706 use futures::future::LocalBoxFuture as BoxFuture;
707 #[derive(Debug)]
708 pub struct Response(azure_core::http::Response);
709 impl Response {
710 pub async fn into_raw_body(
711 self,
712 ) -> azure_core::Result<models::GitDeletedRepositoryList> {
713 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
714 let body: models::GitDeletedRepositoryList = serde_json::from_slice(&bytes)
715 .map_err(|e| {
716 azure_core::error::Error::full(
717 azure_core::error::ErrorKind::DataConversion,
718 e,
719 format!(
720 "Failed to deserialize response:\n{}",
721 String::from_utf8_lossy(&bytes)
722 ),
723 )
724 })?;
725 Ok(body)
726 }
727 pub fn into_raw_response(self) -> azure_core::http::Response {
728 self.0
729 }
730 pub fn as_raw_response(&self) -> &azure_core::http::Response {
731 &self.0
732 }
733 }
734 impl From<Response> for azure_core::http::Response {
735 fn from(rsp: Response) -> Self {
736 rsp.into_raw_response()
737 }
738 }
739 impl AsRef<azure_core::http::Response> for Response {
740 fn as_ref(&self) -> &azure_core::http::Response {
741 self.as_raw_response()
742 }
743 }
744 #[derive(Clone)]
745 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
746 #[doc = r""]
747 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
748 #[doc = r" parameters can be chained."]
749 #[doc = r""]
750 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
751 #[doc = r" converts the [`RequestBuilder`] into a future,"]
752 #[doc = r" executes the request and returns a `Result` with the parsed"]
753 #[doc = r" response."]
754 #[doc = r""]
755 #[doc = r" If you need lower-level access to the raw response details"]
756 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
757 #[doc = r" can finalize the request using the"]
758 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
759 #[doc = r" that resolves to a lower-level [`Response`] value."]
760 pub struct RequestBuilder {
761 pub(crate) client: super::super::Client,
762 pub(crate) organization: String,
763 pub(crate) project: String,
764 }
765 impl RequestBuilder {
766 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
767 #[doc = ""]
768 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
769 #[doc = "However, this function can provide more flexibility when required."]
770 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
771 Box::pin({
772 let this = self.clone();
773 async move {
774 let url = this.url()?;
775 let mut req =
776 azure_core::http::Request::new(url, azure_core::http::Method::Get);
777 if let Some(auth_header) = this
778 .client
779 .token_credential()
780 .http_authorization_header(&this.client.scopes())
781 .await?
782 {
783 req.insert_header(
784 azure_core::http::headers::AUTHORIZATION,
785 auth_header,
786 );
787 }
788 let req_body = azure_core::Bytes::new();
789 req.set_body(req_body);
790 Ok(Response(this.client.send(&mut req).await?))
791 }
792 })
793 }
794 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
795 let mut url = azure_core::http::Url::parse(&format!(
796 "{}/{}/{}/_apis/git/recycleBin/repositories",
797 self.client.endpoint(),
798 &self.organization,
799 &self.project
800 ))?;
801 let has_api_version_already = url
802 .query_pairs()
803 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
804 if !has_api_version_already {
805 url.query_pairs_mut().append_pair(
806 azure_core::http::headers::query_param::API_VERSION,
807 "7.1-preview",
808 );
809 }
810 Ok(url)
811 }
812 }
813 impl std::future::IntoFuture for RequestBuilder {
814 type Output = azure_core::Result<models::GitDeletedRepositoryList>;
815 type IntoFuture =
816 BoxFuture<'static, azure_core::Result<models::GitDeletedRepositoryList>>;
817 #[doc = "Returns a future that sends the request and returns the parsed response body."]
818 #[doc = ""]
819 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
820 #[doc = ""]
821 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
822 fn into_future(self) -> Self::IntoFuture {
823 Box::pin(async move { self.send().await?.into_raw_body().await })
824 }
825 }
826 }
827 pub mod restore_repository_from_recycle_bin {
828 use super::models;
829 #[cfg(not(target_arch = "wasm32"))]
830 use futures::future::BoxFuture;
831 #[cfg(target_arch = "wasm32")]
832 use futures::future::LocalBoxFuture as BoxFuture;
833 #[derive(Debug)]
834 pub struct Response(azure_core::http::Response);
835 impl Response {
836 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRepository> {
837 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
838 let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
839 azure_core::error::Error::full(
840 azure_core::error::ErrorKind::DataConversion,
841 e,
842 format!(
843 "Failed to deserialize response:\n{}",
844 String::from_utf8_lossy(&bytes)
845 ),
846 )
847 })?;
848 Ok(body)
849 }
850 pub fn into_raw_response(self) -> azure_core::http::Response {
851 self.0
852 }
853 pub fn as_raw_response(&self) -> &azure_core::http::Response {
854 &self.0
855 }
856 }
857 impl From<Response> for azure_core::http::Response {
858 fn from(rsp: Response) -> Self {
859 rsp.into_raw_response()
860 }
861 }
862 impl AsRef<azure_core::http::Response> for Response {
863 fn as_ref(&self) -> &azure_core::http::Response {
864 self.as_raw_response()
865 }
866 }
867 #[derive(Clone)]
868 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
869 #[doc = r""]
870 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
871 #[doc = r" parameters can be chained."]
872 #[doc = r""]
873 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
874 #[doc = r" converts the [`RequestBuilder`] into a future,"]
875 #[doc = r" executes the request and returns a `Result` with the parsed"]
876 #[doc = r" response."]
877 #[doc = r""]
878 #[doc = r" If you need lower-level access to the raw response details"]
879 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
880 #[doc = r" can finalize the request using the"]
881 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
882 #[doc = r" that resolves to a lower-level [`Response`] value."]
883 pub struct RequestBuilder {
884 pub(crate) client: super::super::Client,
885 pub(crate) organization: String,
886 pub(crate) body: models::GitRecycleBinRepositoryDetails,
887 pub(crate) project: String,
888 pub(crate) repository_id: String,
889 }
890 impl RequestBuilder {
891 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
892 #[doc = ""]
893 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
894 #[doc = "However, this function can provide more flexibility when required."]
895 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
896 Box::pin({
897 let this = self.clone();
898 async move {
899 let url = this.url()?;
900 let mut req =
901 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
902 if let Some(auth_header) = this
903 .client
904 .token_credential()
905 .http_authorization_header(&this.client.scopes())
906 .await?
907 {
908 req.insert_header(
909 azure_core::http::headers::AUTHORIZATION,
910 auth_header,
911 );
912 }
913 req.insert_header("content-type", "application/json");
914 let req_body = azure_core::json::to_json(&this.body)?;
915 req.set_body(req_body);
916 Ok(Response(this.client.send(&mut req).await?))
917 }
918 })
919 }
920 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
921 let mut url = azure_core::http::Url::parse(&format!(
922 "{}/{}/{}/_apis/git/recycleBin/repositories/{}",
923 self.client.endpoint(),
924 &self.organization,
925 &self.project,
926 &self.repository_id
927 ))?;
928 let has_api_version_already = url
929 .query_pairs()
930 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
931 if !has_api_version_already {
932 url.query_pairs_mut().append_pair(
933 azure_core::http::headers::query_param::API_VERSION,
934 "7.1-preview",
935 );
936 }
937 Ok(url)
938 }
939 }
940 impl std::future::IntoFuture for RequestBuilder {
941 type Output = azure_core::Result<models::GitRepository>;
942 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRepository>>;
943 #[doc = "Returns a future that sends the request and returns the parsed response body."]
944 #[doc = ""]
945 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
946 #[doc = ""]
947 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
948 fn into_future(self) -> Self::IntoFuture {
949 Box::pin(async move { self.send().await?.into_raw_body().await })
950 }
951 }
952 }
953 pub mod delete_repository_from_recycle_bin {
954 use super::models;
955 #[cfg(not(target_arch = "wasm32"))]
956 use futures::future::BoxFuture;
957 #[cfg(target_arch = "wasm32")]
958 use futures::future::LocalBoxFuture as BoxFuture;
959 #[derive(Debug)]
960 pub struct Response(azure_core::http::Response);
961 impl Response {
962 pub fn into_raw_response(self) -> azure_core::http::Response {
963 self.0
964 }
965 pub fn as_raw_response(&self) -> &azure_core::http::Response {
966 &self.0
967 }
968 }
969 impl From<Response> for azure_core::http::Response {
970 fn from(rsp: Response) -> Self {
971 rsp.into_raw_response()
972 }
973 }
974 impl AsRef<azure_core::http::Response> for Response {
975 fn as_ref(&self) -> &azure_core::http::Response {
976 self.as_raw_response()
977 }
978 }
979 #[derive(Clone)]
980 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
981 #[doc = r""]
982 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
983 #[doc = r" parameters can be chained."]
984 #[doc = r""]
985 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
986 #[doc = r" converts the [`RequestBuilder`] into a future,"]
987 #[doc = r" executes the request and returns a `Result` with the parsed"]
988 #[doc = r" response."]
989 #[doc = r""]
990 #[doc = r" If you need lower-level access to the raw response details"]
991 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
992 #[doc = r" can finalize the request using the"]
993 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
994 #[doc = r" that resolves to a lower-level [`Response`] value."]
995 pub struct RequestBuilder {
996 pub(crate) client: super::super::Client,
997 pub(crate) organization: String,
998 pub(crate) project: String,
999 pub(crate) repository_id: String,
1000 }
1001 impl RequestBuilder {
1002 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1003 #[doc = ""]
1004 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1005 #[doc = "However, this function can provide more flexibility when required."]
1006 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1007 Box::pin({
1008 let this = self.clone();
1009 async move {
1010 let url = this.url()?;
1011 let mut req =
1012 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
1013 if let Some(auth_header) = this
1014 .client
1015 .token_credential()
1016 .http_authorization_header(&this.client.scopes())
1017 .await?
1018 {
1019 req.insert_header(
1020 azure_core::http::headers::AUTHORIZATION,
1021 auth_header,
1022 );
1023 }
1024 let req_body = azure_core::Bytes::new();
1025 req.set_body(req_body);
1026 Ok(Response(this.client.send(&mut req).await?))
1027 }
1028 })
1029 }
1030 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1031 let mut url = azure_core::http::Url::parse(&format!(
1032 "{}/{}/{}/_apis/git/recycleBin/repositories/{}",
1033 self.client.endpoint(),
1034 &self.organization,
1035 &self.project,
1036 &self.repository_id
1037 ))?;
1038 let has_api_version_already = url
1039 .query_pairs()
1040 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1041 if !has_api_version_already {
1042 url.query_pairs_mut().append_pair(
1043 azure_core::http::headers::query_param::API_VERSION,
1044 "7.1-preview",
1045 );
1046 }
1047 Ok(url)
1048 }
1049 }
1050 impl std::future::IntoFuture for RequestBuilder {
1051 type Output = azure_core::Result<()>;
1052 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
1053 #[doc = "Returns a future that sends the request and waits for the response."]
1054 #[doc = ""]
1055 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1056 #[doc = ""]
1057 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1058 fn into_future(self) -> Self::IntoFuture {
1059 Box::pin(async move {
1060 let _rsp = self.send().await?;
1061 Ok(())
1062 })
1063 }
1064 }
1065 }
1066 pub mod list {
1067 use super::models;
1068 #[cfg(not(target_arch = "wasm32"))]
1069 use futures::future::BoxFuture;
1070 #[cfg(target_arch = "wasm32")]
1071 use futures::future::LocalBoxFuture as BoxFuture;
1072 #[derive(Debug)]
1073 pub struct Response(azure_core::http::Response);
1074 impl Response {
1075 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRepositoryList> {
1076 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1077 let body: models::GitRepositoryList =
1078 serde_json::from_slice(&bytes).map_err(|e| {
1079 azure_core::error::Error::full(
1080 azure_core::error::ErrorKind::DataConversion,
1081 e,
1082 format!(
1083 "Failed to deserialize response:\n{}",
1084 String::from_utf8_lossy(&bytes)
1085 ),
1086 )
1087 })?;
1088 Ok(body)
1089 }
1090 pub fn into_raw_response(self) -> azure_core::http::Response {
1091 self.0
1092 }
1093 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1094 &self.0
1095 }
1096 }
1097 impl From<Response> for azure_core::http::Response {
1098 fn from(rsp: Response) -> Self {
1099 rsp.into_raw_response()
1100 }
1101 }
1102 impl AsRef<azure_core::http::Response> for Response {
1103 fn as_ref(&self) -> &azure_core::http::Response {
1104 self.as_raw_response()
1105 }
1106 }
1107 #[derive(Clone)]
1108 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1109 #[doc = r""]
1110 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1111 #[doc = r" parameters can be chained."]
1112 #[doc = r""]
1113 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1114 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1115 #[doc = r" executes the request and returns a `Result` with the parsed"]
1116 #[doc = r" response."]
1117 #[doc = r""]
1118 #[doc = r" If you need lower-level access to the raw response details"]
1119 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1120 #[doc = r" can finalize the request using the"]
1121 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1122 #[doc = r" that resolves to a lower-level [`Response`] value."]
1123 pub struct RequestBuilder {
1124 pub(crate) client: super::super::Client,
1125 pub(crate) organization: String,
1126 pub(crate) project: String,
1127 pub(crate) include_links: Option<bool>,
1128 pub(crate) include_all_urls: Option<bool>,
1129 pub(crate) include_hidden: Option<bool>,
1130 }
1131 impl RequestBuilder {
1132 #[doc = "(optional) Set to true to include reference links. The default value is false."]
1133 pub fn include_links(mut self, include_links: bool) -> Self {
1134 self.include_links = Some(include_links);
1135 self
1136 }
1137 #[doc = "(optional) Set to true to include all remote URLs. The default value is false."]
1138 pub fn include_all_urls(mut self, include_all_urls: bool) -> Self {
1139 self.include_all_urls = Some(include_all_urls);
1140 self
1141 }
1142 #[doc = "(optional) Set to true to include hidden repositories. The default value is false."]
1143 pub fn include_hidden(mut self, include_hidden: bool) -> Self {
1144 self.include_hidden = Some(include_hidden);
1145 self
1146 }
1147 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1148 #[doc = ""]
1149 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1150 #[doc = "However, this function can provide more flexibility when required."]
1151 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1152 Box::pin({
1153 let this = self.clone();
1154 async move {
1155 let url = this.url()?;
1156 let mut req =
1157 azure_core::http::Request::new(url, azure_core::http::Method::Get);
1158 if let Some(auth_header) = this
1159 .client
1160 .token_credential()
1161 .http_authorization_header(&this.client.scopes())
1162 .await?
1163 {
1164 req.insert_header(
1165 azure_core::http::headers::AUTHORIZATION,
1166 auth_header,
1167 );
1168 }
1169 if let Some(include_links) = &this.include_links {
1170 req.url_mut()
1171 .query_pairs_mut()
1172 .append_pair("includeLinks", &include_links.to_string());
1173 }
1174 if let Some(include_all_urls) = &this.include_all_urls {
1175 req.url_mut()
1176 .query_pairs_mut()
1177 .append_pair("includeAllUrls", &include_all_urls.to_string());
1178 }
1179 if let Some(include_hidden) = &this.include_hidden {
1180 req.url_mut()
1181 .query_pairs_mut()
1182 .append_pair("includeHidden", &include_hidden.to_string());
1183 }
1184 let req_body = azure_core::Bytes::new();
1185 req.set_body(req_body);
1186 Ok(Response(this.client.send(&mut req).await?))
1187 }
1188 })
1189 }
1190 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1191 let mut url = azure_core::http::Url::parse(&format!(
1192 "{}/{}/{}/_apis/git/repositories",
1193 self.client.endpoint(),
1194 &self.organization,
1195 &self.project
1196 ))?;
1197 let has_api_version_already = url
1198 .query_pairs()
1199 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1200 if !has_api_version_already {
1201 url.query_pairs_mut().append_pair(
1202 azure_core::http::headers::query_param::API_VERSION,
1203 "7.1-preview",
1204 );
1205 }
1206 Ok(url)
1207 }
1208 }
1209 impl std::future::IntoFuture for RequestBuilder {
1210 type Output = azure_core::Result<models::GitRepositoryList>;
1211 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRepositoryList>>;
1212 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1213 #[doc = ""]
1214 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1215 #[doc = ""]
1216 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1217 fn into_future(self) -> Self::IntoFuture {
1218 Box::pin(async move { self.send().await?.into_raw_body().await })
1219 }
1220 }
1221 }
1222 pub mod create {
1223 use super::models;
1224 #[cfg(not(target_arch = "wasm32"))]
1225 use futures::future::BoxFuture;
1226 #[cfg(target_arch = "wasm32")]
1227 use futures::future::LocalBoxFuture as BoxFuture;
1228 #[derive(Debug)]
1229 pub struct Response(azure_core::http::Response);
1230 impl Response {
1231 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRepository> {
1232 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1233 let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
1234 azure_core::error::Error::full(
1235 azure_core::error::ErrorKind::DataConversion,
1236 e,
1237 format!(
1238 "Failed to deserialize response:\n{}",
1239 String::from_utf8_lossy(&bytes)
1240 ),
1241 )
1242 })?;
1243 Ok(body)
1244 }
1245 pub fn into_raw_response(self) -> azure_core::http::Response {
1246 self.0
1247 }
1248 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1249 &self.0
1250 }
1251 }
1252 impl From<Response> for azure_core::http::Response {
1253 fn from(rsp: Response) -> Self {
1254 rsp.into_raw_response()
1255 }
1256 }
1257 impl AsRef<azure_core::http::Response> for Response {
1258 fn as_ref(&self) -> &azure_core::http::Response {
1259 self.as_raw_response()
1260 }
1261 }
1262 #[derive(Clone)]
1263 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1264 #[doc = r""]
1265 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1266 #[doc = r" parameters can be chained."]
1267 #[doc = r""]
1268 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1269 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1270 #[doc = r" executes the request and returns a `Result` with the parsed"]
1271 #[doc = r" response."]
1272 #[doc = r""]
1273 #[doc = r" If you need lower-level access to the raw response details"]
1274 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1275 #[doc = r" can finalize the request using the"]
1276 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1277 #[doc = r" that resolves to a lower-level [`Response`] value."]
1278 pub struct RequestBuilder {
1279 pub(crate) client: super::super::Client,
1280 pub(crate) organization: String,
1281 pub(crate) body: models::GitRepositoryCreateOptions,
1282 pub(crate) project: String,
1283 pub(crate) source_ref: Option<String>,
1284 }
1285 impl RequestBuilder {
1286 #[doc = "\\[optional\\] Specify the source refs to use while creating a fork repo"]
1287 pub fn source_ref(mut self, source_ref: impl Into<String>) -> Self {
1288 self.source_ref = Some(source_ref.into());
1289 self
1290 }
1291 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1292 #[doc = ""]
1293 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1294 #[doc = "However, this function can provide more flexibility when required."]
1295 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1296 Box::pin({
1297 let this = self.clone();
1298 async move {
1299 let url = this.url()?;
1300 let mut req =
1301 azure_core::http::Request::new(url, azure_core::http::Method::Post);
1302 if let Some(auth_header) = this
1303 .client
1304 .token_credential()
1305 .http_authorization_header(&this.client.scopes())
1306 .await?
1307 {
1308 req.insert_header(
1309 azure_core::http::headers::AUTHORIZATION,
1310 auth_header,
1311 );
1312 }
1313 req.insert_header("content-type", "application/json");
1314 let req_body = azure_core::json::to_json(&this.body)?;
1315 if let Some(source_ref) = &this.source_ref {
1316 req.url_mut()
1317 .query_pairs_mut()
1318 .append_pair("sourceRef", source_ref);
1319 }
1320 req.set_body(req_body);
1321 Ok(Response(this.client.send(&mut req).await?))
1322 }
1323 })
1324 }
1325 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1326 let mut url = azure_core::http::Url::parse(&format!(
1327 "{}/{}/{}/_apis/git/repositories",
1328 self.client.endpoint(),
1329 &self.organization,
1330 &self.project
1331 ))?;
1332 let has_api_version_already = url
1333 .query_pairs()
1334 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1335 if !has_api_version_already {
1336 url.query_pairs_mut().append_pair(
1337 azure_core::http::headers::query_param::API_VERSION,
1338 "7.1-preview",
1339 );
1340 }
1341 Ok(url)
1342 }
1343 }
1344 impl std::future::IntoFuture for RequestBuilder {
1345 type Output = azure_core::Result<models::GitRepository>;
1346 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRepository>>;
1347 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1348 #[doc = ""]
1349 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1350 #[doc = ""]
1351 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1352 fn into_future(self) -> Self::IntoFuture {
1353 Box::pin(async move { self.send().await?.into_raw_body().await })
1354 }
1355 }
1356 }
1357 pub mod get_repository {
1358 use super::models;
1359 #[cfg(not(target_arch = "wasm32"))]
1360 use futures::future::BoxFuture;
1361 #[cfg(target_arch = "wasm32")]
1362 use futures::future::LocalBoxFuture as BoxFuture;
1363 #[derive(Debug)]
1364 pub struct Response(azure_core::http::Response);
1365 impl Response {
1366 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRepository> {
1367 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1368 let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
1369 azure_core::error::Error::full(
1370 azure_core::error::ErrorKind::DataConversion,
1371 e,
1372 format!(
1373 "Failed to deserialize response:\n{}",
1374 String::from_utf8_lossy(&bytes)
1375 ),
1376 )
1377 })?;
1378 Ok(body)
1379 }
1380 pub fn into_raw_response(self) -> azure_core::http::Response {
1381 self.0
1382 }
1383 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1384 &self.0
1385 }
1386 }
1387 impl From<Response> for azure_core::http::Response {
1388 fn from(rsp: Response) -> Self {
1389 rsp.into_raw_response()
1390 }
1391 }
1392 impl AsRef<azure_core::http::Response> for Response {
1393 fn as_ref(&self) -> &azure_core::http::Response {
1394 self.as_raw_response()
1395 }
1396 }
1397 #[derive(Clone)]
1398 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1399 #[doc = r""]
1400 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1401 #[doc = r" parameters can be chained."]
1402 #[doc = r""]
1403 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1404 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1405 #[doc = r" executes the request and returns a `Result` with the parsed"]
1406 #[doc = r" response."]
1407 #[doc = r""]
1408 #[doc = r" If you need lower-level access to the raw response details"]
1409 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1410 #[doc = r" can finalize the request using the"]
1411 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1412 #[doc = r" that resolves to a lower-level [`Response`] value."]
1413 pub struct RequestBuilder {
1414 pub(crate) client: super::super::Client,
1415 pub(crate) organization: String,
1416 pub(crate) repository_id: String,
1417 pub(crate) project: String,
1418 }
1419 impl RequestBuilder {
1420 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1421 #[doc = ""]
1422 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1423 #[doc = "However, this function can provide more flexibility when required."]
1424 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1425 Box::pin({
1426 let this = self.clone();
1427 async move {
1428 let url = this.url()?;
1429 let mut req =
1430 azure_core::http::Request::new(url, azure_core::http::Method::Get);
1431 if let Some(auth_header) = this
1432 .client
1433 .token_credential()
1434 .http_authorization_header(&this.client.scopes())
1435 .await?
1436 {
1437 req.insert_header(
1438 azure_core::http::headers::AUTHORIZATION,
1439 auth_header,
1440 );
1441 }
1442 let req_body = azure_core::Bytes::new();
1443 req.set_body(req_body);
1444 Ok(Response(this.client.send(&mut req).await?))
1445 }
1446 })
1447 }
1448 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1449 let mut url = azure_core::http::Url::parse(&format!(
1450 "{}/{}/{}/_apis/git/repositories/{}",
1451 self.client.endpoint(),
1452 &self.organization,
1453 &self.project,
1454 &self.repository_id
1455 ))?;
1456 let has_api_version_already = url
1457 .query_pairs()
1458 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1459 if !has_api_version_already {
1460 url.query_pairs_mut().append_pair(
1461 azure_core::http::headers::query_param::API_VERSION,
1462 "7.1-preview",
1463 );
1464 }
1465 Ok(url)
1466 }
1467 }
1468 impl std::future::IntoFuture for RequestBuilder {
1469 type Output = azure_core::Result<models::GitRepository>;
1470 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRepository>>;
1471 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1472 #[doc = ""]
1473 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1474 #[doc = ""]
1475 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1476 fn into_future(self) -> Self::IntoFuture {
1477 Box::pin(async move { self.send().await?.into_raw_body().await })
1478 }
1479 }
1480 }
1481 pub mod update {
1482 use super::models;
1483 #[cfg(not(target_arch = "wasm32"))]
1484 use futures::future::BoxFuture;
1485 #[cfg(target_arch = "wasm32")]
1486 use futures::future::LocalBoxFuture as BoxFuture;
1487 #[derive(Debug)]
1488 pub struct Response(azure_core::http::Response);
1489 impl Response {
1490 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRepository> {
1491 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1492 let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
1493 azure_core::error::Error::full(
1494 azure_core::error::ErrorKind::DataConversion,
1495 e,
1496 format!(
1497 "Failed to deserialize response:\n{}",
1498 String::from_utf8_lossy(&bytes)
1499 ),
1500 )
1501 })?;
1502 Ok(body)
1503 }
1504 pub fn into_raw_response(self) -> azure_core::http::Response {
1505 self.0
1506 }
1507 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1508 &self.0
1509 }
1510 }
1511 impl From<Response> for azure_core::http::Response {
1512 fn from(rsp: Response) -> Self {
1513 rsp.into_raw_response()
1514 }
1515 }
1516 impl AsRef<azure_core::http::Response> for Response {
1517 fn as_ref(&self) -> &azure_core::http::Response {
1518 self.as_raw_response()
1519 }
1520 }
1521 #[derive(Clone)]
1522 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1523 #[doc = r""]
1524 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1525 #[doc = r" parameters can be chained."]
1526 #[doc = r""]
1527 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1528 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1529 #[doc = r" executes the request and returns a `Result` with the parsed"]
1530 #[doc = r" response."]
1531 #[doc = r""]
1532 #[doc = r" If you need lower-level access to the raw response details"]
1533 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1534 #[doc = r" can finalize the request using the"]
1535 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1536 #[doc = r" that resolves to a lower-level [`Response`] value."]
1537 pub struct RequestBuilder {
1538 pub(crate) client: super::super::Client,
1539 pub(crate) organization: String,
1540 pub(crate) body: models::GitRepository,
1541 pub(crate) repository_id: String,
1542 pub(crate) project: String,
1543 }
1544 impl RequestBuilder {
1545 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1546 #[doc = ""]
1547 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1548 #[doc = "However, this function can provide more flexibility when required."]
1549 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1550 Box::pin({
1551 let this = self.clone();
1552 async move {
1553 let url = this.url()?;
1554 let mut req =
1555 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
1556 if let Some(auth_header) = this
1557 .client
1558 .token_credential()
1559 .http_authorization_header(&this.client.scopes())
1560 .await?
1561 {
1562 req.insert_header(
1563 azure_core::http::headers::AUTHORIZATION,
1564 auth_header,
1565 );
1566 }
1567 req.insert_header("content-type", "application/json");
1568 let req_body = azure_core::json::to_json(&this.body)?;
1569 req.set_body(req_body);
1570 Ok(Response(this.client.send(&mut req).await?))
1571 }
1572 })
1573 }
1574 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1575 let mut url = azure_core::http::Url::parse(&format!(
1576 "{}/{}/{}/_apis/git/repositories/{}",
1577 self.client.endpoint(),
1578 &self.organization,
1579 &self.project,
1580 &self.repository_id
1581 ))?;
1582 let has_api_version_already = url
1583 .query_pairs()
1584 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1585 if !has_api_version_already {
1586 url.query_pairs_mut().append_pair(
1587 azure_core::http::headers::query_param::API_VERSION,
1588 "7.1-preview",
1589 );
1590 }
1591 Ok(url)
1592 }
1593 }
1594 impl std::future::IntoFuture for RequestBuilder {
1595 type Output = azure_core::Result<models::GitRepository>;
1596 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRepository>>;
1597 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1598 #[doc = ""]
1599 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1600 #[doc = ""]
1601 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1602 fn into_future(self) -> Self::IntoFuture {
1603 Box::pin(async move { self.send().await?.into_raw_body().await })
1604 }
1605 }
1606 }
1607 pub mod delete {
1608 use super::models;
1609 #[cfg(not(target_arch = "wasm32"))]
1610 use futures::future::BoxFuture;
1611 #[cfg(target_arch = "wasm32")]
1612 use futures::future::LocalBoxFuture as BoxFuture;
1613 #[derive(Debug)]
1614 pub struct Response(azure_core::http::Response);
1615 impl Response {
1616 pub fn into_raw_response(self) -> azure_core::http::Response {
1617 self.0
1618 }
1619 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1620 &self.0
1621 }
1622 }
1623 impl From<Response> for azure_core::http::Response {
1624 fn from(rsp: Response) -> Self {
1625 rsp.into_raw_response()
1626 }
1627 }
1628 impl AsRef<azure_core::http::Response> for Response {
1629 fn as_ref(&self) -> &azure_core::http::Response {
1630 self.as_raw_response()
1631 }
1632 }
1633 #[derive(Clone)]
1634 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1635 #[doc = r""]
1636 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1637 #[doc = r" parameters can be chained."]
1638 #[doc = r""]
1639 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1640 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1641 #[doc = r" executes the request and returns a `Result` with the parsed"]
1642 #[doc = r" response."]
1643 #[doc = r""]
1644 #[doc = r" If you need lower-level access to the raw response details"]
1645 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1646 #[doc = r" can finalize the request using the"]
1647 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1648 #[doc = r" that resolves to a lower-level [`Response`] value."]
1649 pub struct RequestBuilder {
1650 pub(crate) client: super::super::Client,
1651 pub(crate) organization: String,
1652 pub(crate) repository_id: String,
1653 pub(crate) project: String,
1654 }
1655 impl RequestBuilder {
1656 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1657 #[doc = ""]
1658 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1659 #[doc = "However, this function can provide more flexibility when required."]
1660 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1661 Box::pin({
1662 let this = self.clone();
1663 async move {
1664 let url = this.url()?;
1665 let mut req =
1666 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
1667 if let Some(auth_header) = this
1668 .client
1669 .token_credential()
1670 .http_authorization_header(&this.client.scopes())
1671 .await?
1672 {
1673 req.insert_header(
1674 azure_core::http::headers::AUTHORIZATION,
1675 auth_header,
1676 );
1677 }
1678 let req_body = azure_core::Bytes::new();
1679 req.set_body(req_body);
1680 Ok(Response(this.client.send(&mut req).await?))
1681 }
1682 })
1683 }
1684 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1685 let mut url = azure_core::http::Url::parse(&format!(
1686 "{}/{}/{}/_apis/git/repositories/{}",
1687 self.client.endpoint(),
1688 &self.organization,
1689 &self.project,
1690 &self.repository_id
1691 ))?;
1692 let has_api_version_already = url
1693 .query_pairs()
1694 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1695 if !has_api_version_already {
1696 url.query_pairs_mut().append_pair(
1697 azure_core::http::headers::query_param::API_VERSION,
1698 "7.1-preview",
1699 );
1700 }
1701 Ok(url)
1702 }
1703 }
1704 impl std::future::IntoFuture for RequestBuilder {
1705 type Output = azure_core::Result<()>;
1706 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
1707 #[doc = "Returns a future that sends the request and waits for the response."]
1708 #[doc = ""]
1709 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1710 #[doc = ""]
1711 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1712 fn into_future(self) -> Self::IntoFuture {
1713 Box::pin(async move {
1714 let _rsp = self.send().await?;
1715 Ok(())
1716 })
1717 }
1718 }
1719 }
1720}
1721pub mod commits {
1722 use super::models;
1723 #[cfg(not(target_arch = "wasm32"))]
1724 use futures::future::BoxFuture;
1725 #[cfg(target_arch = "wasm32")]
1726 use futures::future::LocalBoxFuture as BoxFuture;
1727 pub struct Client(pub(crate) super::Client);
1728 impl Client {
1729 #[doc = "Retrieve git commits for a project\n\nParameters that use the searchCriteria prefix in their name can be specified without it as query parameters, e.g. searchCriteria.$top -> $top"]
1730 #[doc = ""]
1731 #[doc = "Arguments:"]
1732 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1733 #[doc = "* `repository_id`: The id or friendly name of the repository. To use the friendly name, projectId must also be specified."]
1734 #[doc = "* `project`: Project ID or project name"]
1735 pub fn get_commits(
1736 &self,
1737 organization: impl Into<String>,
1738 repository_id: impl Into<String>,
1739 project: impl Into<String>,
1740 ) -> get_commits::RequestBuilder {
1741 get_commits::RequestBuilder {
1742 client: self.0.clone(),
1743 organization: organization.into(),
1744 repository_id: repository_id.into(),
1745 project: project.into(),
1746 search_criteria_skip: None,
1747 search_criteria_top: None,
1748 search_criteria_author: None,
1749 search_criteria_compare_version_version: None,
1750 search_criteria_compare_version_version_options: None,
1751 search_criteria_compare_version_version_type: None,
1752 search_criteria_exclude_deletes: None,
1753 search_criteria_from_commit_id: None,
1754 search_criteria_from_date: None,
1755 search_criteria_history_mode: None,
1756 search_criteria_ids: Vec::new(),
1757 search_criteria_include_links: None,
1758 search_criteria_include_push_data: None,
1759 search_criteria_include_user_image_url: None,
1760 search_criteria_include_work_items: None,
1761 search_criteria_item_path: None,
1762 search_criteria_item_version_version: None,
1763 search_criteria_item_version_version_options: None,
1764 search_criteria_item_version_version_type: None,
1765 search_criteria_show_oldest_commits_first: None,
1766 search_criteria_to_commit_id: None,
1767 search_criteria_to_date: None,
1768 search_criteria_user: None,
1769 }
1770 }
1771 #[doc = "Retrieve a list of commits associated with a particular push."]
1772 #[doc = ""]
1773 #[doc = "Arguments:"]
1774 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1775 #[doc = "* `repository_id`: The id or friendly name of the repository. To use the friendly name, projectId must also be specified."]
1776 #[doc = "* `push_id`: The id of the push."]
1777 #[doc = "* `project`: Project ID or project name"]
1778 pub fn get_push_commits(
1779 &self,
1780 organization: impl Into<String>,
1781 repository_id: impl Into<String>,
1782 push_id: i32,
1783 project: impl Into<String>,
1784 ) -> get_push_commits::RequestBuilder {
1785 get_push_commits::RequestBuilder {
1786 client: self.0.clone(),
1787 organization: organization.into(),
1788 repository_id: repository_id.into(),
1789 push_id,
1790 project: project.into(),
1791 top: None,
1792 skip: None,
1793 include_links: None,
1794 }
1795 }
1796 #[doc = "Retrieve a particular commit."]
1797 #[doc = ""]
1798 #[doc = "Arguments:"]
1799 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1800 #[doc = "* `commit_id`: The id of the commit."]
1801 #[doc = "* `repository_id`: The id or friendly name of the repository. To use the friendly name, projectId must also be specified."]
1802 #[doc = "* `project`: Project ID or project name"]
1803 pub fn get(
1804 &self,
1805 organization: impl Into<String>,
1806 commit_id: impl Into<String>,
1807 repository_id: impl Into<String>,
1808 project: impl Into<String>,
1809 ) -> get::RequestBuilder {
1810 get::RequestBuilder {
1811 client: self.0.clone(),
1812 organization: organization.into(),
1813 commit_id: commit_id.into(),
1814 repository_id: repository_id.into(),
1815 project: project.into(),
1816 change_count: None,
1817 }
1818 }
1819 #[doc = "Retrieve changes for a particular commit."]
1820 #[doc = ""]
1821 #[doc = "Arguments:"]
1822 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1823 #[doc = "* `commit_id`: The id of the commit."]
1824 #[doc = "* `repository_id`: The id or friendly name of the repository. To use the friendly name, projectId must also be specified."]
1825 #[doc = "* `project`: Project ID or project name"]
1826 pub fn get_changes(
1827 &self,
1828 organization: impl Into<String>,
1829 commit_id: impl Into<String>,
1830 repository_id: impl Into<String>,
1831 project: impl Into<String>,
1832 ) -> get_changes::RequestBuilder {
1833 get_changes::RequestBuilder {
1834 client: self.0.clone(),
1835 organization: organization.into(),
1836 commit_id: commit_id.into(),
1837 repository_id: repository_id.into(),
1838 project: project.into(),
1839 top: None,
1840 skip: None,
1841 }
1842 }
1843 #[doc = "Retrieve git commits for a project matching the search criteria"]
1844 #[doc = ""]
1845 #[doc = "Arguments:"]
1846 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1847 #[doc = "* `body`: Search options"]
1848 #[doc = "* `repository_id`: The name or ID of the repository."]
1849 #[doc = "* `project`: Project ID or project name"]
1850 pub fn get_commits_batch(
1851 &self,
1852 organization: impl Into<String>,
1853 body: impl Into<models::GitQueryCommitsCriteria>,
1854 repository_id: impl Into<String>,
1855 project: impl Into<String>,
1856 ) -> get_commits_batch::RequestBuilder {
1857 get_commits_batch::RequestBuilder {
1858 client: self.0.clone(),
1859 organization: organization.into(),
1860 body: body.into(),
1861 repository_id: repository_id.into(),
1862 project: project.into(),
1863 skip: None,
1864 top: None,
1865 include_statuses: None,
1866 }
1867 }
1868 }
1869 pub mod get_commits {
1870 use super::models;
1871 #[cfg(not(target_arch = "wasm32"))]
1872 use futures::future::BoxFuture;
1873 #[cfg(target_arch = "wasm32")]
1874 use futures::future::LocalBoxFuture as BoxFuture;
1875 #[derive(Debug)]
1876 pub struct Response(azure_core::http::Response);
1877 impl Response {
1878 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCommitRefList> {
1879 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
1880 let body: models::GitCommitRefList =
1881 serde_json::from_slice(&bytes).map_err(|e| {
1882 azure_core::error::Error::full(
1883 azure_core::error::ErrorKind::DataConversion,
1884 e,
1885 format!(
1886 "Failed to deserialize response:\n{}",
1887 String::from_utf8_lossy(&bytes)
1888 ),
1889 )
1890 })?;
1891 Ok(body)
1892 }
1893 pub fn into_raw_response(self) -> azure_core::http::Response {
1894 self.0
1895 }
1896 pub fn as_raw_response(&self) -> &azure_core::http::Response {
1897 &self.0
1898 }
1899 }
1900 impl From<Response> for azure_core::http::Response {
1901 fn from(rsp: Response) -> Self {
1902 rsp.into_raw_response()
1903 }
1904 }
1905 impl AsRef<azure_core::http::Response> for Response {
1906 fn as_ref(&self) -> &azure_core::http::Response {
1907 self.as_raw_response()
1908 }
1909 }
1910 #[derive(Clone)]
1911 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1912 #[doc = r""]
1913 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1914 #[doc = r" parameters can be chained."]
1915 #[doc = r""]
1916 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1917 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1918 #[doc = r" executes the request and returns a `Result` with the parsed"]
1919 #[doc = r" response."]
1920 #[doc = r""]
1921 #[doc = r" If you need lower-level access to the raw response details"]
1922 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1923 #[doc = r" can finalize the request using the"]
1924 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1925 #[doc = r" that resolves to a lower-level [`Response`] value."]
1926 pub struct RequestBuilder {
1927 pub(crate) client: super::super::Client,
1928 pub(crate) organization: String,
1929 pub(crate) repository_id: String,
1930 pub(crate) project: String,
1931 pub(crate) search_criteria_skip: Option<i32>,
1932 pub(crate) search_criteria_top: Option<i32>,
1933 pub(crate) search_criteria_author: Option<String>,
1934 pub(crate) search_criteria_compare_version_version: Option<String>,
1935 pub(crate) search_criteria_compare_version_version_options: Option<String>,
1936 pub(crate) search_criteria_compare_version_version_type: Option<String>,
1937 pub(crate) search_criteria_exclude_deletes: Option<bool>,
1938 pub(crate) search_criteria_from_commit_id: Option<String>,
1939 pub(crate) search_criteria_from_date: Option<String>,
1940 pub(crate) search_criteria_history_mode: Option<String>,
1941 pub(crate) search_criteria_ids: Vec<String>,
1942 pub(crate) search_criteria_include_links: Option<bool>,
1943 pub(crate) search_criteria_include_push_data: Option<bool>,
1944 pub(crate) search_criteria_include_user_image_url: Option<bool>,
1945 pub(crate) search_criteria_include_work_items: Option<bool>,
1946 pub(crate) search_criteria_item_path: Option<String>,
1947 pub(crate) search_criteria_item_version_version: Option<String>,
1948 pub(crate) search_criteria_item_version_version_options: Option<String>,
1949 pub(crate) search_criteria_item_version_version_type: Option<String>,
1950 pub(crate) search_criteria_show_oldest_commits_first: Option<bool>,
1951 pub(crate) search_criteria_to_commit_id: Option<String>,
1952 pub(crate) search_criteria_to_date: Option<String>,
1953 pub(crate) search_criteria_user: Option<String>,
1954 }
1955 impl RequestBuilder {
1956 #[doc = "Number of entries to skip"]
1957 pub fn search_criteria_skip(mut self, search_criteria_skip: i32) -> Self {
1958 self.search_criteria_skip = Some(search_criteria_skip);
1959 self
1960 }
1961 #[doc = "Maximum number of entries to retrieve"]
1962 pub fn search_criteria_top(mut self, search_criteria_top: i32) -> Self {
1963 self.search_criteria_top = Some(search_criteria_top);
1964 self
1965 }
1966 #[doc = "Alias or display name of the author"]
1967 pub fn search_criteria_author(
1968 mut self,
1969 search_criteria_author: impl Into<String>,
1970 ) -> Self {
1971 self.search_criteria_author = Some(search_criteria_author.into());
1972 self
1973 }
1974 #[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
1975 pub fn search_criteria_compare_version_version(
1976 mut self,
1977 search_criteria_compare_version_version: impl Into<String>,
1978 ) -> Self {
1979 self.search_criteria_compare_version_version =
1980 Some(search_criteria_compare_version_version.into());
1981 self
1982 }
1983 #[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
1984 pub fn search_criteria_compare_version_version_options(
1985 mut self,
1986 search_criteria_compare_version_version_options: impl Into<String>,
1987 ) -> Self {
1988 self.search_criteria_compare_version_version_options =
1989 Some(search_criteria_compare_version_version_options.into());
1990 self
1991 }
1992 #[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
1993 pub fn search_criteria_compare_version_version_type(
1994 mut self,
1995 search_criteria_compare_version_version_type: impl Into<String>,
1996 ) -> Self {
1997 self.search_criteria_compare_version_version_type =
1998 Some(search_criteria_compare_version_version_type.into());
1999 self
2000 }
2001 #[doc = "Only applies when an itemPath is specified. This determines whether to exclude delete entries of the specified path."]
2002 pub fn search_criteria_exclude_deletes(
2003 mut self,
2004 search_criteria_exclude_deletes: bool,
2005 ) -> Self {
2006 self.search_criteria_exclude_deletes = Some(search_criteria_exclude_deletes);
2007 self
2008 }
2009 #[doc = "If provided, a lower bound for filtering commits alphabetically"]
2010 pub fn search_criteria_from_commit_id(
2011 mut self,
2012 search_criteria_from_commit_id: impl Into<String>,
2013 ) -> Self {
2014 self.search_criteria_from_commit_id = Some(search_criteria_from_commit_id.into());
2015 self
2016 }
2017 #[doc = "If provided, only include history entries created after this date (string)"]
2018 pub fn search_criteria_from_date(
2019 mut self,
2020 search_criteria_from_date: impl Into<String>,
2021 ) -> Self {
2022 self.search_criteria_from_date = Some(search_criteria_from_date.into());
2023 self
2024 }
2025 #[doc = "What Git history mode should be used. This only applies to the search criteria when Ids = null and an itemPath is specified."]
2026 pub fn search_criteria_history_mode(
2027 mut self,
2028 search_criteria_history_mode: impl Into<String>,
2029 ) -> Self {
2030 self.search_criteria_history_mode = Some(search_criteria_history_mode.into());
2031 self
2032 }
2033 #[doc = "If provided, specifies the exact commit ids of the commits to fetch. May not be combined with other parameters."]
2034 pub fn search_criteria_ids(mut self, search_criteria_ids: Vec<String>) -> Self {
2035 self.search_criteria_ids = search_criteria_ids;
2036 self
2037 }
2038 #[doc = "Whether to include the _links field on the shallow references"]
2039 pub fn search_criteria_include_links(
2040 mut self,
2041 search_criteria_include_links: bool,
2042 ) -> Self {
2043 self.search_criteria_include_links = Some(search_criteria_include_links);
2044 self
2045 }
2046 #[doc = "Whether to include the push information"]
2047 pub fn search_criteria_include_push_data(
2048 mut self,
2049 search_criteria_include_push_data: bool,
2050 ) -> Self {
2051 self.search_criteria_include_push_data = Some(search_criteria_include_push_data);
2052 self
2053 }
2054 #[doc = "Whether to include the image Url for committers and authors"]
2055 pub fn search_criteria_include_user_image_url(
2056 mut self,
2057 search_criteria_include_user_image_url: bool,
2058 ) -> Self {
2059 self.search_criteria_include_user_image_url =
2060 Some(search_criteria_include_user_image_url);
2061 self
2062 }
2063 #[doc = "Whether to include linked work items"]
2064 pub fn search_criteria_include_work_items(
2065 mut self,
2066 search_criteria_include_work_items: bool,
2067 ) -> Self {
2068 self.search_criteria_include_work_items = Some(search_criteria_include_work_items);
2069 self
2070 }
2071 #[doc = "Path of item to search under"]
2072 pub fn search_criteria_item_path(
2073 mut self,
2074 search_criteria_item_path: impl Into<String>,
2075 ) -> Self {
2076 self.search_criteria_item_path = Some(search_criteria_item_path.into());
2077 self
2078 }
2079 #[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
2080 pub fn search_criteria_item_version_version(
2081 mut self,
2082 search_criteria_item_version_version: impl Into<String>,
2083 ) -> Self {
2084 self.search_criteria_item_version_version =
2085 Some(search_criteria_item_version_version.into());
2086 self
2087 }
2088 #[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
2089 pub fn search_criteria_item_version_version_options(
2090 mut self,
2091 search_criteria_item_version_version_options: impl Into<String>,
2092 ) -> Self {
2093 self.search_criteria_item_version_version_options =
2094 Some(search_criteria_item_version_version_options.into());
2095 self
2096 }
2097 #[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
2098 pub fn search_criteria_item_version_version_type(
2099 mut self,
2100 search_criteria_item_version_version_type: impl Into<String>,
2101 ) -> Self {
2102 self.search_criteria_item_version_version_type =
2103 Some(search_criteria_item_version_version_type.into());
2104 self
2105 }
2106 #[doc = "If enabled, this option will ignore the itemVersion and compareVersion parameters"]
2107 pub fn search_criteria_show_oldest_commits_first(
2108 mut self,
2109 search_criteria_show_oldest_commits_first: bool,
2110 ) -> Self {
2111 self.search_criteria_show_oldest_commits_first =
2112 Some(search_criteria_show_oldest_commits_first);
2113 self
2114 }
2115 #[doc = "If provided, an upper bound for filtering commits alphabetically"]
2116 pub fn search_criteria_to_commit_id(
2117 mut self,
2118 search_criteria_to_commit_id: impl Into<String>,
2119 ) -> Self {
2120 self.search_criteria_to_commit_id = Some(search_criteria_to_commit_id.into());
2121 self
2122 }
2123 #[doc = "If provided, only include history entries created before this date (string)"]
2124 pub fn search_criteria_to_date(
2125 mut self,
2126 search_criteria_to_date: impl Into<String>,
2127 ) -> Self {
2128 self.search_criteria_to_date = Some(search_criteria_to_date.into());
2129 self
2130 }
2131 #[doc = "Alias or display name of the committer"]
2132 pub fn search_criteria_user(mut self, search_criteria_user: impl Into<String>) -> Self {
2133 self.search_criteria_user = Some(search_criteria_user.into());
2134 self
2135 }
2136 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2137 #[doc = ""]
2138 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2139 #[doc = "However, this function can provide more flexibility when required."]
2140 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2141 Box::pin({
2142 let this = self.clone();
2143 async move {
2144 let url = this.url()?;
2145 let mut req =
2146 azure_core::http::Request::new(url, azure_core::http::Method::Get);
2147 if let Some(auth_header) = this
2148 .client
2149 .token_credential()
2150 .http_authorization_header(&this.client.scopes())
2151 .await?
2152 {
2153 req.insert_header(
2154 azure_core::http::headers::AUTHORIZATION,
2155 auth_header,
2156 );
2157 }
2158 if let Some(search_criteria_skip) = &this.search_criteria_skip {
2159 req.url_mut().query_pairs_mut().append_pair(
2160 "searchCriteria.$skip",
2161 &search_criteria_skip.to_string(),
2162 );
2163 }
2164 if let Some(search_criteria_top) = &this.search_criteria_top {
2165 req.url_mut().query_pairs_mut().append_pair(
2166 "searchCriteria.$top",
2167 &search_criteria_top.to_string(),
2168 );
2169 }
2170 if let Some(search_criteria_author) = &this.search_criteria_author {
2171 req.url_mut()
2172 .query_pairs_mut()
2173 .append_pair("searchCriteria.author", search_criteria_author);
2174 }
2175 if let Some(search_criteria_compare_version_version) =
2176 &this.search_criteria_compare_version_version
2177 {
2178 req.url_mut().query_pairs_mut().append_pair(
2179 "searchCriteria.compareVersion.version",
2180 search_criteria_compare_version_version,
2181 );
2182 }
2183 if let Some(search_criteria_compare_version_version_options) =
2184 &this.search_criteria_compare_version_version_options
2185 {
2186 req.url_mut().query_pairs_mut().append_pair(
2187 "searchCriteria.compareVersion.versionOptions",
2188 search_criteria_compare_version_version_options,
2189 );
2190 }
2191 if let Some(search_criteria_compare_version_version_type) =
2192 &this.search_criteria_compare_version_version_type
2193 {
2194 req.url_mut().query_pairs_mut().append_pair(
2195 "searchCriteria.compareVersion.versionType",
2196 search_criteria_compare_version_version_type,
2197 );
2198 }
2199 if let Some(search_criteria_exclude_deletes) =
2200 &this.search_criteria_exclude_deletes
2201 {
2202 req.url_mut().query_pairs_mut().append_pair(
2203 "searchCriteria.excludeDeletes",
2204 &search_criteria_exclude_deletes.to_string(),
2205 );
2206 }
2207 if let Some(search_criteria_from_commit_id) =
2208 &this.search_criteria_from_commit_id
2209 {
2210 req.url_mut().query_pairs_mut().append_pair(
2211 "searchCriteria.fromCommitId",
2212 search_criteria_from_commit_id,
2213 );
2214 }
2215 if let Some(search_criteria_from_date) = &this.search_criteria_from_date {
2216 req.url_mut()
2217 .query_pairs_mut()
2218 .append_pair("searchCriteria.fromDate", search_criteria_from_date);
2219 }
2220 if let Some(search_criteria_history_mode) =
2221 &this.search_criteria_history_mode
2222 {
2223 req.url_mut().query_pairs_mut().append_pair(
2224 "searchCriteria.historyMode",
2225 search_criteria_history_mode,
2226 );
2227 }
2228 if let Some(search_criteria_include_links) =
2229 &this.search_criteria_include_links
2230 {
2231 req.url_mut().query_pairs_mut().append_pair(
2232 "searchCriteria.includeLinks",
2233 &search_criteria_include_links.to_string(),
2234 );
2235 }
2236 if let Some(search_criteria_include_push_data) =
2237 &this.search_criteria_include_push_data
2238 {
2239 req.url_mut().query_pairs_mut().append_pair(
2240 "searchCriteria.includePushData",
2241 &search_criteria_include_push_data.to_string(),
2242 );
2243 }
2244 if let Some(search_criteria_include_user_image_url) =
2245 &this.search_criteria_include_user_image_url
2246 {
2247 req.url_mut().query_pairs_mut().append_pair(
2248 "searchCriteria.includeUserImageUrl",
2249 &search_criteria_include_user_image_url.to_string(),
2250 );
2251 }
2252 if let Some(search_criteria_include_work_items) =
2253 &this.search_criteria_include_work_items
2254 {
2255 req.url_mut().query_pairs_mut().append_pair(
2256 "searchCriteria.includeWorkItems",
2257 &search_criteria_include_work_items.to_string(),
2258 );
2259 }
2260 if let Some(search_criteria_item_path) = &this.search_criteria_item_path {
2261 req.url_mut()
2262 .query_pairs_mut()
2263 .append_pair("searchCriteria.itemPath", search_criteria_item_path);
2264 }
2265 if let Some(search_criteria_item_version_version) =
2266 &this.search_criteria_item_version_version
2267 {
2268 req.url_mut().query_pairs_mut().append_pair(
2269 "searchCriteria.itemVersion.version",
2270 search_criteria_item_version_version,
2271 );
2272 }
2273 if let Some(search_criteria_item_version_version_options) =
2274 &this.search_criteria_item_version_version_options
2275 {
2276 req.url_mut().query_pairs_mut().append_pair(
2277 "searchCriteria.itemVersion.versionOptions",
2278 search_criteria_item_version_version_options,
2279 );
2280 }
2281 if let Some(search_criteria_item_version_version_type) =
2282 &this.search_criteria_item_version_version_type
2283 {
2284 req.url_mut().query_pairs_mut().append_pair(
2285 "searchCriteria.itemVersion.versionType",
2286 search_criteria_item_version_version_type,
2287 );
2288 }
2289 if let Some(search_criteria_show_oldest_commits_first) =
2290 &this.search_criteria_show_oldest_commits_first
2291 {
2292 req.url_mut().query_pairs_mut().append_pair(
2293 "searchCriteria.showOldestCommitsFirst",
2294 &search_criteria_show_oldest_commits_first.to_string(),
2295 );
2296 }
2297 if let Some(search_criteria_to_commit_id) =
2298 &this.search_criteria_to_commit_id
2299 {
2300 req.url_mut().query_pairs_mut().append_pair(
2301 "searchCriteria.toCommitId",
2302 search_criteria_to_commit_id,
2303 );
2304 }
2305 if let Some(search_criteria_to_date) = &this.search_criteria_to_date {
2306 req.url_mut()
2307 .query_pairs_mut()
2308 .append_pair("searchCriteria.toDate", search_criteria_to_date);
2309 }
2310 if let Some(search_criteria_user) = &this.search_criteria_user {
2311 req.url_mut()
2312 .query_pairs_mut()
2313 .append_pair("searchCriteria.user", search_criteria_user);
2314 }
2315 let req_body = azure_core::Bytes::new();
2316 req.set_body(req_body);
2317 Ok(Response(this.client.send(&mut req).await?))
2318 }
2319 })
2320 }
2321 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
2322 let mut url = azure_core::http::Url::parse(&format!(
2323 "{}/{}/{}/_apis/git/repositories/{}/commits?",
2324 self.client.endpoint(),
2325 &self.organization,
2326 &self.project,
2327 &self.repository_id
2328 ))?;
2329 let has_api_version_already = url
2330 .query_pairs()
2331 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
2332 if !has_api_version_already {
2333 url.query_pairs_mut().append_pair(
2334 azure_core::http::headers::query_param::API_VERSION,
2335 "7.1-preview",
2336 );
2337 }
2338 Ok(url)
2339 }
2340 }
2341 impl std::future::IntoFuture for RequestBuilder {
2342 type Output = azure_core::Result<models::GitCommitRefList>;
2343 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
2344 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2345 #[doc = ""]
2346 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2347 #[doc = ""]
2348 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2349 fn into_future(self) -> Self::IntoFuture {
2350 Box::pin(async move { self.send().await?.into_raw_body().await })
2351 }
2352 }
2353 }
2354 pub mod get_push_commits {
2355 use super::models;
2356 #[cfg(not(target_arch = "wasm32"))]
2357 use futures::future::BoxFuture;
2358 #[cfg(target_arch = "wasm32")]
2359 use futures::future::LocalBoxFuture as BoxFuture;
2360 #[derive(Debug)]
2361 pub struct Response(azure_core::http::Response);
2362 impl Response {
2363 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCommitRefList> {
2364 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
2365 let body: models::GitCommitRefList =
2366 serde_json::from_slice(&bytes).map_err(|e| {
2367 azure_core::error::Error::full(
2368 azure_core::error::ErrorKind::DataConversion,
2369 e,
2370 format!(
2371 "Failed to deserialize response:\n{}",
2372 String::from_utf8_lossy(&bytes)
2373 ),
2374 )
2375 })?;
2376 Ok(body)
2377 }
2378 pub fn into_raw_response(self) -> azure_core::http::Response {
2379 self.0
2380 }
2381 pub fn as_raw_response(&self) -> &azure_core::http::Response {
2382 &self.0
2383 }
2384 }
2385 impl From<Response> for azure_core::http::Response {
2386 fn from(rsp: Response) -> Self {
2387 rsp.into_raw_response()
2388 }
2389 }
2390 impl AsRef<azure_core::http::Response> for Response {
2391 fn as_ref(&self) -> &azure_core::http::Response {
2392 self.as_raw_response()
2393 }
2394 }
2395 #[derive(Clone)]
2396 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2397 #[doc = r""]
2398 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2399 #[doc = r" parameters can be chained."]
2400 #[doc = r""]
2401 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2402 #[doc = r" converts the [`RequestBuilder`] into a future,"]
2403 #[doc = r" executes the request and returns a `Result` with the parsed"]
2404 #[doc = r" response."]
2405 #[doc = r""]
2406 #[doc = r" If you need lower-level access to the raw response details"]
2407 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2408 #[doc = r" can finalize the request using the"]
2409 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2410 #[doc = r" that resolves to a lower-level [`Response`] value."]
2411 pub struct RequestBuilder {
2412 pub(crate) client: super::super::Client,
2413 pub(crate) organization: String,
2414 pub(crate) repository_id: String,
2415 pub(crate) push_id: i32,
2416 pub(crate) project: String,
2417 pub(crate) top: Option<i32>,
2418 pub(crate) skip: Option<i32>,
2419 pub(crate) include_links: Option<bool>,
2420 }
2421 impl RequestBuilder {
2422 #[doc = "The maximum number of commits to return (\"get the top x commits\")."]
2423 pub fn top(mut self, top: i32) -> Self {
2424 self.top = Some(top);
2425 self
2426 }
2427 #[doc = "The number of commits to skip."]
2428 pub fn skip(mut self, skip: i32) -> Self {
2429 self.skip = Some(skip);
2430 self
2431 }
2432 #[doc = "Set to false to avoid including REST Url links for resources. Defaults to true."]
2433 pub fn include_links(mut self, include_links: bool) -> Self {
2434 self.include_links = Some(include_links);
2435 self
2436 }
2437 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2438 #[doc = ""]
2439 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2440 #[doc = "However, this function can provide more flexibility when required."]
2441 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2442 Box::pin({
2443 let this = self.clone();
2444 async move {
2445 let url = this.url()?;
2446 let mut req =
2447 azure_core::http::Request::new(url, azure_core::http::Method::Get);
2448 if let Some(auth_header) = this
2449 .client
2450 .token_credential()
2451 .http_authorization_header(&this.client.scopes())
2452 .await?
2453 {
2454 req.insert_header(
2455 azure_core::http::headers::AUTHORIZATION,
2456 auth_header,
2457 );
2458 }
2459 let push_id = &this.push_id;
2460 req.url_mut()
2461 .query_pairs_mut()
2462 .append_pair("pushId", &push_id.to_string());
2463 if let Some(top) = &this.top {
2464 req.url_mut()
2465 .query_pairs_mut()
2466 .append_pair("top", &top.to_string());
2467 }
2468 if let Some(skip) = &this.skip {
2469 req.url_mut()
2470 .query_pairs_mut()
2471 .append_pair("skip", &skip.to_string());
2472 }
2473 if let Some(include_links) = &this.include_links {
2474 req.url_mut()
2475 .query_pairs_mut()
2476 .append_pair("includeLinks", &include_links.to_string());
2477 }
2478 let req_body = azure_core::Bytes::new();
2479 req.set_body(req_body);
2480 Ok(Response(this.client.send(&mut req).await?))
2481 }
2482 })
2483 }
2484 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
2485 let mut url = azure_core::http::Url::parse(&format!(
2486 "{}/{}/{}/_apis/git/repositories/{}/commits",
2487 self.client.endpoint(),
2488 &self.organization,
2489 &self.project,
2490 &self.repository_id
2491 ))?;
2492 let has_api_version_already = url
2493 .query_pairs()
2494 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
2495 if !has_api_version_already {
2496 url.query_pairs_mut().append_pair(
2497 azure_core::http::headers::query_param::API_VERSION,
2498 "7.1-preview",
2499 );
2500 }
2501 Ok(url)
2502 }
2503 }
2504 impl std::future::IntoFuture for RequestBuilder {
2505 type Output = azure_core::Result<models::GitCommitRefList>;
2506 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
2507 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2508 #[doc = ""]
2509 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2510 #[doc = ""]
2511 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2512 fn into_future(self) -> Self::IntoFuture {
2513 Box::pin(async move { self.send().await?.into_raw_body().await })
2514 }
2515 }
2516 }
2517 pub mod get {
2518 use super::models;
2519 #[cfg(not(target_arch = "wasm32"))]
2520 use futures::future::BoxFuture;
2521 #[cfg(target_arch = "wasm32")]
2522 use futures::future::LocalBoxFuture as BoxFuture;
2523 #[derive(Debug)]
2524 pub struct Response(azure_core::http::Response);
2525 impl Response {
2526 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCommit> {
2527 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
2528 let body: models::GitCommit = serde_json::from_slice(&bytes).map_err(|e| {
2529 azure_core::error::Error::full(
2530 azure_core::error::ErrorKind::DataConversion,
2531 e,
2532 format!(
2533 "Failed to deserialize response:\n{}",
2534 String::from_utf8_lossy(&bytes)
2535 ),
2536 )
2537 })?;
2538 Ok(body)
2539 }
2540 pub fn into_raw_response(self) -> azure_core::http::Response {
2541 self.0
2542 }
2543 pub fn as_raw_response(&self) -> &azure_core::http::Response {
2544 &self.0
2545 }
2546 }
2547 impl From<Response> for azure_core::http::Response {
2548 fn from(rsp: Response) -> Self {
2549 rsp.into_raw_response()
2550 }
2551 }
2552 impl AsRef<azure_core::http::Response> for Response {
2553 fn as_ref(&self) -> &azure_core::http::Response {
2554 self.as_raw_response()
2555 }
2556 }
2557 #[derive(Clone)]
2558 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2559 #[doc = r""]
2560 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2561 #[doc = r" parameters can be chained."]
2562 #[doc = r""]
2563 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2564 #[doc = r" converts the [`RequestBuilder`] into a future,"]
2565 #[doc = r" executes the request and returns a `Result` with the parsed"]
2566 #[doc = r" response."]
2567 #[doc = r""]
2568 #[doc = r" If you need lower-level access to the raw response details"]
2569 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2570 #[doc = r" can finalize the request using the"]
2571 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2572 #[doc = r" that resolves to a lower-level [`Response`] value."]
2573 pub struct RequestBuilder {
2574 pub(crate) client: super::super::Client,
2575 pub(crate) organization: String,
2576 pub(crate) commit_id: String,
2577 pub(crate) repository_id: String,
2578 pub(crate) project: String,
2579 pub(crate) change_count: Option<i32>,
2580 }
2581 impl RequestBuilder {
2582 #[doc = "The number of changes to include in the result."]
2583 pub fn change_count(mut self, change_count: i32) -> Self {
2584 self.change_count = Some(change_count);
2585 self
2586 }
2587 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2588 #[doc = ""]
2589 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2590 #[doc = "However, this function can provide more flexibility when required."]
2591 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2592 Box::pin({
2593 let this = self.clone();
2594 async move {
2595 let url = this.url()?;
2596 let mut req =
2597 azure_core::http::Request::new(url, azure_core::http::Method::Get);
2598 if let Some(auth_header) = this
2599 .client
2600 .token_credential()
2601 .http_authorization_header(&this.client.scopes())
2602 .await?
2603 {
2604 req.insert_header(
2605 azure_core::http::headers::AUTHORIZATION,
2606 auth_header,
2607 );
2608 }
2609 if let Some(change_count) = &this.change_count {
2610 req.url_mut()
2611 .query_pairs_mut()
2612 .append_pair("changeCount", &change_count.to_string());
2613 }
2614 let req_body = azure_core::Bytes::new();
2615 req.set_body(req_body);
2616 Ok(Response(this.client.send(&mut req).await?))
2617 }
2618 })
2619 }
2620 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
2621 let mut url = azure_core::http::Url::parse(&format!(
2622 "{}/{}/{}/_apis/git/repositories/{}/commits/{}",
2623 self.client.endpoint(),
2624 &self.organization,
2625 &self.project,
2626 &self.repository_id,
2627 &self.commit_id
2628 ))?;
2629 let has_api_version_already = url
2630 .query_pairs()
2631 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
2632 if !has_api_version_already {
2633 url.query_pairs_mut().append_pair(
2634 azure_core::http::headers::query_param::API_VERSION,
2635 "7.1-preview",
2636 );
2637 }
2638 Ok(url)
2639 }
2640 }
2641 impl std::future::IntoFuture for RequestBuilder {
2642 type Output = azure_core::Result<models::GitCommit>;
2643 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCommit>>;
2644 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2645 #[doc = ""]
2646 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2647 #[doc = ""]
2648 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2649 fn into_future(self) -> Self::IntoFuture {
2650 Box::pin(async move { self.send().await?.into_raw_body().await })
2651 }
2652 }
2653 }
2654 pub mod get_changes {
2655 use super::models;
2656 #[cfg(not(target_arch = "wasm32"))]
2657 use futures::future::BoxFuture;
2658 #[cfg(target_arch = "wasm32")]
2659 use futures::future::LocalBoxFuture as BoxFuture;
2660 #[derive(Debug)]
2661 pub struct Response(azure_core::http::Response);
2662 impl Response {
2663 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCommitChanges> {
2664 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
2665 let body: models::GitCommitChanges =
2666 serde_json::from_slice(&bytes).map_err(|e| {
2667 azure_core::error::Error::full(
2668 azure_core::error::ErrorKind::DataConversion,
2669 e,
2670 format!(
2671 "Failed to deserialize response:\n{}",
2672 String::from_utf8_lossy(&bytes)
2673 ),
2674 )
2675 })?;
2676 Ok(body)
2677 }
2678 pub fn into_raw_response(self) -> azure_core::http::Response {
2679 self.0
2680 }
2681 pub fn as_raw_response(&self) -> &azure_core::http::Response {
2682 &self.0
2683 }
2684 }
2685 impl From<Response> for azure_core::http::Response {
2686 fn from(rsp: Response) -> Self {
2687 rsp.into_raw_response()
2688 }
2689 }
2690 impl AsRef<azure_core::http::Response> for Response {
2691 fn as_ref(&self) -> &azure_core::http::Response {
2692 self.as_raw_response()
2693 }
2694 }
2695 #[derive(Clone)]
2696 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2697 #[doc = r""]
2698 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2699 #[doc = r" parameters can be chained."]
2700 #[doc = r""]
2701 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2702 #[doc = r" converts the [`RequestBuilder`] into a future,"]
2703 #[doc = r" executes the request and returns a `Result` with the parsed"]
2704 #[doc = r" response."]
2705 #[doc = r""]
2706 #[doc = r" If you need lower-level access to the raw response details"]
2707 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2708 #[doc = r" can finalize the request using the"]
2709 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2710 #[doc = r" that resolves to a lower-level [`Response`] value."]
2711 pub struct RequestBuilder {
2712 pub(crate) client: super::super::Client,
2713 pub(crate) organization: String,
2714 pub(crate) commit_id: String,
2715 pub(crate) repository_id: String,
2716 pub(crate) project: String,
2717 pub(crate) top: Option<i32>,
2718 pub(crate) skip: Option<i32>,
2719 }
2720 impl RequestBuilder {
2721 #[doc = "The maximum number of changes to return."]
2722 pub fn top(mut self, top: i32) -> Self {
2723 self.top = Some(top);
2724 self
2725 }
2726 #[doc = "The number of changes to skip."]
2727 pub fn skip(mut self, skip: i32) -> Self {
2728 self.skip = Some(skip);
2729 self
2730 }
2731 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2732 #[doc = ""]
2733 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2734 #[doc = "However, this function can provide more flexibility when required."]
2735 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2736 Box::pin({
2737 let this = self.clone();
2738 async move {
2739 let url = this.url()?;
2740 let mut req =
2741 azure_core::http::Request::new(url, azure_core::http::Method::Get);
2742 if let Some(auth_header) = this
2743 .client
2744 .token_credential()
2745 .http_authorization_header(&this.client.scopes())
2746 .await?
2747 {
2748 req.insert_header(
2749 azure_core::http::headers::AUTHORIZATION,
2750 auth_header,
2751 );
2752 }
2753 if let Some(top) = &this.top {
2754 req.url_mut()
2755 .query_pairs_mut()
2756 .append_pair("top", &top.to_string());
2757 }
2758 if let Some(skip) = &this.skip {
2759 req.url_mut()
2760 .query_pairs_mut()
2761 .append_pair("skip", &skip.to_string());
2762 }
2763 let req_body = azure_core::Bytes::new();
2764 req.set_body(req_body);
2765 Ok(Response(this.client.send(&mut req).await?))
2766 }
2767 })
2768 }
2769 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
2770 let mut url = azure_core::http::Url::parse(&format!(
2771 "{}/{}/{}/_apis/git/repositories/{}/commits/{}/changes",
2772 self.client.endpoint(),
2773 &self.organization,
2774 &self.project,
2775 &self.repository_id,
2776 &self.commit_id
2777 ))?;
2778 let has_api_version_already = url
2779 .query_pairs()
2780 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
2781 if !has_api_version_already {
2782 url.query_pairs_mut().append_pair(
2783 azure_core::http::headers::query_param::API_VERSION,
2784 "7.1-preview",
2785 );
2786 }
2787 Ok(url)
2788 }
2789 }
2790 impl std::future::IntoFuture for RequestBuilder {
2791 type Output = azure_core::Result<models::GitCommitChanges>;
2792 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCommitChanges>>;
2793 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2794 #[doc = ""]
2795 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2796 #[doc = ""]
2797 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2798 fn into_future(self) -> Self::IntoFuture {
2799 Box::pin(async move { self.send().await?.into_raw_body().await })
2800 }
2801 }
2802 }
2803 pub mod get_commits_batch {
2804 use super::models;
2805 #[cfg(not(target_arch = "wasm32"))]
2806 use futures::future::BoxFuture;
2807 #[cfg(target_arch = "wasm32")]
2808 use futures::future::LocalBoxFuture as BoxFuture;
2809 #[derive(Debug)]
2810 pub struct Response(azure_core::http::Response);
2811 impl Response {
2812 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCommitRefList> {
2813 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
2814 let body: models::GitCommitRefList =
2815 serde_json::from_slice(&bytes).map_err(|e| {
2816 azure_core::error::Error::full(
2817 azure_core::error::ErrorKind::DataConversion,
2818 e,
2819 format!(
2820 "Failed to deserialize response:\n{}",
2821 String::from_utf8_lossy(&bytes)
2822 ),
2823 )
2824 })?;
2825 Ok(body)
2826 }
2827 pub fn into_raw_response(self) -> azure_core::http::Response {
2828 self.0
2829 }
2830 pub fn as_raw_response(&self) -> &azure_core::http::Response {
2831 &self.0
2832 }
2833 }
2834 impl From<Response> for azure_core::http::Response {
2835 fn from(rsp: Response) -> Self {
2836 rsp.into_raw_response()
2837 }
2838 }
2839 impl AsRef<azure_core::http::Response> for Response {
2840 fn as_ref(&self) -> &azure_core::http::Response {
2841 self.as_raw_response()
2842 }
2843 }
2844 #[derive(Clone)]
2845 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2846 #[doc = r""]
2847 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2848 #[doc = r" parameters can be chained."]
2849 #[doc = r""]
2850 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2851 #[doc = r" converts the [`RequestBuilder`] into a future,"]
2852 #[doc = r" executes the request and returns a `Result` with the parsed"]
2853 #[doc = r" response."]
2854 #[doc = r""]
2855 #[doc = r" If you need lower-level access to the raw response details"]
2856 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2857 #[doc = r" can finalize the request using the"]
2858 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2859 #[doc = r" that resolves to a lower-level [`Response`] value."]
2860 pub struct RequestBuilder {
2861 pub(crate) client: super::super::Client,
2862 pub(crate) organization: String,
2863 pub(crate) body: models::GitQueryCommitsCriteria,
2864 pub(crate) repository_id: String,
2865 pub(crate) project: String,
2866 pub(crate) skip: Option<i32>,
2867 pub(crate) top: Option<i32>,
2868 pub(crate) include_statuses: Option<bool>,
2869 }
2870 impl RequestBuilder {
2871 #[doc = "Number of commits to skip. The value cannot exceed 3,000,000."]
2872 pub fn skip(mut self, skip: i32) -> Self {
2873 self.skip = Some(skip);
2874 self
2875 }
2876 #[doc = "Maximum number of commits to return. The value cannot exceed 50,000."]
2877 pub fn top(mut self, top: i32) -> Self {
2878 self.top = Some(top);
2879 self
2880 }
2881 #[doc = "Set to true to include additional commit status information."]
2882 pub fn include_statuses(mut self, include_statuses: bool) -> Self {
2883 self.include_statuses = Some(include_statuses);
2884 self
2885 }
2886 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2887 #[doc = ""]
2888 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2889 #[doc = "However, this function can provide more flexibility when required."]
2890 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2891 Box::pin({
2892 let this = self.clone();
2893 async move {
2894 let url = this.url()?;
2895 let mut req =
2896 azure_core::http::Request::new(url, azure_core::http::Method::Post);
2897 if let Some(auth_header) = this
2898 .client
2899 .token_credential()
2900 .http_authorization_header(&this.client.scopes())
2901 .await?
2902 {
2903 req.insert_header(
2904 azure_core::http::headers::AUTHORIZATION,
2905 auth_header,
2906 );
2907 }
2908 req.insert_header("content-type", "application/json");
2909 let req_body = azure_core::json::to_json(&this.body)?;
2910 if let Some(skip) = &this.skip {
2911 req.url_mut()
2912 .query_pairs_mut()
2913 .append_pair("$skip", &skip.to_string());
2914 }
2915 if let Some(top) = &this.top {
2916 req.url_mut()
2917 .query_pairs_mut()
2918 .append_pair("$top", &top.to_string());
2919 }
2920 if let Some(include_statuses) = &this.include_statuses {
2921 req.url_mut()
2922 .query_pairs_mut()
2923 .append_pair("includeStatuses", &include_statuses.to_string());
2924 }
2925 req.set_body(req_body);
2926 Ok(Response(this.client.send(&mut req).await?))
2927 }
2928 })
2929 }
2930 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
2931 let mut url = azure_core::http::Url::parse(&format!(
2932 "{}/{}/{}/_apis/git/repositories/{}/commitsbatch",
2933 self.client.endpoint(),
2934 &self.organization,
2935 &self.project,
2936 &self.repository_id
2937 ))?;
2938 let has_api_version_already = url
2939 .query_pairs()
2940 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
2941 if !has_api_version_already {
2942 url.query_pairs_mut().append_pair(
2943 azure_core::http::headers::query_param::API_VERSION,
2944 "7.1-preview",
2945 );
2946 }
2947 Ok(url)
2948 }
2949 }
2950 impl std::future::IntoFuture for RequestBuilder {
2951 type Output = azure_core::Result<models::GitCommitRefList>;
2952 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
2953 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2954 #[doc = ""]
2955 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2956 #[doc = ""]
2957 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2958 fn into_future(self) -> Self::IntoFuture {
2959 Box::pin(async move { self.send().await?.into_raw_body().await })
2960 }
2961 }
2962 }
2963}
2964pub mod items {
2965 use super::models;
2966 #[cfg(not(target_arch = "wasm32"))]
2967 use futures::future::BoxFuture;
2968 #[cfg(target_arch = "wasm32")]
2969 use futures::future::LocalBoxFuture as BoxFuture;
2970 pub struct Client(pub(crate) super::Client);
2971 impl Client {
2972 #[doc = "Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download."]
2973 #[doc = ""]
2974 #[doc = "Arguments:"]
2975 #[doc = "* `organization`: The name of the Azure DevOps organization."]
2976 #[doc = "* `repository_id`: The name or ID of the repository."]
2977 #[doc = "* `path`: The item path."]
2978 #[doc = "* `project`: Project ID or project name"]
2979 pub fn get(
2980 &self,
2981 organization: impl Into<String>,
2982 repository_id: impl Into<String>,
2983 path: impl Into<String>,
2984 project: impl Into<String>,
2985 ) -> get::RequestBuilder {
2986 get::RequestBuilder {
2987 client: self.0.clone(),
2988 organization: organization.into(),
2989 repository_id: repository_id.into(),
2990 path: path.into(),
2991 project: project.into(),
2992 scope_path: None,
2993 recursion_level: None,
2994 include_content_metadata: None,
2995 latest_processed_change: None,
2996 download: None,
2997 format: None,
2998 version_descriptor_version: None,
2999 version_descriptor_version_options: None,
3000 version_descriptor_version_type: None,
3001 include_content: None,
3002 resolve_lfs: None,
3003 sanitize: None,
3004 }
3005 }
3006 #[doc = "Get Item Metadata and/or Content for a collection of items. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download."]
3007 #[doc = ""]
3008 #[doc = "Arguments:"]
3009 #[doc = "* `organization`: The name of the Azure DevOps organization."]
3010 #[doc = "* `repository_id`: The name or ID of the repository."]
3011 #[doc = "* `project`: Project ID or project name"]
3012 pub fn list(
3013 &self,
3014 organization: impl Into<String>,
3015 repository_id: impl Into<String>,
3016 project: impl Into<String>,
3017 ) -> list::RequestBuilder {
3018 list::RequestBuilder {
3019 client: self.0.clone(),
3020 organization: organization.into(),
3021 repository_id: repository_id.into(),
3022 project: project.into(),
3023 scope_path: None,
3024 recursion_level: None,
3025 include_content_metadata: None,
3026 latest_processed_change: None,
3027 download: None,
3028 include_links: None,
3029 format: None,
3030 version_descriptor_version: None,
3031 version_descriptor_version_options: None,
3032 version_descriptor_version_type: None,
3033 zip_for_unix: None,
3034 }
3035 }
3036 #[doc = "Post for retrieving a creating a batch out of a set of items in a repo / project given a list of paths or a long path"]
3037 #[doc = ""]
3038 #[doc = "Arguments:"]
3039 #[doc = "* `organization`: The name of the Azure DevOps organization."]
3040 #[doc = "* `body`: Request data attributes: ItemDescriptors, IncludeContentMetadata, LatestProcessedChange, IncludeLinks. ItemDescriptors: Collection of items to fetch, including path, version, and recursion level. IncludeContentMetadata: Whether to include metadata for all items LatestProcessedChange: Whether to include shallow ref to commit that last changed each item. IncludeLinks: Whether to include the _links field on the shallow references."]
3041 #[doc = "* `repository_id`: The name or ID of the repository"]
3042 #[doc = "* `project`: Project ID or project name"]
3043 pub fn get_items_batch(
3044 &self,
3045 organization: impl Into<String>,
3046 body: impl Into<models::GitItemRequestData>,
3047 repository_id: impl Into<String>,
3048 project: impl Into<String>,
3049 ) -> get_items_batch::RequestBuilder {
3050 get_items_batch::RequestBuilder {
3051 client: self.0.clone(),
3052 organization: organization.into(),
3053 body: body.into(),
3054 repository_id: repository_id.into(),
3055 project: project.into(),
3056 }
3057 }
3058 }
3059 pub mod get {
3060 use super::models;
3061 #[cfg(not(target_arch = "wasm32"))]
3062 use futures::future::BoxFuture;
3063 #[cfg(target_arch = "wasm32")]
3064 use futures::future::LocalBoxFuture as BoxFuture;
3065 #[derive(Debug)]
3066 pub struct Response(azure_core::http::Response);
3067 impl Response {
3068 pub async fn into_raw_body(self) -> azure_core::Result<models::GitItem> {
3069 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
3070 let body: models::GitItem = serde_json::from_slice(&bytes).map_err(|e| {
3071 azure_core::error::Error::full(
3072 azure_core::error::ErrorKind::DataConversion,
3073 e,
3074 format!(
3075 "Failed to deserialize response:\n{}",
3076 String::from_utf8_lossy(&bytes)
3077 ),
3078 )
3079 })?;
3080 Ok(body)
3081 }
3082 pub fn into_raw_response(self) -> azure_core::http::Response {
3083 self.0
3084 }
3085 pub fn as_raw_response(&self) -> &azure_core::http::Response {
3086 &self.0
3087 }
3088 }
3089 impl From<Response> for azure_core::http::Response {
3090 fn from(rsp: Response) -> Self {
3091 rsp.into_raw_response()
3092 }
3093 }
3094 impl AsRef<azure_core::http::Response> for Response {
3095 fn as_ref(&self) -> &azure_core::http::Response {
3096 self.as_raw_response()
3097 }
3098 }
3099 #[derive(Clone)]
3100 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3101 #[doc = r""]
3102 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3103 #[doc = r" parameters can be chained."]
3104 #[doc = r""]
3105 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3106 #[doc = r" converts the [`RequestBuilder`] into a future,"]
3107 #[doc = r" executes the request and returns a `Result` with the parsed"]
3108 #[doc = r" response."]
3109 #[doc = r""]
3110 #[doc = r" If you need lower-level access to the raw response details"]
3111 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3112 #[doc = r" can finalize the request using the"]
3113 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3114 #[doc = r" that resolves to a lower-level [`Response`] value."]
3115 pub struct RequestBuilder {
3116 pub(crate) client: super::super::Client,
3117 pub(crate) organization: String,
3118 pub(crate) repository_id: String,
3119 pub(crate) path: String,
3120 pub(crate) project: String,
3121 pub(crate) scope_path: Option<String>,
3122 pub(crate) recursion_level: Option<String>,
3123 pub(crate) include_content_metadata: Option<bool>,
3124 pub(crate) latest_processed_change: Option<bool>,
3125 pub(crate) download: Option<bool>,
3126 pub(crate) format: Option<String>,
3127 pub(crate) version_descriptor_version: Option<String>,
3128 pub(crate) version_descriptor_version_options: Option<String>,
3129 pub(crate) version_descriptor_version_type: Option<String>,
3130 pub(crate) include_content: Option<bool>,
3131 pub(crate) resolve_lfs: Option<bool>,
3132 pub(crate) sanitize: Option<bool>,
3133 }
3134 impl RequestBuilder {
3135 #[doc = "The path scope. The default is null."]
3136 pub fn scope_path(mut self, scope_path: impl Into<String>) -> Self {
3137 self.scope_path = Some(scope_path.into());
3138 self
3139 }
3140 #[doc = "The recursion level of this request. The default is 'none', no recursion."]
3141 pub fn recursion_level(mut self, recursion_level: impl Into<String>) -> Self {
3142 self.recursion_level = Some(recursion_level.into());
3143 self
3144 }
3145 #[doc = "Set to true to include content metadata. Default is false."]
3146 pub fn include_content_metadata(mut self, include_content_metadata: bool) -> Self {
3147 self.include_content_metadata = Some(include_content_metadata);
3148 self
3149 }
3150 #[doc = "Set to true to include the latest changes. Default is false."]
3151 pub fn latest_processed_change(mut self, latest_processed_change: bool) -> Self {
3152 self.latest_processed_change = Some(latest_processed_change);
3153 self
3154 }
3155 #[doc = "Set to true to download the response as a file. Default is false."]
3156 pub fn download(mut self, download: bool) -> Self {
3157 self.download = Some(download);
3158 self
3159 }
3160 #[doc = "If specified, this overrides the HTTP Accept request header to return either 'json' or 'zip'. If format is specified, then api-version should also be specified as a query parameter."]
3161 pub fn format(mut self, format: impl Into<String>) -> Self {
3162 self.format = Some(format.into());
3163 self
3164 }
3165 #[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
3166 pub fn version_descriptor_version(
3167 mut self,
3168 version_descriptor_version: impl Into<String>,
3169 ) -> Self {
3170 self.version_descriptor_version = Some(version_descriptor_version.into());
3171 self
3172 }
3173 #[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
3174 pub fn version_descriptor_version_options(
3175 mut self,
3176 version_descriptor_version_options: impl Into<String>,
3177 ) -> Self {
3178 self.version_descriptor_version_options =
3179 Some(version_descriptor_version_options.into());
3180 self
3181 }
3182 #[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
3183 pub fn version_descriptor_version_type(
3184 mut self,
3185 version_descriptor_version_type: impl Into<String>,
3186 ) -> Self {
3187 self.version_descriptor_version_type = Some(version_descriptor_version_type.into());
3188 self
3189 }
3190 #[doc = "Set to true to include item content when requesting json. Default is false."]
3191 pub fn include_content(mut self, include_content: bool) -> Self {
3192 self.include_content = Some(include_content);
3193 self
3194 }
3195 #[doc = "Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false."]
3196 pub fn resolve_lfs(mut self, resolve_lfs: bool) -> Self {
3197 self.resolve_lfs = Some(resolve_lfs);
3198 self
3199 }
3200 #[doc = "Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false."]
3201 pub fn sanitize(mut self, sanitize: bool) -> Self {
3202 self.sanitize = Some(sanitize);
3203 self
3204 }
3205 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3206 #[doc = ""]
3207 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3208 #[doc = "However, this function can provide more flexibility when required."]
3209 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3210 Box::pin({
3211 let this = self.clone();
3212 async move {
3213 let url = this.url()?;
3214 let mut req =
3215 azure_core::http::Request::new(url, azure_core::http::Method::Get);
3216 if let Some(auth_header) = this
3217 .client
3218 .token_credential()
3219 .http_authorization_header(&this.client.scopes())
3220 .await?
3221 {
3222 req.insert_header(
3223 azure_core::http::headers::AUTHORIZATION,
3224 auth_header,
3225 );
3226 }
3227 let path = &this.path;
3228 req.url_mut().query_pairs_mut().append_pair("path", path);
3229 if let Some(scope_path) = &this.scope_path {
3230 req.url_mut()
3231 .query_pairs_mut()
3232 .append_pair("scopePath", scope_path);
3233 }
3234 if let Some(recursion_level) = &this.recursion_level {
3235 req.url_mut()
3236 .query_pairs_mut()
3237 .append_pair("recursionLevel", recursion_level);
3238 }
3239 if let Some(include_content_metadata) = &this.include_content_metadata {
3240 req.url_mut().query_pairs_mut().append_pair(
3241 "includeContentMetadata",
3242 &include_content_metadata.to_string(),
3243 );
3244 }
3245 if let Some(latest_processed_change) = &this.latest_processed_change {
3246 req.url_mut().query_pairs_mut().append_pair(
3247 "latestProcessedChange",
3248 &latest_processed_change.to_string(),
3249 );
3250 }
3251 if let Some(download) = &this.download {
3252 req.url_mut()
3253 .query_pairs_mut()
3254 .append_pair("download", &download.to_string());
3255 }
3256 if let Some(format) = &this.format {
3257 req.url_mut()
3258 .query_pairs_mut()
3259 .append_pair("$format", format);
3260 }
3261 if let Some(version_descriptor_version) = &this.version_descriptor_version {
3262 req.url_mut().query_pairs_mut().append_pair(
3263 "versionDescriptor.version",
3264 version_descriptor_version,
3265 );
3266 }
3267 if let Some(version_descriptor_version_options) =
3268 &this.version_descriptor_version_options
3269 {
3270 req.url_mut().query_pairs_mut().append_pair(
3271 "versionDescriptor.versionOptions",
3272 version_descriptor_version_options,
3273 );
3274 }
3275 if let Some(version_descriptor_version_type) =
3276 &this.version_descriptor_version_type
3277 {
3278 req.url_mut().query_pairs_mut().append_pair(
3279 "versionDescriptor.versionType",
3280 version_descriptor_version_type,
3281 );
3282 }
3283 if let Some(include_content) = &this.include_content {
3284 req.url_mut()
3285 .query_pairs_mut()
3286 .append_pair("includeContent", &include_content.to_string());
3287 }
3288 if let Some(resolve_lfs) = &this.resolve_lfs {
3289 req.url_mut()
3290 .query_pairs_mut()
3291 .append_pair("resolveLfs", &resolve_lfs.to_string());
3292 }
3293 if let Some(sanitize) = &this.sanitize {
3294 req.url_mut()
3295 .query_pairs_mut()
3296 .append_pair("sanitize", &sanitize.to_string());
3297 }
3298 let req_body = azure_core::Bytes::new();
3299 req.set_body(req_body);
3300 Ok(Response(this.client.send(&mut req).await?))
3301 }
3302 })
3303 }
3304 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
3305 let mut url = azure_core::http::Url::parse(&format!(
3306 "{}/{}/{}/_apis/git/repositories/{}/items?path={}",
3307 self.client.endpoint(),
3308 &self.organization,
3309 &self.project,
3310 &self.repository_id,
3311 &self.path
3312 ))?;
3313 let has_api_version_already = url
3314 .query_pairs()
3315 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
3316 if !has_api_version_already {
3317 url.query_pairs_mut().append_pair(
3318 azure_core::http::headers::query_param::API_VERSION,
3319 "7.1-preview",
3320 );
3321 }
3322 Ok(url)
3323 }
3324 }
3325 impl std::future::IntoFuture for RequestBuilder {
3326 type Output = azure_core::Result<models::GitItem>;
3327 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitItem>>;
3328 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3329 #[doc = ""]
3330 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3331 #[doc = ""]
3332 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3333 fn into_future(self) -> Self::IntoFuture {
3334 Box::pin(async move { self.send().await?.into_raw_body().await })
3335 }
3336 }
3337 }
3338 pub mod list {
3339 use super::models;
3340 #[cfg(not(target_arch = "wasm32"))]
3341 use futures::future::BoxFuture;
3342 #[cfg(target_arch = "wasm32")]
3343 use futures::future::LocalBoxFuture as BoxFuture;
3344 #[derive(Debug)]
3345 pub struct Response(azure_core::http::Response);
3346 impl Response {
3347 pub async fn into_raw_body(self) -> azure_core::Result<models::GitItemList> {
3348 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
3349 let body: models::GitItemList = serde_json::from_slice(&bytes).map_err(|e| {
3350 azure_core::error::Error::full(
3351 azure_core::error::ErrorKind::DataConversion,
3352 e,
3353 format!(
3354 "Failed to deserialize response:\n{}",
3355 String::from_utf8_lossy(&bytes)
3356 ),
3357 )
3358 })?;
3359 Ok(body)
3360 }
3361 pub fn into_raw_response(self) -> azure_core::http::Response {
3362 self.0
3363 }
3364 pub fn as_raw_response(&self) -> &azure_core::http::Response {
3365 &self.0
3366 }
3367 }
3368 impl From<Response> for azure_core::http::Response {
3369 fn from(rsp: Response) -> Self {
3370 rsp.into_raw_response()
3371 }
3372 }
3373 impl AsRef<azure_core::http::Response> for Response {
3374 fn as_ref(&self) -> &azure_core::http::Response {
3375 self.as_raw_response()
3376 }
3377 }
3378 #[derive(Clone)]
3379 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3380 #[doc = r""]
3381 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3382 #[doc = r" parameters can be chained."]
3383 #[doc = r""]
3384 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3385 #[doc = r" converts the [`RequestBuilder`] into a future,"]
3386 #[doc = r" executes the request and returns a `Result` with the parsed"]
3387 #[doc = r" response."]
3388 #[doc = r""]
3389 #[doc = r" If you need lower-level access to the raw response details"]
3390 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3391 #[doc = r" can finalize the request using the"]
3392 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3393 #[doc = r" that resolves to a lower-level [`Response`] value."]
3394 pub struct RequestBuilder {
3395 pub(crate) client: super::super::Client,
3396 pub(crate) organization: String,
3397 pub(crate) repository_id: String,
3398 pub(crate) project: String,
3399 pub(crate) scope_path: Option<String>,
3400 pub(crate) recursion_level: Option<String>,
3401 pub(crate) include_content_metadata: Option<bool>,
3402 pub(crate) latest_processed_change: Option<bool>,
3403 pub(crate) download: Option<bool>,
3404 pub(crate) include_links: Option<bool>,
3405 pub(crate) format: Option<String>,
3406 pub(crate) version_descriptor_version: Option<String>,
3407 pub(crate) version_descriptor_version_options: Option<String>,
3408 pub(crate) version_descriptor_version_type: Option<String>,
3409 pub(crate) zip_for_unix: Option<bool>,
3410 }
3411 impl RequestBuilder {
3412 #[doc = "The path scope. The default is null."]
3413 pub fn scope_path(mut self, scope_path: impl Into<String>) -> Self {
3414 self.scope_path = Some(scope_path.into());
3415 self
3416 }
3417 #[doc = "The recursion level of this request. The default is 'none', no recursion."]
3418 pub fn recursion_level(mut self, recursion_level: impl Into<String>) -> Self {
3419 self.recursion_level = Some(recursion_level.into());
3420 self
3421 }
3422 #[doc = "Set to true to include content metadata. Default is false."]
3423 pub fn include_content_metadata(mut self, include_content_metadata: bool) -> Self {
3424 self.include_content_metadata = Some(include_content_metadata);
3425 self
3426 }
3427 #[doc = "Set to true to include the latest changes. Default is false."]
3428 pub fn latest_processed_change(mut self, latest_processed_change: bool) -> Self {
3429 self.latest_processed_change = Some(latest_processed_change);
3430 self
3431 }
3432 #[doc = "Set to true to download the response as a file. Default is false."]
3433 pub fn download(mut self, download: bool) -> Self {
3434 self.download = Some(download);
3435 self
3436 }
3437 #[doc = "Set to true to include links to items. Default is false."]
3438 pub fn include_links(mut self, include_links: bool) -> Self {
3439 self.include_links = Some(include_links);
3440 self
3441 }
3442 #[doc = "If specified, this overrides the HTTP Accept request header to return either 'json' or 'zip'. If format is specified, then api-version should also be specified as a query parameter."]
3443 pub fn format(mut self, format: impl Into<String>) -> Self {
3444 self.format = Some(format.into());
3445 self
3446 }
3447 #[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
3448 pub fn version_descriptor_version(
3449 mut self,
3450 version_descriptor_version: impl Into<String>,
3451 ) -> Self {
3452 self.version_descriptor_version = Some(version_descriptor_version.into());
3453 self
3454 }
3455 #[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
3456 pub fn version_descriptor_version_options(
3457 mut self,
3458 version_descriptor_version_options: impl Into<String>,
3459 ) -> Self {
3460 self.version_descriptor_version_options =
3461 Some(version_descriptor_version_options.into());
3462 self
3463 }
3464 #[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
3465 pub fn version_descriptor_version_type(
3466 mut self,
3467 version_descriptor_version_type: impl Into<String>,
3468 ) -> Self {
3469 self.version_descriptor_version_type = Some(version_descriptor_version_type.into());
3470 self
3471 }
3472 #[doc = "Set to true to keep the file permissions for unix (and POSIX) systems like executables and symlinks"]
3473 pub fn zip_for_unix(mut self, zip_for_unix: bool) -> Self {
3474 self.zip_for_unix = Some(zip_for_unix);
3475 self
3476 }
3477 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3478 #[doc = ""]
3479 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3480 #[doc = "However, this function can provide more flexibility when required."]
3481 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3482 Box::pin({
3483 let this = self.clone();
3484 async move {
3485 let url = this.url()?;
3486 let mut req =
3487 azure_core::http::Request::new(url, azure_core::http::Method::Get);
3488 if let Some(auth_header) = this
3489 .client
3490 .token_credential()
3491 .http_authorization_header(&this.client.scopes())
3492 .await?
3493 {
3494 req.insert_header(
3495 azure_core::http::headers::AUTHORIZATION,
3496 auth_header,
3497 );
3498 }
3499 if let Some(scope_path) = &this.scope_path {
3500 req.url_mut()
3501 .query_pairs_mut()
3502 .append_pair("scopePath", scope_path);
3503 }
3504 if let Some(recursion_level) = &this.recursion_level {
3505 req.url_mut()
3506 .query_pairs_mut()
3507 .append_pair("recursionLevel", recursion_level);
3508 }
3509 if let Some(include_content_metadata) = &this.include_content_metadata {
3510 req.url_mut().query_pairs_mut().append_pair(
3511 "includeContentMetadata",
3512 &include_content_metadata.to_string(),
3513 );
3514 }
3515 if let Some(latest_processed_change) = &this.latest_processed_change {
3516 req.url_mut().query_pairs_mut().append_pair(
3517 "latestProcessedChange",
3518 &latest_processed_change.to_string(),
3519 );
3520 }
3521 if let Some(download) = &this.download {
3522 req.url_mut()
3523 .query_pairs_mut()
3524 .append_pair("download", &download.to_string());
3525 }
3526 if let Some(include_links) = &this.include_links {
3527 req.url_mut()
3528 .query_pairs_mut()
3529 .append_pair("includeLinks", &include_links.to_string());
3530 }
3531 if let Some(format) = &this.format {
3532 req.url_mut()
3533 .query_pairs_mut()
3534 .append_pair("$format", format);
3535 }
3536 if let Some(version_descriptor_version) = &this.version_descriptor_version {
3537 req.url_mut().query_pairs_mut().append_pair(
3538 "versionDescriptor.version",
3539 version_descriptor_version,
3540 );
3541 }
3542 if let Some(version_descriptor_version_options) =
3543 &this.version_descriptor_version_options
3544 {
3545 req.url_mut().query_pairs_mut().append_pair(
3546 "versionDescriptor.versionOptions",
3547 version_descriptor_version_options,
3548 );
3549 }
3550 if let Some(version_descriptor_version_type) =
3551 &this.version_descriptor_version_type
3552 {
3553 req.url_mut().query_pairs_mut().append_pair(
3554 "versionDescriptor.versionType",
3555 version_descriptor_version_type,
3556 );
3557 }
3558 if let Some(zip_for_unix) = &this.zip_for_unix {
3559 req.url_mut()
3560 .query_pairs_mut()
3561 .append_pair("zipForUnix", &zip_for_unix.to_string());
3562 }
3563 let req_body = azure_core::Bytes::new();
3564 req.set_body(req_body);
3565 Ok(Response(this.client.send(&mut req).await?))
3566 }
3567 })
3568 }
3569 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
3570 let mut url = azure_core::http::Url::parse(&format!(
3571 "{}/{}/{}/_apis/git/repositories/{}/items",
3572 self.client.endpoint(),
3573 &self.organization,
3574 &self.project,
3575 &self.repository_id
3576 ))?;
3577 let has_api_version_already = url
3578 .query_pairs()
3579 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
3580 if !has_api_version_already {
3581 url.query_pairs_mut().append_pair(
3582 azure_core::http::headers::query_param::API_VERSION,
3583 "7.1-preview",
3584 );
3585 }
3586 Ok(url)
3587 }
3588 }
3589 impl std::future::IntoFuture for RequestBuilder {
3590 type Output = azure_core::Result<models::GitItemList>;
3591 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitItemList>>;
3592 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3593 #[doc = ""]
3594 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3595 #[doc = ""]
3596 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3597 fn into_future(self) -> Self::IntoFuture {
3598 Box::pin(async move { self.send().await?.into_raw_body().await })
3599 }
3600 }
3601 }
3602 pub mod get_items_batch {
3603 use super::models;
3604 #[cfg(not(target_arch = "wasm32"))]
3605 use futures::future::BoxFuture;
3606 #[cfg(target_arch = "wasm32")]
3607 use futures::future::LocalBoxFuture as BoxFuture;
3608 #[derive(Debug)]
3609 pub struct Response(azure_core::http::Response);
3610 impl Response {
3611 pub async fn into_raw_body(self) -> azure_core::Result<models::GitItemsList> {
3612 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
3613 let body: models::GitItemsList = serde_json::from_slice(&bytes).map_err(|e| {
3614 azure_core::error::Error::full(
3615 azure_core::error::ErrorKind::DataConversion,
3616 e,
3617 format!(
3618 "Failed to deserialize response:\n{}",
3619 String::from_utf8_lossy(&bytes)
3620 ),
3621 )
3622 })?;
3623 Ok(body)
3624 }
3625 pub fn into_raw_response(self) -> azure_core::http::Response {
3626 self.0
3627 }
3628 pub fn as_raw_response(&self) -> &azure_core::http::Response {
3629 &self.0
3630 }
3631 }
3632 impl From<Response> for azure_core::http::Response {
3633 fn from(rsp: Response) -> Self {
3634 rsp.into_raw_response()
3635 }
3636 }
3637 impl AsRef<azure_core::http::Response> for Response {
3638 fn as_ref(&self) -> &azure_core::http::Response {
3639 self.as_raw_response()
3640 }
3641 }
3642 #[derive(Clone)]
3643 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3644 #[doc = r""]
3645 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3646 #[doc = r" parameters can be chained."]
3647 #[doc = r""]
3648 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3649 #[doc = r" converts the [`RequestBuilder`] into a future,"]
3650 #[doc = r" executes the request and returns a `Result` with the parsed"]
3651 #[doc = r" response."]
3652 #[doc = r""]
3653 #[doc = r" If you need lower-level access to the raw response details"]
3654 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3655 #[doc = r" can finalize the request using the"]
3656 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3657 #[doc = r" that resolves to a lower-level [`Response`] value."]
3658 pub struct RequestBuilder {
3659 pub(crate) client: super::super::Client,
3660 pub(crate) organization: String,
3661 pub(crate) body: models::GitItemRequestData,
3662 pub(crate) repository_id: String,
3663 pub(crate) project: String,
3664 }
3665 impl RequestBuilder {
3666 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3667 #[doc = ""]
3668 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3669 #[doc = "However, this function can provide more flexibility when required."]
3670 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3671 Box::pin({
3672 let this = self.clone();
3673 async move {
3674 let url = this.url()?;
3675 let mut req =
3676 azure_core::http::Request::new(url, azure_core::http::Method::Post);
3677 if let Some(auth_header) = this
3678 .client
3679 .token_credential()
3680 .http_authorization_header(&this.client.scopes())
3681 .await?
3682 {
3683 req.insert_header(
3684 azure_core::http::headers::AUTHORIZATION,
3685 auth_header,
3686 );
3687 }
3688 req.insert_header("content-type", "application/json");
3689 let req_body = azure_core::json::to_json(&this.body)?;
3690 req.set_body(req_body);
3691 Ok(Response(this.client.send(&mut req).await?))
3692 }
3693 })
3694 }
3695 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
3696 let mut url = azure_core::http::Url::parse(&format!(
3697 "{}/{}/{}/_apis/git/repositories/{}/itemsbatch",
3698 self.client.endpoint(),
3699 &self.organization,
3700 &self.project,
3701 &self.repository_id
3702 ))?;
3703 let has_api_version_already = url
3704 .query_pairs()
3705 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
3706 if !has_api_version_already {
3707 url.query_pairs_mut().append_pair(
3708 azure_core::http::headers::query_param::API_VERSION,
3709 "7.1-preview",
3710 );
3711 }
3712 Ok(url)
3713 }
3714 }
3715 impl std::future::IntoFuture for RequestBuilder {
3716 type Output = azure_core::Result<models::GitItemsList>;
3717 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitItemsList>>;
3718 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3719 #[doc = ""]
3720 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3721 #[doc = ""]
3722 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3723 fn into_future(self) -> Self::IntoFuture {
3724 Box::pin(async move { self.send().await?.into_raw_body().await })
3725 }
3726 }
3727 }
3728}
3729pub mod stats {
3730 use super::models;
3731 #[cfg(not(target_arch = "wasm32"))]
3732 use futures::future::BoxFuture;
3733 #[cfg(target_arch = "wasm32")]
3734 use futures::future::LocalBoxFuture as BoxFuture;
3735 pub struct Client(pub(crate) super::Client);
3736 impl Client {
3737 #[doc = "Retrieve statistics about a single branch."]
3738 #[doc = ""]
3739 #[doc = "Arguments:"]
3740 #[doc = "* `organization`: The name of the Azure DevOps organization."]
3741 #[doc = "* `repository_id`: The name or ID of the repository."]
3742 #[doc = "* `name`: Name of the branch."]
3743 #[doc = "* `project`: Project ID or project name"]
3744 pub fn get(
3745 &self,
3746 organization: impl Into<String>,
3747 repository_id: impl Into<String>,
3748 name: impl Into<String>,
3749 project: impl Into<String>,
3750 ) -> get::RequestBuilder {
3751 get::RequestBuilder {
3752 client: self.0.clone(),
3753 organization: organization.into(),
3754 repository_id: repository_id.into(),
3755 name: name.into(),
3756 project: project.into(),
3757 base_version_descriptor_version: None,
3758 base_version_descriptor_version_options: None,
3759 base_version_descriptor_version_type: None,
3760 }
3761 }
3762 #[doc = "Retrieve statistics about all branches within a repository."]
3763 #[doc = ""]
3764 #[doc = "Arguments:"]
3765 #[doc = "* `organization`: The name of the Azure DevOps organization."]
3766 #[doc = "* `repository_id`: The name or ID of the repository."]
3767 #[doc = "* `project`: Project ID or project name"]
3768 pub fn list(
3769 &self,
3770 organization: impl Into<String>,
3771 repository_id: impl Into<String>,
3772 project: impl Into<String>,
3773 ) -> list::RequestBuilder {
3774 list::RequestBuilder {
3775 client: self.0.clone(),
3776 organization: organization.into(),
3777 repository_id: repository_id.into(),
3778 project: project.into(),
3779 base_version_descriptor_version: None,
3780 base_version_descriptor_version_options: None,
3781 base_version_descriptor_version_type: None,
3782 }
3783 }
3784 }
3785 pub mod get {
3786 use super::models;
3787 #[cfg(not(target_arch = "wasm32"))]
3788 use futures::future::BoxFuture;
3789 #[cfg(target_arch = "wasm32")]
3790 use futures::future::LocalBoxFuture as BoxFuture;
3791 #[derive(Debug)]
3792 pub struct Response(azure_core::http::Response);
3793 impl Response {
3794 pub async fn into_raw_body(self) -> azure_core::Result<models::GitBranchStats> {
3795 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
3796 let body: models::GitBranchStats = serde_json::from_slice(&bytes).map_err(|e| {
3797 azure_core::error::Error::full(
3798 azure_core::error::ErrorKind::DataConversion,
3799 e,
3800 format!(
3801 "Failed to deserialize response:\n{}",
3802 String::from_utf8_lossy(&bytes)
3803 ),
3804 )
3805 })?;
3806 Ok(body)
3807 }
3808 pub fn into_raw_response(self) -> azure_core::http::Response {
3809 self.0
3810 }
3811 pub fn as_raw_response(&self) -> &azure_core::http::Response {
3812 &self.0
3813 }
3814 }
3815 impl From<Response> for azure_core::http::Response {
3816 fn from(rsp: Response) -> Self {
3817 rsp.into_raw_response()
3818 }
3819 }
3820 impl AsRef<azure_core::http::Response> for Response {
3821 fn as_ref(&self) -> &azure_core::http::Response {
3822 self.as_raw_response()
3823 }
3824 }
3825 #[derive(Clone)]
3826 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
3827 #[doc = r""]
3828 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
3829 #[doc = r" parameters can be chained."]
3830 #[doc = r""]
3831 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
3832 #[doc = r" converts the [`RequestBuilder`] into a future,"]
3833 #[doc = r" executes the request and returns a `Result` with the parsed"]
3834 #[doc = r" response."]
3835 #[doc = r""]
3836 #[doc = r" If you need lower-level access to the raw response details"]
3837 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
3838 #[doc = r" can finalize the request using the"]
3839 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
3840 #[doc = r" that resolves to a lower-level [`Response`] value."]
3841 pub struct RequestBuilder {
3842 pub(crate) client: super::super::Client,
3843 pub(crate) organization: String,
3844 pub(crate) repository_id: String,
3845 pub(crate) name: String,
3846 pub(crate) project: String,
3847 pub(crate) base_version_descriptor_version: Option<String>,
3848 pub(crate) base_version_descriptor_version_options: Option<String>,
3849 pub(crate) base_version_descriptor_version_type: Option<String>,
3850 }
3851 impl RequestBuilder {
3852 #[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
3853 pub fn base_version_descriptor_version(
3854 mut self,
3855 base_version_descriptor_version: impl Into<String>,
3856 ) -> Self {
3857 self.base_version_descriptor_version = Some(base_version_descriptor_version.into());
3858 self
3859 }
3860 #[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
3861 pub fn base_version_descriptor_version_options(
3862 mut self,
3863 base_version_descriptor_version_options: impl Into<String>,
3864 ) -> Self {
3865 self.base_version_descriptor_version_options =
3866 Some(base_version_descriptor_version_options.into());
3867 self
3868 }
3869 #[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
3870 pub fn base_version_descriptor_version_type(
3871 mut self,
3872 base_version_descriptor_version_type: impl Into<String>,
3873 ) -> Self {
3874 self.base_version_descriptor_version_type =
3875 Some(base_version_descriptor_version_type.into());
3876 self
3877 }
3878 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
3879 #[doc = ""]
3880 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
3881 #[doc = "However, this function can provide more flexibility when required."]
3882 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
3883 Box::pin({
3884 let this = self.clone();
3885 async move {
3886 let url = this.url()?;
3887 let mut req =
3888 azure_core::http::Request::new(url, azure_core::http::Method::Get);
3889 if let Some(auth_header) = this
3890 .client
3891 .token_credential()
3892 .http_authorization_header(&this.client.scopes())
3893 .await?
3894 {
3895 req.insert_header(
3896 azure_core::http::headers::AUTHORIZATION,
3897 auth_header,
3898 );
3899 }
3900 let name = &this.name;
3901 req.url_mut().query_pairs_mut().append_pair("name", name);
3902 if let Some(base_version_descriptor_version) =
3903 &this.base_version_descriptor_version
3904 {
3905 req.url_mut().query_pairs_mut().append_pair(
3906 "baseVersionDescriptor.version",
3907 base_version_descriptor_version,
3908 );
3909 }
3910 if let Some(base_version_descriptor_version_options) =
3911 &this.base_version_descriptor_version_options
3912 {
3913 req.url_mut().query_pairs_mut().append_pair(
3914 "baseVersionDescriptor.versionOptions",
3915 base_version_descriptor_version_options,
3916 );
3917 }
3918 if let Some(base_version_descriptor_version_type) =
3919 &this.base_version_descriptor_version_type
3920 {
3921 req.url_mut().query_pairs_mut().append_pair(
3922 "baseVersionDescriptor.versionType",
3923 base_version_descriptor_version_type,
3924 );
3925 }
3926 let req_body = azure_core::Bytes::new();
3927 req.set_body(req_body);
3928 Ok(Response(this.client.send(&mut req).await?))
3929 }
3930 })
3931 }
3932 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
3933 let mut url = azure_core::http::Url::parse(&format!(
3934 "{}/{}/{}/_apis/git/repositories/{}/stats/branches?name={}",
3935 self.client.endpoint(),
3936 &self.organization,
3937 &self.project,
3938 &self.repository_id,
3939 &self.name
3940 ))?;
3941 let has_api_version_already = url
3942 .query_pairs()
3943 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
3944 if !has_api_version_already {
3945 url.query_pairs_mut().append_pair(
3946 azure_core::http::headers::query_param::API_VERSION,
3947 "7.1-preview",
3948 );
3949 }
3950 Ok(url)
3951 }
3952 }
3953 impl std::future::IntoFuture for RequestBuilder {
3954 type Output = azure_core::Result<models::GitBranchStats>;
3955 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitBranchStats>>;
3956 #[doc = "Returns a future that sends the request and returns the parsed response body."]
3957 #[doc = ""]
3958 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
3959 #[doc = ""]
3960 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
3961 fn into_future(self) -> Self::IntoFuture {
3962 Box::pin(async move { self.send().await?.into_raw_body().await })
3963 }
3964 }
3965 }
3966 pub mod list {
3967 use super::models;
3968 #[cfg(not(target_arch = "wasm32"))]
3969 use futures::future::BoxFuture;
3970 #[cfg(target_arch = "wasm32")]
3971 use futures::future::LocalBoxFuture as BoxFuture;
3972 #[derive(Debug)]
3973 pub struct Response(azure_core::http::Response);
3974 impl Response {
3975 pub async fn into_raw_body(self) -> azure_core::Result<models::GitBranchStatsList> {
3976 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
3977 let body: models::GitBranchStatsList =
3978 serde_json::from_slice(&bytes).map_err(|e| {
3979 azure_core::error::Error::full(
3980 azure_core::error::ErrorKind::DataConversion,
3981 e,
3982 format!(
3983 "Failed to deserialize response:\n{}",
3984 String::from_utf8_lossy(&bytes)
3985 ),
3986 )
3987 })?;
3988 Ok(body)
3989 }
3990 pub fn into_raw_response(self) -> azure_core::http::Response {
3991 self.0
3992 }
3993 pub fn as_raw_response(&self) -> &azure_core::http::Response {
3994 &self.0
3995 }
3996 }
3997 impl From<Response> for azure_core::http::Response {
3998 fn from(rsp: Response) -> Self {
3999 rsp.into_raw_response()
4000 }
4001 }
4002 impl AsRef<azure_core::http::Response> for Response {
4003 fn as_ref(&self) -> &azure_core::http::Response {
4004 self.as_raw_response()
4005 }
4006 }
4007 #[derive(Clone)]
4008 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4009 #[doc = r""]
4010 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4011 #[doc = r" parameters can be chained."]
4012 #[doc = r""]
4013 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4014 #[doc = r" converts the [`RequestBuilder`] into a future,"]
4015 #[doc = r" executes the request and returns a `Result` with the parsed"]
4016 #[doc = r" response."]
4017 #[doc = r""]
4018 #[doc = r" If you need lower-level access to the raw response details"]
4019 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4020 #[doc = r" can finalize the request using the"]
4021 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4022 #[doc = r" that resolves to a lower-level [`Response`] value."]
4023 pub struct RequestBuilder {
4024 pub(crate) client: super::super::Client,
4025 pub(crate) organization: String,
4026 pub(crate) repository_id: String,
4027 pub(crate) project: String,
4028 pub(crate) base_version_descriptor_version: Option<String>,
4029 pub(crate) base_version_descriptor_version_options: Option<String>,
4030 pub(crate) base_version_descriptor_version_type: Option<String>,
4031 }
4032 impl RequestBuilder {
4033 #[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
4034 pub fn base_version_descriptor_version(
4035 mut self,
4036 base_version_descriptor_version: impl Into<String>,
4037 ) -> Self {
4038 self.base_version_descriptor_version = Some(base_version_descriptor_version.into());
4039 self
4040 }
4041 #[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
4042 pub fn base_version_descriptor_version_options(
4043 mut self,
4044 base_version_descriptor_version_options: impl Into<String>,
4045 ) -> Self {
4046 self.base_version_descriptor_version_options =
4047 Some(base_version_descriptor_version_options.into());
4048 self
4049 }
4050 #[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
4051 pub fn base_version_descriptor_version_type(
4052 mut self,
4053 base_version_descriptor_version_type: impl Into<String>,
4054 ) -> Self {
4055 self.base_version_descriptor_version_type =
4056 Some(base_version_descriptor_version_type.into());
4057 self
4058 }
4059 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4060 #[doc = ""]
4061 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4062 #[doc = "However, this function can provide more flexibility when required."]
4063 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4064 Box::pin({
4065 let this = self.clone();
4066 async move {
4067 let url = this.url()?;
4068 let mut req =
4069 azure_core::http::Request::new(url, azure_core::http::Method::Get);
4070 if let Some(auth_header) = this
4071 .client
4072 .token_credential()
4073 .http_authorization_header(&this.client.scopes())
4074 .await?
4075 {
4076 req.insert_header(
4077 azure_core::http::headers::AUTHORIZATION,
4078 auth_header,
4079 );
4080 }
4081 if let Some(base_version_descriptor_version) =
4082 &this.base_version_descriptor_version
4083 {
4084 req.url_mut().query_pairs_mut().append_pair(
4085 "baseVersionDescriptor.version",
4086 base_version_descriptor_version,
4087 );
4088 }
4089 if let Some(base_version_descriptor_version_options) =
4090 &this.base_version_descriptor_version_options
4091 {
4092 req.url_mut().query_pairs_mut().append_pair(
4093 "baseVersionDescriptor.versionOptions",
4094 base_version_descriptor_version_options,
4095 );
4096 }
4097 if let Some(base_version_descriptor_version_type) =
4098 &this.base_version_descriptor_version_type
4099 {
4100 req.url_mut().query_pairs_mut().append_pair(
4101 "baseVersionDescriptor.versionType",
4102 base_version_descriptor_version_type,
4103 );
4104 }
4105 let req_body = azure_core::Bytes::new();
4106 req.set_body(req_body);
4107 Ok(Response(this.client.send(&mut req).await?))
4108 }
4109 })
4110 }
4111 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
4112 let mut url = azure_core::http::Url::parse(&format!(
4113 "{}/{}/{}/_apis/git/repositories/{}/stats/branches",
4114 self.client.endpoint(),
4115 &self.organization,
4116 &self.project,
4117 &self.repository_id
4118 ))?;
4119 let has_api_version_already = url
4120 .query_pairs()
4121 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
4122 if !has_api_version_already {
4123 url.query_pairs_mut().append_pair(
4124 azure_core::http::headers::query_param::API_VERSION,
4125 "7.1-preview",
4126 );
4127 }
4128 Ok(url)
4129 }
4130 }
4131 impl std::future::IntoFuture for RequestBuilder {
4132 type Output = azure_core::Result<models::GitBranchStatsList>;
4133 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitBranchStatsList>>;
4134 #[doc = "Returns a future that sends the request and returns the parsed response body."]
4135 #[doc = ""]
4136 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
4137 #[doc = ""]
4138 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
4139 fn into_future(self) -> Self::IntoFuture {
4140 Box::pin(async move { self.send().await?.into_raw_body().await })
4141 }
4142 }
4143 }
4144}
4145pub mod refs_favorites {
4146 use super::models;
4147 #[cfg(not(target_arch = "wasm32"))]
4148 use futures::future::BoxFuture;
4149 #[cfg(target_arch = "wasm32")]
4150 use futures::future::LocalBoxFuture as BoxFuture;
4151 pub struct Client(pub(crate) super::Client);
4152 impl Client {
4153 #[doc = "Gets the refs favorites for a repo and an identity."]
4154 #[doc = ""]
4155 #[doc = "Arguments:"]
4156 #[doc = "* `organization`: The name of the Azure DevOps organization."]
4157 #[doc = "* `project`: Project ID or project name"]
4158 pub fn list(
4159 &self,
4160 organization: impl Into<String>,
4161 project: impl Into<String>,
4162 ) -> list::RequestBuilder {
4163 list::RequestBuilder {
4164 client: self.0.clone(),
4165 organization: organization.into(),
4166 project: project.into(),
4167 repository_id: None,
4168 identity_id: None,
4169 }
4170 }
4171 #[doc = "Creates a ref favorite"]
4172 #[doc = ""]
4173 #[doc = "Arguments:"]
4174 #[doc = "* `organization`: The name of the Azure DevOps organization."]
4175 #[doc = "* `body`: The ref favorite to create."]
4176 #[doc = "* `project`: Project ID or project name"]
4177 pub fn create(
4178 &self,
4179 organization: impl Into<String>,
4180 body: impl Into<models::GitRefFavorite>,
4181 project: impl Into<String>,
4182 ) -> create::RequestBuilder {
4183 create::RequestBuilder {
4184 client: self.0.clone(),
4185 organization: organization.into(),
4186 body: body.into(),
4187 project: project.into(),
4188 }
4189 }
4190 #[doc = "Gets the refs favorite for a favorite Id."]
4191 #[doc = ""]
4192 #[doc = "Arguments:"]
4193 #[doc = "* `organization`: The name of the Azure DevOps organization."]
4194 #[doc = "* `project`: Project ID or project name"]
4195 #[doc = "* `favorite_id`: The Id of the requested ref favorite."]
4196 pub fn get(
4197 &self,
4198 organization: impl Into<String>,
4199 project: impl Into<String>,
4200 favorite_id: i32,
4201 ) -> get::RequestBuilder {
4202 get::RequestBuilder {
4203 client: self.0.clone(),
4204 organization: organization.into(),
4205 project: project.into(),
4206 favorite_id,
4207 }
4208 }
4209 #[doc = "Deletes the refs favorite specified"]
4210 #[doc = ""]
4211 #[doc = "Arguments:"]
4212 #[doc = "* `organization`: The name of the Azure DevOps organization."]
4213 #[doc = "* `project`: Project ID or project name"]
4214 #[doc = "* `favorite_id`: The Id of the ref favorite to delete."]
4215 pub fn delete(
4216 &self,
4217 organization: impl Into<String>,
4218 project: impl Into<String>,
4219 favorite_id: i32,
4220 ) -> delete::RequestBuilder {
4221 delete::RequestBuilder {
4222 client: self.0.clone(),
4223 organization: organization.into(),
4224 project: project.into(),
4225 favorite_id,
4226 }
4227 }
4228 }
4229 pub mod list {
4230 use super::models;
4231 #[cfg(not(target_arch = "wasm32"))]
4232 use futures::future::BoxFuture;
4233 #[cfg(target_arch = "wasm32")]
4234 use futures::future::LocalBoxFuture as BoxFuture;
4235 #[derive(Debug)]
4236 pub struct Response(azure_core::http::Response);
4237 impl Response {
4238 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRefFavoriteList> {
4239 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
4240 let body: models::GitRefFavoriteList =
4241 serde_json::from_slice(&bytes).map_err(|e| {
4242 azure_core::error::Error::full(
4243 azure_core::error::ErrorKind::DataConversion,
4244 e,
4245 format!(
4246 "Failed to deserialize response:\n{}",
4247 String::from_utf8_lossy(&bytes)
4248 ),
4249 )
4250 })?;
4251 Ok(body)
4252 }
4253 pub fn into_raw_response(self) -> azure_core::http::Response {
4254 self.0
4255 }
4256 pub fn as_raw_response(&self) -> &azure_core::http::Response {
4257 &self.0
4258 }
4259 }
4260 impl From<Response> for azure_core::http::Response {
4261 fn from(rsp: Response) -> Self {
4262 rsp.into_raw_response()
4263 }
4264 }
4265 impl AsRef<azure_core::http::Response> for Response {
4266 fn as_ref(&self) -> &azure_core::http::Response {
4267 self.as_raw_response()
4268 }
4269 }
4270 #[derive(Clone)]
4271 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4272 #[doc = r""]
4273 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4274 #[doc = r" parameters can be chained."]
4275 #[doc = r""]
4276 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4277 #[doc = r" converts the [`RequestBuilder`] into a future,"]
4278 #[doc = r" executes the request and returns a `Result` with the parsed"]
4279 #[doc = r" response."]
4280 #[doc = r""]
4281 #[doc = r" If you need lower-level access to the raw response details"]
4282 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4283 #[doc = r" can finalize the request using the"]
4284 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4285 #[doc = r" that resolves to a lower-level [`Response`] value."]
4286 pub struct RequestBuilder {
4287 pub(crate) client: super::super::Client,
4288 pub(crate) organization: String,
4289 pub(crate) project: String,
4290 pub(crate) repository_id: Option<String>,
4291 pub(crate) identity_id: Option<String>,
4292 }
4293 impl RequestBuilder {
4294 #[doc = "The id of the repository."]
4295 pub fn repository_id(mut self, repository_id: impl Into<String>) -> Self {
4296 self.repository_id = Some(repository_id.into());
4297 self
4298 }
4299 #[doc = "The id of the identity whose favorites are to be retrieved. If null, the requesting identity is used."]
4300 pub fn identity_id(mut self, identity_id: impl Into<String>) -> Self {
4301 self.identity_id = Some(identity_id.into());
4302 self
4303 }
4304 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4305 #[doc = ""]
4306 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4307 #[doc = "However, this function can provide more flexibility when required."]
4308 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4309 Box::pin({
4310 let this = self.clone();
4311 async move {
4312 let url = this.url()?;
4313 let mut req =
4314 azure_core::http::Request::new(url, azure_core::http::Method::Get);
4315 if let Some(auth_header) = this
4316 .client
4317 .token_credential()
4318 .http_authorization_header(&this.client.scopes())
4319 .await?
4320 {
4321 req.insert_header(
4322 azure_core::http::headers::AUTHORIZATION,
4323 auth_header,
4324 );
4325 }
4326 if let Some(repository_id) = &this.repository_id {
4327 req.url_mut()
4328 .query_pairs_mut()
4329 .append_pair("repositoryId", repository_id);
4330 }
4331 if let Some(identity_id) = &this.identity_id {
4332 req.url_mut()
4333 .query_pairs_mut()
4334 .append_pair("identityId", identity_id);
4335 }
4336 let req_body = azure_core::Bytes::new();
4337 req.set_body(req_body);
4338 Ok(Response(this.client.send(&mut req).await?))
4339 }
4340 })
4341 }
4342 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
4343 let mut url = azure_core::http::Url::parse(&format!(
4344 "{}/{}/{}/_apis/git/favorites/refs",
4345 self.client.endpoint(),
4346 &self.organization,
4347 &self.project
4348 ))?;
4349 let has_api_version_already = url
4350 .query_pairs()
4351 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
4352 if !has_api_version_already {
4353 url.query_pairs_mut().append_pair(
4354 azure_core::http::headers::query_param::API_VERSION,
4355 "7.1-preview",
4356 );
4357 }
4358 Ok(url)
4359 }
4360 }
4361 impl std::future::IntoFuture for RequestBuilder {
4362 type Output = azure_core::Result<models::GitRefFavoriteList>;
4363 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRefFavoriteList>>;
4364 #[doc = "Returns a future that sends the request and returns the parsed response body."]
4365 #[doc = ""]
4366 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
4367 #[doc = ""]
4368 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
4369 fn into_future(self) -> Self::IntoFuture {
4370 Box::pin(async move { self.send().await?.into_raw_body().await })
4371 }
4372 }
4373 }
4374 pub mod create {
4375 use super::models;
4376 #[cfg(not(target_arch = "wasm32"))]
4377 use futures::future::BoxFuture;
4378 #[cfg(target_arch = "wasm32")]
4379 use futures::future::LocalBoxFuture as BoxFuture;
4380 #[derive(Debug)]
4381 pub struct Response(azure_core::http::Response);
4382 impl Response {
4383 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRefFavorite> {
4384 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
4385 let body: models::GitRefFavorite = serde_json::from_slice(&bytes).map_err(|e| {
4386 azure_core::error::Error::full(
4387 azure_core::error::ErrorKind::DataConversion,
4388 e,
4389 format!(
4390 "Failed to deserialize response:\n{}",
4391 String::from_utf8_lossy(&bytes)
4392 ),
4393 )
4394 })?;
4395 Ok(body)
4396 }
4397 pub fn into_raw_response(self) -> azure_core::http::Response {
4398 self.0
4399 }
4400 pub fn as_raw_response(&self) -> &azure_core::http::Response {
4401 &self.0
4402 }
4403 }
4404 impl From<Response> for azure_core::http::Response {
4405 fn from(rsp: Response) -> Self {
4406 rsp.into_raw_response()
4407 }
4408 }
4409 impl AsRef<azure_core::http::Response> for Response {
4410 fn as_ref(&self) -> &azure_core::http::Response {
4411 self.as_raw_response()
4412 }
4413 }
4414 #[derive(Clone)]
4415 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4416 #[doc = r""]
4417 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4418 #[doc = r" parameters can be chained."]
4419 #[doc = r""]
4420 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4421 #[doc = r" converts the [`RequestBuilder`] into a future,"]
4422 #[doc = r" executes the request and returns a `Result` with the parsed"]
4423 #[doc = r" response."]
4424 #[doc = r""]
4425 #[doc = r" If you need lower-level access to the raw response details"]
4426 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4427 #[doc = r" can finalize the request using the"]
4428 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4429 #[doc = r" that resolves to a lower-level [`Response`] value."]
4430 pub struct RequestBuilder {
4431 pub(crate) client: super::super::Client,
4432 pub(crate) organization: String,
4433 pub(crate) body: models::GitRefFavorite,
4434 pub(crate) project: String,
4435 }
4436 impl RequestBuilder {
4437 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4438 #[doc = ""]
4439 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4440 #[doc = "However, this function can provide more flexibility when required."]
4441 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4442 Box::pin({
4443 let this = self.clone();
4444 async move {
4445 let url = this.url()?;
4446 let mut req =
4447 azure_core::http::Request::new(url, azure_core::http::Method::Post);
4448 if let Some(auth_header) = this
4449 .client
4450 .token_credential()
4451 .http_authorization_header(&this.client.scopes())
4452 .await?
4453 {
4454 req.insert_header(
4455 azure_core::http::headers::AUTHORIZATION,
4456 auth_header,
4457 );
4458 }
4459 req.insert_header("content-type", "application/json");
4460 let req_body = azure_core::json::to_json(&this.body)?;
4461 req.set_body(req_body);
4462 Ok(Response(this.client.send(&mut req).await?))
4463 }
4464 })
4465 }
4466 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
4467 let mut url = azure_core::http::Url::parse(&format!(
4468 "{}/{}/{}/_apis/git/favorites/refs",
4469 self.client.endpoint(),
4470 &self.organization,
4471 &self.project
4472 ))?;
4473 let has_api_version_already = url
4474 .query_pairs()
4475 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
4476 if !has_api_version_already {
4477 url.query_pairs_mut().append_pair(
4478 azure_core::http::headers::query_param::API_VERSION,
4479 "7.1-preview",
4480 );
4481 }
4482 Ok(url)
4483 }
4484 }
4485 impl std::future::IntoFuture for RequestBuilder {
4486 type Output = azure_core::Result<models::GitRefFavorite>;
4487 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRefFavorite>>;
4488 #[doc = "Returns a future that sends the request and returns the parsed response body."]
4489 #[doc = ""]
4490 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
4491 #[doc = ""]
4492 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
4493 fn into_future(self) -> Self::IntoFuture {
4494 Box::pin(async move { self.send().await?.into_raw_body().await })
4495 }
4496 }
4497 }
4498 pub mod get {
4499 use super::models;
4500 #[cfg(not(target_arch = "wasm32"))]
4501 use futures::future::BoxFuture;
4502 #[cfg(target_arch = "wasm32")]
4503 use futures::future::LocalBoxFuture as BoxFuture;
4504 #[derive(Debug)]
4505 pub struct Response(azure_core::http::Response);
4506 impl Response {
4507 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRefFavorite> {
4508 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
4509 let body: models::GitRefFavorite = serde_json::from_slice(&bytes).map_err(|e| {
4510 azure_core::error::Error::full(
4511 azure_core::error::ErrorKind::DataConversion,
4512 e,
4513 format!(
4514 "Failed to deserialize response:\n{}",
4515 String::from_utf8_lossy(&bytes)
4516 ),
4517 )
4518 })?;
4519 Ok(body)
4520 }
4521 pub fn into_raw_response(self) -> azure_core::http::Response {
4522 self.0
4523 }
4524 pub fn as_raw_response(&self) -> &azure_core::http::Response {
4525 &self.0
4526 }
4527 }
4528 impl From<Response> for azure_core::http::Response {
4529 fn from(rsp: Response) -> Self {
4530 rsp.into_raw_response()
4531 }
4532 }
4533 impl AsRef<azure_core::http::Response> for Response {
4534 fn as_ref(&self) -> &azure_core::http::Response {
4535 self.as_raw_response()
4536 }
4537 }
4538 #[derive(Clone)]
4539 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4540 #[doc = r""]
4541 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4542 #[doc = r" parameters can be chained."]
4543 #[doc = r""]
4544 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4545 #[doc = r" converts the [`RequestBuilder`] into a future,"]
4546 #[doc = r" executes the request and returns a `Result` with the parsed"]
4547 #[doc = r" response."]
4548 #[doc = r""]
4549 #[doc = r" If you need lower-level access to the raw response details"]
4550 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4551 #[doc = r" can finalize the request using the"]
4552 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4553 #[doc = r" that resolves to a lower-level [`Response`] value."]
4554 pub struct RequestBuilder {
4555 pub(crate) client: super::super::Client,
4556 pub(crate) organization: String,
4557 pub(crate) project: String,
4558 pub(crate) favorite_id: i32,
4559 }
4560 impl RequestBuilder {
4561 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4562 #[doc = ""]
4563 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4564 #[doc = "However, this function can provide more flexibility when required."]
4565 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4566 Box::pin({
4567 let this = self.clone();
4568 async move {
4569 let url = this.url()?;
4570 let mut req =
4571 azure_core::http::Request::new(url, azure_core::http::Method::Get);
4572 if let Some(auth_header) = this
4573 .client
4574 .token_credential()
4575 .http_authorization_header(&this.client.scopes())
4576 .await?
4577 {
4578 req.insert_header(
4579 azure_core::http::headers::AUTHORIZATION,
4580 auth_header,
4581 );
4582 }
4583 let req_body = azure_core::Bytes::new();
4584 req.set_body(req_body);
4585 Ok(Response(this.client.send(&mut req).await?))
4586 }
4587 })
4588 }
4589 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
4590 let mut url = azure_core::http::Url::parse(&format!(
4591 "{}/{}/{}/_apis/git/favorites/refs/{}",
4592 self.client.endpoint(),
4593 &self.organization,
4594 &self.project,
4595 &self.favorite_id
4596 ))?;
4597 let has_api_version_already = url
4598 .query_pairs()
4599 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
4600 if !has_api_version_already {
4601 url.query_pairs_mut().append_pair(
4602 azure_core::http::headers::query_param::API_VERSION,
4603 "7.1-preview",
4604 );
4605 }
4606 Ok(url)
4607 }
4608 }
4609 impl std::future::IntoFuture for RequestBuilder {
4610 type Output = azure_core::Result<models::GitRefFavorite>;
4611 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRefFavorite>>;
4612 #[doc = "Returns a future that sends the request and returns the parsed response body."]
4613 #[doc = ""]
4614 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
4615 #[doc = ""]
4616 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
4617 fn into_future(self) -> Self::IntoFuture {
4618 Box::pin(async move { self.send().await?.into_raw_body().await })
4619 }
4620 }
4621 }
4622 pub mod delete {
4623 use super::models;
4624 #[cfg(not(target_arch = "wasm32"))]
4625 use futures::future::BoxFuture;
4626 #[cfg(target_arch = "wasm32")]
4627 use futures::future::LocalBoxFuture as BoxFuture;
4628 #[derive(Debug)]
4629 pub struct Response(azure_core::http::Response);
4630 impl Response {
4631 pub fn into_raw_response(self) -> azure_core::http::Response {
4632 self.0
4633 }
4634 pub fn as_raw_response(&self) -> &azure_core::http::Response {
4635 &self.0
4636 }
4637 }
4638 impl From<Response> for azure_core::http::Response {
4639 fn from(rsp: Response) -> Self {
4640 rsp.into_raw_response()
4641 }
4642 }
4643 impl AsRef<azure_core::http::Response> for Response {
4644 fn as_ref(&self) -> &azure_core::http::Response {
4645 self.as_raw_response()
4646 }
4647 }
4648 #[derive(Clone)]
4649 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4650 #[doc = r""]
4651 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4652 #[doc = r" parameters can be chained."]
4653 #[doc = r""]
4654 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4655 #[doc = r" converts the [`RequestBuilder`] into a future,"]
4656 #[doc = r" executes the request and returns a `Result` with the parsed"]
4657 #[doc = r" response."]
4658 #[doc = r""]
4659 #[doc = r" If you need lower-level access to the raw response details"]
4660 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4661 #[doc = r" can finalize the request using the"]
4662 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4663 #[doc = r" that resolves to a lower-level [`Response`] value."]
4664 pub struct RequestBuilder {
4665 pub(crate) client: super::super::Client,
4666 pub(crate) organization: String,
4667 pub(crate) project: String,
4668 pub(crate) favorite_id: i32,
4669 }
4670 impl RequestBuilder {
4671 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4672 #[doc = ""]
4673 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4674 #[doc = "However, this function can provide more flexibility when required."]
4675 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4676 Box::pin({
4677 let this = self.clone();
4678 async move {
4679 let url = this.url()?;
4680 let mut req =
4681 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
4682 if let Some(auth_header) = this
4683 .client
4684 .token_credential()
4685 .http_authorization_header(&this.client.scopes())
4686 .await?
4687 {
4688 req.insert_header(
4689 azure_core::http::headers::AUTHORIZATION,
4690 auth_header,
4691 );
4692 }
4693 let req_body = azure_core::Bytes::new();
4694 req.set_body(req_body);
4695 Ok(Response(this.client.send(&mut req).await?))
4696 }
4697 })
4698 }
4699 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
4700 let mut url = azure_core::http::Url::parse(&format!(
4701 "{}/{}/{}/_apis/git/favorites/refs/{}",
4702 self.client.endpoint(),
4703 &self.organization,
4704 &self.project,
4705 &self.favorite_id
4706 ))?;
4707 let has_api_version_already = url
4708 .query_pairs()
4709 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
4710 if !has_api_version_already {
4711 url.query_pairs_mut().append_pair(
4712 azure_core::http::headers::query_param::API_VERSION,
4713 "7.1-preview",
4714 );
4715 }
4716 Ok(url)
4717 }
4718 }
4719 impl std::future::IntoFuture for RequestBuilder {
4720 type Output = azure_core::Result<()>;
4721 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
4722 #[doc = "Returns a future that sends the request and waits for the response."]
4723 #[doc = ""]
4724 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
4725 #[doc = ""]
4726 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
4727 fn into_future(self) -> Self::IntoFuture {
4728 Box::pin(async move {
4729 let _rsp = self.send().await?;
4730 Ok(())
4731 })
4732 }
4733 }
4734 }
4735}
4736pub mod policy_configurations {
4737 use super::models;
4738 #[cfg(not(target_arch = "wasm32"))]
4739 use futures::future::BoxFuture;
4740 #[cfg(target_arch = "wasm32")]
4741 use futures::future::LocalBoxFuture as BoxFuture;
4742 pub struct Client(pub(crate) super::Client);
4743 impl Client {
4744 #[doc = "Retrieve a list of policy configurations by a given set of scope/filtering criteria.\n\nBelow is a short description of how all of the query parameters interact with each other:\n- repositoryId set, refName set: returns all policy configurations that *apply* to a particular branch in a repository\n- repositoryId set, refName unset: returns all policy configurations that *apply* to a particular repository\n- repositoryId unset, refName unset: returns all policy configurations that are *defined* at the project level\n- repositoryId unset, refName set: returns all project-level branch policies, plus the project level configurations\nFor all of the examples above, when policyType is set, it'll restrict results to the given policy type"]
4745 #[doc = ""]
4746 #[doc = "Arguments:"]
4747 #[doc = "* `organization`: The name of the Azure DevOps organization."]
4748 #[doc = "* `project`: Project ID or project name"]
4749 pub fn get(
4750 &self,
4751 organization: impl Into<String>,
4752 project: impl Into<String>,
4753 ) -> get::RequestBuilder {
4754 get::RequestBuilder {
4755 client: self.0.clone(),
4756 organization: organization.into(),
4757 project: project.into(),
4758 repository_id: None,
4759 ref_name: None,
4760 policy_type: None,
4761 top: None,
4762 continuation_token: None,
4763 }
4764 }
4765 }
4766 pub mod get {
4767 use super::models;
4768 #[cfg(not(target_arch = "wasm32"))]
4769 use futures::future::BoxFuture;
4770 #[cfg(target_arch = "wasm32")]
4771 use futures::future::LocalBoxFuture as BoxFuture;
4772 #[derive(Debug)]
4773 pub struct Response(azure_core::http::Response);
4774 impl Response {
4775 pub async fn into_raw_body(
4776 self,
4777 ) -> azure_core::Result<models::PolicyConfigurationList> {
4778 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
4779 let body: models::PolicyConfigurationList = serde_json::from_slice(&bytes)
4780 .map_err(|e| {
4781 azure_core::error::Error::full(
4782 azure_core::error::ErrorKind::DataConversion,
4783 e,
4784 format!(
4785 "Failed to deserialize response:\n{}",
4786 String::from_utf8_lossy(&bytes)
4787 ),
4788 )
4789 })?;
4790 Ok(body)
4791 }
4792 pub fn into_raw_response(self) -> azure_core::http::Response {
4793 self.0
4794 }
4795 pub fn as_raw_response(&self) -> &azure_core::http::Response {
4796 &self.0
4797 }
4798 pub fn headers(&self) -> Headers {
4799 Headers(self.0.headers())
4800 }
4801 }
4802 impl From<Response> for azure_core::http::Response {
4803 fn from(rsp: Response) -> Self {
4804 rsp.into_raw_response()
4805 }
4806 }
4807 impl AsRef<azure_core::http::Response> for Response {
4808 fn as_ref(&self) -> &azure_core::http::Response {
4809 self.as_raw_response()
4810 }
4811 }
4812 pub struct Headers<'a>(&'a azure_core::http::headers::Headers);
4813 impl Headers<'_> {
4814 pub fn x_ms_continuationtoken(&self) -> azure_core::Result<&str> {
4815 self.0
4816 .get_str(&azure_core::http::headers::HeaderName::from_static(
4817 "x-ms-continuationtoken",
4818 ))
4819 }
4820 }
4821 #[derive(Clone)]
4822 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
4823 #[doc = r""]
4824 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
4825 #[doc = r" parameters can be chained."]
4826 #[doc = r""]
4827 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
4828 #[doc = r" converts the [`RequestBuilder`] into a future,"]
4829 #[doc = r" executes the request and returns a `Result` with the parsed"]
4830 #[doc = r" response."]
4831 #[doc = r""]
4832 #[doc = r" If you need lower-level access to the raw response details"]
4833 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
4834 #[doc = r" can finalize the request using the"]
4835 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
4836 #[doc = r" that resolves to a lower-level [`Response`] value."]
4837 pub struct RequestBuilder {
4838 pub(crate) client: super::super::Client,
4839 pub(crate) organization: String,
4840 pub(crate) project: String,
4841 pub(crate) repository_id: Option<String>,
4842 pub(crate) ref_name: Option<String>,
4843 pub(crate) policy_type: Option<String>,
4844 pub(crate) top: Option<i32>,
4845 pub(crate) continuation_token: Option<String>,
4846 }
4847 impl RequestBuilder {
4848 #[doc = "The repository id."]
4849 pub fn repository_id(mut self, repository_id: impl Into<String>) -> Self {
4850 self.repository_id = Some(repository_id.into());
4851 self
4852 }
4853 #[doc = "The fully-qualified Git ref name (e.g. refs/heads/master)."]
4854 pub fn ref_name(mut self, ref_name: impl Into<String>) -> Self {
4855 self.ref_name = Some(ref_name.into());
4856 self
4857 }
4858 #[doc = "The policy type filter."]
4859 pub fn policy_type(mut self, policy_type: impl Into<String>) -> Self {
4860 self.policy_type = Some(policy_type.into());
4861 self
4862 }
4863 #[doc = "Maximum number of policies to return."]
4864 pub fn top(mut self, top: i32) -> Self {
4865 self.top = Some(top);
4866 self
4867 }
4868 #[doc = "Pass a policy configuration ID to fetch the next page of results, up to top number of results, for this endpoint."]
4869 pub fn continuation_token(mut self, continuation_token: impl Into<String>) -> Self {
4870 self.continuation_token = Some(continuation_token.into());
4871 self
4872 }
4873 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
4874 #[doc = ""]
4875 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
4876 #[doc = "However, this function can provide more flexibility when required."]
4877 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
4878 Box::pin({
4879 let this = self.clone();
4880 async move {
4881 let url = this.url()?;
4882 let mut req =
4883 azure_core::http::Request::new(url, azure_core::http::Method::Get);
4884 if let Some(auth_header) = this
4885 .client
4886 .token_credential()
4887 .http_authorization_header(&this.client.scopes())
4888 .await?
4889 {
4890 req.insert_header(
4891 azure_core::http::headers::AUTHORIZATION,
4892 auth_header,
4893 );
4894 }
4895 if let Some(repository_id) = &this.repository_id {
4896 req.url_mut()
4897 .query_pairs_mut()
4898 .append_pair("repositoryId", repository_id);
4899 }
4900 if let Some(ref_name) = &this.ref_name {
4901 req.url_mut()
4902 .query_pairs_mut()
4903 .append_pair("refName", ref_name);
4904 }
4905 if let Some(policy_type) = &this.policy_type {
4906 req.url_mut()
4907 .query_pairs_mut()
4908 .append_pair("policyType", policy_type);
4909 }
4910 if let Some(top) = &this.top {
4911 req.url_mut()
4912 .query_pairs_mut()
4913 .append_pair("$top", &top.to_string());
4914 }
4915 if let Some(continuation_token) = &this.continuation_token {
4916 req.url_mut()
4917 .query_pairs_mut()
4918 .append_pair("continuationToken", continuation_token);
4919 }
4920 let req_body = azure_core::Bytes::new();
4921 req.set_body(req_body);
4922 Ok(Response(this.client.send(&mut req).await?))
4923 }
4924 })
4925 }
4926 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
4927 let mut url = azure_core::http::Url::parse(&format!(
4928 "{}/{}/{}/_apis/git/policy/configurations",
4929 self.client.endpoint(),
4930 &self.organization,
4931 &self.project
4932 ))?;
4933 let has_api_version_already = url
4934 .query_pairs()
4935 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
4936 if !has_api_version_already {
4937 url.query_pairs_mut().append_pair(
4938 azure_core::http::headers::query_param::API_VERSION,
4939 "7.1-preview",
4940 );
4941 }
4942 Ok(url)
4943 }
4944 }
4945 impl std::future::IntoFuture for RequestBuilder {
4946 type Output = azure_core::Result<models::PolicyConfigurationList>;
4947 type IntoFuture =
4948 BoxFuture<'static, azure_core::Result<models::PolicyConfigurationList>>;
4949 #[doc = "Returns a future that sends the request and returns the parsed response body."]
4950 #[doc = ""]
4951 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
4952 #[doc = ""]
4953 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
4954 fn into_future(self) -> Self::IntoFuture {
4955 Box::pin(async move { self.send().await?.into_raw_body().await })
4956 }
4957 }
4958 }
4959}
4960pub mod pull_requests {
4961 use super::models;
4962 #[cfg(not(target_arch = "wasm32"))]
4963 use futures::future::BoxFuture;
4964 #[cfg(target_arch = "wasm32")]
4965 use futures::future::LocalBoxFuture as BoxFuture;
4966 pub struct Client(pub(crate) super::Client);
4967 impl Client {
4968 #[doc = "Retrieve all pull requests matching a specified criteria.\n\nPlease note that description field will be truncated up to 400 symbols in the result."]
4969 #[doc = ""]
4970 #[doc = "Arguments:"]
4971 #[doc = "* `organization`: The name of the Azure DevOps organization."]
4972 #[doc = "* `project`: Project ID or project name"]
4973 pub fn get_pull_requests_by_project(
4974 &self,
4975 organization: impl Into<String>,
4976 project: impl Into<String>,
4977 ) -> get_pull_requests_by_project::RequestBuilder {
4978 get_pull_requests_by_project::RequestBuilder {
4979 client: self.0.clone(),
4980 organization: organization.into(),
4981 project: project.into(),
4982 search_criteria_creator_id: None,
4983 search_criteria_include_links: None,
4984 search_criteria_max_time: None,
4985 search_criteria_min_time: None,
4986 search_criteria_query_time_range_type: None,
4987 search_criteria_repository_id: None,
4988 search_criteria_reviewer_id: None,
4989 search_criteria_source_ref_name: None,
4990 search_criteria_source_repository_id: None,
4991 search_criteria_status: None,
4992 search_criteria_target_ref_name: None,
4993 max_comment_length: None,
4994 skip: None,
4995 top: None,
4996 }
4997 }
4998 #[doc = "Retrieve a pull request."]
4999 #[doc = ""]
5000 #[doc = "Arguments:"]
5001 #[doc = "* `organization`: The name of the Azure DevOps organization."]
5002 #[doc = "* `pull_request_id`: The ID of the pull request to retrieve."]
5003 #[doc = "* `project`: Project ID or project name"]
5004 pub fn get_pull_request_by_id(
5005 &self,
5006 organization: impl Into<String>,
5007 pull_request_id: i32,
5008 project: impl Into<String>,
5009 ) -> get_pull_request_by_id::RequestBuilder {
5010 get_pull_request_by_id::RequestBuilder {
5011 client: self.0.clone(),
5012 organization: organization.into(),
5013 pull_request_id,
5014 project: project.into(),
5015 }
5016 }
5017 #[doc = "Retrieve all pull requests matching a specified criteria.\n\nPlease note that description field will be truncated up to 400 symbols in the result."]
5018 #[doc = ""]
5019 #[doc = "Arguments:"]
5020 #[doc = "* `organization`: The name of the Azure DevOps organization."]
5021 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
5022 #[doc = "* `project`: Project ID or project name"]
5023 pub fn get_pull_requests(
5024 &self,
5025 organization: impl Into<String>,
5026 repository_id: impl Into<String>,
5027 project: impl Into<String>,
5028 ) -> get_pull_requests::RequestBuilder {
5029 get_pull_requests::RequestBuilder {
5030 client: self.0.clone(),
5031 organization: organization.into(),
5032 repository_id: repository_id.into(),
5033 project: project.into(),
5034 search_criteria_creator_id: None,
5035 search_criteria_include_links: None,
5036 search_criteria_max_time: None,
5037 search_criteria_min_time: None,
5038 search_criteria_query_time_range_type: None,
5039 search_criteria_repository_id: None,
5040 search_criteria_reviewer_id: None,
5041 search_criteria_source_ref_name: None,
5042 search_criteria_source_repository_id: None,
5043 search_criteria_status: None,
5044 search_criteria_target_ref_name: None,
5045 max_comment_length: None,
5046 skip: None,
5047 top: None,
5048 }
5049 }
5050 #[doc = "Create a pull request."]
5051 #[doc = ""]
5052 #[doc = "Arguments:"]
5053 #[doc = "* `organization`: The name of the Azure DevOps organization."]
5054 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
5055 #[doc = "* `project`: Project ID or project name"]
5056 #[doc = "* `create_options`: The pull request to create."]
5057 pub fn create(
5058 &self,
5059 organization: impl Into<String>,
5060 repository_id: impl Into<String>,
5061 project: impl Into<String>,
5062 create_options: impl Into<models::GitPullRequestCreateOptions>,
5063 ) -> create::RequestBuilder {
5064 create::RequestBuilder {
5065 client: self.0.clone(),
5066 organization: organization.into(),
5067 repository_id: repository_id.into(),
5068 project: project.into(),
5069 create_options: create_options.into(),
5070 supports_iterations: None,
5071 }
5072 }
5073 #[doc = "Retrieve a pull request."]
5074 #[doc = ""]
5075 #[doc = "Arguments:"]
5076 #[doc = "* `organization`: The name of the Azure DevOps organization."]
5077 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
5078 #[doc = "* `pull_request_id`: The ID of the pull request to retrieve."]
5079 #[doc = "* `project`: Project ID or project name"]
5080 pub fn get_pull_request(
5081 &self,
5082 organization: impl Into<String>,
5083 repository_id: impl Into<String>,
5084 pull_request_id: i32,
5085 project: impl Into<String>,
5086 ) -> get_pull_request::RequestBuilder {
5087 get_pull_request::RequestBuilder {
5088 client: self.0.clone(),
5089 organization: organization.into(),
5090 repository_id: repository_id.into(),
5091 pull_request_id,
5092 project: project.into(),
5093 max_comment_length: None,
5094 skip: None,
5095 top: None,
5096 include_commits: None,
5097 include_work_item_refs: None,
5098 }
5099 }
5100 #[doc = "Update a pull request\n\nThese are the properties that can be updated with the API:\n - Status\n - Title\n - Description (up to 4000 characters)\n - CompletionOptions\n - MergeOptions\n - AutoCompleteSetBy.Id\n - TargetRefName (when the PR retargeting feature is enabled)\n Attempting to update other properties outside of this list will either cause the server to throw an `InvalidArgumentValueException`,\n or to silently ignore the update."]
5101 #[doc = ""]
5102 #[doc = "Arguments:"]
5103 #[doc = "* `organization`: The name of the Azure DevOps organization."]
5104 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
5105 #[doc = "* `project`: Project ID or project name"]
5106 #[doc = "* `pull_request_id`: The ID of the pull request to retrieve."]
5107 #[doc = "* `update_options`: The pull request content to update."]
5108 pub fn update(
5109 &self,
5110 organization: impl Into<String>,
5111 repository_id: impl Into<String>,
5112 project: impl Into<String>,
5113 pull_request_id: i32,
5114 update_options: impl Into<models::GitPullRequestUpdateOptions>,
5115 ) -> update::RequestBuilder {
5116 update::RequestBuilder {
5117 client: self.0.clone(),
5118 organization: organization.into(),
5119 repository_id: repository_id.into(),
5120 project: project.into(),
5121 pull_request_id,
5122 update_options: update_options.into(),
5123 include_commits: None,
5124 include_work_item_refs: None,
5125 }
5126 }
5127 }
5128 pub mod get_pull_requests_by_project {
5129 use super::models;
5130 #[cfg(not(target_arch = "wasm32"))]
5131 use futures::future::BoxFuture;
5132 #[cfg(target_arch = "wasm32")]
5133 use futures::future::LocalBoxFuture as BoxFuture;
5134 #[derive(Debug)]
5135 pub struct Response(azure_core::http::Response);
5136 impl Response {
5137 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequestList> {
5138 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
5139 let body: models::GitPullRequestList =
5140 serde_json::from_slice(&bytes).map_err(|e| {
5141 azure_core::error::Error::full(
5142 azure_core::error::ErrorKind::DataConversion,
5143 e,
5144 format!(
5145 "Failed to deserialize response:\n{}",
5146 String::from_utf8_lossy(&bytes)
5147 ),
5148 )
5149 })?;
5150 Ok(body)
5151 }
5152 pub fn into_raw_response(self) -> azure_core::http::Response {
5153 self.0
5154 }
5155 pub fn as_raw_response(&self) -> &azure_core::http::Response {
5156 &self.0
5157 }
5158 }
5159 impl From<Response> for azure_core::http::Response {
5160 fn from(rsp: Response) -> Self {
5161 rsp.into_raw_response()
5162 }
5163 }
5164 impl AsRef<azure_core::http::Response> for Response {
5165 fn as_ref(&self) -> &azure_core::http::Response {
5166 self.as_raw_response()
5167 }
5168 }
5169 #[derive(Clone)]
5170 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5171 #[doc = r""]
5172 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5173 #[doc = r" parameters can be chained."]
5174 #[doc = r""]
5175 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5176 #[doc = r" converts the [`RequestBuilder`] into a future,"]
5177 #[doc = r" executes the request and returns a `Result` with the parsed"]
5178 #[doc = r" response."]
5179 #[doc = r""]
5180 #[doc = r" If you need lower-level access to the raw response details"]
5181 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5182 #[doc = r" can finalize the request using the"]
5183 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5184 #[doc = r" that resolves to a lower-level [`Response`] value."]
5185 pub struct RequestBuilder {
5186 pub(crate) client: super::super::Client,
5187 pub(crate) organization: String,
5188 pub(crate) project: String,
5189 pub(crate) search_criteria_creator_id: Option<String>,
5190 pub(crate) search_criteria_include_links: Option<bool>,
5191 pub(crate) search_criteria_max_time: Option<time::OffsetDateTime>,
5192 pub(crate) search_criteria_min_time: Option<time::OffsetDateTime>,
5193 pub(crate) search_criteria_query_time_range_type: Option<String>,
5194 pub(crate) search_criteria_repository_id: Option<String>,
5195 pub(crate) search_criteria_reviewer_id: Option<String>,
5196 pub(crate) search_criteria_source_ref_name: Option<String>,
5197 pub(crate) search_criteria_source_repository_id: Option<String>,
5198 pub(crate) search_criteria_status: Option<String>,
5199 pub(crate) search_criteria_target_ref_name: Option<String>,
5200 pub(crate) max_comment_length: Option<i32>,
5201 pub(crate) skip: Option<i32>,
5202 pub(crate) top: Option<i32>,
5203 }
5204 impl RequestBuilder {
5205 #[doc = "If set, search for pull requests that were created by this identity."]
5206 pub fn search_criteria_creator_id(
5207 mut self,
5208 search_criteria_creator_id: impl Into<String>,
5209 ) -> Self {
5210 self.search_criteria_creator_id = Some(search_criteria_creator_id.into());
5211 self
5212 }
5213 #[doc = "Whether to include the _links field on the shallow references"]
5214 pub fn search_criteria_include_links(
5215 mut self,
5216 search_criteria_include_links: bool,
5217 ) -> Self {
5218 self.search_criteria_include_links = Some(search_criteria_include_links);
5219 self
5220 }
5221 #[doc = "If specified, filters pull requests that created/closed before this date based on the queryTimeRangeType specified."]
5222 pub fn search_criteria_max_time(
5223 mut self,
5224 search_criteria_max_time: impl Into<time::OffsetDateTime>,
5225 ) -> Self {
5226 self.search_criteria_max_time = Some(search_criteria_max_time.into());
5227 self
5228 }
5229 #[doc = "If specified, filters pull requests that created/closed after this date based on the queryTimeRangeType specified."]
5230 pub fn search_criteria_min_time(
5231 mut self,
5232 search_criteria_min_time: impl Into<time::OffsetDateTime>,
5233 ) -> Self {
5234 self.search_criteria_min_time = Some(search_criteria_min_time.into());
5235 self
5236 }
5237 #[doc = "The type of time range which should be used for minTime and maxTime. Defaults to Created if unset."]
5238 pub fn search_criteria_query_time_range_type(
5239 mut self,
5240 search_criteria_query_time_range_type: impl Into<String>,
5241 ) -> Self {
5242 self.search_criteria_query_time_range_type =
5243 Some(search_criteria_query_time_range_type.into());
5244 self
5245 }
5246 #[doc = "If set, search for pull requests whose target branch is in this repository."]
5247 pub fn search_criteria_repository_id(
5248 mut self,
5249 search_criteria_repository_id: impl Into<String>,
5250 ) -> Self {
5251 self.search_criteria_repository_id = Some(search_criteria_repository_id.into());
5252 self
5253 }
5254 #[doc = "If set, search for pull requests that have this identity as a reviewer."]
5255 pub fn search_criteria_reviewer_id(
5256 mut self,
5257 search_criteria_reviewer_id: impl Into<String>,
5258 ) -> Self {
5259 self.search_criteria_reviewer_id = Some(search_criteria_reviewer_id.into());
5260 self
5261 }
5262 #[doc = "If set, search for pull requests from this branch."]
5263 pub fn search_criteria_source_ref_name(
5264 mut self,
5265 search_criteria_source_ref_name: impl Into<String>,
5266 ) -> Self {
5267 self.search_criteria_source_ref_name = Some(search_criteria_source_ref_name.into());
5268 self
5269 }
5270 #[doc = "If set, search for pull requests whose source branch is in this repository."]
5271 pub fn search_criteria_source_repository_id(
5272 mut self,
5273 search_criteria_source_repository_id: impl Into<String>,
5274 ) -> Self {
5275 self.search_criteria_source_repository_id =
5276 Some(search_criteria_source_repository_id.into());
5277 self
5278 }
5279 #[doc = "If set, search for pull requests that are in this state. Defaults to Active if unset."]
5280 pub fn search_criteria_status(
5281 mut self,
5282 search_criteria_status: impl Into<String>,
5283 ) -> Self {
5284 self.search_criteria_status = Some(search_criteria_status.into());
5285 self
5286 }
5287 #[doc = "If set, search for pull requests into this branch."]
5288 pub fn search_criteria_target_ref_name(
5289 mut self,
5290 search_criteria_target_ref_name: impl Into<String>,
5291 ) -> Self {
5292 self.search_criteria_target_ref_name = Some(search_criteria_target_ref_name.into());
5293 self
5294 }
5295 #[doc = "Not used."]
5296 pub fn max_comment_length(mut self, max_comment_length: i32) -> Self {
5297 self.max_comment_length = Some(max_comment_length);
5298 self
5299 }
5300 #[doc = "The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100."]
5301 pub fn skip(mut self, skip: i32) -> Self {
5302 self.skip = Some(skip);
5303 self
5304 }
5305 #[doc = "The number of pull requests to retrieve."]
5306 pub fn top(mut self, top: i32) -> Self {
5307 self.top = Some(top);
5308 self
5309 }
5310 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5311 #[doc = ""]
5312 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5313 #[doc = "However, this function can provide more flexibility when required."]
5314 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5315 Box::pin({
5316 let this = self.clone();
5317 async move {
5318 let url = this.url()?;
5319 let mut req =
5320 azure_core::http::Request::new(url, azure_core::http::Method::Get);
5321 if let Some(auth_header) = this
5322 .client
5323 .token_credential()
5324 .http_authorization_header(&this.client.scopes())
5325 .await?
5326 {
5327 req.insert_header(
5328 azure_core::http::headers::AUTHORIZATION,
5329 auth_header,
5330 );
5331 }
5332 if let Some(search_criteria_creator_id) = &this.search_criteria_creator_id {
5333 req.url_mut().query_pairs_mut().append_pair(
5334 "searchCriteria.creatorId",
5335 search_criteria_creator_id,
5336 );
5337 }
5338 if let Some(search_criteria_include_links) =
5339 &this.search_criteria_include_links
5340 {
5341 req.url_mut().query_pairs_mut().append_pair(
5342 "searchCriteria.includeLinks",
5343 &search_criteria_include_links.to_string(),
5344 );
5345 }
5346 if let Some(search_criteria_max_time) = &this.search_criteria_max_time {
5347 req.url_mut().query_pairs_mut().append_pair(
5348 "searchCriteria.maxTime",
5349 &search_criteria_max_time.to_string(),
5350 );
5351 }
5352 if let Some(search_criteria_min_time) = &this.search_criteria_min_time {
5353 req.url_mut().query_pairs_mut().append_pair(
5354 "searchCriteria.minTime",
5355 &search_criteria_min_time.to_string(),
5356 );
5357 }
5358 if let Some(search_criteria_query_time_range_type) =
5359 &this.search_criteria_query_time_range_type
5360 {
5361 req.url_mut().query_pairs_mut().append_pair(
5362 "searchCriteria.queryTimeRangeType",
5363 search_criteria_query_time_range_type,
5364 );
5365 }
5366 if let Some(search_criteria_repository_id) =
5367 &this.search_criteria_repository_id
5368 {
5369 req.url_mut().query_pairs_mut().append_pair(
5370 "searchCriteria.repositoryId",
5371 search_criteria_repository_id,
5372 );
5373 }
5374 if let Some(search_criteria_reviewer_id) = &this.search_criteria_reviewer_id
5375 {
5376 req.url_mut().query_pairs_mut().append_pair(
5377 "searchCriteria.reviewerId",
5378 search_criteria_reviewer_id,
5379 );
5380 }
5381 if let Some(search_criteria_source_ref_name) =
5382 &this.search_criteria_source_ref_name
5383 {
5384 req.url_mut().query_pairs_mut().append_pair(
5385 "searchCriteria.sourceRefName",
5386 search_criteria_source_ref_name,
5387 );
5388 }
5389 if let Some(search_criteria_source_repository_id) =
5390 &this.search_criteria_source_repository_id
5391 {
5392 req.url_mut().query_pairs_mut().append_pair(
5393 "searchCriteria.sourceRepositoryId",
5394 search_criteria_source_repository_id,
5395 );
5396 }
5397 if let Some(search_criteria_status) = &this.search_criteria_status {
5398 req.url_mut()
5399 .query_pairs_mut()
5400 .append_pair("searchCriteria.status", search_criteria_status);
5401 }
5402 if let Some(search_criteria_target_ref_name) =
5403 &this.search_criteria_target_ref_name
5404 {
5405 req.url_mut().query_pairs_mut().append_pair(
5406 "searchCriteria.targetRefName",
5407 search_criteria_target_ref_name,
5408 );
5409 }
5410 if let Some(max_comment_length) = &this.max_comment_length {
5411 req.url_mut()
5412 .query_pairs_mut()
5413 .append_pair("maxCommentLength", &max_comment_length.to_string());
5414 }
5415 if let Some(skip) = &this.skip {
5416 req.url_mut()
5417 .query_pairs_mut()
5418 .append_pair("$skip", &skip.to_string());
5419 }
5420 if let Some(top) = &this.top {
5421 req.url_mut()
5422 .query_pairs_mut()
5423 .append_pair("$top", &top.to_string());
5424 }
5425 let req_body = azure_core::Bytes::new();
5426 req.set_body(req_body);
5427 Ok(Response(this.client.send(&mut req).await?))
5428 }
5429 })
5430 }
5431 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
5432 let mut url = azure_core::http::Url::parse(&format!(
5433 "{}/{}/{}/_apis/git/pullrequests",
5434 self.client.endpoint(),
5435 &self.organization,
5436 &self.project
5437 ))?;
5438 let has_api_version_already = url
5439 .query_pairs()
5440 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
5441 if !has_api_version_already {
5442 url.query_pairs_mut().append_pair(
5443 azure_core::http::headers::query_param::API_VERSION,
5444 "7.1-preview",
5445 );
5446 }
5447 Ok(url)
5448 }
5449 }
5450 impl std::future::IntoFuture for RequestBuilder {
5451 type Output = azure_core::Result<models::GitPullRequestList>;
5452 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequestList>>;
5453 #[doc = "Returns a future that sends the request and returns the parsed response body."]
5454 #[doc = ""]
5455 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
5456 #[doc = ""]
5457 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
5458 fn into_future(self) -> Self::IntoFuture {
5459 Box::pin(async move { self.send().await?.into_raw_body().await })
5460 }
5461 }
5462 }
5463 pub mod get_pull_request_by_id {
5464 use super::models;
5465 #[cfg(not(target_arch = "wasm32"))]
5466 use futures::future::BoxFuture;
5467 #[cfg(target_arch = "wasm32")]
5468 use futures::future::LocalBoxFuture as BoxFuture;
5469 #[derive(Debug)]
5470 pub struct Response(azure_core::http::Response);
5471 impl Response {
5472 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequest> {
5473 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
5474 let body: models::GitPullRequest = serde_json::from_slice(&bytes).map_err(|e| {
5475 azure_core::error::Error::full(
5476 azure_core::error::ErrorKind::DataConversion,
5477 e,
5478 format!(
5479 "Failed to deserialize response:\n{}",
5480 String::from_utf8_lossy(&bytes)
5481 ),
5482 )
5483 })?;
5484 Ok(body)
5485 }
5486 pub fn into_raw_response(self) -> azure_core::http::Response {
5487 self.0
5488 }
5489 pub fn as_raw_response(&self) -> &azure_core::http::Response {
5490 &self.0
5491 }
5492 }
5493 impl From<Response> for azure_core::http::Response {
5494 fn from(rsp: Response) -> Self {
5495 rsp.into_raw_response()
5496 }
5497 }
5498 impl AsRef<azure_core::http::Response> for Response {
5499 fn as_ref(&self) -> &azure_core::http::Response {
5500 self.as_raw_response()
5501 }
5502 }
5503 #[derive(Clone)]
5504 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5505 #[doc = r""]
5506 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5507 #[doc = r" parameters can be chained."]
5508 #[doc = r""]
5509 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5510 #[doc = r" converts the [`RequestBuilder`] into a future,"]
5511 #[doc = r" executes the request and returns a `Result` with the parsed"]
5512 #[doc = r" response."]
5513 #[doc = r""]
5514 #[doc = r" If you need lower-level access to the raw response details"]
5515 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5516 #[doc = r" can finalize the request using the"]
5517 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5518 #[doc = r" that resolves to a lower-level [`Response`] value."]
5519 pub struct RequestBuilder {
5520 pub(crate) client: super::super::Client,
5521 pub(crate) organization: String,
5522 pub(crate) pull_request_id: i32,
5523 pub(crate) project: String,
5524 }
5525 impl RequestBuilder {
5526 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5527 #[doc = ""]
5528 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5529 #[doc = "However, this function can provide more flexibility when required."]
5530 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5531 Box::pin({
5532 let this = self.clone();
5533 async move {
5534 let url = this.url()?;
5535 let mut req =
5536 azure_core::http::Request::new(url, azure_core::http::Method::Get);
5537 if let Some(auth_header) = this
5538 .client
5539 .token_credential()
5540 .http_authorization_header(&this.client.scopes())
5541 .await?
5542 {
5543 req.insert_header(
5544 azure_core::http::headers::AUTHORIZATION,
5545 auth_header,
5546 );
5547 }
5548 let req_body = azure_core::Bytes::new();
5549 req.set_body(req_body);
5550 Ok(Response(this.client.send(&mut req).await?))
5551 }
5552 })
5553 }
5554 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
5555 let mut url = azure_core::http::Url::parse(&format!(
5556 "{}/{}/{}/_apis/git/pullrequests/{}",
5557 self.client.endpoint(),
5558 &self.organization,
5559 &self.project,
5560 &self.pull_request_id
5561 ))?;
5562 let has_api_version_already = url
5563 .query_pairs()
5564 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
5565 if !has_api_version_already {
5566 url.query_pairs_mut().append_pair(
5567 azure_core::http::headers::query_param::API_VERSION,
5568 "7.1-preview",
5569 );
5570 }
5571 Ok(url)
5572 }
5573 }
5574 impl std::future::IntoFuture for RequestBuilder {
5575 type Output = azure_core::Result<models::GitPullRequest>;
5576 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequest>>;
5577 #[doc = "Returns a future that sends the request and returns the parsed response body."]
5578 #[doc = ""]
5579 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
5580 #[doc = ""]
5581 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
5582 fn into_future(self) -> Self::IntoFuture {
5583 Box::pin(async move { self.send().await?.into_raw_body().await })
5584 }
5585 }
5586 }
5587 pub mod get_pull_requests {
5588 use super::models;
5589 #[cfg(not(target_arch = "wasm32"))]
5590 use futures::future::BoxFuture;
5591 #[cfg(target_arch = "wasm32")]
5592 use futures::future::LocalBoxFuture as BoxFuture;
5593 #[derive(Debug)]
5594 pub struct Response(azure_core::http::Response);
5595 impl Response {
5596 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequestList> {
5597 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
5598 let body: models::GitPullRequestList =
5599 serde_json::from_slice(&bytes).map_err(|e| {
5600 azure_core::error::Error::full(
5601 azure_core::error::ErrorKind::DataConversion,
5602 e,
5603 format!(
5604 "Failed to deserialize response:\n{}",
5605 String::from_utf8_lossy(&bytes)
5606 ),
5607 )
5608 })?;
5609 Ok(body)
5610 }
5611 pub fn into_raw_response(self) -> azure_core::http::Response {
5612 self.0
5613 }
5614 pub fn as_raw_response(&self) -> &azure_core::http::Response {
5615 &self.0
5616 }
5617 }
5618 impl From<Response> for azure_core::http::Response {
5619 fn from(rsp: Response) -> Self {
5620 rsp.into_raw_response()
5621 }
5622 }
5623 impl AsRef<azure_core::http::Response> for Response {
5624 fn as_ref(&self) -> &azure_core::http::Response {
5625 self.as_raw_response()
5626 }
5627 }
5628 #[derive(Clone)]
5629 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5630 #[doc = r""]
5631 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5632 #[doc = r" parameters can be chained."]
5633 #[doc = r""]
5634 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5635 #[doc = r" converts the [`RequestBuilder`] into a future,"]
5636 #[doc = r" executes the request and returns a `Result` with the parsed"]
5637 #[doc = r" response."]
5638 #[doc = r""]
5639 #[doc = r" If you need lower-level access to the raw response details"]
5640 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5641 #[doc = r" can finalize the request using the"]
5642 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5643 #[doc = r" that resolves to a lower-level [`Response`] value."]
5644 pub struct RequestBuilder {
5645 pub(crate) client: super::super::Client,
5646 pub(crate) organization: String,
5647 pub(crate) repository_id: String,
5648 pub(crate) project: String,
5649 pub(crate) search_criteria_creator_id: Option<String>,
5650 pub(crate) search_criteria_include_links: Option<bool>,
5651 pub(crate) search_criteria_max_time: Option<time::OffsetDateTime>,
5652 pub(crate) search_criteria_min_time: Option<time::OffsetDateTime>,
5653 pub(crate) search_criteria_query_time_range_type: Option<String>,
5654 pub(crate) search_criteria_repository_id: Option<String>,
5655 pub(crate) search_criteria_reviewer_id: Option<String>,
5656 pub(crate) search_criteria_source_ref_name: Option<String>,
5657 pub(crate) search_criteria_source_repository_id: Option<String>,
5658 pub(crate) search_criteria_status: Option<String>,
5659 pub(crate) search_criteria_target_ref_name: Option<String>,
5660 pub(crate) max_comment_length: Option<i32>,
5661 pub(crate) skip: Option<i32>,
5662 pub(crate) top: Option<i32>,
5663 }
5664 impl RequestBuilder {
5665 #[doc = "If set, search for pull requests that were created by this identity."]
5666 pub fn search_criteria_creator_id(
5667 mut self,
5668 search_criteria_creator_id: impl Into<String>,
5669 ) -> Self {
5670 self.search_criteria_creator_id = Some(search_criteria_creator_id.into());
5671 self
5672 }
5673 #[doc = "Whether to include the _links field on the shallow references"]
5674 pub fn search_criteria_include_links(
5675 mut self,
5676 search_criteria_include_links: bool,
5677 ) -> Self {
5678 self.search_criteria_include_links = Some(search_criteria_include_links);
5679 self
5680 }
5681 #[doc = "If specified, filters pull requests that created/closed before this date based on the queryTimeRangeType specified."]
5682 pub fn search_criteria_max_time(
5683 mut self,
5684 search_criteria_max_time: impl Into<time::OffsetDateTime>,
5685 ) -> Self {
5686 self.search_criteria_max_time = Some(search_criteria_max_time.into());
5687 self
5688 }
5689 #[doc = "If specified, filters pull requests that created/closed after this date based on the queryTimeRangeType specified."]
5690 pub fn search_criteria_min_time(
5691 mut self,
5692 search_criteria_min_time: impl Into<time::OffsetDateTime>,
5693 ) -> Self {
5694 self.search_criteria_min_time = Some(search_criteria_min_time.into());
5695 self
5696 }
5697 #[doc = "The type of time range which should be used for minTime and maxTime. Defaults to Created if unset."]
5698 pub fn search_criteria_query_time_range_type(
5699 mut self,
5700 search_criteria_query_time_range_type: impl Into<String>,
5701 ) -> Self {
5702 self.search_criteria_query_time_range_type =
5703 Some(search_criteria_query_time_range_type.into());
5704 self
5705 }
5706 #[doc = "If set, search for pull requests whose target branch is in this repository."]
5707 pub fn search_criteria_repository_id(
5708 mut self,
5709 search_criteria_repository_id: impl Into<String>,
5710 ) -> Self {
5711 self.search_criteria_repository_id = Some(search_criteria_repository_id.into());
5712 self
5713 }
5714 #[doc = "If set, search for pull requests that have this identity as a reviewer."]
5715 pub fn search_criteria_reviewer_id(
5716 mut self,
5717 search_criteria_reviewer_id: impl Into<String>,
5718 ) -> Self {
5719 self.search_criteria_reviewer_id = Some(search_criteria_reviewer_id.into());
5720 self
5721 }
5722 #[doc = "If set, search for pull requests from this branch."]
5723 pub fn search_criteria_source_ref_name(
5724 mut self,
5725 search_criteria_source_ref_name: impl Into<String>,
5726 ) -> Self {
5727 self.search_criteria_source_ref_name = Some(search_criteria_source_ref_name.into());
5728 self
5729 }
5730 #[doc = "If set, search for pull requests whose source branch is in this repository."]
5731 pub fn search_criteria_source_repository_id(
5732 mut self,
5733 search_criteria_source_repository_id: impl Into<String>,
5734 ) -> Self {
5735 self.search_criteria_source_repository_id =
5736 Some(search_criteria_source_repository_id.into());
5737 self
5738 }
5739 #[doc = "If set, search for pull requests that are in this state. Defaults to Active if unset."]
5740 pub fn search_criteria_status(
5741 mut self,
5742 search_criteria_status: impl Into<String>,
5743 ) -> Self {
5744 self.search_criteria_status = Some(search_criteria_status.into());
5745 self
5746 }
5747 #[doc = "If set, search for pull requests into this branch."]
5748 pub fn search_criteria_target_ref_name(
5749 mut self,
5750 search_criteria_target_ref_name: impl Into<String>,
5751 ) -> Self {
5752 self.search_criteria_target_ref_name = Some(search_criteria_target_ref_name.into());
5753 self
5754 }
5755 #[doc = "Not used."]
5756 pub fn max_comment_length(mut self, max_comment_length: i32) -> Self {
5757 self.max_comment_length = Some(max_comment_length);
5758 self
5759 }
5760 #[doc = "The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100."]
5761 pub fn skip(mut self, skip: i32) -> Self {
5762 self.skip = Some(skip);
5763 self
5764 }
5765 #[doc = "The number of pull requests to retrieve."]
5766 pub fn top(mut self, top: i32) -> Self {
5767 self.top = Some(top);
5768 self
5769 }
5770 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5771 #[doc = ""]
5772 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5773 #[doc = "However, this function can provide more flexibility when required."]
5774 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5775 Box::pin({
5776 let this = self.clone();
5777 async move {
5778 let url = this.url()?;
5779 let mut req =
5780 azure_core::http::Request::new(url, azure_core::http::Method::Get);
5781 if let Some(auth_header) = this
5782 .client
5783 .token_credential()
5784 .http_authorization_header(&this.client.scopes())
5785 .await?
5786 {
5787 req.insert_header(
5788 azure_core::http::headers::AUTHORIZATION,
5789 auth_header,
5790 );
5791 }
5792 if let Some(search_criteria_creator_id) = &this.search_criteria_creator_id {
5793 req.url_mut().query_pairs_mut().append_pair(
5794 "searchCriteria.creatorId",
5795 search_criteria_creator_id,
5796 );
5797 }
5798 if let Some(search_criteria_include_links) =
5799 &this.search_criteria_include_links
5800 {
5801 req.url_mut().query_pairs_mut().append_pair(
5802 "searchCriteria.includeLinks",
5803 &search_criteria_include_links.to_string(),
5804 );
5805 }
5806 if let Some(search_criteria_max_time) = &this.search_criteria_max_time {
5807 req.url_mut().query_pairs_mut().append_pair(
5808 "searchCriteria.maxTime",
5809 &search_criteria_max_time.to_string(),
5810 );
5811 }
5812 if let Some(search_criteria_min_time) = &this.search_criteria_min_time {
5813 req.url_mut().query_pairs_mut().append_pair(
5814 "searchCriteria.minTime",
5815 &search_criteria_min_time.to_string(),
5816 );
5817 }
5818 if let Some(search_criteria_query_time_range_type) =
5819 &this.search_criteria_query_time_range_type
5820 {
5821 req.url_mut().query_pairs_mut().append_pair(
5822 "searchCriteria.queryTimeRangeType",
5823 search_criteria_query_time_range_type,
5824 );
5825 }
5826 if let Some(search_criteria_repository_id) =
5827 &this.search_criteria_repository_id
5828 {
5829 req.url_mut().query_pairs_mut().append_pair(
5830 "searchCriteria.repositoryId",
5831 search_criteria_repository_id,
5832 );
5833 }
5834 if let Some(search_criteria_reviewer_id) = &this.search_criteria_reviewer_id
5835 {
5836 req.url_mut().query_pairs_mut().append_pair(
5837 "searchCriteria.reviewerId",
5838 search_criteria_reviewer_id,
5839 );
5840 }
5841 if let Some(search_criteria_source_ref_name) =
5842 &this.search_criteria_source_ref_name
5843 {
5844 req.url_mut().query_pairs_mut().append_pair(
5845 "searchCriteria.sourceRefName",
5846 search_criteria_source_ref_name,
5847 );
5848 }
5849 if let Some(search_criteria_source_repository_id) =
5850 &this.search_criteria_source_repository_id
5851 {
5852 req.url_mut().query_pairs_mut().append_pair(
5853 "searchCriteria.sourceRepositoryId",
5854 search_criteria_source_repository_id,
5855 );
5856 }
5857 if let Some(search_criteria_status) = &this.search_criteria_status {
5858 req.url_mut()
5859 .query_pairs_mut()
5860 .append_pair("searchCriteria.status", search_criteria_status);
5861 }
5862 if let Some(search_criteria_target_ref_name) =
5863 &this.search_criteria_target_ref_name
5864 {
5865 req.url_mut().query_pairs_mut().append_pair(
5866 "searchCriteria.targetRefName",
5867 search_criteria_target_ref_name,
5868 );
5869 }
5870 if let Some(max_comment_length) = &this.max_comment_length {
5871 req.url_mut()
5872 .query_pairs_mut()
5873 .append_pair("maxCommentLength", &max_comment_length.to_string());
5874 }
5875 if let Some(skip) = &this.skip {
5876 req.url_mut()
5877 .query_pairs_mut()
5878 .append_pair("$skip", &skip.to_string());
5879 }
5880 if let Some(top) = &this.top {
5881 req.url_mut()
5882 .query_pairs_mut()
5883 .append_pair("$top", &top.to_string());
5884 }
5885 let req_body = azure_core::Bytes::new();
5886 req.set_body(req_body);
5887 Ok(Response(this.client.send(&mut req).await?))
5888 }
5889 })
5890 }
5891 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
5892 let mut url = azure_core::http::Url::parse(&format!(
5893 "{}/{}/{}/_apis/git/repositories/{}/pullrequests",
5894 self.client.endpoint(),
5895 &self.organization,
5896 &self.project,
5897 &self.repository_id
5898 ))?;
5899 let has_api_version_already = url
5900 .query_pairs()
5901 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
5902 if !has_api_version_already {
5903 url.query_pairs_mut().append_pair(
5904 azure_core::http::headers::query_param::API_VERSION,
5905 "7.1-preview",
5906 );
5907 }
5908 Ok(url)
5909 }
5910 }
5911 impl std::future::IntoFuture for RequestBuilder {
5912 type Output = azure_core::Result<models::GitPullRequestList>;
5913 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequestList>>;
5914 #[doc = "Returns a future that sends the request and returns the parsed response body."]
5915 #[doc = ""]
5916 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
5917 #[doc = ""]
5918 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
5919 fn into_future(self) -> Self::IntoFuture {
5920 Box::pin(async move { self.send().await?.into_raw_body().await })
5921 }
5922 }
5923 }
5924 pub mod create {
5925 use super::models;
5926 #[cfg(not(target_arch = "wasm32"))]
5927 use futures::future::BoxFuture;
5928 #[cfg(target_arch = "wasm32")]
5929 use futures::future::LocalBoxFuture as BoxFuture;
5930 #[derive(Debug)]
5931 pub struct Response(azure_core::http::Response);
5932 impl Response {
5933 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequest> {
5934 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
5935 let body: models::GitPullRequest = serde_json::from_slice(&bytes).map_err(|e| {
5936 azure_core::error::Error::full(
5937 azure_core::error::ErrorKind::DataConversion,
5938 e,
5939 format!(
5940 "Failed to deserialize response:\n{}",
5941 String::from_utf8_lossy(&bytes)
5942 ),
5943 )
5944 })?;
5945 Ok(body)
5946 }
5947 pub fn into_raw_response(self) -> azure_core::http::Response {
5948 self.0
5949 }
5950 pub fn as_raw_response(&self) -> &azure_core::http::Response {
5951 &self.0
5952 }
5953 }
5954 impl From<Response> for azure_core::http::Response {
5955 fn from(rsp: Response) -> Self {
5956 rsp.into_raw_response()
5957 }
5958 }
5959 impl AsRef<azure_core::http::Response> for Response {
5960 fn as_ref(&self) -> &azure_core::http::Response {
5961 self.as_raw_response()
5962 }
5963 }
5964 #[derive(Clone)]
5965 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
5966 #[doc = r""]
5967 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
5968 #[doc = r" parameters can be chained."]
5969 #[doc = r""]
5970 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
5971 #[doc = r" converts the [`RequestBuilder`] into a future,"]
5972 #[doc = r" executes the request and returns a `Result` with the parsed"]
5973 #[doc = r" response."]
5974 #[doc = r""]
5975 #[doc = r" If you need lower-level access to the raw response details"]
5976 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
5977 #[doc = r" can finalize the request using the"]
5978 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
5979 #[doc = r" that resolves to a lower-level [`Response`] value."]
5980 pub struct RequestBuilder {
5981 pub(crate) client: super::super::Client,
5982 pub(crate) organization: String,
5983 pub(crate) repository_id: String,
5984 pub(crate) project: String,
5985 pub(crate) create_options: models::GitPullRequestCreateOptions,
5986 pub(crate) supports_iterations: Option<bool>,
5987 }
5988 impl RequestBuilder {
5989 #[doc = "If true, subsequent pushes to the pull request will be individually reviewable. Set this to false for large pull requests for performance reasons if this functionality is not needed."]
5990 pub fn supports_iterations(mut self, supports_iterations: bool) -> Self {
5991 self.supports_iterations = Some(supports_iterations);
5992 self
5993 }
5994 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
5995 #[doc = ""]
5996 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
5997 #[doc = "However, this function can provide more flexibility when required."]
5998 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
5999 Box::pin({
6000 let this = self.clone();
6001 async move {
6002 let url = this.url()?;
6003 let mut req =
6004 azure_core::http::Request::new(url, azure_core::http::Method::Post);
6005 if let Some(auth_header) = this
6006 .client
6007 .token_credential()
6008 .http_authorization_header(&this.client.scopes())
6009 .await?
6010 {
6011 req.insert_header(
6012 azure_core::http::headers::AUTHORIZATION,
6013 auth_header,
6014 );
6015 }
6016 req.insert_header("content-type", "application/json");
6017 let req_body = azure_core::json::to_json(&this.create_options)?;
6018 if let Some(supports_iterations) = &this.supports_iterations {
6019 req.url_mut().query_pairs_mut().append_pair(
6020 "supportsIterations",
6021 &supports_iterations.to_string(),
6022 );
6023 }
6024 req.set_body(req_body);
6025 Ok(Response(this.client.send(&mut req).await?))
6026 }
6027 })
6028 }
6029 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
6030 let mut url = azure_core::http::Url::parse(&format!(
6031 "{}/{}/{}/_apis/git/repositories/{}/pullrequests",
6032 self.client.endpoint(),
6033 &self.organization,
6034 &self.project,
6035 &self.repository_id
6036 ))?;
6037 let has_api_version_already = url
6038 .query_pairs()
6039 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
6040 if !has_api_version_already {
6041 url.query_pairs_mut().append_pair(
6042 azure_core::http::headers::query_param::API_VERSION,
6043 "7.1-preview",
6044 );
6045 }
6046 Ok(url)
6047 }
6048 }
6049 impl std::future::IntoFuture for RequestBuilder {
6050 type Output = azure_core::Result<models::GitPullRequest>;
6051 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequest>>;
6052 #[doc = "Returns a future that sends the request and returns the parsed response body."]
6053 #[doc = ""]
6054 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
6055 #[doc = ""]
6056 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
6057 fn into_future(self) -> Self::IntoFuture {
6058 Box::pin(async move { self.send().await?.into_raw_body().await })
6059 }
6060 }
6061 }
6062 pub mod get_pull_request {
6063 use super::models;
6064 #[cfg(not(target_arch = "wasm32"))]
6065 use futures::future::BoxFuture;
6066 #[cfg(target_arch = "wasm32")]
6067 use futures::future::LocalBoxFuture as BoxFuture;
6068 #[derive(Debug)]
6069 pub struct Response(azure_core::http::Response);
6070 impl Response {
6071 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequest> {
6072 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
6073 let body: models::GitPullRequest = serde_json::from_slice(&bytes).map_err(|e| {
6074 azure_core::error::Error::full(
6075 azure_core::error::ErrorKind::DataConversion,
6076 e,
6077 format!(
6078 "Failed to deserialize response:\n{}",
6079 String::from_utf8_lossy(&bytes)
6080 ),
6081 )
6082 })?;
6083 Ok(body)
6084 }
6085 pub fn into_raw_response(self) -> azure_core::http::Response {
6086 self.0
6087 }
6088 pub fn as_raw_response(&self) -> &azure_core::http::Response {
6089 &self.0
6090 }
6091 }
6092 impl From<Response> for azure_core::http::Response {
6093 fn from(rsp: Response) -> Self {
6094 rsp.into_raw_response()
6095 }
6096 }
6097 impl AsRef<azure_core::http::Response> for Response {
6098 fn as_ref(&self) -> &azure_core::http::Response {
6099 self.as_raw_response()
6100 }
6101 }
6102 #[derive(Clone)]
6103 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6104 #[doc = r""]
6105 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6106 #[doc = r" parameters can be chained."]
6107 #[doc = r""]
6108 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6109 #[doc = r" converts the [`RequestBuilder`] into a future,"]
6110 #[doc = r" executes the request and returns a `Result` with the parsed"]
6111 #[doc = r" response."]
6112 #[doc = r""]
6113 #[doc = r" If you need lower-level access to the raw response details"]
6114 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6115 #[doc = r" can finalize the request using the"]
6116 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6117 #[doc = r" that resolves to a lower-level [`Response`] value."]
6118 pub struct RequestBuilder {
6119 pub(crate) client: super::super::Client,
6120 pub(crate) organization: String,
6121 pub(crate) repository_id: String,
6122 pub(crate) pull_request_id: i32,
6123 pub(crate) project: String,
6124 pub(crate) max_comment_length: Option<i32>,
6125 pub(crate) skip: Option<i32>,
6126 pub(crate) top: Option<i32>,
6127 pub(crate) include_commits: Option<bool>,
6128 pub(crate) include_work_item_refs: Option<bool>,
6129 }
6130 impl RequestBuilder {
6131 #[doc = "Not used."]
6132 pub fn max_comment_length(mut self, max_comment_length: i32) -> Self {
6133 self.max_comment_length = Some(max_comment_length);
6134 self
6135 }
6136 #[doc = "Not used."]
6137 pub fn skip(mut self, skip: i32) -> Self {
6138 self.skip = Some(skip);
6139 self
6140 }
6141 #[doc = "Not used."]
6142 pub fn top(mut self, top: i32) -> Self {
6143 self.top = Some(top);
6144 self
6145 }
6146 #[doc = "If true, the pull request will be returned with the associated commits."]
6147 pub fn include_commits(mut self, include_commits: bool) -> Self {
6148 self.include_commits = Some(include_commits);
6149 self
6150 }
6151 #[doc = "If true, the pull request will be returned with the associated work item references."]
6152 pub fn include_work_item_refs(mut self, include_work_item_refs: bool) -> Self {
6153 self.include_work_item_refs = Some(include_work_item_refs);
6154 self
6155 }
6156 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6157 #[doc = ""]
6158 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6159 #[doc = "However, this function can provide more flexibility when required."]
6160 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6161 Box::pin({
6162 let this = self.clone();
6163 async move {
6164 let url = this.url()?;
6165 let mut req =
6166 azure_core::http::Request::new(url, azure_core::http::Method::Get);
6167 if let Some(auth_header) = this
6168 .client
6169 .token_credential()
6170 .http_authorization_header(&this.client.scopes())
6171 .await?
6172 {
6173 req.insert_header(
6174 azure_core::http::headers::AUTHORIZATION,
6175 auth_header,
6176 );
6177 }
6178 if let Some(max_comment_length) = &this.max_comment_length {
6179 req.url_mut()
6180 .query_pairs_mut()
6181 .append_pair("maxCommentLength", &max_comment_length.to_string());
6182 }
6183 if let Some(skip) = &this.skip {
6184 req.url_mut()
6185 .query_pairs_mut()
6186 .append_pair("$skip", &skip.to_string());
6187 }
6188 if let Some(top) = &this.top {
6189 req.url_mut()
6190 .query_pairs_mut()
6191 .append_pair("$top", &top.to_string());
6192 }
6193 if let Some(include_commits) = &this.include_commits {
6194 req.url_mut()
6195 .query_pairs_mut()
6196 .append_pair("includeCommits", &include_commits.to_string());
6197 }
6198 if let Some(include_work_item_refs) = &this.include_work_item_refs {
6199 req.url_mut().query_pairs_mut().append_pair(
6200 "includeWorkItemRefs",
6201 &include_work_item_refs.to_string(),
6202 );
6203 }
6204 let req_body = azure_core::Bytes::new();
6205 req.set_body(req_body);
6206 Ok(Response(this.client.send(&mut req).await?))
6207 }
6208 })
6209 }
6210 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
6211 let mut url = azure_core::http::Url::parse(&format!(
6212 "{}/{}/{}/_apis/git/repositories/{}/pullrequests/{}",
6213 self.client.endpoint(),
6214 &self.organization,
6215 &self.project,
6216 &self.repository_id,
6217 &self.pull_request_id
6218 ))?;
6219 let has_api_version_already = url
6220 .query_pairs()
6221 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
6222 if !has_api_version_already {
6223 url.query_pairs_mut().append_pair(
6224 azure_core::http::headers::query_param::API_VERSION,
6225 "7.1-preview",
6226 );
6227 }
6228 Ok(url)
6229 }
6230 }
6231 impl std::future::IntoFuture for RequestBuilder {
6232 type Output = azure_core::Result<models::GitPullRequest>;
6233 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequest>>;
6234 #[doc = "Returns a future that sends the request and returns the parsed response body."]
6235 #[doc = ""]
6236 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
6237 #[doc = ""]
6238 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
6239 fn into_future(self) -> Self::IntoFuture {
6240 Box::pin(async move { self.send().await?.into_raw_body().await })
6241 }
6242 }
6243 }
6244 pub mod update {
6245 use super::models;
6246 #[cfg(not(target_arch = "wasm32"))]
6247 use futures::future::BoxFuture;
6248 #[cfg(target_arch = "wasm32")]
6249 use futures::future::LocalBoxFuture as BoxFuture;
6250 #[derive(Debug)]
6251 pub struct Response(azure_core::http::Response);
6252 impl Response {
6253 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequest> {
6254 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
6255 let body: models::GitPullRequest = serde_json::from_slice(&bytes).map_err(|e| {
6256 azure_core::error::Error::full(
6257 azure_core::error::ErrorKind::DataConversion,
6258 e,
6259 format!(
6260 "Failed to deserialize response:\n{}",
6261 String::from_utf8_lossy(&bytes)
6262 ),
6263 )
6264 })?;
6265 Ok(body)
6266 }
6267 pub fn into_raw_response(self) -> azure_core::http::Response {
6268 self.0
6269 }
6270 pub fn as_raw_response(&self) -> &azure_core::http::Response {
6271 &self.0
6272 }
6273 }
6274 impl From<Response> for azure_core::http::Response {
6275 fn from(rsp: Response) -> Self {
6276 rsp.into_raw_response()
6277 }
6278 }
6279 impl AsRef<azure_core::http::Response> for Response {
6280 fn as_ref(&self) -> &azure_core::http::Response {
6281 self.as_raw_response()
6282 }
6283 }
6284 #[derive(Clone)]
6285 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6286 #[doc = r""]
6287 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6288 #[doc = r" parameters can be chained."]
6289 #[doc = r""]
6290 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6291 #[doc = r" converts the [`RequestBuilder`] into a future,"]
6292 #[doc = r" executes the request and returns a `Result` with the parsed"]
6293 #[doc = r" response."]
6294 #[doc = r""]
6295 #[doc = r" If you need lower-level access to the raw response details"]
6296 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6297 #[doc = r" can finalize the request using the"]
6298 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6299 #[doc = r" that resolves to a lower-level [`Response`] value."]
6300 pub struct RequestBuilder {
6301 pub(crate) client: super::super::Client,
6302 pub(crate) organization: String,
6303 pub(crate) repository_id: String,
6304 pub(crate) project: String,
6305 pub(crate) pull_request_id: i32,
6306 pub(crate) update_options: models::GitPullRequestUpdateOptions,
6307 pub(crate) include_commits: Option<bool>,
6308 pub(crate) include_work_item_refs: Option<bool>,
6309 }
6310 impl RequestBuilder {
6311 #[doc = "If true, the pull request will be returned with the associated commits."]
6312 pub fn include_commits(mut self, include_commits: bool) -> Self {
6313 self.include_commits = Some(include_commits);
6314 self
6315 }
6316 #[doc = "If true, the pull request will be returned with the associated work item references."]
6317 pub fn include_work_item_refs(mut self, include_work_item_refs: bool) -> Self {
6318 self.include_work_item_refs = Some(include_work_item_refs);
6319 self
6320 }
6321 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6322 #[doc = ""]
6323 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6324 #[doc = "However, this function can provide more flexibility when required."]
6325 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6326 Box::pin({
6327 let this = self.clone();
6328 async move {
6329 let url = this.url()?;
6330 let mut req =
6331 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
6332 if let Some(auth_header) = this
6333 .client
6334 .token_credential()
6335 .http_authorization_header(&this.client.scopes())
6336 .await?
6337 {
6338 req.insert_header(
6339 azure_core::http::headers::AUTHORIZATION,
6340 auth_header,
6341 );
6342 }
6343 if let Some(include_commits) = &this.include_commits {
6344 req.url_mut()
6345 .query_pairs_mut()
6346 .append_pair("includeCommits", &include_commits.to_string());
6347 }
6348 req.insert_header("content-type", "application/json");
6349 let req_body = azure_core::json::to_json(&this.update_options)?;
6350 if let Some(include_work_item_refs) = &this.include_work_item_refs {
6351 req.url_mut().query_pairs_mut().append_pair(
6352 "includeWorkItemRefs",
6353 &include_work_item_refs.to_string(),
6354 );
6355 }
6356 req.set_body(req_body);
6357 Ok(Response(this.client.send(&mut req).await?))
6358 }
6359 })
6360 }
6361 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
6362 let mut url = azure_core::http::Url::parse(&format!(
6363 "{}/{}/{}/_apis/git/repositories/{}/pullrequests/{}",
6364 self.client.endpoint(),
6365 &self.organization,
6366 &self.project,
6367 &self.repository_id,
6368 &self.pull_request_id
6369 ))?;
6370 let has_api_version_already = url
6371 .query_pairs()
6372 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
6373 if !has_api_version_already {
6374 url.query_pairs_mut().append_pair(
6375 azure_core::http::headers::query_param::API_VERSION,
6376 "7.1-preview",
6377 );
6378 }
6379 Ok(url)
6380 }
6381 }
6382 impl std::future::IntoFuture for RequestBuilder {
6383 type Output = azure_core::Result<models::GitPullRequest>;
6384 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequest>>;
6385 #[doc = "Returns a future that sends the request and returns the parsed response body."]
6386 #[doc = ""]
6387 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
6388 #[doc = ""]
6389 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
6390 fn into_future(self) -> Self::IntoFuture {
6391 Box::pin(async move { self.send().await?.into_raw_body().await })
6392 }
6393 }
6394 }
6395}
6396pub mod annotated_tags {
6397 use super::models;
6398 #[cfg(not(target_arch = "wasm32"))]
6399 use futures::future::BoxFuture;
6400 #[cfg(target_arch = "wasm32")]
6401 use futures::future::LocalBoxFuture as BoxFuture;
6402 pub struct Client(pub(crate) super::Client);
6403 impl Client {
6404 #[doc = "Create an annotated tag.\n\nRepositories have both a name and an identifier. Identifiers are globally unique, but several projects\nmay contain a repository of the same name. You don't need to include the project if you specify a\nrepository by ID. However, if you specify a repository by name, you must also specify the project (by name or ID)."]
6405 #[doc = ""]
6406 #[doc = "Arguments:"]
6407 #[doc = "* `organization`: The name of the Azure DevOps organization."]
6408 #[doc = "* `body`: Object containing details of tag to be created."]
6409 #[doc = "* `project`: Project ID or project name"]
6410 #[doc = "* `repository_id`: ID or name of the repository."]
6411 pub fn create(
6412 &self,
6413 organization: impl Into<String>,
6414 body: impl Into<models::GitAnnotatedTag>,
6415 project: impl Into<String>,
6416 repository_id: impl Into<String>,
6417 ) -> create::RequestBuilder {
6418 create::RequestBuilder {
6419 client: self.0.clone(),
6420 organization: organization.into(),
6421 body: body.into(),
6422 project: project.into(),
6423 repository_id: repository_id.into(),
6424 }
6425 }
6426 #[doc = "Get an annotated tag.\n\nRepositories have both a name and an identifier. Identifiers are globally unique, but several projects\nmay contain a repository of the same name. You don't need to include the project if you specify a\nrepository by ID. However, if you specify a repository by name, you must also specify the project (by name or ID)."]
6427 #[doc = ""]
6428 #[doc = "Arguments:"]
6429 #[doc = "* `organization`: The name of the Azure DevOps organization."]
6430 #[doc = "* `project`: Project ID or project name"]
6431 #[doc = "* `repository_id`: ID or name of the repository."]
6432 #[doc = "* `object_id`: ObjectId (Sha1Id) of tag to get."]
6433 pub fn get(
6434 &self,
6435 organization: impl Into<String>,
6436 project: impl Into<String>,
6437 repository_id: impl Into<String>,
6438 object_id: impl Into<String>,
6439 ) -> get::RequestBuilder {
6440 get::RequestBuilder {
6441 client: self.0.clone(),
6442 organization: organization.into(),
6443 project: project.into(),
6444 repository_id: repository_id.into(),
6445 object_id: object_id.into(),
6446 }
6447 }
6448 }
6449 pub mod create {
6450 use super::models;
6451 #[cfg(not(target_arch = "wasm32"))]
6452 use futures::future::BoxFuture;
6453 #[cfg(target_arch = "wasm32")]
6454 use futures::future::LocalBoxFuture as BoxFuture;
6455 #[derive(Debug)]
6456 pub struct Response(azure_core::http::Response);
6457 impl Response {
6458 pub async fn into_raw_body(self) -> azure_core::Result<models::GitAnnotatedTag> {
6459 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
6460 let body: models::GitAnnotatedTag =
6461 serde_json::from_slice(&bytes).map_err(|e| {
6462 azure_core::error::Error::full(
6463 azure_core::error::ErrorKind::DataConversion,
6464 e,
6465 format!(
6466 "Failed to deserialize response:\n{}",
6467 String::from_utf8_lossy(&bytes)
6468 ),
6469 )
6470 })?;
6471 Ok(body)
6472 }
6473 pub fn into_raw_response(self) -> azure_core::http::Response {
6474 self.0
6475 }
6476 pub fn as_raw_response(&self) -> &azure_core::http::Response {
6477 &self.0
6478 }
6479 }
6480 impl From<Response> for azure_core::http::Response {
6481 fn from(rsp: Response) -> Self {
6482 rsp.into_raw_response()
6483 }
6484 }
6485 impl AsRef<azure_core::http::Response> for Response {
6486 fn as_ref(&self) -> &azure_core::http::Response {
6487 self.as_raw_response()
6488 }
6489 }
6490 #[derive(Clone)]
6491 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6492 #[doc = r""]
6493 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6494 #[doc = r" parameters can be chained."]
6495 #[doc = r""]
6496 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6497 #[doc = r" converts the [`RequestBuilder`] into a future,"]
6498 #[doc = r" executes the request and returns a `Result` with the parsed"]
6499 #[doc = r" response."]
6500 #[doc = r""]
6501 #[doc = r" If you need lower-level access to the raw response details"]
6502 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6503 #[doc = r" can finalize the request using the"]
6504 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6505 #[doc = r" that resolves to a lower-level [`Response`] value."]
6506 pub struct RequestBuilder {
6507 pub(crate) client: super::super::Client,
6508 pub(crate) organization: String,
6509 pub(crate) body: models::GitAnnotatedTag,
6510 pub(crate) project: String,
6511 pub(crate) repository_id: String,
6512 }
6513 impl RequestBuilder {
6514 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6515 #[doc = ""]
6516 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6517 #[doc = "However, this function can provide more flexibility when required."]
6518 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6519 Box::pin({
6520 let this = self.clone();
6521 async move {
6522 let url = this.url()?;
6523 let mut req =
6524 azure_core::http::Request::new(url, azure_core::http::Method::Post);
6525 if let Some(auth_header) = this
6526 .client
6527 .token_credential()
6528 .http_authorization_header(&this.client.scopes())
6529 .await?
6530 {
6531 req.insert_header(
6532 azure_core::http::headers::AUTHORIZATION,
6533 auth_header,
6534 );
6535 }
6536 req.insert_header("content-type", "application/json");
6537 let req_body = azure_core::json::to_json(&this.body)?;
6538 req.set_body(req_body);
6539 Ok(Response(this.client.send(&mut req).await?))
6540 }
6541 })
6542 }
6543 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
6544 let mut url = azure_core::http::Url::parse(&format!(
6545 "{}/{}/{}/_apis/git/repositories/{}/annotatedtags",
6546 self.client.endpoint(),
6547 &self.organization,
6548 &self.project,
6549 &self.repository_id
6550 ))?;
6551 let has_api_version_already = url
6552 .query_pairs()
6553 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
6554 if !has_api_version_already {
6555 url.query_pairs_mut().append_pair(
6556 azure_core::http::headers::query_param::API_VERSION,
6557 "7.1-preview",
6558 );
6559 }
6560 Ok(url)
6561 }
6562 }
6563 impl std::future::IntoFuture for RequestBuilder {
6564 type Output = azure_core::Result<models::GitAnnotatedTag>;
6565 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitAnnotatedTag>>;
6566 #[doc = "Returns a future that sends the request and returns the parsed response body."]
6567 #[doc = ""]
6568 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
6569 #[doc = ""]
6570 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
6571 fn into_future(self) -> Self::IntoFuture {
6572 Box::pin(async move { self.send().await?.into_raw_body().await })
6573 }
6574 }
6575 }
6576 pub mod get {
6577 use super::models;
6578 #[cfg(not(target_arch = "wasm32"))]
6579 use futures::future::BoxFuture;
6580 #[cfg(target_arch = "wasm32")]
6581 use futures::future::LocalBoxFuture as BoxFuture;
6582 #[derive(Debug)]
6583 pub struct Response(azure_core::http::Response);
6584 impl Response {
6585 pub async fn into_raw_body(self) -> azure_core::Result<models::GitAnnotatedTag> {
6586 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
6587 let body: models::GitAnnotatedTag =
6588 serde_json::from_slice(&bytes).map_err(|e| {
6589 azure_core::error::Error::full(
6590 azure_core::error::ErrorKind::DataConversion,
6591 e,
6592 format!(
6593 "Failed to deserialize response:\n{}",
6594 String::from_utf8_lossy(&bytes)
6595 ),
6596 )
6597 })?;
6598 Ok(body)
6599 }
6600 pub fn into_raw_response(self) -> azure_core::http::Response {
6601 self.0
6602 }
6603 pub fn as_raw_response(&self) -> &azure_core::http::Response {
6604 &self.0
6605 }
6606 }
6607 impl From<Response> for azure_core::http::Response {
6608 fn from(rsp: Response) -> Self {
6609 rsp.into_raw_response()
6610 }
6611 }
6612 impl AsRef<azure_core::http::Response> for Response {
6613 fn as_ref(&self) -> &azure_core::http::Response {
6614 self.as_raw_response()
6615 }
6616 }
6617 #[derive(Clone)]
6618 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6619 #[doc = r""]
6620 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6621 #[doc = r" parameters can be chained."]
6622 #[doc = r""]
6623 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6624 #[doc = r" converts the [`RequestBuilder`] into a future,"]
6625 #[doc = r" executes the request and returns a `Result` with the parsed"]
6626 #[doc = r" response."]
6627 #[doc = r""]
6628 #[doc = r" If you need lower-level access to the raw response details"]
6629 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6630 #[doc = r" can finalize the request using the"]
6631 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6632 #[doc = r" that resolves to a lower-level [`Response`] value."]
6633 pub struct RequestBuilder {
6634 pub(crate) client: super::super::Client,
6635 pub(crate) organization: String,
6636 pub(crate) project: String,
6637 pub(crate) repository_id: String,
6638 pub(crate) object_id: String,
6639 }
6640 impl RequestBuilder {
6641 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6642 #[doc = ""]
6643 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6644 #[doc = "However, this function can provide more flexibility when required."]
6645 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6646 Box::pin({
6647 let this = self.clone();
6648 async move {
6649 let url = this.url()?;
6650 let mut req =
6651 azure_core::http::Request::new(url, azure_core::http::Method::Get);
6652 if let Some(auth_header) = this
6653 .client
6654 .token_credential()
6655 .http_authorization_header(&this.client.scopes())
6656 .await?
6657 {
6658 req.insert_header(
6659 azure_core::http::headers::AUTHORIZATION,
6660 auth_header,
6661 );
6662 }
6663 let req_body = azure_core::Bytes::new();
6664 req.set_body(req_body);
6665 Ok(Response(this.client.send(&mut req).await?))
6666 }
6667 })
6668 }
6669 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
6670 let mut url = azure_core::http::Url::parse(&format!(
6671 "{}/{}/{}/_apis/git/repositories/{}/annotatedtags/{}",
6672 self.client.endpoint(),
6673 &self.organization,
6674 &self.project,
6675 &self.repository_id,
6676 &self.object_id
6677 ))?;
6678 let has_api_version_already = url
6679 .query_pairs()
6680 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
6681 if !has_api_version_already {
6682 url.query_pairs_mut().append_pair(
6683 azure_core::http::headers::query_param::API_VERSION,
6684 "7.1-preview",
6685 );
6686 }
6687 Ok(url)
6688 }
6689 }
6690 impl std::future::IntoFuture for RequestBuilder {
6691 type Output = azure_core::Result<models::GitAnnotatedTag>;
6692 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitAnnotatedTag>>;
6693 #[doc = "Returns a future that sends the request and returns the parsed response body."]
6694 #[doc = ""]
6695 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
6696 #[doc = ""]
6697 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
6698 fn into_future(self) -> Self::IntoFuture {
6699 Box::pin(async move { self.send().await?.into_raw_body().await })
6700 }
6701 }
6702 }
6703}
6704pub mod blobs {
6705 use super::models;
6706 #[cfg(not(target_arch = "wasm32"))]
6707 use futures::future::BoxFuture;
6708 #[cfg(target_arch = "wasm32")]
6709 use futures::future::LocalBoxFuture as BoxFuture;
6710 pub struct Client(pub(crate) super::Client);
6711 impl Client {
6712 #[doc = "Gets one or more blobs in a zip file download."]
6713 #[doc = ""]
6714 #[doc = "Arguments:"]
6715 #[doc = "* `organization`: The name of the Azure DevOps organization."]
6716 #[doc = "* `body`: Blob IDs (SHA1 hashes) to be returned in the zip file."]
6717 #[doc = "* `repository_id`: The name or ID of the repository."]
6718 #[doc = "* `project`: Project ID or project name"]
6719 pub fn get_blobs_zip(
6720 &self,
6721 organization: impl Into<String>,
6722 body: Vec<String>,
6723 repository_id: impl Into<String>,
6724 project: impl Into<String>,
6725 ) -> get_blobs_zip::RequestBuilder {
6726 get_blobs_zip::RequestBuilder {
6727 client: self.0.clone(),
6728 organization: organization.into(),
6729 body,
6730 repository_id: repository_id.into(),
6731 project: project.into(),
6732 filename: None,
6733 }
6734 }
6735 #[doc = "Get a single blob.\n\nRepositories have both a name and an identifier. Identifiers are globally unique,\nbut several projects may contain a repository of the same name. You don't need to include\nthe project if you specify a repository by ID. However, if you specify a repository by name,\nyou must also specify the project (by name or ID)."]
6736 #[doc = ""]
6737 #[doc = "Arguments:"]
6738 #[doc = "* `organization`: The name of the Azure DevOps organization."]
6739 #[doc = "* `repository_id`: The name or ID of the repository."]
6740 #[doc = "* `sha1`: SHA1 hash of the file. You can get the SHA1 of a file using the \"Git/Items/Get Item\" endpoint."]
6741 #[doc = "* `project`: Project ID or project name"]
6742 pub fn get_blob(
6743 &self,
6744 organization: impl Into<String>,
6745 repository_id: impl Into<String>,
6746 sha1: impl Into<String>,
6747 project: impl Into<String>,
6748 ) -> get_blob::RequestBuilder {
6749 get_blob::RequestBuilder {
6750 client: self.0.clone(),
6751 organization: organization.into(),
6752 repository_id: repository_id.into(),
6753 sha1: sha1.into(),
6754 project: project.into(),
6755 download: None,
6756 file_name: None,
6757 format: None,
6758 resolve_lfs: None,
6759 }
6760 }
6761 }
6762 pub mod get_blobs_zip {
6763 use super::models;
6764 #[cfg(not(target_arch = "wasm32"))]
6765 use futures::future::BoxFuture;
6766 #[cfg(target_arch = "wasm32")]
6767 use futures::future::LocalBoxFuture as BoxFuture;
6768 #[derive(Debug)]
6769 pub struct Response(azure_core::http::Response);
6770 impl Response {
6771 pub async fn into_raw_body(self) -> azure_core::Result<String> {
6772 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
6773 let body: String = serde_json::from_slice(&bytes).map_err(|e| {
6774 azure_core::error::Error::full(
6775 azure_core::error::ErrorKind::DataConversion,
6776 e,
6777 format!(
6778 "Failed to deserialize response:\n{}",
6779 String::from_utf8_lossy(&bytes)
6780 ),
6781 )
6782 })?;
6783 Ok(body)
6784 }
6785 pub fn into_raw_response(self) -> azure_core::http::Response {
6786 self.0
6787 }
6788 pub fn as_raw_response(&self) -> &azure_core::http::Response {
6789 &self.0
6790 }
6791 }
6792 impl From<Response> for azure_core::http::Response {
6793 fn from(rsp: Response) -> Self {
6794 rsp.into_raw_response()
6795 }
6796 }
6797 impl AsRef<azure_core::http::Response> for Response {
6798 fn as_ref(&self) -> &azure_core::http::Response {
6799 self.as_raw_response()
6800 }
6801 }
6802 #[derive(Clone)]
6803 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6804 #[doc = r""]
6805 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6806 #[doc = r" parameters can be chained."]
6807 #[doc = r""]
6808 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6809 #[doc = r" converts the [`RequestBuilder`] into a future,"]
6810 #[doc = r" executes the request and returns a `Result` with the parsed"]
6811 #[doc = r" response."]
6812 #[doc = r""]
6813 #[doc = r" If you need lower-level access to the raw response details"]
6814 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6815 #[doc = r" can finalize the request using the"]
6816 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6817 #[doc = r" that resolves to a lower-level [`Response`] value."]
6818 pub struct RequestBuilder {
6819 pub(crate) client: super::super::Client,
6820 pub(crate) organization: String,
6821 pub(crate) body: Vec<String>,
6822 pub(crate) repository_id: String,
6823 pub(crate) project: String,
6824 pub(crate) filename: Option<String>,
6825 }
6826 impl RequestBuilder {
6827 pub fn filename(mut self, filename: impl Into<String>) -> Self {
6828 self.filename = Some(filename.into());
6829 self
6830 }
6831 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6832 #[doc = ""]
6833 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6834 #[doc = "However, this function can provide more flexibility when required."]
6835 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6836 Box::pin({
6837 let this = self.clone();
6838 async move {
6839 let url = this.url()?;
6840 let mut req =
6841 azure_core::http::Request::new(url, azure_core::http::Method::Post);
6842 if let Some(auth_header) = this
6843 .client
6844 .token_credential()
6845 .http_authorization_header(&this.client.scopes())
6846 .await?
6847 {
6848 req.insert_header(
6849 azure_core::http::headers::AUTHORIZATION,
6850 auth_header,
6851 );
6852 }
6853 req.insert_header("content-type", "application/json");
6854 let req_body = azure_core::json::to_json(&this.body)?;
6855 if let Some(filename) = &this.filename {
6856 req.url_mut()
6857 .query_pairs_mut()
6858 .append_pair("filename", filename);
6859 }
6860 req.set_body(req_body);
6861 Ok(Response(this.client.send(&mut req).await?))
6862 }
6863 })
6864 }
6865 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
6866 let mut url = azure_core::http::Url::parse(&format!(
6867 "{}/{}/{}/_apis/git/repositories/{}/blobs",
6868 self.client.endpoint(),
6869 &self.organization,
6870 &self.project,
6871 &self.repository_id
6872 ))?;
6873 let has_api_version_already = url
6874 .query_pairs()
6875 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
6876 if !has_api_version_already {
6877 url.query_pairs_mut().append_pair(
6878 azure_core::http::headers::query_param::API_VERSION,
6879 "7.1-preview",
6880 );
6881 }
6882 Ok(url)
6883 }
6884 }
6885 impl std::future::IntoFuture for RequestBuilder {
6886 type Output = azure_core::Result<String>;
6887 type IntoFuture = BoxFuture<'static, azure_core::Result<String>>;
6888 #[doc = "Returns a future that sends the request and returns the parsed response body."]
6889 #[doc = ""]
6890 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
6891 #[doc = ""]
6892 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
6893 fn into_future(self) -> Self::IntoFuture {
6894 Box::pin(async move { self.send().await?.into_raw_body().await })
6895 }
6896 }
6897 }
6898 pub mod get_blob {
6899 use super::models;
6900 #[cfg(not(target_arch = "wasm32"))]
6901 use futures::future::BoxFuture;
6902 #[cfg(target_arch = "wasm32")]
6903 use futures::future::LocalBoxFuture as BoxFuture;
6904 #[derive(Debug)]
6905 pub struct Response(azure_core::http::Response);
6906 impl Response {
6907 pub async fn into_raw_body(self) -> azure_core::Result<models::GitBlobRef> {
6908 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
6909 let body: models::GitBlobRef = serde_json::from_slice(&bytes).map_err(|e| {
6910 azure_core::error::Error::full(
6911 azure_core::error::ErrorKind::DataConversion,
6912 e,
6913 format!(
6914 "Failed to deserialize response:\n{}",
6915 String::from_utf8_lossy(&bytes)
6916 ),
6917 )
6918 })?;
6919 Ok(body)
6920 }
6921 pub fn into_raw_response(self) -> azure_core::http::Response {
6922 self.0
6923 }
6924 pub fn as_raw_response(&self) -> &azure_core::http::Response {
6925 &self.0
6926 }
6927 }
6928 impl From<Response> for azure_core::http::Response {
6929 fn from(rsp: Response) -> Self {
6930 rsp.into_raw_response()
6931 }
6932 }
6933 impl AsRef<azure_core::http::Response> for Response {
6934 fn as_ref(&self) -> &azure_core::http::Response {
6935 self.as_raw_response()
6936 }
6937 }
6938 #[derive(Clone)]
6939 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
6940 #[doc = r""]
6941 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
6942 #[doc = r" parameters can be chained."]
6943 #[doc = r""]
6944 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
6945 #[doc = r" converts the [`RequestBuilder`] into a future,"]
6946 #[doc = r" executes the request and returns a `Result` with the parsed"]
6947 #[doc = r" response."]
6948 #[doc = r""]
6949 #[doc = r" If you need lower-level access to the raw response details"]
6950 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
6951 #[doc = r" can finalize the request using the"]
6952 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
6953 #[doc = r" that resolves to a lower-level [`Response`] value."]
6954 pub struct RequestBuilder {
6955 pub(crate) client: super::super::Client,
6956 pub(crate) organization: String,
6957 pub(crate) repository_id: String,
6958 pub(crate) sha1: String,
6959 pub(crate) project: String,
6960 pub(crate) download: Option<bool>,
6961 pub(crate) file_name: Option<String>,
6962 pub(crate) format: Option<String>,
6963 pub(crate) resolve_lfs: Option<bool>,
6964 }
6965 impl RequestBuilder {
6966 #[doc = "If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if format is zip"]
6967 pub fn download(mut self, download: bool) -> Self {
6968 self.download = Some(download);
6969 self
6970 }
6971 #[doc = "Provide a filename to use for a download."]
6972 pub fn file_name(mut self, file_name: impl Into<String>) -> Self {
6973 self.file_name = Some(file_name.into());
6974 self
6975 }
6976 #[doc = "Options: json, zip, text, octetstream. If not set, defaults to the MIME type set in the Accept header."]
6977 pub fn format(mut self, format: impl Into<String>) -> Self {
6978 self.format = Some(format.into());
6979 self
6980 }
6981 #[doc = "If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or format types"]
6982 pub fn resolve_lfs(mut self, resolve_lfs: bool) -> Self {
6983 self.resolve_lfs = Some(resolve_lfs);
6984 self
6985 }
6986 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
6987 #[doc = ""]
6988 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
6989 #[doc = "However, this function can provide more flexibility when required."]
6990 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
6991 Box::pin({
6992 let this = self.clone();
6993 async move {
6994 let url = this.url()?;
6995 let mut req =
6996 azure_core::http::Request::new(url, azure_core::http::Method::Get);
6997 if let Some(auth_header) = this
6998 .client
6999 .token_credential()
7000 .http_authorization_header(&this.client.scopes())
7001 .await?
7002 {
7003 req.insert_header(
7004 azure_core::http::headers::AUTHORIZATION,
7005 auth_header,
7006 );
7007 }
7008 if let Some(download) = &this.download {
7009 req.url_mut()
7010 .query_pairs_mut()
7011 .append_pair("download", &download.to_string());
7012 }
7013 if let Some(file_name) = &this.file_name {
7014 req.url_mut()
7015 .query_pairs_mut()
7016 .append_pair("fileName", file_name);
7017 }
7018 if let Some(format) = &this.format {
7019 req.url_mut()
7020 .query_pairs_mut()
7021 .append_pair("$format", format);
7022 }
7023 if let Some(resolve_lfs) = &this.resolve_lfs {
7024 req.url_mut()
7025 .query_pairs_mut()
7026 .append_pair("resolveLfs", &resolve_lfs.to_string());
7027 }
7028 let req_body = azure_core::Bytes::new();
7029 req.set_body(req_body);
7030 Ok(Response(this.client.send(&mut req).await?))
7031 }
7032 })
7033 }
7034 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
7035 let mut url = azure_core::http::Url::parse(&format!(
7036 "{}/{}/{}/_apis/git/repositories/{}/blobs/{}",
7037 self.client.endpoint(),
7038 &self.organization,
7039 &self.project,
7040 &self.repository_id,
7041 &self.sha1
7042 ))?;
7043 let has_api_version_already = url
7044 .query_pairs()
7045 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
7046 if !has_api_version_already {
7047 url.query_pairs_mut().append_pair(
7048 azure_core::http::headers::query_param::API_VERSION,
7049 "7.1-preview",
7050 );
7051 }
7052 Ok(url)
7053 }
7054 }
7055 impl std::future::IntoFuture for RequestBuilder {
7056 type Output = azure_core::Result<models::GitBlobRef>;
7057 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitBlobRef>>;
7058 #[doc = "Returns a future that sends the request and returns the parsed response body."]
7059 #[doc = ""]
7060 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
7061 #[doc = ""]
7062 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
7063 fn into_future(self) -> Self::IntoFuture {
7064 Box::pin(async move { self.send().await?.into_raw_body().await })
7065 }
7066 }
7067 }
7068}
7069pub mod cherry_picks {
7070 use super::models;
7071 #[cfg(not(target_arch = "wasm32"))]
7072 use futures::future::BoxFuture;
7073 #[cfg(target_arch = "wasm32")]
7074 use futures::future::LocalBoxFuture as BoxFuture;
7075 pub struct Client(pub(crate) super::Client);
7076 impl Client {
7077 #[doc = "Retrieve information about a cherry pick operation for a specific branch. This operation is expensive due to the underlying object structure, so this API only looks at the 1000 most recent cherry pick operations."]
7078 #[doc = ""]
7079 #[doc = "Arguments:"]
7080 #[doc = "* `organization`: The name of the Azure DevOps organization."]
7081 #[doc = "* `project`: Project ID or project name"]
7082 #[doc = "* `repository_id`: ID of the repository."]
7083 #[doc = "* `ref_name`: The GitAsyncRefOperationParameters generatedRefName used for the cherry pick operation."]
7084 pub fn get_cherry_pick_for_ref_name(
7085 &self,
7086 organization: impl Into<String>,
7087 project: impl Into<String>,
7088 repository_id: impl Into<String>,
7089 ref_name: impl Into<String>,
7090 ) -> get_cherry_pick_for_ref_name::RequestBuilder {
7091 get_cherry_pick_for_ref_name::RequestBuilder {
7092 client: self.0.clone(),
7093 organization: organization.into(),
7094 project: project.into(),
7095 repository_id: repository_id.into(),
7096 ref_name: ref_name.into(),
7097 }
7098 }
7099 #[doc = "Cherry pick a specific commit or commits that are associated to a pull request into a new branch."]
7100 #[doc = ""]
7101 #[doc = "Arguments:"]
7102 #[doc = "* `organization`: The name of the Azure DevOps organization."]
7103 #[doc = "* `project`: Project ID or project name"]
7104 #[doc = "* `repository_id`: ID of the repository."]
7105 pub fn create(
7106 &self,
7107 organization: impl Into<String>,
7108 body: impl Into<models::GitAsyncRefOperationParameters>,
7109 project: impl Into<String>,
7110 repository_id: impl Into<String>,
7111 ) -> create::RequestBuilder {
7112 create::RequestBuilder {
7113 client: self.0.clone(),
7114 organization: organization.into(),
7115 body: body.into(),
7116 project: project.into(),
7117 repository_id: repository_id.into(),
7118 }
7119 }
7120 #[doc = "Retrieve information about a cherry pick operation by cherry pick Id."]
7121 #[doc = ""]
7122 #[doc = "Arguments:"]
7123 #[doc = "* `organization`: The name of the Azure DevOps organization."]
7124 #[doc = "* `project`: Project ID or project name"]
7125 #[doc = "* `cherry_pick_id`: ID of the cherry pick."]
7126 #[doc = "* `repository_id`: ID of the repository."]
7127 pub fn get_cherry_pick(
7128 &self,
7129 organization: impl Into<String>,
7130 project: impl Into<String>,
7131 cherry_pick_id: i32,
7132 repository_id: impl Into<String>,
7133 ) -> get_cherry_pick::RequestBuilder {
7134 get_cherry_pick::RequestBuilder {
7135 client: self.0.clone(),
7136 organization: organization.into(),
7137 project: project.into(),
7138 cherry_pick_id,
7139 repository_id: repository_id.into(),
7140 }
7141 }
7142 }
7143 pub mod get_cherry_pick_for_ref_name {
7144 use super::models;
7145 #[cfg(not(target_arch = "wasm32"))]
7146 use futures::future::BoxFuture;
7147 #[cfg(target_arch = "wasm32")]
7148 use futures::future::LocalBoxFuture as BoxFuture;
7149 #[derive(Debug)]
7150 pub struct Response(azure_core::http::Response);
7151 impl Response {
7152 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCherryPick> {
7153 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
7154 let body: models::GitCherryPick = serde_json::from_slice(&bytes).map_err(|e| {
7155 azure_core::error::Error::full(
7156 azure_core::error::ErrorKind::DataConversion,
7157 e,
7158 format!(
7159 "Failed to deserialize response:\n{}",
7160 String::from_utf8_lossy(&bytes)
7161 ),
7162 )
7163 })?;
7164 Ok(body)
7165 }
7166 pub fn into_raw_response(self) -> azure_core::http::Response {
7167 self.0
7168 }
7169 pub fn as_raw_response(&self) -> &azure_core::http::Response {
7170 &self.0
7171 }
7172 }
7173 impl From<Response> for azure_core::http::Response {
7174 fn from(rsp: Response) -> Self {
7175 rsp.into_raw_response()
7176 }
7177 }
7178 impl AsRef<azure_core::http::Response> for Response {
7179 fn as_ref(&self) -> &azure_core::http::Response {
7180 self.as_raw_response()
7181 }
7182 }
7183 #[derive(Clone)]
7184 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7185 #[doc = r""]
7186 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7187 #[doc = r" parameters can be chained."]
7188 #[doc = r""]
7189 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7190 #[doc = r" converts the [`RequestBuilder`] into a future,"]
7191 #[doc = r" executes the request and returns a `Result` with the parsed"]
7192 #[doc = r" response."]
7193 #[doc = r""]
7194 #[doc = r" If you need lower-level access to the raw response details"]
7195 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7196 #[doc = r" can finalize the request using the"]
7197 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7198 #[doc = r" that resolves to a lower-level [`Response`] value."]
7199 pub struct RequestBuilder {
7200 pub(crate) client: super::super::Client,
7201 pub(crate) organization: String,
7202 pub(crate) project: String,
7203 pub(crate) repository_id: String,
7204 pub(crate) ref_name: String,
7205 }
7206 impl RequestBuilder {
7207 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7208 #[doc = ""]
7209 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7210 #[doc = "However, this function can provide more flexibility when required."]
7211 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7212 Box::pin({
7213 let this = self.clone();
7214 async move {
7215 let url = this.url()?;
7216 let mut req =
7217 azure_core::http::Request::new(url, azure_core::http::Method::Get);
7218 if let Some(auth_header) = this
7219 .client
7220 .token_credential()
7221 .http_authorization_header(&this.client.scopes())
7222 .await?
7223 {
7224 req.insert_header(
7225 azure_core::http::headers::AUTHORIZATION,
7226 auth_header,
7227 );
7228 }
7229 let ref_name = &this.ref_name;
7230 req.url_mut()
7231 .query_pairs_mut()
7232 .append_pair("refName", ref_name);
7233 let req_body = azure_core::Bytes::new();
7234 req.set_body(req_body);
7235 Ok(Response(this.client.send(&mut req).await?))
7236 }
7237 })
7238 }
7239 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
7240 let mut url = azure_core::http::Url::parse(&format!(
7241 "{}/{}/{}/_apis/git/repositories/{}/cherryPicks",
7242 self.client.endpoint(),
7243 &self.organization,
7244 &self.project,
7245 &self.repository_id
7246 ))?;
7247 let has_api_version_already = url
7248 .query_pairs()
7249 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
7250 if !has_api_version_already {
7251 url.query_pairs_mut().append_pair(
7252 azure_core::http::headers::query_param::API_VERSION,
7253 "7.1-preview",
7254 );
7255 }
7256 Ok(url)
7257 }
7258 }
7259 impl std::future::IntoFuture for RequestBuilder {
7260 type Output = azure_core::Result<models::GitCherryPick>;
7261 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCherryPick>>;
7262 #[doc = "Returns a future that sends the request and returns the parsed response body."]
7263 #[doc = ""]
7264 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
7265 #[doc = ""]
7266 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
7267 fn into_future(self) -> Self::IntoFuture {
7268 Box::pin(async move { self.send().await?.into_raw_body().await })
7269 }
7270 }
7271 }
7272 pub mod create {
7273 use super::models;
7274 #[cfg(not(target_arch = "wasm32"))]
7275 use futures::future::BoxFuture;
7276 #[cfg(target_arch = "wasm32")]
7277 use futures::future::LocalBoxFuture as BoxFuture;
7278 #[derive(Debug)]
7279 pub struct Response(azure_core::http::Response);
7280 impl Response {
7281 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCherryPick> {
7282 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
7283 let body: models::GitCherryPick = serde_json::from_slice(&bytes).map_err(|e| {
7284 azure_core::error::Error::full(
7285 azure_core::error::ErrorKind::DataConversion,
7286 e,
7287 format!(
7288 "Failed to deserialize response:\n{}",
7289 String::from_utf8_lossy(&bytes)
7290 ),
7291 )
7292 })?;
7293 Ok(body)
7294 }
7295 pub fn into_raw_response(self) -> azure_core::http::Response {
7296 self.0
7297 }
7298 pub fn as_raw_response(&self) -> &azure_core::http::Response {
7299 &self.0
7300 }
7301 }
7302 impl From<Response> for azure_core::http::Response {
7303 fn from(rsp: Response) -> Self {
7304 rsp.into_raw_response()
7305 }
7306 }
7307 impl AsRef<azure_core::http::Response> for Response {
7308 fn as_ref(&self) -> &azure_core::http::Response {
7309 self.as_raw_response()
7310 }
7311 }
7312 #[derive(Clone)]
7313 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7314 #[doc = r""]
7315 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7316 #[doc = r" parameters can be chained."]
7317 #[doc = r""]
7318 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7319 #[doc = r" converts the [`RequestBuilder`] into a future,"]
7320 #[doc = r" executes the request and returns a `Result` with the parsed"]
7321 #[doc = r" response."]
7322 #[doc = r""]
7323 #[doc = r" If you need lower-level access to the raw response details"]
7324 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7325 #[doc = r" can finalize the request using the"]
7326 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7327 #[doc = r" that resolves to a lower-level [`Response`] value."]
7328 pub struct RequestBuilder {
7329 pub(crate) client: super::super::Client,
7330 pub(crate) organization: String,
7331 pub(crate) body: models::GitAsyncRefOperationParameters,
7332 pub(crate) project: String,
7333 pub(crate) repository_id: String,
7334 }
7335 impl RequestBuilder {
7336 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7337 #[doc = ""]
7338 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7339 #[doc = "However, this function can provide more flexibility when required."]
7340 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7341 Box::pin({
7342 let this = self.clone();
7343 async move {
7344 let url = this.url()?;
7345 let mut req =
7346 azure_core::http::Request::new(url, azure_core::http::Method::Post);
7347 if let Some(auth_header) = this
7348 .client
7349 .token_credential()
7350 .http_authorization_header(&this.client.scopes())
7351 .await?
7352 {
7353 req.insert_header(
7354 azure_core::http::headers::AUTHORIZATION,
7355 auth_header,
7356 );
7357 }
7358 req.insert_header("content-type", "application/json");
7359 let req_body = azure_core::json::to_json(&this.body)?;
7360 req.set_body(req_body);
7361 Ok(Response(this.client.send(&mut req).await?))
7362 }
7363 })
7364 }
7365 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
7366 let mut url = azure_core::http::Url::parse(&format!(
7367 "{}/{}/{}/_apis/git/repositories/{}/cherryPicks",
7368 self.client.endpoint(),
7369 &self.organization,
7370 &self.project,
7371 &self.repository_id
7372 ))?;
7373 let has_api_version_already = url
7374 .query_pairs()
7375 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
7376 if !has_api_version_already {
7377 url.query_pairs_mut().append_pair(
7378 azure_core::http::headers::query_param::API_VERSION,
7379 "7.1-preview",
7380 );
7381 }
7382 Ok(url)
7383 }
7384 }
7385 impl std::future::IntoFuture for RequestBuilder {
7386 type Output = azure_core::Result<models::GitCherryPick>;
7387 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCherryPick>>;
7388 #[doc = "Returns a future that sends the request and returns the parsed response body."]
7389 #[doc = ""]
7390 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
7391 #[doc = ""]
7392 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
7393 fn into_future(self) -> Self::IntoFuture {
7394 Box::pin(async move { self.send().await?.into_raw_body().await })
7395 }
7396 }
7397 }
7398 pub mod get_cherry_pick {
7399 use super::models;
7400 #[cfg(not(target_arch = "wasm32"))]
7401 use futures::future::BoxFuture;
7402 #[cfg(target_arch = "wasm32")]
7403 use futures::future::LocalBoxFuture as BoxFuture;
7404 #[derive(Debug)]
7405 pub struct Response(azure_core::http::Response);
7406 impl Response {
7407 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCherryPick> {
7408 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
7409 let body: models::GitCherryPick = serde_json::from_slice(&bytes).map_err(|e| {
7410 azure_core::error::Error::full(
7411 azure_core::error::ErrorKind::DataConversion,
7412 e,
7413 format!(
7414 "Failed to deserialize response:\n{}",
7415 String::from_utf8_lossy(&bytes)
7416 ),
7417 )
7418 })?;
7419 Ok(body)
7420 }
7421 pub fn into_raw_response(self) -> azure_core::http::Response {
7422 self.0
7423 }
7424 pub fn as_raw_response(&self) -> &azure_core::http::Response {
7425 &self.0
7426 }
7427 }
7428 impl From<Response> for azure_core::http::Response {
7429 fn from(rsp: Response) -> Self {
7430 rsp.into_raw_response()
7431 }
7432 }
7433 impl AsRef<azure_core::http::Response> for Response {
7434 fn as_ref(&self) -> &azure_core::http::Response {
7435 self.as_raw_response()
7436 }
7437 }
7438 #[derive(Clone)]
7439 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7440 #[doc = r""]
7441 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7442 #[doc = r" parameters can be chained."]
7443 #[doc = r""]
7444 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7445 #[doc = r" converts the [`RequestBuilder`] into a future,"]
7446 #[doc = r" executes the request and returns a `Result` with the parsed"]
7447 #[doc = r" response."]
7448 #[doc = r""]
7449 #[doc = r" If you need lower-level access to the raw response details"]
7450 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7451 #[doc = r" can finalize the request using the"]
7452 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7453 #[doc = r" that resolves to a lower-level [`Response`] value."]
7454 pub struct RequestBuilder {
7455 pub(crate) client: super::super::Client,
7456 pub(crate) organization: String,
7457 pub(crate) project: String,
7458 pub(crate) cherry_pick_id: i32,
7459 pub(crate) repository_id: String,
7460 }
7461 impl RequestBuilder {
7462 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7463 #[doc = ""]
7464 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7465 #[doc = "However, this function can provide more flexibility when required."]
7466 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7467 Box::pin({
7468 let this = self.clone();
7469 async move {
7470 let url = this.url()?;
7471 let mut req =
7472 azure_core::http::Request::new(url, azure_core::http::Method::Get);
7473 if let Some(auth_header) = this
7474 .client
7475 .token_credential()
7476 .http_authorization_header(&this.client.scopes())
7477 .await?
7478 {
7479 req.insert_header(
7480 azure_core::http::headers::AUTHORIZATION,
7481 auth_header,
7482 );
7483 }
7484 let req_body = azure_core::Bytes::new();
7485 req.set_body(req_body);
7486 Ok(Response(this.client.send(&mut req).await?))
7487 }
7488 })
7489 }
7490 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
7491 let mut url = azure_core::http::Url::parse(&format!(
7492 "{}/{}/{}/_apis/git/repositories/{}/cherryPicks/{}",
7493 self.client.endpoint(),
7494 &self.organization,
7495 &self.project,
7496 &self.repository_id,
7497 &self.cherry_pick_id
7498 ))?;
7499 let has_api_version_already = url
7500 .query_pairs()
7501 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
7502 if !has_api_version_already {
7503 url.query_pairs_mut().append_pair(
7504 azure_core::http::headers::query_param::API_VERSION,
7505 "7.1-preview",
7506 );
7507 }
7508 Ok(url)
7509 }
7510 }
7511 impl std::future::IntoFuture for RequestBuilder {
7512 type Output = azure_core::Result<models::GitCherryPick>;
7513 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCherryPick>>;
7514 #[doc = "Returns a future that sends the request and returns the parsed response body."]
7515 #[doc = ""]
7516 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
7517 #[doc = ""]
7518 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
7519 fn into_future(self) -> Self::IntoFuture {
7520 Box::pin(async move { self.send().await?.into_raw_body().await })
7521 }
7522 }
7523 }
7524}
7525pub mod statuses {
7526 use super::models;
7527 #[cfg(not(target_arch = "wasm32"))]
7528 use futures::future::BoxFuture;
7529 #[cfg(target_arch = "wasm32")]
7530 use futures::future::LocalBoxFuture as BoxFuture;
7531 pub struct Client(pub(crate) super::Client);
7532 impl Client {
7533 #[doc = "Get statuses associated with the Git commit."]
7534 #[doc = ""]
7535 #[doc = "Arguments:"]
7536 #[doc = "* `organization`: The name of the Azure DevOps organization."]
7537 #[doc = "* `commit_id`: ID of the Git commit."]
7538 #[doc = "* `repository_id`: ID of the repository."]
7539 #[doc = "* `project`: Project ID or project name"]
7540 pub fn list(
7541 &self,
7542 organization: impl Into<String>,
7543 commit_id: impl Into<String>,
7544 repository_id: impl Into<String>,
7545 project: impl Into<String>,
7546 ) -> list::RequestBuilder {
7547 list::RequestBuilder {
7548 client: self.0.clone(),
7549 organization: organization.into(),
7550 commit_id: commit_id.into(),
7551 repository_id: repository_id.into(),
7552 project: project.into(),
7553 top: None,
7554 skip: None,
7555 latest_only: None,
7556 }
7557 }
7558 #[doc = "Create Git commit status."]
7559 #[doc = ""]
7560 #[doc = "Arguments:"]
7561 #[doc = "* `organization`: The name of the Azure DevOps organization."]
7562 #[doc = "* `body`: Git commit status object to create."]
7563 #[doc = "* `commit_id`: ID of the Git commit."]
7564 #[doc = "* `repository_id`: ID of the repository."]
7565 #[doc = "* `project`: Project ID or project name"]
7566 pub fn create(
7567 &self,
7568 organization: impl Into<String>,
7569 body: impl Into<models::GitStatus>,
7570 commit_id: impl Into<String>,
7571 repository_id: impl Into<String>,
7572 project: impl Into<String>,
7573 ) -> create::RequestBuilder {
7574 create::RequestBuilder {
7575 client: self.0.clone(),
7576 organization: organization.into(),
7577 body: body.into(),
7578 commit_id: commit_id.into(),
7579 repository_id: repository_id.into(),
7580 project: project.into(),
7581 }
7582 }
7583 }
7584 pub mod list {
7585 use super::models;
7586 #[cfg(not(target_arch = "wasm32"))]
7587 use futures::future::BoxFuture;
7588 #[cfg(target_arch = "wasm32")]
7589 use futures::future::LocalBoxFuture as BoxFuture;
7590 #[derive(Debug)]
7591 pub struct Response(azure_core::http::Response);
7592 impl Response {
7593 pub async fn into_raw_body(self) -> azure_core::Result<models::GitStatusList> {
7594 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
7595 let body: models::GitStatusList = serde_json::from_slice(&bytes).map_err(|e| {
7596 azure_core::error::Error::full(
7597 azure_core::error::ErrorKind::DataConversion,
7598 e,
7599 format!(
7600 "Failed to deserialize response:\n{}",
7601 String::from_utf8_lossy(&bytes)
7602 ),
7603 )
7604 })?;
7605 Ok(body)
7606 }
7607 pub fn into_raw_response(self) -> azure_core::http::Response {
7608 self.0
7609 }
7610 pub fn as_raw_response(&self) -> &azure_core::http::Response {
7611 &self.0
7612 }
7613 }
7614 impl From<Response> for azure_core::http::Response {
7615 fn from(rsp: Response) -> Self {
7616 rsp.into_raw_response()
7617 }
7618 }
7619 impl AsRef<azure_core::http::Response> for Response {
7620 fn as_ref(&self) -> &azure_core::http::Response {
7621 self.as_raw_response()
7622 }
7623 }
7624 #[derive(Clone)]
7625 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7626 #[doc = r""]
7627 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7628 #[doc = r" parameters can be chained."]
7629 #[doc = r""]
7630 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7631 #[doc = r" converts the [`RequestBuilder`] into a future,"]
7632 #[doc = r" executes the request and returns a `Result` with the parsed"]
7633 #[doc = r" response."]
7634 #[doc = r""]
7635 #[doc = r" If you need lower-level access to the raw response details"]
7636 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7637 #[doc = r" can finalize the request using the"]
7638 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7639 #[doc = r" that resolves to a lower-level [`Response`] value."]
7640 pub struct RequestBuilder {
7641 pub(crate) client: super::super::Client,
7642 pub(crate) organization: String,
7643 pub(crate) commit_id: String,
7644 pub(crate) repository_id: String,
7645 pub(crate) project: String,
7646 pub(crate) top: Option<i32>,
7647 pub(crate) skip: Option<i32>,
7648 pub(crate) latest_only: Option<bool>,
7649 }
7650 impl RequestBuilder {
7651 #[doc = "Optional. The number of statuses to retrieve. Default is 1000."]
7652 pub fn top(mut self, top: i32) -> Self {
7653 self.top = Some(top);
7654 self
7655 }
7656 #[doc = "Optional. The number of statuses to ignore. Default is 0. For example, to retrieve results 101-150, set top to 50 and skip to 100."]
7657 pub fn skip(mut self, skip: i32) -> Self {
7658 self.skip = Some(skip);
7659 self
7660 }
7661 #[doc = "The flag indicates whether to get only latest statuses grouped by `Context.Name` and `Context.Genre`."]
7662 pub fn latest_only(mut self, latest_only: bool) -> Self {
7663 self.latest_only = Some(latest_only);
7664 self
7665 }
7666 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7667 #[doc = ""]
7668 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7669 #[doc = "However, this function can provide more flexibility when required."]
7670 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7671 Box::pin({
7672 let this = self.clone();
7673 async move {
7674 let url = this.url()?;
7675 let mut req =
7676 azure_core::http::Request::new(url, azure_core::http::Method::Get);
7677 if let Some(auth_header) = this
7678 .client
7679 .token_credential()
7680 .http_authorization_header(&this.client.scopes())
7681 .await?
7682 {
7683 req.insert_header(
7684 azure_core::http::headers::AUTHORIZATION,
7685 auth_header,
7686 );
7687 }
7688 if let Some(top) = &this.top {
7689 req.url_mut()
7690 .query_pairs_mut()
7691 .append_pair("top", &top.to_string());
7692 }
7693 if let Some(skip) = &this.skip {
7694 req.url_mut()
7695 .query_pairs_mut()
7696 .append_pair("skip", &skip.to_string());
7697 }
7698 if let Some(latest_only) = &this.latest_only {
7699 req.url_mut()
7700 .query_pairs_mut()
7701 .append_pair("latestOnly", &latest_only.to_string());
7702 }
7703 let req_body = azure_core::Bytes::new();
7704 req.set_body(req_body);
7705 Ok(Response(this.client.send(&mut req).await?))
7706 }
7707 })
7708 }
7709 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
7710 let mut url = azure_core::http::Url::parse(&format!(
7711 "{}/{}/{}/_apis/git/repositories/{}/commits/{}/statuses",
7712 self.client.endpoint(),
7713 &self.organization,
7714 &self.project,
7715 &self.repository_id,
7716 &self.commit_id
7717 ))?;
7718 let has_api_version_already = url
7719 .query_pairs()
7720 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
7721 if !has_api_version_already {
7722 url.query_pairs_mut().append_pair(
7723 azure_core::http::headers::query_param::API_VERSION,
7724 "7.1-preview",
7725 );
7726 }
7727 Ok(url)
7728 }
7729 }
7730 impl std::future::IntoFuture for RequestBuilder {
7731 type Output = azure_core::Result<models::GitStatusList>;
7732 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitStatusList>>;
7733 #[doc = "Returns a future that sends the request and returns the parsed response body."]
7734 #[doc = ""]
7735 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
7736 #[doc = ""]
7737 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
7738 fn into_future(self) -> Self::IntoFuture {
7739 Box::pin(async move { self.send().await?.into_raw_body().await })
7740 }
7741 }
7742 }
7743 pub mod create {
7744 use super::models;
7745 #[cfg(not(target_arch = "wasm32"))]
7746 use futures::future::BoxFuture;
7747 #[cfg(target_arch = "wasm32")]
7748 use futures::future::LocalBoxFuture as BoxFuture;
7749 #[derive(Debug)]
7750 pub struct Response(azure_core::http::Response);
7751 impl Response {
7752 pub async fn into_raw_body(self) -> azure_core::Result<models::GitStatus> {
7753 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
7754 let body: models::GitStatus = serde_json::from_slice(&bytes).map_err(|e| {
7755 azure_core::error::Error::full(
7756 azure_core::error::ErrorKind::DataConversion,
7757 e,
7758 format!(
7759 "Failed to deserialize response:\n{}",
7760 String::from_utf8_lossy(&bytes)
7761 ),
7762 )
7763 })?;
7764 Ok(body)
7765 }
7766 pub fn into_raw_response(self) -> azure_core::http::Response {
7767 self.0
7768 }
7769 pub fn as_raw_response(&self) -> &azure_core::http::Response {
7770 &self.0
7771 }
7772 }
7773 impl From<Response> for azure_core::http::Response {
7774 fn from(rsp: Response) -> Self {
7775 rsp.into_raw_response()
7776 }
7777 }
7778 impl AsRef<azure_core::http::Response> for Response {
7779 fn as_ref(&self) -> &azure_core::http::Response {
7780 self.as_raw_response()
7781 }
7782 }
7783 #[derive(Clone)]
7784 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7785 #[doc = r""]
7786 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7787 #[doc = r" parameters can be chained."]
7788 #[doc = r""]
7789 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7790 #[doc = r" converts the [`RequestBuilder`] into a future,"]
7791 #[doc = r" executes the request and returns a `Result` with the parsed"]
7792 #[doc = r" response."]
7793 #[doc = r""]
7794 #[doc = r" If you need lower-level access to the raw response details"]
7795 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7796 #[doc = r" can finalize the request using the"]
7797 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7798 #[doc = r" that resolves to a lower-level [`Response`] value."]
7799 pub struct RequestBuilder {
7800 pub(crate) client: super::super::Client,
7801 pub(crate) organization: String,
7802 pub(crate) body: models::GitStatus,
7803 pub(crate) commit_id: String,
7804 pub(crate) repository_id: String,
7805 pub(crate) project: String,
7806 }
7807 impl RequestBuilder {
7808 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
7809 #[doc = ""]
7810 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
7811 #[doc = "However, this function can provide more flexibility when required."]
7812 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
7813 Box::pin({
7814 let this = self.clone();
7815 async move {
7816 let url = this.url()?;
7817 let mut req =
7818 azure_core::http::Request::new(url, azure_core::http::Method::Post);
7819 if let Some(auth_header) = this
7820 .client
7821 .token_credential()
7822 .http_authorization_header(&this.client.scopes())
7823 .await?
7824 {
7825 req.insert_header(
7826 azure_core::http::headers::AUTHORIZATION,
7827 auth_header,
7828 );
7829 }
7830 req.insert_header("content-type", "application/json");
7831 let req_body = azure_core::json::to_json(&this.body)?;
7832 req.set_body(req_body);
7833 Ok(Response(this.client.send(&mut req).await?))
7834 }
7835 })
7836 }
7837 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
7838 let mut url = azure_core::http::Url::parse(&format!(
7839 "{}/{}/{}/_apis/git/repositories/{}/commits/{}/statuses",
7840 self.client.endpoint(),
7841 &self.organization,
7842 &self.project,
7843 &self.repository_id,
7844 &self.commit_id
7845 ))?;
7846 let has_api_version_already = url
7847 .query_pairs()
7848 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
7849 if !has_api_version_already {
7850 url.query_pairs_mut().append_pair(
7851 azure_core::http::headers::query_param::API_VERSION,
7852 "7.1-preview",
7853 );
7854 }
7855 Ok(url)
7856 }
7857 }
7858 impl std::future::IntoFuture for RequestBuilder {
7859 type Output = azure_core::Result<models::GitStatus>;
7860 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitStatus>>;
7861 #[doc = "Returns a future that sends the request and returns the parsed response body."]
7862 #[doc = ""]
7863 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
7864 #[doc = ""]
7865 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
7866 fn into_future(self) -> Self::IntoFuture {
7867 Box::pin(async move { self.send().await?.into_raw_body().await })
7868 }
7869 }
7870 }
7871}
7872pub mod diffs {
7873 use super::models;
7874 #[cfg(not(target_arch = "wasm32"))]
7875 use futures::future::BoxFuture;
7876 #[cfg(target_arch = "wasm32")]
7877 use futures::future::LocalBoxFuture as BoxFuture;
7878 pub struct Client(pub(crate) super::Client);
7879 impl Client {
7880 #[doc = "Find the closest common commit (the merge base) between base and target commits, and get the diff between either the base and target commits or common and target commits."]
7881 #[doc = ""]
7882 #[doc = "Arguments:"]
7883 #[doc = "* `organization`: The name of the Azure DevOps organization."]
7884 #[doc = "* `repository_id`: The name or ID of the repository."]
7885 #[doc = "* `project`: Project ID or project name"]
7886 pub fn get(
7887 &self,
7888 organization: impl Into<String>,
7889 repository_id: impl Into<String>,
7890 project: impl Into<String>,
7891 ) -> get::RequestBuilder {
7892 get::RequestBuilder {
7893 client: self.0.clone(),
7894 organization: organization.into(),
7895 repository_id: repository_id.into(),
7896 project: project.into(),
7897 diff_common_commit: None,
7898 top: None,
7899 skip: None,
7900 base_version: None,
7901 base_version_options: None,
7902 base_version_type: None,
7903 target_version: None,
7904 target_version_options: None,
7905 target_version_type: None,
7906 }
7907 }
7908 }
7909 pub mod get {
7910 use super::models;
7911 #[cfg(not(target_arch = "wasm32"))]
7912 use futures::future::BoxFuture;
7913 #[cfg(target_arch = "wasm32")]
7914 use futures::future::LocalBoxFuture as BoxFuture;
7915 #[derive(Debug)]
7916 pub struct Response(azure_core::http::Response);
7917 impl Response {
7918 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCommitDiffs> {
7919 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
7920 let body: models::GitCommitDiffs = serde_json::from_slice(&bytes).map_err(|e| {
7921 azure_core::error::Error::full(
7922 azure_core::error::ErrorKind::DataConversion,
7923 e,
7924 format!(
7925 "Failed to deserialize response:\n{}",
7926 String::from_utf8_lossy(&bytes)
7927 ),
7928 )
7929 })?;
7930 Ok(body)
7931 }
7932 pub fn into_raw_response(self) -> azure_core::http::Response {
7933 self.0
7934 }
7935 pub fn as_raw_response(&self) -> &azure_core::http::Response {
7936 &self.0
7937 }
7938 }
7939 impl From<Response> for azure_core::http::Response {
7940 fn from(rsp: Response) -> Self {
7941 rsp.into_raw_response()
7942 }
7943 }
7944 impl AsRef<azure_core::http::Response> for Response {
7945 fn as_ref(&self) -> &azure_core::http::Response {
7946 self.as_raw_response()
7947 }
7948 }
7949 #[derive(Clone)]
7950 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
7951 #[doc = r""]
7952 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
7953 #[doc = r" parameters can be chained."]
7954 #[doc = r""]
7955 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
7956 #[doc = r" converts the [`RequestBuilder`] into a future,"]
7957 #[doc = r" executes the request and returns a `Result` with the parsed"]
7958 #[doc = r" response."]
7959 #[doc = r""]
7960 #[doc = r" If you need lower-level access to the raw response details"]
7961 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
7962 #[doc = r" can finalize the request using the"]
7963 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
7964 #[doc = r" that resolves to a lower-level [`Response`] value."]
7965 pub struct RequestBuilder {
7966 pub(crate) client: super::super::Client,
7967 pub(crate) organization: String,
7968 pub(crate) repository_id: String,
7969 pub(crate) project: String,
7970 pub(crate) diff_common_commit: Option<bool>,
7971 pub(crate) top: Option<i32>,
7972 pub(crate) skip: Option<i32>,
7973 pub(crate) base_version: Option<String>,
7974 pub(crate) base_version_options: Option<String>,
7975 pub(crate) base_version_type: Option<String>,
7976 pub(crate) target_version: Option<String>,
7977 pub(crate) target_version_options: Option<String>,
7978 pub(crate) target_version_type: Option<String>,
7979 }
7980 impl RequestBuilder {
7981 #[doc = "If true, diff between common and target commits. If false, diff between base and target commits."]
7982 pub fn diff_common_commit(mut self, diff_common_commit: bool) -> Self {
7983 self.diff_common_commit = Some(diff_common_commit);
7984 self
7985 }
7986 #[doc = "Maximum number of changes to return. Defaults to 100."]
7987 pub fn top(mut self, top: i32) -> Self {
7988 self.top = Some(top);
7989 self
7990 }
7991 #[doc = "Number of changes to skip"]
7992 pub fn skip(mut self, skip: i32) -> Self {
7993 self.skip = Some(skip);
7994 self
7995 }
7996 #[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
7997 pub fn base_version(mut self, base_version: impl Into<String>) -> Self {
7998 self.base_version = Some(base_version.into());
7999 self
8000 }
8001 #[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
8002 pub fn base_version_options(mut self, base_version_options: impl Into<String>) -> Self {
8003 self.base_version_options = Some(base_version_options.into());
8004 self
8005 }
8006 #[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
8007 pub fn base_version_type(mut self, base_version_type: impl Into<String>) -> Self {
8008 self.base_version_type = Some(base_version_type.into());
8009 self
8010 }
8011 #[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
8012 pub fn target_version(mut self, target_version: impl Into<String>) -> Self {
8013 self.target_version = Some(target_version.into());
8014 self
8015 }
8016 #[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
8017 pub fn target_version_options(
8018 mut self,
8019 target_version_options: impl Into<String>,
8020 ) -> Self {
8021 self.target_version_options = Some(target_version_options.into());
8022 self
8023 }
8024 #[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
8025 pub fn target_version_type(mut self, target_version_type: impl Into<String>) -> Self {
8026 self.target_version_type = Some(target_version_type.into());
8027 self
8028 }
8029 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8030 #[doc = ""]
8031 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8032 #[doc = "However, this function can provide more flexibility when required."]
8033 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8034 Box::pin({
8035 let this = self.clone();
8036 async move {
8037 let url = this.url()?;
8038 let mut req =
8039 azure_core::http::Request::new(url, azure_core::http::Method::Get);
8040 if let Some(auth_header) = this
8041 .client
8042 .token_credential()
8043 .http_authorization_header(&this.client.scopes())
8044 .await?
8045 {
8046 req.insert_header(
8047 azure_core::http::headers::AUTHORIZATION,
8048 auth_header,
8049 );
8050 }
8051 if let Some(diff_common_commit) = &this.diff_common_commit {
8052 req.url_mut()
8053 .query_pairs_mut()
8054 .append_pair("diffCommonCommit", &diff_common_commit.to_string());
8055 }
8056 if let Some(top) = &this.top {
8057 req.url_mut()
8058 .query_pairs_mut()
8059 .append_pair("$top", &top.to_string());
8060 }
8061 if let Some(skip) = &this.skip {
8062 req.url_mut()
8063 .query_pairs_mut()
8064 .append_pair("$skip", &skip.to_string());
8065 }
8066 if let Some(base_version) = &this.base_version {
8067 req.url_mut()
8068 .query_pairs_mut()
8069 .append_pair("baseVersion", base_version);
8070 }
8071 if let Some(base_version_options) = &this.base_version_options {
8072 req.url_mut()
8073 .query_pairs_mut()
8074 .append_pair("baseVersionOptions", base_version_options);
8075 }
8076 if let Some(base_version_type) = &this.base_version_type {
8077 req.url_mut()
8078 .query_pairs_mut()
8079 .append_pair("baseVersionType", base_version_type);
8080 }
8081 if let Some(target_version) = &this.target_version {
8082 req.url_mut()
8083 .query_pairs_mut()
8084 .append_pair("targetVersion", target_version);
8085 }
8086 if let Some(target_version_options) = &this.target_version_options {
8087 req.url_mut()
8088 .query_pairs_mut()
8089 .append_pair("targetVersionOptions", target_version_options);
8090 }
8091 if let Some(target_version_type) = &this.target_version_type {
8092 req.url_mut()
8093 .query_pairs_mut()
8094 .append_pair("targetVersionType", target_version_type);
8095 }
8096 let req_body = azure_core::Bytes::new();
8097 req.set_body(req_body);
8098 Ok(Response(this.client.send(&mut req).await?))
8099 }
8100 })
8101 }
8102 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
8103 let mut url = azure_core::http::Url::parse(&format!(
8104 "{}/{}/{}/_apis/git/repositories/{}/diffs/commits",
8105 self.client.endpoint(),
8106 &self.organization,
8107 &self.project,
8108 &self.repository_id
8109 ))?;
8110 let has_api_version_already = url
8111 .query_pairs()
8112 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
8113 if !has_api_version_already {
8114 url.query_pairs_mut().append_pair(
8115 azure_core::http::headers::query_param::API_VERSION,
8116 "7.1-preview",
8117 );
8118 }
8119 Ok(url)
8120 }
8121 }
8122 impl std::future::IntoFuture for RequestBuilder {
8123 type Output = azure_core::Result<models::GitCommitDiffs>;
8124 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCommitDiffs>>;
8125 #[doc = "Returns a future that sends the request and returns the parsed response body."]
8126 #[doc = ""]
8127 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
8128 #[doc = ""]
8129 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
8130 fn into_future(self) -> Self::IntoFuture {
8131 Box::pin(async move { self.send().await?.into_raw_body().await })
8132 }
8133 }
8134 }
8135}
8136pub mod import_requests {
8137 use super::models;
8138 #[cfg(not(target_arch = "wasm32"))]
8139 use futures::future::BoxFuture;
8140 #[cfg(target_arch = "wasm32")]
8141 use futures::future::LocalBoxFuture as BoxFuture;
8142 pub struct Client(pub(crate) super::Client);
8143 impl Client {
8144 #[doc = "Retrieve import requests for a repository."]
8145 #[doc = ""]
8146 #[doc = "Arguments:"]
8147 #[doc = "* `organization`: The name of the Azure DevOps organization."]
8148 #[doc = "* `project`: Project ID or project name"]
8149 #[doc = "* `repository_id`: The name or ID of the repository."]
8150 pub fn query(
8151 &self,
8152 organization: impl Into<String>,
8153 project: impl Into<String>,
8154 repository_id: impl Into<String>,
8155 ) -> query::RequestBuilder {
8156 query::RequestBuilder {
8157 client: self.0.clone(),
8158 organization: organization.into(),
8159 project: project.into(),
8160 repository_id: repository_id.into(),
8161 include_abandoned: None,
8162 }
8163 }
8164 #[doc = "Create an import request."]
8165 #[doc = ""]
8166 #[doc = "Arguments:"]
8167 #[doc = "* `organization`: The name of the Azure DevOps organization."]
8168 #[doc = "* `body`: The import request to create."]
8169 #[doc = "* `project`: Project ID or project name"]
8170 #[doc = "* `repository_id`: The name or ID of the repository."]
8171 pub fn create(
8172 &self,
8173 organization: impl Into<String>,
8174 body: impl Into<models::GitImportRequest>,
8175 project: impl Into<String>,
8176 repository_id: impl Into<String>,
8177 ) -> create::RequestBuilder {
8178 create::RequestBuilder {
8179 client: self.0.clone(),
8180 organization: organization.into(),
8181 body: body.into(),
8182 project: project.into(),
8183 repository_id: repository_id.into(),
8184 }
8185 }
8186 #[doc = "Retrieve a particular import request."]
8187 #[doc = ""]
8188 #[doc = "Arguments:"]
8189 #[doc = "* `organization`: The name of the Azure DevOps organization."]
8190 #[doc = "* `project`: Project ID or project name"]
8191 #[doc = "* `repository_id`: The name or ID of the repository."]
8192 #[doc = "* `import_request_id`: The unique identifier for the import request."]
8193 pub fn get(
8194 &self,
8195 organization: impl Into<String>,
8196 project: impl Into<String>,
8197 repository_id: impl Into<String>,
8198 import_request_id: i32,
8199 ) -> get::RequestBuilder {
8200 get::RequestBuilder {
8201 client: self.0.clone(),
8202 organization: organization.into(),
8203 project: project.into(),
8204 repository_id: repository_id.into(),
8205 import_request_id,
8206 }
8207 }
8208 #[doc = "Retry or abandon a failed import request.\n\nThere can only be one active import request associated with a repository. Marking a failed import request abandoned makes it inactive."]
8209 #[doc = ""]
8210 #[doc = "Arguments:"]
8211 #[doc = "* `organization`: The name of the Azure DevOps organization."]
8212 #[doc = "* `body`: The updated version of the import request. Currently, the only change allowed is setting the Status to Queued or Abandoned."]
8213 #[doc = "* `project`: Project ID or project name"]
8214 #[doc = "* `repository_id`: The name or ID of the repository."]
8215 #[doc = "* `import_request_id`: The unique identifier for the import request to update."]
8216 pub fn update(
8217 &self,
8218 organization: impl Into<String>,
8219 body: impl Into<models::GitImportRequest>,
8220 project: impl Into<String>,
8221 repository_id: impl Into<String>,
8222 import_request_id: i32,
8223 ) -> update::RequestBuilder {
8224 update::RequestBuilder {
8225 client: self.0.clone(),
8226 organization: organization.into(),
8227 body: body.into(),
8228 project: project.into(),
8229 repository_id: repository_id.into(),
8230 import_request_id,
8231 }
8232 }
8233 }
8234 pub mod query {
8235 use super::models;
8236 #[cfg(not(target_arch = "wasm32"))]
8237 use futures::future::BoxFuture;
8238 #[cfg(target_arch = "wasm32")]
8239 use futures::future::LocalBoxFuture as BoxFuture;
8240 #[derive(Debug)]
8241 pub struct Response(azure_core::http::Response);
8242 impl Response {
8243 pub async fn into_raw_body(self) -> azure_core::Result<models::GitImportRequestList> {
8244 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
8245 let body: models::GitImportRequestList =
8246 serde_json::from_slice(&bytes).map_err(|e| {
8247 azure_core::error::Error::full(
8248 azure_core::error::ErrorKind::DataConversion,
8249 e,
8250 format!(
8251 "Failed to deserialize response:\n{}",
8252 String::from_utf8_lossy(&bytes)
8253 ),
8254 )
8255 })?;
8256 Ok(body)
8257 }
8258 pub fn into_raw_response(self) -> azure_core::http::Response {
8259 self.0
8260 }
8261 pub fn as_raw_response(&self) -> &azure_core::http::Response {
8262 &self.0
8263 }
8264 }
8265 impl From<Response> for azure_core::http::Response {
8266 fn from(rsp: Response) -> Self {
8267 rsp.into_raw_response()
8268 }
8269 }
8270 impl AsRef<azure_core::http::Response> for Response {
8271 fn as_ref(&self) -> &azure_core::http::Response {
8272 self.as_raw_response()
8273 }
8274 }
8275 #[derive(Clone)]
8276 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
8277 #[doc = r""]
8278 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
8279 #[doc = r" parameters can be chained."]
8280 #[doc = r""]
8281 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
8282 #[doc = r" converts the [`RequestBuilder`] into a future,"]
8283 #[doc = r" executes the request and returns a `Result` with the parsed"]
8284 #[doc = r" response."]
8285 #[doc = r""]
8286 #[doc = r" If you need lower-level access to the raw response details"]
8287 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
8288 #[doc = r" can finalize the request using the"]
8289 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
8290 #[doc = r" that resolves to a lower-level [`Response`] value."]
8291 pub struct RequestBuilder {
8292 pub(crate) client: super::super::Client,
8293 pub(crate) organization: String,
8294 pub(crate) project: String,
8295 pub(crate) repository_id: String,
8296 pub(crate) include_abandoned: Option<bool>,
8297 }
8298 impl RequestBuilder {
8299 #[doc = "Set to true to include abandoned import requests in the results."]
8300 pub fn include_abandoned(mut self, include_abandoned: bool) -> Self {
8301 self.include_abandoned = Some(include_abandoned);
8302 self
8303 }
8304 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8305 #[doc = ""]
8306 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8307 #[doc = "However, this function can provide more flexibility when required."]
8308 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8309 Box::pin({
8310 let this = self.clone();
8311 async move {
8312 let url = this.url()?;
8313 let mut req =
8314 azure_core::http::Request::new(url, azure_core::http::Method::Get);
8315 if let Some(auth_header) = this
8316 .client
8317 .token_credential()
8318 .http_authorization_header(&this.client.scopes())
8319 .await?
8320 {
8321 req.insert_header(
8322 azure_core::http::headers::AUTHORIZATION,
8323 auth_header,
8324 );
8325 }
8326 if let Some(include_abandoned) = &this.include_abandoned {
8327 req.url_mut()
8328 .query_pairs_mut()
8329 .append_pair("includeAbandoned", &include_abandoned.to_string());
8330 }
8331 let req_body = azure_core::Bytes::new();
8332 req.set_body(req_body);
8333 Ok(Response(this.client.send(&mut req).await?))
8334 }
8335 })
8336 }
8337 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
8338 let mut url = azure_core::http::Url::parse(&format!(
8339 "{}/{}/{}/_apis/git/repositories/{}/importRequests",
8340 self.client.endpoint(),
8341 &self.organization,
8342 &self.project,
8343 &self.repository_id
8344 ))?;
8345 let has_api_version_already = url
8346 .query_pairs()
8347 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
8348 if !has_api_version_already {
8349 url.query_pairs_mut().append_pair(
8350 azure_core::http::headers::query_param::API_VERSION,
8351 "7.1-preview",
8352 );
8353 }
8354 Ok(url)
8355 }
8356 }
8357 impl std::future::IntoFuture for RequestBuilder {
8358 type Output = azure_core::Result<models::GitImportRequestList>;
8359 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitImportRequestList>>;
8360 #[doc = "Returns a future that sends the request and returns the parsed response body."]
8361 #[doc = ""]
8362 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
8363 #[doc = ""]
8364 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
8365 fn into_future(self) -> Self::IntoFuture {
8366 Box::pin(async move { self.send().await?.into_raw_body().await })
8367 }
8368 }
8369 }
8370 pub mod create {
8371 use super::models;
8372 #[cfg(not(target_arch = "wasm32"))]
8373 use futures::future::BoxFuture;
8374 #[cfg(target_arch = "wasm32")]
8375 use futures::future::LocalBoxFuture as BoxFuture;
8376 #[derive(Debug)]
8377 pub struct Response(azure_core::http::Response);
8378 impl Response {
8379 pub async fn into_raw_body(self) -> azure_core::Result<models::GitImportRequest> {
8380 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
8381 let body: models::GitImportRequest =
8382 serde_json::from_slice(&bytes).map_err(|e| {
8383 azure_core::error::Error::full(
8384 azure_core::error::ErrorKind::DataConversion,
8385 e,
8386 format!(
8387 "Failed to deserialize response:\n{}",
8388 String::from_utf8_lossy(&bytes)
8389 ),
8390 )
8391 })?;
8392 Ok(body)
8393 }
8394 pub fn into_raw_response(self) -> azure_core::http::Response {
8395 self.0
8396 }
8397 pub fn as_raw_response(&self) -> &azure_core::http::Response {
8398 &self.0
8399 }
8400 }
8401 impl From<Response> for azure_core::http::Response {
8402 fn from(rsp: Response) -> Self {
8403 rsp.into_raw_response()
8404 }
8405 }
8406 impl AsRef<azure_core::http::Response> for Response {
8407 fn as_ref(&self) -> &azure_core::http::Response {
8408 self.as_raw_response()
8409 }
8410 }
8411 #[derive(Clone)]
8412 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
8413 #[doc = r""]
8414 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
8415 #[doc = r" parameters can be chained."]
8416 #[doc = r""]
8417 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
8418 #[doc = r" converts the [`RequestBuilder`] into a future,"]
8419 #[doc = r" executes the request and returns a `Result` with the parsed"]
8420 #[doc = r" response."]
8421 #[doc = r""]
8422 #[doc = r" If you need lower-level access to the raw response details"]
8423 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
8424 #[doc = r" can finalize the request using the"]
8425 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
8426 #[doc = r" that resolves to a lower-level [`Response`] value."]
8427 pub struct RequestBuilder {
8428 pub(crate) client: super::super::Client,
8429 pub(crate) organization: String,
8430 pub(crate) body: models::GitImportRequest,
8431 pub(crate) project: String,
8432 pub(crate) repository_id: String,
8433 }
8434 impl RequestBuilder {
8435 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8436 #[doc = ""]
8437 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8438 #[doc = "However, this function can provide more flexibility when required."]
8439 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8440 Box::pin({
8441 let this = self.clone();
8442 async move {
8443 let url = this.url()?;
8444 let mut req =
8445 azure_core::http::Request::new(url, azure_core::http::Method::Post);
8446 if let Some(auth_header) = this
8447 .client
8448 .token_credential()
8449 .http_authorization_header(&this.client.scopes())
8450 .await?
8451 {
8452 req.insert_header(
8453 azure_core::http::headers::AUTHORIZATION,
8454 auth_header,
8455 );
8456 }
8457 req.insert_header("content-type", "application/json");
8458 let req_body = azure_core::json::to_json(&this.body)?;
8459 req.set_body(req_body);
8460 Ok(Response(this.client.send(&mut req).await?))
8461 }
8462 })
8463 }
8464 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
8465 let mut url = azure_core::http::Url::parse(&format!(
8466 "{}/{}/{}/_apis/git/repositories/{}/importRequests",
8467 self.client.endpoint(),
8468 &self.organization,
8469 &self.project,
8470 &self.repository_id
8471 ))?;
8472 let has_api_version_already = url
8473 .query_pairs()
8474 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
8475 if !has_api_version_already {
8476 url.query_pairs_mut().append_pair(
8477 azure_core::http::headers::query_param::API_VERSION,
8478 "7.1-preview",
8479 );
8480 }
8481 Ok(url)
8482 }
8483 }
8484 impl std::future::IntoFuture for RequestBuilder {
8485 type Output = azure_core::Result<models::GitImportRequest>;
8486 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitImportRequest>>;
8487 #[doc = "Returns a future that sends the request and returns the parsed response body."]
8488 #[doc = ""]
8489 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
8490 #[doc = ""]
8491 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
8492 fn into_future(self) -> Self::IntoFuture {
8493 Box::pin(async move { self.send().await?.into_raw_body().await })
8494 }
8495 }
8496 }
8497 pub mod get {
8498 use super::models;
8499 #[cfg(not(target_arch = "wasm32"))]
8500 use futures::future::BoxFuture;
8501 #[cfg(target_arch = "wasm32")]
8502 use futures::future::LocalBoxFuture as BoxFuture;
8503 #[derive(Debug)]
8504 pub struct Response(azure_core::http::Response);
8505 impl Response {
8506 pub async fn into_raw_body(self) -> azure_core::Result<models::GitImportRequest> {
8507 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
8508 let body: models::GitImportRequest =
8509 serde_json::from_slice(&bytes).map_err(|e| {
8510 azure_core::error::Error::full(
8511 azure_core::error::ErrorKind::DataConversion,
8512 e,
8513 format!(
8514 "Failed to deserialize response:\n{}",
8515 String::from_utf8_lossy(&bytes)
8516 ),
8517 )
8518 })?;
8519 Ok(body)
8520 }
8521 pub fn into_raw_response(self) -> azure_core::http::Response {
8522 self.0
8523 }
8524 pub fn as_raw_response(&self) -> &azure_core::http::Response {
8525 &self.0
8526 }
8527 }
8528 impl From<Response> for azure_core::http::Response {
8529 fn from(rsp: Response) -> Self {
8530 rsp.into_raw_response()
8531 }
8532 }
8533 impl AsRef<azure_core::http::Response> for Response {
8534 fn as_ref(&self) -> &azure_core::http::Response {
8535 self.as_raw_response()
8536 }
8537 }
8538 #[derive(Clone)]
8539 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
8540 #[doc = r""]
8541 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
8542 #[doc = r" parameters can be chained."]
8543 #[doc = r""]
8544 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
8545 #[doc = r" converts the [`RequestBuilder`] into a future,"]
8546 #[doc = r" executes the request and returns a `Result` with the parsed"]
8547 #[doc = r" response."]
8548 #[doc = r""]
8549 #[doc = r" If you need lower-level access to the raw response details"]
8550 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
8551 #[doc = r" can finalize the request using the"]
8552 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
8553 #[doc = r" that resolves to a lower-level [`Response`] value."]
8554 pub struct RequestBuilder {
8555 pub(crate) client: super::super::Client,
8556 pub(crate) organization: String,
8557 pub(crate) project: String,
8558 pub(crate) repository_id: String,
8559 pub(crate) import_request_id: i32,
8560 }
8561 impl RequestBuilder {
8562 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8563 #[doc = ""]
8564 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8565 #[doc = "However, this function can provide more flexibility when required."]
8566 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8567 Box::pin({
8568 let this = self.clone();
8569 async move {
8570 let url = this.url()?;
8571 let mut req =
8572 azure_core::http::Request::new(url, azure_core::http::Method::Get);
8573 if let Some(auth_header) = this
8574 .client
8575 .token_credential()
8576 .http_authorization_header(&this.client.scopes())
8577 .await?
8578 {
8579 req.insert_header(
8580 azure_core::http::headers::AUTHORIZATION,
8581 auth_header,
8582 );
8583 }
8584 let req_body = azure_core::Bytes::new();
8585 req.set_body(req_body);
8586 Ok(Response(this.client.send(&mut req).await?))
8587 }
8588 })
8589 }
8590 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
8591 let mut url = azure_core::http::Url::parse(&format!(
8592 "{}/{}/{}/_apis/git/repositories/{}/importRequests/{}",
8593 self.client.endpoint(),
8594 &self.organization,
8595 &self.project,
8596 &self.repository_id,
8597 &self.import_request_id
8598 ))?;
8599 let has_api_version_already = url
8600 .query_pairs()
8601 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
8602 if !has_api_version_already {
8603 url.query_pairs_mut().append_pair(
8604 azure_core::http::headers::query_param::API_VERSION,
8605 "7.1-preview",
8606 );
8607 }
8608 Ok(url)
8609 }
8610 }
8611 impl std::future::IntoFuture for RequestBuilder {
8612 type Output = azure_core::Result<models::GitImportRequest>;
8613 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitImportRequest>>;
8614 #[doc = "Returns a future that sends the request and returns the parsed response body."]
8615 #[doc = ""]
8616 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
8617 #[doc = ""]
8618 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
8619 fn into_future(self) -> Self::IntoFuture {
8620 Box::pin(async move { self.send().await?.into_raw_body().await })
8621 }
8622 }
8623 }
8624 pub mod update {
8625 use super::models;
8626 #[cfg(not(target_arch = "wasm32"))]
8627 use futures::future::BoxFuture;
8628 #[cfg(target_arch = "wasm32")]
8629 use futures::future::LocalBoxFuture as BoxFuture;
8630 #[derive(Debug)]
8631 pub struct Response(azure_core::http::Response);
8632 impl Response {
8633 pub async fn into_raw_body(self) -> azure_core::Result<models::GitImportRequest> {
8634 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
8635 let body: models::GitImportRequest =
8636 serde_json::from_slice(&bytes).map_err(|e| {
8637 azure_core::error::Error::full(
8638 azure_core::error::ErrorKind::DataConversion,
8639 e,
8640 format!(
8641 "Failed to deserialize response:\n{}",
8642 String::from_utf8_lossy(&bytes)
8643 ),
8644 )
8645 })?;
8646 Ok(body)
8647 }
8648 pub fn into_raw_response(self) -> azure_core::http::Response {
8649 self.0
8650 }
8651 pub fn as_raw_response(&self) -> &azure_core::http::Response {
8652 &self.0
8653 }
8654 }
8655 impl From<Response> for azure_core::http::Response {
8656 fn from(rsp: Response) -> Self {
8657 rsp.into_raw_response()
8658 }
8659 }
8660 impl AsRef<azure_core::http::Response> for Response {
8661 fn as_ref(&self) -> &azure_core::http::Response {
8662 self.as_raw_response()
8663 }
8664 }
8665 #[derive(Clone)]
8666 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
8667 #[doc = r""]
8668 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
8669 #[doc = r" parameters can be chained."]
8670 #[doc = r""]
8671 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
8672 #[doc = r" converts the [`RequestBuilder`] into a future,"]
8673 #[doc = r" executes the request and returns a `Result` with the parsed"]
8674 #[doc = r" response."]
8675 #[doc = r""]
8676 #[doc = r" If you need lower-level access to the raw response details"]
8677 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
8678 #[doc = r" can finalize the request using the"]
8679 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
8680 #[doc = r" that resolves to a lower-level [`Response`] value."]
8681 pub struct RequestBuilder {
8682 pub(crate) client: super::super::Client,
8683 pub(crate) organization: String,
8684 pub(crate) body: models::GitImportRequest,
8685 pub(crate) project: String,
8686 pub(crate) repository_id: String,
8687 pub(crate) import_request_id: i32,
8688 }
8689 impl RequestBuilder {
8690 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8691 #[doc = ""]
8692 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8693 #[doc = "However, this function can provide more flexibility when required."]
8694 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8695 Box::pin({
8696 let this = self.clone();
8697 async move {
8698 let url = this.url()?;
8699 let mut req =
8700 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
8701 if let Some(auth_header) = this
8702 .client
8703 .token_credential()
8704 .http_authorization_header(&this.client.scopes())
8705 .await?
8706 {
8707 req.insert_header(
8708 azure_core::http::headers::AUTHORIZATION,
8709 auth_header,
8710 );
8711 }
8712 req.insert_header("content-type", "application/json");
8713 let req_body = azure_core::json::to_json(&this.body)?;
8714 req.set_body(req_body);
8715 Ok(Response(this.client.send(&mut req).await?))
8716 }
8717 })
8718 }
8719 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
8720 let mut url = azure_core::http::Url::parse(&format!(
8721 "{}/{}/{}/_apis/git/repositories/{}/importRequests/{}",
8722 self.client.endpoint(),
8723 &self.organization,
8724 &self.project,
8725 &self.repository_id,
8726 &self.import_request_id
8727 ))?;
8728 let has_api_version_already = url
8729 .query_pairs()
8730 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
8731 if !has_api_version_already {
8732 url.query_pairs_mut().append_pair(
8733 azure_core::http::headers::query_param::API_VERSION,
8734 "7.1-preview",
8735 );
8736 }
8737 Ok(url)
8738 }
8739 }
8740 impl std::future::IntoFuture for RequestBuilder {
8741 type Output = azure_core::Result<models::GitImportRequest>;
8742 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitImportRequest>>;
8743 #[doc = "Returns a future that sends the request and returns the parsed response body."]
8744 #[doc = ""]
8745 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
8746 #[doc = ""]
8747 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
8748 fn into_future(self) -> Self::IntoFuture {
8749 Box::pin(async move { self.send().await?.into_raw_body().await })
8750 }
8751 }
8752 }
8753}
8754pub mod pull_request_query {
8755 use super::models;
8756 #[cfg(not(target_arch = "wasm32"))]
8757 use futures::future::BoxFuture;
8758 #[cfg(target_arch = "wasm32")]
8759 use futures::future::LocalBoxFuture as BoxFuture;
8760 pub struct Client(pub(crate) super::Client);
8761 impl Client {
8762 #[doc = "This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests."]
8763 #[doc = ""]
8764 #[doc = "Arguments:"]
8765 #[doc = "* `organization`: The name of the Azure DevOps organization."]
8766 #[doc = "* `body`: The list of queries to perform."]
8767 #[doc = "* `repository_id`: ID of the repository."]
8768 #[doc = "* `project`: Project ID or project name"]
8769 pub fn get(
8770 &self,
8771 organization: impl Into<String>,
8772 body: impl Into<models::GitPullRequestQuery>,
8773 repository_id: impl Into<String>,
8774 project: impl Into<String>,
8775 ) -> get::RequestBuilder {
8776 get::RequestBuilder {
8777 client: self.0.clone(),
8778 organization: organization.into(),
8779 body: body.into(),
8780 repository_id: repository_id.into(),
8781 project: project.into(),
8782 }
8783 }
8784 }
8785 pub mod get {
8786 use super::models;
8787 #[cfg(not(target_arch = "wasm32"))]
8788 use futures::future::BoxFuture;
8789 #[cfg(target_arch = "wasm32")]
8790 use futures::future::LocalBoxFuture as BoxFuture;
8791 #[derive(Debug)]
8792 pub struct Response(azure_core::http::Response);
8793 impl Response {
8794 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequestQuery> {
8795 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
8796 let body: models::GitPullRequestQuery =
8797 serde_json::from_slice(&bytes).map_err(|e| {
8798 azure_core::error::Error::full(
8799 azure_core::error::ErrorKind::DataConversion,
8800 e,
8801 format!(
8802 "Failed to deserialize response:\n{}",
8803 String::from_utf8_lossy(&bytes)
8804 ),
8805 )
8806 })?;
8807 Ok(body)
8808 }
8809 pub fn into_raw_response(self) -> azure_core::http::Response {
8810 self.0
8811 }
8812 pub fn as_raw_response(&self) -> &azure_core::http::Response {
8813 &self.0
8814 }
8815 }
8816 impl From<Response> for azure_core::http::Response {
8817 fn from(rsp: Response) -> Self {
8818 rsp.into_raw_response()
8819 }
8820 }
8821 impl AsRef<azure_core::http::Response> for Response {
8822 fn as_ref(&self) -> &azure_core::http::Response {
8823 self.as_raw_response()
8824 }
8825 }
8826 #[derive(Clone)]
8827 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
8828 #[doc = r""]
8829 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
8830 #[doc = r" parameters can be chained."]
8831 #[doc = r""]
8832 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
8833 #[doc = r" converts the [`RequestBuilder`] into a future,"]
8834 #[doc = r" executes the request and returns a `Result` with the parsed"]
8835 #[doc = r" response."]
8836 #[doc = r""]
8837 #[doc = r" If you need lower-level access to the raw response details"]
8838 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
8839 #[doc = r" can finalize the request using the"]
8840 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
8841 #[doc = r" that resolves to a lower-level [`Response`] value."]
8842 pub struct RequestBuilder {
8843 pub(crate) client: super::super::Client,
8844 pub(crate) organization: String,
8845 pub(crate) body: models::GitPullRequestQuery,
8846 pub(crate) repository_id: String,
8847 pub(crate) project: String,
8848 }
8849 impl RequestBuilder {
8850 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
8851 #[doc = ""]
8852 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
8853 #[doc = "However, this function can provide more flexibility when required."]
8854 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
8855 Box::pin({
8856 let this = self.clone();
8857 async move {
8858 let url = this.url()?;
8859 let mut req =
8860 azure_core::http::Request::new(url, azure_core::http::Method::Post);
8861 if let Some(auth_header) = this
8862 .client
8863 .token_credential()
8864 .http_authorization_header(&this.client.scopes())
8865 .await?
8866 {
8867 req.insert_header(
8868 azure_core::http::headers::AUTHORIZATION,
8869 auth_header,
8870 );
8871 }
8872 req.insert_header("content-type", "application/json");
8873 let req_body = azure_core::json::to_json(&this.body)?;
8874 req.set_body(req_body);
8875 Ok(Response(this.client.send(&mut req).await?))
8876 }
8877 })
8878 }
8879 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
8880 let mut url = azure_core::http::Url::parse(&format!(
8881 "{}/{}/{}/_apis/git/repositories/{}/pullrequestquery",
8882 self.client.endpoint(),
8883 &self.organization,
8884 &self.project,
8885 &self.repository_id
8886 ))?;
8887 let has_api_version_already = url
8888 .query_pairs()
8889 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
8890 if !has_api_version_already {
8891 url.query_pairs_mut().append_pair(
8892 azure_core::http::headers::query_param::API_VERSION,
8893 "7.1-preview",
8894 );
8895 }
8896 Ok(url)
8897 }
8898 }
8899 impl std::future::IntoFuture for RequestBuilder {
8900 type Output = azure_core::Result<models::GitPullRequestQuery>;
8901 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequestQuery>>;
8902 #[doc = "Returns a future that sends the request and returns the parsed response body."]
8903 #[doc = ""]
8904 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
8905 #[doc = ""]
8906 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
8907 fn into_future(self) -> Self::IntoFuture {
8908 Box::pin(async move { self.send().await?.into_raw_body().await })
8909 }
8910 }
8911 }
8912}
8913pub mod pull_request_attachments {
8914 use super::models;
8915 #[cfg(not(target_arch = "wasm32"))]
8916 use futures::future::BoxFuture;
8917 #[cfg(target_arch = "wasm32")]
8918 use futures::future::LocalBoxFuture as BoxFuture;
8919 pub struct Client(pub(crate) super::Client);
8920 impl Client {
8921 #[doc = "Get a list of files attached to a given pull request."]
8922 #[doc = ""]
8923 #[doc = "Arguments:"]
8924 #[doc = "* `organization`: The name of the Azure DevOps organization."]
8925 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
8926 #[doc = "* `pull_request_id`: ID of the pull request."]
8927 #[doc = "* `project`: Project ID or project name"]
8928 pub fn list(
8929 &self,
8930 organization: impl Into<String>,
8931 repository_id: impl Into<String>,
8932 pull_request_id: i32,
8933 project: impl Into<String>,
8934 ) -> list::RequestBuilder {
8935 list::RequestBuilder {
8936 client: self.0.clone(),
8937 organization: organization.into(),
8938 repository_id: repository_id.into(),
8939 pull_request_id,
8940 project: project.into(),
8941 }
8942 }
8943 #[doc = "Get the file content of a pull request attachment."]
8944 #[doc = ""]
8945 #[doc = "Arguments:"]
8946 #[doc = "* `organization`: The name of the Azure DevOps organization."]
8947 #[doc = "* `file_name`: The name of the attachment."]
8948 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
8949 #[doc = "* `pull_request_id`: ID of the pull request."]
8950 #[doc = "* `project`: Project ID or project name"]
8951 pub fn get(
8952 &self,
8953 organization: impl Into<String>,
8954 file_name: impl Into<String>,
8955 repository_id: impl Into<String>,
8956 pull_request_id: i32,
8957 project: impl Into<String>,
8958 ) -> get::RequestBuilder {
8959 get::RequestBuilder {
8960 client: self.0.clone(),
8961 organization: organization.into(),
8962 file_name: file_name.into(),
8963 repository_id: repository_id.into(),
8964 pull_request_id,
8965 project: project.into(),
8966 }
8967 }
8968 #[doc = "Attach a new file to a pull request."]
8969 #[doc = ""]
8970 #[doc = "Arguments:"]
8971 #[doc = "* `organization`: The name of the Azure DevOps organization."]
8972 #[doc = "* `body`: Stream to upload"]
8973 #[doc = "* `file_name`: The name of the file."]
8974 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
8975 #[doc = "* `pull_request_id`: ID of the pull request."]
8976 #[doc = "* `project`: Project ID or project name"]
8977 pub fn create(
8978 &self,
8979 organization: impl Into<String>,
8980 body: impl Into<String>,
8981 file_name: impl Into<String>,
8982 repository_id: impl Into<String>,
8983 pull_request_id: i32,
8984 project: impl Into<String>,
8985 ) -> create::RequestBuilder {
8986 create::RequestBuilder {
8987 client: self.0.clone(),
8988 organization: organization.into(),
8989 body: body.into(),
8990 file_name: file_name.into(),
8991 repository_id: repository_id.into(),
8992 pull_request_id,
8993 project: project.into(),
8994 }
8995 }
8996 #[doc = "Delete a pull request attachment."]
8997 #[doc = ""]
8998 #[doc = "Arguments:"]
8999 #[doc = "* `organization`: The name of the Azure DevOps organization."]
9000 #[doc = "* `file_name`: The name of the attachment to delete."]
9001 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
9002 #[doc = "* `pull_request_id`: ID of the pull request."]
9003 #[doc = "* `project`: Project ID or project name"]
9004 pub fn delete(
9005 &self,
9006 organization: impl Into<String>,
9007 file_name: impl Into<String>,
9008 repository_id: impl Into<String>,
9009 pull_request_id: i32,
9010 project: impl Into<String>,
9011 ) -> delete::RequestBuilder {
9012 delete::RequestBuilder {
9013 client: self.0.clone(),
9014 organization: organization.into(),
9015 file_name: file_name.into(),
9016 repository_id: repository_id.into(),
9017 pull_request_id,
9018 project: project.into(),
9019 }
9020 }
9021 }
9022 pub mod list {
9023 use super::models;
9024 #[cfg(not(target_arch = "wasm32"))]
9025 use futures::future::BoxFuture;
9026 #[cfg(target_arch = "wasm32")]
9027 use futures::future::LocalBoxFuture as BoxFuture;
9028 #[derive(Debug)]
9029 pub struct Response(azure_core::http::Response);
9030 impl Response {
9031 pub async fn into_raw_body(self) -> azure_core::Result<models::AttachmentList> {
9032 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
9033 let body: models::AttachmentList = serde_json::from_slice(&bytes).map_err(|e| {
9034 azure_core::error::Error::full(
9035 azure_core::error::ErrorKind::DataConversion,
9036 e,
9037 format!(
9038 "Failed to deserialize response:\n{}",
9039 String::from_utf8_lossy(&bytes)
9040 ),
9041 )
9042 })?;
9043 Ok(body)
9044 }
9045 pub fn into_raw_response(self) -> azure_core::http::Response {
9046 self.0
9047 }
9048 pub fn as_raw_response(&self) -> &azure_core::http::Response {
9049 &self.0
9050 }
9051 }
9052 impl From<Response> for azure_core::http::Response {
9053 fn from(rsp: Response) -> Self {
9054 rsp.into_raw_response()
9055 }
9056 }
9057 impl AsRef<azure_core::http::Response> for Response {
9058 fn as_ref(&self) -> &azure_core::http::Response {
9059 self.as_raw_response()
9060 }
9061 }
9062 #[derive(Clone)]
9063 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9064 #[doc = r""]
9065 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9066 #[doc = r" parameters can be chained."]
9067 #[doc = r""]
9068 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9069 #[doc = r" converts the [`RequestBuilder`] into a future,"]
9070 #[doc = r" executes the request and returns a `Result` with the parsed"]
9071 #[doc = r" response."]
9072 #[doc = r""]
9073 #[doc = r" If you need lower-level access to the raw response details"]
9074 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9075 #[doc = r" can finalize the request using the"]
9076 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9077 #[doc = r" that resolves to a lower-level [`Response`] value."]
9078 pub struct RequestBuilder {
9079 pub(crate) client: super::super::Client,
9080 pub(crate) organization: String,
9081 pub(crate) repository_id: String,
9082 pub(crate) pull_request_id: i32,
9083 pub(crate) project: String,
9084 }
9085 impl RequestBuilder {
9086 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9087 #[doc = ""]
9088 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9089 #[doc = "However, this function can provide more flexibility when required."]
9090 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9091 Box::pin({
9092 let this = self.clone();
9093 async move {
9094 let url = this.url()?;
9095 let mut req =
9096 azure_core::http::Request::new(url, azure_core::http::Method::Get);
9097 if let Some(auth_header) = this
9098 .client
9099 .token_credential()
9100 .http_authorization_header(&this.client.scopes())
9101 .await?
9102 {
9103 req.insert_header(
9104 azure_core::http::headers::AUTHORIZATION,
9105 auth_header,
9106 );
9107 }
9108 let req_body = azure_core::Bytes::new();
9109 req.set_body(req_body);
9110 Ok(Response(this.client.send(&mut req).await?))
9111 }
9112 })
9113 }
9114 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
9115 let mut url = azure_core::http::Url::parse(&format!(
9116 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/attachments",
9117 self.client.endpoint(),
9118 &self.organization,
9119 &self.project,
9120 &self.repository_id,
9121 &self.pull_request_id
9122 ))?;
9123 let has_api_version_already = url
9124 .query_pairs()
9125 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
9126 if !has_api_version_already {
9127 url.query_pairs_mut().append_pair(
9128 azure_core::http::headers::query_param::API_VERSION,
9129 "7.1-preview",
9130 );
9131 }
9132 Ok(url)
9133 }
9134 }
9135 impl std::future::IntoFuture for RequestBuilder {
9136 type Output = azure_core::Result<models::AttachmentList>;
9137 type IntoFuture = BoxFuture<'static, azure_core::Result<models::AttachmentList>>;
9138 #[doc = "Returns a future that sends the request and returns the parsed response body."]
9139 #[doc = ""]
9140 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
9141 #[doc = ""]
9142 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
9143 fn into_future(self) -> Self::IntoFuture {
9144 Box::pin(async move { self.send().await?.into_raw_body().await })
9145 }
9146 }
9147 }
9148 pub mod get {
9149 use super::models;
9150 #[cfg(not(target_arch = "wasm32"))]
9151 use futures::future::BoxFuture;
9152 #[cfg(target_arch = "wasm32")]
9153 use futures::future::LocalBoxFuture as BoxFuture;
9154 #[derive(Debug)]
9155 pub struct Response(azure_core::http::Response);
9156 impl Response {
9157 pub async fn into_raw_body(self) -> azure_core::Result<String> {
9158 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
9159 let body: String = serde_json::from_slice(&bytes).map_err(|e| {
9160 azure_core::error::Error::full(
9161 azure_core::error::ErrorKind::DataConversion,
9162 e,
9163 format!(
9164 "Failed to deserialize response:\n{}",
9165 String::from_utf8_lossy(&bytes)
9166 ),
9167 )
9168 })?;
9169 Ok(body)
9170 }
9171 pub fn into_raw_response(self) -> azure_core::http::Response {
9172 self.0
9173 }
9174 pub fn as_raw_response(&self) -> &azure_core::http::Response {
9175 &self.0
9176 }
9177 }
9178 impl From<Response> for azure_core::http::Response {
9179 fn from(rsp: Response) -> Self {
9180 rsp.into_raw_response()
9181 }
9182 }
9183 impl AsRef<azure_core::http::Response> for Response {
9184 fn as_ref(&self) -> &azure_core::http::Response {
9185 self.as_raw_response()
9186 }
9187 }
9188 #[derive(Clone)]
9189 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9190 #[doc = r""]
9191 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9192 #[doc = r" parameters can be chained."]
9193 #[doc = r""]
9194 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9195 #[doc = r" converts the [`RequestBuilder`] into a future,"]
9196 #[doc = r" executes the request and returns a `Result` with the parsed"]
9197 #[doc = r" response."]
9198 #[doc = r""]
9199 #[doc = r" If you need lower-level access to the raw response details"]
9200 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9201 #[doc = r" can finalize the request using the"]
9202 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9203 #[doc = r" that resolves to a lower-level [`Response`] value."]
9204 pub struct RequestBuilder {
9205 pub(crate) client: super::super::Client,
9206 pub(crate) organization: String,
9207 pub(crate) file_name: String,
9208 pub(crate) repository_id: String,
9209 pub(crate) pull_request_id: i32,
9210 pub(crate) project: String,
9211 }
9212 impl RequestBuilder {
9213 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9214 #[doc = ""]
9215 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9216 #[doc = "However, this function can provide more flexibility when required."]
9217 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9218 Box::pin({
9219 let this = self.clone();
9220 async move {
9221 let url = this.url()?;
9222 let mut req =
9223 azure_core::http::Request::new(url, azure_core::http::Method::Get);
9224 if let Some(auth_header) = this
9225 .client
9226 .token_credential()
9227 .http_authorization_header(&this.client.scopes())
9228 .await?
9229 {
9230 req.insert_header(
9231 azure_core::http::headers::AUTHORIZATION,
9232 auth_header,
9233 );
9234 }
9235 let req_body = azure_core::Bytes::new();
9236 req.set_body(req_body);
9237 Ok(Response(this.client.send(&mut req).await?))
9238 }
9239 })
9240 }
9241 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
9242 let mut url = azure_core::http::Url::parse(&format!(
9243 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/attachments/{}",
9244 self.client.endpoint(),
9245 &self.organization,
9246 &self.project,
9247 &self.repository_id,
9248 &self.pull_request_id,
9249 &self.file_name
9250 ))?;
9251 let has_api_version_already = url
9252 .query_pairs()
9253 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
9254 if !has_api_version_already {
9255 url.query_pairs_mut().append_pair(
9256 azure_core::http::headers::query_param::API_VERSION,
9257 "7.1-preview",
9258 );
9259 }
9260 Ok(url)
9261 }
9262 }
9263 impl std::future::IntoFuture for RequestBuilder {
9264 type Output = azure_core::Result<String>;
9265 type IntoFuture = BoxFuture<'static, azure_core::Result<String>>;
9266 #[doc = "Returns a future that sends the request and returns the parsed response body."]
9267 #[doc = ""]
9268 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
9269 #[doc = ""]
9270 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
9271 fn into_future(self) -> Self::IntoFuture {
9272 Box::pin(async move { self.send().await?.into_raw_body().await })
9273 }
9274 }
9275 }
9276 pub mod create {
9277 use super::models;
9278 #[cfg(not(target_arch = "wasm32"))]
9279 use futures::future::BoxFuture;
9280 #[cfg(target_arch = "wasm32")]
9281 use futures::future::LocalBoxFuture as BoxFuture;
9282 #[derive(Debug)]
9283 pub struct Response(azure_core::http::Response);
9284 impl Response {
9285 pub async fn into_raw_body(self) -> azure_core::Result<models::Attachment> {
9286 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
9287 let body: models::Attachment = serde_json::from_slice(&bytes).map_err(|e| {
9288 azure_core::error::Error::full(
9289 azure_core::error::ErrorKind::DataConversion,
9290 e,
9291 format!(
9292 "Failed to deserialize response:\n{}",
9293 String::from_utf8_lossy(&bytes)
9294 ),
9295 )
9296 })?;
9297 Ok(body)
9298 }
9299 pub fn into_raw_response(self) -> azure_core::http::Response {
9300 self.0
9301 }
9302 pub fn as_raw_response(&self) -> &azure_core::http::Response {
9303 &self.0
9304 }
9305 }
9306 impl From<Response> for azure_core::http::Response {
9307 fn from(rsp: Response) -> Self {
9308 rsp.into_raw_response()
9309 }
9310 }
9311 impl AsRef<azure_core::http::Response> for Response {
9312 fn as_ref(&self) -> &azure_core::http::Response {
9313 self.as_raw_response()
9314 }
9315 }
9316 #[derive(Clone)]
9317 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9318 #[doc = r""]
9319 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9320 #[doc = r" parameters can be chained."]
9321 #[doc = r""]
9322 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9323 #[doc = r" converts the [`RequestBuilder`] into a future,"]
9324 #[doc = r" executes the request and returns a `Result` with the parsed"]
9325 #[doc = r" response."]
9326 #[doc = r""]
9327 #[doc = r" If you need lower-level access to the raw response details"]
9328 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9329 #[doc = r" can finalize the request using the"]
9330 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9331 #[doc = r" that resolves to a lower-level [`Response`] value."]
9332 pub struct RequestBuilder {
9333 pub(crate) client: super::super::Client,
9334 pub(crate) organization: String,
9335 pub(crate) body: String,
9336 pub(crate) file_name: String,
9337 pub(crate) repository_id: String,
9338 pub(crate) pull_request_id: i32,
9339 pub(crate) project: String,
9340 }
9341 impl RequestBuilder {
9342 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9343 #[doc = ""]
9344 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9345 #[doc = "However, this function can provide more flexibility when required."]
9346 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9347 Box::pin({
9348 let this = self.clone();
9349 async move {
9350 let url = this.url()?;
9351 let mut req =
9352 azure_core::http::Request::new(url, azure_core::http::Method::Post);
9353 if let Some(auth_header) = this
9354 .client
9355 .token_credential()
9356 .http_authorization_header(&this.client.scopes())
9357 .await?
9358 {
9359 req.insert_header(
9360 azure_core::http::headers::AUTHORIZATION,
9361 auth_header,
9362 );
9363 }
9364 req.insert_header("content-type", "application/octet-stream");
9365 let req_body = azure_core::json::to_json(&this.body)?;
9366 req.set_body(req_body);
9367 Ok(Response(this.client.send(&mut req).await?))
9368 }
9369 })
9370 }
9371 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
9372 let mut url = azure_core::http::Url::parse(&format!(
9373 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/attachments/{}",
9374 self.client.endpoint(),
9375 &self.organization,
9376 &self.project,
9377 &self.repository_id,
9378 &self.pull_request_id,
9379 &self.file_name
9380 ))?;
9381 let has_api_version_already = url
9382 .query_pairs()
9383 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
9384 if !has_api_version_already {
9385 url.query_pairs_mut().append_pair(
9386 azure_core::http::headers::query_param::API_VERSION,
9387 "7.1-preview",
9388 );
9389 }
9390 Ok(url)
9391 }
9392 }
9393 impl std::future::IntoFuture for RequestBuilder {
9394 type Output = azure_core::Result<models::Attachment>;
9395 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Attachment>>;
9396 #[doc = "Returns a future that sends the request and returns the parsed response body."]
9397 #[doc = ""]
9398 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
9399 #[doc = ""]
9400 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
9401 fn into_future(self) -> Self::IntoFuture {
9402 Box::pin(async move { self.send().await?.into_raw_body().await })
9403 }
9404 }
9405 }
9406 pub mod delete {
9407 use super::models;
9408 #[cfg(not(target_arch = "wasm32"))]
9409 use futures::future::BoxFuture;
9410 #[cfg(target_arch = "wasm32")]
9411 use futures::future::LocalBoxFuture as BoxFuture;
9412 #[derive(Debug)]
9413 pub struct Response(azure_core::http::Response);
9414 impl Response {
9415 pub fn into_raw_response(self) -> azure_core::http::Response {
9416 self.0
9417 }
9418 pub fn as_raw_response(&self) -> &azure_core::http::Response {
9419 &self.0
9420 }
9421 }
9422 impl From<Response> for azure_core::http::Response {
9423 fn from(rsp: Response) -> Self {
9424 rsp.into_raw_response()
9425 }
9426 }
9427 impl AsRef<azure_core::http::Response> for Response {
9428 fn as_ref(&self) -> &azure_core::http::Response {
9429 self.as_raw_response()
9430 }
9431 }
9432 #[derive(Clone)]
9433 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9434 #[doc = r""]
9435 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9436 #[doc = r" parameters can be chained."]
9437 #[doc = r""]
9438 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9439 #[doc = r" converts the [`RequestBuilder`] into a future,"]
9440 #[doc = r" executes the request and returns a `Result` with the parsed"]
9441 #[doc = r" response."]
9442 #[doc = r""]
9443 #[doc = r" If you need lower-level access to the raw response details"]
9444 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9445 #[doc = r" can finalize the request using the"]
9446 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9447 #[doc = r" that resolves to a lower-level [`Response`] value."]
9448 pub struct RequestBuilder {
9449 pub(crate) client: super::super::Client,
9450 pub(crate) organization: String,
9451 pub(crate) file_name: String,
9452 pub(crate) repository_id: String,
9453 pub(crate) pull_request_id: i32,
9454 pub(crate) project: String,
9455 }
9456 impl RequestBuilder {
9457 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9458 #[doc = ""]
9459 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9460 #[doc = "However, this function can provide more flexibility when required."]
9461 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9462 Box::pin({
9463 let this = self.clone();
9464 async move {
9465 let url = this.url()?;
9466 let mut req =
9467 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
9468 if let Some(auth_header) = this
9469 .client
9470 .token_credential()
9471 .http_authorization_header(&this.client.scopes())
9472 .await?
9473 {
9474 req.insert_header(
9475 azure_core::http::headers::AUTHORIZATION,
9476 auth_header,
9477 );
9478 }
9479 let req_body = azure_core::Bytes::new();
9480 req.set_body(req_body);
9481 Ok(Response(this.client.send(&mut req).await?))
9482 }
9483 })
9484 }
9485 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
9486 let mut url = azure_core::http::Url::parse(&format!(
9487 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/attachments/{}",
9488 self.client.endpoint(),
9489 &self.organization,
9490 &self.project,
9491 &self.repository_id,
9492 &self.pull_request_id,
9493 &self.file_name
9494 ))?;
9495 let has_api_version_already = url
9496 .query_pairs()
9497 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
9498 if !has_api_version_already {
9499 url.query_pairs_mut().append_pair(
9500 azure_core::http::headers::query_param::API_VERSION,
9501 "7.1-preview",
9502 );
9503 }
9504 Ok(url)
9505 }
9506 }
9507 impl std::future::IntoFuture for RequestBuilder {
9508 type Output = azure_core::Result<()>;
9509 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
9510 #[doc = "Returns a future that sends the request and waits for the response."]
9511 #[doc = ""]
9512 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
9513 #[doc = ""]
9514 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
9515 fn into_future(self) -> Self::IntoFuture {
9516 Box::pin(async move {
9517 let _rsp = self.send().await?;
9518 Ok(())
9519 })
9520 }
9521 }
9522 }
9523}
9524pub mod pull_request_commits {
9525 use super::models;
9526 #[cfg(not(target_arch = "wasm32"))]
9527 use futures::future::BoxFuture;
9528 #[cfg(target_arch = "wasm32")]
9529 use futures::future::LocalBoxFuture as BoxFuture;
9530 pub struct Client(pub(crate) super::Client);
9531 impl Client {
9532 #[doc = "Get the commits for the specified pull request."]
9533 #[doc = ""]
9534 #[doc = "Arguments:"]
9535 #[doc = "* `organization`: The name of the Azure DevOps organization."]
9536 #[doc = "* `repository_id`: ID or name of the repository."]
9537 #[doc = "* `pull_request_id`: ID of the pull request."]
9538 #[doc = "* `project`: Project ID or project name"]
9539 pub fn get_pull_request_commits(
9540 &self,
9541 organization: impl Into<String>,
9542 repository_id: impl Into<String>,
9543 pull_request_id: i32,
9544 project: impl Into<String>,
9545 ) -> get_pull_request_commits::RequestBuilder {
9546 get_pull_request_commits::RequestBuilder {
9547 client: self.0.clone(),
9548 organization: organization.into(),
9549 repository_id: repository_id.into(),
9550 pull_request_id,
9551 project: project.into(),
9552 top: None,
9553 continuation_token: None,
9554 }
9555 }
9556 #[doc = "Get the commits for the specified iteration of a pull request."]
9557 #[doc = ""]
9558 #[doc = "Arguments:"]
9559 #[doc = "* `organization`: The name of the Azure DevOps organization."]
9560 #[doc = "* `repository_id`: ID or name of the repository."]
9561 #[doc = "* `pull_request_id`: ID of the pull request."]
9562 #[doc = "* `iteration_id`: ID of the iteration from which to get the commits."]
9563 #[doc = "* `project`: Project ID or project name"]
9564 pub fn get_pull_request_iteration_commits(
9565 &self,
9566 organization: impl Into<String>,
9567 repository_id: impl Into<String>,
9568 pull_request_id: i32,
9569 iteration_id: i32,
9570 project: impl Into<String>,
9571 ) -> get_pull_request_iteration_commits::RequestBuilder {
9572 get_pull_request_iteration_commits::RequestBuilder {
9573 client: self.0.clone(),
9574 organization: organization.into(),
9575 repository_id: repository_id.into(),
9576 pull_request_id,
9577 iteration_id,
9578 project: project.into(),
9579 top: None,
9580 skip: None,
9581 }
9582 }
9583 }
9584 pub mod get_pull_request_commits {
9585 use super::models;
9586 #[cfg(not(target_arch = "wasm32"))]
9587 use futures::future::BoxFuture;
9588 #[cfg(target_arch = "wasm32")]
9589 use futures::future::LocalBoxFuture as BoxFuture;
9590 #[derive(Debug)]
9591 pub struct Response(azure_core::http::Response);
9592 impl Response {
9593 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCommitRefList> {
9594 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
9595 let body: models::GitCommitRefList =
9596 serde_json::from_slice(&bytes).map_err(|e| {
9597 azure_core::error::Error::full(
9598 azure_core::error::ErrorKind::DataConversion,
9599 e,
9600 format!(
9601 "Failed to deserialize response:\n{}",
9602 String::from_utf8_lossy(&bytes)
9603 ),
9604 )
9605 })?;
9606 Ok(body)
9607 }
9608 pub fn into_raw_response(self) -> azure_core::http::Response {
9609 self.0
9610 }
9611 pub fn as_raw_response(&self) -> &azure_core::http::Response {
9612 &self.0
9613 }
9614 }
9615 impl From<Response> for azure_core::http::Response {
9616 fn from(rsp: Response) -> Self {
9617 rsp.into_raw_response()
9618 }
9619 }
9620 impl AsRef<azure_core::http::Response> for Response {
9621 fn as_ref(&self) -> &azure_core::http::Response {
9622 self.as_raw_response()
9623 }
9624 }
9625 #[derive(Clone)]
9626 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9627 #[doc = r""]
9628 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9629 #[doc = r" parameters can be chained."]
9630 #[doc = r""]
9631 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9632 #[doc = r" converts the [`RequestBuilder`] into a future,"]
9633 #[doc = r" executes the request and returns a `Result` with the parsed"]
9634 #[doc = r" response."]
9635 #[doc = r""]
9636 #[doc = r" If you need lower-level access to the raw response details"]
9637 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9638 #[doc = r" can finalize the request using the"]
9639 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9640 #[doc = r" that resolves to a lower-level [`Response`] value."]
9641 pub struct RequestBuilder {
9642 pub(crate) client: super::super::Client,
9643 pub(crate) organization: String,
9644 pub(crate) repository_id: String,
9645 pub(crate) pull_request_id: i32,
9646 pub(crate) project: String,
9647 pub(crate) top: Option<i32>,
9648 pub(crate) continuation_token: Option<String>,
9649 }
9650 impl RequestBuilder {
9651 #[doc = "Maximum number of commits to return."]
9652 pub fn top(mut self, top: i32) -> Self {
9653 self.top = Some(top);
9654 self
9655 }
9656 #[doc = "The continuation token used for pagination."]
9657 pub fn continuation_token(mut self, continuation_token: impl Into<String>) -> Self {
9658 self.continuation_token = Some(continuation_token.into());
9659 self
9660 }
9661 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9662 #[doc = ""]
9663 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9664 #[doc = "However, this function can provide more flexibility when required."]
9665 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9666 Box::pin({
9667 let this = self.clone();
9668 async move {
9669 let url = this.url()?;
9670 let mut req =
9671 azure_core::http::Request::new(url, azure_core::http::Method::Get);
9672 if let Some(auth_header) = this
9673 .client
9674 .token_credential()
9675 .http_authorization_header(&this.client.scopes())
9676 .await?
9677 {
9678 req.insert_header(
9679 azure_core::http::headers::AUTHORIZATION,
9680 auth_header,
9681 );
9682 }
9683 if let Some(top) = &this.top {
9684 req.url_mut()
9685 .query_pairs_mut()
9686 .append_pair("$top", &top.to_string());
9687 }
9688 if let Some(continuation_token) = &this.continuation_token {
9689 req.url_mut()
9690 .query_pairs_mut()
9691 .append_pair("continuationToken", continuation_token);
9692 }
9693 let req_body = azure_core::Bytes::new();
9694 req.set_body(req_body);
9695 Ok(Response(this.client.send(&mut req).await?))
9696 }
9697 })
9698 }
9699 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
9700 let mut url = azure_core::http::Url::parse(&format!(
9701 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/commits",
9702 self.client.endpoint(),
9703 &self.organization,
9704 &self.project,
9705 &self.repository_id,
9706 &self.pull_request_id
9707 ))?;
9708 let has_api_version_already = url
9709 .query_pairs()
9710 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
9711 if !has_api_version_already {
9712 url.query_pairs_mut().append_pair(
9713 azure_core::http::headers::query_param::API_VERSION,
9714 "7.1-preview",
9715 );
9716 }
9717 Ok(url)
9718 }
9719 }
9720 impl std::future::IntoFuture for RequestBuilder {
9721 type Output = azure_core::Result<models::GitCommitRefList>;
9722 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
9723 #[doc = "Returns a future that sends the request and returns the parsed response body."]
9724 #[doc = ""]
9725 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
9726 #[doc = ""]
9727 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
9728 fn into_future(self) -> Self::IntoFuture {
9729 Box::pin(async move { self.send().await?.into_raw_body().await })
9730 }
9731 }
9732 }
9733 pub mod get_pull_request_iteration_commits {
9734 use super::models;
9735 #[cfg(not(target_arch = "wasm32"))]
9736 use futures::future::BoxFuture;
9737 #[cfg(target_arch = "wasm32")]
9738 use futures::future::LocalBoxFuture as BoxFuture;
9739 #[derive(Debug)]
9740 pub struct Response(azure_core::http::Response);
9741 impl Response {
9742 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCommitRefList> {
9743 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
9744 let body: models::GitCommitRefList =
9745 serde_json::from_slice(&bytes).map_err(|e| {
9746 azure_core::error::Error::full(
9747 azure_core::error::ErrorKind::DataConversion,
9748 e,
9749 format!(
9750 "Failed to deserialize response:\n{}",
9751 String::from_utf8_lossy(&bytes)
9752 ),
9753 )
9754 })?;
9755 Ok(body)
9756 }
9757 pub fn into_raw_response(self) -> azure_core::http::Response {
9758 self.0
9759 }
9760 pub fn as_raw_response(&self) -> &azure_core::http::Response {
9761 &self.0
9762 }
9763 }
9764 impl From<Response> for azure_core::http::Response {
9765 fn from(rsp: Response) -> Self {
9766 rsp.into_raw_response()
9767 }
9768 }
9769 impl AsRef<azure_core::http::Response> for Response {
9770 fn as_ref(&self) -> &azure_core::http::Response {
9771 self.as_raw_response()
9772 }
9773 }
9774 #[derive(Clone)]
9775 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9776 #[doc = r""]
9777 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9778 #[doc = r" parameters can be chained."]
9779 #[doc = r""]
9780 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9781 #[doc = r" converts the [`RequestBuilder`] into a future,"]
9782 #[doc = r" executes the request and returns a `Result` with the parsed"]
9783 #[doc = r" response."]
9784 #[doc = r""]
9785 #[doc = r" If you need lower-level access to the raw response details"]
9786 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9787 #[doc = r" can finalize the request using the"]
9788 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
9789 #[doc = r" that resolves to a lower-level [`Response`] value."]
9790 pub struct RequestBuilder {
9791 pub(crate) client: super::super::Client,
9792 pub(crate) organization: String,
9793 pub(crate) repository_id: String,
9794 pub(crate) pull_request_id: i32,
9795 pub(crate) iteration_id: i32,
9796 pub(crate) project: String,
9797 pub(crate) top: Option<i32>,
9798 pub(crate) skip: Option<i32>,
9799 }
9800 impl RequestBuilder {
9801 #[doc = "Maximum number of commits to return. The maximum number of commits that can be returned per batch is 500."]
9802 pub fn top(mut self, top: i32) -> Self {
9803 self.top = Some(top);
9804 self
9805 }
9806 #[doc = "Number of commits to skip."]
9807 pub fn skip(mut self, skip: i32) -> Self {
9808 self.skip = Some(skip);
9809 self
9810 }
9811 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
9812 #[doc = ""]
9813 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
9814 #[doc = "However, this function can provide more flexibility when required."]
9815 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
9816 Box::pin({
9817 let this = self.clone();
9818 async move {
9819 let url = this.url()?;
9820 let mut req =
9821 azure_core::http::Request::new(url, azure_core::http::Method::Get);
9822 if let Some(auth_header) = this
9823 .client
9824 .token_credential()
9825 .http_authorization_header(&this.client.scopes())
9826 .await?
9827 {
9828 req.insert_header(
9829 azure_core::http::headers::AUTHORIZATION,
9830 auth_header,
9831 );
9832 }
9833 if let Some(top) = &this.top {
9834 req.url_mut()
9835 .query_pairs_mut()
9836 .append_pair("top", &top.to_string());
9837 }
9838 if let Some(skip) = &this.skip {
9839 req.url_mut()
9840 .query_pairs_mut()
9841 .append_pair("skip", &skip.to_string());
9842 }
9843 let req_body = azure_core::Bytes::new();
9844 req.set_body(req_body);
9845 Ok(Response(this.client.send(&mut req).await?))
9846 }
9847 })
9848 }
9849 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
9850 let mut url = azure_core::http::Url::parse(&format!(
9851 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/commits",
9852 self.client.endpoint(),
9853 &self.organization,
9854 &self.project,
9855 &self.repository_id,
9856 &self.pull_request_id,
9857 &self.iteration_id
9858 ))?;
9859 let has_api_version_already = url
9860 .query_pairs()
9861 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
9862 if !has_api_version_already {
9863 url.query_pairs_mut().append_pair(
9864 azure_core::http::headers::query_param::API_VERSION,
9865 "7.1-preview",
9866 );
9867 }
9868 Ok(url)
9869 }
9870 }
9871 impl std::future::IntoFuture for RequestBuilder {
9872 type Output = azure_core::Result<models::GitCommitRefList>;
9873 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
9874 #[doc = "Returns a future that sends the request and returns the parsed response body."]
9875 #[doc = ""]
9876 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
9877 #[doc = ""]
9878 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
9879 fn into_future(self) -> Self::IntoFuture {
9880 Box::pin(async move { self.send().await?.into_raw_body().await })
9881 }
9882 }
9883 }
9884}
9885pub mod pull_request_iterations {
9886 use super::models;
9887 #[cfg(not(target_arch = "wasm32"))]
9888 use futures::future::BoxFuture;
9889 #[cfg(target_arch = "wasm32")]
9890 use futures::future::LocalBoxFuture as BoxFuture;
9891 pub struct Client(pub(crate) super::Client);
9892 impl Client {
9893 #[doc = "Get the list of iterations for the specified pull request."]
9894 #[doc = ""]
9895 #[doc = "Arguments:"]
9896 #[doc = "* `organization`: The name of the Azure DevOps organization."]
9897 #[doc = "* `repository_id`: ID or name of the repository."]
9898 #[doc = "* `pull_request_id`: ID of the pull request."]
9899 #[doc = "* `project`: Project ID or project name"]
9900 pub fn list(
9901 &self,
9902 organization: impl Into<String>,
9903 repository_id: impl Into<String>,
9904 pull_request_id: i32,
9905 project: impl Into<String>,
9906 ) -> list::RequestBuilder {
9907 list::RequestBuilder {
9908 client: self.0.clone(),
9909 organization: organization.into(),
9910 repository_id: repository_id.into(),
9911 pull_request_id,
9912 project: project.into(),
9913 include_commits: None,
9914 }
9915 }
9916 #[doc = "Get the specified iteration for a pull request."]
9917 #[doc = ""]
9918 #[doc = "Arguments:"]
9919 #[doc = "* `organization`: The name of the Azure DevOps organization."]
9920 #[doc = "* `repository_id`: ID or name of the repository."]
9921 #[doc = "* `pull_request_id`: ID of the pull request."]
9922 #[doc = "* `iteration_id`: ID of the pull request iteration to return."]
9923 #[doc = "* `project`: Project ID or project name"]
9924 pub fn get(
9925 &self,
9926 organization: impl Into<String>,
9927 repository_id: impl Into<String>,
9928 pull_request_id: i32,
9929 iteration_id: i32,
9930 project: impl Into<String>,
9931 ) -> get::RequestBuilder {
9932 get::RequestBuilder {
9933 client: self.0.clone(),
9934 organization: organization.into(),
9935 repository_id: repository_id.into(),
9936 pull_request_id,
9937 iteration_id,
9938 project: project.into(),
9939 }
9940 }
9941 }
9942 pub mod list {
9943 use super::models;
9944 #[cfg(not(target_arch = "wasm32"))]
9945 use futures::future::BoxFuture;
9946 #[cfg(target_arch = "wasm32")]
9947 use futures::future::LocalBoxFuture as BoxFuture;
9948 #[derive(Debug)]
9949 pub struct Response(azure_core::http::Response);
9950 impl Response {
9951 pub async fn into_raw_body(
9952 self,
9953 ) -> azure_core::Result<models::GitPullRequestIterationList> {
9954 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
9955 let body: models::GitPullRequestIterationList = serde_json::from_slice(&bytes)
9956 .map_err(|e| {
9957 azure_core::error::Error::full(
9958 azure_core::error::ErrorKind::DataConversion,
9959 e,
9960 format!(
9961 "Failed to deserialize response:\n{}",
9962 String::from_utf8_lossy(&bytes)
9963 ),
9964 )
9965 })?;
9966 Ok(body)
9967 }
9968 pub fn into_raw_response(self) -> azure_core::http::Response {
9969 self.0
9970 }
9971 pub fn as_raw_response(&self) -> &azure_core::http::Response {
9972 &self.0
9973 }
9974 }
9975 impl From<Response> for azure_core::http::Response {
9976 fn from(rsp: Response) -> Self {
9977 rsp.into_raw_response()
9978 }
9979 }
9980 impl AsRef<azure_core::http::Response> for Response {
9981 fn as_ref(&self) -> &azure_core::http::Response {
9982 self.as_raw_response()
9983 }
9984 }
9985 #[derive(Clone)]
9986 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
9987 #[doc = r""]
9988 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
9989 #[doc = r" parameters can be chained."]
9990 #[doc = r""]
9991 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
9992 #[doc = r" converts the [`RequestBuilder`] into a future,"]
9993 #[doc = r" executes the request and returns a `Result` with the parsed"]
9994 #[doc = r" response."]
9995 #[doc = r""]
9996 #[doc = r" If you need lower-level access to the raw response details"]
9997 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
9998 #[doc = r" can finalize the request using the"]
9999 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
10000 #[doc = r" that resolves to a lower-level [`Response`] value."]
10001 pub struct RequestBuilder {
10002 pub(crate) client: super::super::Client,
10003 pub(crate) organization: String,
10004 pub(crate) repository_id: String,
10005 pub(crate) pull_request_id: i32,
10006 pub(crate) project: String,
10007 pub(crate) include_commits: Option<bool>,
10008 }
10009 impl RequestBuilder {
10010 #[doc = "If true, include the commits associated with each iteration in the response."]
10011 pub fn include_commits(mut self, include_commits: bool) -> Self {
10012 self.include_commits = Some(include_commits);
10013 self
10014 }
10015 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
10016 #[doc = ""]
10017 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
10018 #[doc = "However, this function can provide more flexibility when required."]
10019 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
10020 Box::pin({
10021 let this = self.clone();
10022 async move {
10023 let url = this.url()?;
10024 let mut req =
10025 azure_core::http::Request::new(url, azure_core::http::Method::Get);
10026 if let Some(auth_header) = this
10027 .client
10028 .token_credential()
10029 .http_authorization_header(&this.client.scopes())
10030 .await?
10031 {
10032 req.insert_header(
10033 azure_core::http::headers::AUTHORIZATION,
10034 auth_header,
10035 );
10036 }
10037 if let Some(include_commits) = &this.include_commits {
10038 req.url_mut()
10039 .query_pairs_mut()
10040 .append_pair("includeCommits", &include_commits.to_string());
10041 }
10042 let req_body = azure_core::Bytes::new();
10043 req.set_body(req_body);
10044 Ok(Response(this.client.send(&mut req).await?))
10045 }
10046 })
10047 }
10048 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
10049 let mut url = azure_core::http::Url::parse(&format!(
10050 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations",
10051 self.client.endpoint(),
10052 &self.organization,
10053 &self.project,
10054 &self.repository_id,
10055 &self.pull_request_id
10056 ))?;
10057 let has_api_version_already = url
10058 .query_pairs()
10059 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
10060 if !has_api_version_already {
10061 url.query_pairs_mut().append_pair(
10062 azure_core::http::headers::query_param::API_VERSION,
10063 "7.1-preview",
10064 );
10065 }
10066 Ok(url)
10067 }
10068 }
10069 impl std::future::IntoFuture for RequestBuilder {
10070 type Output = azure_core::Result<models::GitPullRequestIterationList>;
10071 type IntoFuture =
10072 BoxFuture<'static, azure_core::Result<models::GitPullRequestIterationList>>;
10073 #[doc = "Returns a future that sends the request and returns the parsed response body."]
10074 #[doc = ""]
10075 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
10076 #[doc = ""]
10077 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
10078 fn into_future(self) -> Self::IntoFuture {
10079 Box::pin(async move { self.send().await?.into_raw_body().await })
10080 }
10081 }
10082 }
10083 pub mod get {
10084 use super::models;
10085 #[cfg(not(target_arch = "wasm32"))]
10086 use futures::future::BoxFuture;
10087 #[cfg(target_arch = "wasm32")]
10088 use futures::future::LocalBoxFuture as BoxFuture;
10089 #[derive(Debug)]
10090 pub struct Response(azure_core::http::Response);
10091 impl Response {
10092 pub async fn into_raw_body(
10093 self,
10094 ) -> azure_core::Result<models::GitPullRequestIteration> {
10095 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
10096 let body: models::GitPullRequestIteration = serde_json::from_slice(&bytes)
10097 .map_err(|e| {
10098 azure_core::error::Error::full(
10099 azure_core::error::ErrorKind::DataConversion,
10100 e,
10101 format!(
10102 "Failed to deserialize response:\n{}",
10103 String::from_utf8_lossy(&bytes)
10104 ),
10105 )
10106 })?;
10107 Ok(body)
10108 }
10109 pub fn into_raw_response(self) -> azure_core::http::Response {
10110 self.0
10111 }
10112 pub fn as_raw_response(&self) -> &azure_core::http::Response {
10113 &self.0
10114 }
10115 }
10116 impl From<Response> for azure_core::http::Response {
10117 fn from(rsp: Response) -> Self {
10118 rsp.into_raw_response()
10119 }
10120 }
10121 impl AsRef<azure_core::http::Response> for Response {
10122 fn as_ref(&self) -> &azure_core::http::Response {
10123 self.as_raw_response()
10124 }
10125 }
10126 #[derive(Clone)]
10127 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
10128 #[doc = r""]
10129 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
10130 #[doc = r" parameters can be chained."]
10131 #[doc = r""]
10132 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
10133 #[doc = r" converts the [`RequestBuilder`] into a future,"]
10134 #[doc = r" executes the request and returns a `Result` with the parsed"]
10135 #[doc = r" response."]
10136 #[doc = r""]
10137 #[doc = r" If you need lower-level access to the raw response details"]
10138 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
10139 #[doc = r" can finalize the request using the"]
10140 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
10141 #[doc = r" that resolves to a lower-level [`Response`] value."]
10142 pub struct RequestBuilder {
10143 pub(crate) client: super::super::Client,
10144 pub(crate) organization: String,
10145 pub(crate) repository_id: String,
10146 pub(crate) pull_request_id: i32,
10147 pub(crate) iteration_id: i32,
10148 pub(crate) project: String,
10149 }
10150 impl RequestBuilder {
10151 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
10152 #[doc = ""]
10153 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
10154 #[doc = "However, this function can provide more flexibility when required."]
10155 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
10156 Box::pin({
10157 let this = self.clone();
10158 async move {
10159 let url = this.url()?;
10160 let mut req =
10161 azure_core::http::Request::new(url, azure_core::http::Method::Get);
10162 if let Some(auth_header) = this
10163 .client
10164 .token_credential()
10165 .http_authorization_header(&this.client.scopes())
10166 .await?
10167 {
10168 req.insert_header(
10169 azure_core::http::headers::AUTHORIZATION,
10170 auth_header,
10171 );
10172 }
10173 let req_body = azure_core::Bytes::new();
10174 req.set_body(req_body);
10175 Ok(Response(this.client.send(&mut req).await?))
10176 }
10177 })
10178 }
10179 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
10180 let mut url = azure_core::http::Url::parse(&format!(
10181 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}",
10182 self.client.endpoint(),
10183 &self.organization,
10184 &self.project,
10185 &self.repository_id,
10186 &self.pull_request_id,
10187 &self.iteration_id
10188 ))?;
10189 let has_api_version_already = url
10190 .query_pairs()
10191 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
10192 if !has_api_version_already {
10193 url.query_pairs_mut().append_pair(
10194 azure_core::http::headers::query_param::API_VERSION,
10195 "7.1-preview",
10196 );
10197 }
10198 Ok(url)
10199 }
10200 }
10201 impl std::future::IntoFuture for RequestBuilder {
10202 type Output = azure_core::Result<models::GitPullRequestIteration>;
10203 type IntoFuture =
10204 BoxFuture<'static, azure_core::Result<models::GitPullRequestIteration>>;
10205 #[doc = "Returns a future that sends the request and returns the parsed response body."]
10206 #[doc = ""]
10207 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
10208 #[doc = ""]
10209 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
10210 fn into_future(self) -> Self::IntoFuture {
10211 Box::pin(async move { self.send().await?.into_raw_body().await })
10212 }
10213 }
10214 }
10215}
10216pub mod pull_request_iteration_changes {
10217 use super::models;
10218 #[cfg(not(target_arch = "wasm32"))]
10219 use futures::future::BoxFuture;
10220 #[cfg(target_arch = "wasm32")]
10221 use futures::future::LocalBoxFuture as BoxFuture;
10222 pub struct Client(pub(crate) super::Client);
10223 impl Client {
10224 #[doc = "Retrieve the changes made in a pull request between two iterations."]
10225 #[doc = ""]
10226 #[doc = "Arguments:"]
10227 #[doc = "* `organization`: The name of the Azure DevOps organization."]
10228 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
10229 #[doc = "* `pull_request_id`: ID of the pull request."]
10230 #[doc = "* `iteration_id`: ID of the pull request iteration. <br /> Iteration one is the head of the source branch at the time the pull request is created and subsequent iterations are created when there are pushes to the source branch. Allowed values are between 1 and the maximum iteration on this pull request."]
10231 #[doc = "* `project`: Project ID or project name"]
10232 pub fn get(
10233 &self,
10234 organization: impl Into<String>,
10235 repository_id: impl Into<String>,
10236 pull_request_id: i32,
10237 iteration_id: i32,
10238 project: impl Into<String>,
10239 ) -> get::RequestBuilder {
10240 get::RequestBuilder {
10241 client: self.0.clone(),
10242 organization: organization.into(),
10243 repository_id: repository_id.into(),
10244 pull_request_id,
10245 iteration_id,
10246 project: project.into(),
10247 top: None,
10248 skip: None,
10249 compare_to: None,
10250 }
10251 }
10252 }
10253 pub mod get {
10254 use super::models;
10255 #[cfg(not(target_arch = "wasm32"))]
10256 use futures::future::BoxFuture;
10257 #[cfg(target_arch = "wasm32")]
10258 use futures::future::LocalBoxFuture as BoxFuture;
10259 #[derive(Debug)]
10260 pub struct Response(azure_core::http::Response);
10261 impl Response {
10262 pub async fn into_raw_body(
10263 self,
10264 ) -> azure_core::Result<models::GitPullRequestIterationChanges> {
10265 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
10266 let body: models::GitPullRequestIterationChanges = serde_json::from_slice(&bytes)
10267 .map_err(|e| {
10268 azure_core::error::Error::full(
10269 azure_core::error::ErrorKind::DataConversion,
10270 e,
10271 format!(
10272 "Failed to deserialize response:\n{}",
10273 String::from_utf8_lossy(&bytes)
10274 ),
10275 )
10276 })?;
10277 Ok(body)
10278 }
10279 pub fn into_raw_response(self) -> azure_core::http::Response {
10280 self.0
10281 }
10282 pub fn as_raw_response(&self) -> &azure_core::http::Response {
10283 &self.0
10284 }
10285 }
10286 impl From<Response> for azure_core::http::Response {
10287 fn from(rsp: Response) -> Self {
10288 rsp.into_raw_response()
10289 }
10290 }
10291 impl AsRef<azure_core::http::Response> for Response {
10292 fn as_ref(&self) -> &azure_core::http::Response {
10293 self.as_raw_response()
10294 }
10295 }
10296 #[derive(Clone)]
10297 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
10298 #[doc = r""]
10299 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
10300 #[doc = r" parameters can be chained."]
10301 #[doc = r""]
10302 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
10303 #[doc = r" converts the [`RequestBuilder`] into a future,"]
10304 #[doc = r" executes the request and returns a `Result` with the parsed"]
10305 #[doc = r" response."]
10306 #[doc = r""]
10307 #[doc = r" If you need lower-level access to the raw response details"]
10308 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
10309 #[doc = r" can finalize the request using the"]
10310 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
10311 #[doc = r" that resolves to a lower-level [`Response`] value."]
10312 pub struct RequestBuilder {
10313 pub(crate) client: super::super::Client,
10314 pub(crate) organization: String,
10315 pub(crate) repository_id: String,
10316 pub(crate) pull_request_id: i32,
10317 pub(crate) iteration_id: i32,
10318 pub(crate) project: String,
10319 pub(crate) top: Option<i32>,
10320 pub(crate) skip: Option<i32>,
10321 pub(crate) compare_to: Option<i32>,
10322 }
10323 impl RequestBuilder {
10324 #[doc = "Optional. The number of changes to retrieve. The default value is 100 and the maximum value is 2000."]
10325 pub fn top(mut self, top: i32) -> Self {
10326 self.top = Some(top);
10327 self
10328 }
10329 #[doc = "Optional. The number of changes to ignore. For example, to retrieve changes 101-150, set top 50 and skip to 100."]
10330 pub fn skip(mut self, skip: i32) -> Self {
10331 self.skip = Some(skip);
10332 self
10333 }
10334 #[doc = "ID of the pull request iteration to compare against. The default value is zero which indicates the comparison is made against the common commit between the source and target branches"]
10335 pub fn compare_to(mut self, compare_to: i32) -> Self {
10336 self.compare_to = Some(compare_to);
10337 self
10338 }
10339 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
10340 #[doc = ""]
10341 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
10342 #[doc = "However, this function can provide more flexibility when required."]
10343 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
10344 Box::pin({
10345 let this = self.clone();
10346 async move {
10347 let url = this.url()?;
10348 let mut req =
10349 azure_core::http::Request::new(url, azure_core::http::Method::Get);
10350 if let Some(auth_header) = this
10351 .client
10352 .token_credential()
10353 .http_authorization_header(&this.client.scopes())
10354 .await?
10355 {
10356 req.insert_header(
10357 azure_core::http::headers::AUTHORIZATION,
10358 auth_header,
10359 );
10360 }
10361 if let Some(top) = &this.top {
10362 req.url_mut()
10363 .query_pairs_mut()
10364 .append_pair("$top", &top.to_string());
10365 }
10366 if let Some(skip) = &this.skip {
10367 req.url_mut()
10368 .query_pairs_mut()
10369 .append_pair("$skip", &skip.to_string());
10370 }
10371 if let Some(compare_to) = &this.compare_to {
10372 req.url_mut()
10373 .query_pairs_mut()
10374 .append_pair("$compareTo", &compare_to.to_string());
10375 }
10376 let req_body = azure_core::Bytes::new();
10377 req.set_body(req_body);
10378 Ok(Response(this.client.send(&mut req).await?))
10379 }
10380 })
10381 }
10382 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
10383 let mut url = azure_core::http::Url::parse(&format!(
10384 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/changes",
10385 self.client.endpoint(),
10386 &self.organization,
10387 &self.project,
10388 &self.repository_id,
10389 &self.pull_request_id,
10390 &self.iteration_id
10391 ))?;
10392 let has_api_version_already = url
10393 .query_pairs()
10394 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
10395 if !has_api_version_already {
10396 url.query_pairs_mut().append_pair(
10397 azure_core::http::headers::query_param::API_VERSION,
10398 "7.1-preview",
10399 );
10400 }
10401 Ok(url)
10402 }
10403 }
10404 impl std::future::IntoFuture for RequestBuilder {
10405 type Output = azure_core::Result<models::GitPullRequestIterationChanges>;
10406 type IntoFuture =
10407 BoxFuture<'static, azure_core::Result<models::GitPullRequestIterationChanges>>;
10408 #[doc = "Returns a future that sends the request and returns the parsed response body."]
10409 #[doc = ""]
10410 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
10411 #[doc = ""]
10412 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
10413 fn into_future(self) -> Self::IntoFuture {
10414 Box::pin(async move { self.send().await?.into_raw_body().await })
10415 }
10416 }
10417 }
10418}
10419pub mod pull_request_iteration_statuses {
10420 use super::models;
10421 #[cfg(not(target_arch = "wasm32"))]
10422 use futures::future::BoxFuture;
10423 #[cfg(target_arch = "wasm32")]
10424 use futures::future::LocalBoxFuture as BoxFuture;
10425 pub struct Client(pub(crate) super::Client);
10426 impl Client {
10427 #[doc = "Get all the statuses associated with a pull request iteration."]
10428 #[doc = ""]
10429 #[doc = "Arguments:"]
10430 #[doc = "* `organization`: The name of the Azure DevOps organization."]
10431 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
10432 #[doc = "* `pull_request_id`: ID of the pull request."]
10433 #[doc = "* `iteration_id`: ID of the pull request iteration."]
10434 #[doc = "* `project`: Project ID or project name"]
10435 pub fn list(
10436 &self,
10437 organization: impl Into<String>,
10438 repository_id: impl Into<String>,
10439 pull_request_id: i32,
10440 iteration_id: i32,
10441 project: impl Into<String>,
10442 ) -> list::RequestBuilder {
10443 list::RequestBuilder {
10444 client: self.0.clone(),
10445 organization: organization.into(),
10446 repository_id: repository_id.into(),
10447 pull_request_id,
10448 iteration_id,
10449 project: project.into(),
10450 }
10451 }
10452 #[doc = "Create a pull request status on the iteration. This operation will have the same result as Create status on pull request with specified iteration ID in the request body.\n\nThe only required field for the status is `Context.Name` that uniquely identifies the status.\nNote that `iterationId` in the request body is optional since `iterationId` can be specified in the URL.\nA conflict between `iterationId` in the URL and `iterationId` in the request body will result in status code 400."]
10453 #[doc = ""]
10454 #[doc = "Arguments:"]
10455 #[doc = "* `organization`: The name of the Azure DevOps organization."]
10456 #[doc = "* `body`: Pull request status to create."]
10457 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
10458 #[doc = "* `pull_request_id`: ID of the pull request."]
10459 #[doc = "* `iteration_id`: ID of the pull request iteration."]
10460 #[doc = "* `project`: Project ID or project name"]
10461 pub fn create(
10462 &self,
10463 organization: impl Into<String>,
10464 body: impl Into<models::GitPullRequestStatus>,
10465 repository_id: impl Into<String>,
10466 pull_request_id: i32,
10467 iteration_id: i32,
10468 project: impl Into<String>,
10469 ) -> create::RequestBuilder {
10470 create::RequestBuilder {
10471 client: self.0.clone(),
10472 organization: organization.into(),
10473 body: body.into(),
10474 repository_id: repository_id.into(),
10475 pull_request_id,
10476 iteration_id,
10477 project: project.into(),
10478 }
10479 }
10480 #[doc = "Update pull request iteration statuses collection. The only supported operation type is `remove`.\n\nThis operation allows to delete multiple statuses in one call.\nThe path of the `remove` operation should refer to the ID of the pull request status.\nFor example `path=\"/1\"` refers to the pull request status with ID 1."]
10481 #[doc = ""]
10482 #[doc = "Arguments:"]
10483 #[doc = "* `organization`: The name of the Azure DevOps organization."]
10484 #[doc = "* `body`: Operations to apply to the pull request statuses in JSON Patch format."]
10485 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
10486 #[doc = "* `pull_request_id`: ID of the pull request."]
10487 #[doc = "* `iteration_id`: ID of the pull request iteration."]
10488 #[doc = "* `project`: Project ID or project name"]
10489 pub fn update(
10490 &self,
10491 organization: impl Into<String>,
10492 body: impl Into<models::JsonPatchDocument>,
10493 repository_id: impl Into<String>,
10494 pull_request_id: i32,
10495 iteration_id: i32,
10496 project: impl Into<String>,
10497 ) -> update::RequestBuilder {
10498 update::RequestBuilder {
10499 client: self.0.clone(),
10500 organization: organization.into(),
10501 body: body.into(),
10502 repository_id: repository_id.into(),
10503 pull_request_id,
10504 iteration_id,
10505 project: project.into(),
10506 }
10507 }
10508 #[doc = "Get the specific pull request iteration status by ID. The status ID is unique within the pull request across all iterations."]
10509 #[doc = ""]
10510 #[doc = "Arguments:"]
10511 #[doc = "* `organization`: The name of the Azure DevOps organization."]
10512 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
10513 #[doc = "* `pull_request_id`: ID of the pull request."]
10514 #[doc = "* `iteration_id`: ID of the pull request iteration."]
10515 #[doc = "* `status_id`: ID of the pull request status."]
10516 #[doc = "* `project`: Project ID or project name"]
10517 pub fn get(
10518 &self,
10519 organization: impl Into<String>,
10520 repository_id: impl Into<String>,
10521 pull_request_id: i32,
10522 iteration_id: i32,
10523 status_id: i32,
10524 project: impl Into<String>,
10525 ) -> get::RequestBuilder {
10526 get::RequestBuilder {
10527 client: self.0.clone(),
10528 organization: organization.into(),
10529 repository_id: repository_id.into(),
10530 pull_request_id,
10531 iteration_id,
10532 status_id,
10533 project: project.into(),
10534 }
10535 }
10536 #[doc = "Delete pull request iteration status.\n\nYou can remove multiple statuses in one call by using Update operation."]
10537 #[doc = ""]
10538 #[doc = "Arguments:"]
10539 #[doc = "* `organization`: The name of the Azure DevOps organization."]
10540 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
10541 #[doc = "* `pull_request_id`: ID of the pull request."]
10542 #[doc = "* `iteration_id`: ID of the pull request iteration."]
10543 #[doc = "* `status_id`: ID of the pull request status."]
10544 #[doc = "* `project`: Project ID or project name"]
10545 pub fn delete(
10546 &self,
10547 organization: impl Into<String>,
10548 repository_id: impl Into<String>,
10549 pull_request_id: i32,
10550 iteration_id: i32,
10551 status_id: i32,
10552 project: impl Into<String>,
10553 ) -> delete::RequestBuilder {
10554 delete::RequestBuilder {
10555 client: self.0.clone(),
10556 organization: organization.into(),
10557 repository_id: repository_id.into(),
10558 pull_request_id,
10559 iteration_id,
10560 status_id,
10561 project: project.into(),
10562 }
10563 }
10564 }
10565 pub mod list {
10566 use super::models;
10567 #[cfg(not(target_arch = "wasm32"))]
10568 use futures::future::BoxFuture;
10569 #[cfg(target_arch = "wasm32")]
10570 use futures::future::LocalBoxFuture as BoxFuture;
10571 #[derive(Debug)]
10572 pub struct Response(azure_core::http::Response);
10573 impl Response {
10574 pub async fn into_raw_body(
10575 self,
10576 ) -> azure_core::Result<models::GitPullRequestStatusList> {
10577 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
10578 let body: models::GitPullRequestStatusList = serde_json::from_slice(&bytes)
10579 .map_err(|e| {
10580 azure_core::error::Error::full(
10581 azure_core::error::ErrorKind::DataConversion,
10582 e,
10583 format!(
10584 "Failed to deserialize response:\n{}",
10585 String::from_utf8_lossy(&bytes)
10586 ),
10587 )
10588 })?;
10589 Ok(body)
10590 }
10591 pub fn into_raw_response(self) -> azure_core::http::Response {
10592 self.0
10593 }
10594 pub fn as_raw_response(&self) -> &azure_core::http::Response {
10595 &self.0
10596 }
10597 }
10598 impl From<Response> for azure_core::http::Response {
10599 fn from(rsp: Response) -> Self {
10600 rsp.into_raw_response()
10601 }
10602 }
10603 impl AsRef<azure_core::http::Response> for Response {
10604 fn as_ref(&self) -> &azure_core::http::Response {
10605 self.as_raw_response()
10606 }
10607 }
10608 #[derive(Clone)]
10609 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
10610 #[doc = r""]
10611 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
10612 #[doc = r" parameters can be chained."]
10613 #[doc = r""]
10614 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
10615 #[doc = r" converts the [`RequestBuilder`] into a future,"]
10616 #[doc = r" executes the request and returns a `Result` with the parsed"]
10617 #[doc = r" response."]
10618 #[doc = r""]
10619 #[doc = r" If you need lower-level access to the raw response details"]
10620 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
10621 #[doc = r" can finalize the request using the"]
10622 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
10623 #[doc = r" that resolves to a lower-level [`Response`] value."]
10624 pub struct RequestBuilder {
10625 pub(crate) client: super::super::Client,
10626 pub(crate) organization: String,
10627 pub(crate) repository_id: String,
10628 pub(crate) pull_request_id: i32,
10629 pub(crate) iteration_id: i32,
10630 pub(crate) project: String,
10631 }
10632 impl RequestBuilder {
10633 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
10634 #[doc = ""]
10635 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
10636 #[doc = "However, this function can provide more flexibility when required."]
10637 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
10638 Box::pin({
10639 let this = self.clone();
10640 async move {
10641 let url = this.url()?;
10642 let mut req =
10643 azure_core::http::Request::new(url, azure_core::http::Method::Get);
10644 if let Some(auth_header) = this
10645 .client
10646 .token_credential()
10647 .http_authorization_header(&this.client.scopes())
10648 .await?
10649 {
10650 req.insert_header(
10651 azure_core::http::headers::AUTHORIZATION,
10652 auth_header,
10653 );
10654 }
10655 let req_body = azure_core::Bytes::new();
10656 req.set_body(req_body);
10657 Ok(Response(this.client.send(&mut req).await?))
10658 }
10659 })
10660 }
10661 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
10662 let mut url = azure_core::http::Url::parse(&format!(
10663 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses",
10664 self.client.endpoint(),
10665 &self.organization,
10666 &self.project,
10667 &self.repository_id,
10668 &self.pull_request_id,
10669 &self.iteration_id
10670 ))?;
10671 let has_api_version_already = url
10672 .query_pairs()
10673 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
10674 if !has_api_version_already {
10675 url.query_pairs_mut().append_pair(
10676 azure_core::http::headers::query_param::API_VERSION,
10677 "7.1-preview",
10678 );
10679 }
10680 Ok(url)
10681 }
10682 }
10683 impl std::future::IntoFuture for RequestBuilder {
10684 type Output = azure_core::Result<models::GitPullRequestStatusList>;
10685 type IntoFuture =
10686 BoxFuture<'static, azure_core::Result<models::GitPullRequestStatusList>>;
10687 #[doc = "Returns a future that sends the request and returns the parsed response body."]
10688 #[doc = ""]
10689 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
10690 #[doc = ""]
10691 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
10692 fn into_future(self) -> Self::IntoFuture {
10693 Box::pin(async move { self.send().await?.into_raw_body().await })
10694 }
10695 }
10696 }
10697 pub mod create {
10698 use super::models;
10699 #[cfg(not(target_arch = "wasm32"))]
10700 use futures::future::BoxFuture;
10701 #[cfg(target_arch = "wasm32")]
10702 use futures::future::LocalBoxFuture as BoxFuture;
10703 #[derive(Debug)]
10704 pub struct Response(azure_core::http::Response);
10705 impl Response {
10706 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequestStatus> {
10707 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
10708 let body: models::GitPullRequestStatus =
10709 serde_json::from_slice(&bytes).map_err(|e| {
10710 azure_core::error::Error::full(
10711 azure_core::error::ErrorKind::DataConversion,
10712 e,
10713 format!(
10714 "Failed to deserialize response:\n{}",
10715 String::from_utf8_lossy(&bytes)
10716 ),
10717 )
10718 })?;
10719 Ok(body)
10720 }
10721 pub fn into_raw_response(self) -> azure_core::http::Response {
10722 self.0
10723 }
10724 pub fn as_raw_response(&self) -> &azure_core::http::Response {
10725 &self.0
10726 }
10727 }
10728 impl From<Response> for azure_core::http::Response {
10729 fn from(rsp: Response) -> Self {
10730 rsp.into_raw_response()
10731 }
10732 }
10733 impl AsRef<azure_core::http::Response> for Response {
10734 fn as_ref(&self) -> &azure_core::http::Response {
10735 self.as_raw_response()
10736 }
10737 }
10738 #[derive(Clone)]
10739 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
10740 #[doc = r""]
10741 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
10742 #[doc = r" parameters can be chained."]
10743 #[doc = r""]
10744 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
10745 #[doc = r" converts the [`RequestBuilder`] into a future,"]
10746 #[doc = r" executes the request and returns a `Result` with the parsed"]
10747 #[doc = r" response."]
10748 #[doc = r""]
10749 #[doc = r" If you need lower-level access to the raw response details"]
10750 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
10751 #[doc = r" can finalize the request using the"]
10752 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
10753 #[doc = r" that resolves to a lower-level [`Response`] value."]
10754 pub struct RequestBuilder {
10755 pub(crate) client: super::super::Client,
10756 pub(crate) organization: String,
10757 pub(crate) body: models::GitPullRequestStatus,
10758 pub(crate) repository_id: String,
10759 pub(crate) pull_request_id: i32,
10760 pub(crate) iteration_id: i32,
10761 pub(crate) project: String,
10762 }
10763 impl RequestBuilder {
10764 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
10765 #[doc = ""]
10766 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
10767 #[doc = "However, this function can provide more flexibility when required."]
10768 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
10769 Box::pin({
10770 let this = self.clone();
10771 async move {
10772 let url = this.url()?;
10773 let mut req =
10774 azure_core::http::Request::new(url, azure_core::http::Method::Post);
10775 if let Some(auth_header) = this
10776 .client
10777 .token_credential()
10778 .http_authorization_header(&this.client.scopes())
10779 .await?
10780 {
10781 req.insert_header(
10782 azure_core::http::headers::AUTHORIZATION,
10783 auth_header,
10784 );
10785 }
10786 req.insert_header("content-type", "application/json");
10787 let req_body = azure_core::json::to_json(&this.body)?;
10788 req.set_body(req_body);
10789 Ok(Response(this.client.send(&mut req).await?))
10790 }
10791 })
10792 }
10793 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
10794 let mut url = azure_core::http::Url::parse(&format!(
10795 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses",
10796 self.client.endpoint(),
10797 &self.organization,
10798 &self.project,
10799 &self.repository_id,
10800 &self.pull_request_id,
10801 &self.iteration_id
10802 ))?;
10803 let has_api_version_already = url
10804 .query_pairs()
10805 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
10806 if !has_api_version_already {
10807 url.query_pairs_mut().append_pair(
10808 azure_core::http::headers::query_param::API_VERSION,
10809 "7.1-preview",
10810 );
10811 }
10812 Ok(url)
10813 }
10814 }
10815 impl std::future::IntoFuture for RequestBuilder {
10816 type Output = azure_core::Result<models::GitPullRequestStatus>;
10817 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequestStatus>>;
10818 #[doc = "Returns a future that sends the request and returns the parsed response body."]
10819 #[doc = ""]
10820 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
10821 #[doc = ""]
10822 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
10823 fn into_future(self) -> Self::IntoFuture {
10824 Box::pin(async move { self.send().await?.into_raw_body().await })
10825 }
10826 }
10827 }
10828 pub mod update {
10829 use super::models;
10830 #[cfg(not(target_arch = "wasm32"))]
10831 use futures::future::BoxFuture;
10832 #[cfg(target_arch = "wasm32")]
10833 use futures::future::LocalBoxFuture as BoxFuture;
10834 #[derive(Debug)]
10835 pub struct Response(azure_core::http::Response);
10836 impl Response {
10837 pub fn into_raw_response(self) -> azure_core::http::Response {
10838 self.0
10839 }
10840 pub fn as_raw_response(&self) -> &azure_core::http::Response {
10841 &self.0
10842 }
10843 }
10844 impl From<Response> for azure_core::http::Response {
10845 fn from(rsp: Response) -> Self {
10846 rsp.into_raw_response()
10847 }
10848 }
10849 impl AsRef<azure_core::http::Response> for Response {
10850 fn as_ref(&self) -> &azure_core::http::Response {
10851 self.as_raw_response()
10852 }
10853 }
10854 #[derive(Clone)]
10855 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
10856 #[doc = r""]
10857 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
10858 #[doc = r" parameters can be chained."]
10859 #[doc = r""]
10860 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
10861 #[doc = r" converts the [`RequestBuilder`] into a future,"]
10862 #[doc = r" executes the request and returns a `Result` with the parsed"]
10863 #[doc = r" response."]
10864 #[doc = r""]
10865 #[doc = r" If you need lower-level access to the raw response details"]
10866 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
10867 #[doc = r" can finalize the request using the"]
10868 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
10869 #[doc = r" that resolves to a lower-level [`Response`] value."]
10870 pub struct RequestBuilder {
10871 pub(crate) client: super::super::Client,
10872 pub(crate) organization: String,
10873 pub(crate) body: models::JsonPatchDocument,
10874 pub(crate) repository_id: String,
10875 pub(crate) pull_request_id: i32,
10876 pub(crate) iteration_id: i32,
10877 pub(crate) project: String,
10878 }
10879 impl RequestBuilder {
10880 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
10881 #[doc = ""]
10882 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
10883 #[doc = "However, this function can provide more flexibility when required."]
10884 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
10885 Box::pin({
10886 let this = self.clone();
10887 async move {
10888 let url = this.url()?;
10889 let mut req =
10890 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
10891 if let Some(auth_header) = this
10892 .client
10893 .token_credential()
10894 .http_authorization_header(&this.client.scopes())
10895 .await?
10896 {
10897 req.insert_header(
10898 azure_core::http::headers::AUTHORIZATION,
10899 auth_header,
10900 );
10901 }
10902 req.insert_header("content-type", "application/json-patch+json");
10903 let req_body = azure_core::json::to_json(&this.body)?;
10904 req.set_body(req_body);
10905 Ok(Response(this.client.send(&mut req).await?))
10906 }
10907 })
10908 }
10909 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
10910 let mut url = azure_core::http::Url::parse(&format!(
10911 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses",
10912 self.client.endpoint(),
10913 &self.organization,
10914 &self.project,
10915 &self.repository_id,
10916 &self.pull_request_id,
10917 &self.iteration_id
10918 ))?;
10919 let has_api_version_already = url
10920 .query_pairs()
10921 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
10922 if !has_api_version_already {
10923 url.query_pairs_mut().append_pair(
10924 azure_core::http::headers::query_param::API_VERSION,
10925 "7.1-preview",
10926 );
10927 }
10928 Ok(url)
10929 }
10930 }
10931 impl std::future::IntoFuture for RequestBuilder {
10932 type Output = azure_core::Result<()>;
10933 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
10934 #[doc = "Returns a future that sends the request and waits for the response."]
10935 #[doc = ""]
10936 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
10937 #[doc = ""]
10938 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
10939 fn into_future(self) -> Self::IntoFuture {
10940 Box::pin(async move {
10941 let _rsp = self.send().await?;
10942 Ok(())
10943 })
10944 }
10945 }
10946 }
10947 pub mod get {
10948 use super::models;
10949 #[cfg(not(target_arch = "wasm32"))]
10950 use futures::future::BoxFuture;
10951 #[cfg(target_arch = "wasm32")]
10952 use futures::future::LocalBoxFuture as BoxFuture;
10953 #[derive(Debug)]
10954 pub struct Response(azure_core::http::Response);
10955 impl Response {
10956 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequestStatus> {
10957 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
10958 let body: models::GitPullRequestStatus =
10959 serde_json::from_slice(&bytes).map_err(|e| {
10960 azure_core::error::Error::full(
10961 azure_core::error::ErrorKind::DataConversion,
10962 e,
10963 format!(
10964 "Failed to deserialize response:\n{}",
10965 String::from_utf8_lossy(&bytes)
10966 ),
10967 )
10968 })?;
10969 Ok(body)
10970 }
10971 pub fn into_raw_response(self) -> azure_core::http::Response {
10972 self.0
10973 }
10974 pub fn as_raw_response(&self) -> &azure_core::http::Response {
10975 &self.0
10976 }
10977 }
10978 impl From<Response> for azure_core::http::Response {
10979 fn from(rsp: Response) -> Self {
10980 rsp.into_raw_response()
10981 }
10982 }
10983 impl AsRef<azure_core::http::Response> for Response {
10984 fn as_ref(&self) -> &azure_core::http::Response {
10985 self.as_raw_response()
10986 }
10987 }
10988 #[derive(Clone)]
10989 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
10990 #[doc = r""]
10991 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
10992 #[doc = r" parameters can be chained."]
10993 #[doc = r""]
10994 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
10995 #[doc = r" converts the [`RequestBuilder`] into a future,"]
10996 #[doc = r" executes the request and returns a `Result` with the parsed"]
10997 #[doc = r" response."]
10998 #[doc = r""]
10999 #[doc = r" If you need lower-level access to the raw response details"]
11000 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11001 #[doc = r" can finalize the request using the"]
11002 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11003 #[doc = r" that resolves to a lower-level [`Response`] value."]
11004 pub struct RequestBuilder {
11005 pub(crate) client: super::super::Client,
11006 pub(crate) organization: String,
11007 pub(crate) repository_id: String,
11008 pub(crate) pull_request_id: i32,
11009 pub(crate) iteration_id: i32,
11010 pub(crate) status_id: i32,
11011 pub(crate) project: String,
11012 }
11013 impl RequestBuilder {
11014 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11015 #[doc = ""]
11016 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11017 #[doc = "However, this function can provide more flexibility when required."]
11018 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11019 Box::pin({
11020 let this = self.clone();
11021 async move {
11022 let url = this.url()?;
11023 let mut req =
11024 azure_core::http::Request::new(url, azure_core::http::Method::Get);
11025 if let Some(auth_header) = this
11026 .client
11027 .token_credential()
11028 .http_authorization_header(&this.client.scopes())
11029 .await?
11030 {
11031 req.insert_header(
11032 azure_core::http::headers::AUTHORIZATION,
11033 auth_header,
11034 );
11035 }
11036 let req_body = azure_core::Bytes::new();
11037 req.set_body(req_body);
11038 Ok(Response(this.client.send(&mut req).await?))
11039 }
11040 })
11041 }
11042 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
11043 let mut url = azure_core::http::Url::parse(&format!(
11044 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses/{}",
11045 self.client.endpoint(),
11046 &self.organization,
11047 &self.project,
11048 &self.repository_id,
11049 &self.pull_request_id,
11050 &self.iteration_id,
11051 &self.status_id
11052 ))?;
11053 let has_api_version_already = url
11054 .query_pairs()
11055 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
11056 if !has_api_version_already {
11057 url.query_pairs_mut().append_pair(
11058 azure_core::http::headers::query_param::API_VERSION,
11059 "7.1-preview",
11060 );
11061 }
11062 Ok(url)
11063 }
11064 }
11065 impl std::future::IntoFuture for RequestBuilder {
11066 type Output = azure_core::Result<models::GitPullRequestStatus>;
11067 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequestStatus>>;
11068 #[doc = "Returns a future that sends the request and returns the parsed response body."]
11069 #[doc = ""]
11070 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
11071 #[doc = ""]
11072 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
11073 fn into_future(self) -> Self::IntoFuture {
11074 Box::pin(async move { self.send().await?.into_raw_body().await })
11075 }
11076 }
11077 }
11078 pub mod delete {
11079 use super::models;
11080 #[cfg(not(target_arch = "wasm32"))]
11081 use futures::future::BoxFuture;
11082 #[cfg(target_arch = "wasm32")]
11083 use futures::future::LocalBoxFuture as BoxFuture;
11084 #[derive(Debug)]
11085 pub struct Response(azure_core::http::Response);
11086 impl Response {
11087 pub fn into_raw_response(self) -> azure_core::http::Response {
11088 self.0
11089 }
11090 pub fn as_raw_response(&self) -> &azure_core::http::Response {
11091 &self.0
11092 }
11093 }
11094 impl From<Response> for azure_core::http::Response {
11095 fn from(rsp: Response) -> Self {
11096 rsp.into_raw_response()
11097 }
11098 }
11099 impl AsRef<azure_core::http::Response> for Response {
11100 fn as_ref(&self) -> &azure_core::http::Response {
11101 self.as_raw_response()
11102 }
11103 }
11104 #[derive(Clone)]
11105 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
11106 #[doc = r""]
11107 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
11108 #[doc = r" parameters can be chained."]
11109 #[doc = r""]
11110 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
11111 #[doc = r" converts the [`RequestBuilder`] into a future,"]
11112 #[doc = r" executes the request and returns a `Result` with the parsed"]
11113 #[doc = r" response."]
11114 #[doc = r""]
11115 #[doc = r" If you need lower-level access to the raw response details"]
11116 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11117 #[doc = r" can finalize the request using the"]
11118 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11119 #[doc = r" that resolves to a lower-level [`Response`] value."]
11120 pub struct RequestBuilder {
11121 pub(crate) client: super::super::Client,
11122 pub(crate) organization: String,
11123 pub(crate) repository_id: String,
11124 pub(crate) pull_request_id: i32,
11125 pub(crate) iteration_id: i32,
11126 pub(crate) status_id: i32,
11127 pub(crate) project: String,
11128 }
11129 impl RequestBuilder {
11130 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11131 #[doc = ""]
11132 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11133 #[doc = "However, this function can provide more flexibility when required."]
11134 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11135 Box::pin({
11136 let this = self.clone();
11137 async move {
11138 let url = this.url()?;
11139 let mut req =
11140 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
11141 if let Some(auth_header) = this
11142 .client
11143 .token_credential()
11144 .http_authorization_header(&this.client.scopes())
11145 .await?
11146 {
11147 req.insert_header(
11148 azure_core::http::headers::AUTHORIZATION,
11149 auth_header,
11150 );
11151 }
11152 let req_body = azure_core::Bytes::new();
11153 req.set_body(req_body);
11154 Ok(Response(this.client.send(&mut req).await?))
11155 }
11156 })
11157 }
11158 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
11159 let mut url = azure_core::http::Url::parse(&format!(
11160 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses/{}",
11161 self.client.endpoint(),
11162 &self.organization,
11163 &self.project,
11164 &self.repository_id,
11165 &self.pull_request_id,
11166 &self.iteration_id,
11167 &self.status_id
11168 ))?;
11169 let has_api_version_already = url
11170 .query_pairs()
11171 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
11172 if !has_api_version_already {
11173 url.query_pairs_mut().append_pair(
11174 azure_core::http::headers::query_param::API_VERSION,
11175 "7.1-preview",
11176 );
11177 }
11178 Ok(url)
11179 }
11180 }
11181 impl std::future::IntoFuture for RequestBuilder {
11182 type Output = azure_core::Result<()>;
11183 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
11184 #[doc = "Returns a future that sends the request and waits for the response."]
11185 #[doc = ""]
11186 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
11187 #[doc = ""]
11188 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
11189 fn into_future(self) -> Self::IntoFuture {
11190 Box::pin(async move {
11191 let _rsp = self.send().await?;
11192 Ok(())
11193 })
11194 }
11195 }
11196 }
11197}
11198pub mod pull_request_labels {
11199 use super::models;
11200 #[cfg(not(target_arch = "wasm32"))]
11201 use futures::future::BoxFuture;
11202 #[cfg(target_arch = "wasm32")]
11203 use futures::future::LocalBoxFuture as BoxFuture;
11204 pub struct Client(pub(crate) super::Client);
11205 impl Client {
11206 #[doc = "Get all the labels (tags) assigned to a pull request."]
11207 #[doc = ""]
11208 #[doc = "Arguments:"]
11209 #[doc = "* `organization`: The name of the Azure DevOps organization."]
11210 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
11211 #[doc = "* `pull_request_id`: ID of the pull request."]
11212 #[doc = "* `project`: Project ID or project name"]
11213 pub fn list(
11214 &self,
11215 organization: impl Into<String>,
11216 repository_id: impl Into<String>,
11217 pull_request_id: i32,
11218 project: impl Into<String>,
11219 ) -> list::RequestBuilder {
11220 list::RequestBuilder {
11221 client: self.0.clone(),
11222 organization: organization.into(),
11223 repository_id: repository_id.into(),
11224 pull_request_id,
11225 project: project.into(),
11226 project_id: None,
11227 }
11228 }
11229 #[doc = "Create a tag (if that does not exists yet) and add that as a label (tag) for a specified pull request. The only required field is the name of the new label (tag)."]
11230 #[doc = ""]
11231 #[doc = "Arguments:"]
11232 #[doc = "* `organization`: The name of the Azure DevOps organization."]
11233 #[doc = "* `body`: Label to assign to the pull request."]
11234 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
11235 #[doc = "* `pull_request_id`: ID of the pull request."]
11236 #[doc = "* `project`: Project ID or project name"]
11237 pub fn create(
11238 &self,
11239 organization: impl Into<String>,
11240 body: impl Into<models::WebApiCreateTagRequestData>,
11241 repository_id: impl Into<String>,
11242 pull_request_id: i32,
11243 project: impl Into<String>,
11244 ) -> create::RequestBuilder {
11245 create::RequestBuilder {
11246 client: self.0.clone(),
11247 organization: organization.into(),
11248 body: body.into(),
11249 repository_id: repository_id.into(),
11250 pull_request_id,
11251 project: project.into(),
11252 project_id: None,
11253 }
11254 }
11255 #[doc = "Retrieves a single label (tag) that has been assigned to a pull request."]
11256 #[doc = ""]
11257 #[doc = "Arguments:"]
11258 #[doc = "* `organization`: The name of the Azure DevOps organization."]
11259 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
11260 #[doc = "* `pull_request_id`: ID of the pull request."]
11261 #[doc = "* `label_id_or_name`: The name or ID of the label requested."]
11262 #[doc = "* `project`: Project ID or project name"]
11263 pub fn get(
11264 &self,
11265 organization: impl Into<String>,
11266 repository_id: impl Into<String>,
11267 pull_request_id: i32,
11268 label_id_or_name: impl Into<String>,
11269 project: impl Into<String>,
11270 ) -> get::RequestBuilder {
11271 get::RequestBuilder {
11272 client: self.0.clone(),
11273 organization: organization.into(),
11274 repository_id: repository_id.into(),
11275 pull_request_id,
11276 label_id_or_name: label_id_or_name.into(),
11277 project: project.into(),
11278 project_id: None,
11279 }
11280 }
11281 #[doc = "Removes a label (tag) from the set of those assigned to the pull request. The tag itself will not be deleted."]
11282 #[doc = ""]
11283 #[doc = "Arguments:"]
11284 #[doc = "* `organization`: The name of the Azure DevOps organization."]
11285 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
11286 #[doc = "* `pull_request_id`: ID of the pull request."]
11287 #[doc = "* `label_id_or_name`: The name or ID of the label requested."]
11288 #[doc = "* `project`: Project ID or project name"]
11289 pub fn delete(
11290 &self,
11291 organization: impl Into<String>,
11292 repository_id: impl Into<String>,
11293 pull_request_id: i32,
11294 label_id_or_name: impl Into<String>,
11295 project: impl Into<String>,
11296 ) -> delete::RequestBuilder {
11297 delete::RequestBuilder {
11298 client: self.0.clone(),
11299 organization: organization.into(),
11300 repository_id: repository_id.into(),
11301 pull_request_id,
11302 label_id_or_name: label_id_or_name.into(),
11303 project: project.into(),
11304 project_id: None,
11305 }
11306 }
11307 }
11308 pub mod list {
11309 use super::models;
11310 #[cfg(not(target_arch = "wasm32"))]
11311 use futures::future::BoxFuture;
11312 #[cfg(target_arch = "wasm32")]
11313 use futures::future::LocalBoxFuture as BoxFuture;
11314 #[derive(Debug)]
11315 pub struct Response(azure_core::http::Response);
11316 impl Response {
11317 pub async fn into_raw_body(
11318 self,
11319 ) -> azure_core::Result<models::WebApiTagDefinitionList> {
11320 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
11321 let body: models::WebApiTagDefinitionList = serde_json::from_slice(&bytes)
11322 .map_err(|e| {
11323 azure_core::error::Error::full(
11324 azure_core::error::ErrorKind::DataConversion,
11325 e,
11326 format!(
11327 "Failed to deserialize response:\n{}",
11328 String::from_utf8_lossy(&bytes)
11329 ),
11330 )
11331 })?;
11332 Ok(body)
11333 }
11334 pub fn into_raw_response(self) -> azure_core::http::Response {
11335 self.0
11336 }
11337 pub fn as_raw_response(&self) -> &azure_core::http::Response {
11338 &self.0
11339 }
11340 }
11341 impl From<Response> for azure_core::http::Response {
11342 fn from(rsp: Response) -> Self {
11343 rsp.into_raw_response()
11344 }
11345 }
11346 impl AsRef<azure_core::http::Response> for Response {
11347 fn as_ref(&self) -> &azure_core::http::Response {
11348 self.as_raw_response()
11349 }
11350 }
11351 #[derive(Clone)]
11352 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
11353 #[doc = r""]
11354 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
11355 #[doc = r" parameters can be chained."]
11356 #[doc = r""]
11357 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
11358 #[doc = r" converts the [`RequestBuilder`] into a future,"]
11359 #[doc = r" executes the request and returns a `Result` with the parsed"]
11360 #[doc = r" response."]
11361 #[doc = r""]
11362 #[doc = r" If you need lower-level access to the raw response details"]
11363 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11364 #[doc = r" can finalize the request using the"]
11365 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11366 #[doc = r" that resolves to a lower-level [`Response`] value."]
11367 pub struct RequestBuilder {
11368 pub(crate) client: super::super::Client,
11369 pub(crate) organization: String,
11370 pub(crate) repository_id: String,
11371 pub(crate) pull_request_id: i32,
11372 pub(crate) project: String,
11373 pub(crate) project_id: Option<String>,
11374 }
11375 impl RequestBuilder {
11376 #[doc = "Project ID or project name."]
11377 pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
11378 self.project_id = Some(project_id.into());
11379 self
11380 }
11381 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11382 #[doc = ""]
11383 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11384 #[doc = "However, this function can provide more flexibility when required."]
11385 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11386 Box::pin({
11387 let this = self.clone();
11388 async move {
11389 let url = this.url()?;
11390 let mut req =
11391 azure_core::http::Request::new(url, azure_core::http::Method::Get);
11392 if let Some(auth_header) = this
11393 .client
11394 .token_credential()
11395 .http_authorization_header(&this.client.scopes())
11396 .await?
11397 {
11398 req.insert_header(
11399 azure_core::http::headers::AUTHORIZATION,
11400 auth_header,
11401 );
11402 }
11403 if let Some(project_id) = &this.project_id {
11404 req.url_mut()
11405 .query_pairs_mut()
11406 .append_pair("projectId", project_id);
11407 }
11408 let req_body = azure_core::Bytes::new();
11409 req.set_body(req_body);
11410 Ok(Response(this.client.send(&mut req).await?))
11411 }
11412 })
11413 }
11414 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
11415 let mut url = azure_core::http::Url::parse(&format!(
11416 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/labels",
11417 self.client.endpoint(),
11418 &self.organization,
11419 &self.project,
11420 &self.repository_id,
11421 &self.pull_request_id
11422 ))?;
11423 let has_api_version_already = url
11424 .query_pairs()
11425 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
11426 if !has_api_version_already {
11427 url.query_pairs_mut().append_pair(
11428 azure_core::http::headers::query_param::API_VERSION,
11429 "7.1-preview",
11430 );
11431 }
11432 Ok(url)
11433 }
11434 }
11435 impl std::future::IntoFuture for RequestBuilder {
11436 type Output = azure_core::Result<models::WebApiTagDefinitionList>;
11437 type IntoFuture =
11438 BoxFuture<'static, azure_core::Result<models::WebApiTagDefinitionList>>;
11439 #[doc = "Returns a future that sends the request and returns the parsed response body."]
11440 #[doc = ""]
11441 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
11442 #[doc = ""]
11443 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
11444 fn into_future(self) -> Self::IntoFuture {
11445 Box::pin(async move { self.send().await?.into_raw_body().await })
11446 }
11447 }
11448 }
11449 pub mod create {
11450 use super::models;
11451 #[cfg(not(target_arch = "wasm32"))]
11452 use futures::future::BoxFuture;
11453 #[cfg(target_arch = "wasm32")]
11454 use futures::future::LocalBoxFuture as BoxFuture;
11455 #[derive(Debug)]
11456 pub struct Response(azure_core::http::Response);
11457 impl Response {
11458 pub async fn into_raw_body(self) -> azure_core::Result<models::WebApiTagDefinition> {
11459 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
11460 let body: models::WebApiTagDefinition =
11461 serde_json::from_slice(&bytes).map_err(|e| {
11462 azure_core::error::Error::full(
11463 azure_core::error::ErrorKind::DataConversion,
11464 e,
11465 format!(
11466 "Failed to deserialize response:\n{}",
11467 String::from_utf8_lossy(&bytes)
11468 ),
11469 )
11470 })?;
11471 Ok(body)
11472 }
11473 pub fn into_raw_response(self) -> azure_core::http::Response {
11474 self.0
11475 }
11476 pub fn as_raw_response(&self) -> &azure_core::http::Response {
11477 &self.0
11478 }
11479 }
11480 impl From<Response> for azure_core::http::Response {
11481 fn from(rsp: Response) -> Self {
11482 rsp.into_raw_response()
11483 }
11484 }
11485 impl AsRef<azure_core::http::Response> for Response {
11486 fn as_ref(&self) -> &azure_core::http::Response {
11487 self.as_raw_response()
11488 }
11489 }
11490 #[derive(Clone)]
11491 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
11492 #[doc = r""]
11493 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
11494 #[doc = r" parameters can be chained."]
11495 #[doc = r""]
11496 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
11497 #[doc = r" converts the [`RequestBuilder`] into a future,"]
11498 #[doc = r" executes the request and returns a `Result` with the parsed"]
11499 #[doc = r" response."]
11500 #[doc = r""]
11501 #[doc = r" If you need lower-level access to the raw response details"]
11502 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11503 #[doc = r" can finalize the request using the"]
11504 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11505 #[doc = r" that resolves to a lower-level [`Response`] value."]
11506 pub struct RequestBuilder {
11507 pub(crate) client: super::super::Client,
11508 pub(crate) organization: String,
11509 pub(crate) body: models::WebApiCreateTagRequestData,
11510 pub(crate) repository_id: String,
11511 pub(crate) pull_request_id: i32,
11512 pub(crate) project: String,
11513 pub(crate) project_id: Option<String>,
11514 }
11515 impl RequestBuilder {
11516 #[doc = "Project ID or project name."]
11517 pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
11518 self.project_id = Some(project_id.into());
11519 self
11520 }
11521 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11522 #[doc = ""]
11523 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11524 #[doc = "However, this function can provide more flexibility when required."]
11525 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11526 Box::pin({
11527 let this = self.clone();
11528 async move {
11529 let url = this.url()?;
11530 let mut req =
11531 azure_core::http::Request::new(url, azure_core::http::Method::Post);
11532 if let Some(auth_header) = this
11533 .client
11534 .token_credential()
11535 .http_authorization_header(&this.client.scopes())
11536 .await?
11537 {
11538 req.insert_header(
11539 azure_core::http::headers::AUTHORIZATION,
11540 auth_header,
11541 );
11542 }
11543 req.insert_header("content-type", "application/json");
11544 let req_body = azure_core::json::to_json(&this.body)?;
11545 if let Some(project_id) = &this.project_id {
11546 req.url_mut()
11547 .query_pairs_mut()
11548 .append_pair("projectId", project_id);
11549 }
11550 req.set_body(req_body);
11551 Ok(Response(this.client.send(&mut req).await?))
11552 }
11553 })
11554 }
11555 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
11556 let mut url = azure_core::http::Url::parse(&format!(
11557 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/labels",
11558 self.client.endpoint(),
11559 &self.organization,
11560 &self.project,
11561 &self.repository_id,
11562 &self.pull_request_id
11563 ))?;
11564 let has_api_version_already = url
11565 .query_pairs()
11566 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
11567 if !has_api_version_already {
11568 url.query_pairs_mut().append_pair(
11569 azure_core::http::headers::query_param::API_VERSION,
11570 "7.1-preview",
11571 );
11572 }
11573 Ok(url)
11574 }
11575 }
11576 impl std::future::IntoFuture for RequestBuilder {
11577 type Output = azure_core::Result<models::WebApiTagDefinition>;
11578 type IntoFuture = BoxFuture<'static, azure_core::Result<models::WebApiTagDefinition>>;
11579 #[doc = "Returns a future that sends the request and returns the parsed response body."]
11580 #[doc = ""]
11581 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
11582 #[doc = ""]
11583 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
11584 fn into_future(self) -> Self::IntoFuture {
11585 Box::pin(async move { self.send().await?.into_raw_body().await })
11586 }
11587 }
11588 }
11589 pub mod get {
11590 use super::models;
11591 #[cfg(not(target_arch = "wasm32"))]
11592 use futures::future::BoxFuture;
11593 #[cfg(target_arch = "wasm32")]
11594 use futures::future::LocalBoxFuture as BoxFuture;
11595 #[derive(Debug)]
11596 pub struct Response(azure_core::http::Response);
11597 impl Response {
11598 pub async fn into_raw_body(self) -> azure_core::Result<models::WebApiTagDefinition> {
11599 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
11600 let body: models::WebApiTagDefinition =
11601 serde_json::from_slice(&bytes).map_err(|e| {
11602 azure_core::error::Error::full(
11603 azure_core::error::ErrorKind::DataConversion,
11604 e,
11605 format!(
11606 "Failed to deserialize response:\n{}",
11607 String::from_utf8_lossy(&bytes)
11608 ),
11609 )
11610 })?;
11611 Ok(body)
11612 }
11613 pub fn into_raw_response(self) -> azure_core::http::Response {
11614 self.0
11615 }
11616 pub fn as_raw_response(&self) -> &azure_core::http::Response {
11617 &self.0
11618 }
11619 }
11620 impl From<Response> for azure_core::http::Response {
11621 fn from(rsp: Response) -> Self {
11622 rsp.into_raw_response()
11623 }
11624 }
11625 impl AsRef<azure_core::http::Response> for Response {
11626 fn as_ref(&self) -> &azure_core::http::Response {
11627 self.as_raw_response()
11628 }
11629 }
11630 #[derive(Clone)]
11631 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
11632 #[doc = r""]
11633 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
11634 #[doc = r" parameters can be chained."]
11635 #[doc = r""]
11636 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
11637 #[doc = r" converts the [`RequestBuilder`] into a future,"]
11638 #[doc = r" executes the request and returns a `Result` with the parsed"]
11639 #[doc = r" response."]
11640 #[doc = r""]
11641 #[doc = r" If you need lower-level access to the raw response details"]
11642 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11643 #[doc = r" can finalize the request using the"]
11644 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11645 #[doc = r" that resolves to a lower-level [`Response`] value."]
11646 pub struct RequestBuilder {
11647 pub(crate) client: super::super::Client,
11648 pub(crate) organization: String,
11649 pub(crate) repository_id: String,
11650 pub(crate) pull_request_id: i32,
11651 pub(crate) label_id_or_name: String,
11652 pub(crate) project: String,
11653 pub(crate) project_id: Option<String>,
11654 }
11655 impl RequestBuilder {
11656 #[doc = "Project ID or project name."]
11657 pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
11658 self.project_id = Some(project_id.into());
11659 self
11660 }
11661 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11662 #[doc = ""]
11663 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11664 #[doc = "However, this function can provide more flexibility when required."]
11665 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11666 Box::pin({
11667 let this = self.clone();
11668 async move {
11669 let url = this.url()?;
11670 let mut req =
11671 azure_core::http::Request::new(url, azure_core::http::Method::Get);
11672 if let Some(auth_header) = this
11673 .client
11674 .token_credential()
11675 .http_authorization_header(&this.client.scopes())
11676 .await?
11677 {
11678 req.insert_header(
11679 azure_core::http::headers::AUTHORIZATION,
11680 auth_header,
11681 );
11682 }
11683 if let Some(project_id) = &this.project_id {
11684 req.url_mut()
11685 .query_pairs_mut()
11686 .append_pair("projectId", project_id);
11687 }
11688 let req_body = azure_core::Bytes::new();
11689 req.set_body(req_body);
11690 Ok(Response(this.client.send(&mut req).await?))
11691 }
11692 })
11693 }
11694 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
11695 let mut url = azure_core::http::Url::parse(&format!(
11696 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/labels/{}",
11697 self.client.endpoint(),
11698 &self.organization,
11699 &self.project,
11700 &self.repository_id,
11701 &self.pull_request_id,
11702 &self.label_id_or_name
11703 ))?;
11704 let has_api_version_already = url
11705 .query_pairs()
11706 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
11707 if !has_api_version_already {
11708 url.query_pairs_mut().append_pair(
11709 azure_core::http::headers::query_param::API_VERSION,
11710 "7.1-preview",
11711 );
11712 }
11713 Ok(url)
11714 }
11715 }
11716 impl std::future::IntoFuture for RequestBuilder {
11717 type Output = azure_core::Result<models::WebApiTagDefinition>;
11718 type IntoFuture = BoxFuture<'static, azure_core::Result<models::WebApiTagDefinition>>;
11719 #[doc = "Returns a future that sends the request and returns the parsed response body."]
11720 #[doc = ""]
11721 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
11722 #[doc = ""]
11723 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
11724 fn into_future(self) -> Self::IntoFuture {
11725 Box::pin(async move { self.send().await?.into_raw_body().await })
11726 }
11727 }
11728 }
11729 pub mod delete {
11730 use super::models;
11731 #[cfg(not(target_arch = "wasm32"))]
11732 use futures::future::BoxFuture;
11733 #[cfg(target_arch = "wasm32")]
11734 use futures::future::LocalBoxFuture as BoxFuture;
11735 #[derive(Debug)]
11736 pub struct Response(azure_core::http::Response);
11737 impl Response {
11738 pub fn into_raw_response(self) -> azure_core::http::Response {
11739 self.0
11740 }
11741 pub fn as_raw_response(&self) -> &azure_core::http::Response {
11742 &self.0
11743 }
11744 }
11745 impl From<Response> for azure_core::http::Response {
11746 fn from(rsp: Response) -> Self {
11747 rsp.into_raw_response()
11748 }
11749 }
11750 impl AsRef<azure_core::http::Response> for Response {
11751 fn as_ref(&self) -> &azure_core::http::Response {
11752 self.as_raw_response()
11753 }
11754 }
11755 #[derive(Clone)]
11756 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
11757 #[doc = r""]
11758 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
11759 #[doc = r" parameters can be chained."]
11760 #[doc = r""]
11761 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
11762 #[doc = r" converts the [`RequestBuilder`] into a future,"]
11763 #[doc = r" executes the request and returns a `Result` with the parsed"]
11764 #[doc = r" response."]
11765 #[doc = r""]
11766 #[doc = r" If you need lower-level access to the raw response details"]
11767 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11768 #[doc = r" can finalize the request using the"]
11769 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11770 #[doc = r" that resolves to a lower-level [`Response`] value."]
11771 pub struct RequestBuilder {
11772 pub(crate) client: super::super::Client,
11773 pub(crate) organization: String,
11774 pub(crate) repository_id: String,
11775 pub(crate) pull_request_id: i32,
11776 pub(crate) label_id_or_name: String,
11777 pub(crate) project: String,
11778 pub(crate) project_id: Option<String>,
11779 }
11780 impl RequestBuilder {
11781 #[doc = "Project ID or project name."]
11782 pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
11783 self.project_id = Some(project_id.into());
11784 self
11785 }
11786 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11787 #[doc = ""]
11788 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11789 #[doc = "However, this function can provide more flexibility when required."]
11790 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11791 Box::pin({
11792 let this = self.clone();
11793 async move {
11794 let url = this.url()?;
11795 let mut req =
11796 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
11797 if let Some(auth_header) = this
11798 .client
11799 .token_credential()
11800 .http_authorization_header(&this.client.scopes())
11801 .await?
11802 {
11803 req.insert_header(
11804 azure_core::http::headers::AUTHORIZATION,
11805 auth_header,
11806 );
11807 }
11808 if let Some(project_id) = &this.project_id {
11809 req.url_mut()
11810 .query_pairs_mut()
11811 .append_pair("projectId", project_id);
11812 }
11813 let req_body = azure_core::Bytes::new();
11814 req.set_body(req_body);
11815 Ok(Response(this.client.send(&mut req).await?))
11816 }
11817 })
11818 }
11819 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
11820 let mut url = azure_core::http::Url::parse(&format!(
11821 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/labels/{}",
11822 self.client.endpoint(),
11823 &self.organization,
11824 &self.project,
11825 &self.repository_id,
11826 &self.pull_request_id,
11827 &self.label_id_or_name
11828 ))?;
11829 let has_api_version_already = url
11830 .query_pairs()
11831 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
11832 if !has_api_version_already {
11833 url.query_pairs_mut().append_pair(
11834 azure_core::http::headers::query_param::API_VERSION,
11835 "7.1-preview",
11836 );
11837 }
11838 Ok(url)
11839 }
11840 }
11841 impl std::future::IntoFuture for RequestBuilder {
11842 type Output = azure_core::Result<()>;
11843 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
11844 #[doc = "Returns a future that sends the request and waits for the response."]
11845 #[doc = ""]
11846 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
11847 #[doc = ""]
11848 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
11849 fn into_future(self) -> Self::IntoFuture {
11850 Box::pin(async move {
11851 let _rsp = self.send().await?;
11852 Ok(())
11853 })
11854 }
11855 }
11856 }
11857}
11858pub mod pull_request_properties {
11859 use super::models;
11860 #[cfg(not(target_arch = "wasm32"))]
11861 use futures::future::BoxFuture;
11862 #[cfg(target_arch = "wasm32")]
11863 use futures::future::LocalBoxFuture as BoxFuture;
11864 pub struct Client(pub(crate) super::Client);
11865 impl Client {
11866 #[doc = "Get external properties of the pull request."]
11867 #[doc = ""]
11868 #[doc = "Arguments:"]
11869 #[doc = "* `organization`: The name of the Azure DevOps organization."]
11870 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
11871 #[doc = "* `pull_request_id`: ID of the pull request."]
11872 #[doc = "* `project`: Project ID or project name"]
11873 pub fn list(
11874 &self,
11875 organization: impl Into<String>,
11876 repository_id: impl Into<String>,
11877 pull_request_id: i32,
11878 project: impl Into<String>,
11879 ) -> list::RequestBuilder {
11880 list::RequestBuilder {
11881 client: self.0.clone(),
11882 organization: organization.into(),
11883 repository_id: repository_id.into(),
11884 pull_request_id,
11885 project: project.into(),
11886 }
11887 }
11888 #[doc = "Create or update pull request external properties. The patch operation can be `add`, `replace` or `remove`. For `add` operation, the path can be empty. If the path is empty, the value must be a list of key value pairs. For `replace` operation, the path cannot be empty. If the path does not exist, the property will be added to the collection. For `remove` operation, the path cannot be empty. If the path does not exist, no action will be performed."]
11889 #[doc = ""]
11890 #[doc = "Arguments:"]
11891 #[doc = "* `organization`: The name of the Azure DevOps organization."]
11892 #[doc = "* `body`: Properties to add, replace or remove in JSON Patch format."]
11893 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
11894 #[doc = "* `pull_request_id`: ID of the pull request."]
11895 #[doc = "* `project`: Project ID or project name"]
11896 pub fn update(
11897 &self,
11898 organization: impl Into<String>,
11899 body: impl Into<models::JsonPatchDocument>,
11900 repository_id: impl Into<String>,
11901 pull_request_id: i32,
11902 project: impl Into<String>,
11903 ) -> update::RequestBuilder {
11904 update::RequestBuilder {
11905 client: self.0.clone(),
11906 organization: organization.into(),
11907 body: body.into(),
11908 repository_id: repository_id.into(),
11909 pull_request_id,
11910 project: project.into(),
11911 }
11912 }
11913 }
11914 pub mod list {
11915 use super::models;
11916 #[cfg(not(target_arch = "wasm32"))]
11917 use futures::future::BoxFuture;
11918 #[cfg(target_arch = "wasm32")]
11919 use futures::future::LocalBoxFuture as BoxFuture;
11920 #[derive(Debug)]
11921 pub struct Response(azure_core::http::Response);
11922 impl Response {
11923 pub async fn into_raw_body(self) -> azure_core::Result<models::PropertiesCollection> {
11924 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
11925 let body: models::PropertiesCollection =
11926 serde_json::from_slice(&bytes).map_err(|e| {
11927 azure_core::error::Error::full(
11928 azure_core::error::ErrorKind::DataConversion,
11929 e,
11930 format!(
11931 "Failed to deserialize response:\n{}",
11932 String::from_utf8_lossy(&bytes)
11933 ),
11934 )
11935 })?;
11936 Ok(body)
11937 }
11938 pub fn into_raw_response(self) -> azure_core::http::Response {
11939 self.0
11940 }
11941 pub fn as_raw_response(&self) -> &azure_core::http::Response {
11942 &self.0
11943 }
11944 }
11945 impl From<Response> for azure_core::http::Response {
11946 fn from(rsp: Response) -> Self {
11947 rsp.into_raw_response()
11948 }
11949 }
11950 impl AsRef<azure_core::http::Response> for Response {
11951 fn as_ref(&self) -> &azure_core::http::Response {
11952 self.as_raw_response()
11953 }
11954 }
11955 #[derive(Clone)]
11956 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
11957 #[doc = r""]
11958 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
11959 #[doc = r" parameters can be chained."]
11960 #[doc = r""]
11961 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
11962 #[doc = r" converts the [`RequestBuilder`] into a future,"]
11963 #[doc = r" executes the request and returns a `Result` with the parsed"]
11964 #[doc = r" response."]
11965 #[doc = r""]
11966 #[doc = r" If you need lower-level access to the raw response details"]
11967 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
11968 #[doc = r" can finalize the request using the"]
11969 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
11970 #[doc = r" that resolves to a lower-level [`Response`] value."]
11971 pub struct RequestBuilder {
11972 pub(crate) client: super::super::Client,
11973 pub(crate) organization: String,
11974 pub(crate) repository_id: String,
11975 pub(crate) pull_request_id: i32,
11976 pub(crate) project: String,
11977 }
11978 impl RequestBuilder {
11979 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
11980 #[doc = ""]
11981 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
11982 #[doc = "However, this function can provide more flexibility when required."]
11983 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
11984 Box::pin({
11985 let this = self.clone();
11986 async move {
11987 let url = this.url()?;
11988 let mut req =
11989 azure_core::http::Request::new(url, azure_core::http::Method::Get);
11990 if let Some(auth_header) = this
11991 .client
11992 .token_credential()
11993 .http_authorization_header(&this.client.scopes())
11994 .await?
11995 {
11996 req.insert_header(
11997 azure_core::http::headers::AUTHORIZATION,
11998 auth_header,
11999 );
12000 }
12001 let req_body = azure_core::Bytes::new();
12002 req.set_body(req_body);
12003 Ok(Response(this.client.send(&mut req).await?))
12004 }
12005 })
12006 }
12007 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
12008 let mut url = azure_core::http::Url::parse(&format!(
12009 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/properties",
12010 self.client.endpoint(),
12011 &self.organization,
12012 &self.project,
12013 &self.repository_id,
12014 &self.pull_request_id
12015 ))?;
12016 let has_api_version_already = url
12017 .query_pairs()
12018 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
12019 if !has_api_version_already {
12020 url.query_pairs_mut().append_pair(
12021 azure_core::http::headers::query_param::API_VERSION,
12022 "7.1-preview",
12023 );
12024 }
12025 Ok(url)
12026 }
12027 }
12028 impl std::future::IntoFuture for RequestBuilder {
12029 type Output = azure_core::Result<models::PropertiesCollection>;
12030 type IntoFuture = BoxFuture<'static, azure_core::Result<models::PropertiesCollection>>;
12031 #[doc = "Returns a future that sends the request and returns the parsed response body."]
12032 #[doc = ""]
12033 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
12034 #[doc = ""]
12035 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
12036 fn into_future(self) -> Self::IntoFuture {
12037 Box::pin(async move { self.send().await?.into_raw_body().await })
12038 }
12039 }
12040 }
12041 pub mod update {
12042 use super::models;
12043 #[cfg(not(target_arch = "wasm32"))]
12044 use futures::future::BoxFuture;
12045 #[cfg(target_arch = "wasm32")]
12046 use futures::future::LocalBoxFuture as BoxFuture;
12047 #[derive(Debug)]
12048 pub struct Response(azure_core::http::Response);
12049 impl Response {
12050 pub async fn into_raw_body(self) -> azure_core::Result<models::PropertiesCollection> {
12051 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
12052 let body: models::PropertiesCollection =
12053 serde_json::from_slice(&bytes).map_err(|e| {
12054 azure_core::error::Error::full(
12055 azure_core::error::ErrorKind::DataConversion,
12056 e,
12057 format!(
12058 "Failed to deserialize response:\n{}",
12059 String::from_utf8_lossy(&bytes)
12060 ),
12061 )
12062 })?;
12063 Ok(body)
12064 }
12065 pub fn into_raw_response(self) -> azure_core::http::Response {
12066 self.0
12067 }
12068 pub fn as_raw_response(&self) -> &azure_core::http::Response {
12069 &self.0
12070 }
12071 }
12072 impl From<Response> for azure_core::http::Response {
12073 fn from(rsp: Response) -> Self {
12074 rsp.into_raw_response()
12075 }
12076 }
12077 impl AsRef<azure_core::http::Response> for Response {
12078 fn as_ref(&self) -> &azure_core::http::Response {
12079 self.as_raw_response()
12080 }
12081 }
12082 #[derive(Clone)]
12083 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12084 #[doc = r""]
12085 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12086 #[doc = r" parameters can be chained."]
12087 #[doc = r""]
12088 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12089 #[doc = r" converts the [`RequestBuilder`] into a future,"]
12090 #[doc = r" executes the request and returns a `Result` with the parsed"]
12091 #[doc = r" response."]
12092 #[doc = r""]
12093 #[doc = r" If you need lower-level access to the raw response details"]
12094 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12095 #[doc = r" can finalize the request using the"]
12096 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12097 #[doc = r" that resolves to a lower-level [`Response`] value."]
12098 pub struct RequestBuilder {
12099 pub(crate) client: super::super::Client,
12100 pub(crate) organization: String,
12101 pub(crate) body: models::JsonPatchDocument,
12102 pub(crate) repository_id: String,
12103 pub(crate) pull_request_id: i32,
12104 pub(crate) project: String,
12105 }
12106 impl RequestBuilder {
12107 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
12108 #[doc = ""]
12109 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
12110 #[doc = "However, this function can provide more flexibility when required."]
12111 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
12112 Box::pin({
12113 let this = self.clone();
12114 async move {
12115 let url = this.url()?;
12116 let mut req =
12117 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
12118 if let Some(auth_header) = this
12119 .client
12120 .token_credential()
12121 .http_authorization_header(&this.client.scopes())
12122 .await?
12123 {
12124 req.insert_header(
12125 azure_core::http::headers::AUTHORIZATION,
12126 auth_header,
12127 );
12128 }
12129 req.insert_header("content-type", "application/json-patch+json");
12130 let req_body = azure_core::json::to_json(&this.body)?;
12131 req.set_body(req_body);
12132 Ok(Response(this.client.send(&mut req).await?))
12133 }
12134 })
12135 }
12136 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
12137 let mut url = azure_core::http::Url::parse(&format!(
12138 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/properties",
12139 self.client.endpoint(),
12140 &self.organization,
12141 &self.project,
12142 &self.repository_id,
12143 &self.pull_request_id
12144 ))?;
12145 let has_api_version_already = url
12146 .query_pairs()
12147 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
12148 if !has_api_version_already {
12149 url.query_pairs_mut().append_pair(
12150 azure_core::http::headers::query_param::API_VERSION,
12151 "7.1-preview",
12152 );
12153 }
12154 Ok(url)
12155 }
12156 }
12157 impl std::future::IntoFuture for RequestBuilder {
12158 type Output = azure_core::Result<models::PropertiesCollection>;
12159 type IntoFuture = BoxFuture<'static, azure_core::Result<models::PropertiesCollection>>;
12160 #[doc = "Returns a future that sends the request and returns the parsed response body."]
12161 #[doc = ""]
12162 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
12163 #[doc = ""]
12164 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
12165 fn into_future(self) -> Self::IntoFuture {
12166 Box::pin(async move { self.send().await?.into_raw_body().await })
12167 }
12168 }
12169 }
12170}
12171pub mod pull_request_reviewers {
12172 use super::models;
12173 #[cfg(not(target_arch = "wasm32"))]
12174 use futures::future::BoxFuture;
12175 #[cfg(target_arch = "wasm32")]
12176 use futures::future::LocalBoxFuture as BoxFuture;
12177 pub struct Client(pub(crate) super::Client);
12178 impl Client {
12179 #[doc = "Retrieve the reviewers for a pull request"]
12180 #[doc = ""]
12181 #[doc = "Arguments:"]
12182 #[doc = "* `organization`: The name of the Azure DevOps organization."]
12183 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
12184 #[doc = "* `pull_request_id`: ID of the pull request."]
12185 #[doc = "* `project`: Project ID or project name"]
12186 pub fn list(
12187 &self,
12188 organization: impl Into<String>,
12189 repository_id: impl Into<String>,
12190 pull_request_id: i32,
12191 project: impl Into<String>,
12192 ) -> list::RequestBuilder {
12193 list::RequestBuilder {
12194 client: self.0.clone(),
12195 organization: organization.into(),
12196 repository_id: repository_id.into(),
12197 pull_request_id,
12198 project: project.into(),
12199 }
12200 }
12201 #[doc = "Add reviewers to a pull request."]
12202 #[doc = ""]
12203 #[doc = "Arguments:"]
12204 #[doc = "* `organization`: The name of the Azure DevOps organization."]
12205 #[doc = "* `body`: Reviewers to add to the pull request."]
12206 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
12207 #[doc = "* `pull_request_id`: ID of the pull request."]
12208 #[doc = "* `project`: Project ID or project name"]
12209 pub fn create_pull_request_reviewers(
12210 &self,
12211 organization: impl Into<String>,
12212 body: Vec<models::IdentityRef>,
12213 repository_id: impl Into<String>,
12214 pull_request_id: i32,
12215 project: impl Into<String>,
12216 ) -> create_pull_request_reviewers::RequestBuilder {
12217 create_pull_request_reviewers::RequestBuilder {
12218 client: self.0.clone(),
12219 organization: organization.into(),
12220 body,
12221 repository_id: repository_id.into(),
12222 pull_request_id,
12223 project: project.into(),
12224 }
12225 }
12226 #[doc = "Add an unmaterialized identity to the reviewers of a pull request."]
12227 #[doc = ""]
12228 #[doc = "Arguments:"]
12229 #[doc = "* `organization`: The name of the Azure DevOps organization."]
12230 #[doc = "* `body`: Reviewer to add to the pull request."]
12231 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
12232 #[doc = "* `pull_request_id`: ID of the pull request."]
12233 #[doc = "* `project`: Project ID or project name"]
12234 pub fn create_unmaterialized_pull_request_reviewer(
12235 &self,
12236 organization: impl Into<String>,
12237 body: impl Into<models::IdentityRefWithVote>,
12238 repository_id: impl Into<String>,
12239 pull_request_id: i32,
12240 project: impl Into<String>,
12241 ) -> create_unmaterialized_pull_request_reviewer::RequestBuilder {
12242 create_unmaterialized_pull_request_reviewer::RequestBuilder {
12243 client: self.0.clone(),
12244 organization: organization.into(),
12245 body: body.into(),
12246 repository_id: repository_id.into(),
12247 pull_request_id,
12248 project: project.into(),
12249 }
12250 }
12251 #[doc = "Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names."]
12252 #[doc = ""]
12253 #[doc = "Arguments:"]
12254 #[doc = "* `organization`: The name of the Azure DevOps organization."]
12255 #[doc = "* `body`: IDs of the reviewers whose votes will be reset to zero"]
12256 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
12257 #[doc = "* `pull_request_id`: ID of the pull request"]
12258 #[doc = "* `project`: Project ID or project name"]
12259 pub fn update_pull_request_reviewers(
12260 &self,
12261 organization: impl Into<String>,
12262 body: Vec<models::IdentityRefWithVote>,
12263 repository_id: impl Into<String>,
12264 pull_request_id: i32,
12265 project: impl Into<String>,
12266 ) -> update_pull_request_reviewers::RequestBuilder {
12267 update_pull_request_reviewers::RequestBuilder {
12268 client: self.0.clone(),
12269 organization: organization.into(),
12270 body,
12271 repository_id: repository_id.into(),
12272 pull_request_id,
12273 project: project.into(),
12274 }
12275 }
12276 #[doc = "Retrieve information about a particular reviewer on a pull request"]
12277 #[doc = ""]
12278 #[doc = "Arguments:"]
12279 #[doc = "* `organization`: The name of the Azure DevOps organization."]
12280 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
12281 #[doc = "* `pull_request_id`: ID of the pull request."]
12282 #[doc = "* `reviewer_id`: ID of the reviewer."]
12283 #[doc = "* `project`: Project ID or project name"]
12284 pub fn get(
12285 &self,
12286 organization: impl Into<String>,
12287 repository_id: impl Into<String>,
12288 pull_request_id: i32,
12289 reviewer_id: impl Into<String>,
12290 project: impl Into<String>,
12291 ) -> get::RequestBuilder {
12292 get::RequestBuilder {
12293 client: self.0.clone(),
12294 organization: organization.into(),
12295 repository_id: repository_id.into(),
12296 pull_request_id,
12297 reviewer_id: reviewer_id.into(),
12298 project: project.into(),
12299 }
12300 }
12301 #[doc = "Add a reviewer to a pull request or cast a vote."]
12302 #[doc = ""]
12303 #[doc = "Arguments:"]
12304 #[doc = "* `organization`: The name of the Azure DevOps organization."]
12305 #[doc = "* `body`: Reviewer's vote.<br />If the reviewer's ID is included here, it must match the reviewerID parameter.<br />Reviewers can set their own vote with this method. When adding other reviewers, vote must be set to zero."]
12306 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
12307 #[doc = "* `pull_request_id`: ID of the pull request."]
12308 #[doc = "* `reviewer_id`: ID of the reviewer."]
12309 #[doc = "* `project`: Project ID or project name"]
12310 pub fn create_pull_request_reviewer(
12311 &self,
12312 organization: impl Into<String>,
12313 body: impl Into<models::IdentityRefWithVote>,
12314 repository_id: impl Into<String>,
12315 pull_request_id: i32,
12316 reviewer_id: impl Into<String>,
12317 project: impl Into<String>,
12318 ) -> create_pull_request_reviewer::RequestBuilder {
12319 create_pull_request_reviewer::RequestBuilder {
12320 client: self.0.clone(),
12321 organization: organization.into(),
12322 body: body.into(),
12323 repository_id: repository_id.into(),
12324 pull_request_id,
12325 reviewer_id: reviewer_id.into(),
12326 project: project.into(),
12327 }
12328 }
12329 #[doc = "Edit a reviewer entry. These fields are patchable: isFlagged, hasDeclined"]
12330 #[doc = ""]
12331 #[doc = "Arguments:"]
12332 #[doc = "* `organization`: The name of the Azure DevOps organization."]
12333 #[doc = "* `body`: Reviewer data.<br />If the reviewer's ID is included here, it must match the reviewerID parameter."]
12334 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
12335 #[doc = "* `pull_request_id`: ID of the pull request."]
12336 #[doc = "* `reviewer_id`: ID of the reviewer."]
12337 #[doc = "* `project`: Project ID or project name"]
12338 pub fn update_pull_request_reviewer(
12339 &self,
12340 organization: impl Into<String>,
12341 body: impl Into<models::IdentityRefWithVote>,
12342 repository_id: impl Into<String>,
12343 pull_request_id: i32,
12344 reviewer_id: impl Into<String>,
12345 project: impl Into<String>,
12346 ) -> update_pull_request_reviewer::RequestBuilder {
12347 update_pull_request_reviewer::RequestBuilder {
12348 client: self.0.clone(),
12349 organization: organization.into(),
12350 body: body.into(),
12351 repository_id: repository_id.into(),
12352 pull_request_id,
12353 reviewer_id: reviewer_id.into(),
12354 project: project.into(),
12355 }
12356 }
12357 #[doc = "Remove a reviewer from a pull request."]
12358 #[doc = ""]
12359 #[doc = "Arguments:"]
12360 #[doc = "* `organization`: The name of the Azure DevOps organization."]
12361 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
12362 #[doc = "* `pull_request_id`: ID of the pull request."]
12363 #[doc = "* `reviewer_id`: ID of the reviewer to remove."]
12364 #[doc = "* `project`: Project ID or project name"]
12365 pub fn delete(
12366 &self,
12367 organization: impl Into<String>,
12368 repository_id: impl Into<String>,
12369 pull_request_id: i32,
12370 reviewer_id: impl Into<String>,
12371 project: impl Into<String>,
12372 ) -> delete::RequestBuilder {
12373 delete::RequestBuilder {
12374 client: self.0.clone(),
12375 organization: organization.into(),
12376 repository_id: repository_id.into(),
12377 pull_request_id,
12378 reviewer_id: reviewer_id.into(),
12379 project: project.into(),
12380 }
12381 }
12382 }
12383 pub mod list {
12384 use super::models;
12385 #[cfg(not(target_arch = "wasm32"))]
12386 use futures::future::BoxFuture;
12387 #[cfg(target_arch = "wasm32")]
12388 use futures::future::LocalBoxFuture as BoxFuture;
12389 #[derive(Debug)]
12390 pub struct Response(azure_core::http::Response);
12391 impl Response {
12392 pub async fn into_raw_body(
12393 self,
12394 ) -> azure_core::Result<models::IdentityRefWithVoteList> {
12395 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
12396 let body: models::IdentityRefWithVoteList = serde_json::from_slice(&bytes)
12397 .map_err(|e| {
12398 azure_core::error::Error::full(
12399 azure_core::error::ErrorKind::DataConversion,
12400 e,
12401 format!(
12402 "Failed to deserialize response:\n{}",
12403 String::from_utf8_lossy(&bytes)
12404 ),
12405 )
12406 })?;
12407 Ok(body)
12408 }
12409 pub fn into_raw_response(self) -> azure_core::http::Response {
12410 self.0
12411 }
12412 pub fn as_raw_response(&self) -> &azure_core::http::Response {
12413 &self.0
12414 }
12415 }
12416 impl From<Response> for azure_core::http::Response {
12417 fn from(rsp: Response) -> Self {
12418 rsp.into_raw_response()
12419 }
12420 }
12421 impl AsRef<azure_core::http::Response> for Response {
12422 fn as_ref(&self) -> &azure_core::http::Response {
12423 self.as_raw_response()
12424 }
12425 }
12426 #[derive(Clone)]
12427 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12428 #[doc = r""]
12429 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12430 #[doc = r" parameters can be chained."]
12431 #[doc = r""]
12432 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12433 #[doc = r" converts the [`RequestBuilder`] into a future,"]
12434 #[doc = r" executes the request and returns a `Result` with the parsed"]
12435 #[doc = r" response."]
12436 #[doc = r""]
12437 #[doc = r" If you need lower-level access to the raw response details"]
12438 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12439 #[doc = r" can finalize the request using the"]
12440 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12441 #[doc = r" that resolves to a lower-level [`Response`] value."]
12442 pub struct RequestBuilder {
12443 pub(crate) client: super::super::Client,
12444 pub(crate) organization: String,
12445 pub(crate) repository_id: String,
12446 pub(crate) pull_request_id: i32,
12447 pub(crate) project: String,
12448 }
12449 impl RequestBuilder {
12450 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
12451 #[doc = ""]
12452 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
12453 #[doc = "However, this function can provide more flexibility when required."]
12454 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
12455 Box::pin({
12456 let this = self.clone();
12457 async move {
12458 let url = this.url()?;
12459 let mut req =
12460 azure_core::http::Request::new(url, azure_core::http::Method::Get);
12461 if let Some(auth_header) = this
12462 .client
12463 .token_credential()
12464 .http_authorization_header(&this.client.scopes())
12465 .await?
12466 {
12467 req.insert_header(
12468 azure_core::http::headers::AUTHORIZATION,
12469 auth_header,
12470 );
12471 }
12472 let req_body = azure_core::Bytes::new();
12473 req.set_body(req_body);
12474 Ok(Response(this.client.send(&mut req).await?))
12475 }
12476 })
12477 }
12478 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
12479 let mut url = azure_core::http::Url::parse(&format!(
12480 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers",
12481 self.client.endpoint(),
12482 &self.organization,
12483 &self.project,
12484 &self.repository_id,
12485 &self.pull_request_id
12486 ))?;
12487 let has_api_version_already = url
12488 .query_pairs()
12489 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
12490 if !has_api_version_already {
12491 url.query_pairs_mut().append_pair(
12492 azure_core::http::headers::query_param::API_VERSION,
12493 "7.1-preview",
12494 );
12495 }
12496 Ok(url)
12497 }
12498 }
12499 impl std::future::IntoFuture for RequestBuilder {
12500 type Output = azure_core::Result<models::IdentityRefWithVoteList>;
12501 type IntoFuture =
12502 BoxFuture<'static, azure_core::Result<models::IdentityRefWithVoteList>>;
12503 #[doc = "Returns a future that sends the request and returns the parsed response body."]
12504 #[doc = ""]
12505 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
12506 #[doc = ""]
12507 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
12508 fn into_future(self) -> Self::IntoFuture {
12509 Box::pin(async move { self.send().await?.into_raw_body().await })
12510 }
12511 }
12512 }
12513 pub mod create_pull_request_reviewers {
12514 use super::models;
12515 #[cfg(not(target_arch = "wasm32"))]
12516 use futures::future::BoxFuture;
12517 #[cfg(target_arch = "wasm32")]
12518 use futures::future::LocalBoxFuture as BoxFuture;
12519 #[derive(Debug)]
12520 pub struct Response(azure_core::http::Response);
12521 impl Response {
12522 pub async fn into_raw_body(
12523 self,
12524 ) -> azure_core::Result<models::IdentityRefWithVoteList> {
12525 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
12526 let body: models::IdentityRefWithVoteList = serde_json::from_slice(&bytes)
12527 .map_err(|e| {
12528 azure_core::error::Error::full(
12529 azure_core::error::ErrorKind::DataConversion,
12530 e,
12531 format!(
12532 "Failed to deserialize response:\n{}",
12533 String::from_utf8_lossy(&bytes)
12534 ),
12535 )
12536 })?;
12537 Ok(body)
12538 }
12539 pub fn into_raw_response(self) -> azure_core::http::Response {
12540 self.0
12541 }
12542 pub fn as_raw_response(&self) -> &azure_core::http::Response {
12543 &self.0
12544 }
12545 }
12546 impl From<Response> for azure_core::http::Response {
12547 fn from(rsp: Response) -> Self {
12548 rsp.into_raw_response()
12549 }
12550 }
12551 impl AsRef<azure_core::http::Response> for Response {
12552 fn as_ref(&self) -> &azure_core::http::Response {
12553 self.as_raw_response()
12554 }
12555 }
12556 #[derive(Clone)]
12557 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12558 #[doc = r""]
12559 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12560 #[doc = r" parameters can be chained."]
12561 #[doc = r""]
12562 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12563 #[doc = r" converts the [`RequestBuilder`] into a future,"]
12564 #[doc = r" executes the request and returns a `Result` with the parsed"]
12565 #[doc = r" response."]
12566 #[doc = r""]
12567 #[doc = r" If you need lower-level access to the raw response details"]
12568 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12569 #[doc = r" can finalize the request using the"]
12570 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12571 #[doc = r" that resolves to a lower-level [`Response`] value."]
12572 pub struct RequestBuilder {
12573 pub(crate) client: super::super::Client,
12574 pub(crate) organization: String,
12575 pub(crate) body: Vec<models::IdentityRef>,
12576 pub(crate) repository_id: String,
12577 pub(crate) pull_request_id: i32,
12578 pub(crate) project: String,
12579 }
12580 impl RequestBuilder {
12581 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
12582 #[doc = ""]
12583 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
12584 #[doc = "However, this function can provide more flexibility when required."]
12585 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
12586 Box::pin({
12587 let this = self.clone();
12588 async move {
12589 let url = this.url()?;
12590 let mut req =
12591 azure_core::http::Request::new(url, azure_core::http::Method::Post);
12592 if let Some(auth_header) = this
12593 .client
12594 .token_credential()
12595 .http_authorization_header(&this.client.scopes())
12596 .await?
12597 {
12598 req.insert_header(
12599 azure_core::http::headers::AUTHORIZATION,
12600 auth_header,
12601 );
12602 }
12603 req.insert_header("content-type", "application/json");
12604 let req_body = azure_core::json::to_json(&this.body)?;
12605 req.set_body(req_body);
12606 Ok(Response(this.client.send(&mut req).await?))
12607 }
12608 })
12609 }
12610 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
12611 let mut url = azure_core::http::Url::parse(&format!(
12612 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers",
12613 self.client.endpoint(),
12614 &self.organization,
12615 &self.project,
12616 &self.repository_id,
12617 &self.pull_request_id
12618 ))?;
12619 let has_api_version_already = url
12620 .query_pairs()
12621 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
12622 if !has_api_version_already {
12623 url.query_pairs_mut().append_pair(
12624 azure_core::http::headers::query_param::API_VERSION,
12625 "7.1-preview",
12626 );
12627 }
12628 Ok(url)
12629 }
12630 }
12631 impl std::future::IntoFuture for RequestBuilder {
12632 type Output = azure_core::Result<models::IdentityRefWithVoteList>;
12633 type IntoFuture =
12634 BoxFuture<'static, azure_core::Result<models::IdentityRefWithVoteList>>;
12635 #[doc = "Returns a future that sends the request and returns the parsed response body."]
12636 #[doc = ""]
12637 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
12638 #[doc = ""]
12639 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
12640 fn into_future(self) -> Self::IntoFuture {
12641 Box::pin(async move { self.send().await?.into_raw_body().await })
12642 }
12643 }
12644 }
12645 pub mod create_unmaterialized_pull_request_reviewer {
12646 use super::models;
12647 #[cfg(not(target_arch = "wasm32"))]
12648 use futures::future::BoxFuture;
12649 #[cfg(target_arch = "wasm32")]
12650 use futures::future::LocalBoxFuture as BoxFuture;
12651 #[derive(Debug)]
12652 pub struct Response(azure_core::http::Response);
12653 impl Response {
12654 pub async fn into_raw_body(self) -> azure_core::Result<models::IdentityRefWithVote> {
12655 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
12656 let body: models::IdentityRefWithVote =
12657 serde_json::from_slice(&bytes).map_err(|e| {
12658 azure_core::error::Error::full(
12659 azure_core::error::ErrorKind::DataConversion,
12660 e,
12661 format!(
12662 "Failed to deserialize response:\n{}",
12663 String::from_utf8_lossy(&bytes)
12664 ),
12665 )
12666 })?;
12667 Ok(body)
12668 }
12669 pub fn into_raw_response(self) -> azure_core::http::Response {
12670 self.0
12671 }
12672 pub fn as_raw_response(&self) -> &azure_core::http::Response {
12673 &self.0
12674 }
12675 }
12676 impl From<Response> for azure_core::http::Response {
12677 fn from(rsp: Response) -> Self {
12678 rsp.into_raw_response()
12679 }
12680 }
12681 impl AsRef<azure_core::http::Response> for Response {
12682 fn as_ref(&self) -> &azure_core::http::Response {
12683 self.as_raw_response()
12684 }
12685 }
12686 #[derive(Clone)]
12687 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12688 #[doc = r""]
12689 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12690 #[doc = r" parameters can be chained."]
12691 #[doc = r""]
12692 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12693 #[doc = r" converts the [`RequestBuilder`] into a future,"]
12694 #[doc = r" executes the request and returns a `Result` with the parsed"]
12695 #[doc = r" response."]
12696 #[doc = r""]
12697 #[doc = r" If you need lower-level access to the raw response details"]
12698 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12699 #[doc = r" can finalize the request using the"]
12700 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12701 #[doc = r" that resolves to a lower-level [`Response`] value."]
12702 pub struct RequestBuilder {
12703 pub(crate) client: super::super::Client,
12704 pub(crate) organization: String,
12705 pub(crate) body: models::IdentityRefWithVote,
12706 pub(crate) repository_id: String,
12707 pub(crate) pull_request_id: i32,
12708 pub(crate) project: String,
12709 }
12710 impl RequestBuilder {
12711 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
12712 #[doc = ""]
12713 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
12714 #[doc = "However, this function can provide more flexibility when required."]
12715 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
12716 Box::pin({
12717 let this = self.clone();
12718 async move {
12719 let url = this.url()?;
12720 let mut req =
12721 azure_core::http::Request::new(url, azure_core::http::Method::Put);
12722 if let Some(auth_header) = this
12723 .client
12724 .token_credential()
12725 .http_authorization_header(&this.client.scopes())
12726 .await?
12727 {
12728 req.insert_header(
12729 azure_core::http::headers::AUTHORIZATION,
12730 auth_header,
12731 );
12732 }
12733 req.insert_header("content-type", "application/json");
12734 let req_body = azure_core::json::to_json(&this.body)?;
12735 req.set_body(req_body);
12736 Ok(Response(this.client.send(&mut req).await?))
12737 }
12738 })
12739 }
12740 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
12741 let mut url = azure_core::http::Url::parse(&format!(
12742 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers",
12743 self.client.endpoint(),
12744 &self.organization,
12745 &self.project,
12746 &self.repository_id,
12747 &self.pull_request_id
12748 ))?;
12749 let has_api_version_already = url
12750 .query_pairs()
12751 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
12752 if !has_api_version_already {
12753 url.query_pairs_mut().append_pair(
12754 azure_core::http::headers::query_param::API_VERSION,
12755 "7.1-preview",
12756 );
12757 }
12758 Ok(url)
12759 }
12760 }
12761 impl std::future::IntoFuture for RequestBuilder {
12762 type Output = azure_core::Result<models::IdentityRefWithVote>;
12763 type IntoFuture = BoxFuture<'static, azure_core::Result<models::IdentityRefWithVote>>;
12764 #[doc = "Returns a future that sends the request and returns the parsed response body."]
12765 #[doc = ""]
12766 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
12767 #[doc = ""]
12768 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
12769 fn into_future(self) -> Self::IntoFuture {
12770 Box::pin(async move { self.send().await?.into_raw_body().await })
12771 }
12772 }
12773 }
12774 pub mod update_pull_request_reviewers {
12775 use super::models;
12776 #[cfg(not(target_arch = "wasm32"))]
12777 use futures::future::BoxFuture;
12778 #[cfg(target_arch = "wasm32")]
12779 use futures::future::LocalBoxFuture as BoxFuture;
12780 #[derive(Debug)]
12781 pub struct Response(azure_core::http::Response);
12782 impl Response {
12783 pub fn into_raw_response(self) -> azure_core::http::Response {
12784 self.0
12785 }
12786 pub fn as_raw_response(&self) -> &azure_core::http::Response {
12787 &self.0
12788 }
12789 }
12790 impl From<Response> for azure_core::http::Response {
12791 fn from(rsp: Response) -> Self {
12792 rsp.into_raw_response()
12793 }
12794 }
12795 impl AsRef<azure_core::http::Response> for Response {
12796 fn as_ref(&self) -> &azure_core::http::Response {
12797 self.as_raw_response()
12798 }
12799 }
12800 #[derive(Clone)]
12801 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12802 #[doc = r""]
12803 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12804 #[doc = r" parameters can be chained."]
12805 #[doc = r""]
12806 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12807 #[doc = r" converts the [`RequestBuilder`] into a future,"]
12808 #[doc = r" executes the request and returns a `Result` with the parsed"]
12809 #[doc = r" response."]
12810 #[doc = r""]
12811 #[doc = r" If you need lower-level access to the raw response details"]
12812 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12813 #[doc = r" can finalize the request using the"]
12814 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12815 #[doc = r" that resolves to a lower-level [`Response`] value."]
12816 pub struct RequestBuilder {
12817 pub(crate) client: super::super::Client,
12818 pub(crate) organization: String,
12819 pub(crate) body: Vec<models::IdentityRefWithVote>,
12820 pub(crate) repository_id: String,
12821 pub(crate) pull_request_id: i32,
12822 pub(crate) project: String,
12823 }
12824 impl RequestBuilder {
12825 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
12826 #[doc = ""]
12827 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
12828 #[doc = "However, this function can provide more flexibility when required."]
12829 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
12830 Box::pin({
12831 let this = self.clone();
12832 async move {
12833 let url = this.url()?;
12834 let mut req =
12835 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
12836 if let Some(auth_header) = this
12837 .client
12838 .token_credential()
12839 .http_authorization_header(&this.client.scopes())
12840 .await?
12841 {
12842 req.insert_header(
12843 azure_core::http::headers::AUTHORIZATION,
12844 auth_header,
12845 );
12846 }
12847 req.insert_header("content-type", "application/json");
12848 let req_body = azure_core::json::to_json(&this.body)?;
12849 req.set_body(req_body);
12850 Ok(Response(this.client.send(&mut req).await?))
12851 }
12852 })
12853 }
12854 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
12855 let mut url = azure_core::http::Url::parse(&format!(
12856 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers",
12857 self.client.endpoint(),
12858 &self.organization,
12859 &self.project,
12860 &self.repository_id,
12861 &self.pull_request_id
12862 ))?;
12863 let has_api_version_already = url
12864 .query_pairs()
12865 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
12866 if !has_api_version_already {
12867 url.query_pairs_mut().append_pair(
12868 azure_core::http::headers::query_param::API_VERSION,
12869 "7.1-preview",
12870 );
12871 }
12872 Ok(url)
12873 }
12874 }
12875 impl std::future::IntoFuture for RequestBuilder {
12876 type Output = azure_core::Result<()>;
12877 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
12878 #[doc = "Returns a future that sends the request and waits for the response."]
12879 #[doc = ""]
12880 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
12881 #[doc = ""]
12882 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
12883 fn into_future(self) -> Self::IntoFuture {
12884 Box::pin(async move {
12885 let _rsp = self.send().await?;
12886 Ok(())
12887 })
12888 }
12889 }
12890 }
12891 pub mod get {
12892 use super::models;
12893 #[cfg(not(target_arch = "wasm32"))]
12894 use futures::future::BoxFuture;
12895 #[cfg(target_arch = "wasm32")]
12896 use futures::future::LocalBoxFuture as BoxFuture;
12897 #[derive(Debug)]
12898 pub struct Response(azure_core::http::Response);
12899 impl Response {
12900 pub async fn into_raw_body(self) -> azure_core::Result<models::IdentityRefWithVote> {
12901 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
12902 let body: models::IdentityRefWithVote =
12903 serde_json::from_slice(&bytes).map_err(|e| {
12904 azure_core::error::Error::full(
12905 azure_core::error::ErrorKind::DataConversion,
12906 e,
12907 format!(
12908 "Failed to deserialize response:\n{}",
12909 String::from_utf8_lossy(&bytes)
12910 ),
12911 )
12912 })?;
12913 Ok(body)
12914 }
12915 pub fn into_raw_response(self) -> azure_core::http::Response {
12916 self.0
12917 }
12918 pub fn as_raw_response(&self) -> &azure_core::http::Response {
12919 &self.0
12920 }
12921 }
12922 impl From<Response> for azure_core::http::Response {
12923 fn from(rsp: Response) -> Self {
12924 rsp.into_raw_response()
12925 }
12926 }
12927 impl AsRef<azure_core::http::Response> for Response {
12928 fn as_ref(&self) -> &azure_core::http::Response {
12929 self.as_raw_response()
12930 }
12931 }
12932 #[derive(Clone)]
12933 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
12934 #[doc = r""]
12935 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
12936 #[doc = r" parameters can be chained."]
12937 #[doc = r""]
12938 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
12939 #[doc = r" converts the [`RequestBuilder`] into a future,"]
12940 #[doc = r" executes the request and returns a `Result` with the parsed"]
12941 #[doc = r" response."]
12942 #[doc = r""]
12943 #[doc = r" If you need lower-level access to the raw response details"]
12944 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
12945 #[doc = r" can finalize the request using the"]
12946 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
12947 #[doc = r" that resolves to a lower-level [`Response`] value."]
12948 pub struct RequestBuilder {
12949 pub(crate) client: super::super::Client,
12950 pub(crate) organization: String,
12951 pub(crate) repository_id: String,
12952 pub(crate) pull_request_id: i32,
12953 pub(crate) reviewer_id: String,
12954 pub(crate) project: String,
12955 }
12956 impl RequestBuilder {
12957 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
12958 #[doc = ""]
12959 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
12960 #[doc = "However, this function can provide more flexibility when required."]
12961 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
12962 Box::pin({
12963 let this = self.clone();
12964 async move {
12965 let url = this.url()?;
12966 let mut req =
12967 azure_core::http::Request::new(url, azure_core::http::Method::Get);
12968 if let Some(auth_header) = this
12969 .client
12970 .token_credential()
12971 .http_authorization_header(&this.client.scopes())
12972 .await?
12973 {
12974 req.insert_header(
12975 azure_core::http::headers::AUTHORIZATION,
12976 auth_header,
12977 );
12978 }
12979 let req_body = azure_core::Bytes::new();
12980 req.set_body(req_body);
12981 Ok(Response(this.client.send(&mut req).await?))
12982 }
12983 })
12984 }
12985 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
12986 let mut url = azure_core::http::Url::parse(&format!(
12987 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers/{}",
12988 self.client.endpoint(),
12989 &self.organization,
12990 &self.project,
12991 &self.repository_id,
12992 &self.pull_request_id,
12993 &self.reviewer_id
12994 ))?;
12995 let has_api_version_already = url
12996 .query_pairs()
12997 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
12998 if !has_api_version_already {
12999 url.query_pairs_mut().append_pair(
13000 azure_core::http::headers::query_param::API_VERSION,
13001 "7.1-preview",
13002 );
13003 }
13004 Ok(url)
13005 }
13006 }
13007 impl std::future::IntoFuture for RequestBuilder {
13008 type Output = azure_core::Result<models::IdentityRefWithVote>;
13009 type IntoFuture = BoxFuture<'static, azure_core::Result<models::IdentityRefWithVote>>;
13010 #[doc = "Returns a future that sends the request and returns the parsed response body."]
13011 #[doc = ""]
13012 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
13013 #[doc = ""]
13014 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
13015 fn into_future(self) -> Self::IntoFuture {
13016 Box::pin(async move { self.send().await?.into_raw_body().await })
13017 }
13018 }
13019 }
13020 pub mod create_pull_request_reviewer {
13021 use super::models;
13022 #[cfg(not(target_arch = "wasm32"))]
13023 use futures::future::BoxFuture;
13024 #[cfg(target_arch = "wasm32")]
13025 use futures::future::LocalBoxFuture as BoxFuture;
13026 #[derive(Debug)]
13027 pub struct Response(azure_core::http::Response);
13028 impl Response {
13029 pub async fn into_raw_body(self) -> azure_core::Result<models::IdentityRefWithVote> {
13030 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
13031 let body: models::IdentityRefWithVote =
13032 serde_json::from_slice(&bytes).map_err(|e| {
13033 azure_core::error::Error::full(
13034 azure_core::error::ErrorKind::DataConversion,
13035 e,
13036 format!(
13037 "Failed to deserialize response:\n{}",
13038 String::from_utf8_lossy(&bytes)
13039 ),
13040 )
13041 })?;
13042 Ok(body)
13043 }
13044 pub fn into_raw_response(self) -> azure_core::http::Response {
13045 self.0
13046 }
13047 pub fn as_raw_response(&self) -> &azure_core::http::Response {
13048 &self.0
13049 }
13050 }
13051 impl From<Response> for azure_core::http::Response {
13052 fn from(rsp: Response) -> Self {
13053 rsp.into_raw_response()
13054 }
13055 }
13056 impl AsRef<azure_core::http::Response> for Response {
13057 fn as_ref(&self) -> &azure_core::http::Response {
13058 self.as_raw_response()
13059 }
13060 }
13061 #[derive(Clone)]
13062 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13063 #[doc = r""]
13064 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13065 #[doc = r" parameters can be chained."]
13066 #[doc = r""]
13067 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13068 #[doc = r" converts the [`RequestBuilder`] into a future,"]
13069 #[doc = r" executes the request and returns a `Result` with the parsed"]
13070 #[doc = r" response."]
13071 #[doc = r""]
13072 #[doc = r" If you need lower-level access to the raw response details"]
13073 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13074 #[doc = r" can finalize the request using the"]
13075 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13076 #[doc = r" that resolves to a lower-level [`Response`] value."]
13077 pub struct RequestBuilder {
13078 pub(crate) client: super::super::Client,
13079 pub(crate) organization: String,
13080 pub(crate) body: models::IdentityRefWithVote,
13081 pub(crate) repository_id: String,
13082 pub(crate) pull_request_id: i32,
13083 pub(crate) reviewer_id: String,
13084 pub(crate) project: String,
13085 }
13086 impl RequestBuilder {
13087 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13088 #[doc = ""]
13089 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13090 #[doc = "However, this function can provide more flexibility when required."]
13091 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13092 Box::pin({
13093 let this = self.clone();
13094 async move {
13095 let url = this.url()?;
13096 let mut req =
13097 azure_core::http::Request::new(url, azure_core::http::Method::Put);
13098 if let Some(auth_header) = this
13099 .client
13100 .token_credential()
13101 .http_authorization_header(&this.client.scopes())
13102 .await?
13103 {
13104 req.insert_header(
13105 azure_core::http::headers::AUTHORIZATION,
13106 auth_header,
13107 );
13108 }
13109 req.insert_header("content-type", "application/json");
13110 let req_body = azure_core::json::to_json(&this.body)?;
13111 req.set_body(req_body);
13112 Ok(Response(this.client.send(&mut req).await?))
13113 }
13114 })
13115 }
13116 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
13117 let mut url = azure_core::http::Url::parse(&format!(
13118 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers/{}",
13119 self.client.endpoint(),
13120 &self.organization,
13121 &self.project,
13122 &self.repository_id,
13123 &self.pull_request_id,
13124 &self.reviewer_id
13125 ))?;
13126 let has_api_version_already = url
13127 .query_pairs()
13128 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
13129 if !has_api_version_already {
13130 url.query_pairs_mut().append_pair(
13131 azure_core::http::headers::query_param::API_VERSION,
13132 "7.1-preview",
13133 );
13134 }
13135 Ok(url)
13136 }
13137 }
13138 impl std::future::IntoFuture for RequestBuilder {
13139 type Output = azure_core::Result<models::IdentityRefWithVote>;
13140 type IntoFuture = BoxFuture<'static, azure_core::Result<models::IdentityRefWithVote>>;
13141 #[doc = "Returns a future that sends the request and returns the parsed response body."]
13142 #[doc = ""]
13143 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
13144 #[doc = ""]
13145 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
13146 fn into_future(self) -> Self::IntoFuture {
13147 Box::pin(async move { self.send().await?.into_raw_body().await })
13148 }
13149 }
13150 }
13151 pub mod update_pull_request_reviewer {
13152 use super::models;
13153 #[cfg(not(target_arch = "wasm32"))]
13154 use futures::future::BoxFuture;
13155 #[cfg(target_arch = "wasm32")]
13156 use futures::future::LocalBoxFuture as BoxFuture;
13157 #[derive(Debug)]
13158 pub struct Response(azure_core::http::Response);
13159 impl Response {
13160 pub async fn into_raw_body(self) -> azure_core::Result<models::IdentityRefWithVote> {
13161 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
13162 let body: models::IdentityRefWithVote =
13163 serde_json::from_slice(&bytes).map_err(|e| {
13164 azure_core::error::Error::full(
13165 azure_core::error::ErrorKind::DataConversion,
13166 e,
13167 format!(
13168 "Failed to deserialize response:\n{}",
13169 String::from_utf8_lossy(&bytes)
13170 ),
13171 )
13172 })?;
13173 Ok(body)
13174 }
13175 pub fn into_raw_response(self) -> azure_core::http::Response {
13176 self.0
13177 }
13178 pub fn as_raw_response(&self) -> &azure_core::http::Response {
13179 &self.0
13180 }
13181 }
13182 impl From<Response> for azure_core::http::Response {
13183 fn from(rsp: Response) -> Self {
13184 rsp.into_raw_response()
13185 }
13186 }
13187 impl AsRef<azure_core::http::Response> for Response {
13188 fn as_ref(&self) -> &azure_core::http::Response {
13189 self.as_raw_response()
13190 }
13191 }
13192 #[derive(Clone)]
13193 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13194 #[doc = r""]
13195 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13196 #[doc = r" parameters can be chained."]
13197 #[doc = r""]
13198 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13199 #[doc = r" converts the [`RequestBuilder`] into a future,"]
13200 #[doc = r" executes the request and returns a `Result` with the parsed"]
13201 #[doc = r" response."]
13202 #[doc = r""]
13203 #[doc = r" If you need lower-level access to the raw response details"]
13204 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13205 #[doc = r" can finalize the request using the"]
13206 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13207 #[doc = r" that resolves to a lower-level [`Response`] value."]
13208 pub struct RequestBuilder {
13209 pub(crate) client: super::super::Client,
13210 pub(crate) organization: String,
13211 pub(crate) body: models::IdentityRefWithVote,
13212 pub(crate) repository_id: String,
13213 pub(crate) pull_request_id: i32,
13214 pub(crate) reviewer_id: String,
13215 pub(crate) project: String,
13216 }
13217 impl RequestBuilder {
13218 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13219 #[doc = ""]
13220 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13221 #[doc = "However, this function can provide more flexibility when required."]
13222 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13223 Box::pin({
13224 let this = self.clone();
13225 async move {
13226 let url = this.url()?;
13227 let mut req =
13228 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
13229 if let Some(auth_header) = this
13230 .client
13231 .token_credential()
13232 .http_authorization_header(&this.client.scopes())
13233 .await?
13234 {
13235 req.insert_header(
13236 azure_core::http::headers::AUTHORIZATION,
13237 auth_header,
13238 );
13239 }
13240 req.insert_header("content-type", "application/json");
13241 let req_body = azure_core::json::to_json(&this.body)?;
13242 req.set_body(req_body);
13243 Ok(Response(this.client.send(&mut req).await?))
13244 }
13245 })
13246 }
13247 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
13248 let mut url = azure_core::http::Url::parse(&format!(
13249 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers/{}",
13250 self.client.endpoint(),
13251 &self.organization,
13252 &self.project,
13253 &self.repository_id,
13254 &self.pull_request_id,
13255 &self.reviewer_id
13256 ))?;
13257 let has_api_version_already = url
13258 .query_pairs()
13259 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
13260 if !has_api_version_already {
13261 url.query_pairs_mut().append_pair(
13262 azure_core::http::headers::query_param::API_VERSION,
13263 "7.1-preview",
13264 );
13265 }
13266 Ok(url)
13267 }
13268 }
13269 impl std::future::IntoFuture for RequestBuilder {
13270 type Output = azure_core::Result<models::IdentityRefWithVote>;
13271 type IntoFuture = BoxFuture<'static, azure_core::Result<models::IdentityRefWithVote>>;
13272 #[doc = "Returns a future that sends the request and returns the parsed response body."]
13273 #[doc = ""]
13274 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
13275 #[doc = ""]
13276 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
13277 fn into_future(self) -> Self::IntoFuture {
13278 Box::pin(async move { self.send().await?.into_raw_body().await })
13279 }
13280 }
13281 }
13282 pub mod delete {
13283 use super::models;
13284 #[cfg(not(target_arch = "wasm32"))]
13285 use futures::future::BoxFuture;
13286 #[cfg(target_arch = "wasm32")]
13287 use futures::future::LocalBoxFuture as BoxFuture;
13288 #[derive(Debug)]
13289 pub struct Response(azure_core::http::Response);
13290 impl Response {
13291 pub fn into_raw_response(self) -> azure_core::http::Response {
13292 self.0
13293 }
13294 pub fn as_raw_response(&self) -> &azure_core::http::Response {
13295 &self.0
13296 }
13297 }
13298 impl From<Response> for azure_core::http::Response {
13299 fn from(rsp: Response) -> Self {
13300 rsp.into_raw_response()
13301 }
13302 }
13303 impl AsRef<azure_core::http::Response> for Response {
13304 fn as_ref(&self) -> &azure_core::http::Response {
13305 self.as_raw_response()
13306 }
13307 }
13308 #[derive(Clone)]
13309 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13310 #[doc = r""]
13311 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13312 #[doc = r" parameters can be chained."]
13313 #[doc = r""]
13314 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13315 #[doc = r" converts the [`RequestBuilder`] into a future,"]
13316 #[doc = r" executes the request and returns a `Result` with the parsed"]
13317 #[doc = r" response."]
13318 #[doc = r""]
13319 #[doc = r" If you need lower-level access to the raw response details"]
13320 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13321 #[doc = r" can finalize the request using the"]
13322 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13323 #[doc = r" that resolves to a lower-level [`Response`] value."]
13324 pub struct RequestBuilder {
13325 pub(crate) client: super::super::Client,
13326 pub(crate) organization: String,
13327 pub(crate) repository_id: String,
13328 pub(crate) pull_request_id: i32,
13329 pub(crate) reviewer_id: String,
13330 pub(crate) project: String,
13331 }
13332 impl RequestBuilder {
13333 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13334 #[doc = ""]
13335 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13336 #[doc = "However, this function can provide more flexibility when required."]
13337 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13338 Box::pin({
13339 let this = self.clone();
13340 async move {
13341 let url = this.url()?;
13342 let mut req =
13343 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
13344 if let Some(auth_header) = this
13345 .client
13346 .token_credential()
13347 .http_authorization_header(&this.client.scopes())
13348 .await?
13349 {
13350 req.insert_header(
13351 azure_core::http::headers::AUTHORIZATION,
13352 auth_header,
13353 );
13354 }
13355 let req_body = azure_core::Bytes::new();
13356 req.set_body(req_body);
13357 Ok(Response(this.client.send(&mut req).await?))
13358 }
13359 })
13360 }
13361 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
13362 let mut url = azure_core::http::Url::parse(&format!(
13363 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers/{}",
13364 self.client.endpoint(),
13365 &self.organization,
13366 &self.project,
13367 &self.repository_id,
13368 &self.pull_request_id,
13369 &self.reviewer_id
13370 ))?;
13371 let has_api_version_already = url
13372 .query_pairs()
13373 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
13374 if !has_api_version_already {
13375 url.query_pairs_mut().append_pair(
13376 azure_core::http::headers::query_param::API_VERSION,
13377 "7.1-preview",
13378 );
13379 }
13380 Ok(url)
13381 }
13382 }
13383 impl std::future::IntoFuture for RequestBuilder {
13384 type Output = azure_core::Result<()>;
13385 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
13386 #[doc = "Returns a future that sends the request and waits for the response."]
13387 #[doc = ""]
13388 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
13389 #[doc = ""]
13390 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
13391 fn into_future(self) -> Self::IntoFuture {
13392 Box::pin(async move {
13393 let _rsp = self.send().await?;
13394 Ok(())
13395 })
13396 }
13397 }
13398 }
13399}
13400pub mod pull_request_share {
13401 use super::models;
13402 #[cfg(not(target_arch = "wasm32"))]
13403 use futures::future::BoxFuture;
13404 #[cfg(target_arch = "wasm32")]
13405 use futures::future::LocalBoxFuture as BoxFuture;
13406 pub struct Client(pub(crate) super::Client);
13407 impl Client {
13408 #[doc = "Sends an e-mail notification about a specific pull request to a set of recipients"]
13409 #[doc = ""]
13410 #[doc = "Arguments:"]
13411 #[doc = "* `organization`: The name of the Azure DevOps organization."]
13412 #[doc = "* `repository_id`: ID of the git repository."]
13413 #[doc = "* `pull_request_id`: ID of the pull request."]
13414 #[doc = "* `project`: Project ID or project name"]
13415 pub fn share_pull_request(
13416 &self,
13417 organization: impl Into<String>,
13418 body: impl Into<models::ShareNotificationContext>,
13419 repository_id: impl Into<String>,
13420 pull_request_id: i32,
13421 project: impl Into<String>,
13422 ) -> share_pull_request::RequestBuilder {
13423 share_pull_request::RequestBuilder {
13424 client: self.0.clone(),
13425 organization: organization.into(),
13426 body: body.into(),
13427 repository_id: repository_id.into(),
13428 pull_request_id,
13429 project: project.into(),
13430 }
13431 }
13432 }
13433 pub mod share_pull_request {
13434 use super::models;
13435 #[cfg(not(target_arch = "wasm32"))]
13436 use futures::future::BoxFuture;
13437 #[cfg(target_arch = "wasm32")]
13438 use futures::future::LocalBoxFuture as BoxFuture;
13439 #[derive(Debug)]
13440 pub struct Response(azure_core::http::Response);
13441 impl Response {
13442 pub fn into_raw_response(self) -> azure_core::http::Response {
13443 self.0
13444 }
13445 pub fn as_raw_response(&self) -> &azure_core::http::Response {
13446 &self.0
13447 }
13448 }
13449 impl From<Response> for azure_core::http::Response {
13450 fn from(rsp: Response) -> Self {
13451 rsp.into_raw_response()
13452 }
13453 }
13454 impl AsRef<azure_core::http::Response> for Response {
13455 fn as_ref(&self) -> &azure_core::http::Response {
13456 self.as_raw_response()
13457 }
13458 }
13459 #[derive(Clone)]
13460 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13461 #[doc = r""]
13462 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13463 #[doc = r" parameters can be chained."]
13464 #[doc = r""]
13465 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13466 #[doc = r" converts the [`RequestBuilder`] into a future,"]
13467 #[doc = r" executes the request and returns a `Result` with the parsed"]
13468 #[doc = r" response."]
13469 #[doc = r""]
13470 #[doc = r" If you need lower-level access to the raw response details"]
13471 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13472 #[doc = r" can finalize the request using the"]
13473 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13474 #[doc = r" that resolves to a lower-level [`Response`] value."]
13475 pub struct RequestBuilder {
13476 pub(crate) client: super::super::Client,
13477 pub(crate) organization: String,
13478 pub(crate) body: models::ShareNotificationContext,
13479 pub(crate) repository_id: String,
13480 pub(crate) pull_request_id: i32,
13481 pub(crate) project: String,
13482 }
13483 impl RequestBuilder {
13484 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13485 #[doc = ""]
13486 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13487 #[doc = "However, this function can provide more flexibility when required."]
13488 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13489 Box::pin({
13490 let this = self.clone();
13491 async move {
13492 let url = this.url()?;
13493 let mut req =
13494 azure_core::http::Request::new(url, azure_core::http::Method::Post);
13495 if let Some(auth_header) = this
13496 .client
13497 .token_credential()
13498 .http_authorization_header(&this.client.scopes())
13499 .await?
13500 {
13501 req.insert_header(
13502 azure_core::http::headers::AUTHORIZATION,
13503 auth_header,
13504 );
13505 }
13506 req.insert_header("content-type", "application/json");
13507 let req_body = azure_core::json::to_json(&this.body)?;
13508 req.set_body(req_body);
13509 Ok(Response(this.client.send(&mut req).await?))
13510 }
13511 })
13512 }
13513 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
13514 let mut url = azure_core::http::Url::parse(&format!(
13515 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/share",
13516 self.client.endpoint(),
13517 &self.organization,
13518 &self.project,
13519 &self.repository_id,
13520 &self.pull_request_id
13521 ))?;
13522 let has_api_version_already = url
13523 .query_pairs()
13524 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
13525 if !has_api_version_already {
13526 url.query_pairs_mut().append_pair(
13527 azure_core::http::headers::query_param::API_VERSION,
13528 "7.1-preview",
13529 );
13530 }
13531 Ok(url)
13532 }
13533 }
13534 impl std::future::IntoFuture for RequestBuilder {
13535 type Output = azure_core::Result<()>;
13536 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
13537 #[doc = "Returns a future that sends the request and waits for the response."]
13538 #[doc = ""]
13539 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
13540 #[doc = ""]
13541 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
13542 fn into_future(self) -> Self::IntoFuture {
13543 Box::pin(async move {
13544 let _rsp = self.send().await?;
13545 Ok(())
13546 })
13547 }
13548 }
13549 }
13550}
13551pub mod pull_request_statuses {
13552 use super::models;
13553 #[cfg(not(target_arch = "wasm32"))]
13554 use futures::future::BoxFuture;
13555 #[cfg(target_arch = "wasm32")]
13556 use futures::future::LocalBoxFuture as BoxFuture;
13557 pub struct Client(pub(crate) super::Client);
13558 impl Client {
13559 #[doc = "Get all the statuses associated with a pull request."]
13560 #[doc = ""]
13561 #[doc = "Arguments:"]
13562 #[doc = "* `organization`: The name of the Azure DevOps organization."]
13563 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
13564 #[doc = "* `pull_request_id`: ID of the pull request."]
13565 #[doc = "* `project`: Project ID or project name"]
13566 pub fn list(
13567 &self,
13568 organization: impl Into<String>,
13569 repository_id: impl Into<String>,
13570 pull_request_id: i32,
13571 project: impl Into<String>,
13572 ) -> list::RequestBuilder {
13573 list::RequestBuilder {
13574 client: self.0.clone(),
13575 organization: organization.into(),
13576 repository_id: repository_id.into(),
13577 pull_request_id,
13578 project: project.into(),
13579 }
13580 }
13581 #[doc = "Create a pull request status.\n\nThe only required field for the status is `Context.Name` that uniquely identifies the status.\nNote that you can specify iterationId in the request body to post the status on the iteration."]
13582 #[doc = ""]
13583 #[doc = "Arguments:"]
13584 #[doc = "* `organization`: The name of the Azure DevOps organization."]
13585 #[doc = "* `body`: Pull request status to create."]
13586 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
13587 #[doc = "* `pull_request_id`: ID of the pull request."]
13588 #[doc = "* `project`: Project ID or project name"]
13589 pub fn create(
13590 &self,
13591 organization: impl Into<String>,
13592 body: impl Into<models::GitPullRequestStatus>,
13593 repository_id: impl Into<String>,
13594 pull_request_id: i32,
13595 project: impl Into<String>,
13596 ) -> create::RequestBuilder {
13597 create::RequestBuilder {
13598 client: self.0.clone(),
13599 organization: organization.into(),
13600 body: body.into(),
13601 repository_id: repository_id.into(),
13602 pull_request_id,
13603 project: project.into(),
13604 }
13605 }
13606 #[doc = "Update pull request statuses collection. The only supported operation type is `remove`.\n\nThis operation allows to delete multiple statuses in one call.\nThe path of the `remove` operation should refer to the ID of the pull request status.\nFor example `path=\"/1\"` refers to the pull request status with ID 1."]
13607 #[doc = ""]
13608 #[doc = "Arguments:"]
13609 #[doc = "* `organization`: The name of the Azure DevOps organization."]
13610 #[doc = "* `body`: Operations to apply to the pull request statuses in JSON Patch format."]
13611 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
13612 #[doc = "* `pull_request_id`: ID of the pull request."]
13613 #[doc = "* `project`: Project ID or project name"]
13614 pub fn update(
13615 &self,
13616 organization: impl Into<String>,
13617 body: impl Into<models::JsonPatchDocument>,
13618 repository_id: impl Into<String>,
13619 pull_request_id: i32,
13620 project: impl Into<String>,
13621 ) -> update::RequestBuilder {
13622 update::RequestBuilder {
13623 client: self.0.clone(),
13624 organization: organization.into(),
13625 body: body.into(),
13626 repository_id: repository_id.into(),
13627 pull_request_id,
13628 project: project.into(),
13629 }
13630 }
13631 #[doc = "Get the specific pull request status by ID. The status ID is unique within the pull request across all iterations."]
13632 #[doc = ""]
13633 #[doc = "Arguments:"]
13634 #[doc = "* `organization`: The name of the Azure DevOps organization."]
13635 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
13636 #[doc = "* `pull_request_id`: ID of the pull request."]
13637 #[doc = "* `status_id`: ID of the pull request status."]
13638 #[doc = "* `project`: Project ID or project name"]
13639 pub fn get(
13640 &self,
13641 organization: impl Into<String>,
13642 repository_id: impl Into<String>,
13643 pull_request_id: i32,
13644 status_id: i32,
13645 project: impl Into<String>,
13646 ) -> get::RequestBuilder {
13647 get::RequestBuilder {
13648 client: self.0.clone(),
13649 organization: organization.into(),
13650 repository_id: repository_id.into(),
13651 pull_request_id,
13652 status_id,
13653 project: project.into(),
13654 }
13655 }
13656 #[doc = "Delete pull request status.\n\nYou can remove multiple statuses in one call by using Update operation."]
13657 #[doc = ""]
13658 #[doc = "Arguments:"]
13659 #[doc = "* `organization`: The name of the Azure DevOps organization."]
13660 #[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
13661 #[doc = "* `pull_request_id`: ID of the pull request."]
13662 #[doc = "* `status_id`: ID of the pull request status."]
13663 #[doc = "* `project`: Project ID or project name"]
13664 pub fn delete(
13665 &self,
13666 organization: impl Into<String>,
13667 repository_id: impl Into<String>,
13668 pull_request_id: i32,
13669 status_id: i32,
13670 project: impl Into<String>,
13671 ) -> delete::RequestBuilder {
13672 delete::RequestBuilder {
13673 client: self.0.clone(),
13674 organization: organization.into(),
13675 repository_id: repository_id.into(),
13676 pull_request_id,
13677 status_id,
13678 project: project.into(),
13679 }
13680 }
13681 }
13682 pub mod list {
13683 use super::models;
13684 #[cfg(not(target_arch = "wasm32"))]
13685 use futures::future::BoxFuture;
13686 #[cfg(target_arch = "wasm32")]
13687 use futures::future::LocalBoxFuture as BoxFuture;
13688 #[derive(Debug)]
13689 pub struct Response(azure_core::http::Response);
13690 impl Response {
13691 pub async fn into_raw_body(
13692 self,
13693 ) -> azure_core::Result<models::GitPullRequestStatusList> {
13694 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
13695 let body: models::GitPullRequestStatusList = serde_json::from_slice(&bytes)
13696 .map_err(|e| {
13697 azure_core::error::Error::full(
13698 azure_core::error::ErrorKind::DataConversion,
13699 e,
13700 format!(
13701 "Failed to deserialize response:\n{}",
13702 String::from_utf8_lossy(&bytes)
13703 ),
13704 )
13705 })?;
13706 Ok(body)
13707 }
13708 pub fn into_raw_response(self) -> azure_core::http::Response {
13709 self.0
13710 }
13711 pub fn as_raw_response(&self) -> &azure_core::http::Response {
13712 &self.0
13713 }
13714 }
13715 impl From<Response> for azure_core::http::Response {
13716 fn from(rsp: Response) -> Self {
13717 rsp.into_raw_response()
13718 }
13719 }
13720 impl AsRef<azure_core::http::Response> for Response {
13721 fn as_ref(&self) -> &azure_core::http::Response {
13722 self.as_raw_response()
13723 }
13724 }
13725 #[derive(Clone)]
13726 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13727 #[doc = r""]
13728 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13729 #[doc = r" parameters can be chained."]
13730 #[doc = r""]
13731 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13732 #[doc = r" converts the [`RequestBuilder`] into a future,"]
13733 #[doc = r" executes the request and returns a `Result` with the parsed"]
13734 #[doc = r" response."]
13735 #[doc = r""]
13736 #[doc = r" If you need lower-level access to the raw response details"]
13737 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13738 #[doc = r" can finalize the request using the"]
13739 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13740 #[doc = r" that resolves to a lower-level [`Response`] value."]
13741 pub struct RequestBuilder {
13742 pub(crate) client: super::super::Client,
13743 pub(crate) organization: String,
13744 pub(crate) repository_id: String,
13745 pub(crate) pull_request_id: i32,
13746 pub(crate) project: String,
13747 }
13748 impl RequestBuilder {
13749 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13750 #[doc = ""]
13751 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13752 #[doc = "However, this function can provide more flexibility when required."]
13753 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13754 Box::pin({
13755 let this = self.clone();
13756 async move {
13757 let url = this.url()?;
13758 let mut req =
13759 azure_core::http::Request::new(url, azure_core::http::Method::Get);
13760 if let Some(auth_header) = this
13761 .client
13762 .token_credential()
13763 .http_authorization_header(&this.client.scopes())
13764 .await?
13765 {
13766 req.insert_header(
13767 azure_core::http::headers::AUTHORIZATION,
13768 auth_header,
13769 );
13770 }
13771 let req_body = azure_core::Bytes::new();
13772 req.set_body(req_body);
13773 Ok(Response(this.client.send(&mut req).await?))
13774 }
13775 })
13776 }
13777 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
13778 let mut url = azure_core::http::Url::parse(&format!(
13779 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses",
13780 self.client.endpoint(),
13781 &self.organization,
13782 &self.project,
13783 &self.repository_id,
13784 &self.pull_request_id
13785 ))?;
13786 let has_api_version_already = url
13787 .query_pairs()
13788 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
13789 if !has_api_version_already {
13790 url.query_pairs_mut().append_pair(
13791 azure_core::http::headers::query_param::API_VERSION,
13792 "7.1-preview",
13793 );
13794 }
13795 Ok(url)
13796 }
13797 }
13798 impl std::future::IntoFuture for RequestBuilder {
13799 type Output = azure_core::Result<models::GitPullRequestStatusList>;
13800 type IntoFuture =
13801 BoxFuture<'static, azure_core::Result<models::GitPullRequestStatusList>>;
13802 #[doc = "Returns a future that sends the request and returns the parsed response body."]
13803 #[doc = ""]
13804 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
13805 #[doc = ""]
13806 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
13807 fn into_future(self) -> Self::IntoFuture {
13808 Box::pin(async move { self.send().await?.into_raw_body().await })
13809 }
13810 }
13811 }
13812 pub mod create {
13813 use super::models;
13814 #[cfg(not(target_arch = "wasm32"))]
13815 use futures::future::BoxFuture;
13816 #[cfg(target_arch = "wasm32")]
13817 use futures::future::LocalBoxFuture as BoxFuture;
13818 #[derive(Debug)]
13819 pub struct Response(azure_core::http::Response);
13820 impl Response {
13821 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequestStatus> {
13822 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
13823 let body: models::GitPullRequestStatus =
13824 serde_json::from_slice(&bytes).map_err(|e| {
13825 azure_core::error::Error::full(
13826 azure_core::error::ErrorKind::DataConversion,
13827 e,
13828 format!(
13829 "Failed to deserialize response:\n{}",
13830 String::from_utf8_lossy(&bytes)
13831 ),
13832 )
13833 })?;
13834 Ok(body)
13835 }
13836 pub fn into_raw_response(self) -> azure_core::http::Response {
13837 self.0
13838 }
13839 pub fn as_raw_response(&self) -> &azure_core::http::Response {
13840 &self.0
13841 }
13842 }
13843 impl From<Response> for azure_core::http::Response {
13844 fn from(rsp: Response) -> Self {
13845 rsp.into_raw_response()
13846 }
13847 }
13848 impl AsRef<azure_core::http::Response> for Response {
13849 fn as_ref(&self) -> &azure_core::http::Response {
13850 self.as_raw_response()
13851 }
13852 }
13853 #[derive(Clone)]
13854 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13855 #[doc = r""]
13856 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13857 #[doc = r" parameters can be chained."]
13858 #[doc = r""]
13859 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13860 #[doc = r" converts the [`RequestBuilder`] into a future,"]
13861 #[doc = r" executes the request and returns a `Result` with the parsed"]
13862 #[doc = r" response."]
13863 #[doc = r""]
13864 #[doc = r" If you need lower-level access to the raw response details"]
13865 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13866 #[doc = r" can finalize the request using the"]
13867 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13868 #[doc = r" that resolves to a lower-level [`Response`] value."]
13869 pub struct RequestBuilder {
13870 pub(crate) client: super::super::Client,
13871 pub(crate) organization: String,
13872 pub(crate) body: models::GitPullRequestStatus,
13873 pub(crate) repository_id: String,
13874 pub(crate) pull_request_id: i32,
13875 pub(crate) project: String,
13876 }
13877 impl RequestBuilder {
13878 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13879 #[doc = ""]
13880 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13881 #[doc = "However, this function can provide more flexibility when required."]
13882 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13883 Box::pin({
13884 let this = self.clone();
13885 async move {
13886 let url = this.url()?;
13887 let mut req =
13888 azure_core::http::Request::new(url, azure_core::http::Method::Post);
13889 if let Some(auth_header) = this
13890 .client
13891 .token_credential()
13892 .http_authorization_header(&this.client.scopes())
13893 .await?
13894 {
13895 req.insert_header(
13896 azure_core::http::headers::AUTHORIZATION,
13897 auth_header,
13898 );
13899 }
13900 req.insert_header("content-type", "application/json");
13901 let req_body = azure_core::json::to_json(&this.body)?;
13902 req.set_body(req_body);
13903 Ok(Response(this.client.send(&mut req).await?))
13904 }
13905 })
13906 }
13907 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
13908 let mut url = azure_core::http::Url::parse(&format!(
13909 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses",
13910 self.client.endpoint(),
13911 &self.organization,
13912 &self.project,
13913 &self.repository_id,
13914 &self.pull_request_id
13915 ))?;
13916 let has_api_version_already = url
13917 .query_pairs()
13918 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
13919 if !has_api_version_already {
13920 url.query_pairs_mut().append_pair(
13921 azure_core::http::headers::query_param::API_VERSION,
13922 "7.1-preview",
13923 );
13924 }
13925 Ok(url)
13926 }
13927 }
13928 impl std::future::IntoFuture for RequestBuilder {
13929 type Output = azure_core::Result<models::GitPullRequestStatus>;
13930 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequestStatus>>;
13931 #[doc = "Returns a future that sends the request and returns the parsed response body."]
13932 #[doc = ""]
13933 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
13934 #[doc = ""]
13935 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
13936 fn into_future(self) -> Self::IntoFuture {
13937 Box::pin(async move { self.send().await?.into_raw_body().await })
13938 }
13939 }
13940 }
13941 pub mod update {
13942 use super::models;
13943 #[cfg(not(target_arch = "wasm32"))]
13944 use futures::future::BoxFuture;
13945 #[cfg(target_arch = "wasm32")]
13946 use futures::future::LocalBoxFuture as BoxFuture;
13947 #[derive(Debug)]
13948 pub struct Response(azure_core::http::Response);
13949 impl Response {
13950 pub fn into_raw_response(self) -> azure_core::http::Response {
13951 self.0
13952 }
13953 pub fn as_raw_response(&self) -> &azure_core::http::Response {
13954 &self.0
13955 }
13956 }
13957 impl From<Response> for azure_core::http::Response {
13958 fn from(rsp: Response) -> Self {
13959 rsp.into_raw_response()
13960 }
13961 }
13962 impl AsRef<azure_core::http::Response> for Response {
13963 fn as_ref(&self) -> &azure_core::http::Response {
13964 self.as_raw_response()
13965 }
13966 }
13967 #[derive(Clone)]
13968 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
13969 #[doc = r""]
13970 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
13971 #[doc = r" parameters can be chained."]
13972 #[doc = r""]
13973 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
13974 #[doc = r" converts the [`RequestBuilder`] into a future,"]
13975 #[doc = r" executes the request and returns a `Result` with the parsed"]
13976 #[doc = r" response."]
13977 #[doc = r""]
13978 #[doc = r" If you need lower-level access to the raw response details"]
13979 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
13980 #[doc = r" can finalize the request using the"]
13981 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
13982 #[doc = r" that resolves to a lower-level [`Response`] value."]
13983 pub struct RequestBuilder {
13984 pub(crate) client: super::super::Client,
13985 pub(crate) organization: String,
13986 pub(crate) body: models::JsonPatchDocument,
13987 pub(crate) repository_id: String,
13988 pub(crate) pull_request_id: i32,
13989 pub(crate) project: String,
13990 }
13991 impl RequestBuilder {
13992 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
13993 #[doc = ""]
13994 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
13995 #[doc = "However, this function can provide more flexibility when required."]
13996 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
13997 Box::pin({
13998 let this = self.clone();
13999 async move {
14000 let url = this.url()?;
14001 let mut req =
14002 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
14003 if let Some(auth_header) = this
14004 .client
14005 .token_credential()
14006 .http_authorization_header(&this.client.scopes())
14007 .await?
14008 {
14009 req.insert_header(
14010 azure_core::http::headers::AUTHORIZATION,
14011 auth_header,
14012 );
14013 }
14014 req.insert_header("content-type", "application/json-patch+json");
14015 let req_body = azure_core::json::to_json(&this.body)?;
14016 req.set_body(req_body);
14017 Ok(Response(this.client.send(&mut req).await?))
14018 }
14019 })
14020 }
14021 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
14022 let mut url = azure_core::http::Url::parse(&format!(
14023 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses",
14024 self.client.endpoint(),
14025 &self.organization,
14026 &self.project,
14027 &self.repository_id,
14028 &self.pull_request_id
14029 ))?;
14030 let has_api_version_already = url
14031 .query_pairs()
14032 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
14033 if !has_api_version_already {
14034 url.query_pairs_mut().append_pair(
14035 azure_core::http::headers::query_param::API_VERSION,
14036 "7.1-preview",
14037 );
14038 }
14039 Ok(url)
14040 }
14041 }
14042 impl std::future::IntoFuture for RequestBuilder {
14043 type Output = azure_core::Result<()>;
14044 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
14045 #[doc = "Returns a future that sends the request and waits for the response."]
14046 #[doc = ""]
14047 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
14048 #[doc = ""]
14049 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
14050 fn into_future(self) -> Self::IntoFuture {
14051 Box::pin(async move {
14052 let _rsp = self.send().await?;
14053 Ok(())
14054 })
14055 }
14056 }
14057 }
14058 pub mod get {
14059 use super::models;
14060 #[cfg(not(target_arch = "wasm32"))]
14061 use futures::future::BoxFuture;
14062 #[cfg(target_arch = "wasm32")]
14063 use futures::future::LocalBoxFuture as BoxFuture;
14064 #[derive(Debug)]
14065 pub struct Response(azure_core::http::Response);
14066 impl Response {
14067 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPullRequestStatus> {
14068 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
14069 let body: models::GitPullRequestStatus =
14070 serde_json::from_slice(&bytes).map_err(|e| {
14071 azure_core::error::Error::full(
14072 azure_core::error::ErrorKind::DataConversion,
14073 e,
14074 format!(
14075 "Failed to deserialize response:\n{}",
14076 String::from_utf8_lossy(&bytes)
14077 ),
14078 )
14079 })?;
14080 Ok(body)
14081 }
14082 pub fn into_raw_response(self) -> azure_core::http::Response {
14083 self.0
14084 }
14085 pub fn as_raw_response(&self) -> &azure_core::http::Response {
14086 &self.0
14087 }
14088 }
14089 impl From<Response> for azure_core::http::Response {
14090 fn from(rsp: Response) -> Self {
14091 rsp.into_raw_response()
14092 }
14093 }
14094 impl AsRef<azure_core::http::Response> for Response {
14095 fn as_ref(&self) -> &azure_core::http::Response {
14096 self.as_raw_response()
14097 }
14098 }
14099 #[derive(Clone)]
14100 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
14101 #[doc = r""]
14102 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
14103 #[doc = r" parameters can be chained."]
14104 #[doc = r""]
14105 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
14106 #[doc = r" converts the [`RequestBuilder`] into a future,"]
14107 #[doc = r" executes the request and returns a `Result` with the parsed"]
14108 #[doc = r" response."]
14109 #[doc = r""]
14110 #[doc = r" If you need lower-level access to the raw response details"]
14111 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
14112 #[doc = r" can finalize the request using the"]
14113 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
14114 #[doc = r" that resolves to a lower-level [`Response`] value."]
14115 pub struct RequestBuilder {
14116 pub(crate) client: super::super::Client,
14117 pub(crate) organization: String,
14118 pub(crate) repository_id: String,
14119 pub(crate) pull_request_id: i32,
14120 pub(crate) status_id: i32,
14121 pub(crate) project: String,
14122 }
14123 impl RequestBuilder {
14124 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
14125 #[doc = ""]
14126 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
14127 #[doc = "However, this function can provide more flexibility when required."]
14128 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
14129 Box::pin({
14130 let this = self.clone();
14131 async move {
14132 let url = this.url()?;
14133 let mut req =
14134 azure_core::http::Request::new(url, azure_core::http::Method::Get);
14135 if let Some(auth_header) = this
14136 .client
14137 .token_credential()
14138 .http_authorization_header(&this.client.scopes())
14139 .await?
14140 {
14141 req.insert_header(
14142 azure_core::http::headers::AUTHORIZATION,
14143 auth_header,
14144 );
14145 }
14146 let req_body = azure_core::Bytes::new();
14147 req.set_body(req_body);
14148 Ok(Response(this.client.send(&mut req).await?))
14149 }
14150 })
14151 }
14152 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
14153 let mut url = azure_core::http::Url::parse(&format!(
14154 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses/{}",
14155 self.client.endpoint(),
14156 &self.organization,
14157 &self.project,
14158 &self.repository_id,
14159 &self.pull_request_id,
14160 &self.status_id
14161 ))?;
14162 let has_api_version_already = url
14163 .query_pairs()
14164 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
14165 if !has_api_version_already {
14166 url.query_pairs_mut().append_pair(
14167 azure_core::http::headers::query_param::API_VERSION,
14168 "7.1-preview",
14169 );
14170 }
14171 Ok(url)
14172 }
14173 }
14174 impl std::future::IntoFuture for RequestBuilder {
14175 type Output = azure_core::Result<models::GitPullRequestStatus>;
14176 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPullRequestStatus>>;
14177 #[doc = "Returns a future that sends the request and returns the parsed response body."]
14178 #[doc = ""]
14179 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
14180 #[doc = ""]
14181 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
14182 fn into_future(self) -> Self::IntoFuture {
14183 Box::pin(async move { self.send().await?.into_raw_body().await })
14184 }
14185 }
14186 }
14187 pub mod delete {
14188 use super::models;
14189 #[cfg(not(target_arch = "wasm32"))]
14190 use futures::future::BoxFuture;
14191 #[cfg(target_arch = "wasm32")]
14192 use futures::future::LocalBoxFuture as BoxFuture;
14193 #[derive(Debug)]
14194 pub struct Response(azure_core::http::Response);
14195 impl Response {
14196 pub fn into_raw_response(self) -> azure_core::http::Response {
14197 self.0
14198 }
14199 pub fn as_raw_response(&self) -> &azure_core::http::Response {
14200 &self.0
14201 }
14202 }
14203 impl From<Response> for azure_core::http::Response {
14204 fn from(rsp: Response) -> Self {
14205 rsp.into_raw_response()
14206 }
14207 }
14208 impl AsRef<azure_core::http::Response> for Response {
14209 fn as_ref(&self) -> &azure_core::http::Response {
14210 self.as_raw_response()
14211 }
14212 }
14213 #[derive(Clone)]
14214 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
14215 #[doc = r""]
14216 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
14217 #[doc = r" parameters can be chained."]
14218 #[doc = r""]
14219 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
14220 #[doc = r" converts the [`RequestBuilder`] into a future,"]
14221 #[doc = r" executes the request and returns a `Result` with the parsed"]
14222 #[doc = r" response."]
14223 #[doc = r""]
14224 #[doc = r" If you need lower-level access to the raw response details"]
14225 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
14226 #[doc = r" can finalize the request using the"]
14227 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
14228 #[doc = r" that resolves to a lower-level [`Response`] value."]
14229 pub struct RequestBuilder {
14230 pub(crate) client: super::super::Client,
14231 pub(crate) organization: String,
14232 pub(crate) repository_id: String,
14233 pub(crate) pull_request_id: i32,
14234 pub(crate) status_id: i32,
14235 pub(crate) project: String,
14236 }
14237 impl RequestBuilder {
14238 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
14239 #[doc = ""]
14240 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
14241 #[doc = "However, this function can provide more flexibility when required."]
14242 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
14243 Box::pin({
14244 let this = self.clone();
14245 async move {
14246 let url = this.url()?;
14247 let mut req =
14248 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
14249 if let Some(auth_header) = this
14250 .client
14251 .token_credential()
14252 .http_authorization_header(&this.client.scopes())
14253 .await?
14254 {
14255 req.insert_header(
14256 azure_core::http::headers::AUTHORIZATION,
14257 auth_header,
14258 );
14259 }
14260 let req_body = azure_core::Bytes::new();
14261 req.set_body(req_body);
14262 Ok(Response(this.client.send(&mut req).await?))
14263 }
14264 })
14265 }
14266 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
14267 let mut url = azure_core::http::Url::parse(&format!(
14268 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses/{}",
14269 self.client.endpoint(),
14270 &self.organization,
14271 &self.project,
14272 &self.repository_id,
14273 &self.pull_request_id,
14274 &self.status_id
14275 ))?;
14276 let has_api_version_already = url
14277 .query_pairs()
14278 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
14279 if !has_api_version_already {
14280 url.query_pairs_mut().append_pair(
14281 azure_core::http::headers::query_param::API_VERSION,
14282 "7.1-preview",
14283 );
14284 }
14285 Ok(url)
14286 }
14287 }
14288 impl std::future::IntoFuture for RequestBuilder {
14289 type Output = azure_core::Result<()>;
14290 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
14291 #[doc = "Returns a future that sends the request and waits for the response."]
14292 #[doc = ""]
14293 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
14294 #[doc = ""]
14295 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
14296 fn into_future(self) -> Self::IntoFuture {
14297 Box::pin(async move {
14298 let _rsp = self.send().await?;
14299 Ok(())
14300 })
14301 }
14302 }
14303 }
14304}
14305pub mod pull_request_threads {
14306 use super::models;
14307 #[cfg(not(target_arch = "wasm32"))]
14308 use futures::future::BoxFuture;
14309 #[cfg(target_arch = "wasm32")]
14310 use futures::future::LocalBoxFuture as BoxFuture;
14311 pub struct Client(pub(crate) super::Client);
14312 impl Client {
14313 #[doc = "Retrieve all threads in a pull request."]
14314 #[doc = ""]
14315 #[doc = "Arguments:"]
14316 #[doc = "* `organization`: The name of the Azure DevOps organization."]
14317 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
14318 #[doc = "* `pull_request_id`: ID of the pull request."]
14319 #[doc = "* `project`: Project ID or project name"]
14320 pub fn list(
14321 &self,
14322 organization: impl Into<String>,
14323 repository_id: impl Into<String>,
14324 pull_request_id: i32,
14325 project: impl Into<String>,
14326 ) -> list::RequestBuilder {
14327 list::RequestBuilder {
14328 client: self.0.clone(),
14329 organization: organization.into(),
14330 repository_id: repository_id.into(),
14331 pull_request_id,
14332 project: project.into(),
14333 iteration: None,
14334 base_iteration: None,
14335 }
14336 }
14337 #[doc = "Create a thread in a pull request."]
14338 #[doc = ""]
14339 #[doc = "Arguments:"]
14340 #[doc = "* `organization`: The name of the Azure DevOps organization."]
14341 #[doc = "* `body`: The thread to create. Thread must contain at least one comment."]
14342 #[doc = "* `repository_id`: Repository ID of the pull request's target branch."]
14343 #[doc = "* `pull_request_id`: ID of the pull request."]
14344 #[doc = "* `project`: Project ID or project name"]
14345 pub fn create(
14346 &self,
14347 organization: impl Into<String>,
14348 body: impl Into<models::GitPullRequestCommentThread>,
14349 repository_id: impl Into<String>,
14350 pull_request_id: i32,
14351 project: impl Into<String>,
14352 ) -> create::RequestBuilder {
14353 create::RequestBuilder {
14354 client: self.0.clone(),
14355 organization: organization.into(),
14356 body: body.into(),
14357 repository_id: repository_id.into(),
14358 pull_request_id,
14359 project: project.into(),
14360 }
14361 }
14362 #[doc = "Retrieve a thread in a pull request."]
14363 #[doc = ""]
14364 #[doc = "Arguments:"]
14365 #[doc = "* `organization`: The name of the Azure DevOps organization."]
14366 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
14367 #[doc = "* `pull_request_id`: ID of the pull request."]
14368 #[doc = "* `thread_id`: ID of the thread."]
14369 #[doc = "* `project`: Project ID or project name"]
14370 pub fn get(
14371 &self,
14372 organization: impl Into<String>,
14373 repository_id: impl Into<String>,
14374 pull_request_id: i32,
14375 thread_id: i32,
14376 project: impl Into<String>,
14377 ) -> get::RequestBuilder {
14378 get::RequestBuilder {
14379 client: self.0.clone(),
14380 organization: organization.into(),
14381 repository_id: repository_id.into(),
14382 pull_request_id,
14383 thread_id,
14384 project: project.into(),
14385 iteration: None,
14386 base_iteration: None,
14387 }
14388 }
14389 #[doc = "Update a thread in a pull request."]
14390 #[doc = ""]
14391 #[doc = "Arguments:"]
14392 #[doc = "* `organization`: The name of the Azure DevOps organization."]
14393 #[doc = "* `body`: The thread content that should be updated."]
14394 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
14395 #[doc = "* `pull_request_id`: ID of the pull request."]
14396 #[doc = "* `thread_id`: ID of the thread to update."]
14397 #[doc = "* `project`: Project ID or project name"]
14398 pub fn update(
14399 &self,
14400 organization: impl Into<String>,
14401 body: impl Into<models::GitPullRequestCommentThread>,
14402 repository_id: impl Into<String>,
14403 pull_request_id: i32,
14404 thread_id: i32,
14405 project: impl Into<String>,
14406 ) -> update::RequestBuilder {
14407 update::RequestBuilder {
14408 client: self.0.clone(),
14409 organization: organization.into(),
14410 body: body.into(),
14411 repository_id: repository_id.into(),
14412 pull_request_id,
14413 thread_id,
14414 project: project.into(),
14415 }
14416 }
14417 }
14418 pub mod list {
14419 use super::models;
14420 #[cfg(not(target_arch = "wasm32"))]
14421 use futures::future::BoxFuture;
14422 #[cfg(target_arch = "wasm32")]
14423 use futures::future::LocalBoxFuture as BoxFuture;
14424 #[derive(Debug)]
14425 pub struct Response(azure_core::http::Response);
14426 impl Response {
14427 pub async fn into_raw_body(
14428 self,
14429 ) -> azure_core::Result<models::GitPullRequestCommentThreadList> {
14430 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
14431 let body: models::GitPullRequestCommentThreadList = serde_json::from_slice(&bytes)
14432 .map_err(|e| {
14433 azure_core::error::Error::full(
14434 azure_core::error::ErrorKind::DataConversion,
14435 e,
14436 format!(
14437 "Failed to deserialize response:\n{}",
14438 String::from_utf8_lossy(&bytes)
14439 ),
14440 )
14441 })?;
14442 Ok(body)
14443 }
14444 pub fn into_raw_response(self) -> azure_core::http::Response {
14445 self.0
14446 }
14447 pub fn as_raw_response(&self) -> &azure_core::http::Response {
14448 &self.0
14449 }
14450 }
14451 impl From<Response> for azure_core::http::Response {
14452 fn from(rsp: Response) -> Self {
14453 rsp.into_raw_response()
14454 }
14455 }
14456 impl AsRef<azure_core::http::Response> for Response {
14457 fn as_ref(&self) -> &azure_core::http::Response {
14458 self.as_raw_response()
14459 }
14460 }
14461 #[derive(Clone)]
14462 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
14463 #[doc = r""]
14464 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
14465 #[doc = r" parameters can be chained."]
14466 #[doc = r""]
14467 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
14468 #[doc = r" converts the [`RequestBuilder`] into a future,"]
14469 #[doc = r" executes the request and returns a `Result` with the parsed"]
14470 #[doc = r" response."]
14471 #[doc = r""]
14472 #[doc = r" If you need lower-level access to the raw response details"]
14473 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
14474 #[doc = r" can finalize the request using the"]
14475 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
14476 #[doc = r" that resolves to a lower-level [`Response`] value."]
14477 pub struct RequestBuilder {
14478 pub(crate) client: super::super::Client,
14479 pub(crate) organization: String,
14480 pub(crate) repository_id: String,
14481 pub(crate) pull_request_id: i32,
14482 pub(crate) project: String,
14483 pub(crate) iteration: Option<i32>,
14484 pub(crate) base_iteration: Option<i32>,
14485 }
14486 impl RequestBuilder {
14487 #[doc = "If specified, thread positions will be tracked using this iteration as the right side of the diff."]
14488 pub fn iteration(mut self, iteration: i32) -> Self {
14489 self.iteration = Some(iteration);
14490 self
14491 }
14492 #[doc = "If specified, thread positions will be tracked using this iteration as the left side of the diff."]
14493 pub fn base_iteration(mut self, base_iteration: i32) -> Self {
14494 self.base_iteration = Some(base_iteration);
14495 self
14496 }
14497 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
14498 #[doc = ""]
14499 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
14500 #[doc = "However, this function can provide more flexibility when required."]
14501 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
14502 Box::pin({
14503 let this = self.clone();
14504 async move {
14505 let url = this.url()?;
14506 let mut req =
14507 azure_core::http::Request::new(url, azure_core::http::Method::Get);
14508 if let Some(auth_header) = this
14509 .client
14510 .token_credential()
14511 .http_authorization_header(&this.client.scopes())
14512 .await?
14513 {
14514 req.insert_header(
14515 azure_core::http::headers::AUTHORIZATION,
14516 auth_header,
14517 );
14518 }
14519 if let Some(iteration) = &this.iteration {
14520 req.url_mut()
14521 .query_pairs_mut()
14522 .append_pair("$iteration", &iteration.to_string());
14523 }
14524 if let Some(base_iteration) = &this.base_iteration {
14525 req.url_mut()
14526 .query_pairs_mut()
14527 .append_pair("$baseIteration", &base_iteration.to_string());
14528 }
14529 let req_body = azure_core::Bytes::new();
14530 req.set_body(req_body);
14531 Ok(Response(this.client.send(&mut req).await?))
14532 }
14533 })
14534 }
14535 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
14536 let mut url = azure_core::http::Url::parse(&format!(
14537 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads",
14538 self.client.endpoint(),
14539 &self.organization,
14540 &self.project,
14541 &self.repository_id,
14542 &self.pull_request_id
14543 ))?;
14544 let has_api_version_already = url
14545 .query_pairs()
14546 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
14547 if !has_api_version_already {
14548 url.query_pairs_mut().append_pair(
14549 azure_core::http::headers::query_param::API_VERSION,
14550 "7.1-preview",
14551 );
14552 }
14553 Ok(url)
14554 }
14555 }
14556 impl std::future::IntoFuture for RequestBuilder {
14557 type Output = azure_core::Result<models::GitPullRequestCommentThreadList>;
14558 type IntoFuture =
14559 BoxFuture<'static, azure_core::Result<models::GitPullRequestCommentThreadList>>;
14560 #[doc = "Returns a future that sends the request and returns the parsed response body."]
14561 #[doc = ""]
14562 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
14563 #[doc = ""]
14564 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
14565 fn into_future(self) -> Self::IntoFuture {
14566 Box::pin(async move { self.send().await?.into_raw_body().await })
14567 }
14568 }
14569 }
14570 pub mod create {
14571 use super::models;
14572 #[cfg(not(target_arch = "wasm32"))]
14573 use futures::future::BoxFuture;
14574 #[cfg(target_arch = "wasm32")]
14575 use futures::future::LocalBoxFuture as BoxFuture;
14576 #[derive(Debug)]
14577 pub struct Response(azure_core::http::Response);
14578 impl Response {
14579 pub async fn into_raw_body(
14580 self,
14581 ) -> azure_core::Result<models::GitPullRequestCommentThread> {
14582 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
14583 let body: models::GitPullRequestCommentThread = serde_json::from_slice(&bytes)
14584 .map_err(|e| {
14585 azure_core::error::Error::full(
14586 azure_core::error::ErrorKind::DataConversion,
14587 e,
14588 format!(
14589 "Failed to deserialize response:\n{}",
14590 String::from_utf8_lossy(&bytes)
14591 ),
14592 )
14593 })?;
14594 Ok(body)
14595 }
14596 pub fn into_raw_response(self) -> azure_core::http::Response {
14597 self.0
14598 }
14599 pub fn as_raw_response(&self) -> &azure_core::http::Response {
14600 &self.0
14601 }
14602 }
14603 impl From<Response> for azure_core::http::Response {
14604 fn from(rsp: Response) -> Self {
14605 rsp.into_raw_response()
14606 }
14607 }
14608 impl AsRef<azure_core::http::Response> for Response {
14609 fn as_ref(&self) -> &azure_core::http::Response {
14610 self.as_raw_response()
14611 }
14612 }
14613 #[derive(Clone)]
14614 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
14615 #[doc = r""]
14616 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
14617 #[doc = r" parameters can be chained."]
14618 #[doc = r""]
14619 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
14620 #[doc = r" converts the [`RequestBuilder`] into a future,"]
14621 #[doc = r" executes the request and returns a `Result` with the parsed"]
14622 #[doc = r" response."]
14623 #[doc = r""]
14624 #[doc = r" If you need lower-level access to the raw response details"]
14625 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
14626 #[doc = r" can finalize the request using the"]
14627 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
14628 #[doc = r" that resolves to a lower-level [`Response`] value."]
14629 pub struct RequestBuilder {
14630 pub(crate) client: super::super::Client,
14631 pub(crate) organization: String,
14632 pub(crate) body: models::GitPullRequestCommentThread,
14633 pub(crate) repository_id: String,
14634 pub(crate) pull_request_id: i32,
14635 pub(crate) project: String,
14636 }
14637 impl RequestBuilder {
14638 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
14639 #[doc = ""]
14640 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
14641 #[doc = "However, this function can provide more flexibility when required."]
14642 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
14643 Box::pin({
14644 let this = self.clone();
14645 async move {
14646 let url = this.url()?;
14647 let mut req =
14648 azure_core::http::Request::new(url, azure_core::http::Method::Post);
14649 if let Some(auth_header) = this
14650 .client
14651 .token_credential()
14652 .http_authorization_header(&this.client.scopes())
14653 .await?
14654 {
14655 req.insert_header(
14656 azure_core::http::headers::AUTHORIZATION,
14657 auth_header,
14658 );
14659 }
14660 req.insert_header("content-type", "application/json");
14661 let req_body = azure_core::json::to_json(&this.body)?;
14662 req.set_body(req_body);
14663 Ok(Response(this.client.send(&mut req).await?))
14664 }
14665 })
14666 }
14667 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
14668 let mut url = azure_core::http::Url::parse(&format!(
14669 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads",
14670 self.client.endpoint(),
14671 &self.organization,
14672 &self.project,
14673 &self.repository_id,
14674 &self.pull_request_id
14675 ))?;
14676 let has_api_version_already = url
14677 .query_pairs()
14678 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
14679 if !has_api_version_already {
14680 url.query_pairs_mut().append_pair(
14681 azure_core::http::headers::query_param::API_VERSION,
14682 "7.1-preview",
14683 );
14684 }
14685 Ok(url)
14686 }
14687 }
14688 impl std::future::IntoFuture for RequestBuilder {
14689 type Output = azure_core::Result<models::GitPullRequestCommentThread>;
14690 type IntoFuture =
14691 BoxFuture<'static, azure_core::Result<models::GitPullRequestCommentThread>>;
14692 #[doc = "Returns a future that sends the request and returns the parsed response body."]
14693 #[doc = ""]
14694 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
14695 #[doc = ""]
14696 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
14697 fn into_future(self) -> Self::IntoFuture {
14698 Box::pin(async move { self.send().await?.into_raw_body().await })
14699 }
14700 }
14701 }
14702 pub mod get {
14703 use super::models;
14704 #[cfg(not(target_arch = "wasm32"))]
14705 use futures::future::BoxFuture;
14706 #[cfg(target_arch = "wasm32")]
14707 use futures::future::LocalBoxFuture as BoxFuture;
14708 #[derive(Debug)]
14709 pub struct Response(azure_core::http::Response);
14710 impl Response {
14711 pub async fn into_raw_body(
14712 self,
14713 ) -> azure_core::Result<models::GitPullRequestCommentThread> {
14714 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
14715 let body: models::GitPullRequestCommentThread = serde_json::from_slice(&bytes)
14716 .map_err(|e| {
14717 azure_core::error::Error::full(
14718 azure_core::error::ErrorKind::DataConversion,
14719 e,
14720 format!(
14721 "Failed to deserialize response:\n{}",
14722 String::from_utf8_lossy(&bytes)
14723 ),
14724 )
14725 })?;
14726 Ok(body)
14727 }
14728 pub fn into_raw_response(self) -> azure_core::http::Response {
14729 self.0
14730 }
14731 pub fn as_raw_response(&self) -> &azure_core::http::Response {
14732 &self.0
14733 }
14734 }
14735 impl From<Response> for azure_core::http::Response {
14736 fn from(rsp: Response) -> Self {
14737 rsp.into_raw_response()
14738 }
14739 }
14740 impl AsRef<azure_core::http::Response> for Response {
14741 fn as_ref(&self) -> &azure_core::http::Response {
14742 self.as_raw_response()
14743 }
14744 }
14745 #[derive(Clone)]
14746 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
14747 #[doc = r""]
14748 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
14749 #[doc = r" parameters can be chained."]
14750 #[doc = r""]
14751 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
14752 #[doc = r" converts the [`RequestBuilder`] into a future,"]
14753 #[doc = r" executes the request and returns a `Result` with the parsed"]
14754 #[doc = r" response."]
14755 #[doc = r""]
14756 #[doc = r" If you need lower-level access to the raw response details"]
14757 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
14758 #[doc = r" can finalize the request using the"]
14759 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
14760 #[doc = r" that resolves to a lower-level [`Response`] value."]
14761 pub struct RequestBuilder {
14762 pub(crate) client: super::super::Client,
14763 pub(crate) organization: String,
14764 pub(crate) repository_id: String,
14765 pub(crate) pull_request_id: i32,
14766 pub(crate) thread_id: i32,
14767 pub(crate) project: String,
14768 pub(crate) iteration: Option<i32>,
14769 pub(crate) base_iteration: Option<i32>,
14770 }
14771 impl RequestBuilder {
14772 #[doc = "If specified, thread position will be tracked using this iteration as the right side of the diff."]
14773 pub fn iteration(mut self, iteration: i32) -> Self {
14774 self.iteration = Some(iteration);
14775 self
14776 }
14777 #[doc = "If specified, thread position will be tracked using this iteration as the left side of the diff."]
14778 pub fn base_iteration(mut self, base_iteration: i32) -> Self {
14779 self.base_iteration = Some(base_iteration);
14780 self
14781 }
14782 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
14783 #[doc = ""]
14784 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
14785 #[doc = "However, this function can provide more flexibility when required."]
14786 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
14787 Box::pin({
14788 let this = self.clone();
14789 async move {
14790 let url = this.url()?;
14791 let mut req =
14792 azure_core::http::Request::new(url, azure_core::http::Method::Get);
14793 if let Some(auth_header) = this
14794 .client
14795 .token_credential()
14796 .http_authorization_header(&this.client.scopes())
14797 .await?
14798 {
14799 req.insert_header(
14800 azure_core::http::headers::AUTHORIZATION,
14801 auth_header,
14802 );
14803 }
14804 if let Some(iteration) = &this.iteration {
14805 req.url_mut()
14806 .query_pairs_mut()
14807 .append_pair("$iteration", &iteration.to_string());
14808 }
14809 if let Some(base_iteration) = &this.base_iteration {
14810 req.url_mut()
14811 .query_pairs_mut()
14812 .append_pair("$baseIteration", &base_iteration.to_string());
14813 }
14814 let req_body = azure_core::Bytes::new();
14815 req.set_body(req_body);
14816 Ok(Response(this.client.send(&mut req).await?))
14817 }
14818 })
14819 }
14820 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
14821 let mut url = azure_core::http::Url::parse(&format!(
14822 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}",
14823 self.client.endpoint(),
14824 &self.organization,
14825 &self.project,
14826 &self.repository_id,
14827 &self.pull_request_id,
14828 &self.thread_id
14829 ))?;
14830 let has_api_version_already = url
14831 .query_pairs()
14832 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
14833 if !has_api_version_already {
14834 url.query_pairs_mut().append_pair(
14835 azure_core::http::headers::query_param::API_VERSION,
14836 "7.1-preview",
14837 );
14838 }
14839 Ok(url)
14840 }
14841 }
14842 impl std::future::IntoFuture for RequestBuilder {
14843 type Output = azure_core::Result<models::GitPullRequestCommentThread>;
14844 type IntoFuture =
14845 BoxFuture<'static, azure_core::Result<models::GitPullRequestCommentThread>>;
14846 #[doc = "Returns a future that sends the request and returns the parsed response body."]
14847 #[doc = ""]
14848 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
14849 #[doc = ""]
14850 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
14851 fn into_future(self) -> Self::IntoFuture {
14852 Box::pin(async move { self.send().await?.into_raw_body().await })
14853 }
14854 }
14855 }
14856 pub mod update {
14857 use super::models;
14858 #[cfg(not(target_arch = "wasm32"))]
14859 use futures::future::BoxFuture;
14860 #[cfg(target_arch = "wasm32")]
14861 use futures::future::LocalBoxFuture as BoxFuture;
14862 #[derive(Debug)]
14863 pub struct Response(azure_core::http::Response);
14864 impl Response {
14865 pub async fn into_raw_body(
14866 self,
14867 ) -> azure_core::Result<models::GitPullRequestCommentThread> {
14868 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
14869 let body: models::GitPullRequestCommentThread = serde_json::from_slice(&bytes)
14870 .map_err(|e| {
14871 azure_core::error::Error::full(
14872 azure_core::error::ErrorKind::DataConversion,
14873 e,
14874 format!(
14875 "Failed to deserialize response:\n{}",
14876 String::from_utf8_lossy(&bytes)
14877 ),
14878 )
14879 })?;
14880 Ok(body)
14881 }
14882 pub fn into_raw_response(self) -> azure_core::http::Response {
14883 self.0
14884 }
14885 pub fn as_raw_response(&self) -> &azure_core::http::Response {
14886 &self.0
14887 }
14888 }
14889 impl From<Response> for azure_core::http::Response {
14890 fn from(rsp: Response) -> Self {
14891 rsp.into_raw_response()
14892 }
14893 }
14894 impl AsRef<azure_core::http::Response> for Response {
14895 fn as_ref(&self) -> &azure_core::http::Response {
14896 self.as_raw_response()
14897 }
14898 }
14899 #[derive(Clone)]
14900 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
14901 #[doc = r""]
14902 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
14903 #[doc = r" parameters can be chained."]
14904 #[doc = r""]
14905 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
14906 #[doc = r" converts the [`RequestBuilder`] into a future,"]
14907 #[doc = r" executes the request and returns a `Result` with the parsed"]
14908 #[doc = r" response."]
14909 #[doc = r""]
14910 #[doc = r" If you need lower-level access to the raw response details"]
14911 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
14912 #[doc = r" can finalize the request using the"]
14913 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
14914 #[doc = r" that resolves to a lower-level [`Response`] value."]
14915 pub struct RequestBuilder {
14916 pub(crate) client: super::super::Client,
14917 pub(crate) organization: String,
14918 pub(crate) body: models::GitPullRequestCommentThread,
14919 pub(crate) repository_id: String,
14920 pub(crate) pull_request_id: i32,
14921 pub(crate) thread_id: i32,
14922 pub(crate) project: String,
14923 }
14924 impl RequestBuilder {
14925 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
14926 #[doc = ""]
14927 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
14928 #[doc = "However, this function can provide more flexibility when required."]
14929 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
14930 Box::pin({
14931 let this = self.clone();
14932 async move {
14933 let url = this.url()?;
14934 let mut req =
14935 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
14936 if let Some(auth_header) = this
14937 .client
14938 .token_credential()
14939 .http_authorization_header(&this.client.scopes())
14940 .await?
14941 {
14942 req.insert_header(
14943 azure_core::http::headers::AUTHORIZATION,
14944 auth_header,
14945 );
14946 }
14947 req.insert_header("content-type", "application/json");
14948 let req_body = azure_core::json::to_json(&this.body)?;
14949 req.set_body(req_body);
14950 Ok(Response(this.client.send(&mut req).await?))
14951 }
14952 })
14953 }
14954 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
14955 let mut url = azure_core::http::Url::parse(&format!(
14956 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}",
14957 self.client.endpoint(),
14958 &self.organization,
14959 &self.project,
14960 &self.repository_id,
14961 &self.pull_request_id,
14962 &self.thread_id
14963 ))?;
14964 let has_api_version_already = url
14965 .query_pairs()
14966 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
14967 if !has_api_version_already {
14968 url.query_pairs_mut().append_pair(
14969 azure_core::http::headers::query_param::API_VERSION,
14970 "7.1-preview",
14971 );
14972 }
14973 Ok(url)
14974 }
14975 }
14976 impl std::future::IntoFuture for RequestBuilder {
14977 type Output = azure_core::Result<models::GitPullRequestCommentThread>;
14978 type IntoFuture =
14979 BoxFuture<'static, azure_core::Result<models::GitPullRequestCommentThread>>;
14980 #[doc = "Returns a future that sends the request and returns the parsed response body."]
14981 #[doc = ""]
14982 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
14983 #[doc = ""]
14984 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
14985 fn into_future(self) -> Self::IntoFuture {
14986 Box::pin(async move { self.send().await?.into_raw_body().await })
14987 }
14988 }
14989 }
14990}
14991pub mod pull_request_thread_comments {
14992 use super::models;
14993 #[cfg(not(target_arch = "wasm32"))]
14994 use futures::future::BoxFuture;
14995 #[cfg(target_arch = "wasm32")]
14996 use futures::future::LocalBoxFuture as BoxFuture;
14997 pub struct Client(pub(crate) super::Client);
14998 impl Client {
14999 #[doc = "Retrieve all comments associated with a specific thread in a pull request."]
15000 #[doc = ""]
15001 #[doc = "Arguments:"]
15002 #[doc = "* `organization`: The name of the Azure DevOps organization."]
15003 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
15004 #[doc = "* `pull_request_id`: ID of the pull request."]
15005 #[doc = "* `thread_id`: ID of the thread."]
15006 #[doc = "* `project`: Project ID or project name"]
15007 pub fn list(
15008 &self,
15009 organization: impl Into<String>,
15010 repository_id: impl Into<String>,
15011 pull_request_id: i32,
15012 thread_id: i32,
15013 project: impl Into<String>,
15014 ) -> list::RequestBuilder {
15015 list::RequestBuilder {
15016 client: self.0.clone(),
15017 organization: organization.into(),
15018 repository_id: repository_id.into(),
15019 pull_request_id,
15020 thread_id,
15021 project: project.into(),
15022 }
15023 }
15024 #[doc = "Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread)."]
15025 #[doc = ""]
15026 #[doc = "Arguments:"]
15027 #[doc = "* `organization`: The name of the Azure DevOps organization."]
15028 #[doc = "* `body`: The comment to create. Comments can be up to 150,000 characters."]
15029 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
15030 #[doc = "* `pull_request_id`: ID of the pull request."]
15031 #[doc = "* `thread_id`: ID of the thread that the desired comment is in."]
15032 #[doc = "* `project`: Project ID or project name"]
15033 pub fn create(
15034 &self,
15035 organization: impl Into<String>,
15036 body: impl Into<models::Comment>,
15037 repository_id: impl Into<String>,
15038 pull_request_id: i32,
15039 thread_id: i32,
15040 project: impl Into<String>,
15041 ) -> create::RequestBuilder {
15042 create::RequestBuilder {
15043 client: self.0.clone(),
15044 organization: organization.into(),
15045 body: body.into(),
15046 repository_id: repository_id.into(),
15047 pull_request_id,
15048 thread_id,
15049 project: project.into(),
15050 }
15051 }
15052 #[doc = "Retrieve a comment associated with a specific thread in a pull request."]
15053 #[doc = ""]
15054 #[doc = "Arguments:"]
15055 #[doc = "* `organization`: The name of the Azure DevOps organization."]
15056 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
15057 #[doc = "* `pull_request_id`: ID of the pull request."]
15058 #[doc = "* `thread_id`: ID of the thread that the desired comment is in."]
15059 #[doc = "* `comment_id`: ID of the comment."]
15060 #[doc = "* `project`: Project ID or project name"]
15061 pub fn get(
15062 &self,
15063 organization: impl Into<String>,
15064 repository_id: impl Into<String>,
15065 pull_request_id: i32,
15066 thread_id: i32,
15067 comment_id: i32,
15068 project: impl Into<String>,
15069 ) -> get::RequestBuilder {
15070 get::RequestBuilder {
15071 client: self.0.clone(),
15072 organization: organization.into(),
15073 repository_id: repository_id.into(),
15074 pull_request_id,
15075 thread_id,
15076 comment_id,
15077 project: project.into(),
15078 }
15079 }
15080 #[doc = "Update a comment associated with a specific thread in a pull request."]
15081 #[doc = ""]
15082 #[doc = "Arguments:"]
15083 #[doc = "* `organization`: The name of the Azure DevOps organization."]
15084 #[doc = "* `body`: The comment content that should be updated. Comments can be up to 150,000 characters."]
15085 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
15086 #[doc = "* `pull_request_id`: ID of the pull request."]
15087 #[doc = "* `thread_id`: ID of the thread that the desired comment is in."]
15088 #[doc = "* `comment_id`: ID of the comment to update."]
15089 #[doc = "* `project`: Project ID or project name"]
15090 pub fn update(
15091 &self,
15092 organization: impl Into<String>,
15093 body: impl Into<models::Comment>,
15094 repository_id: impl Into<String>,
15095 pull_request_id: i32,
15096 thread_id: i32,
15097 comment_id: i32,
15098 project: impl Into<String>,
15099 ) -> update::RequestBuilder {
15100 update::RequestBuilder {
15101 client: self.0.clone(),
15102 organization: organization.into(),
15103 body: body.into(),
15104 repository_id: repository_id.into(),
15105 pull_request_id,
15106 thread_id,
15107 comment_id,
15108 project: project.into(),
15109 }
15110 }
15111 #[doc = "Delete a comment associated with a specific thread in a pull request."]
15112 #[doc = ""]
15113 #[doc = "Arguments:"]
15114 #[doc = "* `organization`: The name of the Azure DevOps organization."]
15115 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
15116 #[doc = "* `pull_request_id`: ID of the pull request."]
15117 #[doc = "* `thread_id`: ID of the thread that the desired comment is in."]
15118 #[doc = "* `comment_id`: ID of the comment."]
15119 #[doc = "* `project`: Project ID or project name"]
15120 pub fn delete(
15121 &self,
15122 organization: impl Into<String>,
15123 repository_id: impl Into<String>,
15124 pull_request_id: i32,
15125 thread_id: i32,
15126 comment_id: i32,
15127 project: impl Into<String>,
15128 ) -> delete::RequestBuilder {
15129 delete::RequestBuilder {
15130 client: self.0.clone(),
15131 organization: organization.into(),
15132 repository_id: repository_id.into(),
15133 pull_request_id,
15134 thread_id,
15135 comment_id,
15136 project: project.into(),
15137 }
15138 }
15139 }
15140 pub mod list {
15141 use super::models;
15142 #[cfg(not(target_arch = "wasm32"))]
15143 use futures::future::BoxFuture;
15144 #[cfg(target_arch = "wasm32")]
15145 use futures::future::LocalBoxFuture as BoxFuture;
15146 #[derive(Debug)]
15147 pub struct Response(azure_core::http::Response);
15148 impl Response {
15149 pub async fn into_raw_body(self) -> azure_core::Result<models::CommentList> {
15150 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
15151 let body: models::CommentList = serde_json::from_slice(&bytes).map_err(|e| {
15152 azure_core::error::Error::full(
15153 azure_core::error::ErrorKind::DataConversion,
15154 e,
15155 format!(
15156 "Failed to deserialize response:\n{}",
15157 String::from_utf8_lossy(&bytes)
15158 ),
15159 )
15160 })?;
15161 Ok(body)
15162 }
15163 pub fn into_raw_response(self) -> azure_core::http::Response {
15164 self.0
15165 }
15166 pub fn as_raw_response(&self) -> &azure_core::http::Response {
15167 &self.0
15168 }
15169 }
15170 impl From<Response> for azure_core::http::Response {
15171 fn from(rsp: Response) -> Self {
15172 rsp.into_raw_response()
15173 }
15174 }
15175 impl AsRef<azure_core::http::Response> for Response {
15176 fn as_ref(&self) -> &azure_core::http::Response {
15177 self.as_raw_response()
15178 }
15179 }
15180 #[derive(Clone)]
15181 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15182 #[doc = r""]
15183 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15184 #[doc = r" parameters can be chained."]
15185 #[doc = r""]
15186 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15187 #[doc = r" converts the [`RequestBuilder`] into a future,"]
15188 #[doc = r" executes the request and returns a `Result` with the parsed"]
15189 #[doc = r" response."]
15190 #[doc = r""]
15191 #[doc = r" If you need lower-level access to the raw response details"]
15192 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15193 #[doc = r" can finalize the request using the"]
15194 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15195 #[doc = r" that resolves to a lower-level [`Response`] value."]
15196 pub struct RequestBuilder {
15197 pub(crate) client: super::super::Client,
15198 pub(crate) organization: String,
15199 pub(crate) repository_id: String,
15200 pub(crate) pull_request_id: i32,
15201 pub(crate) thread_id: i32,
15202 pub(crate) project: String,
15203 }
15204 impl RequestBuilder {
15205 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15206 #[doc = ""]
15207 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15208 #[doc = "However, this function can provide more flexibility when required."]
15209 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15210 Box::pin({
15211 let this = self.clone();
15212 async move {
15213 let url = this.url()?;
15214 let mut req =
15215 azure_core::http::Request::new(url, azure_core::http::Method::Get);
15216 if let Some(auth_header) = this
15217 .client
15218 .token_credential()
15219 .http_authorization_header(&this.client.scopes())
15220 .await?
15221 {
15222 req.insert_header(
15223 azure_core::http::headers::AUTHORIZATION,
15224 auth_header,
15225 );
15226 }
15227 let req_body = azure_core::Bytes::new();
15228 req.set_body(req_body);
15229 Ok(Response(this.client.send(&mut req).await?))
15230 }
15231 })
15232 }
15233 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
15234 let mut url = azure_core::http::Url::parse(&format!(
15235 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments",
15236 self.client.endpoint(),
15237 &self.organization,
15238 &self.project,
15239 &self.repository_id,
15240 &self.pull_request_id,
15241 &self.thread_id
15242 ))?;
15243 let has_api_version_already = url
15244 .query_pairs()
15245 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
15246 if !has_api_version_already {
15247 url.query_pairs_mut().append_pair(
15248 azure_core::http::headers::query_param::API_VERSION,
15249 "7.1-preview",
15250 );
15251 }
15252 Ok(url)
15253 }
15254 }
15255 impl std::future::IntoFuture for RequestBuilder {
15256 type Output = azure_core::Result<models::CommentList>;
15257 type IntoFuture = BoxFuture<'static, azure_core::Result<models::CommentList>>;
15258 #[doc = "Returns a future that sends the request and returns the parsed response body."]
15259 #[doc = ""]
15260 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
15261 #[doc = ""]
15262 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
15263 fn into_future(self) -> Self::IntoFuture {
15264 Box::pin(async move { self.send().await?.into_raw_body().await })
15265 }
15266 }
15267 }
15268 pub mod create {
15269 use super::models;
15270 #[cfg(not(target_arch = "wasm32"))]
15271 use futures::future::BoxFuture;
15272 #[cfg(target_arch = "wasm32")]
15273 use futures::future::LocalBoxFuture as BoxFuture;
15274 #[derive(Debug)]
15275 pub struct Response(azure_core::http::Response);
15276 impl Response {
15277 pub async fn into_raw_body(self) -> azure_core::Result<models::Comment> {
15278 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
15279 let body: models::Comment = serde_json::from_slice(&bytes).map_err(|e| {
15280 azure_core::error::Error::full(
15281 azure_core::error::ErrorKind::DataConversion,
15282 e,
15283 format!(
15284 "Failed to deserialize response:\n{}",
15285 String::from_utf8_lossy(&bytes)
15286 ),
15287 )
15288 })?;
15289 Ok(body)
15290 }
15291 pub fn into_raw_response(self) -> azure_core::http::Response {
15292 self.0
15293 }
15294 pub fn as_raw_response(&self) -> &azure_core::http::Response {
15295 &self.0
15296 }
15297 }
15298 impl From<Response> for azure_core::http::Response {
15299 fn from(rsp: Response) -> Self {
15300 rsp.into_raw_response()
15301 }
15302 }
15303 impl AsRef<azure_core::http::Response> for Response {
15304 fn as_ref(&self) -> &azure_core::http::Response {
15305 self.as_raw_response()
15306 }
15307 }
15308 #[derive(Clone)]
15309 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15310 #[doc = r""]
15311 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15312 #[doc = r" parameters can be chained."]
15313 #[doc = r""]
15314 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15315 #[doc = r" converts the [`RequestBuilder`] into a future,"]
15316 #[doc = r" executes the request and returns a `Result` with the parsed"]
15317 #[doc = r" response."]
15318 #[doc = r""]
15319 #[doc = r" If you need lower-level access to the raw response details"]
15320 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15321 #[doc = r" can finalize the request using the"]
15322 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15323 #[doc = r" that resolves to a lower-level [`Response`] value."]
15324 pub struct RequestBuilder {
15325 pub(crate) client: super::super::Client,
15326 pub(crate) organization: String,
15327 pub(crate) body: models::Comment,
15328 pub(crate) repository_id: String,
15329 pub(crate) pull_request_id: i32,
15330 pub(crate) thread_id: i32,
15331 pub(crate) project: String,
15332 }
15333 impl RequestBuilder {
15334 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15335 #[doc = ""]
15336 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15337 #[doc = "However, this function can provide more flexibility when required."]
15338 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15339 Box::pin({
15340 let this = self.clone();
15341 async move {
15342 let url = this.url()?;
15343 let mut req =
15344 azure_core::http::Request::new(url, azure_core::http::Method::Post);
15345 if let Some(auth_header) = this
15346 .client
15347 .token_credential()
15348 .http_authorization_header(&this.client.scopes())
15349 .await?
15350 {
15351 req.insert_header(
15352 azure_core::http::headers::AUTHORIZATION,
15353 auth_header,
15354 );
15355 }
15356 req.insert_header("content-type", "application/json");
15357 let req_body = azure_core::json::to_json(&this.body)?;
15358 req.set_body(req_body);
15359 Ok(Response(this.client.send(&mut req).await?))
15360 }
15361 })
15362 }
15363 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
15364 let mut url = azure_core::http::Url::parse(&format!(
15365 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments",
15366 self.client.endpoint(),
15367 &self.organization,
15368 &self.project,
15369 &self.repository_id,
15370 &self.pull_request_id,
15371 &self.thread_id
15372 ))?;
15373 let has_api_version_already = url
15374 .query_pairs()
15375 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
15376 if !has_api_version_already {
15377 url.query_pairs_mut().append_pair(
15378 azure_core::http::headers::query_param::API_VERSION,
15379 "7.1-preview",
15380 );
15381 }
15382 Ok(url)
15383 }
15384 }
15385 impl std::future::IntoFuture for RequestBuilder {
15386 type Output = azure_core::Result<models::Comment>;
15387 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Comment>>;
15388 #[doc = "Returns a future that sends the request and returns the parsed response body."]
15389 #[doc = ""]
15390 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
15391 #[doc = ""]
15392 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
15393 fn into_future(self) -> Self::IntoFuture {
15394 Box::pin(async move { self.send().await?.into_raw_body().await })
15395 }
15396 }
15397 }
15398 pub mod get {
15399 use super::models;
15400 #[cfg(not(target_arch = "wasm32"))]
15401 use futures::future::BoxFuture;
15402 #[cfg(target_arch = "wasm32")]
15403 use futures::future::LocalBoxFuture as BoxFuture;
15404 #[derive(Debug)]
15405 pub struct Response(azure_core::http::Response);
15406 impl Response {
15407 pub async fn into_raw_body(self) -> azure_core::Result<models::Comment> {
15408 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
15409 let body: models::Comment = serde_json::from_slice(&bytes).map_err(|e| {
15410 azure_core::error::Error::full(
15411 azure_core::error::ErrorKind::DataConversion,
15412 e,
15413 format!(
15414 "Failed to deserialize response:\n{}",
15415 String::from_utf8_lossy(&bytes)
15416 ),
15417 )
15418 })?;
15419 Ok(body)
15420 }
15421 pub fn into_raw_response(self) -> azure_core::http::Response {
15422 self.0
15423 }
15424 pub fn as_raw_response(&self) -> &azure_core::http::Response {
15425 &self.0
15426 }
15427 }
15428 impl From<Response> for azure_core::http::Response {
15429 fn from(rsp: Response) -> Self {
15430 rsp.into_raw_response()
15431 }
15432 }
15433 impl AsRef<azure_core::http::Response> for Response {
15434 fn as_ref(&self) -> &azure_core::http::Response {
15435 self.as_raw_response()
15436 }
15437 }
15438 #[derive(Clone)]
15439 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15440 #[doc = r""]
15441 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15442 #[doc = r" parameters can be chained."]
15443 #[doc = r""]
15444 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15445 #[doc = r" converts the [`RequestBuilder`] into a future,"]
15446 #[doc = r" executes the request and returns a `Result` with the parsed"]
15447 #[doc = r" response."]
15448 #[doc = r""]
15449 #[doc = r" If you need lower-level access to the raw response details"]
15450 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15451 #[doc = r" can finalize the request using the"]
15452 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15453 #[doc = r" that resolves to a lower-level [`Response`] value."]
15454 pub struct RequestBuilder {
15455 pub(crate) client: super::super::Client,
15456 pub(crate) organization: String,
15457 pub(crate) repository_id: String,
15458 pub(crate) pull_request_id: i32,
15459 pub(crate) thread_id: i32,
15460 pub(crate) comment_id: i32,
15461 pub(crate) project: String,
15462 }
15463 impl RequestBuilder {
15464 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15465 #[doc = ""]
15466 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15467 #[doc = "However, this function can provide more flexibility when required."]
15468 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15469 Box::pin({
15470 let this = self.clone();
15471 async move {
15472 let url = this.url()?;
15473 let mut req =
15474 azure_core::http::Request::new(url, azure_core::http::Method::Get);
15475 if let Some(auth_header) = this
15476 .client
15477 .token_credential()
15478 .http_authorization_header(&this.client.scopes())
15479 .await?
15480 {
15481 req.insert_header(
15482 azure_core::http::headers::AUTHORIZATION,
15483 auth_header,
15484 );
15485 }
15486 let req_body = azure_core::Bytes::new();
15487 req.set_body(req_body);
15488 Ok(Response(this.client.send(&mut req).await?))
15489 }
15490 })
15491 }
15492 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
15493 let mut url = azure_core::http::Url::parse(&format!(
15494 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}",
15495 self.client.endpoint(),
15496 &self.organization,
15497 &self.project,
15498 &self.repository_id,
15499 &self.pull_request_id,
15500 &self.thread_id,
15501 &self.comment_id
15502 ))?;
15503 let has_api_version_already = url
15504 .query_pairs()
15505 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
15506 if !has_api_version_already {
15507 url.query_pairs_mut().append_pair(
15508 azure_core::http::headers::query_param::API_VERSION,
15509 "7.1-preview",
15510 );
15511 }
15512 Ok(url)
15513 }
15514 }
15515 impl std::future::IntoFuture for RequestBuilder {
15516 type Output = azure_core::Result<models::Comment>;
15517 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Comment>>;
15518 #[doc = "Returns a future that sends the request and returns the parsed response body."]
15519 #[doc = ""]
15520 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
15521 #[doc = ""]
15522 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
15523 fn into_future(self) -> Self::IntoFuture {
15524 Box::pin(async move { self.send().await?.into_raw_body().await })
15525 }
15526 }
15527 }
15528 pub mod update {
15529 use super::models;
15530 #[cfg(not(target_arch = "wasm32"))]
15531 use futures::future::BoxFuture;
15532 #[cfg(target_arch = "wasm32")]
15533 use futures::future::LocalBoxFuture as BoxFuture;
15534 #[derive(Debug)]
15535 pub struct Response(azure_core::http::Response);
15536 impl Response {
15537 pub async fn into_raw_body(self) -> azure_core::Result<models::Comment> {
15538 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
15539 let body: models::Comment = serde_json::from_slice(&bytes).map_err(|e| {
15540 azure_core::error::Error::full(
15541 azure_core::error::ErrorKind::DataConversion,
15542 e,
15543 format!(
15544 "Failed to deserialize response:\n{}",
15545 String::from_utf8_lossy(&bytes)
15546 ),
15547 )
15548 })?;
15549 Ok(body)
15550 }
15551 pub fn into_raw_response(self) -> azure_core::http::Response {
15552 self.0
15553 }
15554 pub fn as_raw_response(&self) -> &azure_core::http::Response {
15555 &self.0
15556 }
15557 }
15558 impl From<Response> for azure_core::http::Response {
15559 fn from(rsp: Response) -> Self {
15560 rsp.into_raw_response()
15561 }
15562 }
15563 impl AsRef<azure_core::http::Response> for Response {
15564 fn as_ref(&self) -> &azure_core::http::Response {
15565 self.as_raw_response()
15566 }
15567 }
15568 #[derive(Clone)]
15569 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15570 #[doc = r""]
15571 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15572 #[doc = r" parameters can be chained."]
15573 #[doc = r""]
15574 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15575 #[doc = r" converts the [`RequestBuilder`] into a future,"]
15576 #[doc = r" executes the request and returns a `Result` with the parsed"]
15577 #[doc = r" response."]
15578 #[doc = r""]
15579 #[doc = r" If you need lower-level access to the raw response details"]
15580 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15581 #[doc = r" can finalize the request using the"]
15582 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15583 #[doc = r" that resolves to a lower-level [`Response`] value."]
15584 pub struct RequestBuilder {
15585 pub(crate) client: super::super::Client,
15586 pub(crate) organization: String,
15587 pub(crate) body: models::Comment,
15588 pub(crate) repository_id: String,
15589 pub(crate) pull_request_id: i32,
15590 pub(crate) thread_id: i32,
15591 pub(crate) comment_id: i32,
15592 pub(crate) project: String,
15593 }
15594 impl RequestBuilder {
15595 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15596 #[doc = ""]
15597 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15598 #[doc = "However, this function can provide more flexibility when required."]
15599 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15600 Box::pin({
15601 let this = self.clone();
15602 async move {
15603 let url = this.url()?;
15604 let mut req =
15605 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
15606 if let Some(auth_header) = this
15607 .client
15608 .token_credential()
15609 .http_authorization_header(&this.client.scopes())
15610 .await?
15611 {
15612 req.insert_header(
15613 azure_core::http::headers::AUTHORIZATION,
15614 auth_header,
15615 );
15616 }
15617 req.insert_header("content-type", "application/json");
15618 let req_body = azure_core::json::to_json(&this.body)?;
15619 req.set_body(req_body);
15620 Ok(Response(this.client.send(&mut req).await?))
15621 }
15622 })
15623 }
15624 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
15625 let mut url = azure_core::http::Url::parse(&format!(
15626 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}",
15627 self.client.endpoint(),
15628 &self.organization,
15629 &self.project,
15630 &self.repository_id,
15631 &self.pull_request_id,
15632 &self.thread_id,
15633 &self.comment_id
15634 ))?;
15635 let has_api_version_already = url
15636 .query_pairs()
15637 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
15638 if !has_api_version_already {
15639 url.query_pairs_mut().append_pair(
15640 azure_core::http::headers::query_param::API_VERSION,
15641 "7.1-preview",
15642 );
15643 }
15644 Ok(url)
15645 }
15646 }
15647 impl std::future::IntoFuture for RequestBuilder {
15648 type Output = azure_core::Result<models::Comment>;
15649 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Comment>>;
15650 #[doc = "Returns a future that sends the request and returns the parsed response body."]
15651 #[doc = ""]
15652 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
15653 #[doc = ""]
15654 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
15655 fn into_future(self) -> Self::IntoFuture {
15656 Box::pin(async move { self.send().await?.into_raw_body().await })
15657 }
15658 }
15659 }
15660 pub mod delete {
15661 use super::models;
15662 #[cfg(not(target_arch = "wasm32"))]
15663 use futures::future::BoxFuture;
15664 #[cfg(target_arch = "wasm32")]
15665 use futures::future::LocalBoxFuture as BoxFuture;
15666 #[derive(Debug)]
15667 pub struct Response(azure_core::http::Response);
15668 impl Response {
15669 pub fn into_raw_response(self) -> azure_core::http::Response {
15670 self.0
15671 }
15672 pub fn as_raw_response(&self) -> &azure_core::http::Response {
15673 &self.0
15674 }
15675 }
15676 impl From<Response> for azure_core::http::Response {
15677 fn from(rsp: Response) -> Self {
15678 rsp.into_raw_response()
15679 }
15680 }
15681 impl AsRef<azure_core::http::Response> for Response {
15682 fn as_ref(&self) -> &azure_core::http::Response {
15683 self.as_raw_response()
15684 }
15685 }
15686 #[derive(Clone)]
15687 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15688 #[doc = r""]
15689 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15690 #[doc = r" parameters can be chained."]
15691 #[doc = r""]
15692 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15693 #[doc = r" converts the [`RequestBuilder`] into a future,"]
15694 #[doc = r" executes the request and returns a `Result` with the parsed"]
15695 #[doc = r" response."]
15696 #[doc = r""]
15697 #[doc = r" If you need lower-level access to the raw response details"]
15698 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15699 #[doc = r" can finalize the request using the"]
15700 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15701 #[doc = r" that resolves to a lower-level [`Response`] value."]
15702 pub struct RequestBuilder {
15703 pub(crate) client: super::super::Client,
15704 pub(crate) organization: String,
15705 pub(crate) repository_id: String,
15706 pub(crate) pull_request_id: i32,
15707 pub(crate) thread_id: i32,
15708 pub(crate) comment_id: i32,
15709 pub(crate) project: String,
15710 }
15711 impl RequestBuilder {
15712 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15713 #[doc = ""]
15714 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15715 #[doc = "However, this function can provide more flexibility when required."]
15716 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15717 Box::pin({
15718 let this = self.clone();
15719 async move {
15720 let url = this.url()?;
15721 let mut req =
15722 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
15723 if let Some(auth_header) = this
15724 .client
15725 .token_credential()
15726 .http_authorization_header(&this.client.scopes())
15727 .await?
15728 {
15729 req.insert_header(
15730 azure_core::http::headers::AUTHORIZATION,
15731 auth_header,
15732 );
15733 }
15734 let req_body = azure_core::Bytes::new();
15735 req.set_body(req_body);
15736 Ok(Response(this.client.send(&mut req).await?))
15737 }
15738 })
15739 }
15740 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
15741 let mut url = azure_core::http::Url::parse(&format!(
15742 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}",
15743 self.client.endpoint(),
15744 &self.organization,
15745 &self.project,
15746 &self.repository_id,
15747 &self.pull_request_id,
15748 &self.thread_id,
15749 &self.comment_id
15750 ))?;
15751 let has_api_version_already = url
15752 .query_pairs()
15753 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
15754 if !has_api_version_already {
15755 url.query_pairs_mut().append_pair(
15756 azure_core::http::headers::query_param::API_VERSION,
15757 "7.1-preview",
15758 );
15759 }
15760 Ok(url)
15761 }
15762 }
15763 impl std::future::IntoFuture for RequestBuilder {
15764 type Output = azure_core::Result<()>;
15765 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
15766 #[doc = "Returns a future that sends the request and waits for the response."]
15767 #[doc = ""]
15768 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
15769 #[doc = ""]
15770 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
15771 fn into_future(self) -> Self::IntoFuture {
15772 Box::pin(async move {
15773 let _rsp = self.send().await?;
15774 Ok(())
15775 })
15776 }
15777 }
15778 }
15779}
15780pub mod pull_request_comment_likes {
15781 use super::models;
15782 #[cfg(not(target_arch = "wasm32"))]
15783 use futures::future::BoxFuture;
15784 #[cfg(target_arch = "wasm32")]
15785 use futures::future::LocalBoxFuture as BoxFuture;
15786 pub struct Client(pub(crate) super::Client);
15787 impl Client {
15788 #[doc = "Get likes for a comment."]
15789 #[doc = ""]
15790 #[doc = "Arguments:"]
15791 #[doc = "* `organization`: The name of the Azure DevOps organization."]
15792 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
15793 #[doc = "* `pull_request_id`: ID of the pull request."]
15794 #[doc = "* `thread_id`: The ID of the thread that contains the comment."]
15795 #[doc = "* `comment_id`: The ID of the comment."]
15796 #[doc = "* `project`: Project ID or project name"]
15797 pub fn list(
15798 &self,
15799 organization: impl Into<String>,
15800 repository_id: impl Into<String>,
15801 pull_request_id: i32,
15802 thread_id: i32,
15803 comment_id: i32,
15804 project: impl Into<String>,
15805 ) -> list::RequestBuilder {
15806 list::RequestBuilder {
15807 client: self.0.clone(),
15808 organization: organization.into(),
15809 repository_id: repository_id.into(),
15810 pull_request_id,
15811 thread_id,
15812 comment_id,
15813 project: project.into(),
15814 }
15815 }
15816 #[doc = "Add a like on a comment."]
15817 #[doc = ""]
15818 #[doc = "Arguments:"]
15819 #[doc = "* `organization`: The name of the Azure DevOps organization."]
15820 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
15821 #[doc = "* `pull_request_id`: ID of the pull request."]
15822 #[doc = "* `thread_id`: The ID of the thread that contains the comment."]
15823 #[doc = "* `comment_id`: The ID of the comment."]
15824 #[doc = "* `project`: Project ID or project name"]
15825 pub fn create(
15826 &self,
15827 organization: impl Into<String>,
15828 repository_id: impl Into<String>,
15829 pull_request_id: i32,
15830 thread_id: i32,
15831 comment_id: i32,
15832 project: impl Into<String>,
15833 ) -> create::RequestBuilder {
15834 create::RequestBuilder {
15835 client: self.0.clone(),
15836 organization: organization.into(),
15837 repository_id: repository_id.into(),
15838 pull_request_id,
15839 thread_id,
15840 comment_id,
15841 project: project.into(),
15842 }
15843 }
15844 #[doc = "Delete a like on a comment."]
15845 #[doc = ""]
15846 #[doc = "Arguments:"]
15847 #[doc = "* `organization`: The name of the Azure DevOps organization."]
15848 #[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
15849 #[doc = "* `pull_request_id`: ID of the pull request."]
15850 #[doc = "* `thread_id`: The ID of the thread that contains the comment."]
15851 #[doc = "* `comment_id`: The ID of the comment."]
15852 #[doc = "* `project`: Project ID or project name"]
15853 pub fn delete(
15854 &self,
15855 organization: impl Into<String>,
15856 repository_id: impl Into<String>,
15857 pull_request_id: i32,
15858 thread_id: i32,
15859 comment_id: i32,
15860 project: impl Into<String>,
15861 ) -> delete::RequestBuilder {
15862 delete::RequestBuilder {
15863 client: self.0.clone(),
15864 organization: organization.into(),
15865 repository_id: repository_id.into(),
15866 pull_request_id,
15867 thread_id,
15868 comment_id,
15869 project: project.into(),
15870 }
15871 }
15872 }
15873 pub mod list {
15874 use super::models;
15875 #[cfg(not(target_arch = "wasm32"))]
15876 use futures::future::BoxFuture;
15877 #[cfg(target_arch = "wasm32")]
15878 use futures::future::LocalBoxFuture as BoxFuture;
15879 #[derive(Debug)]
15880 pub struct Response(azure_core::http::Response);
15881 impl Response {
15882 pub async fn into_raw_body(self) -> azure_core::Result<models::IdentityRefList> {
15883 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
15884 let body: models::IdentityRefList =
15885 serde_json::from_slice(&bytes).map_err(|e| {
15886 azure_core::error::Error::full(
15887 azure_core::error::ErrorKind::DataConversion,
15888 e,
15889 format!(
15890 "Failed to deserialize response:\n{}",
15891 String::from_utf8_lossy(&bytes)
15892 ),
15893 )
15894 })?;
15895 Ok(body)
15896 }
15897 pub fn into_raw_response(self) -> azure_core::http::Response {
15898 self.0
15899 }
15900 pub fn as_raw_response(&self) -> &azure_core::http::Response {
15901 &self.0
15902 }
15903 }
15904 impl From<Response> for azure_core::http::Response {
15905 fn from(rsp: Response) -> Self {
15906 rsp.into_raw_response()
15907 }
15908 }
15909 impl AsRef<azure_core::http::Response> for Response {
15910 fn as_ref(&self) -> &azure_core::http::Response {
15911 self.as_raw_response()
15912 }
15913 }
15914 #[derive(Clone)]
15915 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
15916 #[doc = r""]
15917 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
15918 #[doc = r" parameters can be chained."]
15919 #[doc = r""]
15920 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
15921 #[doc = r" converts the [`RequestBuilder`] into a future,"]
15922 #[doc = r" executes the request and returns a `Result` with the parsed"]
15923 #[doc = r" response."]
15924 #[doc = r""]
15925 #[doc = r" If you need lower-level access to the raw response details"]
15926 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
15927 #[doc = r" can finalize the request using the"]
15928 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
15929 #[doc = r" that resolves to a lower-level [`Response`] value."]
15930 pub struct RequestBuilder {
15931 pub(crate) client: super::super::Client,
15932 pub(crate) organization: String,
15933 pub(crate) repository_id: String,
15934 pub(crate) pull_request_id: i32,
15935 pub(crate) thread_id: i32,
15936 pub(crate) comment_id: i32,
15937 pub(crate) project: String,
15938 }
15939 impl RequestBuilder {
15940 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
15941 #[doc = ""]
15942 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
15943 #[doc = "However, this function can provide more flexibility when required."]
15944 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
15945 Box::pin({
15946 let this = self.clone();
15947 async move {
15948 let url = this.url()?;
15949 let mut req =
15950 azure_core::http::Request::new(url, azure_core::http::Method::Get);
15951 if let Some(auth_header) = this
15952 .client
15953 .token_credential()
15954 .http_authorization_header(&this.client.scopes())
15955 .await?
15956 {
15957 req.insert_header(
15958 azure_core::http::headers::AUTHORIZATION,
15959 auth_header,
15960 );
15961 }
15962 let req_body = azure_core::Bytes::new();
15963 req.set_body(req_body);
15964 Ok(Response(this.client.send(&mut req).await?))
15965 }
15966 })
15967 }
15968 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
15969 let mut url = azure_core :: http :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}/likes" , self . client . endpoint () , & self . organization , & self . project , & self . repository_id , & self . pull_request_id , & self . thread_id , & self . comment_id)) ? ;
15970 let has_api_version_already = url
15971 .query_pairs()
15972 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
15973 if !has_api_version_already {
15974 url.query_pairs_mut().append_pair(
15975 azure_core::http::headers::query_param::API_VERSION,
15976 "7.1-preview",
15977 );
15978 }
15979 Ok(url)
15980 }
15981 }
15982 impl std::future::IntoFuture for RequestBuilder {
15983 type Output = azure_core::Result<models::IdentityRefList>;
15984 type IntoFuture = BoxFuture<'static, azure_core::Result<models::IdentityRefList>>;
15985 #[doc = "Returns a future that sends the request and returns the parsed response body."]
15986 #[doc = ""]
15987 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
15988 #[doc = ""]
15989 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
15990 fn into_future(self) -> Self::IntoFuture {
15991 Box::pin(async move { self.send().await?.into_raw_body().await })
15992 }
15993 }
15994 }
15995 pub mod create {
15996 use super::models;
15997 #[cfg(not(target_arch = "wasm32"))]
15998 use futures::future::BoxFuture;
15999 #[cfg(target_arch = "wasm32")]
16000 use futures::future::LocalBoxFuture as BoxFuture;
16001 #[derive(Debug)]
16002 pub struct Response(azure_core::http::Response);
16003 impl Response {
16004 pub fn into_raw_response(self) -> azure_core::http::Response {
16005 self.0
16006 }
16007 pub fn as_raw_response(&self) -> &azure_core::http::Response {
16008 &self.0
16009 }
16010 }
16011 impl From<Response> for azure_core::http::Response {
16012 fn from(rsp: Response) -> Self {
16013 rsp.into_raw_response()
16014 }
16015 }
16016 impl AsRef<azure_core::http::Response> for Response {
16017 fn as_ref(&self) -> &azure_core::http::Response {
16018 self.as_raw_response()
16019 }
16020 }
16021 #[derive(Clone)]
16022 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
16023 #[doc = r""]
16024 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
16025 #[doc = r" parameters can be chained."]
16026 #[doc = r""]
16027 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
16028 #[doc = r" converts the [`RequestBuilder`] into a future,"]
16029 #[doc = r" executes the request and returns a `Result` with the parsed"]
16030 #[doc = r" response."]
16031 #[doc = r""]
16032 #[doc = r" If you need lower-level access to the raw response details"]
16033 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
16034 #[doc = r" can finalize the request using the"]
16035 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
16036 #[doc = r" that resolves to a lower-level [`Response`] value."]
16037 pub struct RequestBuilder {
16038 pub(crate) client: super::super::Client,
16039 pub(crate) organization: String,
16040 pub(crate) repository_id: String,
16041 pub(crate) pull_request_id: i32,
16042 pub(crate) thread_id: i32,
16043 pub(crate) comment_id: i32,
16044 pub(crate) project: String,
16045 }
16046 impl RequestBuilder {
16047 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
16048 #[doc = ""]
16049 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
16050 #[doc = "However, this function can provide more flexibility when required."]
16051 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
16052 Box::pin({
16053 let this = self.clone();
16054 async move {
16055 let url = this.url()?;
16056 let mut req =
16057 azure_core::http::Request::new(url, azure_core::http::Method::Post);
16058 if let Some(auth_header) = this
16059 .client
16060 .token_credential()
16061 .http_authorization_header(&this.client.scopes())
16062 .await?
16063 {
16064 req.insert_header(
16065 azure_core::http::headers::AUTHORIZATION,
16066 auth_header,
16067 );
16068 }
16069 let req_body = azure_core::Bytes::new();
16070 req.insert_header(azure_core::http::headers::CONTENT_LENGTH, "0");
16071 req.set_body(req_body);
16072 Ok(Response(this.client.send(&mut req).await?))
16073 }
16074 })
16075 }
16076 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
16077 let mut url = azure_core :: http :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}/likes" , self . client . endpoint () , & self . organization , & self . project , & self . repository_id , & self . pull_request_id , & self . thread_id , & self . comment_id)) ? ;
16078 let has_api_version_already = url
16079 .query_pairs()
16080 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
16081 if !has_api_version_already {
16082 url.query_pairs_mut().append_pair(
16083 azure_core::http::headers::query_param::API_VERSION,
16084 "7.1-preview",
16085 );
16086 }
16087 Ok(url)
16088 }
16089 }
16090 impl std::future::IntoFuture for RequestBuilder {
16091 type Output = azure_core::Result<()>;
16092 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
16093 #[doc = "Returns a future that sends the request and waits for the response."]
16094 #[doc = ""]
16095 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
16096 #[doc = ""]
16097 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
16098 fn into_future(self) -> Self::IntoFuture {
16099 Box::pin(async move {
16100 let _rsp = self.send().await?;
16101 Ok(())
16102 })
16103 }
16104 }
16105 }
16106 pub mod delete {
16107 use super::models;
16108 #[cfg(not(target_arch = "wasm32"))]
16109 use futures::future::BoxFuture;
16110 #[cfg(target_arch = "wasm32")]
16111 use futures::future::LocalBoxFuture as BoxFuture;
16112 #[derive(Debug)]
16113 pub struct Response(azure_core::http::Response);
16114 impl Response {
16115 pub fn into_raw_response(self) -> azure_core::http::Response {
16116 self.0
16117 }
16118 pub fn as_raw_response(&self) -> &azure_core::http::Response {
16119 &self.0
16120 }
16121 }
16122 impl From<Response> for azure_core::http::Response {
16123 fn from(rsp: Response) -> Self {
16124 rsp.into_raw_response()
16125 }
16126 }
16127 impl AsRef<azure_core::http::Response> for Response {
16128 fn as_ref(&self) -> &azure_core::http::Response {
16129 self.as_raw_response()
16130 }
16131 }
16132 #[derive(Clone)]
16133 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
16134 #[doc = r""]
16135 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
16136 #[doc = r" parameters can be chained."]
16137 #[doc = r""]
16138 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
16139 #[doc = r" converts the [`RequestBuilder`] into a future,"]
16140 #[doc = r" executes the request and returns a `Result` with the parsed"]
16141 #[doc = r" response."]
16142 #[doc = r""]
16143 #[doc = r" If you need lower-level access to the raw response details"]
16144 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
16145 #[doc = r" can finalize the request using the"]
16146 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
16147 #[doc = r" that resolves to a lower-level [`Response`] value."]
16148 pub struct RequestBuilder {
16149 pub(crate) client: super::super::Client,
16150 pub(crate) organization: String,
16151 pub(crate) repository_id: String,
16152 pub(crate) pull_request_id: i32,
16153 pub(crate) thread_id: i32,
16154 pub(crate) comment_id: i32,
16155 pub(crate) project: String,
16156 }
16157 impl RequestBuilder {
16158 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
16159 #[doc = ""]
16160 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
16161 #[doc = "However, this function can provide more flexibility when required."]
16162 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
16163 Box::pin({
16164 let this = self.clone();
16165 async move {
16166 let url = this.url()?;
16167 let mut req =
16168 azure_core::http::Request::new(url, azure_core::http::Method::Delete);
16169 if let Some(auth_header) = this
16170 .client
16171 .token_credential()
16172 .http_authorization_header(&this.client.scopes())
16173 .await?
16174 {
16175 req.insert_header(
16176 azure_core::http::headers::AUTHORIZATION,
16177 auth_header,
16178 );
16179 }
16180 let req_body = azure_core::Bytes::new();
16181 req.set_body(req_body);
16182 Ok(Response(this.client.send(&mut req).await?))
16183 }
16184 })
16185 }
16186 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
16187 let mut url = azure_core :: http :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}/likes" , self . client . endpoint () , & self . organization , & self . project , & self . repository_id , & self . pull_request_id , & self . thread_id , & self . comment_id)) ? ;
16188 let has_api_version_already = url
16189 .query_pairs()
16190 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
16191 if !has_api_version_already {
16192 url.query_pairs_mut().append_pair(
16193 azure_core::http::headers::query_param::API_VERSION,
16194 "7.1-preview",
16195 );
16196 }
16197 Ok(url)
16198 }
16199 }
16200 impl std::future::IntoFuture for RequestBuilder {
16201 type Output = azure_core::Result<()>;
16202 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
16203 #[doc = "Returns a future that sends the request and waits for the response."]
16204 #[doc = ""]
16205 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
16206 #[doc = ""]
16207 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
16208 fn into_future(self) -> Self::IntoFuture {
16209 Box::pin(async move {
16210 let _rsp = self.send().await?;
16211 Ok(())
16212 })
16213 }
16214 }
16215 }
16216}
16217pub mod pull_request_work_items {
16218 use super::models;
16219 #[cfg(not(target_arch = "wasm32"))]
16220 use futures::future::BoxFuture;
16221 #[cfg(target_arch = "wasm32")]
16222 use futures::future::LocalBoxFuture as BoxFuture;
16223 pub struct Client(pub(crate) super::Client);
16224 impl Client {
16225 #[doc = "Retrieve a list of work items associated with a pull request."]
16226 #[doc = ""]
16227 #[doc = "Arguments:"]
16228 #[doc = "* `organization`: The name of the Azure DevOps organization."]
16229 #[doc = "* `repository_id`: ID or name of the repository."]
16230 #[doc = "* `pull_request_id`: ID of the pull request."]
16231 #[doc = "* `project`: Project ID or project name"]
16232 pub fn list(
16233 &self,
16234 organization: impl Into<String>,
16235 repository_id: impl Into<String>,
16236 pull_request_id: i32,
16237 project: impl Into<String>,
16238 ) -> list::RequestBuilder {
16239 list::RequestBuilder {
16240 client: self.0.clone(),
16241 organization: organization.into(),
16242 repository_id: repository_id.into(),
16243 pull_request_id,
16244 project: project.into(),
16245 }
16246 }
16247 }
16248 pub mod list {
16249 use super::models;
16250 #[cfg(not(target_arch = "wasm32"))]
16251 use futures::future::BoxFuture;
16252 #[cfg(target_arch = "wasm32")]
16253 use futures::future::LocalBoxFuture as BoxFuture;
16254 #[derive(Debug)]
16255 pub struct Response(azure_core::http::Response);
16256 impl Response {
16257 pub async fn into_raw_body(self) -> azure_core::Result<models::ResourceRefList> {
16258 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
16259 let body: models::ResourceRefList =
16260 serde_json::from_slice(&bytes).map_err(|e| {
16261 azure_core::error::Error::full(
16262 azure_core::error::ErrorKind::DataConversion,
16263 e,
16264 format!(
16265 "Failed to deserialize response:\n{}",
16266 String::from_utf8_lossy(&bytes)
16267 ),
16268 )
16269 })?;
16270 Ok(body)
16271 }
16272 pub fn into_raw_response(self) -> azure_core::http::Response {
16273 self.0
16274 }
16275 pub fn as_raw_response(&self) -> &azure_core::http::Response {
16276 &self.0
16277 }
16278 }
16279 impl From<Response> for azure_core::http::Response {
16280 fn from(rsp: Response) -> Self {
16281 rsp.into_raw_response()
16282 }
16283 }
16284 impl AsRef<azure_core::http::Response> for Response {
16285 fn as_ref(&self) -> &azure_core::http::Response {
16286 self.as_raw_response()
16287 }
16288 }
16289 #[derive(Clone)]
16290 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
16291 #[doc = r""]
16292 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
16293 #[doc = r" parameters can be chained."]
16294 #[doc = r""]
16295 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
16296 #[doc = r" converts the [`RequestBuilder`] into a future,"]
16297 #[doc = r" executes the request and returns a `Result` with the parsed"]
16298 #[doc = r" response."]
16299 #[doc = r""]
16300 #[doc = r" If you need lower-level access to the raw response details"]
16301 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
16302 #[doc = r" can finalize the request using the"]
16303 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
16304 #[doc = r" that resolves to a lower-level [`Response`] value."]
16305 pub struct RequestBuilder {
16306 pub(crate) client: super::super::Client,
16307 pub(crate) organization: String,
16308 pub(crate) repository_id: String,
16309 pub(crate) pull_request_id: i32,
16310 pub(crate) project: String,
16311 }
16312 impl RequestBuilder {
16313 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
16314 #[doc = ""]
16315 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
16316 #[doc = "However, this function can provide more flexibility when required."]
16317 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
16318 Box::pin({
16319 let this = self.clone();
16320 async move {
16321 let url = this.url()?;
16322 let mut req =
16323 azure_core::http::Request::new(url, azure_core::http::Method::Get);
16324 if let Some(auth_header) = this
16325 .client
16326 .token_credential()
16327 .http_authorization_header(&this.client.scopes())
16328 .await?
16329 {
16330 req.insert_header(
16331 azure_core::http::headers::AUTHORIZATION,
16332 auth_header,
16333 );
16334 }
16335 let req_body = azure_core::Bytes::new();
16336 req.set_body(req_body);
16337 Ok(Response(this.client.send(&mut req).await?))
16338 }
16339 })
16340 }
16341 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
16342 let mut url = azure_core::http::Url::parse(&format!(
16343 "{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/workitems",
16344 self.client.endpoint(),
16345 &self.organization,
16346 &self.project,
16347 &self.repository_id,
16348 &self.pull_request_id
16349 ))?;
16350 let has_api_version_already = url
16351 .query_pairs()
16352 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
16353 if !has_api_version_already {
16354 url.query_pairs_mut().append_pair(
16355 azure_core::http::headers::query_param::API_VERSION,
16356 "7.1-preview",
16357 );
16358 }
16359 Ok(url)
16360 }
16361 }
16362 impl std::future::IntoFuture for RequestBuilder {
16363 type Output = azure_core::Result<models::ResourceRefList>;
16364 type IntoFuture = BoxFuture<'static, azure_core::Result<models::ResourceRefList>>;
16365 #[doc = "Returns a future that sends the request and returns the parsed response body."]
16366 #[doc = ""]
16367 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
16368 #[doc = ""]
16369 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
16370 fn into_future(self) -> Self::IntoFuture {
16371 Box::pin(async move { self.send().await?.into_raw_body().await })
16372 }
16373 }
16374 }
16375}
16376pub mod pushes {
16377 use super::models;
16378 #[cfg(not(target_arch = "wasm32"))]
16379 use futures::future::BoxFuture;
16380 #[cfg(target_arch = "wasm32")]
16381 use futures::future::LocalBoxFuture as BoxFuture;
16382 pub struct Client(pub(crate) super::Client);
16383 impl Client {
16384 #[doc = "Retrieves pushes associated with the specified repository."]
16385 #[doc = ""]
16386 #[doc = "Arguments:"]
16387 #[doc = "* `organization`: The name of the Azure DevOps organization."]
16388 #[doc = "* `repository_id`: The name or ID of the repository."]
16389 #[doc = "* `project`: Project ID or project name"]
16390 pub fn list(
16391 &self,
16392 organization: impl Into<String>,
16393 repository_id: impl Into<String>,
16394 project: impl Into<String>,
16395 ) -> list::RequestBuilder {
16396 list::RequestBuilder {
16397 client: self.0.clone(),
16398 organization: organization.into(),
16399 repository_id: repository_id.into(),
16400 project: project.into(),
16401 skip: None,
16402 top: None,
16403 search_criteria_from_date: None,
16404 search_criteria_include_links: None,
16405 search_criteria_include_ref_updates: None,
16406 search_criteria_pusher_id: None,
16407 search_criteria_ref_name: None,
16408 search_criteria_to_date: None,
16409 }
16410 }
16411 #[doc = "Push changes to the repository."]
16412 #[doc = ""]
16413 #[doc = "Arguments:"]
16414 #[doc = "* `organization`: The name of the Azure DevOps organization."]
16415 #[doc = "* `repository_id`: The name or ID of the repository."]
16416 #[doc = "* `project`: Project ID or project name"]
16417 pub fn create(
16418 &self,
16419 organization: impl Into<String>,
16420 body: impl Into<models::GitPush>,
16421 repository_id: impl Into<String>,
16422 project: impl Into<String>,
16423 ) -> create::RequestBuilder {
16424 create::RequestBuilder {
16425 client: self.0.clone(),
16426 organization: organization.into(),
16427 body: body.into(),
16428 repository_id: repository_id.into(),
16429 project: project.into(),
16430 }
16431 }
16432 #[doc = "Retrieves a particular push."]
16433 #[doc = ""]
16434 #[doc = "Arguments:"]
16435 #[doc = "* `organization`: The name of the Azure DevOps organization."]
16436 #[doc = "* `repository_id`: The name or ID of the repository."]
16437 #[doc = "* `push_id`: ID of the push."]
16438 #[doc = "* `project`: Project ID or project name"]
16439 pub fn get(
16440 &self,
16441 organization: impl Into<String>,
16442 repository_id: impl Into<String>,
16443 push_id: i32,
16444 project: impl Into<String>,
16445 ) -> get::RequestBuilder {
16446 get::RequestBuilder {
16447 client: self.0.clone(),
16448 organization: organization.into(),
16449 repository_id: repository_id.into(),
16450 push_id,
16451 project: project.into(),
16452 include_commits: None,
16453 include_ref_updates: None,
16454 }
16455 }
16456 }
16457 pub mod list {
16458 use super::models;
16459 #[cfg(not(target_arch = "wasm32"))]
16460 use futures::future::BoxFuture;
16461 #[cfg(target_arch = "wasm32")]
16462 use futures::future::LocalBoxFuture as BoxFuture;
16463 #[derive(Debug)]
16464 pub struct Response(azure_core::http::Response);
16465 impl Response {
16466 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPushList> {
16467 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
16468 let body: models::GitPushList = serde_json::from_slice(&bytes).map_err(|e| {
16469 azure_core::error::Error::full(
16470 azure_core::error::ErrorKind::DataConversion,
16471 e,
16472 format!(
16473 "Failed to deserialize response:\n{}",
16474 String::from_utf8_lossy(&bytes)
16475 ),
16476 )
16477 })?;
16478 Ok(body)
16479 }
16480 pub fn into_raw_response(self) -> azure_core::http::Response {
16481 self.0
16482 }
16483 pub fn as_raw_response(&self) -> &azure_core::http::Response {
16484 &self.0
16485 }
16486 }
16487 impl From<Response> for azure_core::http::Response {
16488 fn from(rsp: Response) -> Self {
16489 rsp.into_raw_response()
16490 }
16491 }
16492 impl AsRef<azure_core::http::Response> for Response {
16493 fn as_ref(&self) -> &azure_core::http::Response {
16494 self.as_raw_response()
16495 }
16496 }
16497 #[derive(Clone)]
16498 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
16499 #[doc = r""]
16500 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
16501 #[doc = r" parameters can be chained."]
16502 #[doc = r""]
16503 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
16504 #[doc = r" converts the [`RequestBuilder`] into a future,"]
16505 #[doc = r" executes the request and returns a `Result` with the parsed"]
16506 #[doc = r" response."]
16507 #[doc = r""]
16508 #[doc = r" If you need lower-level access to the raw response details"]
16509 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
16510 #[doc = r" can finalize the request using the"]
16511 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
16512 #[doc = r" that resolves to a lower-level [`Response`] value."]
16513 pub struct RequestBuilder {
16514 pub(crate) client: super::super::Client,
16515 pub(crate) organization: String,
16516 pub(crate) repository_id: String,
16517 pub(crate) project: String,
16518 pub(crate) skip: Option<i32>,
16519 pub(crate) top: Option<i32>,
16520 pub(crate) search_criteria_from_date: Option<time::OffsetDateTime>,
16521 pub(crate) search_criteria_include_links: Option<bool>,
16522 pub(crate) search_criteria_include_ref_updates: Option<bool>,
16523 pub(crate) search_criteria_pusher_id: Option<String>,
16524 pub(crate) search_criteria_ref_name: Option<String>,
16525 pub(crate) search_criteria_to_date: Option<time::OffsetDateTime>,
16526 }
16527 impl RequestBuilder {
16528 #[doc = "Number of pushes to skip."]
16529 pub fn skip(mut self, skip: i32) -> Self {
16530 self.skip = Some(skip);
16531 self
16532 }
16533 #[doc = "Number of pushes to return."]
16534 pub fn top(mut self, top: i32) -> Self {
16535 self.top = Some(top);
16536 self
16537 }
16538 #[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
16539 pub fn search_criteria_from_date(
16540 mut self,
16541 search_criteria_from_date: impl Into<time::OffsetDateTime>,
16542 ) -> Self {
16543 self.search_criteria_from_date = Some(search_criteria_from_date.into());
16544 self
16545 }
16546 #[doc = "Whether to include the _links field on the shallow references"]
16547 pub fn search_criteria_include_links(
16548 mut self,
16549 search_criteria_include_links: bool,
16550 ) -> Self {
16551 self.search_criteria_include_links = Some(search_criteria_include_links);
16552 self
16553 }
16554 #[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
16555 pub fn search_criteria_include_ref_updates(
16556 mut self,
16557 search_criteria_include_ref_updates: bool,
16558 ) -> Self {
16559 self.search_criteria_include_ref_updates =
16560 Some(search_criteria_include_ref_updates);
16561 self
16562 }
16563 #[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
16564 pub fn search_criteria_pusher_id(
16565 mut self,
16566 search_criteria_pusher_id: impl Into<String>,
16567 ) -> Self {
16568 self.search_criteria_pusher_id = Some(search_criteria_pusher_id.into());
16569 self
16570 }
16571 #[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
16572 pub fn search_criteria_ref_name(
16573 mut self,
16574 search_criteria_ref_name: impl Into<String>,
16575 ) -> Self {
16576 self.search_criteria_ref_name = Some(search_criteria_ref_name.into());
16577 self
16578 }
16579 #[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
16580 pub fn search_criteria_to_date(
16581 mut self,
16582 search_criteria_to_date: impl Into<time::OffsetDateTime>,
16583 ) -> Self {
16584 self.search_criteria_to_date = Some(search_criteria_to_date.into());
16585 self
16586 }
16587 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
16588 #[doc = ""]
16589 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
16590 #[doc = "However, this function can provide more flexibility when required."]
16591 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
16592 Box::pin({
16593 let this = self.clone();
16594 async move {
16595 let url = this.url()?;
16596 let mut req =
16597 azure_core::http::Request::new(url, azure_core::http::Method::Get);
16598 if let Some(auth_header) = this
16599 .client
16600 .token_credential()
16601 .http_authorization_header(&this.client.scopes())
16602 .await?
16603 {
16604 req.insert_header(
16605 azure_core::http::headers::AUTHORIZATION,
16606 auth_header,
16607 );
16608 }
16609 if let Some(skip) = &this.skip {
16610 req.url_mut()
16611 .query_pairs_mut()
16612 .append_pair("$skip", &skip.to_string());
16613 }
16614 if let Some(top) = &this.top {
16615 req.url_mut()
16616 .query_pairs_mut()
16617 .append_pair("$top", &top.to_string());
16618 }
16619 if let Some(search_criteria_from_date) = &this.search_criteria_from_date {
16620 req.url_mut().query_pairs_mut().append_pair(
16621 "searchCriteria.fromDate",
16622 &search_criteria_from_date.to_string(),
16623 );
16624 }
16625 if let Some(search_criteria_include_links) =
16626 &this.search_criteria_include_links
16627 {
16628 req.url_mut().query_pairs_mut().append_pair(
16629 "searchCriteria.includeLinks",
16630 &search_criteria_include_links.to_string(),
16631 );
16632 }
16633 if let Some(search_criteria_include_ref_updates) =
16634 &this.search_criteria_include_ref_updates
16635 {
16636 req.url_mut().query_pairs_mut().append_pair(
16637 "searchCriteria.includeRefUpdates",
16638 &search_criteria_include_ref_updates.to_string(),
16639 );
16640 }
16641 if let Some(search_criteria_pusher_id) = &this.search_criteria_pusher_id {
16642 req.url_mut()
16643 .query_pairs_mut()
16644 .append_pair("searchCriteria.pusherId", search_criteria_pusher_id);
16645 }
16646 if let Some(search_criteria_ref_name) = &this.search_criteria_ref_name {
16647 req.url_mut()
16648 .query_pairs_mut()
16649 .append_pair("searchCriteria.refName", search_criteria_ref_name);
16650 }
16651 if let Some(search_criteria_to_date) = &this.search_criteria_to_date {
16652 req.url_mut().query_pairs_mut().append_pair(
16653 "searchCriteria.toDate",
16654 &search_criteria_to_date.to_string(),
16655 );
16656 }
16657 let req_body = azure_core::Bytes::new();
16658 req.set_body(req_body);
16659 Ok(Response(this.client.send(&mut req).await?))
16660 }
16661 })
16662 }
16663 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
16664 let mut url = azure_core::http::Url::parse(&format!(
16665 "{}/{}/{}/_apis/git/repositories/{}/pushes",
16666 self.client.endpoint(),
16667 &self.organization,
16668 &self.project,
16669 &self.repository_id
16670 ))?;
16671 let has_api_version_already = url
16672 .query_pairs()
16673 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
16674 if !has_api_version_already {
16675 url.query_pairs_mut().append_pair(
16676 azure_core::http::headers::query_param::API_VERSION,
16677 "7.1-preview",
16678 );
16679 }
16680 Ok(url)
16681 }
16682 }
16683 impl std::future::IntoFuture for RequestBuilder {
16684 type Output = azure_core::Result<models::GitPushList>;
16685 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPushList>>;
16686 #[doc = "Returns a future that sends the request and returns the parsed response body."]
16687 #[doc = ""]
16688 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
16689 #[doc = ""]
16690 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
16691 fn into_future(self) -> Self::IntoFuture {
16692 Box::pin(async move { self.send().await?.into_raw_body().await })
16693 }
16694 }
16695 }
16696 pub mod create {
16697 use super::models;
16698 #[cfg(not(target_arch = "wasm32"))]
16699 use futures::future::BoxFuture;
16700 #[cfg(target_arch = "wasm32")]
16701 use futures::future::LocalBoxFuture as BoxFuture;
16702 #[derive(Debug)]
16703 pub struct Response(azure_core::http::Response);
16704 impl Response {
16705 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPush> {
16706 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
16707 let body: models::GitPush = serde_json::from_slice(&bytes).map_err(|e| {
16708 azure_core::error::Error::full(
16709 azure_core::error::ErrorKind::DataConversion,
16710 e,
16711 format!(
16712 "Failed to deserialize response:\n{}",
16713 String::from_utf8_lossy(&bytes)
16714 ),
16715 )
16716 })?;
16717 Ok(body)
16718 }
16719 pub fn into_raw_response(self) -> azure_core::http::Response {
16720 self.0
16721 }
16722 pub fn as_raw_response(&self) -> &azure_core::http::Response {
16723 &self.0
16724 }
16725 }
16726 impl From<Response> for azure_core::http::Response {
16727 fn from(rsp: Response) -> Self {
16728 rsp.into_raw_response()
16729 }
16730 }
16731 impl AsRef<azure_core::http::Response> for Response {
16732 fn as_ref(&self) -> &azure_core::http::Response {
16733 self.as_raw_response()
16734 }
16735 }
16736 #[derive(Clone)]
16737 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
16738 #[doc = r""]
16739 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
16740 #[doc = r" parameters can be chained."]
16741 #[doc = r""]
16742 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
16743 #[doc = r" converts the [`RequestBuilder`] into a future,"]
16744 #[doc = r" executes the request and returns a `Result` with the parsed"]
16745 #[doc = r" response."]
16746 #[doc = r""]
16747 #[doc = r" If you need lower-level access to the raw response details"]
16748 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
16749 #[doc = r" can finalize the request using the"]
16750 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
16751 #[doc = r" that resolves to a lower-level [`Response`] value."]
16752 pub struct RequestBuilder {
16753 pub(crate) client: super::super::Client,
16754 pub(crate) organization: String,
16755 pub(crate) body: models::GitPush,
16756 pub(crate) repository_id: String,
16757 pub(crate) project: String,
16758 }
16759 impl RequestBuilder {
16760 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
16761 #[doc = ""]
16762 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
16763 #[doc = "However, this function can provide more flexibility when required."]
16764 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
16765 Box::pin({
16766 let this = self.clone();
16767 async move {
16768 let url = this.url()?;
16769 let mut req =
16770 azure_core::http::Request::new(url, azure_core::http::Method::Post);
16771 if let Some(auth_header) = this
16772 .client
16773 .token_credential()
16774 .http_authorization_header(&this.client.scopes())
16775 .await?
16776 {
16777 req.insert_header(
16778 azure_core::http::headers::AUTHORIZATION,
16779 auth_header,
16780 );
16781 }
16782 req.insert_header("content-type", "application/json");
16783 let req_body = azure_core::json::to_json(&this.body)?;
16784 req.set_body(req_body);
16785 Ok(Response(this.client.send(&mut req).await?))
16786 }
16787 })
16788 }
16789 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
16790 let mut url = azure_core::http::Url::parse(&format!(
16791 "{}/{}/{}/_apis/git/repositories/{}/pushes",
16792 self.client.endpoint(),
16793 &self.organization,
16794 &self.project,
16795 &self.repository_id
16796 ))?;
16797 let has_api_version_already = url
16798 .query_pairs()
16799 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
16800 if !has_api_version_already {
16801 url.query_pairs_mut().append_pair(
16802 azure_core::http::headers::query_param::API_VERSION,
16803 "7.1-preview",
16804 );
16805 }
16806 Ok(url)
16807 }
16808 }
16809 impl std::future::IntoFuture for RequestBuilder {
16810 type Output = azure_core::Result<models::GitPush>;
16811 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPush>>;
16812 #[doc = "Returns a future that sends the request and returns the parsed response body."]
16813 #[doc = ""]
16814 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
16815 #[doc = ""]
16816 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
16817 fn into_future(self) -> Self::IntoFuture {
16818 Box::pin(async move { self.send().await?.into_raw_body().await })
16819 }
16820 }
16821 }
16822 pub mod get {
16823 use super::models;
16824 #[cfg(not(target_arch = "wasm32"))]
16825 use futures::future::BoxFuture;
16826 #[cfg(target_arch = "wasm32")]
16827 use futures::future::LocalBoxFuture as BoxFuture;
16828 #[derive(Debug)]
16829 pub struct Response(azure_core::http::Response);
16830 impl Response {
16831 pub async fn into_raw_body(self) -> azure_core::Result<models::GitPush> {
16832 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
16833 let body: models::GitPush = serde_json::from_slice(&bytes).map_err(|e| {
16834 azure_core::error::Error::full(
16835 azure_core::error::ErrorKind::DataConversion,
16836 e,
16837 format!(
16838 "Failed to deserialize response:\n{}",
16839 String::from_utf8_lossy(&bytes)
16840 ),
16841 )
16842 })?;
16843 Ok(body)
16844 }
16845 pub fn into_raw_response(self) -> azure_core::http::Response {
16846 self.0
16847 }
16848 pub fn as_raw_response(&self) -> &azure_core::http::Response {
16849 &self.0
16850 }
16851 }
16852 impl From<Response> for azure_core::http::Response {
16853 fn from(rsp: Response) -> Self {
16854 rsp.into_raw_response()
16855 }
16856 }
16857 impl AsRef<azure_core::http::Response> for Response {
16858 fn as_ref(&self) -> &azure_core::http::Response {
16859 self.as_raw_response()
16860 }
16861 }
16862 #[derive(Clone)]
16863 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
16864 #[doc = r""]
16865 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
16866 #[doc = r" parameters can be chained."]
16867 #[doc = r""]
16868 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
16869 #[doc = r" converts the [`RequestBuilder`] into a future,"]
16870 #[doc = r" executes the request and returns a `Result` with the parsed"]
16871 #[doc = r" response."]
16872 #[doc = r""]
16873 #[doc = r" If you need lower-level access to the raw response details"]
16874 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
16875 #[doc = r" can finalize the request using the"]
16876 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
16877 #[doc = r" that resolves to a lower-level [`Response`] value."]
16878 pub struct RequestBuilder {
16879 pub(crate) client: super::super::Client,
16880 pub(crate) organization: String,
16881 pub(crate) repository_id: String,
16882 pub(crate) push_id: i32,
16883 pub(crate) project: String,
16884 pub(crate) include_commits: Option<i32>,
16885 pub(crate) include_ref_updates: Option<bool>,
16886 }
16887 impl RequestBuilder {
16888 #[doc = "The number of commits to include in the result."]
16889 pub fn include_commits(mut self, include_commits: i32) -> Self {
16890 self.include_commits = Some(include_commits);
16891 self
16892 }
16893 #[doc = "If true, include the list of refs that were updated by the push."]
16894 pub fn include_ref_updates(mut self, include_ref_updates: bool) -> Self {
16895 self.include_ref_updates = Some(include_ref_updates);
16896 self
16897 }
16898 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
16899 #[doc = ""]
16900 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
16901 #[doc = "However, this function can provide more flexibility when required."]
16902 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
16903 Box::pin({
16904 let this = self.clone();
16905 async move {
16906 let url = this.url()?;
16907 let mut req =
16908 azure_core::http::Request::new(url, azure_core::http::Method::Get);
16909 if let Some(auth_header) = this
16910 .client
16911 .token_credential()
16912 .http_authorization_header(&this.client.scopes())
16913 .await?
16914 {
16915 req.insert_header(
16916 azure_core::http::headers::AUTHORIZATION,
16917 auth_header,
16918 );
16919 }
16920 if let Some(include_commits) = &this.include_commits {
16921 req.url_mut()
16922 .query_pairs_mut()
16923 .append_pair("includeCommits", &include_commits.to_string());
16924 }
16925 if let Some(include_ref_updates) = &this.include_ref_updates {
16926 req.url_mut()
16927 .query_pairs_mut()
16928 .append_pair("includeRefUpdates", &include_ref_updates.to_string());
16929 }
16930 let req_body = azure_core::Bytes::new();
16931 req.set_body(req_body);
16932 Ok(Response(this.client.send(&mut req).await?))
16933 }
16934 })
16935 }
16936 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
16937 let mut url = azure_core::http::Url::parse(&format!(
16938 "{}/{}/{}/_apis/git/repositories/{}/pushes/{}",
16939 self.client.endpoint(),
16940 &self.organization,
16941 &self.project,
16942 &self.repository_id,
16943 &self.push_id
16944 ))?;
16945 let has_api_version_already = url
16946 .query_pairs()
16947 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
16948 if !has_api_version_already {
16949 url.query_pairs_mut().append_pair(
16950 azure_core::http::headers::query_param::API_VERSION,
16951 "7.1-preview",
16952 );
16953 }
16954 Ok(url)
16955 }
16956 }
16957 impl std::future::IntoFuture for RequestBuilder {
16958 type Output = azure_core::Result<models::GitPush>;
16959 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitPush>>;
16960 #[doc = "Returns a future that sends the request and returns the parsed response body."]
16961 #[doc = ""]
16962 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
16963 #[doc = ""]
16964 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
16965 fn into_future(self) -> Self::IntoFuture {
16966 Box::pin(async move { self.send().await?.into_raw_body().await })
16967 }
16968 }
16969 }
16970}
16971pub mod refs {
16972 use super::models;
16973 #[cfg(not(target_arch = "wasm32"))]
16974 use futures::future::BoxFuture;
16975 #[cfg(target_arch = "wasm32")]
16976 use futures::future::LocalBoxFuture as BoxFuture;
16977 pub struct Client(pub(crate) super::Client);
16978 impl Client {
16979 #[doc = "Queries the provided repository for its refs and returns them."]
16980 #[doc = ""]
16981 #[doc = "Arguments:"]
16982 #[doc = "* `organization`: The name of the Azure DevOps organization."]
16983 #[doc = "* `repository_id`: The name or ID of the repository."]
16984 #[doc = "* `project`: Project ID or project name"]
16985 pub fn list(
16986 &self,
16987 organization: impl Into<String>,
16988 repository_id: impl Into<String>,
16989 project: impl Into<String>,
16990 ) -> list::RequestBuilder {
16991 list::RequestBuilder {
16992 client: self.0.clone(),
16993 organization: organization.into(),
16994 repository_id: repository_id.into(),
16995 project: project.into(),
16996 filter: None,
16997 include_links: None,
16998 include_statuses: None,
16999 include_my_branches: None,
17000 latest_statuses_only: None,
17001 peel_tags: None,
17002 filter_contains: None,
17003 top: None,
17004 continuation_token: None,
17005 }
17006 }
17007 #[doc = "Creating, updating, or deleting refs(branches).\n\nUpdating a ref means making it point at a different commit than it used to. You must specify both the old and new commit to avoid race conditions."]
17008 #[doc = ""]
17009 #[doc = "Arguments:"]
17010 #[doc = "* `organization`: The name of the Azure DevOps organization."]
17011 #[doc = "* `body`: List of ref updates to attempt to perform"]
17012 #[doc = "* `repository_id`: The name or ID of the repository."]
17013 #[doc = "* `project`: Project ID or project name"]
17014 pub fn update_refs(
17015 &self,
17016 organization: impl Into<String>,
17017 body: Vec<models::GitRefUpdate>,
17018 repository_id: impl Into<String>,
17019 project: impl Into<String>,
17020 ) -> update_refs::RequestBuilder {
17021 update_refs::RequestBuilder {
17022 client: self.0.clone(),
17023 organization: organization.into(),
17024 body,
17025 repository_id: repository_id.into(),
17026 project: project.into(),
17027 project_id: None,
17028 }
17029 }
17030 #[doc = "Lock or Unlock a branch."]
17031 #[doc = ""]
17032 #[doc = "Arguments:"]
17033 #[doc = "* `organization`: The name of the Azure DevOps organization."]
17034 #[doc = "* `body`: The ref update action (lock/unlock) to perform"]
17035 #[doc = "* `repository_id`: The name or ID of the repository."]
17036 #[doc = "* `filter`: The name of the branch to lock/unlock"]
17037 #[doc = "* `project`: Project ID or project name"]
17038 pub fn update_ref(
17039 &self,
17040 organization: impl Into<String>,
17041 body: impl Into<models::GitRefUpdate>,
17042 repository_id: impl Into<String>,
17043 filter: impl Into<String>,
17044 project: impl Into<String>,
17045 ) -> update_ref::RequestBuilder {
17046 update_ref::RequestBuilder {
17047 client: self.0.clone(),
17048 organization: organization.into(),
17049 body: body.into(),
17050 repository_id: repository_id.into(),
17051 filter: filter.into(),
17052 project: project.into(),
17053 project_id: None,
17054 }
17055 }
17056 }
17057 pub mod list {
17058 use super::models;
17059 #[cfg(not(target_arch = "wasm32"))]
17060 use futures::future::BoxFuture;
17061 #[cfg(target_arch = "wasm32")]
17062 use futures::future::LocalBoxFuture as BoxFuture;
17063 #[derive(Debug)]
17064 pub struct Response(azure_core::http::Response);
17065 impl Response {
17066 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRefList> {
17067 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
17068 let body: models::GitRefList = serde_json::from_slice(&bytes).map_err(|e| {
17069 azure_core::error::Error::full(
17070 azure_core::error::ErrorKind::DataConversion,
17071 e,
17072 format!(
17073 "Failed to deserialize response:\n{}",
17074 String::from_utf8_lossy(&bytes)
17075 ),
17076 )
17077 })?;
17078 Ok(body)
17079 }
17080 pub fn into_raw_response(self) -> azure_core::http::Response {
17081 self.0
17082 }
17083 pub fn as_raw_response(&self) -> &azure_core::http::Response {
17084 &self.0
17085 }
17086 }
17087 impl From<Response> for azure_core::http::Response {
17088 fn from(rsp: Response) -> Self {
17089 rsp.into_raw_response()
17090 }
17091 }
17092 impl AsRef<azure_core::http::Response> for Response {
17093 fn as_ref(&self) -> &azure_core::http::Response {
17094 self.as_raw_response()
17095 }
17096 }
17097 #[derive(Clone)]
17098 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
17099 #[doc = r""]
17100 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
17101 #[doc = r" parameters can be chained."]
17102 #[doc = r""]
17103 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
17104 #[doc = r" converts the [`RequestBuilder`] into a future,"]
17105 #[doc = r" executes the request and returns a `Result` with the parsed"]
17106 #[doc = r" response."]
17107 #[doc = r""]
17108 #[doc = r" If you need lower-level access to the raw response details"]
17109 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
17110 #[doc = r" can finalize the request using the"]
17111 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
17112 #[doc = r" that resolves to a lower-level [`Response`] value."]
17113 pub struct RequestBuilder {
17114 pub(crate) client: super::super::Client,
17115 pub(crate) organization: String,
17116 pub(crate) repository_id: String,
17117 pub(crate) project: String,
17118 pub(crate) filter: Option<String>,
17119 pub(crate) include_links: Option<bool>,
17120 pub(crate) include_statuses: Option<bool>,
17121 pub(crate) include_my_branches: Option<bool>,
17122 pub(crate) latest_statuses_only: Option<bool>,
17123 pub(crate) peel_tags: Option<bool>,
17124 pub(crate) filter_contains: Option<String>,
17125 pub(crate) top: Option<i32>,
17126 pub(crate) continuation_token: Option<String>,
17127 }
17128 impl RequestBuilder {
17129 #[doc = "\\[optional\\] A filter to apply to the refs (starts with)."]
17130 pub fn filter(mut self, filter: impl Into<String>) -> Self {
17131 self.filter = Some(filter.into());
17132 self
17133 }
17134 #[doc = "\\[optional\\] Specifies if referenceLinks should be included in the result. default is false."]
17135 pub fn include_links(mut self, include_links: bool) -> Self {
17136 self.include_links = Some(include_links);
17137 self
17138 }
17139 #[doc = "\\[optional\\] Includes up to the first 1000 commit statuses for each ref. The default value is false."]
17140 pub fn include_statuses(mut self, include_statuses: bool) -> Self {
17141 self.include_statuses = Some(include_statuses);
17142 self
17143 }
17144 #[doc = "\\[optional\\] Includes only branches that the user owns, the branches the user favorites, and the default branch. The default value is false. Cannot be combined with the filter parameter."]
17145 pub fn include_my_branches(mut self, include_my_branches: bool) -> Self {
17146 self.include_my_branches = Some(include_my_branches);
17147 self
17148 }
17149 #[doc = "(optional) Set to true to include only the tip commit status for each ref. This option requires `includeStatuses` to be true. The default value is false."]
17150 pub fn latest_statuses_only(mut self, latest_statuses_only: bool) -> Self {
17151 self.latest_statuses_only = Some(latest_statuses_only);
17152 self
17153 }
17154 #[doc = "\\[optional\\] Annotated tags will populate the PeeledObjectId property. default is false."]
17155 pub fn peel_tags(mut self, peel_tags: bool) -> Self {
17156 self.peel_tags = Some(peel_tags);
17157 self
17158 }
17159 #[doc = "\\[optional\\] A filter to apply to the refs (contains)."]
17160 pub fn filter_contains(mut self, filter_contains: impl Into<String>) -> Self {
17161 self.filter_contains = Some(filter_contains.into());
17162 self
17163 }
17164 #[doc = "\\[optional\\] Maximum number of refs to return. It cannot be bigger than 1000. If it is not provided but continuation token is, top will default to 100."]
17165 pub fn top(mut self, top: i32) -> Self {
17166 self.top = Some(top);
17167 self
17168 }
17169 #[doc = "The continuation token used for pagination."]
17170 pub fn continuation_token(mut self, continuation_token: impl Into<String>) -> Self {
17171 self.continuation_token = Some(continuation_token.into());
17172 self
17173 }
17174 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
17175 #[doc = ""]
17176 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
17177 #[doc = "However, this function can provide more flexibility when required."]
17178 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
17179 Box::pin({
17180 let this = self.clone();
17181 async move {
17182 let url = this.url()?;
17183 let mut req =
17184 azure_core::http::Request::new(url, azure_core::http::Method::Get);
17185 if let Some(auth_header) = this
17186 .client
17187 .token_credential()
17188 .http_authorization_header(&this.client.scopes())
17189 .await?
17190 {
17191 req.insert_header(
17192 azure_core::http::headers::AUTHORIZATION,
17193 auth_header,
17194 );
17195 }
17196 if let Some(filter) = &this.filter {
17197 req.url_mut()
17198 .query_pairs_mut()
17199 .append_pair("filter", filter);
17200 }
17201 if let Some(include_links) = &this.include_links {
17202 req.url_mut()
17203 .query_pairs_mut()
17204 .append_pair("includeLinks", &include_links.to_string());
17205 }
17206 if let Some(include_statuses) = &this.include_statuses {
17207 req.url_mut()
17208 .query_pairs_mut()
17209 .append_pair("includeStatuses", &include_statuses.to_string());
17210 }
17211 if let Some(include_my_branches) = &this.include_my_branches {
17212 req.url_mut()
17213 .query_pairs_mut()
17214 .append_pair("includeMyBranches", &include_my_branches.to_string());
17215 }
17216 if let Some(latest_statuses_only) = &this.latest_statuses_only {
17217 req.url_mut().query_pairs_mut().append_pair(
17218 "latestStatusesOnly",
17219 &latest_statuses_only.to_string(),
17220 );
17221 }
17222 if let Some(peel_tags) = &this.peel_tags {
17223 req.url_mut()
17224 .query_pairs_mut()
17225 .append_pair("peelTags", &peel_tags.to_string());
17226 }
17227 if let Some(filter_contains) = &this.filter_contains {
17228 req.url_mut()
17229 .query_pairs_mut()
17230 .append_pair("filterContains", filter_contains);
17231 }
17232 if let Some(top) = &this.top {
17233 req.url_mut()
17234 .query_pairs_mut()
17235 .append_pair("$top", &top.to_string());
17236 }
17237 if let Some(continuation_token) = &this.continuation_token {
17238 req.url_mut()
17239 .query_pairs_mut()
17240 .append_pair("continuationToken", continuation_token);
17241 }
17242 let req_body = azure_core::Bytes::new();
17243 req.set_body(req_body);
17244 Ok(Response(this.client.send(&mut req).await?))
17245 }
17246 })
17247 }
17248 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
17249 let mut url = azure_core::http::Url::parse(&format!(
17250 "{}/{}/{}/_apis/git/repositories/{}/refs",
17251 self.client.endpoint(),
17252 &self.organization,
17253 &self.project,
17254 &self.repository_id
17255 ))?;
17256 let has_api_version_already = url
17257 .query_pairs()
17258 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
17259 if !has_api_version_already {
17260 url.query_pairs_mut().append_pair(
17261 azure_core::http::headers::query_param::API_VERSION,
17262 "7.1-preview",
17263 );
17264 }
17265 Ok(url)
17266 }
17267 }
17268 impl std::future::IntoFuture for RequestBuilder {
17269 type Output = azure_core::Result<models::GitRefList>;
17270 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRefList>>;
17271 #[doc = "Returns a future that sends the request and returns the parsed response body."]
17272 #[doc = ""]
17273 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
17274 #[doc = ""]
17275 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
17276 fn into_future(self) -> Self::IntoFuture {
17277 Box::pin(async move { self.send().await?.into_raw_body().await })
17278 }
17279 }
17280 }
17281 pub mod update_refs {
17282 use super::models;
17283 #[cfg(not(target_arch = "wasm32"))]
17284 use futures::future::BoxFuture;
17285 #[cfg(target_arch = "wasm32")]
17286 use futures::future::LocalBoxFuture as BoxFuture;
17287 #[derive(Debug)]
17288 pub struct Response(azure_core::http::Response);
17289 impl Response {
17290 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRefUpdateResultList> {
17291 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
17292 let body: models::GitRefUpdateResultList =
17293 serde_json::from_slice(&bytes).map_err(|e| {
17294 azure_core::error::Error::full(
17295 azure_core::error::ErrorKind::DataConversion,
17296 e,
17297 format!(
17298 "Failed to deserialize response:\n{}",
17299 String::from_utf8_lossy(&bytes)
17300 ),
17301 )
17302 })?;
17303 Ok(body)
17304 }
17305 pub fn into_raw_response(self) -> azure_core::http::Response {
17306 self.0
17307 }
17308 pub fn as_raw_response(&self) -> &azure_core::http::Response {
17309 &self.0
17310 }
17311 }
17312 impl From<Response> for azure_core::http::Response {
17313 fn from(rsp: Response) -> Self {
17314 rsp.into_raw_response()
17315 }
17316 }
17317 impl AsRef<azure_core::http::Response> for Response {
17318 fn as_ref(&self) -> &azure_core::http::Response {
17319 self.as_raw_response()
17320 }
17321 }
17322 #[derive(Clone)]
17323 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
17324 #[doc = r""]
17325 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
17326 #[doc = r" parameters can be chained."]
17327 #[doc = r""]
17328 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
17329 #[doc = r" converts the [`RequestBuilder`] into a future,"]
17330 #[doc = r" executes the request and returns a `Result` with the parsed"]
17331 #[doc = r" response."]
17332 #[doc = r""]
17333 #[doc = r" If you need lower-level access to the raw response details"]
17334 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
17335 #[doc = r" can finalize the request using the"]
17336 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
17337 #[doc = r" that resolves to a lower-level [`Response`] value."]
17338 pub struct RequestBuilder {
17339 pub(crate) client: super::super::Client,
17340 pub(crate) organization: String,
17341 pub(crate) body: Vec<models::GitRefUpdate>,
17342 pub(crate) repository_id: String,
17343 pub(crate) project: String,
17344 pub(crate) project_id: Option<String>,
17345 }
17346 impl RequestBuilder {
17347 #[doc = "ID or name of the team project. Optional if specifying an ID for repository."]
17348 pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
17349 self.project_id = Some(project_id.into());
17350 self
17351 }
17352 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
17353 #[doc = ""]
17354 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
17355 #[doc = "However, this function can provide more flexibility when required."]
17356 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
17357 Box::pin({
17358 let this = self.clone();
17359 async move {
17360 let url = this.url()?;
17361 let mut req =
17362 azure_core::http::Request::new(url, azure_core::http::Method::Post);
17363 if let Some(auth_header) = this
17364 .client
17365 .token_credential()
17366 .http_authorization_header(&this.client.scopes())
17367 .await?
17368 {
17369 req.insert_header(
17370 azure_core::http::headers::AUTHORIZATION,
17371 auth_header,
17372 );
17373 }
17374 req.insert_header("content-type", "application/json");
17375 let req_body = azure_core::json::to_json(&this.body)?;
17376 if let Some(project_id) = &this.project_id {
17377 req.url_mut()
17378 .query_pairs_mut()
17379 .append_pair("projectId", project_id);
17380 }
17381 req.set_body(req_body);
17382 Ok(Response(this.client.send(&mut req).await?))
17383 }
17384 })
17385 }
17386 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
17387 let mut url = azure_core::http::Url::parse(&format!(
17388 "{}/{}/{}/_apis/git/repositories/{}/refs",
17389 self.client.endpoint(),
17390 &self.organization,
17391 &self.project,
17392 &self.repository_id
17393 ))?;
17394 let has_api_version_already = url
17395 .query_pairs()
17396 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
17397 if !has_api_version_already {
17398 url.query_pairs_mut().append_pair(
17399 azure_core::http::headers::query_param::API_VERSION,
17400 "7.1-preview",
17401 );
17402 }
17403 Ok(url)
17404 }
17405 }
17406 impl std::future::IntoFuture for RequestBuilder {
17407 type Output = azure_core::Result<models::GitRefUpdateResultList>;
17408 type IntoFuture =
17409 BoxFuture<'static, azure_core::Result<models::GitRefUpdateResultList>>;
17410 #[doc = "Returns a future that sends the request and returns the parsed response body."]
17411 #[doc = ""]
17412 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
17413 #[doc = ""]
17414 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
17415 fn into_future(self) -> Self::IntoFuture {
17416 Box::pin(async move { self.send().await?.into_raw_body().await })
17417 }
17418 }
17419 }
17420 pub mod update_ref {
17421 use super::models;
17422 #[cfg(not(target_arch = "wasm32"))]
17423 use futures::future::BoxFuture;
17424 #[cfg(target_arch = "wasm32")]
17425 use futures::future::LocalBoxFuture as BoxFuture;
17426 #[derive(Debug)]
17427 pub struct Response(azure_core::http::Response);
17428 impl Response {
17429 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRef> {
17430 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
17431 let body: models::GitRef = serde_json::from_slice(&bytes).map_err(|e| {
17432 azure_core::error::Error::full(
17433 azure_core::error::ErrorKind::DataConversion,
17434 e,
17435 format!(
17436 "Failed to deserialize response:\n{}",
17437 String::from_utf8_lossy(&bytes)
17438 ),
17439 )
17440 })?;
17441 Ok(body)
17442 }
17443 pub fn into_raw_response(self) -> azure_core::http::Response {
17444 self.0
17445 }
17446 pub fn as_raw_response(&self) -> &azure_core::http::Response {
17447 &self.0
17448 }
17449 }
17450 impl From<Response> for azure_core::http::Response {
17451 fn from(rsp: Response) -> Self {
17452 rsp.into_raw_response()
17453 }
17454 }
17455 impl AsRef<azure_core::http::Response> for Response {
17456 fn as_ref(&self) -> &azure_core::http::Response {
17457 self.as_raw_response()
17458 }
17459 }
17460 #[derive(Clone)]
17461 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
17462 #[doc = r""]
17463 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
17464 #[doc = r" parameters can be chained."]
17465 #[doc = r""]
17466 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
17467 #[doc = r" converts the [`RequestBuilder`] into a future,"]
17468 #[doc = r" executes the request and returns a `Result` with the parsed"]
17469 #[doc = r" response."]
17470 #[doc = r""]
17471 #[doc = r" If you need lower-level access to the raw response details"]
17472 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
17473 #[doc = r" can finalize the request using the"]
17474 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
17475 #[doc = r" that resolves to a lower-level [`Response`] value."]
17476 pub struct RequestBuilder {
17477 pub(crate) client: super::super::Client,
17478 pub(crate) organization: String,
17479 pub(crate) body: models::GitRefUpdate,
17480 pub(crate) repository_id: String,
17481 pub(crate) filter: String,
17482 pub(crate) project: String,
17483 pub(crate) project_id: Option<String>,
17484 }
17485 impl RequestBuilder {
17486 #[doc = "ID or name of the team project. Optional if specifying an ID for repository."]
17487 pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
17488 self.project_id = Some(project_id.into());
17489 self
17490 }
17491 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
17492 #[doc = ""]
17493 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
17494 #[doc = "However, this function can provide more flexibility when required."]
17495 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
17496 Box::pin({
17497 let this = self.clone();
17498 async move {
17499 let url = this.url()?;
17500 let mut req =
17501 azure_core::http::Request::new(url, azure_core::http::Method::Patch);
17502 if let Some(auth_header) = this
17503 .client
17504 .token_credential()
17505 .http_authorization_header(&this.client.scopes())
17506 .await?
17507 {
17508 req.insert_header(
17509 azure_core::http::headers::AUTHORIZATION,
17510 auth_header,
17511 );
17512 }
17513 req.insert_header("content-type", "application/json");
17514 let req_body = azure_core::json::to_json(&this.body)?;
17515 let filter = &this.filter;
17516 req.url_mut()
17517 .query_pairs_mut()
17518 .append_pair("filter", filter);
17519 if let Some(project_id) = &this.project_id {
17520 req.url_mut()
17521 .query_pairs_mut()
17522 .append_pair("projectId", project_id);
17523 }
17524 req.set_body(req_body);
17525 Ok(Response(this.client.send(&mut req).await?))
17526 }
17527 })
17528 }
17529 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
17530 let mut url = azure_core::http::Url::parse(&format!(
17531 "{}/{}/{}/_apis/git/repositories/{}/refs",
17532 self.client.endpoint(),
17533 &self.organization,
17534 &self.project,
17535 &self.repository_id
17536 ))?;
17537 let has_api_version_already = url
17538 .query_pairs()
17539 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
17540 if !has_api_version_already {
17541 url.query_pairs_mut().append_pair(
17542 azure_core::http::headers::query_param::API_VERSION,
17543 "7.1-preview",
17544 );
17545 }
17546 Ok(url)
17547 }
17548 }
17549 impl std::future::IntoFuture for RequestBuilder {
17550 type Output = azure_core::Result<models::GitRef>;
17551 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRef>>;
17552 #[doc = "Returns a future that sends the request and returns the parsed response body."]
17553 #[doc = ""]
17554 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
17555 #[doc = ""]
17556 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
17557 fn into_future(self) -> Self::IntoFuture {
17558 Box::pin(async move { self.send().await?.into_raw_body().await })
17559 }
17560 }
17561 }
17562}
17563pub mod reverts {
17564 use super::models;
17565 #[cfg(not(target_arch = "wasm32"))]
17566 use futures::future::BoxFuture;
17567 #[cfg(target_arch = "wasm32")]
17568 use futures::future::LocalBoxFuture as BoxFuture;
17569 pub struct Client(pub(crate) super::Client);
17570 impl Client {
17571 #[doc = "Retrieve information about a revert operation for a specific branch."]
17572 #[doc = ""]
17573 #[doc = "Arguments:"]
17574 #[doc = "* `organization`: The name of the Azure DevOps organization."]
17575 #[doc = "* `project`: Project ID or project name"]
17576 #[doc = "* `repository_id`: ID of the repository."]
17577 #[doc = "* `ref_name`: The GitAsyncRefOperationParameters generatedRefName used for the revert operation."]
17578 pub fn get_revert_for_ref_name(
17579 &self,
17580 organization: impl Into<String>,
17581 project: impl Into<String>,
17582 repository_id: impl Into<String>,
17583 ref_name: impl Into<String>,
17584 ) -> get_revert_for_ref_name::RequestBuilder {
17585 get_revert_for_ref_name::RequestBuilder {
17586 client: self.0.clone(),
17587 organization: organization.into(),
17588 project: project.into(),
17589 repository_id: repository_id.into(),
17590 ref_name: ref_name.into(),
17591 }
17592 }
17593 #[doc = "Starts the operation to create a new branch which reverts changes introduced by either a specific commit or commits that are associated to a pull request."]
17594 #[doc = ""]
17595 #[doc = "Arguments:"]
17596 #[doc = "* `organization`: The name of the Azure DevOps organization."]
17597 #[doc = "* `project`: Project ID or project name"]
17598 #[doc = "* `repository_id`: ID of the repository."]
17599 pub fn create(
17600 &self,
17601 organization: impl Into<String>,
17602 body: impl Into<models::GitAsyncRefOperationParameters>,
17603 project: impl Into<String>,
17604 repository_id: impl Into<String>,
17605 ) -> create::RequestBuilder {
17606 create::RequestBuilder {
17607 client: self.0.clone(),
17608 organization: organization.into(),
17609 body: body.into(),
17610 project: project.into(),
17611 repository_id: repository_id.into(),
17612 }
17613 }
17614 #[doc = "Retrieve information about a revert operation by revert Id."]
17615 #[doc = ""]
17616 #[doc = "Arguments:"]
17617 #[doc = "* `organization`: The name of the Azure DevOps organization."]
17618 #[doc = "* `project`: Project ID or project name"]
17619 #[doc = "* `revert_id`: ID of the revert operation."]
17620 #[doc = "* `repository_id`: ID of the repository."]
17621 pub fn get_revert(
17622 &self,
17623 organization: impl Into<String>,
17624 project: impl Into<String>,
17625 revert_id: i32,
17626 repository_id: impl Into<String>,
17627 ) -> get_revert::RequestBuilder {
17628 get_revert::RequestBuilder {
17629 client: self.0.clone(),
17630 organization: organization.into(),
17631 project: project.into(),
17632 revert_id,
17633 repository_id: repository_id.into(),
17634 }
17635 }
17636 }
17637 pub mod get_revert_for_ref_name {
17638 use super::models;
17639 #[cfg(not(target_arch = "wasm32"))]
17640 use futures::future::BoxFuture;
17641 #[cfg(target_arch = "wasm32")]
17642 use futures::future::LocalBoxFuture as BoxFuture;
17643 #[derive(Debug)]
17644 pub struct Response(azure_core::http::Response);
17645 impl Response {
17646 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRevert> {
17647 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
17648 let body: models::GitRevert = serde_json::from_slice(&bytes).map_err(|e| {
17649 azure_core::error::Error::full(
17650 azure_core::error::ErrorKind::DataConversion,
17651 e,
17652 format!(
17653 "Failed to deserialize response:\n{}",
17654 String::from_utf8_lossy(&bytes)
17655 ),
17656 )
17657 })?;
17658 Ok(body)
17659 }
17660 pub fn into_raw_response(self) -> azure_core::http::Response {
17661 self.0
17662 }
17663 pub fn as_raw_response(&self) -> &azure_core::http::Response {
17664 &self.0
17665 }
17666 }
17667 impl From<Response> for azure_core::http::Response {
17668 fn from(rsp: Response) -> Self {
17669 rsp.into_raw_response()
17670 }
17671 }
17672 impl AsRef<azure_core::http::Response> for Response {
17673 fn as_ref(&self) -> &azure_core::http::Response {
17674 self.as_raw_response()
17675 }
17676 }
17677 #[derive(Clone)]
17678 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
17679 #[doc = r""]
17680 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
17681 #[doc = r" parameters can be chained."]
17682 #[doc = r""]
17683 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
17684 #[doc = r" converts the [`RequestBuilder`] into a future,"]
17685 #[doc = r" executes the request and returns a `Result` with the parsed"]
17686 #[doc = r" response."]
17687 #[doc = r""]
17688 #[doc = r" If you need lower-level access to the raw response details"]
17689 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
17690 #[doc = r" can finalize the request using the"]
17691 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
17692 #[doc = r" that resolves to a lower-level [`Response`] value."]
17693 pub struct RequestBuilder {
17694 pub(crate) client: super::super::Client,
17695 pub(crate) organization: String,
17696 pub(crate) project: String,
17697 pub(crate) repository_id: String,
17698 pub(crate) ref_name: String,
17699 }
17700 impl RequestBuilder {
17701 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
17702 #[doc = ""]
17703 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
17704 #[doc = "However, this function can provide more flexibility when required."]
17705 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
17706 Box::pin({
17707 let this = self.clone();
17708 async move {
17709 let url = this.url()?;
17710 let mut req =
17711 azure_core::http::Request::new(url, azure_core::http::Method::Get);
17712 if let Some(auth_header) = this
17713 .client
17714 .token_credential()
17715 .http_authorization_header(&this.client.scopes())
17716 .await?
17717 {
17718 req.insert_header(
17719 azure_core::http::headers::AUTHORIZATION,
17720 auth_header,
17721 );
17722 }
17723 let ref_name = &this.ref_name;
17724 req.url_mut()
17725 .query_pairs_mut()
17726 .append_pair("refName", ref_name);
17727 let req_body = azure_core::Bytes::new();
17728 req.set_body(req_body);
17729 Ok(Response(this.client.send(&mut req).await?))
17730 }
17731 })
17732 }
17733 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
17734 let mut url = azure_core::http::Url::parse(&format!(
17735 "{}/{}/{}/_apis/git/repositories/{}/reverts",
17736 self.client.endpoint(),
17737 &self.organization,
17738 &self.project,
17739 &self.repository_id
17740 ))?;
17741 let has_api_version_already = url
17742 .query_pairs()
17743 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
17744 if !has_api_version_already {
17745 url.query_pairs_mut().append_pair(
17746 azure_core::http::headers::query_param::API_VERSION,
17747 "7.1-preview",
17748 );
17749 }
17750 Ok(url)
17751 }
17752 }
17753 impl std::future::IntoFuture for RequestBuilder {
17754 type Output = azure_core::Result<models::GitRevert>;
17755 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRevert>>;
17756 #[doc = "Returns a future that sends the request and returns the parsed response body."]
17757 #[doc = ""]
17758 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
17759 #[doc = ""]
17760 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
17761 fn into_future(self) -> Self::IntoFuture {
17762 Box::pin(async move { self.send().await?.into_raw_body().await })
17763 }
17764 }
17765 }
17766 pub mod create {
17767 use super::models;
17768 #[cfg(not(target_arch = "wasm32"))]
17769 use futures::future::BoxFuture;
17770 #[cfg(target_arch = "wasm32")]
17771 use futures::future::LocalBoxFuture as BoxFuture;
17772 #[derive(Debug)]
17773 pub struct Response(azure_core::http::Response);
17774 impl Response {
17775 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRevert> {
17776 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
17777 let body: models::GitRevert = serde_json::from_slice(&bytes).map_err(|e| {
17778 azure_core::error::Error::full(
17779 azure_core::error::ErrorKind::DataConversion,
17780 e,
17781 format!(
17782 "Failed to deserialize response:\n{}",
17783 String::from_utf8_lossy(&bytes)
17784 ),
17785 )
17786 })?;
17787 Ok(body)
17788 }
17789 pub fn into_raw_response(self) -> azure_core::http::Response {
17790 self.0
17791 }
17792 pub fn as_raw_response(&self) -> &azure_core::http::Response {
17793 &self.0
17794 }
17795 }
17796 impl From<Response> for azure_core::http::Response {
17797 fn from(rsp: Response) -> Self {
17798 rsp.into_raw_response()
17799 }
17800 }
17801 impl AsRef<azure_core::http::Response> for Response {
17802 fn as_ref(&self) -> &azure_core::http::Response {
17803 self.as_raw_response()
17804 }
17805 }
17806 #[derive(Clone)]
17807 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
17808 #[doc = r""]
17809 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
17810 #[doc = r" parameters can be chained."]
17811 #[doc = r""]
17812 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
17813 #[doc = r" converts the [`RequestBuilder`] into a future,"]
17814 #[doc = r" executes the request and returns a `Result` with the parsed"]
17815 #[doc = r" response."]
17816 #[doc = r""]
17817 #[doc = r" If you need lower-level access to the raw response details"]
17818 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
17819 #[doc = r" can finalize the request using the"]
17820 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
17821 #[doc = r" that resolves to a lower-level [`Response`] value."]
17822 pub struct RequestBuilder {
17823 pub(crate) client: super::super::Client,
17824 pub(crate) organization: String,
17825 pub(crate) body: models::GitAsyncRefOperationParameters,
17826 pub(crate) project: String,
17827 pub(crate) repository_id: String,
17828 }
17829 impl RequestBuilder {
17830 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
17831 #[doc = ""]
17832 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
17833 #[doc = "However, this function can provide more flexibility when required."]
17834 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
17835 Box::pin({
17836 let this = self.clone();
17837 async move {
17838 let url = this.url()?;
17839 let mut req =
17840 azure_core::http::Request::new(url, azure_core::http::Method::Post);
17841 if let Some(auth_header) = this
17842 .client
17843 .token_credential()
17844 .http_authorization_header(&this.client.scopes())
17845 .await?
17846 {
17847 req.insert_header(
17848 azure_core::http::headers::AUTHORIZATION,
17849 auth_header,
17850 );
17851 }
17852 req.insert_header("content-type", "application/json");
17853 let req_body = azure_core::json::to_json(&this.body)?;
17854 req.set_body(req_body);
17855 Ok(Response(this.client.send(&mut req).await?))
17856 }
17857 })
17858 }
17859 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
17860 let mut url = azure_core::http::Url::parse(&format!(
17861 "{}/{}/{}/_apis/git/repositories/{}/reverts",
17862 self.client.endpoint(),
17863 &self.organization,
17864 &self.project,
17865 &self.repository_id
17866 ))?;
17867 let has_api_version_already = url
17868 .query_pairs()
17869 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
17870 if !has_api_version_already {
17871 url.query_pairs_mut().append_pair(
17872 azure_core::http::headers::query_param::API_VERSION,
17873 "7.1-preview",
17874 );
17875 }
17876 Ok(url)
17877 }
17878 }
17879 impl std::future::IntoFuture for RequestBuilder {
17880 type Output = azure_core::Result<models::GitRevert>;
17881 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRevert>>;
17882 #[doc = "Returns a future that sends the request and returns the parsed response body."]
17883 #[doc = ""]
17884 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
17885 #[doc = ""]
17886 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
17887 fn into_future(self) -> Self::IntoFuture {
17888 Box::pin(async move { self.send().await?.into_raw_body().await })
17889 }
17890 }
17891 }
17892 pub mod get_revert {
17893 use super::models;
17894 #[cfg(not(target_arch = "wasm32"))]
17895 use futures::future::BoxFuture;
17896 #[cfg(target_arch = "wasm32")]
17897 use futures::future::LocalBoxFuture as BoxFuture;
17898 #[derive(Debug)]
17899 pub struct Response(azure_core::http::Response);
17900 impl Response {
17901 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRevert> {
17902 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
17903 let body: models::GitRevert = serde_json::from_slice(&bytes).map_err(|e| {
17904 azure_core::error::Error::full(
17905 azure_core::error::ErrorKind::DataConversion,
17906 e,
17907 format!(
17908 "Failed to deserialize response:\n{}",
17909 String::from_utf8_lossy(&bytes)
17910 ),
17911 )
17912 })?;
17913 Ok(body)
17914 }
17915 pub fn into_raw_response(self) -> azure_core::http::Response {
17916 self.0
17917 }
17918 pub fn as_raw_response(&self) -> &azure_core::http::Response {
17919 &self.0
17920 }
17921 }
17922 impl From<Response> for azure_core::http::Response {
17923 fn from(rsp: Response) -> Self {
17924 rsp.into_raw_response()
17925 }
17926 }
17927 impl AsRef<azure_core::http::Response> for Response {
17928 fn as_ref(&self) -> &azure_core::http::Response {
17929 self.as_raw_response()
17930 }
17931 }
17932 #[derive(Clone)]
17933 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
17934 #[doc = r""]
17935 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
17936 #[doc = r" parameters can be chained."]
17937 #[doc = r""]
17938 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
17939 #[doc = r" converts the [`RequestBuilder`] into a future,"]
17940 #[doc = r" executes the request and returns a `Result` with the parsed"]
17941 #[doc = r" response."]
17942 #[doc = r""]
17943 #[doc = r" If you need lower-level access to the raw response details"]
17944 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
17945 #[doc = r" can finalize the request using the"]
17946 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
17947 #[doc = r" that resolves to a lower-level [`Response`] value."]
17948 pub struct RequestBuilder {
17949 pub(crate) client: super::super::Client,
17950 pub(crate) organization: String,
17951 pub(crate) project: String,
17952 pub(crate) revert_id: i32,
17953 pub(crate) repository_id: String,
17954 }
17955 impl RequestBuilder {
17956 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
17957 #[doc = ""]
17958 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
17959 #[doc = "However, this function can provide more flexibility when required."]
17960 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
17961 Box::pin({
17962 let this = self.clone();
17963 async move {
17964 let url = this.url()?;
17965 let mut req =
17966 azure_core::http::Request::new(url, azure_core::http::Method::Get);
17967 if let Some(auth_header) = this
17968 .client
17969 .token_credential()
17970 .http_authorization_header(&this.client.scopes())
17971 .await?
17972 {
17973 req.insert_header(
17974 azure_core::http::headers::AUTHORIZATION,
17975 auth_header,
17976 );
17977 }
17978 let req_body = azure_core::Bytes::new();
17979 req.set_body(req_body);
17980 Ok(Response(this.client.send(&mut req).await?))
17981 }
17982 })
17983 }
17984 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
17985 let mut url = azure_core::http::Url::parse(&format!(
17986 "{}/{}/{}/_apis/git/repositories/{}/reverts/{}",
17987 self.client.endpoint(),
17988 &self.organization,
17989 &self.project,
17990 &self.repository_id,
17991 &self.revert_id
17992 ))?;
17993 let has_api_version_already = url
17994 .query_pairs()
17995 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
17996 if !has_api_version_already {
17997 url.query_pairs_mut().append_pair(
17998 azure_core::http::headers::query_param::API_VERSION,
17999 "7.1-preview",
18000 );
18001 }
18002 Ok(url)
18003 }
18004 }
18005 impl std::future::IntoFuture for RequestBuilder {
18006 type Output = azure_core::Result<models::GitRevert>;
18007 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRevert>>;
18008 #[doc = "Returns a future that sends the request and returns the parsed response body."]
18009 #[doc = ""]
18010 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
18011 #[doc = ""]
18012 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
18013 fn into_future(self) -> Self::IntoFuture {
18014 Box::pin(async move { self.send().await?.into_raw_body().await })
18015 }
18016 }
18017 }
18018}
18019pub mod suggestions {
18020 use super::models;
18021 #[cfg(not(target_arch = "wasm32"))]
18022 use futures::future::BoxFuture;
18023 #[cfg(target_arch = "wasm32")]
18024 use futures::future::LocalBoxFuture as BoxFuture;
18025 pub struct Client(pub(crate) super::Client);
18026 impl Client {
18027 #[doc = "Retrieve a pull request suggestion for a particular repository or team project."]
18028 #[doc = ""]
18029 #[doc = "Arguments:"]
18030 #[doc = "* `organization`: The name of the Azure DevOps organization."]
18031 #[doc = "* `repository_id`: ID of the git repository."]
18032 #[doc = "* `project`: Project ID or project name"]
18033 pub fn list(
18034 &self,
18035 organization: impl Into<String>,
18036 repository_id: impl Into<String>,
18037 project: impl Into<String>,
18038 ) -> list::RequestBuilder {
18039 list::RequestBuilder {
18040 client: self.0.clone(),
18041 organization: organization.into(),
18042 repository_id: repository_id.into(),
18043 project: project.into(),
18044 }
18045 }
18046 }
18047 pub mod list {
18048 use super::models;
18049 #[cfg(not(target_arch = "wasm32"))]
18050 use futures::future::BoxFuture;
18051 #[cfg(target_arch = "wasm32")]
18052 use futures::future::LocalBoxFuture as BoxFuture;
18053 #[derive(Debug)]
18054 pub struct Response(azure_core::http::Response);
18055 impl Response {
18056 pub async fn into_raw_body(self) -> azure_core::Result<models::GitSuggestionList> {
18057 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
18058 let body: models::GitSuggestionList =
18059 serde_json::from_slice(&bytes).map_err(|e| {
18060 azure_core::error::Error::full(
18061 azure_core::error::ErrorKind::DataConversion,
18062 e,
18063 format!(
18064 "Failed to deserialize response:\n{}",
18065 String::from_utf8_lossy(&bytes)
18066 ),
18067 )
18068 })?;
18069 Ok(body)
18070 }
18071 pub fn into_raw_response(self) -> azure_core::http::Response {
18072 self.0
18073 }
18074 pub fn as_raw_response(&self) -> &azure_core::http::Response {
18075 &self.0
18076 }
18077 }
18078 impl From<Response> for azure_core::http::Response {
18079 fn from(rsp: Response) -> Self {
18080 rsp.into_raw_response()
18081 }
18082 }
18083 impl AsRef<azure_core::http::Response> for Response {
18084 fn as_ref(&self) -> &azure_core::http::Response {
18085 self.as_raw_response()
18086 }
18087 }
18088 #[derive(Clone)]
18089 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
18090 #[doc = r""]
18091 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
18092 #[doc = r" parameters can be chained."]
18093 #[doc = r""]
18094 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
18095 #[doc = r" converts the [`RequestBuilder`] into a future,"]
18096 #[doc = r" executes the request and returns a `Result` with the parsed"]
18097 #[doc = r" response."]
18098 #[doc = r""]
18099 #[doc = r" If you need lower-level access to the raw response details"]
18100 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
18101 #[doc = r" can finalize the request using the"]
18102 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
18103 #[doc = r" that resolves to a lower-level [`Response`] value."]
18104 pub struct RequestBuilder {
18105 pub(crate) client: super::super::Client,
18106 pub(crate) organization: String,
18107 pub(crate) repository_id: String,
18108 pub(crate) project: String,
18109 }
18110 impl RequestBuilder {
18111 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
18112 #[doc = ""]
18113 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
18114 #[doc = "However, this function can provide more flexibility when required."]
18115 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
18116 Box::pin({
18117 let this = self.clone();
18118 async move {
18119 let url = this.url()?;
18120 let mut req =
18121 azure_core::http::Request::new(url, azure_core::http::Method::Get);
18122 if let Some(auth_header) = this
18123 .client
18124 .token_credential()
18125 .http_authorization_header(&this.client.scopes())
18126 .await?
18127 {
18128 req.insert_header(
18129 azure_core::http::headers::AUTHORIZATION,
18130 auth_header,
18131 );
18132 }
18133 let req_body = azure_core::Bytes::new();
18134 req.set_body(req_body);
18135 Ok(Response(this.client.send(&mut req).await?))
18136 }
18137 })
18138 }
18139 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
18140 let mut url = azure_core::http::Url::parse(&format!(
18141 "{}/{}/{}/_apis/git/repositories/{}/suggestions",
18142 self.client.endpoint(),
18143 &self.organization,
18144 &self.project,
18145 &self.repository_id
18146 ))?;
18147 let has_api_version_already = url
18148 .query_pairs()
18149 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
18150 if !has_api_version_already {
18151 url.query_pairs_mut().append_pair(
18152 azure_core::http::headers::query_param::API_VERSION,
18153 "7.1-preview",
18154 );
18155 }
18156 Ok(url)
18157 }
18158 }
18159 impl std::future::IntoFuture for RequestBuilder {
18160 type Output = azure_core::Result<models::GitSuggestionList>;
18161 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitSuggestionList>>;
18162 #[doc = "Returns a future that sends the request and returns the parsed response body."]
18163 #[doc = ""]
18164 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
18165 #[doc = ""]
18166 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
18167 fn into_future(self) -> Self::IntoFuture {
18168 Box::pin(async move { self.send().await?.into_raw_body().await })
18169 }
18170 }
18171 }
18172}
18173pub mod trees {
18174 use super::models;
18175 #[cfg(not(target_arch = "wasm32"))]
18176 use futures::future::BoxFuture;
18177 #[cfg(target_arch = "wasm32")]
18178 use futures::future::LocalBoxFuture as BoxFuture;
18179 pub struct Client(pub(crate) super::Client);
18180 impl Client {
18181 #[doc = "The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.\n\nRepositories have both a name and an identifier. Identifiers are globally unique, but several projects may contain a repository of the same name. You don't need to include the project if you specify a repository by ID. However, if you specify a repository by name, you must also specify the project (by name or ID."]
18182 #[doc = ""]
18183 #[doc = "Arguments:"]
18184 #[doc = "* `organization`: The name of the Azure DevOps organization."]
18185 #[doc = "* `repository_id`: Repository Id."]
18186 #[doc = "* `sha1`: SHA1 hash of the tree object."]
18187 #[doc = "* `project`: Project ID or project name"]
18188 pub fn get(
18189 &self,
18190 organization: impl Into<String>,
18191 repository_id: impl Into<String>,
18192 sha1: impl Into<String>,
18193 project: impl Into<String>,
18194 ) -> get::RequestBuilder {
18195 get::RequestBuilder {
18196 client: self.0.clone(),
18197 organization: organization.into(),
18198 repository_id: repository_id.into(),
18199 sha1: sha1.into(),
18200 project: project.into(),
18201 project_id: None,
18202 recursive: None,
18203 file_name: None,
18204 format: None,
18205 }
18206 }
18207 }
18208 pub mod get {
18209 use super::models;
18210 #[cfg(not(target_arch = "wasm32"))]
18211 use futures::future::BoxFuture;
18212 #[cfg(target_arch = "wasm32")]
18213 use futures::future::LocalBoxFuture as BoxFuture;
18214 #[derive(Debug)]
18215 pub struct Response(azure_core::http::Response);
18216 impl Response {
18217 pub async fn into_raw_body(self) -> azure_core::Result<models::GitTreeRef> {
18218 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
18219 let body: models::GitTreeRef = serde_json::from_slice(&bytes).map_err(|e| {
18220 azure_core::error::Error::full(
18221 azure_core::error::ErrorKind::DataConversion,
18222 e,
18223 format!(
18224 "Failed to deserialize response:\n{}",
18225 String::from_utf8_lossy(&bytes)
18226 ),
18227 )
18228 })?;
18229 Ok(body)
18230 }
18231 pub fn into_raw_response(self) -> azure_core::http::Response {
18232 self.0
18233 }
18234 pub fn as_raw_response(&self) -> &azure_core::http::Response {
18235 &self.0
18236 }
18237 }
18238 impl From<Response> for azure_core::http::Response {
18239 fn from(rsp: Response) -> Self {
18240 rsp.into_raw_response()
18241 }
18242 }
18243 impl AsRef<azure_core::http::Response> for Response {
18244 fn as_ref(&self) -> &azure_core::http::Response {
18245 self.as_raw_response()
18246 }
18247 }
18248 #[derive(Clone)]
18249 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
18250 #[doc = r""]
18251 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
18252 #[doc = r" parameters can be chained."]
18253 #[doc = r""]
18254 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
18255 #[doc = r" converts the [`RequestBuilder`] into a future,"]
18256 #[doc = r" executes the request and returns a `Result` with the parsed"]
18257 #[doc = r" response."]
18258 #[doc = r""]
18259 #[doc = r" If you need lower-level access to the raw response details"]
18260 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
18261 #[doc = r" can finalize the request using the"]
18262 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
18263 #[doc = r" that resolves to a lower-level [`Response`] value."]
18264 pub struct RequestBuilder {
18265 pub(crate) client: super::super::Client,
18266 pub(crate) organization: String,
18267 pub(crate) repository_id: String,
18268 pub(crate) sha1: String,
18269 pub(crate) project: String,
18270 pub(crate) project_id: Option<String>,
18271 pub(crate) recursive: Option<bool>,
18272 pub(crate) file_name: Option<String>,
18273 pub(crate) format: Option<String>,
18274 }
18275 impl RequestBuilder {
18276 #[doc = "Project Id."]
18277 pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
18278 self.project_id = Some(project_id.into());
18279 self
18280 }
18281 #[doc = "Search recursively. Include trees underneath this tree. Default is false."]
18282 pub fn recursive(mut self, recursive: bool) -> Self {
18283 self.recursive = Some(recursive);
18284 self
18285 }
18286 #[doc = "Name to use if a .zip file is returned. Default is the object ID."]
18287 pub fn file_name(mut self, file_name: impl Into<String>) -> Self {
18288 self.file_name = Some(file_name.into());
18289 self
18290 }
18291 #[doc = "Use \"zip\". Defaults to the MIME type set in the Accept header."]
18292 pub fn format(mut self, format: impl Into<String>) -> Self {
18293 self.format = Some(format.into());
18294 self
18295 }
18296 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
18297 #[doc = ""]
18298 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
18299 #[doc = "However, this function can provide more flexibility when required."]
18300 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
18301 Box::pin({
18302 let this = self.clone();
18303 async move {
18304 let url = this.url()?;
18305 let mut req =
18306 azure_core::http::Request::new(url, azure_core::http::Method::Get);
18307 if let Some(auth_header) = this
18308 .client
18309 .token_credential()
18310 .http_authorization_header(&this.client.scopes())
18311 .await?
18312 {
18313 req.insert_header(
18314 azure_core::http::headers::AUTHORIZATION,
18315 auth_header,
18316 );
18317 }
18318 if let Some(project_id) = &this.project_id {
18319 req.url_mut()
18320 .query_pairs_mut()
18321 .append_pair("projectId", project_id);
18322 }
18323 if let Some(recursive) = &this.recursive {
18324 req.url_mut()
18325 .query_pairs_mut()
18326 .append_pair("recursive", &recursive.to_string());
18327 }
18328 if let Some(file_name) = &this.file_name {
18329 req.url_mut()
18330 .query_pairs_mut()
18331 .append_pair("fileName", file_name);
18332 }
18333 if let Some(format) = &this.format {
18334 req.url_mut()
18335 .query_pairs_mut()
18336 .append_pair("$format", format);
18337 }
18338 let req_body = azure_core::Bytes::new();
18339 req.set_body(req_body);
18340 Ok(Response(this.client.send(&mut req).await?))
18341 }
18342 })
18343 }
18344 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
18345 let mut url = azure_core::http::Url::parse(&format!(
18346 "{}/{}/{}/_apis/git/repositories/{}/trees/{}",
18347 self.client.endpoint(),
18348 &self.organization,
18349 &self.project,
18350 &self.repository_id,
18351 &self.sha1
18352 ))?;
18353 let has_api_version_already = url
18354 .query_pairs()
18355 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
18356 if !has_api_version_already {
18357 url.query_pairs_mut().append_pair(
18358 azure_core::http::headers::query_param::API_VERSION,
18359 "7.1-preview",
18360 );
18361 }
18362 Ok(url)
18363 }
18364 }
18365 impl std::future::IntoFuture for RequestBuilder {
18366 type Output = azure_core::Result<models::GitTreeRef>;
18367 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitTreeRef>>;
18368 #[doc = "Returns a future that sends the request and returns the parsed response body."]
18369 #[doc = ""]
18370 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
18371 #[doc = ""]
18372 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
18373 fn into_future(self) -> Self::IntoFuture {
18374 Box::pin(async move { self.send().await?.into_raw_body().await })
18375 }
18376 }
18377 }
18378}
18379pub mod merge_bases {
18380 use super::models;
18381 #[cfg(not(target_arch = "wasm32"))]
18382 use futures::future::BoxFuture;
18383 #[cfg(target_arch = "wasm32")]
18384 use futures::future::LocalBoxFuture as BoxFuture;
18385 pub struct Client(pub(crate) super::Client);
18386 impl Client {
18387 #[doc = "Find the merge bases of two commits, optionally across forks. If otherRepositoryId is not specified, the merge bases will only be calculated within the context of the local repositoryNameOrId."]
18388 #[doc = ""]
18389 #[doc = "Arguments:"]
18390 #[doc = "* `organization`: The name of the Azure DevOps organization."]
18391 #[doc = "* `repository_name_or_id`: ID or name of the local repository."]
18392 #[doc = "* `commit_id`: First commit, usually the tip of the target branch of the potential merge."]
18393 #[doc = "* `other_commit_id`: Other commit, usually the tip of the source branch of the potential merge."]
18394 #[doc = "* `project`: Project ID or project name"]
18395 pub fn list(
18396 &self,
18397 organization: impl Into<String>,
18398 repository_name_or_id: impl Into<String>,
18399 commit_id: impl Into<String>,
18400 other_commit_id: impl Into<String>,
18401 project: impl Into<String>,
18402 ) -> list::RequestBuilder {
18403 list::RequestBuilder {
18404 client: self.0.clone(),
18405 organization: organization.into(),
18406 repository_name_or_id: repository_name_or_id.into(),
18407 commit_id: commit_id.into(),
18408 other_commit_id: other_commit_id.into(),
18409 project: project.into(),
18410 other_collection_id: None,
18411 other_repository_id: None,
18412 }
18413 }
18414 }
18415 pub mod list {
18416 use super::models;
18417 #[cfg(not(target_arch = "wasm32"))]
18418 use futures::future::BoxFuture;
18419 #[cfg(target_arch = "wasm32")]
18420 use futures::future::LocalBoxFuture as BoxFuture;
18421 #[derive(Debug)]
18422 pub struct Response(azure_core::http::Response);
18423 impl Response {
18424 pub async fn into_raw_body(self) -> azure_core::Result<models::GitCommitRefList> {
18425 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
18426 let body: models::GitCommitRefList =
18427 serde_json::from_slice(&bytes).map_err(|e| {
18428 azure_core::error::Error::full(
18429 azure_core::error::ErrorKind::DataConversion,
18430 e,
18431 format!(
18432 "Failed to deserialize response:\n{}",
18433 String::from_utf8_lossy(&bytes)
18434 ),
18435 )
18436 })?;
18437 Ok(body)
18438 }
18439 pub fn into_raw_response(self) -> azure_core::http::Response {
18440 self.0
18441 }
18442 pub fn as_raw_response(&self) -> &azure_core::http::Response {
18443 &self.0
18444 }
18445 }
18446 impl From<Response> for azure_core::http::Response {
18447 fn from(rsp: Response) -> Self {
18448 rsp.into_raw_response()
18449 }
18450 }
18451 impl AsRef<azure_core::http::Response> for Response {
18452 fn as_ref(&self) -> &azure_core::http::Response {
18453 self.as_raw_response()
18454 }
18455 }
18456 #[derive(Clone)]
18457 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
18458 #[doc = r""]
18459 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
18460 #[doc = r" parameters can be chained."]
18461 #[doc = r""]
18462 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
18463 #[doc = r" converts the [`RequestBuilder`] into a future,"]
18464 #[doc = r" executes the request and returns a `Result` with the parsed"]
18465 #[doc = r" response."]
18466 #[doc = r""]
18467 #[doc = r" If you need lower-level access to the raw response details"]
18468 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
18469 #[doc = r" can finalize the request using the"]
18470 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
18471 #[doc = r" that resolves to a lower-level [`Response`] value."]
18472 pub struct RequestBuilder {
18473 pub(crate) client: super::super::Client,
18474 pub(crate) organization: String,
18475 pub(crate) repository_name_or_id: String,
18476 pub(crate) commit_id: String,
18477 pub(crate) other_commit_id: String,
18478 pub(crate) project: String,
18479 pub(crate) other_collection_id: Option<String>,
18480 pub(crate) other_repository_id: Option<String>,
18481 }
18482 impl RequestBuilder {
18483 #[doc = "The collection ID where otherCommitId lives."]
18484 pub fn other_collection_id(mut self, other_collection_id: impl Into<String>) -> Self {
18485 self.other_collection_id = Some(other_collection_id.into());
18486 self
18487 }
18488 #[doc = "The repository ID where otherCommitId lives."]
18489 pub fn other_repository_id(mut self, other_repository_id: impl Into<String>) -> Self {
18490 self.other_repository_id = Some(other_repository_id.into());
18491 self
18492 }
18493 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
18494 #[doc = ""]
18495 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
18496 #[doc = "However, this function can provide more flexibility when required."]
18497 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
18498 Box::pin({
18499 let this = self.clone();
18500 async move {
18501 let url = this.url()?;
18502 let mut req =
18503 azure_core::http::Request::new(url, azure_core::http::Method::Get);
18504 if let Some(auth_header) = this
18505 .client
18506 .token_credential()
18507 .http_authorization_header(&this.client.scopes())
18508 .await?
18509 {
18510 req.insert_header(
18511 azure_core::http::headers::AUTHORIZATION,
18512 auth_header,
18513 );
18514 }
18515 let other_commit_id = &this.other_commit_id;
18516 req.url_mut()
18517 .query_pairs_mut()
18518 .append_pair("otherCommitId", other_commit_id);
18519 if let Some(other_collection_id) = &this.other_collection_id {
18520 req.url_mut()
18521 .query_pairs_mut()
18522 .append_pair("otherCollectionId", other_collection_id);
18523 }
18524 if let Some(other_repository_id) = &this.other_repository_id {
18525 req.url_mut()
18526 .query_pairs_mut()
18527 .append_pair("otherRepositoryId", other_repository_id);
18528 }
18529 let req_body = azure_core::Bytes::new();
18530 req.set_body(req_body);
18531 Ok(Response(this.client.send(&mut req).await?))
18532 }
18533 })
18534 }
18535 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
18536 let mut url = azure_core::http::Url::parse(&format!(
18537 "{}/{}/{}/_apis/git/repositories/{}/commits/{}/mergebases",
18538 self.client.endpoint(),
18539 &self.organization,
18540 &self.project,
18541 &self.repository_name_or_id,
18542 &self.commit_id
18543 ))?;
18544 let has_api_version_already = url
18545 .query_pairs()
18546 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
18547 if !has_api_version_already {
18548 url.query_pairs_mut().append_pair(
18549 azure_core::http::headers::query_param::API_VERSION,
18550 "7.1-preview",
18551 );
18552 }
18553 Ok(url)
18554 }
18555 }
18556 impl std::future::IntoFuture for RequestBuilder {
18557 type Output = azure_core::Result<models::GitCommitRefList>;
18558 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
18559 #[doc = "Returns a future that sends the request and returns the parsed response body."]
18560 #[doc = ""]
18561 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
18562 #[doc = ""]
18563 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
18564 fn into_future(self) -> Self::IntoFuture {
18565 Box::pin(async move { self.send().await?.into_raw_body().await })
18566 }
18567 }
18568 }
18569}
18570pub mod forks {
18571 use super::models;
18572 #[cfg(not(target_arch = "wasm32"))]
18573 use futures::future::BoxFuture;
18574 #[cfg(target_arch = "wasm32")]
18575 use futures::future::LocalBoxFuture as BoxFuture;
18576 pub struct Client(pub(crate) super::Client);
18577 impl Client {
18578 #[doc = "Retrieve all forks of a repository in the collection."]
18579 #[doc = ""]
18580 #[doc = "Arguments:"]
18581 #[doc = "* `organization`: The name of the Azure DevOps organization."]
18582 #[doc = "* `repository_name_or_id`: The name or ID of the repository."]
18583 #[doc = "* `collection_id`: Team project collection ID."]
18584 #[doc = "* `project`: Project ID or project name"]
18585 pub fn list(
18586 &self,
18587 organization: impl Into<String>,
18588 repository_name_or_id: impl Into<String>,
18589 collection_id: impl Into<String>,
18590 project: impl Into<String>,
18591 ) -> list::RequestBuilder {
18592 list::RequestBuilder {
18593 client: self.0.clone(),
18594 organization: organization.into(),
18595 repository_name_or_id: repository_name_or_id.into(),
18596 collection_id: collection_id.into(),
18597 project: project.into(),
18598 include_links: None,
18599 }
18600 }
18601 #[doc = "Retrieve all requested fork sync operations on this repository."]
18602 #[doc = ""]
18603 #[doc = "Arguments:"]
18604 #[doc = "* `organization`: The name of the Azure DevOps organization."]
18605 #[doc = "* `repository_name_or_id`: The name or ID of the repository."]
18606 #[doc = "* `project`: Project ID or project name"]
18607 pub fn get_fork_sync_requests(
18608 &self,
18609 organization: impl Into<String>,
18610 repository_name_or_id: impl Into<String>,
18611 project: impl Into<String>,
18612 ) -> get_fork_sync_requests::RequestBuilder {
18613 get_fork_sync_requests::RequestBuilder {
18614 client: self.0.clone(),
18615 organization: organization.into(),
18616 repository_name_or_id: repository_name_or_id.into(),
18617 project: project.into(),
18618 include_abandoned: None,
18619 include_links: None,
18620 }
18621 }
18622 #[doc = "Request that another repository's refs be fetched into this one. It syncs two existing forks. To create a fork, please see the <a href=\"https://docs.microsoft.com/en-us/rest/api/vsts/git/repositories/create?view=azure-devops-rest-5.1\"> repositories endpoint</a>"]
18623 #[doc = ""]
18624 #[doc = "Arguments:"]
18625 #[doc = "* `organization`: The name of the Azure DevOps organization."]
18626 #[doc = "* `body`: Source repository and ref mapping."]
18627 #[doc = "* `repository_name_or_id`: The name or ID of the repository."]
18628 #[doc = "* `project`: Project ID or project name"]
18629 pub fn create_fork_sync_request(
18630 &self,
18631 organization: impl Into<String>,
18632 body: impl Into<models::GitForkSyncRequestParameters>,
18633 repository_name_or_id: impl Into<String>,
18634 project: impl Into<String>,
18635 ) -> create_fork_sync_request::RequestBuilder {
18636 create_fork_sync_request::RequestBuilder {
18637 client: self.0.clone(),
18638 organization: organization.into(),
18639 body: body.into(),
18640 repository_name_or_id: repository_name_or_id.into(),
18641 project: project.into(),
18642 include_links: None,
18643 }
18644 }
18645 #[doc = "Get a specific fork sync operation's details."]
18646 #[doc = ""]
18647 #[doc = "Arguments:"]
18648 #[doc = "* `organization`: The name of the Azure DevOps organization."]
18649 #[doc = "* `repository_name_or_id`: The name or ID of the repository."]
18650 #[doc = "* `fork_sync_operation_id`: OperationId of the sync request."]
18651 #[doc = "* `project`: Project ID or project name"]
18652 pub fn get_fork_sync_request(
18653 &self,
18654 organization: impl Into<String>,
18655 repository_name_or_id: impl Into<String>,
18656 fork_sync_operation_id: i32,
18657 project: impl Into<String>,
18658 ) -> get_fork_sync_request::RequestBuilder {
18659 get_fork_sync_request::RequestBuilder {
18660 client: self.0.clone(),
18661 organization: organization.into(),
18662 repository_name_or_id: repository_name_or_id.into(),
18663 fork_sync_operation_id,
18664 project: project.into(),
18665 include_links: None,
18666 }
18667 }
18668 }
18669 pub mod list {
18670 use super::models;
18671 #[cfg(not(target_arch = "wasm32"))]
18672 use futures::future::BoxFuture;
18673 #[cfg(target_arch = "wasm32")]
18674 use futures::future::LocalBoxFuture as BoxFuture;
18675 #[derive(Debug)]
18676 pub struct Response(azure_core::http::Response);
18677 impl Response {
18678 pub async fn into_raw_body(self) -> azure_core::Result<models::GitRepositoryRefList> {
18679 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
18680 let body: models::GitRepositoryRefList =
18681 serde_json::from_slice(&bytes).map_err(|e| {
18682 azure_core::error::Error::full(
18683 azure_core::error::ErrorKind::DataConversion,
18684 e,
18685 format!(
18686 "Failed to deserialize response:\n{}",
18687 String::from_utf8_lossy(&bytes)
18688 ),
18689 )
18690 })?;
18691 Ok(body)
18692 }
18693 pub fn into_raw_response(self) -> azure_core::http::Response {
18694 self.0
18695 }
18696 pub fn as_raw_response(&self) -> &azure_core::http::Response {
18697 &self.0
18698 }
18699 }
18700 impl From<Response> for azure_core::http::Response {
18701 fn from(rsp: Response) -> Self {
18702 rsp.into_raw_response()
18703 }
18704 }
18705 impl AsRef<azure_core::http::Response> for Response {
18706 fn as_ref(&self) -> &azure_core::http::Response {
18707 self.as_raw_response()
18708 }
18709 }
18710 #[derive(Clone)]
18711 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
18712 #[doc = r""]
18713 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
18714 #[doc = r" parameters can be chained."]
18715 #[doc = r""]
18716 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
18717 #[doc = r" converts the [`RequestBuilder`] into a future,"]
18718 #[doc = r" executes the request and returns a `Result` with the parsed"]
18719 #[doc = r" response."]
18720 #[doc = r""]
18721 #[doc = r" If you need lower-level access to the raw response details"]
18722 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
18723 #[doc = r" can finalize the request using the"]
18724 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
18725 #[doc = r" that resolves to a lower-level [`Response`] value."]
18726 pub struct RequestBuilder {
18727 pub(crate) client: super::super::Client,
18728 pub(crate) organization: String,
18729 pub(crate) repository_name_or_id: String,
18730 pub(crate) collection_id: String,
18731 pub(crate) project: String,
18732 pub(crate) include_links: Option<bool>,
18733 }
18734 impl RequestBuilder {
18735 #[doc = "Set to true to include links."]
18736 pub fn include_links(mut self, include_links: bool) -> Self {
18737 self.include_links = Some(include_links);
18738 self
18739 }
18740 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
18741 #[doc = ""]
18742 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
18743 #[doc = "However, this function can provide more flexibility when required."]
18744 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
18745 Box::pin({
18746 let this = self.clone();
18747 async move {
18748 let url = this.url()?;
18749 let mut req =
18750 azure_core::http::Request::new(url, azure_core::http::Method::Get);
18751 if let Some(auth_header) = this
18752 .client
18753 .token_credential()
18754 .http_authorization_header(&this.client.scopes())
18755 .await?
18756 {
18757 req.insert_header(
18758 azure_core::http::headers::AUTHORIZATION,
18759 auth_header,
18760 );
18761 }
18762 if let Some(include_links) = &this.include_links {
18763 req.url_mut()
18764 .query_pairs_mut()
18765 .append_pair("includeLinks", &include_links.to_string());
18766 }
18767 let req_body = azure_core::Bytes::new();
18768 req.set_body(req_body);
18769 Ok(Response(this.client.send(&mut req).await?))
18770 }
18771 })
18772 }
18773 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
18774 let mut url = azure_core::http::Url::parse(&format!(
18775 "{}/{}/{}/_apis/git/repositories/{}/forks/{}",
18776 self.client.endpoint(),
18777 &self.organization,
18778 &self.project,
18779 &self.repository_name_or_id,
18780 &self.collection_id
18781 ))?;
18782 let has_api_version_already = url
18783 .query_pairs()
18784 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
18785 if !has_api_version_already {
18786 url.query_pairs_mut().append_pair(
18787 azure_core::http::headers::query_param::API_VERSION,
18788 "7.1-preview",
18789 );
18790 }
18791 Ok(url)
18792 }
18793 }
18794 impl std::future::IntoFuture for RequestBuilder {
18795 type Output = azure_core::Result<models::GitRepositoryRefList>;
18796 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitRepositoryRefList>>;
18797 #[doc = "Returns a future that sends the request and returns the parsed response body."]
18798 #[doc = ""]
18799 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
18800 #[doc = ""]
18801 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
18802 fn into_future(self) -> Self::IntoFuture {
18803 Box::pin(async move { self.send().await?.into_raw_body().await })
18804 }
18805 }
18806 }
18807 pub mod get_fork_sync_requests {
18808 use super::models;
18809 #[cfg(not(target_arch = "wasm32"))]
18810 use futures::future::BoxFuture;
18811 #[cfg(target_arch = "wasm32")]
18812 use futures::future::LocalBoxFuture as BoxFuture;
18813 #[derive(Debug)]
18814 pub struct Response(azure_core::http::Response);
18815 impl Response {
18816 pub async fn into_raw_body(self) -> azure_core::Result<models::GitForkSyncRequestList> {
18817 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
18818 let body: models::GitForkSyncRequestList =
18819 serde_json::from_slice(&bytes).map_err(|e| {
18820 azure_core::error::Error::full(
18821 azure_core::error::ErrorKind::DataConversion,
18822 e,
18823 format!(
18824 "Failed to deserialize response:\n{}",
18825 String::from_utf8_lossy(&bytes)
18826 ),
18827 )
18828 })?;
18829 Ok(body)
18830 }
18831 pub fn into_raw_response(self) -> azure_core::http::Response {
18832 self.0
18833 }
18834 pub fn as_raw_response(&self) -> &azure_core::http::Response {
18835 &self.0
18836 }
18837 }
18838 impl From<Response> for azure_core::http::Response {
18839 fn from(rsp: Response) -> Self {
18840 rsp.into_raw_response()
18841 }
18842 }
18843 impl AsRef<azure_core::http::Response> for Response {
18844 fn as_ref(&self) -> &azure_core::http::Response {
18845 self.as_raw_response()
18846 }
18847 }
18848 #[derive(Clone)]
18849 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
18850 #[doc = r""]
18851 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
18852 #[doc = r" parameters can be chained."]
18853 #[doc = r""]
18854 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
18855 #[doc = r" converts the [`RequestBuilder`] into a future,"]
18856 #[doc = r" executes the request and returns a `Result` with the parsed"]
18857 #[doc = r" response."]
18858 #[doc = r""]
18859 #[doc = r" If you need lower-level access to the raw response details"]
18860 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
18861 #[doc = r" can finalize the request using the"]
18862 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
18863 #[doc = r" that resolves to a lower-level [`Response`] value."]
18864 pub struct RequestBuilder {
18865 pub(crate) client: super::super::Client,
18866 pub(crate) organization: String,
18867 pub(crate) repository_name_or_id: String,
18868 pub(crate) project: String,
18869 pub(crate) include_abandoned: Option<bool>,
18870 pub(crate) include_links: Option<bool>,
18871 }
18872 impl RequestBuilder {
18873 #[doc = "Set to true to include abandoned requests."]
18874 pub fn include_abandoned(mut self, include_abandoned: bool) -> Self {
18875 self.include_abandoned = Some(include_abandoned);
18876 self
18877 }
18878 #[doc = "Set to true to include links."]
18879 pub fn include_links(mut self, include_links: bool) -> Self {
18880 self.include_links = Some(include_links);
18881 self
18882 }
18883 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
18884 #[doc = ""]
18885 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
18886 #[doc = "However, this function can provide more flexibility when required."]
18887 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
18888 Box::pin({
18889 let this = self.clone();
18890 async move {
18891 let url = this.url()?;
18892 let mut req =
18893 azure_core::http::Request::new(url, azure_core::http::Method::Get);
18894 if let Some(auth_header) = this
18895 .client
18896 .token_credential()
18897 .http_authorization_header(&this.client.scopes())
18898 .await?
18899 {
18900 req.insert_header(
18901 azure_core::http::headers::AUTHORIZATION,
18902 auth_header,
18903 );
18904 }
18905 if let Some(include_abandoned) = &this.include_abandoned {
18906 req.url_mut()
18907 .query_pairs_mut()
18908 .append_pair("includeAbandoned", &include_abandoned.to_string());
18909 }
18910 if let Some(include_links) = &this.include_links {
18911 req.url_mut()
18912 .query_pairs_mut()
18913 .append_pair("includeLinks", &include_links.to_string());
18914 }
18915 let req_body = azure_core::Bytes::new();
18916 req.set_body(req_body);
18917 Ok(Response(this.client.send(&mut req).await?))
18918 }
18919 })
18920 }
18921 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
18922 let mut url = azure_core::http::Url::parse(&format!(
18923 "{}/{}/{}/_apis/git/repositories/{}/forkSyncRequests",
18924 self.client.endpoint(),
18925 &self.organization,
18926 &self.project,
18927 &self.repository_name_or_id
18928 ))?;
18929 let has_api_version_already = url
18930 .query_pairs()
18931 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
18932 if !has_api_version_already {
18933 url.query_pairs_mut().append_pair(
18934 azure_core::http::headers::query_param::API_VERSION,
18935 "7.1-preview",
18936 );
18937 }
18938 Ok(url)
18939 }
18940 }
18941 impl std::future::IntoFuture for RequestBuilder {
18942 type Output = azure_core::Result<models::GitForkSyncRequestList>;
18943 type IntoFuture =
18944 BoxFuture<'static, azure_core::Result<models::GitForkSyncRequestList>>;
18945 #[doc = "Returns a future that sends the request and returns the parsed response body."]
18946 #[doc = ""]
18947 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
18948 #[doc = ""]
18949 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
18950 fn into_future(self) -> Self::IntoFuture {
18951 Box::pin(async move { self.send().await?.into_raw_body().await })
18952 }
18953 }
18954 }
18955 pub mod create_fork_sync_request {
18956 use super::models;
18957 #[cfg(not(target_arch = "wasm32"))]
18958 use futures::future::BoxFuture;
18959 #[cfg(target_arch = "wasm32")]
18960 use futures::future::LocalBoxFuture as BoxFuture;
18961 #[derive(Debug)]
18962 pub struct Response(azure_core::http::Response);
18963 impl Response {
18964 pub async fn into_raw_body(self) -> azure_core::Result<models::GitForkSyncRequest> {
18965 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
18966 let body: models::GitForkSyncRequest =
18967 serde_json::from_slice(&bytes).map_err(|e| {
18968 azure_core::error::Error::full(
18969 azure_core::error::ErrorKind::DataConversion,
18970 e,
18971 format!(
18972 "Failed to deserialize response:\n{}",
18973 String::from_utf8_lossy(&bytes)
18974 ),
18975 )
18976 })?;
18977 Ok(body)
18978 }
18979 pub fn into_raw_response(self) -> azure_core::http::Response {
18980 self.0
18981 }
18982 pub fn as_raw_response(&self) -> &azure_core::http::Response {
18983 &self.0
18984 }
18985 }
18986 impl From<Response> for azure_core::http::Response {
18987 fn from(rsp: Response) -> Self {
18988 rsp.into_raw_response()
18989 }
18990 }
18991 impl AsRef<azure_core::http::Response> for Response {
18992 fn as_ref(&self) -> &azure_core::http::Response {
18993 self.as_raw_response()
18994 }
18995 }
18996 #[derive(Clone)]
18997 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
18998 #[doc = r""]
18999 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
19000 #[doc = r" parameters can be chained."]
19001 #[doc = r""]
19002 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
19003 #[doc = r" converts the [`RequestBuilder`] into a future,"]
19004 #[doc = r" executes the request and returns a `Result` with the parsed"]
19005 #[doc = r" response."]
19006 #[doc = r""]
19007 #[doc = r" If you need lower-level access to the raw response details"]
19008 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
19009 #[doc = r" can finalize the request using the"]
19010 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
19011 #[doc = r" that resolves to a lower-level [`Response`] value."]
19012 pub struct RequestBuilder {
19013 pub(crate) client: super::super::Client,
19014 pub(crate) organization: String,
19015 pub(crate) body: models::GitForkSyncRequestParameters,
19016 pub(crate) repository_name_or_id: String,
19017 pub(crate) project: String,
19018 pub(crate) include_links: Option<bool>,
19019 }
19020 impl RequestBuilder {
19021 #[doc = "Set to true to include links"]
19022 pub fn include_links(mut self, include_links: bool) -> Self {
19023 self.include_links = Some(include_links);
19024 self
19025 }
19026 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
19027 #[doc = ""]
19028 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
19029 #[doc = "However, this function can provide more flexibility when required."]
19030 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
19031 Box::pin({
19032 let this = self.clone();
19033 async move {
19034 let url = this.url()?;
19035 let mut req =
19036 azure_core::http::Request::new(url, azure_core::http::Method::Post);
19037 if let Some(auth_header) = this
19038 .client
19039 .token_credential()
19040 .http_authorization_header(&this.client.scopes())
19041 .await?
19042 {
19043 req.insert_header(
19044 azure_core::http::headers::AUTHORIZATION,
19045 auth_header,
19046 );
19047 }
19048 req.insert_header("content-type", "application/json");
19049 let req_body = azure_core::json::to_json(&this.body)?;
19050 if let Some(include_links) = &this.include_links {
19051 req.url_mut()
19052 .query_pairs_mut()
19053 .append_pair("includeLinks", &include_links.to_string());
19054 }
19055 req.set_body(req_body);
19056 Ok(Response(this.client.send(&mut req).await?))
19057 }
19058 })
19059 }
19060 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
19061 let mut url = azure_core::http::Url::parse(&format!(
19062 "{}/{}/{}/_apis/git/repositories/{}/forkSyncRequests",
19063 self.client.endpoint(),
19064 &self.organization,
19065 &self.project,
19066 &self.repository_name_or_id
19067 ))?;
19068 let has_api_version_already = url
19069 .query_pairs()
19070 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
19071 if !has_api_version_already {
19072 url.query_pairs_mut().append_pair(
19073 azure_core::http::headers::query_param::API_VERSION,
19074 "7.1-preview",
19075 );
19076 }
19077 Ok(url)
19078 }
19079 }
19080 impl std::future::IntoFuture for RequestBuilder {
19081 type Output = azure_core::Result<models::GitForkSyncRequest>;
19082 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitForkSyncRequest>>;
19083 #[doc = "Returns a future that sends the request and returns the parsed response body."]
19084 #[doc = ""]
19085 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
19086 #[doc = ""]
19087 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
19088 fn into_future(self) -> Self::IntoFuture {
19089 Box::pin(async move { self.send().await?.into_raw_body().await })
19090 }
19091 }
19092 }
19093 pub mod get_fork_sync_request {
19094 use super::models;
19095 #[cfg(not(target_arch = "wasm32"))]
19096 use futures::future::BoxFuture;
19097 #[cfg(target_arch = "wasm32")]
19098 use futures::future::LocalBoxFuture as BoxFuture;
19099 #[derive(Debug)]
19100 pub struct Response(azure_core::http::Response);
19101 impl Response {
19102 pub async fn into_raw_body(self) -> azure_core::Result<models::GitForkSyncRequest> {
19103 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
19104 let body: models::GitForkSyncRequest =
19105 serde_json::from_slice(&bytes).map_err(|e| {
19106 azure_core::error::Error::full(
19107 azure_core::error::ErrorKind::DataConversion,
19108 e,
19109 format!(
19110 "Failed to deserialize response:\n{}",
19111 String::from_utf8_lossy(&bytes)
19112 ),
19113 )
19114 })?;
19115 Ok(body)
19116 }
19117 pub fn into_raw_response(self) -> azure_core::http::Response {
19118 self.0
19119 }
19120 pub fn as_raw_response(&self) -> &azure_core::http::Response {
19121 &self.0
19122 }
19123 }
19124 impl From<Response> for azure_core::http::Response {
19125 fn from(rsp: Response) -> Self {
19126 rsp.into_raw_response()
19127 }
19128 }
19129 impl AsRef<azure_core::http::Response> for Response {
19130 fn as_ref(&self) -> &azure_core::http::Response {
19131 self.as_raw_response()
19132 }
19133 }
19134 #[derive(Clone)]
19135 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
19136 #[doc = r""]
19137 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
19138 #[doc = r" parameters can be chained."]
19139 #[doc = r""]
19140 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
19141 #[doc = r" converts the [`RequestBuilder`] into a future,"]
19142 #[doc = r" executes the request and returns a `Result` with the parsed"]
19143 #[doc = r" response."]
19144 #[doc = r""]
19145 #[doc = r" If you need lower-level access to the raw response details"]
19146 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
19147 #[doc = r" can finalize the request using the"]
19148 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
19149 #[doc = r" that resolves to a lower-level [`Response`] value."]
19150 pub struct RequestBuilder {
19151 pub(crate) client: super::super::Client,
19152 pub(crate) organization: String,
19153 pub(crate) repository_name_or_id: String,
19154 pub(crate) fork_sync_operation_id: i32,
19155 pub(crate) project: String,
19156 pub(crate) include_links: Option<bool>,
19157 }
19158 impl RequestBuilder {
19159 #[doc = "Set to true to include links."]
19160 pub fn include_links(mut self, include_links: bool) -> Self {
19161 self.include_links = Some(include_links);
19162 self
19163 }
19164 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
19165 #[doc = ""]
19166 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
19167 #[doc = "However, this function can provide more flexibility when required."]
19168 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
19169 Box::pin({
19170 let this = self.clone();
19171 async move {
19172 let url = this.url()?;
19173 let mut req =
19174 azure_core::http::Request::new(url, azure_core::http::Method::Get);
19175 if let Some(auth_header) = this
19176 .client
19177 .token_credential()
19178 .http_authorization_header(&this.client.scopes())
19179 .await?
19180 {
19181 req.insert_header(
19182 azure_core::http::headers::AUTHORIZATION,
19183 auth_header,
19184 );
19185 }
19186 if let Some(include_links) = &this.include_links {
19187 req.url_mut()
19188 .query_pairs_mut()
19189 .append_pair("includeLinks", &include_links.to_string());
19190 }
19191 let req_body = azure_core::Bytes::new();
19192 req.set_body(req_body);
19193 Ok(Response(this.client.send(&mut req).await?))
19194 }
19195 })
19196 }
19197 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
19198 let mut url = azure_core::http::Url::parse(&format!(
19199 "{}/{}/{}/_apis/git/repositories/{}/forkSyncRequests/{}",
19200 self.client.endpoint(),
19201 &self.organization,
19202 &self.project,
19203 &self.repository_name_or_id,
19204 &self.fork_sync_operation_id
19205 ))?;
19206 let has_api_version_already = url
19207 .query_pairs()
19208 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
19209 if !has_api_version_already {
19210 url.query_pairs_mut().append_pair(
19211 azure_core::http::headers::query_param::API_VERSION,
19212 "7.1-preview",
19213 );
19214 }
19215 Ok(url)
19216 }
19217 }
19218 impl std::future::IntoFuture for RequestBuilder {
19219 type Output = azure_core::Result<models::GitForkSyncRequest>;
19220 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitForkSyncRequest>>;
19221 #[doc = "Returns a future that sends the request and returns the parsed response body."]
19222 #[doc = ""]
19223 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
19224 #[doc = ""]
19225 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
19226 fn into_future(self) -> Self::IntoFuture {
19227 Box::pin(async move { self.send().await?.into_raw_body().await })
19228 }
19229 }
19230 }
19231}
19232pub mod merges {
19233 use super::models;
19234 #[cfg(not(target_arch = "wasm32"))]
19235 use futures::future::BoxFuture;
19236 #[cfg(target_arch = "wasm32")]
19237 use futures::future::LocalBoxFuture as BoxFuture;
19238 pub struct Client(pub(crate) super::Client);
19239 impl Client {
19240 #[doc = "Request a git merge operation. Currently we support merging only 2 commits."]
19241 #[doc = ""]
19242 #[doc = "Arguments:"]
19243 #[doc = "* `organization`: The name of the Azure DevOps organization."]
19244 #[doc = "* `body`: Parents commitIds and merge commit messsage."]
19245 #[doc = "* `project`: Project ID or project name"]
19246 #[doc = "* `repository_name_or_id`: The name or ID of the repository."]
19247 pub fn create(
19248 &self,
19249 organization: impl Into<String>,
19250 body: impl Into<models::GitMergeParameters>,
19251 project: impl Into<String>,
19252 repository_name_or_id: impl Into<String>,
19253 ) -> create::RequestBuilder {
19254 create::RequestBuilder {
19255 client: self.0.clone(),
19256 organization: organization.into(),
19257 body: body.into(),
19258 project: project.into(),
19259 repository_name_or_id: repository_name_or_id.into(),
19260 include_links: None,
19261 }
19262 }
19263 #[doc = "Get a specific merge operation's details."]
19264 #[doc = ""]
19265 #[doc = "Arguments:"]
19266 #[doc = "* `organization`: The name of the Azure DevOps organization."]
19267 #[doc = "* `project`: Project ID or project name"]
19268 #[doc = "* `repository_name_or_id`: The name or ID of the repository."]
19269 #[doc = "* `merge_operation_id`: OperationId of the merge request."]
19270 pub fn get(
19271 &self,
19272 organization: impl Into<String>,
19273 project: impl Into<String>,
19274 repository_name_or_id: impl Into<String>,
19275 merge_operation_id: i32,
19276 ) -> get::RequestBuilder {
19277 get::RequestBuilder {
19278 client: self.0.clone(),
19279 organization: organization.into(),
19280 project: project.into(),
19281 repository_name_or_id: repository_name_or_id.into(),
19282 merge_operation_id,
19283 include_links: None,
19284 }
19285 }
19286 }
19287 pub mod create {
19288 use super::models;
19289 #[cfg(not(target_arch = "wasm32"))]
19290 use futures::future::BoxFuture;
19291 #[cfg(target_arch = "wasm32")]
19292 use futures::future::LocalBoxFuture as BoxFuture;
19293 #[derive(Debug)]
19294 pub struct Response(azure_core::http::Response);
19295 impl Response {
19296 pub async fn into_raw_body(self) -> azure_core::Result<models::GitMerge> {
19297 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
19298 let body: models::GitMerge = serde_json::from_slice(&bytes).map_err(|e| {
19299 azure_core::error::Error::full(
19300 azure_core::error::ErrorKind::DataConversion,
19301 e,
19302 format!(
19303 "Failed to deserialize response:\n{}",
19304 String::from_utf8_lossy(&bytes)
19305 ),
19306 )
19307 })?;
19308 Ok(body)
19309 }
19310 pub fn into_raw_response(self) -> azure_core::http::Response {
19311 self.0
19312 }
19313 pub fn as_raw_response(&self) -> &azure_core::http::Response {
19314 &self.0
19315 }
19316 }
19317 impl From<Response> for azure_core::http::Response {
19318 fn from(rsp: Response) -> Self {
19319 rsp.into_raw_response()
19320 }
19321 }
19322 impl AsRef<azure_core::http::Response> for Response {
19323 fn as_ref(&self) -> &azure_core::http::Response {
19324 self.as_raw_response()
19325 }
19326 }
19327 #[derive(Clone)]
19328 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
19329 #[doc = r""]
19330 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
19331 #[doc = r" parameters can be chained."]
19332 #[doc = r""]
19333 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
19334 #[doc = r" converts the [`RequestBuilder`] into a future,"]
19335 #[doc = r" executes the request and returns a `Result` with the parsed"]
19336 #[doc = r" response."]
19337 #[doc = r""]
19338 #[doc = r" If you need lower-level access to the raw response details"]
19339 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
19340 #[doc = r" can finalize the request using the"]
19341 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
19342 #[doc = r" that resolves to a lower-level [`Response`] value."]
19343 pub struct RequestBuilder {
19344 pub(crate) client: super::super::Client,
19345 pub(crate) organization: String,
19346 pub(crate) body: models::GitMergeParameters,
19347 pub(crate) project: String,
19348 pub(crate) repository_name_or_id: String,
19349 pub(crate) include_links: Option<bool>,
19350 }
19351 impl RequestBuilder {
19352 #[doc = "Set to true to include links"]
19353 pub fn include_links(mut self, include_links: bool) -> Self {
19354 self.include_links = Some(include_links);
19355 self
19356 }
19357 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
19358 #[doc = ""]
19359 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
19360 #[doc = "However, this function can provide more flexibility when required."]
19361 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
19362 Box::pin({
19363 let this = self.clone();
19364 async move {
19365 let url = this.url()?;
19366 let mut req =
19367 azure_core::http::Request::new(url, azure_core::http::Method::Post);
19368 if let Some(auth_header) = this
19369 .client
19370 .token_credential()
19371 .http_authorization_header(&this.client.scopes())
19372 .await?
19373 {
19374 req.insert_header(
19375 azure_core::http::headers::AUTHORIZATION,
19376 auth_header,
19377 );
19378 }
19379 req.insert_header("content-type", "application/json");
19380 let req_body = azure_core::json::to_json(&this.body)?;
19381 if let Some(include_links) = &this.include_links {
19382 req.url_mut()
19383 .query_pairs_mut()
19384 .append_pair("includeLinks", &include_links.to_string());
19385 }
19386 req.set_body(req_body);
19387 Ok(Response(this.client.send(&mut req).await?))
19388 }
19389 })
19390 }
19391 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
19392 let mut url = azure_core::http::Url::parse(&format!(
19393 "{}/{}/{}/_apis/git/repositories/{}/merges",
19394 self.client.endpoint(),
19395 &self.organization,
19396 &self.project,
19397 &self.repository_name_or_id
19398 ))?;
19399 let has_api_version_already = url
19400 .query_pairs()
19401 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
19402 if !has_api_version_already {
19403 url.query_pairs_mut().append_pair(
19404 azure_core::http::headers::query_param::API_VERSION,
19405 "7.1-preview",
19406 );
19407 }
19408 Ok(url)
19409 }
19410 }
19411 impl std::future::IntoFuture for RequestBuilder {
19412 type Output = azure_core::Result<models::GitMerge>;
19413 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitMerge>>;
19414 #[doc = "Returns a future that sends the request and returns the parsed response body."]
19415 #[doc = ""]
19416 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
19417 #[doc = ""]
19418 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
19419 fn into_future(self) -> Self::IntoFuture {
19420 Box::pin(async move { self.send().await?.into_raw_body().await })
19421 }
19422 }
19423 }
19424 pub mod get {
19425 use super::models;
19426 #[cfg(not(target_arch = "wasm32"))]
19427 use futures::future::BoxFuture;
19428 #[cfg(target_arch = "wasm32")]
19429 use futures::future::LocalBoxFuture as BoxFuture;
19430 #[derive(Debug)]
19431 pub struct Response(azure_core::http::Response);
19432 impl Response {
19433 pub async fn into_raw_body(self) -> azure_core::Result<models::GitMerge> {
19434 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
19435 let body: models::GitMerge = serde_json::from_slice(&bytes).map_err(|e| {
19436 azure_core::error::Error::full(
19437 azure_core::error::ErrorKind::DataConversion,
19438 e,
19439 format!(
19440 "Failed to deserialize response:\n{}",
19441 String::from_utf8_lossy(&bytes)
19442 ),
19443 )
19444 })?;
19445 Ok(body)
19446 }
19447 pub fn into_raw_response(self) -> azure_core::http::Response {
19448 self.0
19449 }
19450 pub fn as_raw_response(&self) -> &azure_core::http::Response {
19451 &self.0
19452 }
19453 }
19454 impl From<Response> for azure_core::http::Response {
19455 fn from(rsp: Response) -> Self {
19456 rsp.into_raw_response()
19457 }
19458 }
19459 impl AsRef<azure_core::http::Response> for Response {
19460 fn as_ref(&self) -> &azure_core::http::Response {
19461 self.as_raw_response()
19462 }
19463 }
19464 #[derive(Clone)]
19465 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
19466 #[doc = r""]
19467 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
19468 #[doc = r" parameters can be chained."]
19469 #[doc = r""]
19470 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
19471 #[doc = r" converts the [`RequestBuilder`] into a future,"]
19472 #[doc = r" executes the request and returns a `Result` with the parsed"]
19473 #[doc = r" response."]
19474 #[doc = r""]
19475 #[doc = r" If you need lower-level access to the raw response details"]
19476 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
19477 #[doc = r" can finalize the request using the"]
19478 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
19479 #[doc = r" that resolves to a lower-level [`Response`] value."]
19480 pub struct RequestBuilder {
19481 pub(crate) client: super::super::Client,
19482 pub(crate) organization: String,
19483 pub(crate) project: String,
19484 pub(crate) repository_name_or_id: String,
19485 pub(crate) merge_operation_id: i32,
19486 pub(crate) include_links: Option<bool>,
19487 }
19488 impl RequestBuilder {
19489 #[doc = "Set to true to include links"]
19490 pub fn include_links(mut self, include_links: bool) -> Self {
19491 self.include_links = Some(include_links);
19492 self
19493 }
19494 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
19495 #[doc = ""]
19496 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
19497 #[doc = "However, this function can provide more flexibility when required."]
19498 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
19499 Box::pin({
19500 let this = self.clone();
19501 async move {
19502 let url = this.url()?;
19503 let mut req =
19504 azure_core::http::Request::new(url, azure_core::http::Method::Get);
19505 if let Some(auth_header) = this
19506 .client
19507 .token_credential()
19508 .http_authorization_header(&this.client.scopes())
19509 .await?
19510 {
19511 req.insert_header(
19512 azure_core::http::headers::AUTHORIZATION,
19513 auth_header,
19514 );
19515 }
19516 if let Some(include_links) = &this.include_links {
19517 req.url_mut()
19518 .query_pairs_mut()
19519 .append_pair("includeLinks", &include_links.to_string());
19520 }
19521 let req_body = azure_core::Bytes::new();
19522 req.set_body(req_body);
19523 Ok(Response(this.client.send(&mut req).await?))
19524 }
19525 })
19526 }
19527 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
19528 let mut url = azure_core::http::Url::parse(&format!(
19529 "{}/{}/{}/_apis/git/repositories/{}/merges/{}",
19530 self.client.endpoint(),
19531 &self.organization,
19532 &self.project,
19533 &self.repository_name_or_id,
19534 &self.merge_operation_id
19535 ))?;
19536 let has_api_version_already = url
19537 .query_pairs()
19538 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
19539 if !has_api_version_already {
19540 url.query_pairs_mut().append_pair(
19541 azure_core::http::headers::query_param::API_VERSION,
19542 "7.1-preview",
19543 );
19544 }
19545 Ok(url)
19546 }
19547 }
19548 impl std::future::IntoFuture for RequestBuilder {
19549 type Output = azure_core::Result<models::GitMerge>;
19550 type IntoFuture = BoxFuture<'static, azure_core::Result<models::GitMerge>>;
19551 #[doc = "Returns a future that sends the request and returns the parsed response body."]
19552 #[doc = ""]
19553 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
19554 #[doc = ""]
19555 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
19556 fn into_future(self) -> Self::IntoFuture {
19557 Box::pin(async move { self.send().await?.into_raw_body().await })
19558 }
19559 }
19560 }
19561}