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