github_types/user.rs
1// Copyright (c) 2019 Jason White
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19// SOFTWARE.
20
21use serde::Deserialize;
22
23/// Information about a user.
24#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct User {
26 pub login: String,
27 pub id: u64,
28 pub avatar_url: String,
29 pub gravatar_id: String,
30 pub url: String,
31 pub html_url: String,
32 pub followers_url: String,
33 pub following_url: String,
34 pub gists_url: String,
35 pub starred_url: String,
36 pub subscriptions_url: String,
37 pub organizations_url: String,
38 pub repos_url: String,
39 pub events_url: String,
40 pub received_events_url: String,
41 pub site_admin: bool,
42}
43
44/// Information about the current authenticated user.
45#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
46pub struct AuthenticatedUser {
47 pub login: String,
48 pub id: u64,
49 pub avatar_url: String,
50 pub gravatar_id: String,
51 pub url: String,
52 pub html_url: String,
53 pub followers_url: String,
54 pub following_url: String,
55 pub gists_url: String,
56 pub starred_url: String,
57 pub subscriptions_url: String,
58 pub organizations_url: String,
59 pub repos_url: String,
60 pub events_url: String,
61 pub received_events_url: String,
62 pub site_admin: bool,
63
64 // Extended over `User`:
65 pub name: Option<String>,
66 pub company: Option<String>,
67 pub blog: String,
68 pub location: Option<String>,
69 pub email: Option<String>,
70 pub hireable: Option<bool>,
71 pub bio: Option<String>,
72}