-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Haskell package for easy integration with the 2captcha API.
--
-- Haskell package for easy integration with the 2captcha API.
--
-- Feature list:
--
--
-- - Lens-based API
-- - Uses Wreq for http calls
--
@package 2captcha
@version 0.1.0.0
module TwoCaptcha.Internal.Types.Captcha
-- | The id of a captcha being solved.
type CaptchaId = Text
-- | Time in milliseconds in how often to request the answer.
type PollingInterval = Int
-- | Time in milliseconds on when to timeout if the request takes too long.
type TimeoutDuration = Integer
-- | Default captcha timeout duration (120 seconds).
captchaTimeout :: TimeoutDuration
-- | Default polling interval (10 seconds).
pollingInterval :: PollingInterval
-- | Represents the request information required to solve a captcha.
data Captcha
MkCaptcha :: Options -> [(Text, Text)] -> [(Text, FilePath)] -> Captcha
[_options] :: Captcha -> Options
[_partTexts] :: Captcha -> [(Text, Text)]
[_partFiles] :: Captcha -> [(Text, FilePath)]
partTexts :: Lens' Captcha [(Text, Text)]
partFiles :: Lens' Captcha [(Text, FilePath)]
options :: Lens' Captcha Options
-- | Convert the captcha's multipart form parameters into a [Part].
parts :: Getter Captcha [Part]
-- | Default parameters for solving a captcha. Internal use only.
defaultCaptcha :: Captcha
-- | Create a lens using the given field name for multipart forms.
mkPartLens :: (Coercible Captcha a, IsString s) => Lens' Captcha [(Text, s)] -> Text -> Lens' a (Maybe s)
-- | Create a lens using the given field name for multipart form texts.
mkPartTextLens :: Coercible Captcha a => Text -> Lens' a (Maybe Text)
-- | Create a lens using the given field name for multipart form files.
mkPartFileLens :: Coercible Captcha a => Text -> Lens' a (Maybe FilePath)
-- | Creates a lens using the given field name for query parameters.
mkParamLens :: Coercible Captcha a => Text -> Lens' a (Maybe Text)
-- | Create a lens using the given field name for type b with a
-- Show and Read instance.
--
-- GOTCHA: Bool values translate to True or False. Use
-- mkLensBool instead for bool lenses.
mkParamLens' :: (Coercible Captcha a, Show b, Read b) => Text -> Lens' a (Maybe b)
-- | Create a lens using the given field name for bools.
--
-- The boolean values become:
--
--
mkParamLensBool :: Coercible Captcha a => Text -> Lens' a (Maybe Bool)
-- | Lenses for constructing options for submit.
class Coercible Captcha a => HasCaptchaLenses a
-- | Software developer id. Developers who integrate their software with
-- 2captcha earn 10% of the user's spendings.
softId :: HasCaptchaLenses a => Lens' a (Maybe Int)
-- | URL for pingback (callback) response that will be sent the
-- answer to when the captcha is solved.
pingback :: HasCaptchaLenses a => Lens' a (Maybe Text)
-- | Type of captcha to solve.
method :: HasCaptchaLenses a => Lens' a (Maybe Text)
-- | Lenses for constructing options for submit and answer.
class Coercible Captcha a => HasCommonCaptchaLenses a
-- | Your 2captcha API key.
apiKey :: HasCommonCaptchaLenses a => Lens' a (Maybe Text)
-- | If True, submit will include the
-- Access-Control-Allow-Origin:* header in the response. Used for
-- cross-domain AJAX requests in web applications.
headerACAO :: HasCommonCaptchaLenses a => Lens' a (Maybe Bool)
-- | Parameters used to retrieve the answer of a solved captcha.
newtype CaptchaRes
CaptchaRes :: Captcha -> CaptchaRes
-- | Parameters for retrieving a captcha's answer.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
captchaRes :: CaptchaRes
-- | The captcha id returned from submit.
captchaId :: Lens' CaptchaRes (Maybe Text)
class Coercible Captcha a => HasPageURL a
-- | Full URL of the page where the captcha is found.
pageUrl :: HasPageURL a => Lens' a (Maybe Text)
class Coercible Captcha a => HasProxy a
-- | Proxy to be sent to the worker who solves the captcha. You can read
-- more about proxies here.
--
-- Format must be in login:password@123.123.123.123:3128 .
proxy :: HasProxy a => Lens' a (Maybe Text)
-- | Type of your proxy: HTTP, HTTPS, SOCKS4,
-- SOCKS5.
proxyType :: HasProxy a => Lens' a (Maybe Text)
class Coercible Captcha a => HasLocalImage a
-- | File path of a captcha image.
file :: HasLocalImage a => Lens' a (Maybe FilePath)
-- | Base-64 encoded image.
body :: HasLocalImage a => Lens' a (Maybe Text)
-- | Text which is shown to the worker to help solve a captcha.
textInstructions :: HasLocalImage a => Lens' a (Maybe Text)
-- | Image file path with instructions on solving a captcha.
imgInstructions :: HasLocalImage a => Lens' a (Maybe FilePath)
class Coercible Captcha a => HasLanguage a
-- | The captcha's language:
--
--
-- - Not specified.
-- - Cyrillic captcha.
-- - Latin captcha.
--
language :: HasLanguage a => Lens' a (Maybe Int)
-- | The captcha's language code. Click here for a list of supported
-- languages.
languageCode :: HasLanguage a => Lens' a (Maybe Text)
class Coercible Captcha a => HasUserAgent a
-- | User agent that will be used by the worker when solving the captcha.
userAgent :: HasUserAgent a => Lens' a (Maybe Text)
class Coercible Captcha a => HasCookies a
-- | Cookies that will be used by the worker solving the captcha. The used
-- cookies will also be included in the response.
--
-- Format: KEY1:Value1;KEY2:Value2;
cookies :: HasCookies a => Lens' a (Maybe Text)
instance GHC.Show.Show TwoCaptcha.Internal.Types.Captcha.CaptchaRes
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.Captcha.CaptchaRes
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.Captcha.Captcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.Captcha.Captcha
instance GHC.Show.Show TwoCaptcha.Internal.Types.Captcha.Captcha
module TwoCaptcha.Internal.Types.CapyCaptcha
-- | Parameters used to solve a capy puzzle captcha.
newtype CapyCaptcha
MkCapyCaptcha :: Captcha -> CapyCaptcha
-- | Parameters used to solve a capy puzzle captcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
capyCaptcha :: CapyCaptcha
-- | Value of captchakey parameter you found on page.
captchaKey :: Lens' CapyCaptcha (Maybe Text)
-- | The domain part of the script URL found on page.
--
-- If not specified, defaults to: https://jp.api.capy.me/
scriptDomain :: Lens' CapyCaptcha (Maybe Text)
instance GHC.Show.Show TwoCaptcha.Internal.Types.CapyCaptcha.CapyCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.CapyCaptcha.CapyCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.CapyCaptcha.CapyCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasPageURL TwoCaptcha.Internal.Types.CapyCaptcha.CapyCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasProxy TwoCaptcha.Internal.Types.CapyCaptcha.CapyCaptcha
module TwoCaptcha.Internal.Types.CoordinateCaptcha
-- | Parameters used to solve a coordinate captcha.
newtype CoordinateCaptcha
MkCoordinateCaptcha :: Captcha -> CoordinateCaptcha
-- | Parameters used to solve a coordinate captcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
--
-- Possible method values:
--
--
-- - post - defines that you're sending an image with multipart
-- form
-- - base64 - defines that you're sending a base64 encoded
-- image
--
--
-- Starred required parameter rules:
--
--
-- - file is only required if captcha = "post"
-- - body is only required if captcha = "base64"
--
coordinateCaptcha :: CoordinateCaptcha
-- | Defines that you're sending a reCAPTCHA as an image.
coordinateReCAPTCHAImage :: Lens' CoordinateCaptcha (Maybe Bool)
instance GHC.Show.Show TwoCaptcha.Internal.Types.CoordinateCaptcha.CoordinateCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.CoordinateCaptcha.CoordinateCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.CoordinateCaptcha.CoordinateCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasLocalImage TwoCaptcha.Internal.Types.CoordinateCaptcha.CoordinateCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasLanguage TwoCaptcha.Internal.Types.CoordinateCaptcha.CoordinateCaptcha
module TwoCaptcha.Internal.Types.Exception
-- | Represents a possible exception when interacting with the 2captcha
-- API.
data TwoCaptchaException
-- | An error documented on 2captcha's website.
TwoCaptchaResponseException :: TwoCaptchaErrorCode -> TwoCaptchaException
-- | A non-200 status code was thrown. This should only appear in rare
-- cases.
NetworkException :: HttpException -> TwoCaptchaException
-- | An unknown error occured, likely due to a change in the 2captcha API.
UnknownError :: Text -> TwoCaptchaException
-- | Solving the captcha took too long. Try setting a higher timeout
-- duration?
SolvingTimeout :: TwoCaptchaException
-- | Possible errors when using the 2captcha API.
data TwoCaptchaErrorCode
-- | The api key you provided is invalid. Please ensure it is 32 characters
-- long.
WrongUserKey :: TwoCaptchaErrorCode
-- | The key you've provided does not exist.
KeyDoesNotExist :: TwoCaptchaErrorCode
-- | You don't have funds in your account.
ZeroBalance :: TwoCaptchaErrorCode
-- | The pageurl parameter is missing in your request.
PageUrlMissing :: TwoCaptchaErrorCode
-- | You can receive this error in two cases:
--
--
-- - If you solve token-based captchas (reCAPTCHA, hCaptcha,
-- ArkoseLabs FunCaptcha, GeeTest, etc): the queue of your captchas
-- that are not distributed to workers is too long. Queue limit changes
-- dynamically and depends on total amount of captchas awaiting solution
-- and usually it’s between 50 and 100 captchas.
-- - If you solve Normal Captcha: your maximum rate for normal
-- captchas is lower than current rate on the server. You can change your
-- maximum rate in your account's settings.
--
NoSlotAvailable :: TwoCaptchaErrorCode
-- | Image size is less than 100 bytes.
ZeroCaptchaFileSize :: TwoCaptchaErrorCode
-- | Image size is more than 100 kB.
TooBigCaptchaFileSize :: TwoCaptchaErrorCode
-- | Image file has unsupported extension. Accepted extensions: jpg, jpeg,
-- gif, png.
WrongFileExtension :: TwoCaptchaErrorCode
-- | Server can't recognize image file type.
ImageTypeNotSupported :: TwoCaptchaErrorCode
-- | Server can't get file data from your POST-request. That happens if
-- your POST-request is malformed or base64 data is not a valid base64
-- image.
UploadFailure :: TwoCaptchaErrorCode
-- | The request is sent from the IP that is not on the list of your
-- allowed IPs.
IpNotAllowed :: TwoCaptchaErrorCode
-- | Your IP address is banned due to many frequent attempts to access the
-- server using wrong authorization keys.
IpBanned :: TwoCaptchaErrorCode
-- | You can get this error code when sending reCAPTCHA V2. This happens if
-- your request contains invalid pair of googlekey and pageurl. The
-- common reason for that is that reCAPTCHA is loaded inside an iframe
-- hosted on another domain/subdomain.
BadTokenOrPageUrl :: TwoCaptchaErrorCode
-- | You can get this error code when sending reCAPTCHA V2. That means that
-- sitekey value provided in your request is incorrect: it's blank or
-- malformed.
GoogleKeyInvalid :: TwoCaptchaErrorCode
-- | The googlekey parameter is missing in your request.
GoogleKeyMissing :: TwoCaptchaErrorCode
-- | You've sent an image that is marked in 2captcha's database as
-- unrecognizable. Usually that happens if the website where you found
-- the captcha stopped sending you captchas and started to send a "deny
-- access" image.
CaptchaImageBlocked :: TwoCaptchaErrorCode
-- | You are sending too many unrecognizable images.
TooManyBadImages :: TwoCaptchaErrorCode
-- | You made more than 60 requests to in.php within 3 seconds. Your
-- account is banned for 10 seconds. Ban will be lifted automatically.
RateLimited :: TwoCaptchaErrorCode
-- | You received the error NoSlotAvailable 120 times in one minute
-- because your current bid is lower than current bid on the server.
--
-- Blocking time: 10 minutes.
Error1001 :: TwoCaptchaErrorCode
-- | You received the error ZeroBalance 120 times in one minute
-- because your balance is zero.
--
-- Blocking time: 5 minutes.
Error1002 :: TwoCaptchaErrorCode
-- | You received the error NoSlotAvailable because you are
-- uploading many captchas and server has a long queue of your captchas
-- that are not distributed to workers. You received three times more
-- errors than amount of captchas you sent (but not less than 120
-- errors). Increase the timeout if you see this error.
--
-- Blocking time: 30 seconds.
Error1003 :: TwoCaptchaErrorCode
-- | Your IP address is blocked because there were 5 requests with
-- incorrect API key from your IP.
Error1004 :: TwoCaptchaErrorCode
-- | You are making too many requests to res.php to get answers.
--
-- 2captcha uses the following rule to block your account: R > C * 20
-- + 1200
--
-- Where:
--
--
-- - R - the amount of your requests
-- - C - the amount of captchas you've uploaded
--
--
-- That means that you don't have to make more than 20 requests to
-- res.php per each captcha. Please remember that balance request sent to
-- res.php also counts!
--
-- To get your answer faster without a risk to be blocked you can use
-- pingback feature and 2captcha will send you the answer when
-- your captcha is solved.
--
-- Blocking time: 10 minutes.
Error1005 :: TwoCaptchaErrorCode
-- | The error code is returned if some required parameters are missing in
-- your request or the values have incorrect format. For example if you
-- submit Grid images but your request is missing an instruction
-- for workers.
--
-- Blocking time: 5 minutes.
BadParameters :: TwoCaptchaErrorCode
-- | You can get this error code when sending a captcha via proxy server
-- which is marked as BAD by the 2captcha API.
BadProxy :: TwoCaptchaErrorCode
-- | Your captcha is not solved yet.
CaptchaNotReady :: TwoCaptchaErrorCode
-- | 2captcha was unable to solve your captcha - three of their workers
-- were unable solve it or they didn't get an answer within 90 seconds
-- (300 seconds for reCAPTCHA V2).
--
-- You will not be charged for that request.
CaptchaUnsolvable :: TwoCaptchaErrorCode
-- | You've provided captcha ID in wrong format. The ID can contain numbers
-- only.
WrongIdFormat :: TwoCaptchaErrorCode
-- | You provided an invalid captcha id.
WrongCaptchaId :: TwoCaptchaErrorCode
-- | Error is returned when 100% accuracy feature is enabled. The error
-- means that max numbers of tries is reached but min number of matches
-- not found.
BadDuplicates :: TwoCaptchaErrorCode
-- | Error is returned to your report request if you already
-- complained lots of correctly solved captchas (more than 40%). Or if
-- more than 15 minutes passed after you submitted the captcha.
ReportNotRecorded :: TwoCaptchaErrorCode
-- | Error is returned to your report request if you are trying to
-- report the same captcha more than once.
DuplicateReport :: TwoCaptchaErrorCode
-- | You can receive this error code when registering a pingback
-- (callback) IP or domain.
--
-- This happens if your request is coming from an IP address that doesn't
-- match the IP address of your pingback IP or domain.
InvalidPingbackIp :: TwoCaptchaErrorCode
-- | You can receive this error code when sending GeeTest. This
-- error means the challenge value you provided is expired.
TokenExpired :: TwoCaptchaErrorCode
-- | Action parameter is missing or no value is provided for action
-- parameter.
EmptyAction :: TwoCaptchaErrorCode
-- | You can get this error code if we were unable to load a captcha
-- through your proxy server. The proxy will be marked as BAD by our API
-- and we will not accept requests with the proxy during 10 minutes. You
-- will recieve ERROR_BAD_PROXY code from in.php API endpoint in such
-- case.
ProxyConnectionFailed :: TwoCaptchaErrorCode
-- | The raw error code provided by 2captcha.
errorCode :: TwoCaptchaErrorCode -> String
-- | Parser instance for parsing an error code to a
-- TwoCaptchaErrorCode.
errorParser :: Parser TwoCaptchaErrorCode
-- | Read an error code as its corresponding TwoCaptchaErrorCode.
readErrorCode :: String -> Either ParseError TwoCaptchaErrorCode
instance GHC.Classes.Eq TwoCaptcha.Internal.Types.Exception.TwoCaptchaErrorCode
instance GHC.Show.Show TwoCaptcha.Internal.Types.Exception.TwoCaptchaErrorCode
instance GHC.Show.Show TwoCaptcha.Internal.Types.Exception.TwoCaptchaException
instance GHC.Exception.Type.Exception TwoCaptcha.Internal.Types.Exception.TwoCaptchaException
module TwoCaptcha.Internal.Client
-- | Runs the given http method and adapts errors to
-- TwoCaptchaException.
handle :: (MonadIO m, MonadCatch m) => IO (Response ByteString) -> m Text
-- | Encapsulates the in.php and res.php endpoints for the
-- 2captcha API.
class TwoCaptchaClient m
-- | Submit a captcha to be solved by the 2captcha API. Returns a captcha
-- id used for answer.
submit :: (TwoCaptchaClient m, Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => Session -> a -> m CaptchaId
-- | Attempt to retrieve the answer of a captcha previously submitted.
answer :: TwoCaptchaClient m => Session -> CaptchaRes -> m Text
-- | Submits a captcha and polls for the answer.
solve :: (TwoCaptchaClient m, Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => PollingInterval -> TimeoutDuration -> Session -> a -> m Text
instance (Control.Monad.IO.Class.MonadIO m, Control.Monad.Catch.MonadCatch m) => TwoCaptcha.Internal.Client.TwoCaptchaClient m
module TwoCaptcha.Internal.Types.FunCaptcha
-- | Parameters used to solve FunCaptcha.
newtype FunCaptcha
MkFunCaptcha :: Captcha -> FunCaptcha
-- | Parameters used to solve FunCaptcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
funCaptcha :: FunCaptcha
-- | Value of pk or data-pkey found on the FunCaptcha page.
publicKey :: Lens' FunCaptcha (Maybe Text)
-- | Value of surl found on the FunCaptcha page.
surl :: Lens' FunCaptcha (Maybe Text)
-- | Custom data to pass to FunCaptcha.
customDataField :: Text -> Lens' FunCaptcha (Maybe Text)
instance GHC.Show.Show TwoCaptcha.Internal.Types.FunCaptcha.FunCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.FunCaptcha.FunCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.FunCaptcha.FunCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasPageURL TwoCaptcha.Internal.Types.FunCaptcha.FunCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasProxy TwoCaptcha.Internal.Types.FunCaptcha.FunCaptcha
module TwoCaptcha.Internal.Types.GeeTestCaptcha
-- | Parameters used to solve a GeeTest captcha.
newtype GeeTestCaptcha
MkGeeTestCaptcha :: Captcha -> GeeTestCaptcha
-- | Parameters used to solve a GeeTest captcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
geeTestCaptcha :: GeeTestCaptcha
-- | Value of gt parameter you found on target website.
gt :: Lens' GeeTestCaptcha (Maybe Text)
-- | Value of challenge parameter you found on target website.
challenge :: Lens' GeeTestCaptcha (Maybe Text)
-- | Value of api_server parameter you found on target website.
apiServer :: Lens' GeeTestCaptcha (Maybe Text)
instance GHC.Show.Show TwoCaptcha.Internal.Types.GeeTestCaptcha.GeeTestCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.GeeTestCaptcha.GeeTestCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.GeeTestCaptcha.GeeTestCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasPageURL TwoCaptcha.Internal.Types.GeeTestCaptcha.GeeTestCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasProxy TwoCaptcha.Internal.Types.GeeTestCaptcha.GeeTestCaptcha
module TwoCaptcha.Internal.Types.GridCaptcha
-- | Parameters used to solve a grid captcha.
newtype GridCaptcha
MkGridCaptcha :: Captcha -> GridCaptcha
-- | Parameters for solving a grid captcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
--
-- Possible method values:
--
--
-- - post - defines that you're sending an image with multipart
-- form
-- - base64 - defines that you're sending a base64 encoded
-- image
--
--
-- Starred required parameter rules:
--
--
-- - file is only required if captcha = "post"
-- - body is only required if captcha = "base64"
--
gridCaptcha :: GridCaptcha
-- | Defines that you're sending a reCAPTCHA as an image.
reCAPTCHAImage :: Lens' GridCaptcha (Maybe Bool)
-- | Defines that you want to use a canvas method.
canvas :: Lens' GridCaptcha (Maybe Bool)
-- | Number of rows in reCAPTCHA grid.
rows :: Lens' GridCaptcha (Maybe Int)
-- | Number of columns in reCAPTCHA grid.
columns :: Lens' GridCaptcha (Maybe Int)
-- | Id of your previous request with the same captcha challenge.
previousId :: Lens' GridCaptcha (Maybe Text)
-- | Defines if the captcha can potentially have no images, or possibly
-- cannot be answered.
cannotAnswer :: Lens' GridCaptcha (Maybe Bool)
instance GHC.Show.Show TwoCaptcha.Internal.Types.GridCaptcha.GridCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.GridCaptcha.GridCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.GridCaptcha.GridCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasLocalImage TwoCaptcha.Internal.Types.GridCaptcha.GridCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasLanguage TwoCaptcha.Internal.Types.GridCaptcha.GridCaptcha
module TwoCaptcha.Internal.Types.HCaptcha
-- | Parameters used to solve hCaptcha.
newtype HCaptcha
MkHCaptcha :: Captcha -> HCaptcha
-- | Parameters used to solve hCaptcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
hCaptcha :: HCaptcha
-- | Value of data-sitekey parameter on target website.
siteKey :: Lens' HCaptcha (Maybe Text)
-- | Defines if the captcha is invisible. Invisible hCaptchas are currently
-- a rare case.
hInvisible :: Lens' HCaptcha (Maybe Bool)
-- | Custom data that is used in some implementations of hCaptcha, mostly
-- with invisible captchas. In most cases, you see it as rqdata
-- inside network requests.
--
-- IMPORTANT: you MUST provide userAgent if you submit
-- with customData. The value should match the User-Agent you use
-- when interacting with target website.
customData :: Lens' HCaptcha (Maybe Text)
instance GHC.Show.Show TwoCaptcha.Internal.Types.HCaptcha.HCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.HCaptcha.HCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.HCaptcha.HCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasPageURL TwoCaptcha.Internal.Types.HCaptcha.HCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasProxy TwoCaptcha.Internal.Types.HCaptcha.HCaptcha
module TwoCaptcha.Internal.Types.KeyCaptcha
-- | Parameters used to solve KeyCaptcha.
newtype KeyCaptcha
MkKeyCaptcha :: Captcha -> KeyCaptcha
-- | Parameters used to solve a KeyCaptcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
keyCaptcha :: KeyCaptcha
-- | Value of s_s_c_user_id parameter you found on page.
userId :: Lens' KeyCaptcha (Maybe Text)
-- | Value of s_s_c_session_id parameter you found on page.
sessionId :: Lens' KeyCaptcha (Maybe Text)
-- | Value of s_s_c_web_server_sign parameter you found on page.
webServerSign :: Lens' KeyCaptcha (Maybe Text)
-- | Value of s_s_c_web_server_sign2 parameter you found on page.
webServerSign2 :: Lens' KeyCaptcha (Maybe Text)
instance GHC.Show.Show TwoCaptcha.Internal.Types.KeyCaptcha.KeyCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.KeyCaptcha.KeyCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.KeyCaptcha.KeyCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasPageURL TwoCaptcha.Internal.Types.KeyCaptcha.KeyCaptcha
module TwoCaptcha.Internal.Types.NormalCaptcha
-- | Parameters used to solve a normal captcha.
newtype NormalCaptcha
MkNormalCaptcha :: Captcha -> NormalCaptcha
-- | Parameters for solving a normal captcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
--
-- Possible method values:
--
--
-- - post - defines that you're sending an image with multipart
-- form
-- - base64 - defines that you're sending a base64 encoded
-- image
--
--
-- Starred required parameter rules:
--
--
-- - file is only required if captcha = "post"
-- - body is only required if captcha = "base64"
--
normalCaptcha :: NormalCaptcha
-- | Defines if the captcha is a phrase.
--
--
-- - True - Captcha contains two or more words.
-- - False - Captcha contains one word.
--
phrase :: Lens' NormalCaptcha (Maybe Bool)
-- | Defines if the captcha is case sensitive.
caseSensitive :: Lens' NormalCaptcha (Maybe Bool)
-- | The captcha's format:
--
--
-- - Not specified.
-- - Captcha contains only numbers.
-- - Captcha contains only letters.
-- - Captcha contains only numbers OR only letters.
-- - Captcha contains both numbers AND letters.
--
format :: Lens' NormalCaptcha (Maybe Int)
-- | Define if the captcha requires calculation (e.g. 1 + 1 = ?).
calc :: Lens' NormalCaptcha (Maybe Bool)
-- | The minimum number of symbols in the captcha (up to 20).
minLength :: Lens' NormalCaptcha (Maybe Int)
-- | The maximum numbers of symbols in the captcha (up to 20).
maxLength :: Lens' NormalCaptcha (Maybe Int)
instance GHC.Show.Show TwoCaptcha.Internal.Types.NormalCaptcha.NormalCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.NormalCaptcha.NormalCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.NormalCaptcha.NormalCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasLocalImage TwoCaptcha.Internal.Types.NormalCaptcha.NormalCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasLanguage TwoCaptcha.Internal.Types.NormalCaptcha.NormalCaptcha
module TwoCaptcha.Internal.Types.ReCaptcha
-- | Default parameters for solving a recaptcha. Internal use only.
defaultReCAPTCHA :: Captcha
-- | Lenses for constructing ReCaptcha options.
class Coercible Captcha a => HasReCaptchaLenses a
-- | Defines if your ReCaptcha is enterprise.
enterprise :: HasReCaptchaLenses a => Lens' a (Maybe Bool)
-- | If using ReCaptchaV2, this is the value of k or
-- data-sitekey found on the captcha page.
--
-- If using ReCaptchaV3, this is the value of sitekey found
-- on the captcha page.
googleKey :: HasReCaptchaLenses a => Lens' a (Maybe Text)
-- | Domain used to load the captcha: google.com or
-- recaptcha.net.
domain :: HasReCaptchaLenses a => Lens' a (Maybe Text)
-- | Parameters used to solve reCAPTCHA V2.
newtype ReCaptchaV2
MkReCaptchaV2 :: Captcha -> ReCaptchaV2
-- | Parameters used to solve reCAPTCHA V2.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
reCAPTCHAV2 :: ReCaptchaV2
-- | Defines if the reCAPTCHA v2 is invisible.
invisible :: Lens' ReCaptchaV2 (Maybe Bool)
-- | Value of the data-s parameter found on the reCAPTCHA page.
-- Currently applicable for google services.
dataS :: Lens' ReCaptchaV2 (Maybe Text)
-- | Parameters used to solve reCAPTCHA V3.
newtype ReCaptchaV3
MkReCaptchaV3 :: Captcha -> ReCaptchaV3
-- | Parameters used to solve reCAPTCHA V3.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
reCAPTCHAV3 :: ReCaptchaV3
-- | The score needed for resolution. Currently it's almost impossible to
-- get a token with a score higher than 0.3
minScore :: Lens' ReCaptchaV3 (Maybe Double)
-- | Default reCAPTCHA timeout duration (600 seconds).
reCAPTCHATimeout :: TimeoutDuration
instance GHC.Show.Show TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV2
instance GHC.Show.Show TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV3
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV3
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV3
instance TwoCaptcha.Internal.Types.ReCaptcha.HasReCaptchaLenses TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV3
instance TwoCaptcha.Internal.Types.Captcha.HasPageURL TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV3
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV2
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV2
instance TwoCaptcha.Internal.Types.ReCaptcha.HasReCaptchaLenses TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV2
instance TwoCaptcha.Internal.Types.Captcha.HasPageURL TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV2
instance TwoCaptcha.Internal.Types.Captcha.HasProxy TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV2
instance TwoCaptcha.Internal.Types.Captcha.HasUserAgent TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV2
instance TwoCaptcha.Internal.Types.Captcha.HasCookies TwoCaptcha.Internal.Types.ReCaptcha.ReCaptchaV2
module TwoCaptcha.Internal.Types.RotateCaptcha
-- | Parameters used to solve a rotate captcha.
newtype RotateCaptcha
MkRotateCaptcha :: Captcha -> RotateCaptcha
-- | Parameters used to solve a rotate captcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
--
-- Starred required parameter rules:
--
--
-- - file is only required if your captcha is sent as a
-- file.
-- - body is only required if your captcha is sent in base64
-- format.
--
rotateCaptcha :: RotateCaptcha
-- | Angle for one rotation step in degrees. Defaults to 40 degrees if not
-- specified.
angle :: Lens' RotateCaptcha (Maybe Int)
instance GHC.Show.Show TwoCaptcha.Internal.Types.RotateCaptcha.RotateCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.RotateCaptcha.RotateCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.RotateCaptcha.RotateCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasLocalImage TwoCaptcha.Internal.Types.RotateCaptcha.RotateCaptcha
module TwoCaptcha.Internal.Types.TextCaptcha
-- | Parameters used to solve a text captcha.
newtype TextCaptcha
MkTextCaptcha :: Captcha -> TextCaptcha
-- | Parameters for solving a text captcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
textCaptcha :: TextCaptcha
-- | The text captcha's content.
textContent :: Lens' TextCaptcha (Maybe Text)
instance GHC.Show.Show TwoCaptcha.Internal.Types.TextCaptcha.TextCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.TextCaptcha.TextCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.TextCaptcha.TextCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasLanguage TwoCaptcha.Internal.Types.TextCaptcha.TextCaptcha
module TwoCaptcha.Internal.Types.TikTokCaptcha
-- | Parameters used to solve a TikTok captcha.
newtype TikTokCaptcha
MkTikTokCaptcha :: Captcha -> TikTokCaptcha
-- | Parameters used to solve a TikTok captcha.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
tikTokCaptcha :: TikTokCaptcha
-- | The aid parameter value found on the page.
aid :: Lens' TikTokCaptcha (Maybe Int)
-- | The host parameter value found on the page.
host :: Lens' TikTokCaptcha (Maybe Text)
instance GHC.Show.Show TwoCaptcha.Internal.Types.TikTokCaptcha.TikTokCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCommonCaptchaLenses TwoCaptcha.Internal.Types.TikTokCaptcha.TikTokCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCaptchaLenses TwoCaptcha.Internal.Types.TikTokCaptcha.TikTokCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasPageURL TwoCaptcha.Internal.Types.TikTokCaptcha.TikTokCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasProxy TwoCaptcha.Internal.Types.TikTokCaptcha.TikTokCaptcha
instance TwoCaptcha.Internal.Types.Captcha.HasCookies TwoCaptcha.Internal.Types.TikTokCaptcha.TikTokCaptcha
module TwoCaptcha.Captcha
-- | Represents the request information required to solve a captcha.
data Captcha
MkCaptcha :: Options -> [(Text, Text)] -> [(Text, FilePath)] -> Captcha
[_options] :: Captcha -> Options
[_partTexts] :: Captcha -> [(Text, Text)]
[_partFiles] :: Captcha -> [(Text, FilePath)]
-- | Time in milliseconds on when to timeout if the request takes too long.
type TimeoutDuration = Integer
-- | Time in milliseconds in how often to request the answer.
type PollingInterval = Int
-- | The id of a captcha being solved.
type CaptchaId = Text
-- | Default captcha timeout duration (120 seconds).
captchaTimeout :: TimeoutDuration
-- | Default polling interval (10 seconds).
pollingInterval :: PollingInterval
class Coercible Captcha a => HasCookies a
-- | Cookies that will be used by the worker solving the captcha. The used
-- cookies will also be included in the response.
--
-- Format: KEY1:Value1;KEY2:Value2;
cookies :: HasCookies a => Lens' a (Maybe Text)
class Coercible Captcha a => HasUserAgent a
-- | User agent that will be used by the worker when solving the captcha.
userAgent :: HasUserAgent a => Lens' a (Maybe Text)
class Coercible Captcha a => HasLanguage a
-- | The captcha's language:
--
--
-- - Not specified.
-- - Cyrillic captcha.
-- - Latin captcha.
--
language :: HasLanguage a => Lens' a (Maybe Int)
-- | The captcha's language code. Click here for a list of supported
-- languages.
languageCode :: HasLanguage a => Lens' a (Maybe Text)
class Coercible Captcha a => HasLocalImage a
-- | File path of a captcha image.
file :: HasLocalImage a => Lens' a (Maybe FilePath)
-- | Base-64 encoded image.
body :: HasLocalImage a => Lens' a (Maybe Text)
-- | Text which is shown to the worker to help solve a captcha.
textInstructions :: HasLocalImage a => Lens' a (Maybe Text)
-- | Image file path with instructions on solving a captcha.
imgInstructions :: HasLocalImage a => Lens' a (Maybe FilePath)
class Coercible Captcha a => HasProxy a
-- | Proxy to be sent to the worker who solves the captcha. You can read
-- more about proxies here.
--
-- Format must be in login:password@123.123.123.123:3128 .
proxy :: HasProxy a => Lens' a (Maybe Text)
-- | Type of your proxy: HTTP, HTTPS, SOCKS4,
-- SOCKS5.
proxyType :: HasProxy a => Lens' a (Maybe Text)
class Coercible Captcha a => HasPageURL a
-- | Full URL of the page where the captcha is found.
pageUrl :: HasPageURL a => Lens' a (Maybe Text)
-- | Parameters used to retrieve the answer of a solved captcha.
newtype CaptchaRes
CaptchaRes :: Captcha -> CaptchaRes
-- | Lenses for constructing options for submit and answer.
class Coercible Captcha a => HasCommonCaptchaLenses a
-- | Your 2captcha API key.
apiKey :: HasCommonCaptchaLenses a => Lens' a (Maybe Text)
-- | If True, submit will include the
-- Access-Control-Allow-Origin:* header in the response. Used for
-- cross-domain AJAX requests in web applications.
headerACAO :: HasCommonCaptchaLenses a => Lens' a (Maybe Bool)
-- | Lenses for constructing options for submit.
class Coercible Captcha a => HasCaptchaLenses a
-- | Software developer id. Developers who integrate their software with
-- 2captcha earn 10% of the user's spendings.
softId :: HasCaptchaLenses a => Lens' a (Maybe Int)
-- | URL for pingback (callback) response that will be sent the
-- answer to when the captcha is solved.
pingback :: HasCaptchaLenses a => Lens' a (Maybe Text)
-- | Type of captcha to solve.
method :: HasCaptchaLenses a => Lens' a (Maybe Text)
options :: Lens' Captcha Options
partFiles :: Lens' Captcha [(Text, FilePath)]
partTexts :: Lens' Captcha [(Text, Text)]
-- | Convert the captcha's multipart form parameters into a [Part].
parts :: Getter Captcha [Part]
-- | Create a lens using the given field name for multipart form files.
mkPartFileLens :: Coercible Captcha a => Text -> Lens' a (Maybe FilePath)
-- | Parameters for retrieving a captcha's answer.
--
-- Required parameters:
--
--
--
-- Optional parameters:
--
--
captchaRes :: CaptchaRes
-- | The captcha id returned from submit.
captchaId :: Lens' CaptchaRes (Maybe Text)
-- | Encapsulates the in.php and res.php endpoints for the
-- 2captcha API.
class TwoCaptchaClient m
-- | Submit a captcha to be solved by the 2captcha API. Returns a captcha
-- id used for answer.
submit :: (TwoCaptchaClient m, Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => Session -> a -> m CaptchaId
-- | Attempt to retrieve the answer of a captcha previously submitted.
answer :: TwoCaptchaClient m => Session -> CaptchaRes -> m Text
-- | Submits a captcha and polls for the answer.
solve :: (TwoCaptchaClient m, Coercible Captcha a, HasCaptchaLenses a, HasCommonCaptchaLenses a) => PollingInterval -> TimeoutDuration -> Session -> a -> m Text