cufinder_rust/
types.rs

1use serde::{Deserialize, Serialize};
2
3/// Base response structure for all CUFinder API responses
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct BaseResponse {
6    pub query: Option<String>,
7    #[serde(rename = "credit_count")]
8    pub credit_count: Option<i32>,
9    #[serde(rename = "meta_data")]
10    pub meta_data: Option<serde_json::Value>,
11    #[serde(rename = "confidence_level")]
12    pub confidence_level: Option<i32>,
13}
14
15/// Company information model
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct Company {
18    pub name: Option<String>,
19    pub domain: Option<String>,
20    #[serde(rename = "linkedin_url")]
21    pub linkedin_url: Option<String>,
22    pub industry: Option<String>,
23    pub size: Option<String>,
24    pub location: Option<String>,
25    pub description: Option<String>,
26    pub founded: Option<i32>,
27    pub revenue: Option<String>,
28    pub employees: Option<serde_json::Value>,
29    pub website: Option<String>,
30    pub phone: Option<String>,
31    pub email: Option<String>,
32    #[serde(rename = "social_media")]
33    pub social_media: Option<serde_json::Value>,
34    pub technologies: Option<Vec<String>>,
35    pub subsidiaries: Option<Vec<String>>,
36    pub headquarters: Option<String>,
37    pub country: Option<String>,
38    pub state: Option<String>,
39    pub city: Option<String>,
40    #[serde(rename = "zip_code")]
41    pub zip_code: Option<String>,
42    pub address: Option<String>,
43}
44
45/// Person information model
46#[derive(Debug, Clone, Serialize, Deserialize)]
47pub struct Person {
48    #[serde(rename = "first_name")]
49    pub first_name: Option<String>,
50    #[serde(rename = "last_name")]
51    pub last_name: Option<String>,
52    #[serde(rename = "full_name")]
53    pub full_name: Option<String>,
54    pub email: Option<String>,
55    pub phone: Option<String>,
56    #[serde(rename = "linkedin_url")]
57    pub linkedin_url: Option<String>,
58    #[serde(rename = "job_title")]
59    pub job_title: Option<String>,
60    pub company: Option<String>,
61    #[serde(rename = "company_domain")]
62    pub company_domain: Option<String>,
63    pub location: Option<String>,
64    pub country: Option<String>,
65    pub state: Option<String>,
66    pub city: Option<String>,
67    pub bio: Option<String>,
68    pub experience: Option<Vec<serde_json::Value>>,
69    pub education: Option<Vec<serde_json::Value>>,
70    pub skills: Option<Vec<String>>,
71    pub languages: Option<Vec<String>>,
72    #[serde(rename = "social_media")]
73    pub social_media: Option<serde_json::Value>,
74}
75
76// Response types for each service
77#[derive(Debug, Clone, Serialize, Deserialize)]
78pub struct CufResponse {
79    #[serde(flatten)]
80    pub base: BaseResponse,
81    pub domain: String,
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
85pub struct LcufResponse {
86    #[serde(flatten)]
87    pub base: BaseResponse,
88    #[serde(rename = "linkedin_url")]
89    pub linkedin_url: String,
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize)]
93pub struct DtcResponse {
94    #[serde(flatten)]
95    pub base: BaseResponse,
96    #[serde(rename = "company_name")]
97    pub company_name: String,
98}
99
100#[derive(Debug, Clone, Serialize, Deserialize)]
101pub struct DteResponse {
102    #[serde(flatten)]
103    pub base: BaseResponse,
104    pub emails: Vec<String>,
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
108pub struct NtpResponse {
109    #[serde(flatten)]
110    pub base: BaseResponse,
111    pub phones: Vec<String>,
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
115pub struct RelResponse {
116    #[serde(flatten)]
117    pub base: BaseResponse,
118    pub person: Person,
119    pub company: Company,
120}
121
122#[derive(Debug, Clone, Serialize, Deserialize)]
123pub struct FclResponse {
124    #[serde(flatten)]
125    pub base: BaseResponse,
126    pub lookalikes: Vec<Company>,
127}
128
129#[derive(Debug, Clone, Serialize, Deserialize)]
130pub struct ElfResponse {
131    #[serde(flatten)]
132    pub base: BaseResponse,
133    pub fundraising: serde_json::Value,
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
137pub struct CarResponse {
138    #[serde(flatten)]
139    pub base: BaseResponse,
140    pub revenue: serde_json::Value,
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
144pub struct FccResponse {
145    #[serde(flatten)]
146    pub base: BaseResponse,
147    pub subsidiaries: Vec<Company>,
148}
149
150#[derive(Debug, Clone, Serialize, Deserialize)]
151pub struct FtsResponse {
152    #[serde(flatten)]
153    pub base: BaseResponse,
154    #[serde(rename = "tech_stack")]
155    pub tech_stack: serde_json::Value,
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
159pub struct EppResponse {
160    #[serde(flatten)]
161    pub base: BaseResponse,
162    pub person: Person,
163    pub company: Company,
164}
165
166#[derive(Debug, Clone, Serialize, Deserialize)]
167pub struct FweResponse {
168    #[serde(flatten)]
169    pub base: BaseResponse,
170    pub email: String,
171}
172
173#[derive(Debug, Clone, Serialize, Deserialize)]
174pub struct TepResponse {
175    #[serde(flatten)]
176    pub base: BaseResponse,
177    pub person: Person,
178}
179
180#[derive(Debug, Clone, Serialize, Deserialize)]
181pub struct EncResponse {
182    #[serde(flatten)]
183    pub base: BaseResponse,
184    pub company: Company,
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
188pub struct CecResponse {
189    #[serde(flatten)]
190    pub base: BaseResponse,
191    pub countries: Vec<String>,
192    #[serde(rename = "total_results")]
193    pub total_results: i32,
194}
195
196#[derive(Debug, Clone, Serialize, Deserialize)]
197pub struct CloResponse {
198    #[serde(flatten)]
199    pub base: BaseResponse,
200    pub locations: Vec<serde_json::Value>,
201}
202
203#[derive(Debug, Clone, Serialize, Deserialize)]
204pub struct CseResponse {
205    #[serde(flatten)]
206    pub base: BaseResponse,
207    pub companies: Vec<Company>,
208    #[serde(rename = "total_results")]
209    pub total_results: i32,
210    pub page: i32,
211}
212
213#[derive(Debug, Clone, Serialize, Deserialize)]
214pub struct PseResponse {
215    #[serde(flatten)]
216    pub base: BaseResponse,
217    pub people: Vec<Person>,
218    #[serde(rename = "total_results")]
219    pub total_results: i32,
220    pub page: i32,
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize)]
224pub struct LbsResponse {
225    #[serde(flatten)]
226    pub base: BaseResponse,
227    pub businesses: Vec<Company>,
228    #[serde(rename = "total_results")]
229    pub total_results: i32,
230    pub page: i32,
231}
232
233// Parameter types for each service
234#[derive(Debug, Clone, Serialize, Deserialize)]
235pub struct CufParams {
236    #[serde(rename = "company_name")]
237    pub company_name: String,
238    #[serde(rename = "country_code")]
239    pub country_code: String,
240}
241
242#[derive(Debug, Clone, Serialize, Deserialize)]
243pub struct LcufParams {
244    #[serde(rename = "company_name")]
245    pub company_name: String,
246}
247
248#[derive(Debug, Clone, Serialize, Deserialize)]
249pub struct DtcParams {
250    #[serde(rename = "company_website")]
251    pub company_website: String,
252}
253
254#[derive(Debug, Clone, Serialize, Deserialize)]
255pub struct DteParams {
256    #[serde(rename = "company_website")]
257    pub company_website: String,
258}
259
260#[derive(Debug, Clone, Serialize, Deserialize)]
261pub struct NtpParams {
262    #[serde(rename = "company_name")]
263    pub company_name: String,
264}
265
266#[derive(Debug, Clone, Serialize, Deserialize)]
267pub struct RelParams {
268    pub email: String,
269}
270
271#[derive(Debug, Clone, Serialize, Deserialize)]
272pub struct FclParams {
273    pub query: String,
274}
275
276#[derive(Debug, Clone, Serialize, Deserialize)]
277pub struct ElfParams {
278    pub query: String,
279}
280
281#[derive(Debug, Clone, Serialize, Deserialize)]
282pub struct CarParams {
283    pub query: String,
284}
285
286#[derive(Debug, Clone, Serialize, Deserialize)]
287pub struct FccParams {
288    pub query: String,
289}
290
291#[derive(Debug, Clone, Serialize, Deserialize)]
292pub struct FtsParams {
293    pub query: String,
294}
295
296#[derive(Debug, Clone, Serialize, Deserialize)]
297pub struct EppParams {
298    #[serde(rename = "linkedin_url")]
299    pub linkedin_url: String,
300}
301
302#[derive(Debug, Clone, Serialize, Deserialize)]
303pub struct FweParams {
304    #[serde(rename = "linkedin_url")]
305    pub linkedin_url: String,
306}
307
308#[derive(Debug, Clone, Serialize, Deserialize)]
309pub struct TepParams {
310    #[serde(rename = "full_name")]
311    pub full_name: String,
312    pub company: String,
313}
314
315#[derive(Debug, Clone, Serialize, Deserialize)]
316pub struct EncParams {
317    pub query: String,
318}
319
320#[derive(Debug, Clone, Serialize, Deserialize)]
321pub struct CecParams {
322    pub query: String,
323}
324
325#[derive(Debug, Clone, Serialize, Deserialize)]
326pub struct CloParams {
327    pub query: String,
328}
329
330#[derive(Debug, Clone, Serialize, Deserialize, Default)]
331pub struct CseParams {
332    pub name: Option<String>,
333    pub country: Option<String>,
334    pub state: Option<String>,
335    pub city: Option<String>,
336    #[serde(rename = "followers_count_min")]
337    pub followers_count_min: Option<i32>,
338    #[serde(rename = "followers_count_max")]
339    pub followers_count_max: Option<i32>,
340    pub industry: Option<String>,
341    #[serde(rename = "employee_size")]
342    pub employee_size: Option<String>,
343    #[serde(rename = "founded_after_year")]
344    pub founded_after_year: Option<i32>,
345    #[serde(rename = "founded_before_year")]
346    pub founded_before_year: Option<i32>,
347    #[serde(rename = "funding_amount_max")]
348    pub funding_amount_max: Option<i32>,
349    #[serde(rename = "funding_amount_min")]
350    pub funding_amount_min: Option<i32>,
351    #[serde(rename = "products_services")]
352    pub products_services: Option<Vec<String>>,
353    #[serde(rename = "is_school")]
354    pub is_school: Option<bool>,
355    #[serde(rename = "annual_revenue_min")]
356    pub annual_revenue_min: Option<i32>,
357    #[serde(rename = "annual_revenue_max")]
358    pub annual_revenue_max: Option<i32>,
359    pub page: Option<i32>,
360}
361
362#[derive(Debug, Clone, Serialize, Deserialize, Default)]
363pub struct PseParams {
364    #[serde(rename = "full_name")]
365    pub full_name: Option<String>,
366    pub country: Option<String>,
367    pub state: Option<String>,
368    pub city: Option<String>,
369    #[serde(rename = "job_title_role")]
370    pub job_title_role: Option<String>,
371    #[serde(rename = "job_title_level")]
372    pub job_title_level: Option<String>,
373    #[serde(rename = "company_country")]
374    pub company_country: Option<String>,
375    #[serde(rename = "company_state")]
376    pub company_state: Option<String>,
377    #[serde(rename = "company_city")]
378    pub company_city: Option<String>,
379    #[serde(rename = "company_name")]
380    pub company_name: Option<String>,
381    #[serde(rename = "company_linkedin_url")]
382    pub company_linkedin_url: Option<String>,
383    #[serde(rename = "company_industry")]
384    pub company_industry: Option<String>,
385    #[serde(rename = "company_employee_size")]
386    pub company_employee_size: Option<String>,
387    #[serde(rename = "company_products_services")]
388    pub company_products_services: Option<Vec<String>>,
389    #[serde(rename = "company_annual_revenue_min")]
390    pub company_annual_revenue_min: Option<i32>,
391    #[serde(rename = "company_annual_revenue_max")]
392    pub company_annual_revenue_max: Option<i32>,
393    pub page: Option<i32>,
394}
395
396#[derive(Debug, Clone, Serialize, Deserialize, Default)]
397pub struct LbsParams {
398    pub name: Option<String>,
399    pub country: Option<String>,
400    pub state: Option<String>,
401    pub city: Option<String>,
402    pub industry: Option<String>,
403    pub page: Option<i32>,
404}