/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // EDITS TO THIS FILE WILL BE OVERWRITTEN #![doc = "Provides operations to manage the mailFolders property of the microsoft.graph.user entity.\n\nAuto-generated from [Microsoft OpenAPI metadata](https://github.com/microsoftgraph/msgraph-metadata/blob/master/openapi/v1.0/openapi.yaml) via `ms_graph_tb_extract openapi.yaml ms_graph_tb/`."] use crate::types::mail_folder_collection_response::*; use crate::*; use form_urlencoded::Serializer; use http::method::Method; #[derive(Debug)] struct TemplateExpressions { endpoint: String, } fn format_path(template_expressions: &TemplateExpressions) -> String { let TemplateExpressions { endpoint } = template_expressions; let endpoint = endpoint.trim_end_matches('/'); format!("{endpoint}/me/mailFolders") } #[doc = "List mailFolders\n\nGet the mail folder collection directly under the root folder of the signed-in user. The returned collection includes any mail search folders directly under the root. By default, this operation does not return hidden folders. Use a query parameter includeHiddenFolders to include them in the response. This operation does not return all mail folders in a mailbox, only the child folders of the root folder. To return all mail folders in a mailbox, each child folder must be traversed separately.\n\nMore information available via [Microsoft documentation](https://learn.microsoft.com/graph/api/user-list-mailfolders?view=graph-rest-1.0)."] #[derive(Debug)] pub struct Get { template_expressions: TemplateExpressions, selection: Selection, } impl Get { pub fn new(endpoint: String) -> Self { Self { template_expressions: TemplateExpressions { endpoint }, selection: Selection::default(), } } } impl Operation for Get { const METHOD: Method = Method::GET; type Body = (); type Response<'response> = Paginated>; fn build(&self) -> http::Request { let mut params = Serializer::new(String::new()); let (select, selection) = self.selection.pair(); params.append_pair(select, &selection); let params = params.finish(); let path = format_path(&self.template_expressions); let uri = format!("{path}?{params}") .parse::() .unwrap(); http::Request::builder() .uri(uri) .method(Self::METHOD) .body(()) .unwrap() } } impl Select for Get { type Properties = MailFolderCollectionResponseSelection; fn select>(&mut self, properties: P) { self.selection.select(properties) } fn extend>(&mut self, properties: P) { self.selection.extend(properties) } }