safe_vk/responses/user.rs
1use serde::Deserialize;
2use serde_json::Value;
3
4/// Information about the user’s career
5#[derive(Deserialize, Debug)]
6pub struct Career {
7 /// Community ID (if available, otherwise company);
8 pub group_id: Option<u64>,
9 /// Company name (if available, otherwise group_id);
10 pub company: Option<String>,
11 /// Country identifier
12 pub country_id: Option<u64>,
13 /// Name of the city (if available, otherwise) city_id;
14 pub city_name: Option<String>,
15 /// City ID (if available, otherwise city_name);
16 pub city_id: Option<u64>,
17 /// Year of commencement of work
18 pub from: Option<u64>,
19 /// The year of termination of employment
20 pub until: Option<u64>,
21 /// Position
22 pub position: Option<String>,
23}
24
25/// Information about the city indicated on the user's page in the section "Contacts"
26#[derive(Deserialize, Debug)]
27pub struct City {
28 /// City ID, which can be used to get its name using the method `database.getCitiesById`
29 pub id: Option<u64>,
30 /// The name of the city
31 pub title: Option<String>,
32}
33
34/// Information about the user's phone numbers
35#[derive(Deserialize, Debug)]
36pub struct Contacts {
37 /// Mobile phone number of the user (only for Standalone applications)
38 pub mobile_phone: Option<String>,
39 /// Additional phone number of the user
40 pub home_phone: Option<String>,
41}
42
43#[derive(Deserialize, Debug)]
44pub struct Counters {
45 /// Number of photo albums
46 pub albums: Option<u64>,
47 /// Number of videos
48 pub videos: Option<u64>,
49 /// The number of audio recordings
50 pub audios: Option<u64>,
51 /// Number of photographs
52 pub photos: Option<u64>,
53 /// Number of notes
54 pub notes: Option<u64>,
55 /// Number of friends
56 pub friends: Option<u64>,
57 /// The number of user gifts
58 pub gifts: Option<u64>,
59 /// The number of communities
60 pub groups: Option<u64>,
61 /// Number of online friends
62 pub online_friends: Option<u64>,
63 /// Number of common friends
64 pub mutual_friends: Option<u64>,
65 /// The number of videos with the user
66 pub user_videos: Option<u64>,
67 /// Number of photos with the user
68 pub user_photos: Option<u64>,
69 /// Number of subscribers
70 pub followers: Option<u64>,
71 /// The number of objects in the block "Interesting pages"
72 pub pages: Option<u64>,
73 /// Number of subscriptions of the user (to whom the user is subscribed)
74 pub subscriptions: Option<u64>,
75}
76
77/// Information about the country indicated on the user's page in the section "Contacts"
78#[derive(Deserialize, Debug)]
79pub struct Country {
80 /// Country identifier that can be used to get its name using the method database.getCountriesById
81 pub id: Option<u64>,
82 /// The name of the country.
83 pub title: Option<String>,
84}
85
86/// Information about the higher educational institution of the user.
87#[derive(Deserialize, Debug)]
88pub struct Education {
89 /// University ID
90 pub university: Option<u64>,
91 /// The name of the university
92 pub university_name: Option<String>,
93 /// ID of the faculty
94 pub faculty: Option<u64>,
95 /// The name of the faculty
96 pub faculty_name: Option<String>,
97 /// Year of end
98 pub graduation: Option<u64>,
99}
100
101/// Time of last visit. An object containing the following fields
102#[derive(Deserialize, Debug)]
103pub struct LastSeen {
104 /// Time of last visit in Unixtime format
105 pub time: Option<u64>,
106 /// Type of platform. Possible values:
107 /// - `1` if the mobile version
108 /// - `2` if application for iPhone
109 /// - `3` if app for iPad
110 /// - `4` if application for Android
111 /// - `5` if application for Windows Phone
112 /// - `6` if application for Windows 10
113 /// - `7` if full version of the site
114 pub platform: Option<u64>,
115}
116
117/// Information about the military service of the user
118#[derive(Deserialize, Debug)]
119pub struct Military {
120 /// The part number
121 pub unit: Option<String>,
122 /// The part identifier in the database
123 pub unit_id: Option<u64>,
124 /// The country in which the part is located
125 pub country_id: Option<u64>,
126 /// year of commencement of service
127 pub from: Option<u64>,
128 /// Year of end of service
129 pub until: Option<u64>,
130}
131
132/// Information about the current type of user activity
133#[derive(Deserialize, Debug)]
134pub struct Occupation {
135 /// Is a type. Possible values
136 /// - `work` if working
137 /// - `school` if secondary education
138 /// - `university` if higher education
139 #[serde(rename = "type")]
140 pub occupation_type: Option<String>,
141 /// ID of the school, university, community of the company (in which the user works)
142 pub id: Option<u64>,
143 /// The name of the school, university or place of work
144 pub name: Option<String>,
145}
146
147///
148/// The object contains information about the VKontakte user. The set of fields can change
149/// depending on the method called and the parameters transmitted in it.
150///
151/// Note that all fields use information about the current user (e.g., blacklisted_by_me require a
152/// user access key to be passed in the request, even if the method itself can be invoked without
153/// an access key.
154///
155#[derive(Deserialize, Debug)]
156pub struct User {
157 /// User ID
158 pub id: u64,
159 /// First name
160 pub first_name: String,
161 /// Last name
162 pub last_name: String,
163 /// The field is returned if the user’s page is deleted or blocked,
164 /// contains a value `deleted` or `banned`
165 pub deactivated: Option<String>,
166 /// Whether the user profile is hidden by privacy settings
167 pub is_closed: bool,
168 /// Can the current user see the profile `is_closed` = 1 (They are friends)
169 pub can_access_closed: bool,
170 ///
171 /// Here comes `optional` fields that are not always included in respons
172 ///
173 /// The content of the field "ABOUT yourself" from the profile
174 pub about: Option<String>,
175 /// Content of the Activity field from the profile
176 pub activities: Option<String>,
177 /// Date of birth. Returns in D.M.YYYY or D.M format (if birth year is hidden).
178 /// If the date of birth is hidden in its entirety,
179 /// the field is missing from the answer
180 pub dbate: Option<String>,
181 /// Information about whether the current user is blacklisted.
182 /// Possible values:
183 /// - `1` if the user is blacklisted.
184 /// - `0` if the user is not blacklisted.
185 pub blacklisted: Option<u8>,
186 /// Information about whether the user is blacklisted from the current user.
187 /// Possible values:
188 /// - `1` if it is
189 /// - `0` if it isn't
190 pub blacklisted_by_me: Option<u8>,
191 /// The content of the “Favorite Books” field from the user profile
192 pub books: Option<String>,
193 /// Information about whether the current user can leave records on the wall.
194 /// Possible values:
195 /// - `1` if maybe he can
196 /// - `0` if he can't
197 pub can_post: Option<u8>,
198 /// Information about whether the current user can see someone else's records on the wall.
199 /// Possible values:
200 /// - `1` if maybe he can
201 /// - `0` if he can't
202 pub can_see_all_posts: Option<u8>,
203 /// Information about whether the current user can see the audio recordings.
204 /// Possible values:
205 /// - `1` if maybe he can
206 /// - `0` if he can't
207 pub can_see_audio: Option<u8>,
208 /// Information about whether a notification will be sent to the user about the friend request from the current user.
209 /// Possible values:
210 /// - `1` notification will be sent
211 /// - `0` notification will not be sent
212 pub can_send_friend_request: Option<u8>,
213 /// Information about whether the current user can send a private message.
214 /// Possible values:
215 /// - `1` if maybe he can
216 /// - `0` if maybe he can't
217 pub can_write_private_message: Option<u8>,
218 /// Information about the user’s career. An object containing the following fields
219 pub career: Option<Career>,
220 /// Information about the city indicated on the user's page in the section "Contacts".
221 pub city: Option<City>,
222 /// Shared friends with current user
223 pub common_count: Option<u64>,
224 /// Returns data about the services specified in the user profile, such as: skype, livejournal.
225 /// For each service, a separate field with a string type containing the username of the user is returned.
226 /// For example, "skype": "username"
227 pub connections: Option<Value>,
228 /// Information about the user's phone numbers. If the data is specified and not hidden by
229 /// the privacy settings
230 pub contacts: Option<Contacts>,
231 /// The number of different objects of the user. The field only returns in method users.get when
232 /// requesting information about one user, with the transfer of user information access_token.
233 pub counters: Option<Counters>,
234 /// Information about the country indicated on the user's page in the section "Contacts".
235 pub country: Option<Country>,
236 /// Returns data on the points at which profile and miniature photos of the user are cut, if available
237 pub crop_photo: Option<Value>,
238 /// Short address of the page. A line containing a short page address is returned (e.g., andrew ).
239 /// If he is not appointed, he shall return "id" + user_id , for example: id35828305
240 pub domain: Option<String>,
241 /// Information about the higher educational institution of the user
242 pub education: Option<Education>,
243 /// External services to which exports from VK are configured `livejournal`.
244 pub exports: Option<Value>,
245 /// Name in nominative case (e.g., "Alexander").
246 pub first_name_nom: Option<String>,
247 /// Name in genitive case (e.g., "Alexandera").
248 pub first_name_gen: Option<String>,
249 /// Name in dative case (e.g., "Alexandru").
250 pub first_name_dat: Option<String>,
251 /// Name in accusative case (e.g., "Alexandra").
252 pub first_name_acc: Option<String>,
253 /// Name in instrumental case (e.g., "Alexandrom").
254 pub first_name_ins: Option<String>,
255 /// Name in prepositional case (e.g., "Alexandre").
256 pub first_name_abl: Option<String>,
257 /// Number of subscribers of the user
258 pub followers_count: Option<u64>,
259 /// Friendship status with the user.
260 /// Possible values:
261 /// - `0` if it's not a friend
262 /// - `1` if sent an application / subscription to the user
263 /// - `2` if there is an incoming application / subscription from the user
264 /// - `3` if is a friend
265 pub friend_status: Option<u64>,
266 /// Content of the “Favorite Games” field from the profile
267 pub games: Option<String>,
268 /// Information about whether the user's mobile phone number is known.
269 /// Return values:
270 /// - `1` if known
271 /// - `0` if unknown
272 pub has_mobile: Option<bool>,
273 /// Information about whether the user has set a profile photo.
274 /// Return values:
275 /// - `1` if established
276 /// - `0` if didn't
277 pub has_photo: Option<u64>,
278 /// Name of hometown
279 pub home_town: Option<String>,
280 /// Content of the “Interesa” field from the profile
281 pub interests: Option<String>,
282 /// Information about whether the user is bookmarked by the current user.
283 /// Possible values:
284 /// - `1` if it's
285 /// - `0` if it's not
286 pub is_favorite: Option<u64>,
287 /// Information about whether the user is a friend of the current user.
288 /// Possible values:
289 /// - `1` if true
290 /// - `0` if false
291 pub is_friend: Option<u64>,
292 /// Information about whether the user is hidden from the news feed of the current user.
293 /// Possible values:
294 /// - `1` if true
295 /// - `0` if false
296 pub is_hidden_from_feed: Option<u64>,
297 /// Is the profile indexed by search sites??
298 /// Possible values:
299 /// - `1` if profile is hidden from search sites
300 /// - `0` if profile is available to search sites. (IN privacy settings: https://vk.com/settings?act=privacy,
301 /// in the item “Who can see my page on the Internet", the value “Everyone” is selected
302 ///
303 ///
304 /// Optional fields L-R
305 ///
306 ///
307 /// Name in nominative case (e.g., "Alexander")
308 pub last_name_nom: Option<String>,
309 /// Name in genitive case (e.g., "Alexandera")
310 pub last_name_gen: Option<String>,
311 /// Name in dative case (e.g., "Alexandru")
312 pub last_name_dat: Option<String>,
313 /// Name in accusative case (e.g., "Alexandra")
314 pub last_name_acc: Option<String>,
315 /// Name in instrumental case (e.g., "Alexandrom")
316 pub last_name_ins: Option<String>,
317 /// Name in prepositional case (e.g., "Alexandre")
318 pub last_name_abl: Option<String>,
319 /// Time of last visit
320 pub last_seen: Option<LastSeen>,
321 /// The comma-separated identifiers of the user's friend lists. The field is only available for the method friends.get
322 pub lists: Option<String>,
323 /// My maiden name
324 pub maiden_name: Option<String>,
325 /// Information about the military service of the user
326 pub military: Option<Military>,
327 /// The content of the “Favorite Movies” field from the user profile
328 pub movies: Option<String>,
329 /// The content of the field “Favorite music” from the user profile
330 pub music: Option<String>,
331 /// Nickname of the user
332 pub nickname: Option<String>,
333 /// Information about the current type of user activity
334 pub occupation: Option<Occupation>,
335 /// Information about whether the user is currently on the site.
336 /// If the user uses a mobile application or mobile version, an additional field is returned
337 /// `online_mobile` which contains `1` . In this case, if the application is used,
338 /// the field is additionally returned. `online_app` containing its identifier
339 pub online: Option<u64>,
340 ///
341 ///
342 /// Option fields S-W
343 ///
344 ///
345 /// The short name of the page
346 pub screen_name: Option<String>,
347 /// Possible values:
348 /// - `1` if female
349 /// - `2` if male
350 /// - `0` unknown
351 pub sex: Option<u64>,
352 /// The address of the site indicated in the profile
353 pub site: Option<String>,
354 /// Status of user. The line containing the status text located in the profile under the name is returned.
355 /// If the option “Translate to status playing music” is enabled, an additional field is returned
356 /// `status_audio` containing information about the composition
357 pub status: Option<String>,
358 /// Information about whether the user's page has a "light"
359 pub trending: Option<u64>,
360 /// Favorite TV show.
361 pub tv: Option<String>,
362 /// It's coming back
363 /// - `1` if the user page is verified
364 /// - `0` if not
365 pub verified: Option<u64>,
366 /// The default wall mode
367 /// Possible values:
368 /// - `owner`
369 /// - `all`
370 pub wall_default: Option<String>,
371}