1use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub enum VisionDeficiencyType {
11 None,
13 Deuteranopia,
15 Protanopia,
17 Tritanopia,
19 Achromatopsia,
21 BlurredVision,
23 ReducedContrast,
25}
26
27impl VisionDeficiencyType {
28 pub fn as_str(&self) -> &'static str {
30 match self {
31 Self::None => "none",
32 Self::Deuteranopia => "deuteranopia",
33 Self::Protanopia => "protanopia",
34 Self::Tritanopia => "tritanopia",
35 Self::Achromatopsia => "achromatopsia",
36 Self::BlurredVision => "blurredVision",
37 Self::ReducedContrast => "reducedContrast",
38 }
39 }
40}
41
42#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
46#[serde(rename_all = "snake_case")]
47pub enum ExtractionModel {
48 Article,
50 Event,
52 FoodRecipe,
54 Hotel,
56 HotelListing,
58 JobListing,
60 JobPosting,
62 Organization,
64 Product,
66 ProductListing,
68 RealEstateProperty,
70 RealEstatePropertyListing,
72 ReviewList,
74 SearchEngineResults,
76 SocialMediaPost,
78 Software,
80 Stock,
82 VehicleAd,
84 VehicleAdListing,
86}
87
88impl ExtractionModel {
89 pub fn as_str(&self) -> &'static str {
91 match self {
92 Self::Article => "article",
93 Self::Event => "event",
94 Self::FoodRecipe => "food_recipe",
95 Self::Hotel => "hotel",
96 Self::HotelListing => "hotel_listing",
97 Self::JobListing => "job_listing",
98 Self::JobPosting => "job_posting",
99 Self::Organization => "organization",
100 Self::Product => "product",
101 Self::ProductListing => "product_listing",
102 Self::RealEstateProperty => "real_estate_property",
103 Self::RealEstatePropertyListing => "real_estate_property_listing",
104 Self::ReviewList => "review_list",
105 Self::SearchEngineResults => "search_engine_results",
106 Self::SocialMediaPost => "social_media_post",
107 Self::Software => "software",
108 Self::Stock => "stock",
109 Self::VehicleAd => "vehicle_ad",
110 Self::VehicleAdListing => "vehicle_ad_listing",
111 }
112 }
113}
114
115#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
117#[serde(rename_all = "snake_case")]
118pub enum ProxyPool {
119 PublicDatacenterPool,
121 PublicResidentialPool,
123}
124
125impl ProxyPool {
126 pub fn as_str(&self) -> &'static str {
128 match self {
129 Self::PublicDatacenterPool => "public_datacenter_pool",
130 Self::PublicResidentialPool => "public_residential_pool",
131 }
132 }
133}
134
135#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
137#[serde(rename_all = "snake_case")]
138pub enum ScreenshotFlag {
139 LoadImages,
141 DarkMode,
143 BlockBanners,
145 PrintMediaFormat,
147 HighQuality,
149}
150
151impl ScreenshotFlag {
152 pub fn as_str(&self) -> &'static str {
154 match self {
155 Self::LoadImages => "load_images",
156 Self::DarkMode => "dark_mode",
157 Self::BlockBanners => "block_banners",
158 Self::PrintMediaFormat => "print_media_format",
159 Self::HighQuality => "high_quality",
160 }
161 }
162}
163
164#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
166#[serde(rename_all = "lowercase")]
167pub enum ScreenshotFormat {
168 Jpg,
170 Png,
172 Webp,
174 Gif,
176}
177
178impl ScreenshotFormat {
179 pub fn as_str(&self) -> &'static str {
181 match self {
182 Self::Jpg => "jpg",
183 Self::Png => "png",
184 Self::Webp => "webp",
185 Self::Gif => "gif",
186 }
187 }
188}
189
190#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
193#[serde(rename_all = "snake_case")]
194pub enum ScreenshotOption {
195 LoadImages,
197 DarkMode,
199 BlockBanners,
201 PrintMediaFormat,
203}
204
205impl ScreenshotOption {
206 pub fn as_str(&self) -> &'static str {
208 match self {
209 Self::LoadImages => "load_images",
210 Self::DarkMode => "dark_mode",
211 Self::BlockBanners => "block_banners",
212 Self::PrintMediaFormat => "print_media_format",
213 }
214 }
215}
216
217#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
219#[serde(rename_all = "snake_case")]
220pub enum Format {
221 Json,
223 Text,
225 Markdown,
227 CleanHtml,
229 Raw,
231}
232
233impl Format {
234 pub fn as_str(&self) -> &'static str {
236 match self {
237 Self::Json => "json",
238 Self::Text => "text",
239 Self::Markdown => "markdown",
240 Self::CleanHtml => "clean_html",
241 Self::Raw => "raw",
242 }
243 }
244}
245
246#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
248#[serde(rename_all = "snake_case")]
249pub enum FormatOption {
250 NoLinks,
252 NoImages,
254 OnlyContent,
256}
257
258impl FormatOption {
259 pub fn as_str(&self) -> &'static str {
261 match self {
262 Self::NoLinks => "no_links",
263 Self::NoImages => "no_images",
264 Self::OnlyContent => "only_content",
265 }
266 }
267}
268
269#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
271#[serde(rename_all = "UPPERCASE")]
272pub enum HttpMethod {
273 Get,
275 Post,
277 Put,
279 Patch,
281 Options,
283 Head,
285}
286
287impl HttpMethod {
288 pub fn as_str(&self) -> &'static str {
290 match self {
291 Self::Get => "GET",
292 Self::Post => "POST",
293 Self::Put => "PUT",
294 Self::Patch => "PATCH",
295 Self::Options => "OPTIONS",
296 Self::Head => "HEAD",
297 }
298 }
299}
300
301#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
303#[serde(rename_all = "lowercase")]
304pub enum CompressionFormat {
305 Gzip,
307 Zstd,
309 Deflate,
311}
312
313impl CompressionFormat {
314 pub fn as_str(&self) -> &'static str {
316 match self {
317 Self::Gzip => "gzip",
318 Self::Zstd => "zstd",
319 Self::Deflate => "deflate",
320 }
321 }
322}
323
324#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
326#[serde(rename_all = "snake_case")]
327pub enum CrawlerContentFormat {
328 Html,
330 CleanHtml,
332 Markdown,
334 Text,
336 Json,
338 ExtractedData,
340 PageMetadata,
342}
343
344impl CrawlerContentFormat {
345 pub fn as_str(&self) -> &'static str {
347 match self {
348 Self::Html => "html",
349 Self::CleanHtml => "clean_html",
350 Self::Markdown => "markdown",
351 Self::Text => "text",
352 Self::Json => "json",
353 Self::ExtractedData => "extracted_data",
354 Self::PageMetadata => "page_metadata",
355 }
356 }
357}
358
359#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
361#[serde(rename_all = "snake_case")]
362pub enum CrawlerWebhookEvent {
363 CrawlerStarted,
365 CrawlerUrlVisited,
367 CrawlerUrlSkipped,
369 CrawlerUrlDiscovered,
371 CrawlerUrlFailed,
373 CrawlerStopped,
375 CrawlerCancelled,
377 CrawlerFinished,
379}
380
381impl CrawlerWebhookEvent {
382 pub fn as_str(&self) -> &'static str {
384 match self {
385 Self::CrawlerStarted => "crawler_started",
386 Self::CrawlerUrlVisited => "crawler_url_visited",
387 Self::CrawlerUrlSkipped => "crawler_url_skipped",
388 Self::CrawlerUrlDiscovered => "crawler_url_discovered",
389 Self::CrawlerUrlFailed => "crawler_url_failed",
390 Self::CrawlerStopped => "crawler_stopped",
391 Self::CrawlerCancelled => "crawler_cancelled",
392 Self::CrawlerFinished => "crawler_finished",
393 }
394 }
395}