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://almsearch.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 code_search_results_client(&self) -> code_search_results::Client {
133 code_search_results::Client(self.clone())
134 }
135 pub fn package_search_results_client(&self) -> package_search_results::Client {
136 package_search_results::Client(self.clone())
137 }
138 pub fn repositories_client(&self) -> repositories::Client {
139 repositories::Client(self.clone())
140 }
141 pub fn tfvc_client(&self) -> tfvc::Client {
142 tfvc::Client(self.clone())
143 }
144 pub fn wiki_search_results_client(&self) -> wiki_search_results::Client {
145 wiki_search_results::Client(self.clone())
146 }
147 pub fn work_item_search_results_client(&self) -> work_item_search_results::Client {
148 work_item_search_results::Client(self.clone())
149 }
150}
151pub mod package_search_results {
152 use super::models;
153 #[cfg(not(target_arch = "wasm32"))]
154 use futures::future::BoxFuture;
155 #[cfg(target_arch = "wasm32")]
156 use futures::future::LocalBoxFuture as BoxFuture;
157 pub struct Client(pub(crate) super::Client);
158 impl Client {
159 #[doc = "Provides a set of results for the search text."]
160 #[doc = ""]
161 #[doc = "Arguments:"]
162 #[doc = "* `organization`: The name of the Azure DevOps organization."]
163 #[doc = "* `body`: The Package Search Request."]
164 pub fn fetch_package_search_results(
165 &self,
166 organization: impl Into<String>,
167 body: impl Into<models::PackageSearchRequest>,
168 ) -> fetch_package_search_results::RequestBuilder {
169 fetch_package_search_results::RequestBuilder {
170 client: self.0.clone(),
171 organization: organization.into(),
172 body: body.into(),
173 }
174 }
175 }
176 pub mod fetch_package_search_results {
177 use super::models;
178 #[cfg(not(target_arch = "wasm32"))]
179 use futures::future::BoxFuture;
180 #[cfg(target_arch = "wasm32")]
181 use futures::future::LocalBoxFuture as BoxFuture;
182 #[derive(Debug)]
183 pub struct Response(azure_core::http::Response);
184 impl Response {
185 pub async fn into_raw_body(
186 self,
187 ) -> azure_core::Result<models::PackageSearchResponseContent> {
188 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
189 let body: models::PackageSearchResponseContent = serde_json::from_slice(&bytes)
190 .map_err(|e| {
191 azure_core::error::Error::full(
192 azure_core::error::ErrorKind::DataConversion,
193 e,
194 format!(
195 "Failed to deserialize response:\n{}",
196 String::from_utf8_lossy(&bytes)
197 ),
198 )
199 })?;
200 Ok(body)
201 }
202 pub fn into_raw_response(self) -> azure_core::http::Response {
203 self.0
204 }
205 pub fn as_raw_response(&self) -> &azure_core::http::Response {
206 &self.0
207 }
208 pub fn headers(&self) -> Headers {
209 Headers(self.0.headers())
210 }
211 }
212 impl From<Response> for azure_core::http::Response {
213 fn from(rsp: Response) -> Self {
214 rsp.into_raw_response()
215 }
216 }
217 impl AsRef<azure_core::http::Response> for Response {
218 fn as_ref(&self) -> &azure_core::http::Response {
219 self.as_raw_response()
220 }
221 }
222 pub struct Headers<'a>(&'a azure_core::http::headers::Headers);
223 impl Headers<'_> {
224 pub fn activity_id(&self) -> azure_core::Result<&str> {
225 self.0
226 .get_str(&azure_core::http::headers::HeaderName::from_static(
227 "activityid",
228 ))
229 }
230 }
231 #[derive(Clone)]
232 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
233 #[doc = r""]
234 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
235 #[doc = r" parameters can be chained."]
236 #[doc = r""]
237 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
238 #[doc = r" converts the [`RequestBuilder`] into a future,"]
239 #[doc = r" executes the request and returns a `Result` with the parsed"]
240 #[doc = r" response."]
241 #[doc = r""]
242 #[doc = r" If you need lower-level access to the raw response details"]
243 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
244 #[doc = r" can finalize the request using the"]
245 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
246 #[doc = r" that resolves to a lower-level [`Response`] value."]
247 pub struct RequestBuilder {
248 pub(crate) client: super::super::Client,
249 pub(crate) organization: String,
250 pub(crate) body: models::PackageSearchRequest,
251 }
252 impl RequestBuilder {
253 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
254 #[doc = ""]
255 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
256 #[doc = "However, this function can provide more flexibility when required."]
257 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
258 Box::pin({
259 let this = self.clone();
260 async move {
261 let url = this.url()?;
262 let mut req =
263 azure_core::http::Request::new(url, azure_core::http::Method::Post);
264 if let Some(auth_header) = this
265 .client
266 .token_credential()
267 .http_authorization_header(&this.client.scopes())
268 .await?
269 {
270 req.insert_header(
271 azure_core::http::headers::AUTHORIZATION,
272 auth_header,
273 );
274 }
275 req.insert_header("content-type", "application/json");
276 let req_body = azure_core::json::to_json(&this.body)?;
277 req.set_body(req_body);
278 Ok(Response(this.client.send(&mut req).await?))
279 }
280 })
281 }
282 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
283 let mut url = azure_core::http::Url::parse(&format!(
284 "{}/{}/_apis/search/packagesearchresults",
285 self.client.endpoint(),
286 &self.organization
287 ))?;
288 let has_api_version_already = url
289 .query_pairs()
290 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
291 if !has_api_version_already {
292 url.query_pairs_mut().append_pair(
293 azure_core::http::headers::query_param::API_VERSION,
294 "7.1-preview",
295 );
296 }
297 Ok(url)
298 }
299 }
300 impl std::future::IntoFuture for RequestBuilder {
301 type Output = azure_core::Result<models::PackageSearchResponseContent>;
302 type IntoFuture =
303 BoxFuture<'static, azure_core::Result<models::PackageSearchResponseContent>>;
304 #[doc = "Returns a future that sends the request and returns the parsed response body."]
305 #[doc = ""]
306 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
307 #[doc = ""]
308 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
309 fn into_future(self) -> Self::IntoFuture {
310 Box::pin(async move { self.send().await?.into_raw_body().await })
311 }
312 }
313 }
314}
315pub mod code_search_results {
316 use super::models;
317 #[cfg(not(target_arch = "wasm32"))]
318 use futures::future::BoxFuture;
319 #[cfg(target_arch = "wasm32")]
320 use futures::future::LocalBoxFuture as BoxFuture;
321 pub struct Client(pub(crate) super::Client);
322 impl Client {
323 #[doc = "Provides a set of results for the search text."]
324 #[doc = ""]
325 #[doc = "Arguments:"]
326 #[doc = "* `organization`: The name of the Azure DevOps organization."]
327 #[doc = "* `body`: The Code Search Request."]
328 #[doc = "* `project`: Project ID or project name"]
329 pub fn fetch_code_search_results(
330 &self,
331 organization: impl Into<String>,
332 body: impl Into<models::CodeSearchRequest>,
333 project: impl Into<String>,
334 ) -> fetch_code_search_results::RequestBuilder {
335 fetch_code_search_results::RequestBuilder {
336 client: self.0.clone(),
337 organization: organization.into(),
338 body: body.into(),
339 project: project.into(),
340 }
341 }
342 }
343 pub mod fetch_code_search_results {
344 use super::models;
345 #[cfg(not(target_arch = "wasm32"))]
346 use futures::future::BoxFuture;
347 #[cfg(target_arch = "wasm32")]
348 use futures::future::LocalBoxFuture as BoxFuture;
349 #[derive(Debug)]
350 pub struct Response(azure_core::http::Response);
351 impl Response {
352 pub async fn into_raw_body(self) -> azure_core::Result<models::CodeSearchResponse> {
353 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
354 let body: models::CodeSearchResponse =
355 serde_json::from_slice(&bytes).map_err(|e| {
356 azure_core::error::Error::full(
357 azure_core::error::ErrorKind::DataConversion,
358 e,
359 format!(
360 "Failed to deserialize response:\n{}",
361 String::from_utf8_lossy(&bytes)
362 ),
363 )
364 })?;
365 Ok(body)
366 }
367 pub fn into_raw_response(self) -> azure_core::http::Response {
368 self.0
369 }
370 pub fn as_raw_response(&self) -> &azure_core::http::Response {
371 &self.0
372 }
373 }
374 impl From<Response> for azure_core::http::Response {
375 fn from(rsp: Response) -> Self {
376 rsp.into_raw_response()
377 }
378 }
379 impl AsRef<azure_core::http::Response> for Response {
380 fn as_ref(&self) -> &azure_core::http::Response {
381 self.as_raw_response()
382 }
383 }
384 #[derive(Clone)]
385 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
386 #[doc = r""]
387 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
388 #[doc = r" parameters can be chained."]
389 #[doc = r""]
390 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
391 #[doc = r" converts the [`RequestBuilder`] into a future,"]
392 #[doc = r" executes the request and returns a `Result` with the parsed"]
393 #[doc = r" response."]
394 #[doc = r""]
395 #[doc = r" If you need lower-level access to the raw response details"]
396 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
397 #[doc = r" can finalize the request using the"]
398 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
399 #[doc = r" that resolves to a lower-level [`Response`] value."]
400 pub struct RequestBuilder {
401 pub(crate) client: super::super::Client,
402 pub(crate) organization: String,
403 pub(crate) body: models::CodeSearchRequest,
404 pub(crate) project: String,
405 }
406 impl RequestBuilder {
407 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
408 #[doc = ""]
409 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
410 #[doc = "However, this function can provide more flexibility when required."]
411 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
412 Box::pin({
413 let this = self.clone();
414 async move {
415 let url = this.url()?;
416 let mut req =
417 azure_core::http::Request::new(url, azure_core::http::Method::Post);
418 if let Some(auth_header) = this
419 .client
420 .token_credential()
421 .http_authorization_header(&this.client.scopes())
422 .await?
423 {
424 req.insert_header(
425 azure_core::http::headers::AUTHORIZATION,
426 auth_header,
427 );
428 }
429 req.insert_header("content-type", "application/json");
430 let req_body = azure_core::json::to_json(&this.body)?;
431 req.set_body(req_body);
432 Ok(Response(this.client.send(&mut req).await?))
433 }
434 })
435 }
436 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
437 let mut url = azure_core::http::Url::parse(&format!(
438 "{}/{}/{}/_apis/search/codesearchresults",
439 self.client.endpoint(),
440 &self.organization,
441 &self.project
442 ))?;
443 let has_api_version_already = url
444 .query_pairs()
445 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
446 if !has_api_version_already {
447 url.query_pairs_mut().append_pair(
448 azure_core::http::headers::query_param::API_VERSION,
449 "7.1-preview",
450 );
451 }
452 Ok(url)
453 }
454 }
455 impl std::future::IntoFuture for RequestBuilder {
456 type Output = azure_core::Result<models::CodeSearchResponse>;
457 type IntoFuture = BoxFuture<'static, azure_core::Result<models::CodeSearchResponse>>;
458 #[doc = "Returns a future that sends the request and returns the parsed response body."]
459 #[doc = ""]
460 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
461 #[doc = ""]
462 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
463 fn into_future(self) -> Self::IntoFuture {
464 Box::pin(async move { self.send().await?.into_raw_body().await })
465 }
466 }
467 }
468}
469pub mod repositories {
470 use super::models;
471 #[cfg(not(target_arch = "wasm32"))]
472 use futures::future::BoxFuture;
473 #[cfg(target_arch = "wasm32")]
474 use futures::future::LocalBoxFuture as BoxFuture;
475 pub struct Client(pub(crate) super::Client);
476 impl Client {
477 #[doc = "Provides status of Repository."]
478 #[doc = ""]
479 #[doc = "Arguments:"]
480 #[doc = "* `organization`: The name of the Azure DevOps organization."]
481 #[doc = "* `project`: Project ID or project name"]
482 #[doc = "* `repository`: Repository ID or repository name."]
483 pub fn get(
484 &self,
485 organization: impl Into<String>,
486 project: impl Into<String>,
487 repository: impl Into<String>,
488 ) -> get::RequestBuilder {
489 get::RequestBuilder {
490 client: self.0.clone(),
491 organization: organization.into(),
492 project: project.into(),
493 repository: repository.into(),
494 }
495 }
496 }
497 pub mod get {
498 use super::models;
499 #[cfg(not(target_arch = "wasm32"))]
500 use futures::future::BoxFuture;
501 #[cfg(target_arch = "wasm32")]
502 use futures::future::LocalBoxFuture as BoxFuture;
503 #[derive(Debug)]
504 pub struct Response(azure_core::http::Response);
505 impl Response {
506 pub async fn into_raw_body(
507 self,
508 ) -> azure_core::Result<models::RepositoryStatusResponse> {
509 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
510 let body: models::RepositoryStatusResponse = serde_json::from_slice(&bytes)
511 .map_err(|e| {
512 azure_core::error::Error::full(
513 azure_core::error::ErrorKind::DataConversion,
514 e,
515 format!(
516 "Failed to deserialize response:\n{}",
517 String::from_utf8_lossy(&bytes)
518 ),
519 )
520 })?;
521 Ok(body)
522 }
523 pub fn into_raw_response(self) -> azure_core::http::Response {
524 self.0
525 }
526 pub fn as_raw_response(&self) -> &azure_core::http::Response {
527 &self.0
528 }
529 }
530 impl From<Response> for azure_core::http::Response {
531 fn from(rsp: Response) -> Self {
532 rsp.into_raw_response()
533 }
534 }
535 impl AsRef<azure_core::http::Response> for Response {
536 fn as_ref(&self) -> &azure_core::http::Response {
537 self.as_raw_response()
538 }
539 }
540 #[derive(Clone)]
541 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
542 #[doc = r""]
543 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
544 #[doc = r" parameters can be chained."]
545 #[doc = r""]
546 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
547 #[doc = r" converts the [`RequestBuilder`] into a future,"]
548 #[doc = r" executes the request and returns a `Result` with the parsed"]
549 #[doc = r" response."]
550 #[doc = r""]
551 #[doc = r" If you need lower-level access to the raw response details"]
552 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
553 #[doc = r" can finalize the request using the"]
554 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
555 #[doc = r" that resolves to a lower-level [`Response`] value."]
556 pub struct RequestBuilder {
557 pub(crate) client: super::super::Client,
558 pub(crate) organization: String,
559 pub(crate) project: String,
560 pub(crate) repository: String,
561 }
562 impl RequestBuilder {
563 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
564 #[doc = ""]
565 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
566 #[doc = "However, this function can provide more flexibility when required."]
567 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
568 Box::pin({
569 let this = self.clone();
570 async move {
571 let url = this.url()?;
572 let mut req =
573 azure_core::http::Request::new(url, azure_core::http::Method::Get);
574 if let Some(auth_header) = this
575 .client
576 .token_credential()
577 .http_authorization_header(&this.client.scopes())
578 .await?
579 {
580 req.insert_header(
581 azure_core::http::headers::AUTHORIZATION,
582 auth_header,
583 );
584 }
585 let req_body = azure_core::Bytes::new();
586 req.set_body(req_body);
587 Ok(Response(this.client.send(&mut req).await?))
588 }
589 })
590 }
591 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
592 let mut url = azure_core::http::Url::parse(&format!(
593 "{}/{}/{}/_apis/search/status/repositories/{}",
594 self.client.endpoint(),
595 &self.organization,
596 &self.project,
597 &self.repository
598 ))?;
599 let has_api_version_already = url
600 .query_pairs()
601 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
602 if !has_api_version_already {
603 url.query_pairs_mut().append_pair(
604 azure_core::http::headers::query_param::API_VERSION,
605 "7.1-preview",
606 );
607 }
608 Ok(url)
609 }
610 }
611 impl std::future::IntoFuture for RequestBuilder {
612 type Output = azure_core::Result<models::RepositoryStatusResponse>;
613 type IntoFuture =
614 BoxFuture<'static, azure_core::Result<models::RepositoryStatusResponse>>;
615 #[doc = "Returns a future that sends the request and returns the parsed response body."]
616 #[doc = ""]
617 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
618 #[doc = ""]
619 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
620 fn into_future(self) -> Self::IntoFuture {
621 Box::pin(async move { self.send().await?.into_raw_body().await })
622 }
623 }
624 }
625}
626pub mod tfvc {
627 use super::models;
628 #[cfg(not(target_arch = "wasm32"))]
629 use futures::future::BoxFuture;
630 #[cfg(target_arch = "wasm32")]
631 use futures::future::LocalBoxFuture as BoxFuture;
632 pub struct Client(pub(crate) super::Client);
633 impl Client {
634 #[doc = "Provides status of TFVC Repository."]
635 #[doc = ""]
636 #[doc = "Arguments:"]
637 #[doc = "* `organization`: The name of the Azure DevOps organization."]
638 #[doc = "* `project`: Project ID or project name"]
639 pub fn get(
640 &self,
641 organization: impl Into<String>,
642 project: impl Into<String>,
643 ) -> get::RequestBuilder {
644 get::RequestBuilder {
645 client: self.0.clone(),
646 organization: organization.into(),
647 project: project.into(),
648 }
649 }
650 }
651 pub mod get {
652 use super::models;
653 #[cfg(not(target_arch = "wasm32"))]
654 use futures::future::BoxFuture;
655 #[cfg(target_arch = "wasm32")]
656 use futures::future::LocalBoxFuture as BoxFuture;
657 #[derive(Debug)]
658 pub struct Response(azure_core::http::Response);
659 impl Response {
660 pub async fn into_raw_body(
661 self,
662 ) -> azure_core::Result<models::TfvcRepositoryStatusResponse> {
663 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
664 let body: models::TfvcRepositoryStatusResponse = serde_json::from_slice(&bytes)
665 .map_err(|e| {
666 azure_core::error::Error::full(
667 azure_core::error::ErrorKind::DataConversion,
668 e,
669 format!(
670 "Failed to deserialize response:\n{}",
671 String::from_utf8_lossy(&bytes)
672 ),
673 )
674 })?;
675 Ok(body)
676 }
677 pub fn into_raw_response(self) -> azure_core::http::Response {
678 self.0
679 }
680 pub fn as_raw_response(&self) -> &azure_core::http::Response {
681 &self.0
682 }
683 }
684 impl From<Response> for azure_core::http::Response {
685 fn from(rsp: Response) -> Self {
686 rsp.into_raw_response()
687 }
688 }
689 impl AsRef<azure_core::http::Response> for Response {
690 fn as_ref(&self) -> &azure_core::http::Response {
691 self.as_raw_response()
692 }
693 }
694 #[derive(Clone)]
695 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
696 #[doc = r""]
697 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
698 #[doc = r" parameters can be chained."]
699 #[doc = r""]
700 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
701 #[doc = r" converts the [`RequestBuilder`] into a future,"]
702 #[doc = r" executes the request and returns a `Result` with the parsed"]
703 #[doc = r" response."]
704 #[doc = r""]
705 #[doc = r" If you need lower-level access to the raw response details"]
706 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
707 #[doc = r" can finalize the request using the"]
708 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
709 #[doc = r" that resolves to a lower-level [`Response`] value."]
710 pub struct RequestBuilder {
711 pub(crate) client: super::super::Client,
712 pub(crate) organization: String,
713 pub(crate) project: String,
714 }
715 impl RequestBuilder {
716 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
717 #[doc = ""]
718 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
719 #[doc = "However, this function can provide more flexibility when required."]
720 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
721 Box::pin({
722 let this = self.clone();
723 async move {
724 let url = this.url()?;
725 let mut req =
726 azure_core::http::Request::new(url, azure_core::http::Method::Get);
727 if let Some(auth_header) = this
728 .client
729 .token_credential()
730 .http_authorization_header(&this.client.scopes())
731 .await?
732 {
733 req.insert_header(
734 azure_core::http::headers::AUTHORIZATION,
735 auth_header,
736 );
737 }
738 let req_body = azure_core::Bytes::new();
739 req.set_body(req_body);
740 Ok(Response(this.client.send(&mut req).await?))
741 }
742 })
743 }
744 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
745 let mut url = azure_core::http::Url::parse(&format!(
746 "{}/{}/{}/_apis/search/status/tfvc",
747 self.client.endpoint(),
748 &self.organization,
749 &self.project
750 ))?;
751 let has_api_version_already = url
752 .query_pairs()
753 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
754 if !has_api_version_already {
755 url.query_pairs_mut().append_pair(
756 azure_core::http::headers::query_param::API_VERSION,
757 "7.1-preview",
758 );
759 }
760 Ok(url)
761 }
762 }
763 impl std::future::IntoFuture for RequestBuilder {
764 type Output = azure_core::Result<models::TfvcRepositoryStatusResponse>;
765 type IntoFuture =
766 BoxFuture<'static, azure_core::Result<models::TfvcRepositoryStatusResponse>>;
767 #[doc = "Returns a future that sends the request and returns the parsed response body."]
768 #[doc = ""]
769 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
770 #[doc = ""]
771 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
772 fn into_future(self) -> Self::IntoFuture {
773 Box::pin(async move { self.send().await?.into_raw_body().await })
774 }
775 }
776 }
777}
778pub mod wiki_search_results {
779 use super::models;
780 #[cfg(not(target_arch = "wasm32"))]
781 use futures::future::BoxFuture;
782 #[cfg(target_arch = "wasm32")]
783 use futures::future::LocalBoxFuture as BoxFuture;
784 pub struct Client(pub(crate) super::Client);
785 impl Client {
786 #[doc = "Provides a set of results for the search request."]
787 #[doc = ""]
788 #[doc = "Arguments:"]
789 #[doc = "* `organization`: The name of the Azure DevOps organization."]
790 #[doc = "* `body`: The Wiki Search Request."]
791 #[doc = "* `project`: Project ID or project name"]
792 pub fn fetch_wiki_search_results(
793 &self,
794 organization: impl Into<String>,
795 body: impl Into<models::WikiSearchRequest>,
796 project: impl Into<String>,
797 ) -> fetch_wiki_search_results::RequestBuilder {
798 fetch_wiki_search_results::RequestBuilder {
799 client: self.0.clone(),
800 organization: organization.into(),
801 body: body.into(),
802 project: project.into(),
803 }
804 }
805 }
806 pub mod fetch_wiki_search_results {
807 use super::models;
808 #[cfg(not(target_arch = "wasm32"))]
809 use futures::future::BoxFuture;
810 #[cfg(target_arch = "wasm32")]
811 use futures::future::LocalBoxFuture as BoxFuture;
812 #[derive(Debug)]
813 pub struct Response(azure_core::http::Response);
814 impl Response {
815 pub async fn into_raw_body(self) -> azure_core::Result<models::WikiSearchResponse> {
816 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
817 let body: models::WikiSearchResponse =
818 serde_json::from_slice(&bytes).map_err(|e| {
819 azure_core::error::Error::full(
820 azure_core::error::ErrorKind::DataConversion,
821 e,
822 format!(
823 "Failed to deserialize response:\n{}",
824 String::from_utf8_lossy(&bytes)
825 ),
826 )
827 })?;
828 Ok(body)
829 }
830 pub fn into_raw_response(self) -> azure_core::http::Response {
831 self.0
832 }
833 pub fn as_raw_response(&self) -> &azure_core::http::Response {
834 &self.0
835 }
836 }
837 impl From<Response> for azure_core::http::Response {
838 fn from(rsp: Response) -> Self {
839 rsp.into_raw_response()
840 }
841 }
842 impl AsRef<azure_core::http::Response> for Response {
843 fn as_ref(&self) -> &azure_core::http::Response {
844 self.as_raw_response()
845 }
846 }
847 #[derive(Clone)]
848 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
849 #[doc = r""]
850 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
851 #[doc = r" parameters can be chained."]
852 #[doc = r""]
853 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
854 #[doc = r" converts the [`RequestBuilder`] into a future,"]
855 #[doc = r" executes the request and returns a `Result` with the parsed"]
856 #[doc = r" response."]
857 #[doc = r""]
858 #[doc = r" If you need lower-level access to the raw response details"]
859 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
860 #[doc = r" can finalize the request using the"]
861 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
862 #[doc = r" that resolves to a lower-level [`Response`] value."]
863 pub struct RequestBuilder {
864 pub(crate) client: super::super::Client,
865 pub(crate) organization: String,
866 pub(crate) body: models::WikiSearchRequest,
867 pub(crate) project: String,
868 }
869 impl RequestBuilder {
870 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
871 #[doc = ""]
872 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
873 #[doc = "However, this function can provide more flexibility when required."]
874 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
875 Box::pin({
876 let this = self.clone();
877 async move {
878 let url = this.url()?;
879 let mut req =
880 azure_core::http::Request::new(url, azure_core::http::Method::Post);
881 if let Some(auth_header) = this
882 .client
883 .token_credential()
884 .http_authorization_header(&this.client.scopes())
885 .await?
886 {
887 req.insert_header(
888 azure_core::http::headers::AUTHORIZATION,
889 auth_header,
890 );
891 }
892 req.insert_header("content-type", "application/json");
893 let req_body = azure_core::json::to_json(&this.body)?;
894 req.set_body(req_body);
895 Ok(Response(this.client.send(&mut req).await?))
896 }
897 })
898 }
899 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
900 let mut url = azure_core::http::Url::parse(&format!(
901 "{}/{}/{}/_apis/search/wikisearchresults",
902 self.client.endpoint(),
903 &self.organization,
904 &self.project
905 ))?;
906 let has_api_version_already = url
907 .query_pairs()
908 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
909 if !has_api_version_already {
910 url.query_pairs_mut().append_pair(
911 azure_core::http::headers::query_param::API_VERSION,
912 "7.1-preview",
913 );
914 }
915 Ok(url)
916 }
917 }
918 impl std::future::IntoFuture for RequestBuilder {
919 type Output = azure_core::Result<models::WikiSearchResponse>;
920 type IntoFuture = BoxFuture<'static, azure_core::Result<models::WikiSearchResponse>>;
921 #[doc = "Returns a future that sends the request and returns the parsed response body."]
922 #[doc = ""]
923 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
924 #[doc = ""]
925 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
926 fn into_future(self) -> Self::IntoFuture {
927 Box::pin(async move { self.send().await?.into_raw_body().await })
928 }
929 }
930 }
931}
932pub mod work_item_search_results {
933 use super::models;
934 #[cfg(not(target_arch = "wasm32"))]
935 use futures::future::BoxFuture;
936 #[cfg(target_arch = "wasm32")]
937 use futures::future::LocalBoxFuture as BoxFuture;
938 pub struct Client(pub(crate) super::Client);
939 impl Client {
940 #[doc = "Provides a set of results for the search text."]
941 #[doc = ""]
942 #[doc = "Arguments:"]
943 #[doc = "* `organization`: The name of the Azure DevOps organization."]
944 #[doc = "* `body`: The Work Item Search Request."]
945 #[doc = "* `project`: Project ID or project name"]
946 pub fn fetch_work_item_search_results(
947 &self,
948 organization: impl Into<String>,
949 body: impl Into<models::WorkItemSearchRequest>,
950 project: impl Into<String>,
951 ) -> fetch_work_item_search_results::RequestBuilder {
952 fetch_work_item_search_results::RequestBuilder {
953 client: self.0.clone(),
954 organization: organization.into(),
955 body: body.into(),
956 project: project.into(),
957 }
958 }
959 }
960 pub mod fetch_work_item_search_results {
961 use super::models;
962 #[cfg(not(target_arch = "wasm32"))]
963 use futures::future::BoxFuture;
964 #[cfg(target_arch = "wasm32")]
965 use futures::future::LocalBoxFuture as BoxFuture;
966 #[derive(Debug)]
967 pub struct Response(azure_core::http::Response);
968 impl Response {
969 pub async fn into_raw_body(self) -> azure_core::Result<models::WorkItemSearchResponse> {
970 let bytes: azure_core::Bytes = self.0.into_raw_body().collect().await?;
971 let body: models::WorkItemSearchResponse =
972 serde_json::from_slice(&bytes).map_err(|e| {
973 azure_core::error::Error::full(
974 azure_core::error::ErrorKind::DataConversion,
975 e,
976 format!(
977 "Failed to deserialize response:\n{}",
978 String::from_utf8_lossy(&bytes)
979 ),
980 )
981 })?;
982 Ok(body)
983 }
984 pub fn into_raw_response(self) -> azure_core::http::Response {
985 self.0
986 }
987 pub fn as_raw_response(&self) -> &azure_core::http::Response {
988 &self.0
989 }
990 }
991 impl From<Response> for azure_core::http::Response {
992 fn from(rsp: Response) -> Self {
993 rsp.into_raw_response()
994 }
995 }
996 impl AsRef<azure_core::http::Response> for Response {
997 fn as_ref(&self) -> &azure_core::http::Response {
998 self.as_raw_response()
999 }
1000 }
1001 #[derive(Clone)]
1002 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1003 #[doc = r""]
1004 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1005 #[doc = r" parameters can be chained."]
1006 #[doc = r""]
1007 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1008 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1009 #[doc = r" executes the request and returns a `Result` with the parsed"]
1010 #[doc = r" response."]
1011 #[doc = r""]
1012 #[doc = r" If you need lower-level access to the raw response details"]
1013 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1014 #[doc = r" can finalize the request using the"]
1015 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1016 #[doc = r" that resolves to a lower-level [`Response`] value."]
1017 pub struct RequestBuilder {
1018 pub(crate) client: super::super::Client,
1019 pub(crate) organization: String,
1020 pub(crate) body: models::WorkItemSearchRequest,
1021 pub(crate) project: String,
1022 }
1023 impl RequestBuilder {
1024 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1025 #[doc = ""]
1026 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1027 #[doc = "However, this function can provide more flexibility when required."]
1028 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1029 Box::pin({
1030 let this = self.clone();
1031 async move {
1032 let url = this.url()?;
1033 let mut req =
1034 azure_core::http::Request::new(url, azure_core::http::Method::Post);
1035 if let Some(auth_header) = this
1036 .client
1037 .token_credential()
1038 .http_authorization_header(&this.client.scopes())
1039 .await?
1040 {
1041 req.insert_header(
1042 azure_core::http::headers::AUTHORIZATION,
1043 auth_header,
1044 );
1045 }
1046 req.insert_header("content-type", "application/json");
1047 let req_body = azure_core::json::to_json(&this.body)?;
1048 req.set_body(req_body);
1049 Ok(Response(this.client.send(&mut req).await?))
1050 }
1051 })
1052 }
1053 fn url(&self) -> azure_core::Result<azure_core::http::Url> {
1054 let mut url = azure_core::http::Url::parse(&format!(
1055 "{}/{}/{}/_apis/search/workitemsearchresults",
1056 self.client.endpoint(),
1057 &self.organization,
1058 &self.project
1059 ))?;
1060 let has_api_version_already = url
1061 .query_pairs()
1062 .any(|(k, _)| k == azure_core::http::headers::query_param::API_VERSION);
1063 if !has_api_version_already {
1064 url.query_pairs_mut().append_pair(
1065 azure_core::http::headers::query_param::API_VERSION,
1066 "7.1-preview",
1067 );
1068 }
1069 Ok(url)
1070 }
1071 }
1072 impl std::future::IntoFuture for RequestBuilder {
1073 type Output = azure_core::Result<models::WorkItemSearchResponse>;
1074 type IntoFuture =
1075 BoxFuture<'static, azure_core::Result<models::WorkItemSearchResponse>>;
1076 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1077 #[doc = ""]
1078 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1079 #[doc = ""]
1080 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1081 fn into_future(self) -> Self::IntoFuture {
1082 Box::pin(async move { self.send().await?.into_raw_body().await })
1083 }
1084 }
1085 }
1086}