Copyright | (c) IP2Location 2025 |
---|---|
License | MIT |
Maintainer | sales@ip2location.com |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
IPGeolocation
Description
This module allows users to query an IP address to get geolocation & proxy info.
IP2Location.io API subscription at https://www.ip2location.io
Synopsis
- data IPResult
- data ResponseObj = ResponseObj {
- ip :: String
- country_code :: String
- country_name :: String
- region_name :: String
- city_name :: String
- latitude :: Float
- longitude :: Float
- zip_code :: String
- time_zone :: String
- asn :: String
- as :: String
- isp :: Maybe String
- domain :: Maybe String
- net_speed :: Maybe String
- idd_code :: Maybe String
- area_code :: Maybe String
- weather_station_code :: Maybe String
- weather_station_name :: Maybe String
- mcc :: Maybe String
- mnc :: Maybe String
- mobile_brand :: Maybe String
- elevation :: Maybe Int
- usage_type :: Maybe String
- address_type :: Maybe String
- continent :: Maybe Continent
- country :: Maybe Country
- region :: Maybe Region
- city :: Maybe City
- time_zone_info :: Maybe TimeZoneInfo
- geotargeting :: Maybe GeoTargeting
- ads_category :: Maybe String
- ads_category_name :: Maybe String
- district :: Maybe String
- is_proxy :: Bool
- fraud_score :: Maybe Int
- proxy :: Maybe ProxyObj
- data ErrorObj = ErrorObj {}
- data ErrorInfo = ErrorInfo {
- error_code :: Int
- error_message :: String
- data Continent = Continent {
- name :: String
- code :: String
- hemisphere :: [String]
- translation :: Translation
- data Translation = Translation {}
- data Country = Country {
- name :: String
- alpha3_code :: String
- numeric_code :: Int
- demonym :: String
- flag :: String
- capital :: String
- total_area :: Int
- population :: Int
- currency :: Currency
- language :: Language
- tld :: String
- translation :: Translation
- data Currency = Currency {}
- data Language = Language {}
- data Region = Region {
- name :: String
- code :: String
- translation :: Translation
- data City = City {
- name :: String
- translation :: Translation
- data TimeZoneInfo = TimeZoneInfo {}
- data GeoTargeting = GeoTargeting {}
- data ProxyObj = ProxyObj {
- last_seen :: Int
- proxy_type :: String
- threat :: String
- provider :: String
- is_vpn :: Bool
- is_tor :: Bool
- is_data_center :: Bool
- is_public_proxy :: Bool
- is_web_proxy :: Bool
- is_web_crawler :: Bool
- is_residential_proxy :: Bool
- is_consumer_privacy_network :: Bool
- is_enterprise_private_network :: Bool
- is_spammer :: Bool
- is_scanner :: Bool
- is_botnet :: Bool
- lookUpIP :: Config -> String -> String -> IO IPResult
Documentation
Define the wrapper type for Response or Error
Constructors
IPResponse ResponseObj | |
IPError ErrorObj |
Instances
FromJSON IPResult Source # | |
Defined in IPGeolocation | |
Generic IPResult Source # | |
Show IPResult Source # | |
type Rep IPResult Source # | |
Defined in IPGeolocation type Rep IPResult = D1 ('MetaData "IPResult" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "IPResponse" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ResponseObj)) :+: C1 ('MetaCons "IPError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ErrorObj))) |
data ResponseObj Source #
Main response type
Constructors
ResponseObj | |
Fields
|
Instances
Define the error structure
Define the error detail structure
Constructors
ErrorInfo | |
Fields
|
Instances
FromJSON ErrorInfo Source # | |
Defined in IPGeolocation | |
Generic ErrorInfo Source # | |
Show ErrorInfo Source # | |
type Rep ErrorInfo Source # | |
Defined in IPGeolocation type Rep ErrorInfo = D1 ('MetaData "ErrorInfo" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "ErrorInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "error_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "error_message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) |
Continent
Constructors
Continent | |
Fields
|
Instances
FromJSON Continent Source # | |
Defined in IPGeolocation | |
Generic Continent Source # | |
Show Continent Source # | |
type Rep Continent Source # | |
Defined in IPGeolocation type Rep Continent = D1 ('MetaData "Continent" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Continent" 'PrefixI 'True) ((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "hemisphere") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "translation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Translation)))) |
data Translation Source #
Translation
Instances
FromJSON Translation Source # | |
Defined in IPGeolocation | |
Generic Translation Source # | |
Defined in IPGeolocation Associated Types type Rep Translation :: Type -> Type # | |
Show Translation Source # | |
Defined in IPGeolocation Methods showsPrec :: Int -> Translation -> ShowS # show :: Translation -> String # showList :: [Translation] -> ShowS # | |
type Rep Translation Source # | |
Defined in IPGeolocation type Rep Translation = D1 ('MetaData "Translation" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Translation" 'PrefixI 'True) (S1 ('MetaSel ('Just "lang") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "value") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)))) |
Country
Constructors
Country | |
Fields
|
Instances
Currency
Instances
FromJSON Currency Source # | |
Defined in IPGeolocation | |
Generic Currency Source # | |
Show Currency Source # | |
type Rep Currency Source # | |
Defined in IPGeolocation type Rep Currency = D1 ('MetaData "Currency" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Currency" 'PrefixI 'True) (S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "symbol") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))) |
Language
Instances
FromJSON Language Source # | |
Defined in IPGeolocation | |
Generic Language Source # | |
Show Language Source # | |
type Rep Language Source # | |
Defined in IPGeolocation type Rep Language = D1 ('MetaData "Language" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Language" 'PrefixI 'True) (S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) |
Region
Constructors
Region | |
Fields
|
Instances
FromJSON Region Source # | |
Defined in IPGeolocation | |
Generic Region Source # | |
Show Region Source # | |
type Rep Region Source # | |
Defined in IPGeolocation type Rep Region = D1 ('MetaData "Region" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Region" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "translation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Translation)))) |
City
Constructors
City | |
Fields
|
Instances
FromJSON City Source # | |
Defined in IPGeolocation | |
Generic City Source # | |
Show City Source # | |
type Rep City Source # | |
Defined in IPGeolocation type Rep City = D1 ('MetaData "City" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "City" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "translation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Translation))) |
data TimeZoneInfo Source #
Time zone info
Constructors
TimeZoneInfo | |
Instances
data GeoTargeting Source #
Geotargeting
Constructors
GeoTargeting | |
Instances
FromJSON GeoTargeting Source # | |
Defined in IPGeolocation | |
Generic GeoTargeting Source # | |
Defined in IPGeolocation Associated Types type Rep GeoTargeting :: Type -> Type # | |
Show GeoTargeting Source # | |
Defined in IPGeolocation Methods showsPrec :: Int -> GeoTargeting -> ShowS # show :: GeoTargeting -> String # showList :: [GeoTargeting] -> ShowS # | |
type Rep GeoTargeting Source # | |
Defined in IPGeolocation type Rep GeoTargeting = D1 ('MetaData "GeoTargeting" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "GeoTargeting" 'PrefixI 'True) (S1 ('MetaSel ('Just "metro") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)))) |
Proxy
Constructors
ProxyObj | |
Fields
|