rust_anticaptcha/core/
enums.rs

1use std::fmt;
2
3pub trait TaskTypeTrait {
4    /// `TaskTypeTrait` analog for `to_string()`
5    fn as_string(&self) -> String;
6}
7
8/// `ImageTaskType` stored image captcha types
9#[derive(Debug)]
10pub enum ImageTaskType {
11    ImageToTextTask,
12    ImageToCoordinatesTask,
13}
14impl TaskTypeTrait for ImageTaskType {
15    /// `ImageTaskType` analog for `to_string()`
16    fn as_string(&self) -> String {
17        format!("{:?}", &self)
18    }
19}
20
21/// `TokenTaskType` stored token captcha types
22/// Token captcha - captcha solved by tokens
23#[derive(Debug)]
24pub enum TokenTaskType {
25    RecaptchaV2Task,
26    RecaptchaV2TaskProxyless,
27
28    RecaptchaV3Enterprise,
29    RecaptchaV3TaskProxyless,
30
31    RecaptchaV2EnterpriseTask,
32    RecaptchaV2EnterpriseTaskProxyless,
33
34    FunCaptchaTask,
35    FunCaptchaTaskProxyless,
36
37    GeeTestTask,
38    GeeTestTaskProxyless,
39
40    TurnstileTask,
41    TurnstileTaskProxyless,
42
43    AntiGateTask,
44}
45impl TaskTypeTrait for TokenTaskType {
46    /// `TokenTaskType` analog for `to_string()`
47    fn as_string(&self) -> String {
48        format!("{:?}", &self)
49    }
50}
51
52/// `EnpPostfix` stored endpoints for service communication
53#[derive(Debug)]
54pub enum EnpPostfix {
55    // tasks processing
56    createTask,
57    getTaskResult,
58    // get account info
59    getBalance,
60    getQueueStats,
61    getAppStats,
62    getSpendingStats,
63    // reports
64    reportIncorrectImageCaptcha,
65    reportIncorrectRecaptcha,
66    reportCorrectRecaptcha,
67    reportIncorrectHcaptcha,
68    pushAntiGateVariable,
69}
70impl fmt::Display for EnpPostfix {
71    /// `EnpPostfix` formatter
72    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
73        write!(f, "{:?}", self)
74    }
75}
76
77/// `GetResultStatus` stored available tasks status
78#[derive(Debug)]
79pub enum GetResultStatus {
80    processing, // captcha still processing
81    ready,      // captcha ready
82    error,      // captcha solving failed
83}
84impl fmt::Display for GetResultStatus {
85    /// `GetResultStatus` formatter
86    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
87        write!(f, "{:?}", self)
88    }
89}