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 PublicTorPool,
125}
126
127impl ProxyPool {
128 pub fn as_str(&self) -> &'static str {
130 match self {
131 Self::PublicDatacenterPool => "public_datacenter_pool",
132 Self::PublicResidentialPool => "public_residential_pool",
133 Self::PublicTorPool => "public_tor_pool",
134 }
135 }
136}
137
138#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
140#[serde(rename_all = "snake_case")]
141pub enum ScreenshotFlag {
142 LoadImages,
144 DarkMode,
146 BlockBanners,
148 PrintMediaFormat,
150 HighQuality,
152}
153
154impl ScreenshotFlag {
155 pub fn as_str(&self) -> &'static str {
157 match self {
158 Self::LoadImages => "load_images",
159 Self::DarkMode => "dark_mode",
160 Self::BlockBanners => "block_banners",
161 Self::PrintMediaFormat => "print_media_format",
162 Self::HighQuality => "high_quality",
163 }
164 }
165}
166
167#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
169#[serde(rename_all = "lowercase")]
170pub enum ScreenshotFormat {
171 Jpg,
173 Png,
175 Webp,
177 Gif,
179}
180
181impl ScreenshotFormat {
182 pub fn as_str(&self) -> &'static str {
184 match self {
185 Self::Jpg => "jpg",
186 Self::Png => "png",
187 Self::Webp => "webp",
188 Self::Gif => "gif",
189 }
190 }
191}
192
193#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
196#[serde(rename_all = "snake_case")]
197pub enum ScreenshotOption {
198 LoadImages,
200 DarkMode,
202 BlockBanners,
204 PrintMediaFormat,
206}
207
208impl ScreenshotOption {
209 pub fn as_str(&self) -> &'static str {
211 match self {
212 Self::LoadImages => "load_images",
213 Self::DarkMode => "dark_mode",
214 Self::BlockBanners => "block_banners",
215 Self::PrintMediaFormat => "print_media_format",
216 }
217 }
218}
219
220#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
222#[serde(rename_all = "snake_case")]
223pub enum Format {
224 Json,
226 Text,
228 Markdown,
230 CleanHtml,
232 Raw,
234}
235
236impl Format {
237 pub fn as_str(&self) -> &'static str {
239 match self {
240 Self::Json => "json",
241 Self::Text => "text",
242 Self::Markdown => "markdown",
243 Self::CleanHtml => "clean_html",
244 Self::Raw => "raw",
245 }
246 }
247}
248
249#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
251#[serde(rename_all = "snake_case")]
252pub enum FormatOption {
253 NoLinks,
255 NoImages,
257 OnlyContent,
259}
260
261impl FormatOption {
262 pub fn as_str(&self) -> &'static str {
264 match self {
265 Self::NoLinks => "no_links",
266 Self::NoImages => "no_images",
267 Self::OnlyContent => "only_content",
268 }
269 }
270}
271
272#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
274#[serde(rename_all = "UPPERCASE")]
275pub enum HttpMethod {
276 Get,
278 Post,
280 Put,
282 Patch,
284 Options,
286 Head,
288}
289
290impl HttpMethod {
291 pub fn as_str(&self) -> &'static str {
293 match self {
294 Self::Get => "GET",
295 Self::Post => "POST",
296 Self::Put => "PUT",
297 Self::Patch => "PATCH",
298 Self::Options => "OPTIONS",
299 Self::Head => "HEAD",
300 }
301 }
302}
303
304#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
306#[serde(rename_all = "lowercase")]
307pub enum CompressionFormat {
308 Gzip,
310 Zstd,
312 Deflate,
314}
315
316impl CompressionFormat {
317 pub fn as_str(&self) -> &'static str {
319 match self {
320 Self::Gzip => "gzip",
321 Self::Zstd => "zstd",
322 Self::Deflate => "deflate",
323 }
324 }
325}
326
327#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
329#[serde(rename_all = "snake_case")]
330pub enum CrawlerContentFormat {
331 Html,
333 CleanHtml,
335 Markdown,
337 Text,
339 Json,
341 ExtractedData,
343 PageMetadata,
345}
346
347impl CrawlerContentFormat {
348 pub fn as_str(&self) -> &'static str {
350 match self {
351 Self::Html => "html",
352 Self::CleanHtml => "clean_html",
353 Self::Markdown => "markdown",
354 Self::Text => "text",
355 Self::Json => "json",
356 Self::ExtractedData => "extracted_data",
357 Self::PageMetadata => "page_metadata",
358 }
359 }
360}
361
362#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
364#[serde(rename_all = "snake_case")]
365pub enum CrawlerWebhookEvent {
366 CrawlerStarted,
368 CrawlerUrlVisited,
370 CrawlerUrlSkipped,
372 CrawlerUrlDiscovered,
374 CrawlerUrlFailed,
376 CrawlerStopped,
378 CrawlerCancelled,
380 CrawlerFinished,
382}
383
384impl CrawlerWebhookEvent {
385 pub fn as_str(&self) -> &'static str {
387 match self {
388 Self::CrawlerStarted => "crawler_started",
389 Self::CrawlerUrlVisited => "crawler_url_visited",
390 Self::CrawlerUrlSkipped => "crawler_url_skipped",
391 Self::CrawlerUrlDiscovered => "crawler_url_discovered",
392 Self::CrawlerUrlFailed => "crawler_url_failed",
393 Self::CrawlerStopped => "crawler_stopped",
394 Self::CrawlerCancelled => "crawler_cancelled",
395 Self::CrawlerFinished => "crawler_finished",
396 }
397 }
398}