Skip to main content

io_msgraph/v1/rest/users/
contacts.rs

1//! Microsoft Graph contacts (`users.contacts`): list, delta, get,
2//! create, update, delete.
3//!
4//! <https://learn.microsoft.com/en-us/graph/api/resources/contact>
5
6use alloc::{string::String, vec::Vec};
7
8use serde::{Deserialize, Serialize};
9
10use crate::v1::{field::MsgraphField, rest::users::messages::MsgraphEmailAddress};
11
12pub mod create;
13pub mod delete;
14pub mod delta;
15pub mod get;
16pub mod list;
17pub mod update;
18
19/// A contact in a contact folder. Doubles as the create/update body.
20///
21/// Unset fields are left out (an update preserves them), null fields
22/// are serialized as explicit nulls (an update clears them), and a set
23/// empty collection clears the collection.
24#[derive(Debug, Clone, Default, Deserialize, Serialize, Eq, PartialEq)]
25#[serde(rename_all = "camelCase")]
26pub struct MsgraphContact {
27    /// The unique identifier of the contact.
28    #[serde(default, skip_serializing_if = "String::is_empty")]
29    pub id: String,
30    /// The display name of the contact.
31    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
32    pub display_name: MsgraphField<String>,
33    /// The given name of the contact.
34    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
35    pub given_name: MsgraphField<String>,
36    /// The middle name of the contact.
37    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
38    pub middle_name: MsgraphField<String>,
39    /// The family name of the contact.
40    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
41    pub surname: MsgraphField<String>,
42    /// The nickname of the contact.
43    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
44    pub nick_name: MsgraphField<String>,
45    /// The title of the contact.
46    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
47    pub title: MsgraphField<String>,
48    /// How the contact is filed under in the folder listing.
49    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
50    pub file_as: MsgraphField<String>,
51    /// The email addresses of the contact.
52    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
53    pub email_addresses: MsgraphField<Vec<MsgraphEmailAddress>>,
54    /// The instant messaging addresses of the contact.
55    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
56    pub im_addresses: MsgraphField<Vec<String>>,
57    /// The business phone numbers of the contact.
58    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
59    pub business_phones: MsgraphField<Vec<String>>,
60    /// The home phone numbers of the contact.
61    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
62    pub home_phones: MsgraphField<Vec<String>>,
63    /// The mobile phone number of the contact.
64    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
65    pub mobile_phone: MsgraphField<String>,
66    /// The home address of the contact.
67    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
68    pub home_address: MsgraphField<MsgraphPhysicalAddress>,
69    /// The business address of the contact.
70    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
71    pub business_address: MsgraphField<MsgraphPhysicalAddress>,
72    /// The alternative address of the contact.
73    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
74    pub other_address: MsgraphField<MsgraphPhysicalAddress>,
75    /// The job title of the contact.
76    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
77    pub job_title: MsgraphField<String>,
78    /// The name of the contact's company.
79    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
80    pub company_name: MsgraphField<String>,
81    /// The department the contact works in.
82    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
83    pub department: MsgraphField<String>,
84    /// The office location of the contact.
85    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
86    pub office_location: MsgraphField<String>,
87    /// The profession of the contact.
88    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
89    pub profession: MsgraphField<String>,
90    /// The name of the contact's assistant.
91    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
92    pub assistant_name: MsgraphField<String>,
93    /// The name of the contact's manager.
94    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
95    pub manager: MsgraphField<String>,
96    /// The business home page of the contact.
97    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
98    pub business_home_page: MsgraphField<String>,
99    /// Birthday as an ISO 8601 date-time (e.g. `1983-04-01T00:00:00Z`).
100    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
101    pub birthday: MsgraphField<String>,
102    /// The name of the contact's spouse or partner.
103    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
104    pub spouse_name: MsgraphField<String>,
105    /// The names of the contact's children.
106    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
107    pub children: MsgraphField<Vec<String>>,
108    /// The free-form notes about the contact.
109    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
110    pub personal_notes: MsgraphField<String>,
111    /// The categories associated with the contact.
112    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
113    pub categories: MsgraphField<Vec<String>>,
114    /// The identifier of the containing contact folder.
115    #[serde(default, skip_serializing_if = "Option::is_none")]
116    pub parent_folder_id: Option<String>,
117    /// The creation date, as an ISO 8601 date-time.
118    #[serde(default, skip_serializing_if = "Option::is_none")]
119    pub created_date_time: Option<String>,
120    /// The last modification date, as an ISO 8601 date-time.
121    #[serde(default, skip_serializing_if = "Option::is_none")]
122    pub last_modified_date_time: Option<String>,
123    /// The version marker of the contact, changing on every update.
124    #[serde(default, skip_serializing_if = "Option::is_none")]
125    pub change_key: Option<String>,
126    /// Single-value extended MAPI properties attached to the contact.
127    ///
128    /// They ride inline in create and update bodies, but responses
129    /// only carry them when the request `$expand`ed them by id.
130    #[serde(default, skip_serializing_if = "MsgraphField::is_unset")]
131    pub single_value_extended_properties: MsgraphField<Vec<MsgraphSingleValueExtendedProperty>>,
132}
133
134/// A physical address of a contact (home, business or other).
135///
136/// The whole object is replaced at once, so its components stay plain
137/// options.
138#[derive(Debug, Clone, Default, Deserialize, Serialize, Eq, PartialEq)]
139#[serde(rename_all = "camelCase")]
140pub struct MsgraphPhysicalAddress {
141    /// The street name and number.
142    #[serde(default, skip_serializing_if = "Option::is_none")]
143    pub street: Option<String>,
144    /// The city.
145    #[serde(default, skip_serializing_if = "Option::is_none")]
146    pub city: Option<String>,
147    /// The state or province.
148    #[serde(default, skip_serializing_if = "Option::is_none")]
149    pub state: Option<String>,
150    /// The country or region.
151    #[serde(default, skip_serializing_if = "Option::is_none")]
152    pub country_or_region: Option<String>,
153    /// The postal code.
154    #[serde(default, skip_serializing_if = "Option::is_none")]
155    pub postal_code: Option<String>,
156}
157
158/// A single-value extended MAPI property: the full property id (the
159/// `String {guid} Name <name>` form) and its value.
160///
161/// <https://learn.microsoft.com/en-us/graph/api/resources/singlevaluelegacyextendedproperty>
162#[derive(Debug, Clone, Default, Deserialize, Serialize, Eq, PartialEq)]
163#[serde(rename_all = "camelCase")]
164pub struct MsgraphSingleValueExtendedProperty {
165    /// The full property identifier.
166    #[serde(default)]
167    pub id: String,
168    /// The value of the property.
169    #[serde(default)]
170    pub value: String,
171}