-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Interface for antigate.com captcha recognition service. -- -- Interface for antigate.com captcha recognition service. @package antigate @version 0.0.1 module Text.Recognition.Antigate type AntigateKey = String type CaptchaID = Int -- | See http://antigate.com/panel.php?action=api data CaptchaConf CaptchaConf :: Bool -> Bool -> Maybe Bool -> Bool -> Word -> Word -> Bool -> Maybe Double -> CaptchaConf -- | phrase :: CaptchaConf -> Bool -- | regsense :: CaptchaConf -> Bool -- | numeric :: CaptchaConf -> Maybe Bool -- | calc :: CaptchaConf -> Bool -- | min_len :: CaptchaConf -> Word -- | max_len :: CaptchaConf -> Word -- | is_russian :: CaptchaConf -> Bool -- | Default value is set on bids page. This parameter allows to -- control maximum bid without setting it on the bids page. max_bid :: CaptchaConf -> Maybe Double data UploadResult -- | result is positive, your captcha is accepted for recognition and its -- ID follows. You may now attempt to retrieve captcha status with this -- ID. UPLOAD_OK :: CaptchaID -> UploadResult -- | user authorization key is invalid (its length is not 32 bytes as it -- should be) ERROR_WRONG_USER_KEY :: UploadResult -- | you have set wrong user authorization key in request UPLOAD_ERROR_KEY_DOES_NOT_EXIST :: UploadResult -- | account has zero or negative balance ERROR_ZERO_BALANCE :: UploadResult -- | no idle captcha workers are available at the moment, please try a bit -- later or try increasing your bid ERROR_NO_SLOT_AVAILABLE :: UploadResult -- | the size of the captcha you are uploading or pointing to is zero ERROR_ZERO_CAPTCHA_FILESIZE :: UploadResult -- | your captcha size is exceeding 100kb limit ERROR_TOO_BIG_CAPTCHA_FILESIZE :: UploadResult -- | your captcha file has wrong extension, the only allowed extensions are -- gif,jpg,jpeg,png ERROR_WRONG_FILE_EXTENSION :: UploadResult -- | Could not determine captcha file type, only allowed formats are JPG, -- GIF, PNG ERROR_IMAGE_TYPE_NOT_SUPPORTED :: UploadResult -- | Request with current account key is not allowed from your IP. Please -- refer to IP list section ERROR_IP_NOT_ALLOWED :: UploadResult UPLOAD_ERROR_UNKNOWN :: String -> UploadResult data CheckResult -- | the captcha is recognized, the guessed text follows CHECK_OK :: String -> CheckResult -- | captcha is not recognized yet, repeat request withing 1-5 seconds CAPCHA_NOT_READY :: CheckResult -- | you have set wrong user authorization key in request CHECK_ERROR_KEY_DOES_NOT_EXIST :: CheckResult -- | the captcha ID you are sending is non-numeric ERROR_WRONG_ID_FORMAT :: CheckResult CHECK_ERROR_UNKNOWN :: String -> CheckResult data SolveException SolveExceptionUpload :: UploadResult -> SolveException SolveExceptionCheck :: CaptchaID -> CheckResult -> SolveException -- | High level function to solve captcha, blocks until answer is provided -- (about 2-10 seconds). -- -- throws SolveException or HttpException when something -- goes wrong. solveCaptcha :: Int -> Int -> AntigateKey -> CaptchaConf -> FilePath -> ByteString -> IO (CaptchaID, String) -- | Same as solveCaptcha, but read contents from a file. solveCaptchaFromFile :: Int -> Int -> AntigateKey -> CaptchaConf -> FilePath -> IO (CaptchaID, String) -- | upload captcha for recognition -- -- throws HttpException on network errors. uploadCaptcha :: AntigateKey -> CaptchaConf -> FilePath -> ByteString -> IO UploadResult -- | retrieve captcha status -- -- throws HttpException on network errors. checkCaptcha :: AntigateKey -> CaptchaID -> IO CheckResult -- | retrieve multiple captcha status -- -- throws HttpException on network errors. checkCaptchas :: AntigateKey -> [CaptchaID] -> IO [CheckResult] -- | report bad captcha result -- -- throws HttpException on network errors. reportBad :: AntigateKey -> CaptchaID -> IO () -- | retrieve your current account balance -- -- throws HttpException on network errors. getBalance :: AntigateKey -> IO Double -- | Parse antigate's upload response parseUploadResult :: String -> UploadResult -- | Parse antigate's check response parseCheckResult :: String -> CheckResult -- | Parse antigate's multi-check response parseCheckResults :: String -> [CheckResult] -- | Parse antigate's multi-check response parseCheckResultNoOK :: String -> CheckResult -- | Marshal UploadResult back to its text form renderUploadResult :: UploadResult -> String -- | Marshal CheckResult back to its text form renderCheckResult :: CheckResult -> String instance Typeable SolveException instance Show CaptchaConf instance Read CaptchaConf instance Show UploadResult instance Read UploadResult instance Eq UploadResult instance Ord UploadResult instance Show CheckResult instance Read CheckResult instance Eq CheckResult instance Ord CheckResult instance Show Field instance Show SolveException instance Exception SolveException instance Default CaptchaConf