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::Url,
13 credential: crate::Credential,
14 scopes: Vec<String>,
15 pipeline: azure_core::Pipeline,
16}
17#[derive(Clone)]
18pub struct ClientBuilder {
19 credential: crate::Credential,
20 endpoint: Option<azure_core::Url>,
21 scopes: Option<Vec<String>>,
22 options: azure_core::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::ClientOptions::default(),
34 }
35 }
36 #[doc = "Set the endpoint."]
37 #[must_use]
38 pub fn endpoint(mut self, endpoint: impl Into<azure_core::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::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::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::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::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::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::Request,
100 ) -> azure_core::Result<azure_core::Response> {
101 let context = azure_core::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::Url>,
113 credential: crate::Credential,
114 scopes: Vec<String>,
115 options: azure_core::ClientOptions,
116 ) -> Self {
117 let endpoint = endpoint.into();
118 let pipeline = azure_core::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 dashboards_client(&self) -> dashboards::Client {
133 dashboards::Client(self.clone())
134 }
135 pub fn widget_types_client(&self) -> widget_types::Client {
136 widget_types::Client(self.clone())
137 }
138 pub fn widgets_client(&self) -> widgets::Client {
139 widgets::Client(self.clone())
140 }
141}
142pub mod widget_types {
143 use super::models;
144 #[cfg(not(target_arch = "wasm32"))]
145 use futures::future::BoxFuture;
146 #[cfg(target_arch = "wasm32")]
147 use futures::future::LocalBoxFuture as BoxFuture;
148 pub struct Client(pub(crate) super::Client);
149 impl Client {
150 #[doc = "Get all available widget metadata in alphabetical order, including widgets marked with isVisibleFromCatalog == false."]
151 #[doc = ""]
152 #[doc = "Arguments:"]
153 #[doc = "* `organization`: The name of the Azure DevOps organization."]
154 #[doc = "* `project`: Project ID or project name"]
155 pub fn get_widget_types(
156 &self,
157 organization: impl Into<String>,
158 scope: impl Into<String>,
159 project: impl Into<String>,
160 ) -> get_widget_types::RequestBuilder {
161 get_widget_types::RequestBuilder {
162 client: self.0.clone(),
163 organization: organization.into(),
164 scope: scope.into(),
165 project: project.into(),
166 }
167 }
168 #[doc = "Get the widget metadata satisfying the specified contribution ID."]
169 #[doc = ""]
170 #[doc = "Arguments:"]
171 #[doc = "* `organization`: The name of the Azure DevOps organization."]
172 #[doc = "* `contribution_id`: The ID of Contribution for the Widget"]
173 #[doc = "* `project`: Project ID or project name"]
174 pub fn get_widget_metadata(
175 &self,
176 organization: impl Into<String>,
177 contribution_id: impl Into<String>,
178 project: impl Into<String>,
179 ) -> get_widget_metadata::RequestBuilder {
180 get_widget_metadata::RequestBuilder {
181 client: self.0.clone(),
182 organization: organization.into(),
183 contribution_id: contribution_id.into(),
184 project: project.into(),
185 }
186 }
187 }
188 pub mod get_widget_types {
189 use super::models;
190 #[cfg(not(target_arch = "wasm32"))]
191 use futures::future::BoxFuture;
192 #[cfg(target_arch = "wasm32")]
193 use futures::future::LocalBoxFuture as BoxFuture;
194 #[derive(Debug)]
195 pub struct Response(azure_core::Response);
196 impl Response {
197 pub async fn into_raw_body(self) -> azure_core::Result<models::WidgetTypesResponse> {
198 let bytes = self.0.into_raw_body().collect().await?;
199 let body: models::WidgetTypesResponse =
200 serde_json::from_slice(&bytes).map_err(|e| {
201 azure_core::error::Error::full(
202 azure_core::error::ErrorKind::DataConversion,
203 e,
204 format!(
205 "Failed to deserialize response:\n{}",
206 String::from_utf8_lossy(&bytes)
207 ),
208 )
209 })?;
210 Ok(body)
211 }
212 pub fn into_raw_response(self) -> azure_core::Response {
213 self.0
214 }
215 pub fn as_raw_response(&self) -> &azure_core::Response {
216 &self.0
217 }
218 }
219 impl From<Response> for azure_core::Response {
220 fn from(rsp: Response) -> Self {
221 rsp.into_raw_response()
222 }
223 }
224 impl AsRef<azure_core::Response> for Response {
225 fn as_ref(&self) -> &azure_core::Response {
226 self.as_raw_response()
227 }
228 }
229 #[derive(Clone)]
230 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
231 #[doc = r""]
232 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
233 #[doc = r" parameters can be chained."]
234 #[doc = r""]
235 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
236 #[doc = r" converts the [`RequestBuilder`] into a future,"]
237 #[doc = r" executes the request and returns a `Result` with the parsed"]
238 #[doc = r" response."]
239 #[doc = r""]
240 #[doc = r" If you need lower-level access to the raw response details"]
241 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
242 #[doc = r" can finalize the request using the"]
243 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
244 #[doc = r" that resolves to a lower-level [`Response`] value."]
245 pub struct RequestBuilder {
246 pub(crate) client: super::super::Client,
247 pub(crate) organization: String,
248 pub(crate) scope: String,
249 pub(crate) project: String,
250 }
251 impl RequestBuilder {
252 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
253 #[doc = ""]
254 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
255 #[doc = "However, this function can provide more flexibility when required."]
256 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
257 Box::pin({
258 let this = self.clone();
259 async move {
260 let url = this.url()?;
261 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
262 if let Some(auth_header) = this
263 .client
264 .token_credential()
265 .http_authorization_header(&this.client.scopes())
266 .await?
267 {
268 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
269 }
270 let scope = &this.scope;
271 req.url_mut().query_pairs_mut().append_pair("$scope", scope);
272 let req_body = azure_core::EMPTY_BODY;
273 req.set_body(req_body);
274 Ok(Response(this.client.send(&mut req).await?))
275 }
276 })
277 }
278 fn url(&self) -> azure_core::Result<azure_core::Url> {
279 let mut url = azure_core::Url::parse(&format!(
280 "{}/{}/{}/_apis/dashboard/widgettypes",
281 self.client.endpoint(),
282 &self.organization,
283 &self.project
284 ))?;
285 let has_api_version_already = url
286 .query_pairs()
287 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
288 if !has_api_version_already {
289 url.query_pairs_mut()
290 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
291 }
292 Ok(url)
293 }
294 }
295 impl std::future::IntoFuture for RequestBuilder {
296 type Output = azure_core::Result<models::WidgetTypesResponse>;
297 type IntoFuture = BoxFuture<'static, azure_core::Result<models::WidgetTypesResponse>>;
298 #[doc = "Returns a future that sends the request and returns the parsed response body."]
299 #[doc = ""]
300 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
301 #[doc = ""]
302 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
303 fn into_future(self) -> Self::IntoFuture {
304 Box::pin(async move { self.send().await?.into_raw_body().await })
305 }
306 }
307 }
308 pub mod get_widget_metadata {
309 use super::models;
310 #[cfg(not(target_arch = "wasm32"))]
311 use futures::future::BoxFuture;
312 #[cfg(target_arch = "wasm32")]
313 use futures::future::LocalBoxFuture as BoxFuture;
314 #[derive(Debug)]
315 pub struct Response(azure_core::Response);
316 impl Response {
317 pub async fn into_raw_body(self) -> azure_core::Result<models::WidgetMetadataResponse> {
318 let bytes = self.0.into_raw_body().collect().await?;
319 let body: models::WidgetMetadataResponse =
320 serde_json::from_slice(&bytes).map_err(|e| {
321 azure_core::error::Error::full(
322 azure_core::error::ErrorKind::DataConversion,
323 e,
324 format!(
325 "Failed to deserialize response:\n{}",
326 String::from_utf8_lossy(&bytes)
327 ),
328 )
329 })?;
330 Ok(body)
331 }
332 pub fn into_raw_response(self) -> azure_core::Response {
333 self.0
334 }
335 pub fn as_raw_response(&self) -> &azure_core::Response {
336 &self.0
337 }
338 }
339 impl From<Response> for azure_core::Response {
340 fn from(rsp: Response) -> Self {
341 rsp.into_raw_response()
342 }
343 }
344 impl AsRef<azure_core::Response> for Response {
345 fn as_ref(&self) -> &azure_core::Response {
346 self.as_raw_response()
347 }
348 }
349 #[derive(Clone)]
350 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
351 #[doc = r""]
352 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
353 #[doc = r" parameters can be chained."]
354 #[doc = r""]
355 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
356 #[doc = r" converts the [`RequestBuilder`] into a future,"]
357 #[doc = r" executes the request and returns a `Result` with the parsed"]
358 #[doc = r" response."]
359 #[doc = r""]
360 #[doc = r" If you need lower-level access to the raw response details"]
361 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
362 #[doc = r" can finalize the request using the"]
363 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
364 #[doc = r" that resolves to a lower-level [`Response`] value."]
365 pub struct RequestBuilder {
366 pub(crate) client: super::super::Client,
367 pub(crate) organization: String,
368 pub(crate) contribution_id: String,
369 pub(crate) project: String,
370 }
371 impl RequestBuilder {
372 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
373 #[doc = ""]
374 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
375 #[doc = "However, this function can provide more flexibility when required."]
376 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
377 Box::pin({
378 let this = self.clone();
379 async move {
380 let url = this.url()?;
381 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
382 if let Some(auth_header) = this
383 .client
384 .token_credential()
385 .http_authorization_header(&this.client.scopes())
386 .await?
387 {
388 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
389 }
390 let req_body = azure_core::EMPTY_BODY;
391 req.set_body(req_body);
392 Ok(Response(this.client.send(&mut req).await?))
393 }
394 })
395 }
396 fn url(&self) -> azure_core::Result<azure_core::Url> {
397 let mut url = azure_core::Url::parse(&format!(
398 "{}/{}/{}/_apis/dashboard/widgettypes/{}",
399 self.client.endpoint(),
400 &self.organization,
401 &self.project,
402 &self.contribution_id
403 ))?;
404 let has_api_version_already = url
405 .query_pairs()
406 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
407 if !has_api_version_already {
408 url.query_pairs_mut()
409 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
410 }
411 Ok(url)
412 }
413 }
414 impl std::future::IntoFuture for RequestBuilder {
415 type Output = azure_core::Result<models::WidgetMetadataResponse>;
416 type IntoFuture =
417 BoxFuture<'static, azure_core::Result<models::WidgetMetadataResponse>>;
418 #[doc = "Returns a future that sends the request and returns the parsed response body."]
419 #[doc = ""]
420 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
421 #[doc = ""]
422 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
423 fn into_future(self) -> Self::IntoFuture {
424 Box::pin(async move { self.send().await?.into_raw_body().await })
425 }
426 }
427 }
428}
429pub mod dashboards {
430 use super::models;
431 #[cfg(not(target_arch = "wasm32"))]
432 use futures::future::BoxFuture;
433 #[cfg(target_arch = "wasm32")]
434 use futures::future::LocalBoxFuture as BoxFuture;
435 pub struct Client(pub(crate) super::Client);
436 impl Client {
437 #[doc = "Get a list of dashboards under a project."]
438 #[doc = ""]
439 #[doc = "Arguments:"]
440 #[doc = "* `organization`: The name of the Azure DevOps organization."]
441 #[doc = "* `project`: Project ID or project name"]
442 #[doc = "* `team`: Team ID or team name"]
443 pub fn list(
444 &self,
445 organization: impl Into<String>,
446 project: impl Into<String>,
447 team: impl Into<String>,
448 ) -> list::RequestBuilder {
449 list::RequestBuilder {
450 client: self.0.clone(),
451 organization: organization.into(),
452 project: project.into(),
453 team: team.into(),
454 }
455 }
456 #[doc = "Create the supplied dashboard."]
457 #[doc = ""]
458 #[doc = "Arguments:"]
459 #[doc = "* `organization`: The name of the Azure DevOps organization."]
460 #[doc = "* `body`: The initial state of the dashboard"]
461 #[doc = "* `project`: Project ID or project name"]
462 #[doc = "* `team`: Team ID or team name"]
463 pub fn create(
464 &self,
465 organization: impl Into<String>,
466 body: impl Into<models::Dashboard>,
467 project: impl Into<String>,
468 team: impl Into<String>,
469 ) -> create::RequestBuilder {
470 create::RequestBuilder {
471 client: self.0.clone(),
472 organization: organization.into(),
473 body: body.into(),
474 project: project.into(),
475 team: team.into(),
476 }
477 }
478 #[doc = "Update the name and position of dashboards in the supplied group, and remove omitted dashboards. Does not modify dashboard content."]
479 #[doc = ""]
480 #[doc = "Arguments:"]
481 #[doc = "* `organization`: The name of the Azure DevOps organization."]
482 #[doc = "* `project`: Project ID or project name"]
483 #[doc = "* `team`: Team ID or team name"]
484 pub fn replace_dashboards(
485 &self,
486 organization: impl Into<String>,
487 body: impl Into<models::DashboardGroup>,
488 project: impl Into<String>,
489 team: impl Into<String>,
490 ) -> replace_dashboards::RequestBuilder {
491 replace_dashboards::RequestBuilder {
492 client: self.0.clone(),
493 organization: organization.into(),
494 body: body.into(),
495 project: project.into(),
496 team: team.into(),
497 }
498 }
499 #[doc = "Get a dashboard by its ID."]
500 #[doc = ""]
501 #[doc = "Arguments:"]
502 #[doc = "* `organization`: The name of the Azure DevOps organization."]
503 #[doc = "* `project`: Project ID or project name"]
504 #[doc = "* `team`: Team ID or team name"]
505 pub fn get(
506 &self,
507 organization: impl Into<String>,
508 project: impl Into<String>,
509 dashboard_id: impl Into<String>,
510 team: impl Into<String>,
511 ) -> get::RequestBuilder {
512 get::RequestBuilder {
513 client: self.0.clone(),
514 organization: organization.into(),
515 project: project.into(),
516 dashboard_id: dashboard_id.into(),
517 team: team.into(),
518 }
519 }
520 #[doc = "Replace configuration for the specified dashboard. Replaces Widget list on Dashboard, only if property is supplied."]
521 #[doc = ""]
522 #[doc = "Arguments:"]
523 #[doc = "* `organization`: The name of the Azure DevOps organization."]
524 #[doc = "* `body`: The Configuration of the dashboard to replace."]
525 #[doc = "* `project`: Project ID or project name"]
526 #[doc = "* `dashboard_id`: ID of the dashboard to replace."]
527 #[doc = "* `team`: Team ID or team name"]
528 pub fn replace_dashboard(
529 &self,
530 organization: impl Into<String>,
531 body: impl Into<models::Dashboard>,
532 project: impl Into<String>,
533 dashboard_id: impl Into<String>,
534 team: impl Into<String>,
535 ) -> replace_dashboard::RequestBuilder {
536 replace_dashboard::RequestBuilder {
537 client: self.0.clone(),
538 organization: organization.into(),
539 body: body.into(),
540 project: project.into(),
541 dashboard_id: dashboard_id.into(),
542 team: team.into(),
543 }
544 }
545 #[doc = "Delete a dashboard given its ID. This also deletes the widgets associated with this dashboard."]
546 #[doc = ""]
547 #[doc = "Arguments:"]
548 #[doc = "* `organization`: The name of the Azure DevOps organization."]
549 #[doc = "* `project`: Project ID or project name"]
550 #[doc = "* `dashboard_id`: ID of the dashboard to delete."]
551 #[doc = "* `team`: Team ID or team name"]
552 pub fn delete(
553 &self,
554 organization: impl Into<String>,
555 project: impl Into<String>,
556 dashboard_id: impl Into<String>,
557 team: impl Into<String>,
558 ) -> delete::RequestBuilder {
559 delete::RequestBuilder {
560 client: self.0.clone(),
561 organization: organization.into(),
562 project: project.into(),
563 dashboard_id: dashboard_id.into(),
564 team: team.into(),
565 }
566 }
567 }
568 pub mod list {
569 use super::models;
570 #[cfg(not(target_arch = "wasm32"))]
571 use futures::future::BoxFuture;
572 #[cfg(target_arch = "wasm32")]
573 use futures::future::LocalBoxFuture as BoxFuture;
574 #[derive(Debug)]
575 pub struct Response(azure_core::Response);
576 impl Response {
577 pub async fn into_raw_body(self) -> azure_core::Result<models::DashboardList> {
578 let bytes = self.0.into_raw_body().collect().await?;
579 let body: models::DashboardList = serde_json::from_slice(&bytes).map_err(|e| {
580 azure_core::error::Error::full(
581 azure_core::error::ErrorKind::DataConversion,
582 e,
583 format!(
584 "Failed to deserialize response:\n{}",
585 String::from_utf8_lossy(&bytes)
586 ),
587 )
588 })?;
589 Ok(body)
590 }
591 pub fn into_raw_response(self) -> azure_core::Response {
592 self.0
593 }
594 pub fn as_raw_response(&self) -> &azure_core::Response {
595 &self.0
596 }
597 }
598 impl From<Response> for azure_core::Response {
599 fn from(rsp: Response) -> Self {
600 rsp.into_raw_response()
601 }
602 }
603 impl AsRef<azure_core::Response> for Response {
604 fn as_ref(&self) -> &azure_core::Response {
605 self.as_raw_response()
606 }
607 }
608 #[derive(Clone)]
609 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
610 #[doc = r""]
611 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
612 #[doc = r" parameters can be chained."]
613 #[doc = r""]
614 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
615 #[doc = r" converts the [`RequestBuilder`] into a future,"]
616 #[doc = r" executes the request and returns a `Result` with the parsed"]
617 #[doc = r" response."]
618 #[doc = r""]
619 #[doc = r" If you need lower-level access to the raw response details"]
620 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
621 #[doc = r" can finalize the request using the"]
622 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
623 #[doc = r" that resolves to a lower-level [`Response`] value."]
624 pub struct RequestBuilder {
625 pub(crate) client: super::super::Client,
626 pub(crate) organization: String,
627 pub(crate) project: String,
628 pub(crate) team: String,
629 }
630 impl RequestBuilder {
631 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
632 #[doc = ""]
633 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
634 #[doc = "However, this function can provide more flexibility when required."]
635 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
636 Box::pin({
637 let this = self.clone();
638 async move {
639 let url = this.url()?;
640 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
641 if let Some(auth_header) = this
642 .client
643 .token_credential()
644 .http_authorization_header(&this.client.scopes())
645 .await?
646 {
647 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
648 }
649 let req_body = azure_core::EMPTY_BODY;
650 req.set_body(req_body);
651 Ok(Response(this.client.send(&mut req).await?))
652 }
653 })
654 }
655 fn url(&self) -> azure_core::Result<azure_core::Url> {
656 let mut url = azure_core::Url::parse(&format!(
657 "{}/{}/{}/{}/_apis/dashboard/dashboards",
658 self.client.endpoint(),
659 &self.organization,
660 &self.project,
661 &self.team
662 ))?;
663 let has_api_version_already = url
664 .query_pairs()
665 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
666 if !has_api_version_already {
667 url.query_pairs_mut()
668 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
669 }
670 Ok(url)
671 }
672 }
673 impl std::future::IntoFuture for RequestBuilder {
674 type Output = azure_core::Result<models::DashboardList>;
675 type IntoFuture = BoxFuture<'static, azure_core::Result<models::DashboardList>>;
676 #[doc = "Returns a future that sends the request and returns the parsed response body."]
677 #[doc = ""]
678 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
679 #[doc = ""]
680 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
681 fn into_future(self) -> Self::IntoFuture {
682 Box::pin(async move { self.send().await?.into_raw_body().await })
683 }
684 }
685 }
686 pub mod create {
687 use super::models;
688 #[cfg(not(target_arch = "wasm32"))]
689 use futures::future::BoxFuture;
690 #[cfg(target_arch = "wasm32")]
691 use futures::future::LocalBoxFuture as BoxFuture;
692 #[derive(Debug)]
693 pub struct Response(azure_core::Response);
694 impl Response {
695 pub async fn into_raw_body(self) -> azure_core::Result<models::Dashboard> {
696 let bytes = self.0.into_raw_body().collect().await?;
697 let body: models::Dashboard = serde_json::from_slice(&bytes).map_err(|e| {
698 azure_core::error::Error::full(
699 azure_core::error::ErrorKind::DataConversion,
700 e,
701 format!(
702 "Failed to deserialize response:\n{}",
703 String::from_utf8_lossy(&bytes)
704 ),
705 )
706 })?;
707 Ok(body)
708 }
709 pub fn into_raw_response(self) -> azure_core::Response {
710 self.0
711 }
712 pub fn as_raw_response(&self) -> &azure_core::Response {
713 &self.0
714 }
715 }
716 impl From<Response> for azure_core::Response {
717 fn from(rsp: Response) -> Self {
718 rsp.into_raw_response()
719 }
720 }
721 impl AsRef<azure_core::Response> for Response {
722 fn as_ref(&self) -> &azure_core::Response {
723 self.as_raw_response()
724 }
725 }
726 #[derive(Clone)]
727 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
728 #[doc = r""]
729 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
730 #[doc = r" parameters can be chained."]
731 #[doc = r""]
732 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
733 #[doc = r" converts the [`RequestBuilder`] into a future,"]
734 #[doc = r" executes the request and returns a `Result` with the parsed"]
735 #[doc = r" response."]
736 #[doc = r""]
737 #[doc = r" If you need lower-level access to the raw response details"]
738 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
739 #[doc = r" can finalize the request using the"]
740 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
741 #[doc = r" that resolves to a lower-level [`Response`] value."]
742 pub struct RequestBuilder {
743 pub(crate) client: super::super::Client,
744 pub(crate) organization: String,
745 pub(crate) body: models::Dashboard,
746 pub(crate) project: String,
747 pub(crate) team: String,
748 }
749 impl RequestBuilder {
750 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
751 #[doc = ""]
752 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
753 #[doc = "However, this function can provide more flexibility when required."]
754 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
755 Box::pin({
756 let this = self.clone();
757 async move {
758 let url = this.url()?;
759 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
760 if let Some(auth_header) = this
761 .client
762 .token_credential()
763 .http_authorization_header(&this.client.scopes())
764 .await?
765 {
766 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
767 }
768 req.insert_header("content-type", "application/json");
769 let req_body = azure_core::json::to_json(&this.body)?;
770 req.set_body(req_body);
771 Ok(Response(this.client.send(&mut req).await?))
772 }
773 })
774 }
775 fn url(&self) -> azure_core::Result<azure_core::Url> {
776 let mut url = azure_core::Url::parse(&format!(
777 "{}/{}/{}/{}/_apis/dashboard/dashboards",
778 self.client.endpoint(),
779 &self.organization,
780 &self.project,
781 &self.team
782 ))?;
783 let has_api_version_already = url
784 .query_pairs()
785 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
786 if !has_api_version_already {
787 url.query_pairs_mut()
788 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
789 }
790 Ok(url)
791 }
792 }
793 impl std::future::IntoFuture for RequestBuilder {
794 type Output = azure_core::Result<models::Dashboard>;
795 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Dashboard>>;
796 #[doc = "Returns a future that sends the request and returns the parsed response body."]
797 #[doc = ""]
798 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
799 #[doc = ""]
800 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
801 fn into_future(self) -> Self::IntoFuture {
802 Box::pin(async move { self.send().await?.into_raw_body().await })
803 }
804 }
805 }
806 pub mod replace_dashboards {
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::Response);
814 impl Response {
815 pub async fn into_raw_body(self) -> azure_core::Result<models::DashboardGroup> {
816 let bytes = self.0.into_raw_body().collect().await?;
817 let body: models::DashboardGroup = serde_json::from_slice(&bytes).map_err(|e| {
818 azure_core::error::Error::full(
819 azure_core::error::ErrorKind::DataConversion,
820 e,
821 format!(
822 "Failed to deserialize response:\n{}",
823 String::from_utf8_lossy(&bytes)
824 ),
825 )
826 })?;
827 Ok(body)
828 }
829 pub fn into_raw_response(self) -> azure_core::Response {
830 self.0
831 }
832 pub fn as_raw_response(&self) -> &azure_core::Response {
833 &self.0
834 }
835 }
836 impl From<Response> for azure_core::Response {
837 fn from(rsp: Response) -> Self {
838 rsp.into_raw_response()
839 }
840 }
841 impl AsRef<azure_core::Response> for Response {
842 fn as_ref(&self) -> &azure_core::Response {
843 self.as_raw_response()
844 }
845 }
846 #[derive(Clone)]
847 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
848 #[doc = r""]
849 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
850 #[doc = r" parameters can be chained."]
851 #[doc = r""]
852 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
853 #[doc = r" converts the [`RequestBuilder`] into a future,"]
854 #[doc = r" executes the request and returns a `Result` with the parsed"]
855 #[doc = r" response."]
856 #[doc = r""]
857 #[doc = r" If you need lower-level access to the raw response details"]
858 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
859 #[doc = r" can finalize the request using the"]
860 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
861 #[doc = r" that resolves to a lower-level [`Response`] value."]
862 pub struct RequestBuilder {
863 pub(crate) client: super::super::Client,
864 pub(crate) organization: String,
865 pub(crate) body: models::DashboardGroup,
866 pub(crate) project: String,
867 pub(crate) team: 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 = azure_core::Request::new(url, azure_core::Method::Put);
880 if let Some(auth_header) = this
881 .client
882 .token_credential()
883 .http_authorization_header(&this.client.scopes())
884 .await?
885 {
886 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
887 }
888 req.insert_header("content-type", "application/json");
889 let req_body = azure_core::json::to_json(&this.body)?;
890 req.set_body(req_body);
891 Ok(Response(this.client.send(&mut req).await?))
892 }
893 })
894 }
895 fn url(&self) -> azure_core::Result<azure_core::Url> {
896 let mut url = azure_core::Url::parse(&format!(
897 "{}/{}/{}/{}/_apis/dashboard/dashboards",
898 self.client.endpoint(),
899 &self.organization,
900 &self.project,
901 &self.team
902 ))?;
903 let has_api_version_already = url
904 .query_pairs()
905 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
906 if !has_api_version_already {
907 url.query_pairs_mut()
908 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
909 }
910 Ok(url)
911 }
912 }
913 impl std::future::IntoFuture for RequestBuilder {
914 type Output = azure_core::Result<models::DashboardGroup>;
915 type IntoFuture = BoxFuture<'static, azure_core::Result<models::DashboardGroup>>;
916 #[doc = "Returns a future that sends the request and returns the parsed response body."]
917 #[doc = ""]
918 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
919 #[doc = ""]
920 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
921 fn into_future(self) -> Self::IntoFuture {
922 Box::pin(async move { self.send().await?.into_raw_body().await })
923 }
924 }
925 }
926 pub mod get {
927 use super::models;
928 #[cfg(not(target_arch = "wasm32"))]
929 use futures::future::BoxFuture;
930 #[cfg(target_arch = "wasm32")]
931 use futures::future::LocalBoxFuture as BoxFuture;
932 #[derive(Debug)]
933 pub struct Response(azure_core::Response);
934 impl Response {
935 pub async fn into_raw_body(self) -> azure_core::Result<models::Dashboard> {
936 let bytes = self.0.into_raw_body().collect().await?;
937 let body: models::Dashboard = serde_json::from_slice(&bytes).map_err(|e| {
938 azure_core::error::Error::full(
939 azure_core::error::ErrorKind::DataConversion,
940 e,
941 format!(
942 "Failed to deserialize response:\n{}",
943 String::from_utf8_lossy(&bytes)
944 ),
945 )
946 })?;
947 Ok(body)
948 }
949 pub fn into_raw_response(self) -> azure_core::Response {
950 self.0
951 }
952 pub fn as_raw_response(&self) -> &azure_core::Response {
953 &self.0
954 }
955 }
956 impl From<Response> for azure_core::Response {
957 fn from(rsp: Response) -> Self {
958 rsp.into_raw_response()
959 }
960 }
961 impl AsRef<azure_core::Response> for Response {
962 fn as_ref(&self) -> &azure_core::Response {
963 self.as_raw_response()
964 }
965 }
966 #[derive(Clone)]
967 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
968 #[doc = r""]
969 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
970 #[doc = r" parameters can be chained."]
971 #[doc = r""]
972 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
973 #[doc = r" converts the [`RequestBuilder`] into a future,"]
974 #[doc = r" executes the request and returns a `Result` with the parsed"]
975 #[doc = r" response."]
976 #[doc = r""]
977 #[doc = r" If you need lower-level access to the raw response details"]
978 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
979 #[doc = r" can finalize the request using the"]
980 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
981 #[doc = r" that resolves to a lower-level [`Response`] value."]
982 pub struct RequestBuilder {
983 pub(crate) client: super::super::Client,
984 pub(crate) organization: String,
985 pub(crate) project: String,
986 pub(crate) dashboard_id: String,
987 pub(crate) team: String,
988 }
989 impl RequestBuilder {
990 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
991 #[doc = ""]
992 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
993 #[doc = "However, this function can provide more flexibility when required."]
994 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
995 Box::pin({
996 let this = self.clone();
997 async move {
998 let url = this.url()?;
999 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1000 if let Some(auth_header) = this
1001 .client
1002 .token_credential()
1003 .http_authorization_header(&this.client.scopes())
1004 .await?
1005 {
1006 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1007 }
1008 let req_body = azure_core::EMPTY_BODY;
1009 req.set_body(req_body);
1010 Ok(Response(this.client.send(&mut req).await?))
1011 }
1012 })
1013 }
1014 fn url(&self) -> azure_core::Result<azure_core::Url> {
1015 let mut url = azure_core::Url::parse(&format!(
1016 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}",
1017 self.client.endpoint(),
1018 &self.organization,
1019 &self.project,
1020 &self.team,
1021 &self.dashboard_id
1022 ))?;
1023 let has_api_version_already = url
1024 .query_pairs()
1025 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1026 if !has_api_version_already {
1027 url.query_pairs_mut()
1028 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1029 }
1030 Ok(url)
1031 }
1032 }
1033 impl std::future::IntoFuture for RequestBuilder {
1034 type Output = azure_core::Result<models::Dashboard>;
1035 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Dashboard>>;
1036 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1037 #[doc = ""]
1038 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1039 #[doc = ""]
1040 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1041 fn into_future(self) -> Self::IntoFuture {
1042 Box::pin(async move { self.send().await?.into_raw_body().await })
1043 }
1044 }
1045 }
1046 pub mod replace_dashboard {
1047 use super::models;
1048 #[cfg(not(target_arch = "wasm32"))]
1049 use futures::future::BoxFuture;
1050 #[cfg(target_arch = "wasm32")]
1051 use futures::future::LocalBoxFuture as BoxFuture;
1052 #[derive(Debug)]
1053 pub struct Response(azure_core::Response);
1054 impl Response {
1055 pub async fn into_raw_body(self) -> azure_core::Result<models::Dashboard> {
1056 let bytes = self.0.into_raw_body().collect().await?;
1057 let body: models::Dashboard = serde_json::from_slice(&bytes).map_err(|e| {
1058 azure_core::error::Error::full(
1059 azure_core::error::ErrorKind::DataConversion,
1060 e,
1061 format!(
1062 "Failed to deserialize response:\n{}",
1063 String::from_utf8_lossy(&bytes)
1064 ),
1065 )
1066 })?;
1067 Ok(body)
1068 }
1069 pub fn into_raw_response(self) -> azure_core::Response {
1070 self.0
1071 }
1072 pub fn as_raw_response(&self) -> &azure_core::Response {
1073 &self.0
1074 }
1075 }
1076 impl From<Response> for azure_core::Response {
1077 fn from(rsp: Response) -> Self {
1078 rsp.into_raw_response()
1079 }
1080 }
1081 impl AsRef<azure_core::Response> for Response {
1082 fn as_ref(&self) -> &azure_core::Response {
1083 self.as_raw_response()
1084 }
1085 }
1086 #[derive(Clone)]
1087 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1088 #[doc = r""]
1089 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1090 #[doc = r" parameters can be chained."]
1091 #[doc = r""]
1092 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1093 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1094 #[doc = r" executes the request and returns a `Result` with the parsed"]
1095 #[doc = r" response."]
1096 #[doc = r""]
1097 #[doc = r" If you need lower-level access to the raw response details"]
1098 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1099 #[doc = r" can finalize the request using the"]
1100 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1101 #[doc = r" that resolves to a lower-level [`Response`] value."]
1102 pub struct RequestBuilder {
1103 pub(crate) client: super::super::Client,
1104 pub(crate) organization: String,
1105 pub(crate) body: models::Dashboard,
1106 pub(crate) project: String,
1107 pub(crate) dashboard_id: String,
1108 pub(crate) team: String,
1109 }
1110 impl RequestBuilder {
1111 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1112 #[doc = ""]
1113 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1114 #[doc = "However, this function can provide more flexibility when required."]
1115 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1116 Box::pin({
1117 let this = self.clone();
1118 async move {
1119 let url = this.url()?;
1120 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
1121 if let Some(auth_header) = this
1122 .client
1123 .token_credential()
1124 .http_authorization_header(&this.client.scopes())
1125 .await?
1126 {
1127 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1128 }
1129 req.insert_header("content-type", "application/json");
1130 let req_body = azure_core::json::to_json(&this.body)?;
1131 req.set_body(req_body);
1132 Ok(Response(this.client.send(&mut req).await?))
1133 }
1134 })
1135 }
1136 fn url(&self) -> azure_core::Result<azure_core::Url> {
1137 let mut url = azure_core::Url::parse(&format!(
1138 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}",
1139 self.client.endpoint(),
1140 &self.organization,
1141 &self.project,
1142 &self.team,
1143 &self.dashboard_id
1144 ))?;
1145 let has_api_version_already = url
1146 .query_pairs()
1147 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1148 if !has_api_version_already {
1149 url.query_pairs_mut()
1150 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1151 }
1152 Ok(url)
1153 }
1154 }
1155 impl std::future::IntoFuture for RequestBuilder {
1156 type Output = azure_core::Result<models::Dashboard>;
1157 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Dashboard>>;
1158 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1159 #[doc = ""]
1160 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1161 #[doc = ""]
1162 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1163 fn into_future(self) -> Self::IntoFuture {
1164 Box::pin(async move { self.send().await?.into_raw_body().await })
1165 }
1166 }
1167 }
1168 pub mod delete {
1169 use super::models;
1170 #[cfg(not(target_arch = "wasm32"))]
1171 use futures::future::BoxFuture;
1172 #[cfg(target_arch = "wasm32")]
1173 use futures::future::LocalBoxFuture as BoxFuture;
1174 #[derive(Debug)]
1175 pub struct Response(azure_core::Response);
1176 impl Response {
1177 pub fn into_raw_response(self) -> azure_core::Response {
1178 self.0
1179 }
1180 pub fn as_raw_response(&self) -> &azure_core::Response {
1181 &self.0
1182 }
1183 }
1184 impl From<Response> for azure_core::Response {
1185 fn from(rsp: Response) -> Self {
1186 rsp.into_raw_response()
1187 }
1188 }
1189 impl AsRef<azure_core::Response> for Response {
1190 fn as_ref(&self) -> &azure_core::Response {
1191 self.as_raw_response()
1192 }
1193 }
1194 #[derive(Clone)]
1195 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1196 #[doc = r""]
1197 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1198 #[doc = r" parameters can be chained."]
1199 #[doc = r""]
1200 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1201 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1202 #[doc = r" executes the request and returns a `Result` with the parsed"]
1203 #[doc = r" response."]
1204 #[doc = r""]
1205 #[doc = r" If you need lower-level access to the raw response details"]
1206 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1207 #[doc = r" can finalize the request using the"]
1208 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1209 #[doc = r" that resolves to a lower-level [`Response`] value."]
1210 pub struct RequestBuilder {
1211 pub(crate) client: super::super::Client,
1212 pub(crate) organization: String,
1213 pub(crate) project: String,
1214 pub(crate) dashboard_id: String,
1215 pub(crate) team: String,
1216 }
1217 impl RequestBuilder {
1218 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1219 #[doc = ""]
1220 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1221 #[doc = "However, this function can provide more flexibility when required."]
1222 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1223 Box::pin({
1224 let this = self.clone();
1225 async move {
1226 let url = this.url()?;
1227 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
1228 if let Some(auth_header) = this
1229 .client
1230 .token_credential()
1231 .http_authorization_header(&this.client.scopes())
1232 .await?
1233 {
1234 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1235 }
1236 let req_body = azure_core::EMPTY_BODY;
1237 req.set_body(req_body);
1238 Ok(Response(this.client.send(&mut req).await?))
1239 }
1240 })
1241 }
1242 fn url(&self) -> azure_core::Result<azure_core::Url> {
1243 let mut url = azure_core::Url::parse(&format!(
1244 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}",
1245 self.client.endpoint(),
1246 &self.organization,
1247 &self.project,
1248 &self.team,
1249 &self.dashboard_id
1250 ))?;
1251 let has_api_version_already = url
1252 .query_pairs()
1253 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1254 if !has_api_version_already {
1255 url.query_pairs_mut()
1256 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1257 }
1258 Ok(url)
1259 }
1260 }
1261 impl std::future::IntoFuture for RequestBuilder {
1262 type Output = azure_core::Result<()>;
1263 type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
1264 #[doc = "Returns a future that sends the request and waits for the response."]
1265 #[doc = ""]
1266 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1267 #[doc = ""]
1268 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1269 fn into_future(self) -> Self::IntoFuture {
1270 Box::pin(async move {
1271 let _rsp = self.send().await?;
1272 Ok(())
1273 })
1274 }
1275 }
1276 }
1277}
1278pub mod widgets {
1279 use super::models;
1280 #[cfg(not(target_arch = "wasm32"))]
1281 use futures::future::BoxFuture;
1282 #[cfg(target_arch = "wasm32")]
1283 use futures::future::LocalBoxFuture as BoxFuture;
1284 pub struct Client(pub(crate) super::Client);
1285 impl Client {
1286 #[doc = "Get widgets contained on the specified dashboard."]
1287 #[doc = ""]
1288 #[doc = "Arguments:"]
1289 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1290 #[doc = "* `project`: Project ID or project name"]
1291 #[doc = "* `dashboard_id`: ID of the dashboard to read."]
1292 #[doc = "* `team`: Team ID or team name"]
1293 pub fn get_widgets(
1294 &self,
1295 organization: impl Into<String>,
1296 project: impl Into<String>,
1297 dashboard_id: impl Into<String>,
1298 team: impl Into<String>,
1299 ) -> get_widgets::RequestBuilder {
1300 get_widgets::RequestBuilder {
1301 client: self.0.clone(),
1302 organization: organization.into(),
1303 project: project.into(),
1304 dashboard_id: dashboard_id.into(),
1305 team: team.into(),
1306 e_tag: None,
1307 }
1308 }
1309 #[doc = "Create a widget on the specified dashboard."]
1310 #[doc = ""]
1311 #[doc = "Arguments:"]
1312 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1313 #[doc = "* `body`: State of the widget to add"]
1314 #[doc = "* `project`: Project ID or project name"]
1315 #[doc = "* `dashboard_id`: ID of dashboard the widget will be added to."]
1316 #[doc = "* `team`: Team ID or team name"]
1317 pub fn create(
1318 &self,
1319 organization: impl Into<String>,
1320 body: impl Into<models::Widget>,
1321 project: impl Into<String>,
1322 dashboard_id: impl Into<String>,
1323 team: impl Into<String>,
1324 ) -> create::RequestBuilder {
1325 create::RequestBuilder {
1326 client: self.0.clone(),
1327 organization: organization.into(),
1328 body: body.into(),
1329 project: project.into(),
1330 dashboard_id: dashboard_id.into(),
1331 team: team.into(),
1332 }
1333 }
1334 #[doc = "Replace the widgets on specified dashboard with the supplied widgets."]
1335 #[doc = ""]
1336 #[doc = "Arguments:"]
1337 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1338 #[doc = "* `body`: Revised state of widgets to store for the dashboard."]
1339 #[doc = "* `project`: Project ID or project name"]
1340 #[doc = "* `dashboard_id`: ID of the Dashboard to modify."]
1341 #[doc = "* `team`: Team ID or team name"]
1342 pub fn replace_widgets(
1343 &self,
1344 organization: impl Into<String>,
1345 body: Vec<models::Widget>,
1346 project: impl Into<String>,
1347 dashboard_id: impl Into<String>,
1348 team: impl Into<String>,
1349 ) -> replace_widgets::RequestBuilder {
1350 replace_widgets::RequestBuilder {
1351 client: self.0.clone(),
1352 organization: organization.into(),
1353 body,
1354 project: project.into(),
1355 dashboard_id: dashboard_id.into(),
1356 team: team.into(),
1357 e_tag: None,
1358 }
1359 }
1360 #[doc = "Update the supplied widgets on the dashboard using supplied state. State of existing Widgets not passed in the widget list is preserved."]
1361 #[doc = ""]
1362 #[doc = "Arguments:"]
1363 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1364 #[doc = "* `body`: The set of widget states to update on the dashboard."]
1365 #[doc = "* `project`: Project ID or project name"]
1366 #[doc = "* `dashboard_id`: ID of the Dashboard to modify."]
1367 #[doc = "* `team`: Team ID or team name"]
1368 pub fn update_widgets(
1369 &self,
1370 organization: impl Into<String>,
1371 body: Vec<models::Widget>,
1372 project: impl Into<String>,
1373 dashboard_id: impl Into<String>,
1374 team: impl Into<String>,
1375 ) -> update_widgets::RequestBuilder {
1376 update_widgets::RequestBuilder {
1377 client: self.0.clone(),
1378 organization: organization.into(),
1379 body,
1380 project: project.into(),
1381 dashboard_id: dashboard_id.into(),
1382 team: team.into(),
1383 e_tag: None,
1384 }
1385 }
1386 #[doc = "Get the current state of the specified widget."]
1387 #[doc = ""]
1388 #[doc = "Arguments:"]
1389 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1390 #[doc = "* `project`: Project ID or project name"]
1391 #[doc = "* `dashboard_id`: ID of the dashboard containing the widget."]
1392 #[doc = "* `widget_id`: ID of the widget to read."]
1393 #[doc = "* `team`: Team ID or team name"]
1394 pub fn get_widget(
1395 &self,
1396 organization: impl Into<String>,
1397 project: impl Into<String>,
1398 dashboard_id: impl Into<String>,
1399 widget_id: impl Into<String>,
1400 team: impl Into<String>,
1401 ) -> get_widget::RequestBuilder {
1402 get_widget::RequestBuilder {
1403 client: self.0.clone(),
1404 organization: organization.into(),
1405 project: project.into(),
1406 dashboard_id: dashboard_id.into(),
1407 widget_id: widget_id.into(),
1408 team: team.into(),
1409 }
1410 }
1411 #[doc = "Override the state of the specified widget."]
1412 #[doc = ""]
1413 #[doc = "Arguments:"]
1414 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1415 #[doc = "* `body`: State to be written for the widget."]
1416 #[doc = "* `project`: Project ID or project name"]
1417 #[doc = "* `dashboard_id`: ID of the dashboard containing the widget."]
1418 #[doc = "* `widget_id`: ID of the widget to update."]
1419 #[doc = "* `team`: Team ID or team name"]
1420 pub fn replace_widget(
1421 &self,
1422 organization: impl Into<String>,
1423 body: impl Into<models::Widget>,
1424 project: impl Into<String>,
1425 dashboard_id: impl Into<String>,
1426 widget_id: impl Into<String>,
1427 team: impl Into<String>,
1428 ) -> replace_widget::RequestBuilder {
1429 replace_widget::RequestBuilder {
1430 client: self.0.clone(),
1431 organization: organization.into(),
1432 body: body.into(),
1433 project: project.into(),
1434 dashboard_id: dashboard_id.into(),
1435 widget_id: widget_id.into(),
1436 team: team.into(),
1437 }
1438 }
1439 #[doc = "Perform a partial update of the specified widget."]
1440 #[doc = ""]
1441 #[doc = "Arguments:"]
1442 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1443 #[doc = "* `body`: Description of the widget changes to apply. All non-null fields will be replaced."]
1444 #[doc = "* `project`: Project ID or project name"]
1445 #[doc = "* `dashboard_id`: ID of the dashboard containing the widget."]
1446 #[doc = "* `widget_id`: ID of the widget to update."]
1447 #[doc = "* `team`: Team ID or team name"]
1448 pub fn update_widget(
1449 &self,
1450 organization: impl Into<String>,
1451 body: impl Into<models::Widget>,
1452 project: impl Into<String>,
1453 dashboard_id: impl Into<String>,
1454 widget_id: impl Into<String>,
1455 team: impl Into<String>,
1456 ) -> update_widget::RequestBuilder {
1457 update_widget::RequestBuilder {
1458 client: self.0.clone(),
1459 organization: organization.into(),
1460 body: body.into(),
1461 project: project.into(),
1462 dashboard_id: dashboard_id.into(),
1463 widget_id: widget_id.into(),
1464 team: team.into(),
1465 }
1466 }
1467 #[doc = "Delete the specified widget."]
1468 #[doc = ""]
1469 #[doc = "Arguments:"]
1470 #[doc = "* `organization`: The name of the Azure DevOps organization."]
1471 #[doc = "* `project`: Project ID or project name"]
1472 #[doc = "* `dashboard_id`: ID of the dashboard containing the widget."]
1473 #[doc = "* `widget_id`: ID of the widget to update."]
1474 #[doc = "* `team`: Team ID or team name"]
1475 pub fn delete(
1476 &self,
1477 organization: impl Into<String>,
1478 project: impl Into<String>,
1479 dashboard_id: impl Into<String>,
1480 widget_id: impl Into<String>,
1481 team: impl Into<String>,
1482 ) -> delete::RequestBuilder {
1483 delete::RequestBuilder {
1484 client: self.0.clone(),
1485 organization: organization.into(),
1486 project: project.into(),
1487 dashboard_id: dashboard_id.into(),
1488 widget_id: widget_id.into(),
1489 team: team.into(),
1490 }
1491 }
1492 }
1493 pub mod get_widgets {
1494 use super::models;
1495 #[cfg(not(target_arch = "wasm32"))]
1496 use futures::future::BoxFuture;
1497 #[cfg(target_arch = "wasm32")]
1498 use futures::future::LocalBoxFuture as BoxFuture;
1499 #[derive(Debug)]
1500 pub struct Response(azure_core::Response);
1501 impl Response {
1502 pub async fn into_raw_body(self) -> azure_core::Result<models::WidgetList> {
1503 let bytes = self.0.into_raw_body().collect().await?;
1504 let body: models::WidgetList = serde_json::from_slice(&bytes).map_err(|e| {
1505 azure_core::error::Error::full(
1506 azure_core::error::ErrorKind::DataConversion,
1507 e,
1508 format!(
1509 "Failed to deserialize response:\n{}",
1510 String::from_utf8_lossy(&bytes)
1511 ),
1512 )
1513 })?;
1514 Ok(body)
1515 }
1516 pub fn into_raw_response(self) -> azure_core::Response {
1517 self.0
1518 }
1519 pub fn as_raw_response(&self) -> &azure_core::Response {
1520 &self.0
1521 }
1522 pub fn headers(&self) -> Headers {
1523 Headers(self.0.headers())
1524 }
1525 }
1526 impl From<Response> for azure_core::Response {
1527 fn from(rsp: Response) -> Self {
1528 rsp.into_raw_response()
1529 }
1530 }
1531 impl AsRef<azure_core::Response> for Response {
1532 fn as_ref(&self) -> &azure_core::Response {
1533 self.as_raw_response()
1534 }
1535 }
1536 pub struct Headers<'a>(&'a azure_core::headers::Headers);
1537 impl Headers<'_> {
1538 pub fn e_tag(&self) -> azure_core::Result<&str> {
1539 self.0
1540 .get_str(&azure_core::headers::HeaderName::from_static("etag"))
1541 }
1542 }
1543 #[derive(Clone)]
1544 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1545 #[doc = r""]
1546 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1547 #[doc = r" parameters can be chained."]
1548 #[doc = r""]
1549 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1550 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1551 #[doc = r" executes the request and returns a `Result` with the parsed"]
1552 #[doc = r" response."]
1553 #[doc = r""]
1554 #[doc = r" If you need lower-level access to the raw response details"]
1555 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1556 #[doc = r" can finalize the request using the"]
1557 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1558 #[doc = r" that resolves to a lower-level [`Response`] value."]
1559 pub struct RequestBuilder {
1560 pub(crate) client: super::super::Client,
1561 pub(crate) organization: String,
1562 pub(crate) project: String,
1563 pub(crate) dashboard_id: String,
1564 pub(crate) team: String,
1565 pub(crate) e_tag: Option<String>,
1566 }
1567 impl RequestBuilder {
1568 #[doc = "Dashboard Widgets Version"]
1569 pub fn e_tag(mut self, e_tag: impl Into<String>) -> Self {
1570 self.e_tag = Some(e_tag.into());
1571 self
1572 }
1573 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1574 #[doc = ""]
1575 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1576 #[doc = "However, this function can provide more flexibility when required."]
1577 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1578 Box::pin({
1579 let this = self.clone();
1580 async move {
1581 let url = this.url()?;
1582 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1583 if let Some(auth_header) = this
1584 .client
1585 .token_credential()
1586 .http_authorization_header(&this.client.scopes())
1587 .await?
1588 {
1589 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1590 }
1591 if let Some(e_tag) = &this.e_tag {
1592 req.insert_header("etag", e_tag);
1593 }
1594 let req_body = azure_core::EMPTY_BODY;
1595 req.set_body(req_body);
1596 Ok(Response(this.client.send(&mut req).await?))
1597 }
1598 })
1599 }
1600 fn url(&self) -> azure_core::Result<azure_core::Url> {
1601 let mut url = azure_core::Url::parse(&format!(
1602 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}/widgets",
1603 self.client.endpoint(),
1604 &self.organization,
1605 &self.project,
1606 &self.team,
1607 &self.dashboard_id
1608 ))?;
1609 let has_api_version_already = url
1610 .query_pairs()
1611 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1612 if !has_api_version_already {
1613 url.query_pairs_mut()
1614 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1615 }
1616 Ok(url)
1617 }
1618 }
1619 impl std::future::IntoFuture for RequestBuilder {
1620 type Output = azure_core::Result<models::WidgetList>;
1621 type IntoFuture = BoxFuture<'static, azure_core::Result<models::WidgetList>>;
1622 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1623 #[doc = ""]
1624 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1625 #[doc = ""]
1626 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1627 fn into_future(self) -> Self::IntoFuture {
1628 Box::pin(async move { self.send().await?.into_raw_body().await })
1629 }
1630 }
1631 }
1632 pub mod create {
1633 use super::models;
1634 #[cfg(not(target_arch = "wasm32"))]
1635 use futures::future::BoxFuture;
1636 #[cfg(target_arch = "wasm32")]
1637 use futures::future::LocalBoxFuture as BoxFuture;
1638 #[derive(Debug)]
1639 pub struct Response(azure_core::Response);
1640 impl Response {
1641 pub async fn into_raw_body(self) -> azure_core::Result<models::Widget> {
1642 let bytes = self.0.into_raw_body().collect().await?;
1643 let body: models::Widget = serde_json::from_slice(&bytes).map_err(|e| {
1644 azure_core::error::Error::full(
1645 azure_core::error::ErrorKind::DataConversion,
1646 e,
1647 format!(
1648 "Failed to deserialize response:\n{}",
1649 String::from_utf8_lossy(&bytes)
1650 ),
1651 )
1652 })?;
1653 Ok(body)
1654 }
1655 pub fn into_raw_response(self) -> azure_core::Response {
1656 self.0
1657 }
1658 pub fn as_raw_response(&self) -> &azure_core::Response {
1659 &self.0
1660 }
1661 }
1662 impl From<Response> for azure_core::Response {
1663 fn from(rsp: Response) -> Self {
1664 rsp.into_raw_response()
1665 }
1666 }
1667 impl AsRef<azure_core::Response> for Response {
1668 fn as_ref(&self) -> &azure_core::Response {
1669 self.as_raw_response()
1670 }
1671 }
1672 #[derive(Clone)]
1673 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1674 #[doc = r""]
1675 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1676 #[doc = r" parameters can be chained."]
1677 #[doc = r""]
1678 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1679 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1680 #[doc = r" executes the request and returns a `Result` with the parsed"]
1681 #[doc = r" response."]
1682 #[doc = r""]
1683 #[doc = r" If you need lower-level access to the raw response details"]
1684 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1685 #[doc = r" can finalize the request using the"]
1686 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1687 #[doc = r" that resolves to a lower-level [`Response`] value."]
1688 pub struct RequestBuilder {
1689 pub(crate) client: super::super::Client,
1690 pub(crate) organization: String,
1691 pub(crate) body: models::Widget,
1692 pub(crate) project: String,
1693 pub(crate) dashboard_id: String,
1694 pub(crate) team: String,
1695 }
1696 impl RequestBuilder {
1697 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1698 #[doc = ""]
1699 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1700 #[doc = "However, this function can provide more flexibility when required."]
1701 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1702 Box::pin({
1703 let this = self.clone();
1704 async move {
1705 let url = this.url()?;
1706 let mut req = azure_core::Request::new(url, azure_core::Method::Post);
1707 if let Some(auth_header) = this
1708 .client
1709 .token_credential()
1710 .http_authorization_header(&this.client.scopes())
1711 .await?
1712 {
1713 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1714 }
1715 req.insert_header("content-type", "application/json");
1716 let req_body = azure_core::json::to_json(&this.body)?;
1717 req.set_body(req_body);
1718 Ok(Response(this.client.send(&mut req).await?))
1719 }
1720 })
1721 }
1722 fn url(&self) -> azure_core::Result<azure_core::Url> {
1723 let mut url = azure_core::Url::parse(&format!(
1724 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}/widgets",
1725 self.client.endpoint(),
1726 &self.organization,
1727 &self.project,
1728 &self.team,
1729 &self.dashboard_id
1730 ))?;
1731 let has_api_version_already = url
1732 .query_pairs()
1733 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1734 if !has_api_version_already {
1735 url.query_pairs_mut()
1736 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1737 }
1738 Ok(url)
1739 }
1740 }
1741 impl std::future::IntoFuture for RequestBuilder {
1742 type Output = azure_core::Result<models::Widget>;
1743 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Widget>>;
1744 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1745 #[doc = ""]
1746 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1747 #[doc = ""]
1748 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1749 fn into_future(self) -> Self::IntoFuture {
1750 Box::pin(async move { self.send().await?.into_raw_body().await })
1751 }
1752 }
1753 }
1754 pub mod replace_widgets {
1755 use super::models;
1756 #[cfg(not(target_arch = "wasm32"))]
1757 use futures::future::BoxFuture;
1758 #[cfg(target_arch = "wasm32")]
1759 use futures::future::LocalBoxFuture as BoxFuture;
1760 #[derive(Debug)]
1761 pub struct Response(azure_core::Response);
1762 impl Response {
1763 pub async fn into_raw_body(self) -> azure_core::Result<models::WidgetList> {
1764 let bytes = self.0.into_raw_body().collect().await?;
1765 let body: models::WidgetList = serde_json::from_slice(&bytes).map_err(|e| {
1766 azure_core::error::Error::full(
1767 azure_core::error::ErrorKind::DataConversion,
1768 e,
1769 format!(
1770 "Failed to deserialize response:\n{}",
1771 String::from_utf8_lossy(&bytes)
1772 ),
1773 )
1774 })?;
1775 Ok(body)
1776 }
1777 pub fn into_raw_response(self) -> azure_core::Response {
1778 self.0
1779 }
1780 pub fn as_raw_response(&self) -> &azure_core::Response {
1781 &self.0
1782 }
1783 pub fn headers(&self) -> Headers {
1784 Headers(self.0.headers())
1785 }
1786 }
1787 impl From<Response> for azure_core::Response {
1788 fn from(rsp: Response) -> Self {
1789 rsp.into_raw_response()
1790 }
1791 }
1792 impl AsRef<azure_core::Response> for Response {
1793 fn as_ref(&self) -> &azure_core::Response {
1794 self.as_raw_response()
1795 }
1796 }
1797 pub struct Headers<'a>(&'a azure_core::headers::Headers);
1798 impl Headers<'_> {
1799 pub fn e_tag(&self) -> azure_core::Result<&str> {
1800 self.0
1801 .get_str(&azure_core::headers::HeaderName::from_static("etag"))
1802 }
1803 }
1804 #[derive(Clone)]
1805 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1806 #[doc = r""]
1807 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1808 #[doc = r" parameters can be chained."]
1809 #[doc = r""]
1810 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1811 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1812 #[doc = r" executes the request and returns a `Result` with the parsed"]
1813 #[doc = r" response."]
1814 #[doc = r""]
1815 #[doc = r" If you need lower-level access to the raw response details"]
1816 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1817 #[doc = r" can finalize the request using the"]
1818 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1819 #[doc = r" that resolves to a lower-level [`Response`] value."]
1820 pub struct RequestBuilder {
1821 pub(crate) client: super::super::Client,
1822 pub(crate) organization: String,
1823 pub(crate) body: Vec<models::Widget>,
1824 pub(crate) project: String,
1825 pub(crate) dashboard_id: String,
1826 pub(crate) team: String,
1827 pub(crate) e_tag: Option<String>,
1828 }
1829 impl RequestBuilder {
1830 #[doc = "Dashboard Widgets Version"]
1831 pub fn e_tag(mut self, e_tag: impl Into<String>) -> Self {
1832 self.e_tag = Some(e_tag.into());
1833 self
1834 }
1835 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1836 #[doc = ""]
1837 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1838 #[doc = "However, this function can provide more flexibility when required."]
1839 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1840 Box::pin({
1841 let this = self.clone();
1842 async move {
1843 let url = this.url()?;
1844 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
1845 if let Some(auth_header) = this
1846 .client
1847 .token_credential()
1848 .http_authorization_header(&this.client.scopes())
1849 .await?
1850 {
1851 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1852 }
1853 req.insert_header("content-type", "application/json");
1854 let req_body = azure_core::json::to_json(&this.body)?;
1855 if let Some(e_tag) = &this.e_tag {
1856 req.insert_header("etag", e_tag);
1857 }
1858 req.set_body(req_body);
1859 Ok(Response(this.client.send(&mut req).await?))
1860 }
1861 })
1862 }
1863 fn url(&self) -> azure_core::Result<azure_core::Url> {
1864 let mut url = azure_core::Url::parse(&format!(
1865 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}/widgets",
1866 self.client.endpoint(),
1867 &self.organization,
1868 &self.project,
1869 &self.team,
1870 &self.dashboard_id
1871 ))?;
1872 let has_api_version_already = url
1873 .query_pairs()
1874 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1875 if !has_api_version_already {
1876 url.query_pairs_mut()
1877 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1878 }
1879 Ok(url)
1880 }
1881 }
1882 impl std::future::IntoFuture for RequestBuilder {
1883 type Output = azure_core::Result<models::WidgetList>;
1884 type IntoFuture = BoxFuture<'static, azure_core::Result<models::WidgetList>>;
1885 #[doc = "Returns a future that sends the request and returns the parsed response body."]
1886 #[doc = ""]
1887 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1888 #[doc = ""]
1889 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1890 fn into_future(self) -> Self::IntoFuture {
1891 Box::pin(async move { self.send().await?.into_raw_body().await })
1892 }
1893 }
1894 }
1895 pub mod update_widgets {
1896 use super::models;
1897 #[cfg(not(target_arch = "wasm32"))]
1898 use futures::future::BoxFuture;
1899 #[cfg(target_arch = "wasm32")]
1900 use futures::future::LocalBoxFuture as BoxFuture;
1901 #[derive(Debug)]
1902 pub struct Response(azure_core::Response);
1903 impl Response {
1904 pub async fn into_raw_body(self) -> azure_core::Result<models::WidgetList> {
1905 let bytes = self.0.into_raw_body().collect().await?;
1906 let body: models::WidgetList = serde_json::from_slice(&bytes).map_err(|e| {
1907 azure_core::error::Error::full(
1908 azure_core::error::ErrorKind::DataConversion,
1909 e,
1910 format!(
1911 "Failed to deserialize response:\n{}",
1912 String::from_utf8_lossy(&bytes)
1913 ),
1914 )
1915 })?;
1916 Ok(body)
1917 }
1918 pub fn into_raw_response(self) -> azure_core::Response {
1919 self.0
1920 }
1921 pub fn as_raw_response(&self) -> &azure_core::Response {
1922 &self.0
1923 }
1924 pub fn headers(&self) -> Headers {
1925 Headers(self.0.headers())
1926 }
1927 }
1928 impl From<Response> for azure_core::Response {
1929 fn from(rsp: Response) -> Self {
1930 rsp.into_raw_response()
1931 }
1932 }
1933 impl AsRef<azure_core::Response> for Response {
1934 fn as_ref(&self) -> &azure_core::Response {
1935 self.as_raw_response()
1936 }
1937 }
1938 pub struct Headers<'a>(&'a azure_core::headers::Headers);
1939 impl Headers<'_> {
1940 pub fn e_tag(&self) -> azure_core::Result<&str> {
1941 self.0
1942 .get_str(&azure_core::headers::HeaderName::from_static("etag"))
1943 }
1944 }
1945 #[derive(Clone)]
1946 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1947 #[doc = r""]
1948 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1949 #[doc = r" parameters can be chained."]
1950 #[doc = r""]
1951 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1952 #[doc = r" converts the [`RequestBuilder`] into a future,"]
1953 #[doc = r" executes the request and returns a `Result` with the parsed"]
1954 #[doc = r" response."]
1955 #[doc = r""]
1956 #[doc = r" If you need lower-level access to the raw response details"]
1957 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1958 #[doc = r" can finalize the request using the"]
1959 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1960 #[doc = r" that resolves to a lower-level [`Response`] value."]
1961 pub struct RequestBuilder {
1962 pub(crate) client: super::super::Client,
1963 pub(crate) organization: String,
1964 pub(crate) body: Vec<models::Widget>,
1965 pub(crate) project: String,
1966 pub(crate) dashboard_id: String,
1967 pub(crate) team: String,
1968 pub(crate) e_tag: Option<String>,
1969 }
1970 impl RequestBuilder {
1971 #[doc = "Dashboard Widgets Version"]
1972 pub fn e_tag(mut self, e_tag: impl Into<String>) -> Self {
1973 self.e_tag = Some(e_tag.into());
1974 self
1975 }
1976 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1977 #[doc = ""]
1978 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1979 #[doc = "However, this function can provide more flexibility when required."]
1980 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1981 Box::pin({
1982 let this = self.clone();
1983 async move {
1984 let url = this.url()?;
1985 let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
1986 if let Some(auth_header) = this
1987 .client
1988 .token_credential()
1989 .http_authorization_header(&this.client.scopes())
1990 .await?
1991 {
1992 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1993 }
1994 req.insert_header("content-type", "application/json");
1995 let req_body = azure_core::json::to_json(&this.body)?;
1996 if let Some(e_tag) = &this.e_tag {
1997 req.insert_header("etag", e_tag);
1998 }
1999 req.set_body(req_body);
2000 Ok(Response(this.client.send(&mut req).await?))
2001 }
2002 })
2003 }
2004 fn url(&self) -> azure_core::Result<azure_core::Url> {
2005 let mut url = azure_core::Url::parse(&format!(
2006 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}/widgets",
2007 self.client.endpoint(),
2008 &self.organization,
2009 &self.project,
2010 &self.team,
2011 &self.dashboard_id
2012 ))?;
2013 let has_api_version_already = url
2014 .query_pairs()
2015 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
2016 if !has_api_version_already {
2017 url.query_pairs_mut()
2018 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
2019 }
2020 Ok(url)
2021 }
2022 }
2023 impl std::future::IntoFuture for RequestBuilder {
2024 type Output = azure_core::Result<models::WidgetList>;
2025 type IntoFuture = BoxFuture<'static, azure_core::Result<models::WidgetList>>;
2026 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2027 #[doc = ""]
2028 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2029 #[doc = ""]
2030 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2031 fn into_future(self) -> Self::IntoFuture {
2032 Box::pin(async move { self.send().await?.into_raw_body().await })
2033 }
2034 }
2035 }
2036 pub mod get_widget {
2037 use super::models;
2038 #[cfg(not(target_arch = "wasm32"))]
2039 use futures::future::BoxFuture;
2040 #[cfg(target_arch = "wasm32")]
2041 use futures::future::LocalBoxFuture as BoxFuture;
2042 #[derive(Debug)]
2043 pub struct Response(azure_core::Response);
2044 impl Response {
2045 pub async fn into_raw_body(self) -> azure_core::Result<models::Widget> {
2046 let bytes = self.0.into_raw_body().collect().await?;
2047 let body: models::Widget = serde_json::from_slice(&bytes).map_err(|e| {
2048 azure_core::error::Error::full(
2049 azure_core::error::ErrorKind::DataConversion,
2050 e,
2051 format!(
2052 "Failed to deserialize response:\n{}",
2053 String::from_utf8_lossy(&bytes)
2054 ),
2055 )
2056 })?;
2057 Ok(body)
2058 }
2059 pub fn into_raw_response(self) -> azure_core::Response {
2060 self.0
2061 }
2062 pub fn as_raw_response(&self) -> &azure_core::Response {
2063 &self.0
2064 }
2065 }
2066 impl From<Response> for azure_core::Response {
2067 fn from(rsp: Response) -> Self {
2068 rsp.into_raw_response()
2069 }
2070 }
2071 impl AsRef<azure_core::Response> for Response {
2072 fn as_ref(&self) -> &azure_core::Response {
2073 self.as_raw_response()
2074 }
2075 }
2076 #[derive(Clone)]
2077 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2078 #[doc = r""]
2079 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2080 #[doc = r" parameters can be chained."]
2081 #[doc = r""]
2082 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2083 #[doc = r" converts the [`RequestBuilder`] into a future,"]
2084 #[doc = r" executes the request and returns a `Result` with the parsed"]
2085 #[doc = r" response."]
2086 #[doc = r""]
2087 #[doc = r" If you need lower-level access to the raw response details"]
2088 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2089 #[doc = r" can finalize the request using the"]
2090 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2091 #[doc = r" that resolves to a lower-level [`Response`] value."]
2092 pub struct RequestBuilder {
2093 pub(crate) client: super::super::Client,
2094 pub(crate) organization: String,
2095 pub(crate) project: String,
2096 pub(crate) dashboard_id: String,
2097 pub(crate) widget_id: String,
2098 pub(crate) team: String,
2099 }
2100 impl RequestBuilder {
2101 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2102 #[doc = ""]
2103 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2104 #[doc = "However, this function can provide more flexibility when required."]
2105 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2106 Box::pin({
2107 let this = self.clone();
2108 async move {
2109 let url = this.url()?;
2110 let mut req = azure_core::Request::new(url, azure_core::Method::Get);
2111 if let Some(auth_header) = this
2112 .client
2113 .token_credential()
2114 .http_authorization_header(&this.client.scopes())
2115 .await?
2116 {
2117 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
2118 }
2119 let req_body = azure_core::EMPTY_BODY;
2120 req.set_body(req_body);
2121 Ok(Response(this.client.send(&mut req).await?))
2122 }
2123 })
2124 }
2125 fn url(&self) -> azure_core::Result<azure_core::Url> {
2126 let mut url = azure_core::Url::parse(&format!(
2127 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}/widgets/{}",
2128 self.client.endpoint(),
2129 &self.organization,
2130 &self.project,
2131 &self.team,
2132 &self.dashboard_id,
2133 &self.widget_id
2134 ))?;
2135 let has_api_version_already = url
2136 .query_pairs()
2137 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
2138 if !has_api_version_already {
2139 url.query_pairs_mut()
2140 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
2141 }
2142 Ok(url)
2143 }
2144 }
2145 impl std::future::IntoFuture for RequestBuilder {
2146 type Output = azure_core::Result<models::Widget>;
2147 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Widget>>;
2148 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2149 #[doc = ""]
2150 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2151 #[doc = ""]
2152 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2153 fn into_future(self) -> Self::IntoFuture {
2154 Box::pin(async move { self.send().await?.into_raw_body().await })
2155 }
2156 }
2157 }
2158 pub mod replace_widget {
2159 use super::models;
2160 #[cfg(not(target_arch = "wasm32"))]
2161 use futures::future::BoxFuture;
2162 #[cfg(target_arch = "wasm32")]
2163 use futures::future::LocalBoxFuture as BoxFuture;
2164 #[derive(Debug)]
2165 pub struct Response(azure_core::Response);
2166 impl Response {
2167 pub async fn into_raw_body(self) -> azure_core::Result<models::Widget> {
2168 let bytes = self.0.into_raw_body().collect().await?;
2169 let body: models::Widget = serde_json::from_slice(&bytes).map_err(|e| {
2170 azure_core::error::Error::full(
2171 azure_core::error::ErrorKind::DataConversion,
2172 e,
2173 format!(
2174 "Failed to deserialize response:\n{}",
2175 String::from_utf8_lossy(&bytes)
2176 ),
2177 )
2178 })?;
2179 Ok(body)
2180 }
2181 pub fn into_raw_response(self) -> azure_core::Response {
2182 self.0
2183 }
2184 pub fn as_raw_response(&self) -> &azure_core::Response {
2185 &self.0
2186 }
2187 }
2188 impl From<Response> for azure_core::Response {
2189 fn from(rsp: Response) -> Self {
2190 rsp.into_raw_response()
2191 }
2192 }
2193 impl AsRef<azure_core::Response> for Response {
2194 fn as_ref(&self) -> &azure_core::Response {
2195 self.as_raw_response()
2196 }
2197 }
2198 #[derive(Clone)]
2199 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2200 #[doc = r""]
2201 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2202 #[doc = r" parameters can be chained."]
2203 #[doc = r""]
2204 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2205 #[doc = r" converts the [`RequestBuilder`] into a future,"]
2206 #[doc = r" executes the request and returns a `Result` with the parsed"]
2207 #[doc = r" response."]
2208 #[doc = r""]
2209 #[doc = r" If you need lower-level access to the raw response details"]
2210 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2211 #[doc = r" can finalize the request using the"]
2212 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2213 #[doc = r" that resolves to a lower-level [`Response`] value."]
2214 pub struct RequestBuilder {
2215 pub(crate) client: super::super::Client,
2216 pub(crate) organization: String,
2217 pub(crate) body: models::Widget,
2218 pub(crate) project: String,
2219 pub(crate) dashboard_id: String,
2220 pub(crate) widget_id: String,
2221 pub(crate) team: String,
2222 }
2223 impl RequestBuilder {
2224 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2225 #[doc = ""]
2226 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2227 #[doc = "However, this function can provide more flexibility when required."]
2228 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2229 Box::pin({
2230 let this = self.clone();
2231 async move {
2232 let url = this.url()?;
2233 let mut req = azure_core::Request::new(url, azure_core::Method::Put);
2234 if let Some(auth_header) = this
2235 .client
2236 .token_credential()
2237 .http_authorization_header(&this.client.scopes())
2238 .await?
2239 {
2240 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
2241 }
2242 req.insert_header("content-type", "application/json");
2243 let req_body = azure_core::json::to_json(&this.body)?;
2244 req.set_body(req_body);
2245 Ok(Response(this.client.send(&mut req).await?))
2246 }
2247 })
2248 }
2249 fn url(&self) -> azure_core::Result<azure_core::Url> {
2250 let mut url = azure_core::Url::parse(&format!(
2251 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}/widgets/{}",
2252 self.client.endpoint(),
2253 &self.organization,
2254 &self.project,
2255 &self.team,
2256 &self.dashboard_id,
2257 &self.widget_id
2258 ))?;
2259 let has_api_version_already = url
2260 .query_pairs()
2261 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
2262 if !has_api_version_already {
2263 url.query_pairs_mut()
2264 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
2265 }
2266 Ok(url)
2267 }
2268 }
2269 impl std::future::IntoFuture for RequestBuilder {
2270 type Output = azure_core::Result<models::Widget>;
2271 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Widget>>;
2272 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2273 #[doc = ""]
2274 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2275 #[doc = ""]
2276 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2277 fn into_future(self) -> Self::IntoFuture {
2278 Box::pin(async move { self.send().await?.into_raw_body().await })
2279 }
2280 }
2281 }
2282 pub mod update_widget {
2283 use super::models;
2284 #[cfg(not(target_arch = "wasm32"))]
2285 use futures::future::BoxFuture;
2286 #[cfg(target_arch = "wasm32")]
2287 use futures::future::LocalBoxFuture as BoxFuture;
2288 #[derive(Debug)]
2289 pub struct Response(azure_core::Response);
2290 impl Response {
2291 pub async fn into_raw_body(self) -> azure_core::Result<models::Widget> {
2292 let bytes = self.0.into_raw_body().collect().await?;
2293 let body: models::Widget = serde_json::from_slice(&bytes).map_err(|e| {
2294 azure_core::error::Error::full(
2295 azure_core::error::ErrorKind::DataConversion,
2296 e,
2297 format!(
2298 "Failed to deserialize response:\n{}",
2299 String::from_utf8_lossy(&bytes)
2300 ),
2301 )
2302 })?;
2303 Ok(body)
2304 }
2305 pub fn into_raw_response(self) -> azure_core::Response {
2306 self.0
2307 }
2308 pub fn as_raw_response(&self) -> &azure_core::Response {
2309 &self.0
2310 }
2311 }
2312 impl From<Response> for azure_core::Response {
2313 fn from(rsp: Response) -> Self {
2314 rsp.into_raw_response()
2315 }
2316 }
2317 impl AsRef<azure_core::Response> for Response {
2318 fn as_ref(&self) -> &azure_core::Response {
2319 self.as_raw_response()
2320 }
2321 }
2322 #[derive(Clone)]
2323 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2324 #[doc = r""]
2325 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2326 #[doc = r" parameters can be chained."]
2327 #[doc = r""]
2328 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2329 #[doc = r" converts the [`RequestBuilder`] into a future,"]
2330 #[doc = r" executes the request and returns a `Result` with the parsed"]
2331 #[doc = r" response."]
2332 #[doc = r""]
2333 #[doc = r" If you need lower-level access to the raw response details"]
2334 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2335 #[doc = r" can finalize the request using the"]
2336 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2337 #[doc = r" that resolves to a lower-level [`Response`] value."]
2338 pub struct RequestBuilder {
2339 pub(crate) client: super::super::Client,
2340 pub(crate) organization: String,
2341 pub(crate) body: models::Widget,
2342 pub(crate) project: String,
2343 pub(crate) dashboard_id: String,
2344 pub(crate) widget_id: String,
2345 pub(crate) team: String,
2346 }
2347 impl RequestBuilder {
2348 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2349 #[doc = ""]
2350 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2351 #[doc = "However, this function can provide more flexibility when required."]
2352 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2353 Box::pin({
2354 let this = self.clone();
2355 async move {
2356 let url = this.url()?;
2357 let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
2358 if let Some(auth_header) = this
2359 .client
2360 .token_credential()
2361 .http_authorization_header(&this.client.scopes())
2362 .await?
2363 {
2364 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
2365 }
2366 req.insert_header("content-type", "application/json");
2367 let req_body = azure_core::json::to_json(&this.body)?;
2368 req.set_body(req_body);
2369 Ok(Response(this.client.send(&mut req).await?))
2370 }
2371 })
2372 }
2373 fn url(&self) -> azure_core::Result<azure_core::Url> {
2374 let mut url = azure_core::Url::parse(&format!(
2375 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}/widgets/{}",
2376 self.client.endpoint(),
2377 &self.organization,
2378 &self.project,
2379 &self.team,
2380 &self.dashboard_id,
2381 &self.widget_id
2382 ))?;
2383 let has_api_version_already = url
2384 .query_pairs()
2385 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
2386 if !has_api_version_already {
2387 url.query_pairs_mut()
2388 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
2389 }
2390 Ok(url)
2391 }
2392 }
2393 impl std::future::IntoFuture for RequestBuilder {
2394 type Output = azure_core::Result<models::Widget>;
2395 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Widget>>;
2396 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2397 #[doc = ""]
2398 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2399 #[doc = ""]
2400 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2401 fn into_future(self) -> Self::IntoFuture {
2402 Box::pin(async move { self.send().await?.into_raw_body().await })
2403 }
2404 }
2405 }
2406 pub mod delete {
2407 use super::models;
2408 #[cfg(not(target_arch = "wasm32"))]
2409 use futures::future::BoxFuture;
2410 #[cfg(target_arch = "wasm32")]
2411 use futures::future::LocalBoxFuture as BoxFuture;
2412 #[derive(Debug)]
2413 pub struct Response(azure_core::Response);
2414 impl Response {
2415 pub async fn into_raw_body(self) -> azure_core::Result<models::Dashboard> {
2416 let bytes = self.0.into_raw_body().collect().await?;
2417 let body: models::Dashboard = serde_json::from_slice(&bytes).map_err(|e| {
2418 azure_core::error::Error::full(
2419 azure_core::error::ErrorKind::DataConversion,
2420 e,
2421 format!(
2422 "Failed to deserialize response:\n{}",
2423 String::from_utf8_lossy(&bytes)
2424 ),
2425 )
2426 })?;
2427 Ok(body)
2428 }
2429 pub fn into_raw_response(self) -> azure_core::Response {
2430 self.0
2431 }
2432 pub fn as_raw_response(&self) -> &azure_core::Response {
2433 &self.0
2434 }
2435 }
2436 impl From<Response> for azure_core::Response {
2437 fn from(rsp: Response) -> Self {
2438 rsp.into_raw_response()
2439 }
2440 }
2441 impl AsRef<azure_core::Response> for Response {
2442 fn as_ref(&self) -> &azure_core::Response {
2443 self.as_raw_response()
2444 }
2445 }
2446 #[derive(Clone)]
2447 #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
2448 #[doc = r""]
2449 #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
2450 #[doc = r" parameters can be chained."]
2451 #[doc = r""]
2452 #[doc = r" To finalize and submit the request, invoke `.await`, which"]
2453 #[doc = r" converts the [`RequestBuilder`] into a future,"]
2454 #[doc = r" executes the request and returns a `Result` with the parsed"]
2455 #[doc = r" response."]
2456 #[doc = r""]
2457 #[doc = r" If you need lower-level access to the raw response details"]
2458 #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
2459 #[doc = r" can finalize the request using the"]
2460 #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
2461 #[doc = r" that resolves to a lower-level [`Response`] value."]
2462 pub struct RequestBuilder {
2463 pub(crate) client: super::super::Client,
2464 pub(crate) organization: String,
2465 pub(crate) project: String,
2466 pub(crate) dashboard_id: String,
2467 pub(crate) widget_id: String,
2468 pub(crate) team: String,
2469 }
2470 impl RequestBuilder {
2471 #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
2472 #[doc = ""]
2473 #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
2474 #[doc = "However, this function can provide more flexibility when required."]
2475 pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
2476 Box::pin({
2477 let this = self.clone();
2478 async move {
2479 let url = this.url()?;
2480 let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
2481 if let Some(auth_header) = this
2482 .client
2483 .token_credential()
2484 .http_authorization_header(&this.client.scopes())
2485 .await?
2486 {
2487 req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
2488 }
2489 let req_body = azure_core::EMPTY_BODY;
2490 req.set_body(req_body);
2491 Ok(Response(this.client.send(&mut req).await?))
2492 }
2493 })
2494 }
2495 fn url(&self) -> azure_core::Result<azure_core::Url> {
2496 let mut url = azure_core::Url::parse(&format!(
2497 "{}/{}/{}/{}/_apis/dashboard/dashboards/{}/widgets/{}",
2498 self.client.endpoint(),
2499 &self.organization,
2500 &self.project,
2501 &self.team,
2502 &self.dashboard_id,
2503 &self.widget_id
2504 ))?;
2505 let has_api_version_already = url
2506 .query_pairs()
2507 .any(|(k, _)| k == azure_core::query_param::API_VERSION);
2508 if !has_api_version_already {
2509 url.query_pairs_mut()
2510 .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
2511 }
2512 Ok(url)
2513 }
2514 }
2515 impl std::future::IntoFuture for RequestBuilder {
2516 type Output = azure_core::Result<models::Dashboard>;
2517 type IntoFuture = BoxFuture<'static, azure_core::Result<models::Dashboard>>;
2518 #[doc = "Returns a future that sends the request and returns the parsed response body."]
2519 #[doc = ""]
2520 #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
2521 #[doc = ""]
2522 #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
2523 fn into_future(self) -> Self::IntoFuture {
2524 Box::pin(async move { self.send().await?.into_raw_body().await })
2525 }
2526 }
2527 }
2528}