proxycurl_linkedin_rs/apis/
contact_api.rs1use reqwest;
12
13use super::{configuration, Error};
14use crate::apis::ResponseContent;
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum DisposableEmailAddressCheckEndpointError {
20 Status400(),
21 Status401(),
22 Status403(),
23 Status404(),
24 Status429(),
25 Status500(),
26 Status503(),
27 UnknownValue(serde_json::Value),
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
32#[serde(untagged)]
33pub enum PersonalContactNumberLookupEndpointError {
34 Status400(),
35 Status401(),
36 Status403(),
37 Status404(),
38 Status429(),
39 Status500(),
40 Status503(),
41 UnknownValue(serde_json::Value),
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum PersonalEmailLookupEndpointError {
48 Status400(),
49 Status401(),
50 Status403(),
51 Status404(),
52 Status429(),
53 Status500(),
54 Status503(),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum ReverseWorkEmailLookupEndpointError {
62 Status400(),
63 Status401(),
64 Status403(),
65 Status404(),
66 Status429(),
67 Status500(),
68 Status503(),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum WorkEmailLookupEndpointError {
76 Status400(),
77 Status401(),
78 Status403(),
79 Status404(),
80 Status429(),
81 Status500(),
82 Status503(),
83 UnknownValue(serde_json::Value),
84}
85
86pub async fn disposable_email_address_check_endpoint(
88 configuration: &configuration::Configuration,
89 email: &str,
90) -> Result<crate::models::DisposableEmail, Error<DisposableEmailAddressCheckEndpointError>> {
91 let local_var_configuration = configuration;
92
93 let local_var_client = &local_var_configuration.client;
94
95 let local_var_uri_str = format!("{}/api/disposable-email", local_var_configuration.base_path);
96 let mut local_var_req_builder =
97 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
98
99 local_var_req_builder = local_var_req_builder.query(&[("email", &email.to_string())]);
100 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
101 local_var_req_builder =
102 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
103 }
104 if let Some(ref local_var_token) = local_var_configuration.api_key {
105 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
106 };
107
108 let local_var_req = local_var_req_builder.build()?;
109 let local_var_resp = local_var_client.execute(local_var_req).await?;
110
111 let local_var_status = local_var_resp.status();
112 let local_var_content = local_var_resp.text().await?;
113
114 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
115 serde_json::from_str(&local_var_content).map_err(Error::from)
116 } else {
117 let local_var_entity: Option<DisposableEmailAddressCheckEndpointError> =
118 serde_json::from_str(&local_var_content).ok();
119 let local_var_error = ResponseContent {
120 status: local_var_status,
121 content: local_var_content,
122 entity: local_var_entity,
123 };
124 Err(Error::ResponseError(local_var_error))
125 }
126}
127
128pub async fn personal_contact_number_lookup_endpoint(
130 configuration: &configuration::Configuration,
131 linkedin_profile_url: &str,
132) -> Result<crate::models::PdlPhoneNumberResult, Error<PersonalContactNumberLookupEndpointError>> {
133 let local_var_configuration = configuration;
134
135 let local_var_client = &local_var_configuration.client;
136
137 let local_var_uri_str = format!(
138 "{}/api/contact-api/personal-contact",
139 local_var_configuration.base_path
140 );
141 let mut local_var_req_builder =
142 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
143
144 local_var_req_builder =
145 local_var_req_builder.query(&[("linkedin_profile_url", &linkedin_profile_url.to_string())]);
146 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
147 local_var_req_builder =
148 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
149 }
150 if let Some(ref local_var_token) = local_var_configuration.api_key {
151 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
152 };
153
154 let local_var_req = local_var_req_builder.build()?;
155 let local_var_resp = local_var_client.execute(local_var_req).await?;
156
157 let local_var_status = local_var_resp.status();
158 let local_var_content = local_var_resp.text().await?;
159
160 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
161 serde_json::from_str(&local_var_content).map_err(Error::from)
162 } else {
163 let local_var_entity: Option<PersonalContactNumberLookupEndpointError> =
164 serde_json::from_str(&local_var_content).ok();
165 let local_var_error = ResponseContent {
166 status: local_var_status,
167 content: local_var_content,
168 entity: local_var_entity,
169 };
170 Err(Error::ResponseError(local_var_error))
171 }
172}
173
174pub async fn personal_email_lookup_endpoint(
176 configuration: &configuration::Configuration,
177 linkedin_profile_url: &str,
178 email_validation: Option<&str>,
179) -> Result<crate::models::PdlEmailResult, Error<PersonalEmailLookupEndpointError>> {
180 let local_var_configuration = configuration;
181
182 let local_var_client = &local_var_configuration.client;
183
184 let local_var_uri_str = format!(
185 "{}/api/contact-api/personal-email",
186 local_var_configuration.base_path
187 );
188 let mut local_var_req_builder =
189 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
190
191 if let Some(ref local_var_str) = email_validation {
192 local_var_req_builder =
193 local_var_req_builder.query(&[("email_validation", &local_var_str.to_string())]);
194 }
195 local_var_req_builder =
196 local_var_req_builder.query(&[("linkedin_profile_url", &linkedin_profile_url.to_string())]);
197 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
198 local_var_req_builder =
199 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
200 }
201 if let Some(ref local_var_token) = local_var_configuration.api_key {
202 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
203 };
204
205 let local_var_req = local_var_req_builder.build()?;
206 let local_var_resp = local_var_client.execute(local_var_req).await?;
207
208 let local_var_status = local_var_resp.status();
209 let local_var_content = local_var_resp.text().await?;
210
211 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
212 serde_json::from_str(&local_var_content).map_err(Error::from)
213 } else {
214 let local_var_entity: Option<PersonalEmailLookupEndpointError> =
215 serde_json::from_str(&local_var_content).ok();
216 let local_var_error = ResponseContent {
217 status: local_var_status,
218 content: local_var_content,
219 entity: local_var_entity,
220 };
221 Err(Error::ResponseError(local_var_error))
222 }
223}
224
225pub async fn reverse_work_email_lookup_endpoint(
227 configuration: &configuration::Configuration,
228 work_email: &str,
229 enrich_profile: Option<&str>,
230) -> Result<crate::models::ReverseEmailUrlEnrichResult, Error<ReverseWorkEmailLookupEndpointError>>
231{
232 let local_var_configuration = configuration;
233
234 let local_var_client = &local_var_configuration.client;
235
236 let local_var_uri_str = format!(
237 "{}/api/linkedin/profile/resolve/email",
238 local_var_configuration.base_path
239 );
240 let mut local_var_req_builder =
241 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
242
243 if let Some(ref local_var_str) = enrich_profile {
244 local_var_req_builder =
245 local_var_req_builder.query(&[("enrich_profile", &local_var_str.to_string())]);
246 }
247 local_var_req_builder = local_var_req_builder.query(&[("work_email", &work_email.to_string())]);
248 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
249 local_var_req_builder =
250 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
251 }
252 if let Some(ref local_var_token) = local_var_configuration.api_key {
253 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
254 };
255
256 let local_var_req = local_var_req_builder.build()?;
257 let local_var_resp = local_var_client.execute(local_var_req).await?;
258
259 let local_var_status = local_var_resp.status();
260 let local_var_content = local_var_resp.text().await?;
261
262 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
263 serde_json::from_str(&local_var_content).map_err(Error::from)
264 } else {
265 let local_var_entity: Option<ReverseWorkEmailLookupEndpointError> =
266 serde_json::from_str(&local_var_content).ok();
267 let local_var_error = ResponseContent {
268 status: local_var_status,
269 content: local_var_content,
270 entity: local_var_entity,
271 };
272 Err(Error::ResponseError(local_var_error))
273 }
274}
275
276pub async fn work_email_lookup_endpoint(
278 configuration: &configuration::Configuration,
279 linkedin_profile_url: &str,
280 callback_url: Option<&str>,
281) -> Result<crate::models::ExtractionEmailResult, Error<WorkEmailLookupEndpointError>> {
282 let local_var_configuration = configuration;
283
284 let local_var_client = &local_var_configuration.client;
285
286 let local_var_uri_str = format!(
287 "{}/api/linkedin/profile/email",
288 local_var_configuration.base_path
289 );
290 let mut local_var_req_builder =
291 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
292
293 local_var_req_builder =
294 local_var_req_builder.query(&[("linkedin_profile_url", &linkedin_profile_url.to_string())]);
295 if let Some(ref local_var_str) = callback_url {
296 local_var_req_builder =
297 local_var_req_builder.query(&[("callback_url", &local_var_str.to_string())]);
298 }
299 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
300 local_var_req_builder =
301 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
302 }
303 if let Some(ref local_var_token) = local_var_configuration.api_key {
304 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
305 };
306
307 let local_var_req = local_var_req_builder.build()?;
308 let local_var_resp = local_var_client.execute(local_var_req).await?;
309
310 let local_var_status = local_var_resp.status();
311 let local_var_content = local_var_resp.text().await?;
312
313 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
314 serde_json::from_str(&local_var_content).map_err(Error::from)
315 } else {
316 let local_var_entity: Option<WorkEmailLookupEndpointError> =
317 serde_json::from_str(&local_var_content).ok();
318 let local_var_error = ResponseContent {
319 status: local_var_status,
320 content: local_var_content,
321 entity: local_var_entity,
322 };
323 Err(Error::ResponseError(local_var_error))
324 }
325}