linkedin_api/
types.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4pub struct Identity {
5    pub authentication_token: String,
6    pub session_cookie: String,
7}
8
9/// Parameters for people search.
10#[derive(Debug, Clone, Default)]
11pub struct SearchPeopleParams {
12    pub keywords: Option<String>,
13    pub connection_of: Option<String>,
14    pub network_depth: Option<String>,
15    pub current_company: Option<Vec<String>>,
16    pub past_companies: Option<Vec<String>>,
17    pub nonprofit_interests: Option<Vec<String>>,
18    pub profile_languages: Option<Vec<String>>,
19    pub regions: Option<Vec<String>>,
20    pub industries: Option<Vec<String>>,
21    pub schools: Option<Vec<String>>,
22    pub include_private_profiles: bool,
23    pub limit: Option<usize>,
24}
25
26/// Strongly-typed struct for profiles.
27#[derive(Debug, Clone, Default, Serialize, Deserialize)]
28#[serde(rename_all = "camelCase")]
29pub struct Profile {
30    #[serde(rename = "entityUrn")]
31    pub entity_urn: Option<String>,
32
33    pub first_name: Option<String>,
34    pub last_name: Option<String>,
35    pub headline: Option<String>,
36    pub summary: Option<String>,
37    pub industry_name: Option<String>,
38    #[serde(rename = "industryUrn")]
39    pub industry_urn: Option<String>,
40
41    pub geo_country_name: Option<String>,
42    #[serde(rename = "geoCountryUrn")]
43    pub geo_country_urn: Option<String>,
44    #[serde(rename = "geoLocationName")]
45    pub geo_location_name: Option<String>,
46    #[serde(rename = "geoLocationBackfilled")]
47    pub geo_location_backfilled: Option<bool>,
48
49    pub address: Option<String>,
50    pub birth_date: Option<BirthDate>,
51
52    pub default_locale: Option<Locale>,
53    pub supported_locales: Option<Vec<Locale>>,
54
55    pub location: Option<Location>,
56    #[serde(rename = "locationName")]
57    pub location_name: Option<String>,
58
59    #[serde(rename = "miniProfile")]
60    pub mini_profile: Option<MiniProfile>,
61
62    pub profile_picture: Option<ProfilePicture>,
63    #[serde(rename = "profilePictureOriginalImage")]
64    pub profile_picture_original_image: Option<VectorImageContainer>,
65
66    #[serde(rename = "showEducationOnProfileTopCard")]
67    pub show_education_on_profile_top_card: Option<bool>,
68    pub student: Option<bool>,
69
70    #[serde(rename = "versionTag")]
71    pub version_tag: Option<String>,
72
73    #[serde(skip)]
74    pub profile_id: String, // extracted from entityUrn with get_id_from_urn
75
76    #[serde(skip)]
77    pub experience: Vec<Experience>,
78
79    #[serde(skip)]
80    pub education: Vec<Education>,
81
82    #[serde(skip)]
83    pub skills: Vec<Skill>,
84}
85
86#[derive(Debug, Clone, Default, Serialize, Deserialize)]
87#[serde(rename_all = "camelCase")]
88pub struct BirthDate {
89    pub day: Option<u32>,
90    pub month: Option<u32>,
91    pub year: Option<u32>,
92}
93
94#[derive(Debug, Clone, Default, Serialize, Deserialize)]
95#[serde(rename_all = "camelCase")]
96pub struct Locale {
97    pub country: Option<String>,
98    pub language: Option<String>,
99}
100
101#[derive(Debug, Clone, Default, Serialize, Deserialize)]
102#[serde(rename_all = "camelCase")]
103pub struct Location {
104    pub basic_location: Option<BasicLocation>,
105}
106
107#[derive(Debug, Clone, Default, Serialize, Deserialize)]
108#[serde(rename_all = "camelCase")]
109pub struct BasicLocation {
110    pub country_code: Option<String>,
111    pub postal_code: Option<String>,
112}
113
114#[derive(Debug, Clone, Default, Serialize, Deserialize)]
115#[serde(rename_all = "camelCase")]
116pub struct MiniProfile {
117    #[serde(rename = "dashEntityUrn")]
118    pub dash_entity_urn: Option<String>,
119    #[serde(rename = "entityUrn")]
120    pub entity_urn: Option<String>,
121    #[serde(rename = "objectUrn")]
122    pub object_urn: Option<String>,
123    pub public_identifier: Option<String>,
124    pub first_name: Option<String>,
125    pub last_name: Option<String>,
126    pub occupation: Option<String>,
127    pub tracking_id: Option<String>,
128    pub picture: Option<VectorImageContainer>,
129}
130
131#[derive(Debug, Clone, Default, Serialize, Deserialize)]
132#[serde(rename_all = "camelCase")]
133pub struct ProfilePicture {
134    pub display_image: Option<String>,
135    pub original_image: Option<String>,
136    pub photo_filter_edit_info: Option<PhotoFilterEditInfo>,
137}
138
139#[derive(Debug, Clone, Default, Serialize, Deserialize)]
140#[serde(rename_all = "camelCase")]
141pub struct PhotoFilterEditInfo {
142    pub top_left: Option<Point>,
143    pub top_right: Option<Point>,
144    pub bottom_left: Option<Point>,
145    pub bottom_right: Option<Point>,
146    pub brightness: Option<f32>,
147    pub contrast: Option<f32>,
148    pub saturation: Option<f32>,
149    pub vignette: Option<f32>,
150    pub photo_filter_type: Option<String>,
151}
152
153#[derive(Debug, Clone, Default, Serialize, Deserialize)]
154#[serde(rename_all = "camelCase")]
155pub struct Point {
156    pub x: f32,
157    pub y: f32,
158}
159
160#[derive(Debug, Clone, Default, Serialize, Deserialize)]
161#[serde(rename_all = "camelCase")]
162pub struct VectorImageContainer {
163    #[serde(rename = "com.linkedin.common.VectorImage")]
164    pub vector_image: Option<VectorImage>,
165}
166
167#[derive(Debug, Clone, Default, Serialize, Deserialize)]
168#[serde(rename_all = "camelCase")]
169pub struct VectorImage {
170    pub root_url: Option<String>,
171    pub artifacts: Vec<ImageArtifact>,
172}
173
174#[derive(Debug, Clone, Default, Serialize, Deserialize)]
175#[serde(rename_all = "camelCase")]
176pub struct ImageArtifact {
177    pub height: u32,
178    pub width: u32,
179    pub expires_at: Option<u64>,
180    pub file_identifying_url_path_segment: Option<String>,
181}
182
183/// An experience entry
184#[derive(Debug, Clone, Default, Serialize, Deserialize)]
185#[serde(rename_all = "camelCase")]
186pub struct Experience {
187    pub title: Option<String>,
188    #[serde(rename = "companyName")]
189    pub company_name: Option<String>,
190    #[serde(rename = "companyLogoUrl")]
191    pub company_logo_url: Option<String>,
192    pub description: Option<String>,
193}
194
195/// An education entry
196#[derive(Debug, Clone, Default, Serialize, Deserialize)]
197#[serde(rename_all = "camelCase")]
198pub struct Education {
199    pub school_name: Option<String>,
200    pub degree: Option<String>,
201    pub field_of_study: Option<String>,
202}
203
204/// A skill entry
205#[derive(Debug, Clone, Default, Serialize, Deserialize)]
206#[serde(rename_all = "camelCase")]
207pub struct Skill {
208    pub name: String,
209}
210
211#[derive(Debug, Clone, Serialize, Deserialize)]
212pub struct ContactInfo {
213    #[serde(rename = "emailAddress")]
214    pub email_address: Option<String>,
215    pub websites: Vec<Website>,
216    pub twitter: Vec<String>,
217    #[serde(rename = "phoneNumbers")]
218    pub phone_numbers: Vec<String>,
219    pub birthdate: Option<String>,
220    pub ims: Option<Vec<Value>>,
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize)]
224pub struct Website {
225    pub url: String,
226    pub label: Option<String>,
227}
228
229#[derive(Debug, Clone, Serialize, Deserialize)]
230pub struct Connection {
231    pub urn_id: String,
232    pub public_id: String,
233    pub distance: String,
234}
235
236#[derive(Debug, Clone, Serialize, Deserialize)]
237pub struct Conversation {
238    pub id: String,
239}
240
241#[derive(Debug, Clone, Serialize, Deserialize)]
242pub struct ConversationDetails {
243    pub id: String,
244}
245
246#[derive(Debug, Clone, Serialize, Deserialize)]
247pub struct MemberBadges {
248    pub premium: bool,
249    pub open_link: bool,
250    pub influencer: bool,
251    pub job_seeker: bool,
252}
253
254#[derive(Debug, Clone, Serialize, Deserialize)]
255pub struct NetworkInfo {
256    pub followers_count: u64,
257}
258
259#[derive(Debug, Clone, Serialize, Deserialize)]
260pub struct School {
261    pub name: String,
262}
263
264#[derive(Debug, Clone, Serialize, Deserialize)]
265pub struct Company {
266    pub name: String,
267}
268
269#[derive(Debug, Clone, Serialize, Deserialize)]
270pub struct PersonSearchResult {
271    pub urn_id: String,
272    pub public_id: String,
273    pub distance: String,
274}
275
276#[derive(Debug, Clone, Serialize, Deserialize)]
277pub struct Invitation {
278    #[serde(rename = "entityUrn")]
279    pub entity_urn: String,
280    #[serde(rename = "sharedSecret")]
281    pub shared_secret: String,
282}
283
284pub(crate) struct UniformResourceName {
285    pub(crate) namespace: String, // the context of the id
286    pub(crate) id: String,
287}