proxycurl_linkedin_rs/apis/
company_api.rs

1/*
2 * Proxycurl API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.0.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use reqwest;
12
13use super::{configuration, Error};
14use crate::apis::ResponseContent;
15
16/// struct for typed errors of method [`company_lookup_endpoint`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum CompanyLookupEndpointError {
20    Status400(),
21    Status401(),
22    Status403(),
23    Status404(),
24    Status429(),
25    Status500(),
26    Status503(),
27    UnknownValue(serde_json::Value),
28}
29
30/// struct for typed errors of method [`company_profile_endpoint`]
31#[derive(Debug, Clone, Serialize, Deserialize)]
32#[serde(untagged)]
33pub enum CompanyProfileEndpointError {
34    Status400(),
35    Status401(),
36    Status403(),
37    Status404(),
38    Status429(),
39    Status500(),
40    Status503(),
41    UnknownValue(serde_json::Value),
42}
43
44/// struct for typed errors of method [`company_profile_picture_endpoint`]
45#[derive(Debug, Clone, Serialize, Deserialize)]
46#[serde(untagged)]
47pub enum CompanyProfilePictureEndpointError {
48    Status400(),
49    Status401(),
50    Status403(),
51    Status404(),
52    Status429(),
53    Status500(),
54    Status503(),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`employee_count_endpoint`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum EmployeeCountEndpointError {
62    Status400(),
63    Status401(),
64    Status403(),
65    Status404(),
66    Status429(),
67    Status500(),
68    Status503(),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`employee_listing_endpoint`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum EmployeeListingEndpointError {
76    Status400(),
77    Status401(),
78    Status403(),
79    Status404(),
80    Status429(),
81    Status500(),
82    Status503(),
83    UnknownValue(serde_json::Value),
84}
85
86/// struct for typed errors of method [`employee_search_endpoint`]
87#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum EmployeeSearchEndpointError {
90    Status400(),
91    Status401(),
92    Status403(),
93    Status404(),
94    Status429(),
95    Status500(),
96    Status503(),
97    UnknownValue(serde_json::Value),
98}
99
100/// Cost: 2 credits / successful request. Resolve Company LinkedIn Profile from company name,     domain name and location.
101pub async fn company_lookup_endpoint(
102    configuration: &configuration::Configuration,
103    company_location: Option<&str>,
104    company_domain: Option<&str>,
105    company_name: Option<&str>,
106    enrich_profile: Option<&str>,
107) -> Result<crate::models::CompanyUrlEnrichResult, Error<CompanyLookupEndpointError>> {
108    let local_var_configuration = configuration;
109
110    let local_var_client = &local_var_configuration.client;
111
112    let local_var_uri_str = format!(
113        "{}/api/linkedin/company/resolve",
114        local_var_configuration.base_path
115    );
116    let mut local_var_req_builder =
117        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
118
119    if let Some(ref local_var_str) = company_location {
120        local_var_req_builder =
121            local_var_req_builder.query(&[("company_location", &local_var_str.to_string())]);
122    }
123    if let Some(ref local_var_str) = company_domain {
124        local_var_req_builder =
125            local_var_req_builder.query(&[("company_domain", &local_var_str.to_string())]);
126    }
127    if let Some(ref local_var_str) = company_name {
128        local_var_req_builder =
129            local_var_req_builder.query(&[("company_name", &local_var_str.to_string())]);
130    }
131    if let Some(ref local_var_str) = enrich_profile {
132        local_var_req_builder =
133            local_var_req_builder.query(&[("enrich_profile", &local_var_str.to_string())]);
134    }
135    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
136        local_var_req_builder =
137            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
138    }
139    if let Some(ref local_var_token) = local_var_configuration.api_key {
140        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
141    };
142
143    let local_var_req = local_var_req_builder.build()?;
144    let local_var_resp = local_var_client.execute(local_var_req).await?;
145
146    let local_var_status = local_var_resp.status();
147    let local_var_content = local_var_resp.text().await?;
148
149    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
150        serde_json::from_str(&local_var_content).map_err(Error::from)
151    } else {
152        let local_var_entity: Option<CompanyLookupEndpointError> =
153            serde_json::from_str(&local_var_content).ok();
154        let local_var_error = ResponseContent {
155            status: local_var_status,
156            content: local_var_content,
157            entity: local_var_entity,
158        };
159        Err(Error::ResponseError(local_var_error))
160    }
161}
162
163/// Cost: 1 credit / successful request. Get structured data of a Company Profile
164#[allow(clippy::too_many_arguments)]
165pub async fn company_profile_endpoint(
166    configuration: &configuration::Configuration,
167    url: &str,
168    resolve_numeric_id: Option<&str>,
169    categories: Option<&str>,
170    funding_data: Option<&str>,
171    extra: Option<&str>,
172    exit_data: Option<&str>,
173    acquisitions: Option<&str>,
174    use_cache: Option<&str>,
175) -> Result<crate::models::LinkedinCompany, Error<CompanyProfileEndpointError>> {
176    let local_var_configuration = configuration;
177
178    let local_var_client = &local_var_configuration.client;
179
180    let local_var_uri_str = format!("{}/api/linkedin/company", local_var_configuration.base_path);
181    let mut local_var_req_builder =
182        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
183
184    if let Some(ref local_var_str) = resolve_numeric_id {
185        local_var_req_builder =
186            local_var_req_builder.query(&[("resolve_numeric_id", &local_var_str.to_string())]);
187    }
188    if let Some(ref local_var_str) = categories {
189        local_var_req_builder =
190            local_var_req_builder.query(&[("categories", &local_var_str.to_string())]);
191    }
192    if let Some(ref local_var_str) = funding_data {
193        local_var_req_builder =
194            local_var_req_builder.query(&[("funding_data", &local_var_str.to_string())]);
195    }
196    if let Some(ref local_var_str) = extra {
197        local_var_req_builder =
198            local_var_req_builder.query(&[("extra", &local_var_str.to_string())]);
199    }
200    if let Some(ref local_var_str) = exit_data {
201        local_var_req_builder =
202            local_var_req_builder.query(&[("exit_data", &local_var_str.to_string())]);
203    }
204    if let Some(ref local_var_str) = acquisitions {
205        local_var_req_builder =
206            local_var_req_builder.query(&[("acquisitions", &local_var_str.to_string())]);
207    }
208    local_var_req_builder = local_var_req_builder.query(&[("url", &url.to_string())]);
209    if let Some(ref local_var_str) = use_cache {
210        local_var_req_builder =
211            local_var_req_builder.query(&[("use_cache", &local_var_str.to_string())]);
212    }
213    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
214        local_var_req_builder =
215            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
216    }
217    if let Some(ref local_var_token) = local_var_configuration.api_key {
218        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
219    };
220
221    let local_var_req = local_var_req_builder.build()?;
222    let local_var_resp = local_var_client.execute(local_var_req).await?;
223
224    let local_var_status = local_var_resp.status();
225    let local_var_content = local_var_resp.text().await?;
226
227    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
228        serde_json::from_str(&local_var_content).map_err(Error::from)
229    } else {
230        let local_var_entity: Option<CompanyProfileEndpointError> =
231            serde_json::from_str(&local_var_content).ok();
232        let local_var_error = ResponseContent {
233            status: local_var_status,
234            content: local_var_content,
235            entity: local_var_entity,
236        };
237        Err(Error::ResponseError(local_var_error))
238    }
239}
240
241/// Cost: 0 credit / successful request. Get the profile picture of a company.  Profile pictures are served from cached company profiles found within [LinkDB](https://nubela.co/proxycurl/linkdb). If the profile does not exist within [LinkDB](https://nubela.co/proxycurl/linkdb), then the API will return a `404` status code.
242pub async fn company_profile_picture_endpoint(
243    configuration: &configuration::Configuration,
244    linkedin_company_profile_url: &str,
245) -> Result<crate::models::ProfilePicture, Error<CompanyProfilePictureEndpointError>> {
246    let local_var_configuration = configuration;
247
248    let local_var_client = &local_var_configuration.client;
249
250    let local_var_uri_str = format!(
251        "{}/api/linkedin/company/profile-picture",
252        local_var_configuration.base_path
253    );
254    let mut local_var_req_builder =
255        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
256
257    local_var_req_builder = local_var_req_builder.query(&[(
258        "linkedin_company_profile_url",
259        &linkedin_company_profile_url.to_string(),
260    )]);
261    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
262        local_var_req_builder =
263            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
264    }
265    if let Some(ref local_var_token) = local_var_configuration.api_key {
266        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
267    };
268
269    let local_var_req = local_var_req_builder.build()?;
270    let local_var_resp = local_var_client.execute(local_var_req).await?;
271
272    let local_var_status = local_var_resp.status();
273    let local_var_content = local_var_resp.text().await?;
274
275    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
276        serde_json::from_str(&local_var_content).map_err(Error::from)
277    } else {
278        let local_var_entity: Option<CompanyProfilePictureEndpointError> =
279            serde_json::from_str(&local_var_content).ok();
280        let local_var_error = ResponseContent {
281            status: local_var_status,
282            content: local_var_content,
283            entity: local_var_entity,
284        };
285        Err(Error::ResponseError(local_var_error))
286    }
287}
288
289/// Cost: 1 credit / successful request. Get a number of total employees of a Company.  Get an employee count of this company from various sources.
290pub async fn employee_count_endpoint(
291    configuration: &configuration::Configuration,
292    url: &str,
293    use_cache: Option<&str>,
294    linkedin_employee_count: Option<&str>,
295    employment_status: Option<&str>,
296) -> Result<crate::models::EmployeeCount, Error<EmployeeCountEndpointError>> {
297    let local_var_configuration = configuration;
298
299    let local_var_client = &local_var_configuration.client;
300
301    let local_var_uri_str = format!(
302        "{}/api/linkedin/company/employees/count",
303        local_var_configuration.base_path
304    );
305    let mut local_var_req_builder =
306        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
307
308    if let Some(ref local_var_str) = use_cache {
309        local_var_req_builder =
310            local_var_req_builder.query(&[("use_cache", &local_var_str.to_string())]);
311    }
312    if let Some(ref local_var_str) = linkedin_employee_count {
313        local_var_req_builder =
314            local_var_req_builder.query(&[("linkedin_employee_count", &local_var_str.to_string())]);
315    }
316    if let Some(ref local_var_str) = employment_status {
317        local_var_req_builder =
318            local_var_req_builder.query(&[("employment_status", &local_var_str.to_string())]);
319    }
320    local_var_req_builder = local_var_req_builder.query(&[("url", &url.to_string())]);
321    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
322        local_var_req_builder =
323            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
324    }
325    if let Some(ref local_var_token) = local_var_configuration.api_key {
326        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
327    };
328
329    let local_var_req = local_var_req_builder.build()?;
330    let local_var_resp = local_var_client.execute(local_var_req).await?;
331
332    let local_var_status = local_var_resp.status();
333    let local_var_content = local_var_resp.text().await?;
334
335    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
336        serde_json::from_str(&local_var_content).map_err(Error::from)
337    } else {
338        let local_var_entity: Option<EmployeeCountEndpointError> =
339            serde_json::from_str(&local_var_content).ok();
340        let local_var_error = ResponseContent {
341            status: local_var_status,
342            content: local_var_content,
343            entity: local_var_entity,
344        };
345        Err(Error::ResponseError(local_var_error))
346    }
347}
348
349/// Cost: 3 credits / employee returned. Get a list of employees of a Company.  This API endpoint is limited by LinkDB which is populated with profiles in the US, UK, Canada, Israel, Australia, Ireland, New Zealand and Singapore. As such, this endpoint is best used to list employees working in companies based in those locations only.
350#[allow(clippy::too_many_arguments)]
351pub async fn employee_listing_endpoint(
352    configuration: &configuration::Configuration,
353    url: &str,
354    country: Option<&str>,
355    enrich_profiles: Option<&str>,
356    role_search: Option<&str>,
357    page_size: Option<&str>,
358    employment_status: Option<&str>,
359    sort_by: Option<&str>,
360    resolve_numeric_id: Option<&str>,
361) -> Result<crate::models::EmployeeList, Error<EmployeeListingEndpointError>> {
362    let local_var_configuration = configuration;
363
364    let local_var_client = &local_var_configuration.client;
365
366    let local_var_uri_str = format!(
367        "{}/api/linkedin/company/employees/",
368        local_var_configuration.base_path
369    );
370    let mut local_var_req_builder =
371        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
372
373    if let Some(ref local_var_str) = country {
374        local_var_req_builder =
375            local_var_req_builder.query(&[("country", &local_var_str.to_string())]);
376    }
377    if let Some(ref local_var_str) = enrich_profiles {
378        local_var_req_builder =
379            local_var_req_builder.query(&[("enrich_profiles", &local_var_str.to_string())]);
380    }
381    if let Some(ref local_var_str) = role_search {
382        local_var_req_builder =
383            local_var_req_builder.query(&[("role_search", &local_var_str.to_string())]);
384    }
385    if let Some(ref local_var_str) = page_size {
386        local_var_req_builder =
387            local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
388    }
389    if let Some(ref local_var_str) = employment_status {
390        local_var_req_builder =
391            local_var_req_builder.query(&[("employment_status", &local_var_str.to_string())]);
392    }
393    if let Some(ref local_var_str) = sort_by {
394        local_var_req_builder =
395            local_var_req_builder.query(&[("sort_by", &local_var_str.to_string())]);
396    }
397    if let Some(ref local_var_str) = resolve_numeric_id {
398        local_var_req_builder =
399            local_var_req_builder.query(&[("resolve_numeric_id", &local_var_str.to_string())]);
400    }
401    local_var_req_builder = local_var_req_builder.query(&[("url", &url.to_string())]);
402    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
403        local_var_req_builder =
404            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
405    }
406    if let Some(ref local_var_token) = local_var_configuration.api_key {
407        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
408    };
409
410    let local_var_req = local_var_req_builder.build()?;
411    let local_var_resp = local_var_client.execute(local_var_req).await?;
412
413    let local_var_status = local_var_resp.status();
414    let local_var_content = local_var_resp.text().await?;
415
416    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
417        serde_json::from_str(&local_var_content).map_err(Error::from)
418    } else {
419        let local_var_entity: Option<EmployeeListingEndpointError> =
420            serde_json::from_str(&local_var_content).ok();
421        let local_var_error = ResponseContent {
422            status: local_var_status,
423            content: local_var_content,
424            entity: local_var_entity,
425        };
426        Err(Error::ResponseError(local_var_error))
427    }
428}
429
430/// Cost: 10 credits / successful request. Search employees of a target by their job title. This API endpoint is syntactic sugar for the role_search parameter under the [Employee Listing Endpoint](https://nubela.co/proxycurl/docs#company-api-employee-listing-endpoint).  Results are limited by data that we have within [LinkDB](https://nubela.co/proxycurl/linkdb). Use [Role Lookup API Endpoint](https://nubela.co/proxycurl/docs#people-api-role-lookup-endpoint) if you need to query for profiles without LinkDB constraints. The drawbacks of the Role Lookup API Endpoint is that it is less precise and can return at most one result per query.
431pub async fn employee_search_endpoint(
432    configuration: &configuration::Configuration,
433    linkedin_company_profile_url: &str,
434    keyword_regex: &str,
435    page_size: Option<&str>,
436    country: Option<&str>,
437    enrich_profiles: Option<&str>,
438    resolve_numeric_id: Option<&str>,
439) -> Result<crate::models::EmployeeList, Error<EmployeeSearchEndpointError>> {
440    let local_var_configuration = configuration;
441
442    let local_var_client = &local_var_configuration.client;
443
444    let local_var_uri_str = format!(
445        "{}/api/linkedin/company/employee/search/",
446        local_var_configuration.base_path
447    );
448    let mut local_var_req_builder =
449        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
450
451    if let Some(ref local_var_str) = page_size {
452        local_var_req_builder =
453            local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
454    }
455    local_var_req_builder = local_var_req_builder.query(&[(
456        "linkedin_company_profile_url",
457        &linkedin_company_profile_url.to_string(),
458    )]);
459    local_var_req_builder =
460        local_var_req_builder.query(&[("keyword_regex", &keyword_regex.to_string())]);
461    if let Some(ref local_var_str) = country {
462        local_var_req_builder =
463            local_var_req_builder.query(&[("country", &local_var_str.to_string())]);
464    }
465    if let Some(ref local_var_str) = enrich_profiles {
466        local_var_req_builder =
467            local_var_req_builder.query(&[("enrich_profiles", &local_var_str.to_string())]);
468    }
469    if let Some(ref local_var_str) = resolve_numeric_id {
470        local_var_req_builder =
471            local_var_req_builder.query(&[("resolve_numeric_id", &local_var_str.to_string())]);
472    }
473    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
474        local_var_req_builder =
475            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
476    }
477    if let Some(ref local_var_token) = local_var_configuration.api_key {
478        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
479    };
480
481    let local_var_req = local_var_req_builder.build()?;
482    let local_var_resp = local_var_client.execute(local_var_req).await?;
483
484    let local_var_status = local_var_resp.status();
485    let local_var_content = local_var_resp.text().await?;
486
487    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
488        serde_json::from_str(&local_var_content).map_err(Error::from)
489    } else {
490        let local_var_entity: Option<EmployeeSearchEndpointError> =
491            serde_json::from_str(&local_var_content).ok();
492        let local_var_error = ResponseContent {
493            status: local_var_status,
494            content: local_var_content,
495            entity: local_var_entity,
496        };
497        Err(Error::ResponseError(local_var_error))
498    }
499}