azure_devops_rust_api/favorite/
mod.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3#![allow(unused_mut)]
4#![allow(unused_variables)]
5#![allow(unused_imports)]
6#![allow(clippy::redundant_clone)]
7#![allow(clippy::too_many_arguments)]
8#![allow(clippy::module_inception)]
9pub mod models;
10#[derive(Clone)]
11pub struct Client {
12    endpoint: azure_core::Url,
13    credential: crate::Credential,
14    scopes: Vec<String>,
15    pipeline: azure_core::Pipeline,
16}
17#[derive(Clone)]
18pub struct ClientBuilder {
19    credential: crate::Credential,
20    endpoint: Option<azure_core::Url>,
21    scopes: Option<Vec<String>>,
22    options: azure_core::ClientOptions,
23}
24azure_core::static_url!(DEFAULT_ENDPOINT, "https://dev.azure.com");
25impl ClientBuilder {
26    #[doc = "Create a new instance of `ClientBuilder`."]
27    #[must_use]
28    pub fn new(credential: crate::Credential) -> Self {
29        Self {
30            credential,
31            endpoint: None,
32            scopes: None,
33            options: azure_core::ClientOptions::default(),
34        }
35    }
36    #[doc = "Set the endpoint."]
37    #[must_use]
38    pub fn endpoint(mut self, endpoint: impl Into<azure_core::Url>) -> Self {
39        self.endpoint = Some(endpoint.into());
40        self
41    }
42    #[doc = "Set the scopes."]
43    #[must_use]
44    pub fn scopes(mut self, scopes: &[&str]) -> Self {
45        self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
46        self
47    }
48    #[doc = "Set the retry options."]
49    #[must_use]
50    pub fn retry(mut self, retry: impl Into<azure_core::RetryOptions>) -> Self {
51        self.options.retry = Some(retry.into());
52        self
53    }
54    #[doc = "Set the transport options."]
55    #[must_use]
56    pub fn transport(mut self, transport: impl Into<azure_core::TransportOptions>) -> Self {
57        self.options.transport = Some(transport.into());
58        self
59    }
60    #[doc = "Set per-call policies."]
61    #[must_use]
62    pub fn per_call_policies(
63        mut self,
64        policies: impl Into<Vec<std::sync::Arc<dyn azure_core::Policy>>>,
65    ) -> Self {
66        self.options.per_call_policies = policies.into();
67        self
68    }
69    #[doc = "Set per-try policies."]
70    #[must_use]
71    pub fn per_try_policies(
72        mut self,
73        policies: impl Into<Vec<std::sync::Arc<dyn azure_core::Policy>>>,
74    ) -> Self {
75        self.options.per_try_policies = policies.into();
76        self
77    }
78    #[doc = "Convert the builder into a `Client` instance."]
79    pub fn build(self) -> Client {
80        let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
81        let scopes = self
82            .scopes
83            .unwrap_or_else(|| vec![crate::ADO_SCOPE.to_string()]);
84        Client::new(endpoint, self.credential, scopes, self.options)
85    }
86}
87impl Client {
88    pub(crate) fn endpoint(&self) -> &azure_core::Url {
89        &self.endpoint
90    }
91    pub(crate) fn token_credential(&self) -> &crate::Credential {
92        &self.credential
93    }
94    pub(crate) fn scopes(&self) -> Vec<&str> {
95        self.scopes.iter().map(String::as_str).collect()
96    }
97    pub(crate) async fn send(
98        &self,
99        request: &mut azure_core::Request,
100    ) -> azure_core::Result<azure_core::Response> {
101        let context = azure_core::Context::default();
102        self.pipeline.send(&context, request).await
103    }
104    #[doc = "Create a new `ClientBuilder`."]
105    #[must_use]
106    pub fn builder(credential: crate::Credential) -> ClientBuilder {
107        ClientBuilder::new(credential)
108    }
109    #[doc = "Create a new `Client`."]
110    #[must_use]
111    pub fn new(
112        endpoint: impl Into<azure_core::Url>,
113        credential: crate::Credential,
114        scopes: Vec<String>,
115        options: azure_core::ClientOptions,
116    ) -> Self {
117        let endpoint = endpoint.into();
118        let pipeline = azure_core::Pipeline::new(
119            option_env!("CARGO_PKG_NAME"),
120            option_env!("CARGO_PKG_VERSION"),
121            options,
122            Vec::new(),
123            Vec::new(),
124        );
125        Self {
126            endpoint,
127            credential,
128            scopes,
129            pipeline,
130        }
131    }
132    pub fn favorites_client(&self) -> favorites::Client {
133        favorites::Client(self.clone())
134    }
135}
136pub mod favorites {
137    use super::models;
138    #[cfg(not(target_arch = "wasm32"))]
139    use futures::future::BoxFuture;
140    #[cfg(target_arch = "wasm32")]
141    use futures::future::LocalBoxFuture as BoxFuture;
142    pub struct Client(pub(crate) super::Client);
143    impl Client {
144        #[doc = "Arguments:"]
145        #[doc = "* `organization`: The name of the Azure DevOps organization."]
146        pub fn get_favorites_of_owner(
147            &self,
148            organization: impl Into<String>,
149            owner_scope_type: impl Into<String>,
150            owner_scope_id: impl Into<String>,
151        ) -> get_favorites_of_owner::RequestBuilder {
152            get_favorites_of_owner::RequestBuilder {
153                client: self.0.clone(),
154                organization: organization.into(),
155                owner_scope_type: owner_scope_type.into(),
156                owner_scope_id: owner_scope_id.into(),
157                artifact_type: None,
158                artifact_scope_type: None,
159                artifact_scope_id: None,
160                include_extended_details: None,
161            }
162        }
163        #[doc = "Arguments:"]
164        #[doc = "* `organization`: The name of the Azure DevOps organization."]
165        pub fn create_favorite_of_owner(
166            &self,
167            organization: impl Into<String>,
168            body: impl Into<models::FavoriteCreateParameters>,
169            owner_scope_type: impl Into<String>,
170            owner_scope_id: impl Into<String>,
171        ) -> create_favorite_of_owner::RequestBuilder {
172            create_favorite_of_owner::RequestBuilder {
173                client: self.0.clone(),
174                organization: organization.into(),
175                body: body.into(),
176                owner_scope_type: owner_scope_type.into(),
177                owner_scope_id: owner_scope_id.into(),
178            }
179        }
180        #[doc = "Arguments:"]
181        #[doc = "* `organization`: The name of the Azure DevOps organization."]
182        pub fn get_favorite_by_artifact(
183            &self,
184            organization: impl Into<String>,
185            artifact_type: impl Into<String>,
186            artifact_id: impl Into<String>,
187            artifact_scope_type: impl Into<String>,
188        ) -> get_favorite_by_artifact::RequestBuilder {
189            get_favorite_by_artifact::RequestBuilder {
190                client: self.0.clone(),
191                organization: organization.into(),
192                artifact_type: artifact_type.into(),
193                artifact_id: artifact_id.into(),
194                artifact_scope_type: artifact_scope_type.into(),
195                artifact_scope_id: None,
196                include_extended_details: None,
197            }
198        }
199        #[doc = "Arguments:"]
200        #[doc = "* `organization`: The name of the Azure DevOps organization."]
201        pub fn delete_favorite_of_owner_by_id(
202            &self,
203            organization: impl Into<String>,
204            favorite_id: impl Into<String>,
205            owner_scope_type: impl Into<String>,
206            owner_scope_id: impl Into<String>,
207            artifact_type: impl Into<String>,
208            artifact_scope_type: impl Into<String>,
209        ) -> delete_favorite_of_owner_by_id::RequestBuilder {
210            delete_favorite_of_owner_by_id::RequestBuilder {
211                client: self.0.clone(),
212                organization: organization.into(),
213                favorite_id: favorite_id.into(),
214                owner_scope_type: owner_scope_type.into(),
215                owner_scope_id: owner_scope_id.into(),
216                artifact_type: artifact_type.into(),
217                artifact_scope_type: artifact_scope_type.into(),
218                artifact_scope_id: None,
219            }
220        }
221        #[doc = "Arguments:"]
222        #[doc = "* `organization`: The name of the Azure DevOps organization."]
223        pub fn get_favorite_of_owner_by_id(
224            &self,
225            organization: impl Into<String>,
226            favorite_id: impl Into<String>,
227            owner_scope_type: impl Into<String>,
228            owner_scope_id: impl Into<String>,
229            artifact_scope_type: impl Into<String>,
230            artifact_type: impl Into<String>,
231        ) -> get_favorite_of_owner_by_id::RequestBuilder {
232            get_favorite_of_owner_by_id::RequestBuilder {
233                client: self.0.clone(),
234                organization: organization.into(),
235                favorite_id: favorite_id.into(),
236                owner_scope_type: owner_scope_type.into(),
237                owner_scope_id: owner_scope_id.into(),
238                artifact_scope_type: artifact_scope_type.into(),
239                artifact_type: artifact_type.into(),
240                artifact_scope_id: None,
241                include_extended_details: None,
242            }
243        }
244        #[doc = "Arguments:"]
245        #[doc = "* `organization`: The name of the Azure DevOps organization."]
246        pub fn get_favorites(
247            &self,
248            organization: impl Into<String>,
249        ) -> get_favorites::RequestBuilder {
250            get_favorites::RequestBuilder {
251                client: self.0.clone(),
252                organization: organization.into(),
253                artifact_type: None,
254                artifact_scope_type: None,
255                artifact_scope_id: None,
256                include_extended_details: None,
257            }
258        }
259        #[doc = "Arguments:"]
260        #[doc = "* `organization`: The name of the Azure DevOps organization."]
261        pub fn create_favorite(
262            &self,
263            organization: impl Into<String>,
264            body: impl Into<models::FavoriteCreateParameters>,
265        ) -> create_favorite::RequestBuilder {
266            create_favorite::RequestBuilder {
267                client: self.0.clone(),
268                organization: organization.into(),
269                body: body.into(),
270            }
271        }
272        #[doc = "Arguments:"]
273        #[doc = "* `organization`: The name of the Azure DevOps organization."]
274        pub fn get_favorite_by_id(
275            &self,
276            organization: impl Into<String>,
277            favorite_id: impl Into<String>,
278            artifact_scope_type: impl Into<String>,
279            artifact_type: impl Into<String>,
280        ) -> get_favorite_by_id::RequestBuilder {
281            get_favorite_by_id::RequestBuilder {
282                client: self.0.clone(),
283                organization: organization.into(),
284                favorite_id: favorite_id.into(),
285                artifact_scope_type: artifact_scope_type.into(),
286                artifact_type: artifact_type.into(),
287                artifact_scope_id: None,
288                include_extended_details: None,
289            }
290        }
291        #[doc = "Arguments:"]
292        #[doc = "* `organization`: The name of the Azure DevOps organization."]
293        pub fn delete_favorite_by_id(
294            &self,
295            organization: impl Into<String>,
296            favorite_id: impl Into<String>,
297            artifact_type: impl Into<String>,
298            artifact_scope_type: impl Into<String>,
299        ) -> delete_favorite_by_id::RequestBuilder {
300            delete_favorite_by_id::RequestBuilder {
301                client: self.0.clone(),
302                organization: organization.into(),
303                favorite_id: favorite_id.into(),
304                artifact_type: artifact_type.into(),
305                artifact_scope_type: artifact_scope_type.into(),
306                artifact_scope_id: None,
307            }
308        }
309    }
310    pub mod get_favorites_of_owner {
311        use super::models;
312        #[cfg(not(target_arch = "wasm32"))]
313        use futures::future::BoxFuture;
314        #[cfg(target_arch = "wasm32")]
315        use futures::future::LocalBoxFuture as BoxFuture;
316        #[derive(Debug)]
317        pub struct Response(azure_core::Response);
318        impl Response {
319            pub async fn into_raw_body(self) -> azure_core::Result<models::FavoriteList> {
320                let bytes = self.0.into_raw_body().collect().await?;
321                let body: models::FavoriteList = serde_json::from_slice(&bytes).map_err(|e| {
322                    azure_core::error::Error::full(
323                        azure_core::error::ErrorKind::DataConversion,
324                        e,
325                        format!(
326                            "Failed to deserialize response:\n{}",
327                            String::from_utf8_lossy(&bytes)
328                        ),
329                    )
330                })?;
331                Ok(body)
332            }
333            pub fn into_raw_response(self) -> azure_core::Response {
334                self.0
335            }
336            pub fn as_raw_response(&self) -> &azure_core::Response {
337                &self.0
338            }
339        }
340        impl From<Response> for azure_core::Response {
341            fn from(rsp: Response) -> Self {
342                rsp.into_raw_response()
343            }
344        }
345        impl AsRef<azure_core::Response> for Response {
346            fn as_ref(&self) -> &azure_core::Response {
347                self.as_raw_response()
348            }
349        }
350        #[derive(Clone)]
351        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
352        #[doc = r""]
353        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
354        #[doc = r" parameters can be chained."]
355        #[doc = r""]
356        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
357        #[doc = r" converts the [`RequestBuilder`] into a future,"]
358        #[doc = r" executes the request and returns a `Result` with the parsed"]
359        #[doc = r" response."]
360        #[doc = r""]
361        #[doc = r" If you need lower-level access to the raw response details"]
362        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
363        #[doc = r" can finalize the request using the"]
364        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
365        #[doc = r" that resolves to a lower-level [`Response`] value."]
366        pub struct RequestBuilder {
367            pub(crate) client: super::super::Client,
368            pub(crate) organization: String,
369            pub(crate) owner_scope_type: String,
370            pub(crate) owner_scope_id: String,
371            pub(crate) artifact_type: Option<String>,
372            pub(crate) artifact_scope_type: Option<String>,
373            pub(crate) artifact_scope_id: Option<String>,
374            pub(crate) include_extended_details: Option<bool>,
375        }
376        impl RequestBuilder {
377            pub fn artifact_type(mut self, artifact_type: impl Into<String>) -> Self {
378                self.artifact_type = Some(artifact_type.into());
379                self
380            }
381            pub fn artifact_scope_type(mut self, artifact_scope_type: impl Into<String>) -> Self {
382                self.artifact_scope_type = Some(artifact_scope_type.into());
383                self
384            }
385            pub fn artifact_scope_id(mut self, artifact_scope_id: impl Into<String>) -> Self {
386                self.artifact_scope_id = Some(artifact_scope_id.into());
387                self
388            }
389            pub fn include_extended_details(mut self, include_extended_details: bool) -> Self {
390                self.include_extended_details = Some(include_extended_details);
391                self
392            }
393            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
394            #[doc = ""]
395            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
396            #[doc = "However, this function can provide more flexibility when required."]
397            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
398                Box::pin({
399                    let this = self.clone();
400                    async move {
401                        let url = this.url()?;
402                        let mut req = azure_core::Request::new(url, azure_core::Method::Get);
403                        if let Some(auth_header) = this
404                            .client
405                            .token_credential()
406                            .http_authorization_header(&this.client.scopes())
407                            .await?
408                        {
409                            req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
410                        }
411                        let owner_scope_type = &this.owner_scope_type;
412                        req.url_mut()
413                            .query_pairs_mut()
414                            .append_pair("ownerScopeType", owner_scope_type);
415                        let owner_scope_id = &this.owner_scope_id;
416                        req.url_mut()
417                            .query_pairs_mut()
418                            .append_pair("ownerScopeId", owner_scope_id);
419                        if let Some(artifact_type) = &this.artifact_type {
420                            req.url_mut()
421                                .query_pairs_mut()
422                                .append_pair("artifactType", artifact_type);
423                        }
424                        if let Some(artifact_scope_type) = &this.artifact_scope_type {
425                            req.url_mut()
426                                .query_pairs_mut()
427                                .append_pair("artifactScopeType", artifact_scope_type);
428                        }
429                        if let Some(artifact_scope_id) = &this.artifact_scope_id {
430                            req.url_mut()
431                                .query_pairs_mut()
432                                .append_pair("artifactScopeId", artifact_scope_id);
433                        }
434                        if let Some(include_extended_details) = &this.include_extended_details {
435                            req.url_mut().query_pairs_mut().append_pair(
436                                "includeExtendedDetails",
437                                &include_extended_details.to_string(),
438                            );
439                        }
440                        let req_body = azure_core::EMPTY_BODY;
441                        req.set_body(req_body);
442                        Ok(Response(this.client.send(&mut req).await?))
443                    }
444                })
445            }
446            fn url(&self) -> azure_core::Result<azure_core::Url> {
447                let mut url = azure_core::Url::parse(&format!(
448                    "{}/{}/_apis/favorite/favorites?ownerScopeType={}&ownerScopeId={}",
449                    self.client.endpoint(),
450                    &self.organization,
451                    &self.owner_scope_type,
452                    &self.owner_scope_id
453                ))?;
454                let has_api_version_already = url
455                    .query_pairs()
456                    .any(|(k, _)| k == azure_core::query_param::API_VERSION);
457                if !has_api_version_already {
458                    url.query_pairs_mut()
459                        .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
460                }
461                Ok(url)
462            }
463        }
464        impl std::future::IntoFuture for RequestBuilder {
465            type Output = azure_core::Result<models::FavoriteList>;
466            type IntoFuture = BoxFuture<'static, azure_core::Result<models::FavoriteList>>;
467            #[doc = "Returns a future that sends the request and returns the parsed response body."]
468            #[doc = ""]
469            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
470            #[doc = ""]
471            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
472            fn into_future(self) -> Self::IntoFuture {
473                Box::pin(async move { self.send().await?.into_raw_body().await })
474            }
475        }
476    }
477    pub mod create_favorite_of_owner {
478        use super::models;
479        #[cfg(not(target_arch = "wasm32"))]
480        use futures::future::BoxFuture;
481        #[cfg(target_arch = "wasm32")]
482        use futures::future::LocalBoxFuture as BoxFuture;
483        #[derive(Debug)]
484        pub struct Response(azure_core::Response);
485        impl Response {
486            pub async fn into_raw_body(self) -> azure_core::Result<models::Favorite> {
487                let bytes = self.0.into_raw_body().collect().await?;
488                let body: models::Favorite = serde_json::from_slice(&bytes).map_err(|e| {
489                    azure_core::error::Error::full(
490                        azure_core::error::ErrorKind::DataConversion,
491                        e,
492                        format!(
493                            "Failed to deserialize response:\n{}",
494                            String::from_utf8_lossy(&bytes)
495                        ),
496                    )
497                })?;
498                Ok(body)
499            }
500            pub fn into_raw_response(self) -> azure_core::Response {
501                self.0
502            }
503            pub fn as_raw_response(&self) -> &azure_core::Response {
504                &self.0
505            }
506        }
507        impl From<Response> for azure_core::Response {
508            fn from(rsp: Response) -> Self {
509                rsp.into_raw_response()
510            }
511        }
512        impl AsRef<azure_core::Response> for Response {
513            fn as_ref(&self) -> &azure_core::Response {
514                self.as_raw_response()
515            }
516        }
517        #[derive(Clone)]
518        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
519        #[doc = r""]
520        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
521        #[doc = r" parameters can be chained."]
522        #[doc = r""]
523        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
524        #[doc = r" converts the [`RequestBuilder`] into a future,"]
525        #[doc = r" executes the request and returns a `Result` with the parsed"]
526        #[doc = r" response."]
527        #[doc = r""]
528        #[doc = r" If you need lower-level access to the raw response details"]
529        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
530        #[doc = r" can finalize the request using the"]
531        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
532        #[doc = r" that resolves to a lower-level [`Response`] value."]
533        pub struct RequestBuilder {
534            pub(crate) client: super::super::Client,
535            pub(crate) organization: String,
536            pub(crate) body: models::FavoriteCreateParameters,
537            pub(crate) owner_scope_type: String,
538            pub(crate) owner_scope_id: String,
539        }
540        impl RequestBuilder {
541            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
542            #[doc = ""]
543            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
544            #[doc = "However, this function can provide more flexibility when required."]
545            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
546                Box::pin({
547                    let this = self.clone();
548                    async move {
549                        let url = this.url()?;
550                        let mut req = azure_core::Request::new(url, azure_core::Method::Post);
551                        if let Some(auth_header) = this
552                            .client
553                            .token_credential()
554                            .http_authorization_header(&this.client.scopes())
555                            .await?
556                        {
557                            req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
558                        }
559                        req.insert_header("content-type", "application/json");
560                        let req_body = azure_core::json::to_json(&this.body)?;
561                        let owner_scope_type = &this.owner_scope_type;
562                        req.url_mut()
563                            .query_pairs_mut()
564                            .append_pair("ownerScopeType", owner_scope_type);
565                        let owner_scope_id = &this.owner_scope_id;
566                        req.url_mut()
567                            .query_pairs_mut()
568                            .append_pair("ownerScopeId", owner_scope_id);
569                        req.set_body(req_body);
570                        Ok(Response(this.client.send(&mut req).await?))
571                    }
572                })
573            }
574            fn url(&self) -> azure_core::Result<azure_core::Url> {
575                let mut url = azure_core::Url::parse(&format!(
576                    "{}/{}/_apis/favorite/favorites?ownerScopeType={}&ownerScopeId={}",
577                    self.client.endpoint(),
578                    &self.organization,
579                    &self.owner_scope_type,
580                    &self.owner_scope_id
581                ))?;
582                let has_api_version_already = url
583                    .query_pairs()
584                    .any(|(k, _)| k == azure_core::query_param::API_VERSION);
585                if !has_api_version_already {
586                    url.query_pairs_mut()
587                        .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
588                }
589                Ok(url)
590            }
591        }
592        impl std::future::IntoFuture for RequestBuilder {
593            type Output = azure_core::Result<models::Favorite>;
594            type IntoFuture = BoxFuture<'static, azure_core::Result<models::Favorite>>;
595            #[doc = "Returns a future that sends the request and returns the parsed response body."]
596            #[doc = ""]
597            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
598            #[doc = ""]
599            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
600            fn into_future(self) -> Self::IntoFuture {
601                Box::pin(async move { self.send().await?.into_raw_body().await })
602            }
603        }
604    }
605    pub mod get_favorite_by_artifact {
606        use super::models;
607        #[cfg(not(target_arch = "wasm32"))]
608        use futures::future::BoxFuture;
609        #[cfg(target_arch = "wasm32")]
610        use futures::future::LocalBoxFuture as BoxFuture;
611        #[derive(Debug)]
612        pub struct Response(azure_core::Response);
613        impl Response {
614            pub async fn into_raw_body(self) -> azure_core::Result<models::Favorite> {
615                let bytes = self.0.into_raw_body().collect().await?;
616                let body: models::Favorite = serde_json::from_slice(&bytes).map_err(|e| {
617                    azure_core::error::Error::full(
618                        azure_core::error::ErrorKind::DataConversion,
619                        e,
620                        format!(
621                            "Failed to deserialize response:\n{}",
622                            String::from_utf8_lossy(&bytes)
623                        ),
624                    )
625                })?;
626                Ok(body)
627            }
628            pub fn into_raw_response(self) -> azure_core::Response {
629                self.0
630            }
631            pub fn as_raw_response(&self) -> &azure_core::Response {
632                &self.0
633            }
634        }
635        impl From<Response> for azure_core::Response {
636            fn from(rsp: Response) -> Self {
637                rsp.into_raw_response()
638            }
639        }
640        impl AsRef<azure_core::Response> for Response {
641            fn as_ref(&self) -> &azure_core::Response {
642                self.as_raw_response()
643            }
644        }
645        #[derive(Clone)]
646        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
647        #[doc = r""]
648        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
649        #[doc = r" parameters can be chained."]
650        #[doc = r""]
651        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
652        #[doc = r" converts the [`RequestBuilder`] into a future,"]
653        #[doc = r" executes the request and returns a `Result` with the parsed"]
654        #[doc = r" response."]
655        #[doc = r""]
656        #[doc = r" If you need lower-level access to the raw response details"]
657        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
658        #[doc = r" can finalize the request using the"]
659        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
660        #[doc = r" that resolves to a lower-level [`Response`] value."]
661        pub struct RequestBuilder {
662            pub(crate) client: super::super::Client,
663            pub(crate) organization: String,
664            pub(crate) artifact_type: String,
665            pub(crate) artifact_id: String,
666            pub(crate) artifact_scope_type: String,
667            pub(crate) artifact_scope_id: Option<String>,
668            pub(crate) include_extended_details: Option<bool>,
669        }
670        impl RequestBuilder {
671            pub fn artifact_scope_id(mut self, artifact_scope_id: impl Into<String>) -> Self {
672                self.artifact_scope_id = Some(artifact_scope_id.into());
673                self
674            }
675            pub fn include_extended_details(mut self, include_extended_details: bool) -> Self {
676                self.include_extended_details = Some(include_extended_details);
677                self
678            }
679            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
680            #[doc = ""]
681            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
682            #[doc = "However, this function can provide more flexibility when required."]
683            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
684                Box::pin({
685                    let this = self.clone();
686                    async move {
687                        let url = this.url()?;
688                        let mut req = azure_core::Request::new(url, azure_core::Method::Get);
689                        if let Some(auth_header) = this
690                            .client
691                            .token_credential()
692                            .http_authorization_header(&this.client.scopes())
693                            .await?
694                        {
695                            req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
696                        }
697                        let artifact_type = &this.artifact_type;
698                        req.url_mut()
699                            .query_pairs_mut()
700                            .append_pair("artifactType", artifact_type);
701                        let artifact_id = &this.artifact_id;
702                        req.url_mut()
703                            .query_pairs_mut()
704                            .append_pair("artifactId", artifact_id);
705                        let artifact_scope_type = &this.artifact_scope_type;
706                        req.url_mut()
707                            .query_pairs_mut()
708                            .append_pair("artifactScopeType", artifact_scope_type);
709                        if let Some(artifact_scope_id) = &this.artifact_scope_id {
710                            req.url_mut()
711                                .query_pairs_mut()
712                                .append_pair("artifactScopeId", artifact_scope_id);
713                        }
714                        if let Some(include_extended_details) = &this.include_extended_details {
715                            req.url_mut().query_pairs_mut().append_pair(
716                                "includeExtendedDetails",
717                                &include_extended_details.to_string(),
718                            );
719                        }
720                        let req_body = azure_core::EMPTY_BODY;
721                        req.set_body(req_body);
722                        Ok(Response(this.client.send(&mut req).await?))
723                    }
724                })
725            }
726            fn url(&self) -> azure_core::Result<azure_core::Url> {
727                let mut url = azure_core :: Url :: parse (& format ! ("{}/{}/_apis/favorite/favorites?artifactType={}&artifactId={}&artifactScopeType={}" , self . client . endpoint () , & self . organization , & self . artifact_type , & self . artifact_id , & self . artifact_scope_type)) ? ;
728                let has_api_version_already = url
729                    .query_pairs()
730                    .any(|(k, _)| k == azure_core::query_param::API_VERSION);
731                if !has_api_version_already {
732                    url.query_pairs_mut()
733                        .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
734                }
735                Ok(url)
736            }
737        }
738        impl std::future::IntoFuture for RequestBuilder {
739            type Output = azure_core::Result<models::Favorite>;
740            type IntoFuture = BoxFuture<'static, azure_core::Result<models::Favorite>>;
741            #[doc = "Returns a future that sends the request and returns the parsed response body."]
742            #[doc = ""]
743            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
744            #[doc = ""]
745            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
746            fn into_future(self) -> Self::IntoFuture {
747                Box::pin(async move { self.send().await?.into_raw_body().await })
748            }
749        }
750    }
751    pub mod delete_favorite_of_owner_by_id {
752        use super::models;
753        #[cfg(not(target_arch = "wasm32"))]
754        use futures::future::BoxFuture;
755        #[cfg(target_arch = "wasm32")]
756        use futures::future::LocalBoxFuture as BoxFuture;
757        #[derive(Debug)]
758        pub struct Response(azure_core::Response);
759        impl Response {
760            pub fn into_raw_response(self) -> azure_core::Response {
761                self.0
762            }
763            pub fn as_raw_response(&self) -> &azure_core::Response {
764                &self.0
765            }
766        }
767        impl From<Response> for azure_core::Response {
768            fn from(rsp: Response) -> Self {
769                rsp.into_raw_response()
770            }
771        }
772        impl AsRef<azure_core::Response> for Response {
773            fn as_ref(&self) -> &azure_core::Response {
774                self.as_raw_response()
775            }
776        }
777        #[derive(Clone)]
778        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
779        #[doc = r""]
780        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
781        #[doc = r" parameters can be chained."]
782        #[doc = r""]
783        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
784        #[doc = r" converts the [`RequestBuilder`] into a future,"]
785        #[doc = r" executes the request and returns a `Result` with the parsed"]
786        #[doc = r" response."]
787        #[doc = r""]
788        #[doc = r" If you need lower-level access to the raw response details"]
789        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
790        #[doc = r" can finalize the request using the"]
791        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
792        #[doc = r" that resolves to a lower-level [`Response`] value."]
793        pub struct RequestBuilder {
794            pub(crate) client: super::super::Client,
795            pub(crate) organization: String,
796            pub(crate) favorite_id: String,
797            pub(crate) owner_scope_type: String,
798            pub(crate) owner_scope_id: String,
799            pub(crate) artifact_type: String,
800            pub(crate) artifact_scope_type: String,
801            pub(crate) artifact_scope_id: Option<String>,
802        }
803        impl RequestBuilder {
804            pub fn artifact_scope_id(mut self, artifact_scope_id: impl Into<String>) -> Self {
805                self.artifact_scope_id = Some(artifact_scope_id.into());
806                self
807            }
808            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
809            #[doc = ""]
810            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
811            #[doc = "However, this function can provide more flexibility when required."]
812            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
813                Box::pin({
814                    let this = self.clone();
815                    async move {
816                        let url = this.url()?;
817                        let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
818                        if let Some(auth_header) = this
819                            .client
820                            .token_credential()
821                            .http_authorization_header(&this.client.scopes())
822                            .await?
823                        {
824                            req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
825                        }
826                        let owner_scope_type = &this.owner_scope_type;
827                        req.url_mut()
828                            .query_pairs_mut()
829                            .append_pair("ownerScopeType", owner_scope_type);
830                        let owner_scope_id = &this.owner_scope_id;
831                        req.url_mut()
832                            .query_pairs_mut()
833                            .append_pair("ownerScopeId", owner_scope_id);
834                        let artifact_type = &this.artifact_type;
835                        req.url_mut()
836                            .query_pairs_mut()
837                            .append_pair("artifactType", artifact_type);
838                        let artifact_scope_type = &this.artifact_scope_type;
839                        req.url_mut()
840                            .query_pairs_mut()
841                            .append_pair("artifactScopeType", artifact_scope_type);
842                        if let Some(artifact_scope_id) = &this.artifact_scope_id {
843                            req.url_mut()
844                                .query_pairs_mut()
845                                .append_pair("artifactScopeId", artifact_scope_id);
846                        }
847                        let req_body = azure_core::EMPTY_BODY;
848                        req.set_body(req_body);
849                        Ok(Response(this.client.send(&mut req).await?))
850                    }
851                })
852            }
853            fn url(&self) -> azure_core::Result<azure_core::Url> {
854                let mut url = azure_core :: Url :: parse (& format ! ("{}/{}/_apis/favorite/favorites/{}?ownerScopeType={}&ownerScopeId={}&artifactType={}&artifactScopeType={}" , self . client . endpoint () , & self . organization , & self . favorite_id , & self . owner_scope_type , & self . owner_scope_id , & self . artifact_type , & self . artifact_scope_type)) ? ;
855                let has_api_version_already = url
856                    .query_pairs()
857                    .any(|(k, _)| k == azure_core::query_param::API_VERSION);
858                if !has_api_version_already {
859                    url.query_pairs_mut()
860                        .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
861                }
862                Ok(url)
863            }
864        }
865        impl std::future::IntoFuture for RequestBuilder {
866            type Output = azure_core::Result<()>;
867            type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
868            #[doc = "Returns a future that sends the request and waits for the response."]
869            #[doc = ""]
870            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
871            #[doc = ""]
872            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
873            fn into_future(self) -> Self::IntoFuture {
874                Box::pin(async move {
875                    let _rsp = self.send().await?;
876                    Ok(())
877                })
878            }
879        }
880    }
881    pub mod get_favorite_of_owner_by_id {
882        use super::models;
883        #[cfg(not(target_arch = "wasm32"))]
884        use futures::future::BoxFuture;
885        #[cfg(target_arch = "wasm32")]
886        use futures::future::LocalBoxFuture as BoxFuture;
887        #[derive(Debug)]
888        pub struct Response(azure_core::Response);
889        impl Response {
890            pub async fn into_raw_body(self) -> azure_core::Result<models::Favorite> {
891                let bytes = self.0.into_raw_body().collect().await?;
892                let body: models::Favorite = serde_json::from_slice(&bytes).map_err(|e| {
893                    azure_core::error::Error::full(
894                        azure_core::error::ErrorKind::DataConversion,
895                        e,
896                        format!(
897                            "Failed to deserialize response:\n{}",
898                            String::from_utf8_lossy(&bytes)
899                        ),
900                    )
901                })?;
902                Ok(body)
903            }
904            pub fn into_raw_response(self) -> azure_core::Response {
905                self.0
906            }
907            pub fn as_raw_response(&self) -> &azure_core::Response {
908                &self.0
909            }
910        }
911        impl From<Response> for azure_core::Response {
912            fn from(rsp: Response) -> Self {
913                rsp.into_raw_response()
914            }
915        }
916        impl AsRef<azure_core::Response> for Response {
917            fn as_ref(&self) -> &azure_core::Response {
918                self.as_raw_response()
919            }
920        }
921        #[derive(Clone)]
922        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
923        #[doc = r""]
924        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
925        #[doc = r" parameters can be chained."]
926        #[doc = r""]
927        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
928        #[doc = r" converts the [`RequestBuilder`] into a future,"]
929        #[doc = r" executes the request and returns a `Result` with the parsed"]
930        #[doc = r" response."]
931        #[doc = r""]
932        #[doc = r" If you need lower-level access to the raw response details"]
933        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
934        #[doc = r" can finalize the request using the"]
935        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
936        #[doc = r" that resolves to a lower-level [`Response`] value."]
937        pub struct RequestBuilder {
938            pub(crate) client: super::super::Client,
939            pub(crate) organization: String,
940            pub(crate) favorite_id: String,
941            pub(crate) owner_scope_type: String,
942            pub(crate) owner_scope_id: String,
943            pub(crate) artifact_scope_type: String,
944            pub(crate) artifact_type: String,
945            pub(crate) artifact_scope_id: Option<String>,
946            pub(crate) include_extended_details: Option<bool>,
947        }
948        impl RequestBuilder {
949            pub fn artifact_scope_id(mut self, artifact_scope_id: impl Into<String>) -> Self {
950                self.artifact_scope_id = Some(artifact_scope_id.into());
951                self
952            }
953            pub fn include_extended_details(mut self, include_extended_details: bool) -> Self {
954                self.include_extended_details = Some(include_extended_details);
955                self
956            }
957            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
958            #[doc = ""]
959            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
960            #[doc = "However, this function can provide more flexibility when required."]
961            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
962                Box::pin({
963                    let this = self.clone();
964                    async move {
965                        let url = this.url()?;
966                        let mut req = azure_core::Request::new(url, azure_core::Method::Get);
967                        if let Some(auth_header) = this
968                            .client
969                            .token_credential()
970                            .http_authorization_header(&this.client.scopes())
971                            .await?
972                        {
973                            req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
974                        }
975                        let owner_scope_type = &this.owner_scope_type;
976                        req.url_mut()
977                            .query_pairs_mut()
978                            .append_pair("ownerScopeType", owner_scope_type);
979                        let owner_scope_id = &this.owner_scope_id;
980                        req.url_mut()
981                            .query_pairs_mut()
982                            .append_pair("ownerScopeId", owner_scope_id);
983                        let artifact_scope_type = &this.artifact_scope_type;
984                        req.url_mut()
985                            .query_pairs_mut()
986                            .append_pair("artifactScopeType", artifact_scope_type);
987                        let artifact_type = &this.artifact_type;
988                        req.url_mut()
989                            .query_pairs_mut()
990                            .append_pair("artifactType", artifact_type);
991                        if let Some(artifact_scope_id) = &this.artifact_scope_id {
992                            req.url_mut()
993                                .query_pairs_mut()
994                                .append_pair("artifactScopeId", artifact_scope_id);
995                        }
996                        if let Some(include_extended_details) = &this.include_extended_details {
997                            req.url_mut().query_pairs_mut().append_pair(
998                                "includeExtendedDetails",
999                                &include_extended_details.to_string(),
1000                            );
1001                        }
1002                        let req_body = azure_core::EMPTY_BODY;
1003                        req.set_body(req_body);
1004                        Ok(Response(this.client.send(&mut req).await?))
1005                    }
1006                })
1007            }
1008            fn url(&self) -> azure_core::Result<azure_core::Url> {
1009                let mut url = azure_core :: Url :: parse (& format ! ("{}/{}/_apis/favorite/favorites/{}?ownerScopeType={}&ownerScopeId={}&artifactScopeType={}&artifactType={}" , self . client . endpoint () , & self . organization , & self . favorite_id , & self . owner_scope_type , & self . owner_scope_id , & self . artifact_scope_type , & self . artifact_type)) ? ;
1010                let has_api_version_already = url
1011                    .query_pairs()
1012                    .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1013                if !has_api_version_already {
1014                    url.query_pairs_mut()
1015                        .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1016                }
1017                Ok(url)
1018            }
1019        }
1020        impl std::future::IntoFuture for RequestBuilder {
1021            type Output = azure_core::Result<models::Favorite>;
1022            type IntoFuture = BoxFuture<'static, azure_core::Result<models::Favorite>>;
1023            #[doc = "Returns a future that sends the request and returns the parsed response body."]
1024            #[doc = ""]
1025            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1026            #[doc = ""]
1027            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1028            fn into_future(self) -> Self::IntoFuture {
1029                Box::pin(async move { self.send().await?.into_raw_body().await })
1030            }
1031        }
1032    }
1033    pub mod get_favorites {
1034        use super::models;
1035        #[cfg(not(target_arch = "wasm32"))]
1036        use futures::future::BoxFuture;
1037        #[cfg(target_arch = "wasm32")]
1038        use futures::future::LocalBoxFuture as BoxFuture;
1039        #[derive(Debug)]
1040        pub struct Response(azure_core::Response);
1041        impl Response {
1042            pub async fn into_raw_body(self) -> azure_core::Result<models::FavoriteList> {
1043                let bytes = self.0.into_raw_body().collect().await?;
1044                let body: models::FavoriteList = serde_json::from_slice(&bytes).map_err(|e| {
1045                    azure_core::error::Error::full(
1046                        azure_core::error::ErrorKind::DataConversion,
1047                        e,
1048                        format!(
1049                            "Failed to deserialize response:\n{}",
1050                            String::from_utf8_lossy(&bytes)
1051                        ),
1052                    )
1053                })?;
1054                Ok(body)
1055            }
1056            pub fn into_raw_response(self) -> azure_core::Response {
1057                self.0
1058            }
1059            pub fn as_raw_response(&self) -> &azure_core::Response {
1060                &self.0
1061            }
1062        }
1063        impl From<Response> for azure_core::Response {
1064            fn from(rsp: Response) -> Self {
1065                rsp.into_raw_response()
1066            }
1067        }
1068        impl AsRef<azure_core::Response> for Response {
1069            fn as_ref(&self) -> &azure_core::Response {
1070                self.as_raw_response()
1071            }
1072        }
1073        #[derive(Clone)]
1074        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1075        #[doc = r""]
1076        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1077        #[doc = r" parameters can be chained."]
1078        #[doc = r""]
1079        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1080        #[doc = r" converts the [`RequestBuilder`] into a future,"]
1081        #[doc = r" executes the request and returns a `Result` with the parsed"]
1082        #[doc = r" response."]
1083        #[doc = r""]
1084        #[doc = r" If you need lower-level access to the raw response details"]
1085        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1086        #[doc = r" can finalize the request using the"]
1087        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1088        #[doc = r" that resolves to a lower-level [`Response`] value."]
1089        pub struct RequestBuilder {
1090            pub(crate) client: super::super::Client,
1091            pub(crate) organization: String,
1092            pub(crate) artifact_type: Option<String>,
1093            pub(crate) artifact_scope_type: Option<String>,
1094            pub(crate) artifact_scope_id: Option<String>,
1095            pub(crate) include_extended_details: Option<bool>,
1096        }
1097        impl RequestBuilder {
1098            pub fn artifact_type(mut self, artifact_type: impl Into<String>) -> Self {
1099                self.artifact_type = Some(artifact_type.into());
1100                self
1101            }
1102            pub fn artifact_scope_type(mut self, artifact_scope_type: impl Into<String>) -> Self {
1103                self.artifact_scope_type = Some(artifact_scope_type.into());
1104                self
1105            }
1106            pub fn artifact_scope_id(mut self, artifact_scope_id: impl Into<String>) -> Self {
1107                self.artifact_scope_id = Some(artifact_scope_id.into());
1108                self
1109            }
1110            pub fn include_extended_details(mut self, include_extended_details: bool) -> Self {
1111                self.include_extended_details = Some(include_extended_details);
1112                self
1113            }
1114            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1115            #[doc = ""]
1116            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1117            #[doc = "However, this function can provide more flexibility when required."]
1118            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1119                Box::pin({
1120                    let this = self.clone();
1121                    async move {
1122                        let url = this.url()?;
1123                        let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1124                        if let Some(auth_header) = this
1125                            .client
1126                            .token_credential()
1127                            .http_authorization_header(&this.client.scopes())
1128                            .await?
1129                        {
1130                            req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1131                        }
1132                        if let Some(artifact_type) = &this.artifact_type {
1133                            req.url_mut()
1134                                .query_pairs_mut()
1135                                .append_pair("artifactType", artifact_type);
1136                        }
1137                        if let Some(artifact_scope_type) = &this.artifact_scope_type {
1138                            req.url_mut()
1139                                .query_pairs_mut()
1140                                .append_pair("artifactScopeType", artifact_scope_type);
1141                        }
1142                        if let Some(artifact_scope_id) = &this.artifact_scope_id {
1143                            req.url_mut()
1144                                .query_pairs_mut()
1145                                .append_pair("artifactScopeId", artifact_scope_id);
1146                        }
1147                        if let Some(include_extended_details) = &this.include_extended_details {
1148                            req.url_mut().query_pairs_mut().append_pair(
1149                                "includeExtendedDetails",
1150                                &include_extended_details.to_string(),
1151                            );
1152                        }
1153                        let req_body = azure_core::EMPTY_BODY;
1154                        req.set_body(req_body);
1155                        Ok(Response(this.client.send(&mut req).await?))
1156                    }
1157                })
1158            }
1159            fn url(&self) -> azure_core::Result<azure_core::Url> {
1160                let mut url = azure_core::Url::parse(&format!(
1161                    "{}/{}/_apis/favorite/favorites",
1162                    self.client.endpoint(),
1163                    &self.organization
1164                ))?;
1165                let has_api_version_already = url
1166                    .query_pairs()
1167                    .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1168                if !has_api_version_already {
1169                    url.query_pairs_mut()
1170                        .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1171                }
1172                Ok(url)
1173            }
1174        }
1175        impl std::future::IntoFuture for RequestBuilder {
1176            type Output = azure_core::Result<models::FavoriteList>;
1177            type IntoFuture = BoxFuture<'static, azure_core::Result<models::FavoriteList>>;
1178            #[doc = "Returns a future that sends the request and returns the parsed response body."]
1179            #[doc = ""]
1180            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1181            #[doc = ""]
1182            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1183            fn into_future(self) -> Self::IntoFuture {
1184                Box::pin(async move { self.send().await?.into_raw_body().await })
1185            }
1186        }
1187    }
1188    pub mod create_favorite {
1189        use super::models;
1190        #[cfg(not(target_arch = "wasm32"))]
1191        use futures::future::BoxFuture;
1192        #[cfg(target_arch = "wasm32")]
1193        use futures::future::LocalBoxFuture as BoxFuture;
1194        #[derive(Debug)]
1195        pub struct Response(azure_core::Response);
1196        impl Response {
1197            pub async fn into_raw_body(self) -> azure_core::Result<models::Favorite> {
1198                let bytes = self.0.into_raw_body().collect().await?;
1199                let body: models::Favorite = serde_json::from_slice(&bytes).map_err(|e| {
1200                    azure_core::error::Error::full(
1201                        azure_core::error::ErrorKind::DataConversion,
1202                        e,
1203                        format!(
1204                            "Failed to deserialize response:\n{}",
1205                            String::from_utf8_lossy(&bytes)
1206                        ),
1207                    )
1208                })?;
1209                Ok(body)
1210            }
1211            pub fn into_raw_response(self) -> azure_core::Response {
1212                self.0
1213            }
1214            pub fn as_raw_response(&self) -> &azure_core::Response {
1215                &self.0
1216            }
1217        }
1218        impl From<Response> for azure_core::Response {
1219            fn from(rsp: Response) -> Self {
1220                rsp.into_raw_response()
1221            }
1222        }
1223        impl AsRef<azure_core::Response> for Response {
1224            fn as_ref(&self) -> &azure_core::Response {
1225                self.as_raw_response()
1226            }
1227        }
1228        #[derive(Clone)]
1229        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1230        #[doc = r""]
1231        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1232        #[doc = r" parameters can be chained."]
1233        #[doc = r""]
1234        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1235        #[doc = r" converts the [`RequestBuilder`] into a future,"]
1236        #[doc = r" executes the request and returns a `Result` with the parsed"]
1237        #[doc = r" response."]
1238        #[doc = r""]
1239        #[doc = r" If you need lower-level access to the raw response details"]
1240        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1241        #[doc = r" can finalize the request using the"]
1242        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1243        #[doc = r" that resolves to a lower-level [`Response`] value."]
1244        pub struct RequestBuilder {
1245            pub(crate) client: super::super::Client,
1246            pub(crate) organization: String,
1247            pub(crate) body: models::FavoriteCreateParameters,
1248        }
1249        impl RequestBuilder {
1250            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1251            #[doc = ""]
1252            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1253            #[doc = "However, this function can provide more flexibility when required."]
1254            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1255                Box::pin({
1256                    let this = self.clone();
1257                    async move {
1258                        let url = this.url()?;
1259                        let mut req = azure_core::Request::new(url, azure_core::Method::Post);
1260                        if let Some(auth_header) = this
1261                            .client
1262                            .token_credential()
1263                            .http_authorization_header(&this.client.scopes())
1264                            .await?
1265                        {
1266                            req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1267                        }
1268                        req.insert_header("content-type", "application/json");
1269                        let req_body = azure_core::json::to_json(&this.body)?;
1270                        req.set_body(req_body);
1271                        Ok(Response(this.client.send(&mut req).await?))
1272                    }
1273                })
1274            }
1275            fn url(&self) -> azure_core::Result<azure_core::Url> {
1276                let mut url = azure_core::Url::parse(&format!(
1277                    "{}/{}/_apis/favorite/favorites",
1278                    self.client.endpoint(),
1279                    &self.organization
1280                ))?;
1281                let has_api_version_already = url
1282                    .query_pairs()
1283                    .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1284                if !has_api_version_already {
1285                    url.query_pairs_mut()
1286                        .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1287                }
1288                Ok(url)
1289            }
1290        }
1291        impl std::future::IntoFuture for RequestBuilder {
1292            type Output = azure_core::Result<models::Favorite>;
1293            type IntoFuture = BoxFuture<'static, azure_core::Result<models::Favorite>>;
1294            #[doc = "Returns a future that sends the request and returns the parsed response body."]
1295            #[doc = ""]
1296            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1297            #[doc = ""]
1298            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1299            fn into_future(self) -> Self::IntoFuture {
1300                Box::pin(async move { self.send().await?.into_raw_body().await })
1301            }
1302        }
1303    }
1304    pub mod get_favorite_by_id {
1305        use super::models;
1306        #[cfg(not(target_arch = "wasm32"))]
1307        use futures::future::BoxFuture;
1308        #[cfg(target_arch = "wasm32")]
1309        use futures::future::LocalBoxFuture as BoxFuture;
1310        #[derive(Debug)]
1311        pub struct Response(azure_core::Response);
1312        impl Response {
1313            pub async fn into_raw_body(self) -> azure_core::Result<models::Favorite> {
1314                let bytes = self.0.into_raw_body().collect().await?;
1315                let body: models::Favorite = serde_json::from_slice(&bytes).map_err(|e| {
1316                    azure_core::error::Error::full(
1317                        azure_core::error::ErrorKind::DataConversion,
1318                        e,
1319                        format!(
1320                            "Failed to deserialize response:\n{}",
1321                            String::from_utf8_lossy(&bytes)
1322                        ),
1323                    )
1324                })?;
1325                Ok(body)
1326            }
1327            pub fn into_raw_response(self) -> azure_core::Response {
1328                self.0
1329            }
1330            pub fn as_raw_response(&self) -> &azure_core::Response {
1331                &self.0
1332            }
1333        }
1334        impl From<Response> for azure_core::Response {
1335            fn from(rsp: Response) -> Self {
1336                rsp.into_raw_response()
1337            }
1338        }
1339        impl AsRef<azure_core::Response> for Response {
1340            fn as_ref(&self) -> &azure_core::Response {
1341                self.as_raw_response()
1342            }
1343        }
1344        #[derive(Clone)]
1345        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1346        #[doc = r""]
1347        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1348        #[doc = r" parameters can be chained."]
1349        #[doc = r""]
1350        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1351        #[doc = r" converts the [`RequestBuilder`] into a future,"]
1352        #[doc = r" executes the request and returns a `Result` with the parsed"]
1353        #[doc = r" response."]
1354        #[doc = r""]
1355        #[doc = r" If you need lower-level access to the raw response details"]
1356        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1357        #[doc = r" can finalize the request using the"]
1358        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1359        #[doc = r" that resolves to a lower-level [`Response`] value."]
1360        pub struct RequestBuilder {
1361            pub(crate) client: super::super::Client,
1362            pub(crate) organization: String,
1363            pub(crate) favorite_id: String,
1364            pub(crate) artifact_scope_type: String,
1365            pub(crate) artifact_type: String,
1366            pub(crate) artifact_scope_id: Option<String>,
1367            pub(crate) include_extended_details: Option<bool>,
1368        }
1369        impl RequestBuilder {
1370            pub fn artifact_scope_id(mut self, artifact_scope_id: impl Into<String>) -> Self {
1371                self.artifact_scope_id = Some(artifact_scope_id.into());
1372                self
1373            }
1374            pub fn include_extended_details(mut self, include_extended_details: bool) -> Self {
1375                self.include_extended_details = Some(include_extended_details);
1376                self
1377            }
1378            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1379            #[doc = ""]
1380            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1381            #[doc = "However, this function can provide more flexibility when required."]
1382            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1383                Box::pin({
1384                    let this = self.clone();
1385                    async move {
1386                        let url = this.url()?;
1387                        let mut req = azure_core::Request::new(url, azure_core::Method::Get);
1388                        if let Some(auth_header) = this
1389                            .client
1390                            .token_credential()
1391                            .http_authorization_header(&this.client.scopes())
1392                            .await?
1393                        {
1394                            req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1395                        }
1396                        let artifact_scope_type = &this.artifact_scope_type;
1397                        req.url_mut()
1398                            .query_pairs_mut()
1399                            .append_pair("artifactScopeType", artifact_scope_type);
1400                        let artifact_type = &this.artifact_type;
1401                        req.url_mut()
1402                            .query_pairs_mut()
1403                            .append_pair("artifactType", artifact_type);
1404                        if let Some(artifact_scope_id) = &this.artifact_scope_id {
1405                            req.url_mut()
1406                                .query_pairs_mut()
1407                                .append_pair("artifactScopeId", artifact_scope_id);
1408                        }
1409                        if let Some(include_extended_details) = &this.include_extended_details {
1410                            req.url_mut().query_pairs_mut().append_pair(
1411                                "includeExtendedDetails",
1412                                &include_extended_details.to_string(),
1413                            );
1414                        }
1415                        let req_body = azure_core::EMPTY_BODY;
1416                        req.set_body(req_body);
1417                        Ok(Response(this.client.send(&mut req).await?))
1418                    }
1419                })
1420            }
1421            fn url(&self) -> azure_core::Result<azure_core::Url> {
1422                let mut url = azure_core::Url::parse(&format!(
1423                    "{}/{}/_apis/favorite/favorites/{}",
1424                    self.client.endpoint(),
1425                    &self.organization,
1426                    &self.favorite_id
1427                ))?;
1428                let has_api_version_already = url
1429                    .query_pairs()
1430                    .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1431                if !has_api_version_already {
1432                    url.query_pairs_mut()
1433                        .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1434                }
1435                Ok(url)
1436            }
1437        }
1438        impl std::future::IntoFuture for RequestBuilder {
1439            type Output = azure_core::Result<models::Favorite>;
1440            type IntoFuture = BoxFuture<'static, azure_core::Result<models::Favorite>>;
1441            #[doc = "Returns a future that sends the request and returns the parsed response body."]
1442            #[doc = ""]
1443            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1444            #[doc = ""]
1445            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1446            fn into_future(self) -> Self::IntoFuture {
1447                Box::pin(async move { self.send().await?.into_raw_body().await })
1448            }
1449        }
1450    }
1451    pub mod delete_favorite_by_id {
1452        use super::models;
1453        #[cfg(not(target_arch = "wasm32"))]
1454        use futures::future::BoxFuture;
1455        #[cfg(target_arch = "wasm32")]
1456        use futures::future::LocalBoxFuture as BoxFuture;
1457        #[derive(Debug)]
1458        pub struct Response(azure_core::Response);
1459        impl Response {
1460            pub fn into_raw_response(self) -> azure_core::Response {
1461                self.0
1462            }
1463            pub fn as_raw_response(&self) -> &azure_core::Response {
1464                &self.0
1465            }
1466        }
1467        impl From<Response> for azure_core::Response {
1468            fn from(rsp: Response) -> Self {
1469                rsp.into_raw_response()
1470            }
1471        }
1472        impl AsRef<azure_core::Response> for Response {
1473            fn as_ref(&self) -> &azure_core::Response {
1474                self.as_raw_response()
1475            }
1476        }
1477        #[derive(Clone)]
1478        #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
1479        #[doc = r""]
1480        #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
1481        #[doc = r" parameters can be chained."]
1482        #[doc = r""]
1483        #[doc = r" To finalize and submit the request, invoke `.await`, which"]
1484        #[doc = r" converts the [`RequestBuilder`] into a future,"]
1485        #[doc = r" executes the request and returns a `Result` with the parsed"]
1486        #[doc = r" response."]
1487        #[doc = r""]
1488        #[doc = r" If you need lower-level access to the raw response details"]
1489        #[doc = r" (e.g. to inspect response headers or raw body data) then you"]
1490        #[doc = r" can finalize the request using the"]
1491        #[doc = r" [`RequestBuilder::send()`] method which returns a future"]
1492        #[doc = r" that resolves to a lower-level [`Response`] value."]
1493        pub struct RequestBuilder {
1494            pub(crate) client: super::super::Client,
1495            pub(crate) organization: String,
1496            pub(crate) favorite_id: String,
1497            pub(crate) artifact_type: String,
1498            pub(crate) artifact_scope_type: String,
1499            pub(crate) artifact_scope_id: Option<String>,
1500        }
1501        impl RequestBuilder {
1502            pub fn artifact_scope_id(mut self, artifact_scope_id: impl Into<String>) -> Self {
1503                self.artifact_scope_id = Some(artifact_scope_id.into());
1504                self
1505            }
1506            #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
1507            #[doc = ""]
1508            #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
1509            #[doc = "However, this function can provide more flexibility when required."]
1510            pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
1511                Box::pin({
1512                    let this = self.clone();
1513                    async move {
1514                        let url = this.url()?;
1515                        let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
1516                        if let Some(auth_header) = this
1517                            .client
1518                            .token_credential()
1519                            .http_authorization_header(&this.client.scopes())
1520                            .await?
1521                        {
1522                            req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
1523                        }
1524                        let artifact_type = &this.artifact_type;
1525                        req.url_mut()
1526                            .query_pairs_mut()
1527                            .append_pair("artifactType", artifact_type);
1528                        let artifact_scope_type = &this.artifact_scope_type;
1529                        req.url_mut()
1530                            .query_pairs_mut()
1531                            .append_pair("artifactScopeType", artifact_scope_type);
1532                        if let Some(artifact_scope_id) = &this.artifact_scope_id {
1533                            req.url_mut()
1534                                .query_pairs_mut()
1535                                .append_pair("artifactScopeId", artifact_scope_id);
1536                        }
1537                        let req_body = azure_core::EMPTY_BODY;
1538                        req.set_body(req_body);
1539                        Ok(Response(this.client.send(&mut req).await?))
1540                    }
1541                })
1542            }
1543            fn url(&self) -> azure_core::Result<azure_core::Url> {
1544                let mut url = azure_core::Url::parse(&format!(
1545                    "{}/{}/_apis/favorite/favorites/{}",
1546                    self.client.endpoint(),
1547                    &self.organization,
1548                    &self.favorite_id
1549                ))?;
1550                let has_api_version_already = url
1551                    .query_pairs()
1552                    .any(|(k, _)| k == azure_core::query_param::API_VERSION);
1553                if !has_api_version_already {
1554                    url.query_pairs_mut()
1555                        .append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
1556                }
1557                Ok(url)
1558            }
1559        }
1560        impl std::future::IntoFuture for RequestBuilder {
1561            type Output = azure_core::Result<()>;
1562            type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
1563            #[doc = "Returns a future that sends the request and waits for the response."]
1564            #[doc = ""]
1565            #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
1566            #[doc = ""]
1567            #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
1568            fn into_future(self) -> Self::IntoFuture {
1569                Box::pin(async move {
1570                    let _rsp = self.send().await?;
1571                    Ok(())
1572                })
1573            }
1574        }
1575    }
1576}