use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum VisionDeficiencyType {
None,
Deuteranopia,
Protanopia,
Tritanopia,
Achromatopsia,
BlurredVision,
ReducedContrast,
}
impl VisionDeficiencyType {
pub fn as_str(&self) -> &'static str {
match self {
Self::None => "none",
Self::Deuteranopia => "deuteranopia",
Self::Protanopia => "protanopia",
Self::Tritanopia => "tritanopia",
Self::Achromatopsia => "achromatopsia",
Self::BlurredVision => "blurredVision",
Self::ReducedContrast => "reducedContrast",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ExtractionModel {
Article,
Event,
FoodRecipe,
Hotel,
HotelListing,
JobListing,
JobPosting,
Organization,
Product,
ProductListing,
RealEstateProperty,
RealEstatePropertyListing,
ReviewList,
SearchEngineResults,
SocialMediaPost,
Software,
Stock,
VehicleAd,
VehicleAdListing,
}
impl ExtractionModel {
pub fn as_str(&self) -> &'static str {
match self {
Self::Article => "article",
Self::Event => "event",
Self::FoodRecipe => "food_recipe",
Self::Hotel => "hotel",
Self::HotelListing => "hotel_listing",
Self::JobListing => "job_listing",
Self::JobPosting => "job_posting",
Self::Organization => "organization",
Self::Product => "product",
Self::ProductListing => "product_listing",
Self::RealEstateProperty => "real_estate_property",
Self::RealEstatePropertyListing => "real_estate_property_listing",
Self::ReviewList => "review_list",
Self::SearchEngineResults => "search_engine_results",
Self::SocialMediaPost => "social_media_post",
Self::Software => "software",
Self::Stock => "stock",
Self::VehicleAd => "vehicle_ad",
Self::VehicleAdListing => "vehicle_ad_listing",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ProxyPool {
PublicDatacenterPool,
PublicResidentialPool,
}
impl ProxyPool {
pub fn as_str(&self) -> &'static str {
match self {
Self::PublicDatacenterPool => "public_datacenter_pool",
Self::PublicResidentialPool => "public_residential_pool",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ScreenshotFlag {
LoadImages,
DarkMode,
BlockBanners,
PrintMediaFormat,
HighQuality,
}
impl ScreenshotFlag {
pub fn as_str(&self) -> &'static str {
match self {
Self::LoadImages => "load_images",
Self::DarkMode => "dark_mode",
Self::BlockBanners => "block_banners",
Self::PrintMediaFormat => "print_media_format",
Self::HighQuality => "high_quality",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum ScreenshotFormat {
Jpg,
Png,
Webp,
Gif,
}
impl ScreenshotFormat {
pub fn as_str(&self) -> &'static str {
match self {
Self::Jpg => "jpg",
Self::Png => "png",
Self::Webp => "webp",
Self::Gif => "gif",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ScreenshotOption {
LoadImages,
DarkMode,
BlockBanners,
PrintMediaFormat,
}
impl ScreenshotOption {
pub fn as_str(&self) -> &'static str {
match self {
Self::LoadImages => "load_images",
Self::DarkMode => "dark_mode",
Self::BlockBanners => "block_banners",
Self::PrintMediaFormat => "print_media_format",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Format {
Json,
Text,
Markdown,
CleanHtml,
Raw,
}
impl Format {
pub fn as_str(&self) -> &'static str {
match self {
Self::Json => "json",
Self::Text => "text",
Self::Markdown => "markdown",
Self::CleanHtml => "clean_html",
Self::Raw => "raw",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum FormatOption {
NoLinks,
NoImages,
OnlyContent,
}
impl FormatOption {
pub fn as_str(&self) -> &'static str {
match self {
Self::NoLinks => "no_links",
Self::NoImages => "no_images",
Self::OnlyContent => "only_content",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum HttpMethod {
Get,
Post,
Put,
Patch,
Options,
Head,
}
impl HttpMethod {
pub fn as_str(&self) -> &'static str {
match self {
Self::Get => "GET",
Self::Post => "POST",
Self::Put => "PUT",
Self::Patch => "PATCH",
Self::Options => "OPTIONS",
Self::Head => "HEAD",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum CompressionFormat {
Gzip,
Zstd,
Deflate,
}
impl CompressionFormat {
pub fn as_str(&self) -> &'static str {
match self {
Self::Gzip => "gzip",
Self::Zstd => "zstd",
Self::Deflate => "deflate",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum CrawlerContentFormat {
Html,
CleanHtml,
Markdown,
Text,
Json,
ExtractedData,
PageMetadata,
}
impl CrawlerContentFormat {
pub fn as_str(&self) -> &'static str {
match self {
Self::Html => "html",
Self::CleanHtml => "clean_html",
Self::Markdown => "markdown",
Self::Text => "text",
Self::Json => "json",
Self::ExtractedData => "extracted_data",
Self::PageMetadata => "page_metadata",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum CrawlerWebhookEvent {
CrawlerStarted,
CrawlerUrlVisited,
CrawlerUrlSkipped,
CrawlerUrlDiscovered,
CrawlerUrlFailed,
CrawlerStopped,
CrawlerCancelled,
CrawlerFinished,
}
impl CrawlerWebhookEvent {
pub fn as_str(&self) -> &'static str {
match self {
Self::CrawlerStarted => "crawler_started",
Self::CrawlerUrlVisited => "crawler_url_visited",
Self::CrawlerUrlSkipped => "crawler_url_skipped",
Self::CrawlerUrlDiscovered => "crawler_url_discovered",
Self::CrawlerUrlFailed => "crawler_url_failed",
Self::CrawlerStopped => "crawler_stopped",
Self::CrawlerCancelled => "crawler_cancelled",
Self::CrawlerFinished => "crawler_finished",
}
}
}