google-static-maps 0.3.0.0 → 0.4.0.0
raw patch · 4 files changed
+829/−114 lines, 4 filesdep +MissingHdep +base64-bytestringdep +bytestringPVP ok
version bump matches the API change (PVP)
Dependencies added: MissingH, base64-bytestring, bytestring, cryptonite, memory, utf8-string
API changes (from Hackage documentation)
- Web.Google.Maps.Common: Location :: Double -> Double -> Location
- Web.Google.Maps.Common: instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Common.Location
- Web.Google.Maps.Common: instance GHC.Generics.Generic Web.Google.Maps.Common.Location
- Web.Google.Static.Maps: Location :: Double -> Double -> Location
+ Web.Google.Maps.Common: AC :: Region
+ Web.Google.Maps.Common: AD :: Region
+ Web.Google.Maps.Common: AE :: Region
+ Web.Google.Maps.Common: AF :: Region
+ Web.Google.Maps.Common: AG :: Region
+ Web.Google.Maps.Common: AI :: Region
+ Web.Google.Maps.Common: AL :: Region
+ Web.Google.Maps.Common: AM :: Region
+ Web.Google.Maps.Common: AO :: Region
+ Web.Google.Maps.Common: AQ :: Region
+ Web.Google.Maps.Common: AR :: Region
+ Web.Google.Maps.Common: AS :: Region
+ Web.Google.Maps.Common: AT :: Region
+ Web.Google.Maps.Common: AU :: Region
+ Web.Google.Maps.Common: AW :: Region
+ Web.Google.Maps.Common: AX :: Region
+ Web.Google.Maps.Common: AZ :: Region
+ Web.Google.Maps.Common: Address :: Text -> Address
+ Web.Google.Maps.Common: Arabic :: Language
+ Web.Google.Maps.Common: BA :: Region
+ Web.Google.Maps.Common: BB :: Region
+ Web.Google.Maps.Common: BD :: Region
+ Web.Google.Maps.Common: BE :: Region
+ Web.Google.Maps.Common: BF :: Region
+ Web.Google.Maps.Common: BG :: Region
+ Web.Google.Maps.Common: BH :: Region
+ Web.Google.Maps.Common: BI :: Region
+ Web.Google.Maps.Common: BJ :: Region
+ Web.Google.Maps.Common: BL :: Region
+ Web.Google.Maps.Common: BM :: Region
+ Web.Google.Maps.Common: BN :: Region
+ Web.Google.Maps.Common: BO :: Region
+ Web.Google.Maps.Common: BQ :: Region
+ Web.Google.Maps.Common: BR :: Region
+ Web.Google.Maps.Common: BS :: Region
+ Web.Google.Maps.Common: BT :: Region
+ Web.Google.Maps.Common: BV :: Region
+ Web.Google.Maps.Common: BW :: Region
+ Web.Google.Maps.Common: BY :: Region
+ Web.Google.Maps.Common: BZ :: Region
+ Web.Google.Maps.Common: Basque :: Language
+ Web.Google.Maps.Common: Bengali :: Language
+ Web.Google.Maps.Common: Bulgarian :: Language
+ Web.Google.Maps.Common: CA :: Region
+ Web.Google.Maps.Common: CC :: Region
+ Web.Google.Maps.Common: CD :: Region
+ Web.Google.Maps.Common: CF :: Region
+ Web.Google.Maps.Common: CG :: Region
+ Web.Google.Maps.Common: CH :: Region
+ Web.Google.Maps.Common: CI :: Region
+ Web.Google.Maps.Common: CK :: Region
+ Web.Google.Maps.Common: CL :: Region
+ Web.Google.Maps.Common: CM :: Region
+ Web.Google.Maps.Common: CN :: Region
+ Web.Google.Maps.Common: CO :: Region
+ Web.Google.Maps.Common: CR :: Region
+ Web.Google.Maps.Common: CU :: Region
+ Web.Google.Maps.Common: CV :: Region
+ Web.Google.Maps.Common: CW :: Region
+ Web.Google.Maps.Common: CX :: Region
+ Web.Google.Maps.Common: CY :: Region
+ Web.Google.Maps.Common: CZ :: Region
+ Web.Google.Maps.Common: Catalan :: Language
+ Web.Google.Maps.Common: ChineseSimplified :: Language
+ Web.Google.Maps.Common: ChineseTraditional :: Language
+ Web.Google.Maps.Common: Coords :: LatLng -> Location
+ Web.Google.Maps.Common: Croatian :: Language
+ Web.Google.Maps.Common: Czech :: Language
+ Web.Google.Maps.Common: DE :: Region
+ Web.Google.Maps.Common: DJ :: Region
+ Web.Google.Maps.Common: DK :: Region
+ Web.Google.Maps.Common: DM :: Region
+ Web.Google.Maps.Common: DO :: Region
+ Web.Google.Maps.Common: DZ :: Region
+ Web.Google.Maps.Common: Danish :: Language
+ Web.Google.Maps.Common: Dutch :: Language
+ Web.Google.Maps.Common: EC :: Region
+ Web.Google.Maps.Common: EE :: Region
+ Web.Google.Maps.Common: EG :: Region
+ Web.Google.Maps.Common: EH :: Region
+ Web.Google.Maps.Common: ER :: Region
+ Web.Google.Maps.Common: ES :: Region
+ Web.Google.Maps.Common: ET :: Region
+ Web.Google.Maps.Common: EU :: Region
+ Web.Google.Maps.Common: English :: Language
+ Web.Google.Maps.Common: EnglishAustralian :: Language
+ Web.Google.Maps.Common: EnglishBritish :: Language
+ Web.Google.Maps.Common: FI :: Region
+ Web.Google.Maps.Common: FJ :: Region
+ Web.Google.Maps.Common: FK :: Region
+ Web.Google.Maps.Common: FM :: Region
+ Web.Google.Maps.Common: FO :: Region
+ Web.Google.Maps.Common: FR :: Region
+ Web.Google.Maps.Common: Farsi :: Language
+ Web.Google.Maps.Common: Filipino :: Language
+ Web.Google.Maps.Common: Finnish :: Language
+ Web.Google.Maps.Common: French :: Language
+ Web.Google.Maps.Common: GA :: Region
+ Web.Google.Maps.Common: GB :: Region
+ Web.Google.Maps.Common: GD :: Region
+ Web.Google.Maps.Common: GE :: Region
+ Web.Google.Maps.Common: GF :: Region
+ Web.Google.Maps.Common: GG :: Region
+ Web.Google.Maps.Common: GH :: Region
+ Web.Google.Maps.Common: GI :: Region
+ Web.Google.Maps.Common: GL :: Region
+ Web.Google.Maps.Common: GM :: Region
+ Web.Google.Maps.Common: GN :: Region
+ Web.Google.Maps.Common: GP :: Region
+ Web.Google.Maps.Common: GQ :: Region
+ Web.Google.Maps.Common: GR :: Region
+ Web.Google.Maps.Common: GS :: Region
+ Web.Google.Maps.Common: GT :: Region
+ Web.Google.Maps.Common: GU :: Region
+ Web.Google.Maps.Common: GW :: Region
+ Web.Google.Maps.Common: GY :: Region
+ Web.Google.Maps.Common: Galician :: Language
+ Web.Google.Maps.Common: German :: Language
+ Web.Google.Maps.Common: Greek :: Language
+ Web.Google.Maps.Common: Gujarati :: Language
+ Web.Google.Maps.Common: HK :: Region
+ Web.Google.Maps.Common: HM :: Region
+ Web.Google.Maps.Common: HN :: Region
+ Web.Google.Maps.Common: HR :: Region
+ Web.Google.Maps.Common: HT :: Region
+ Web.Google.Maps.Common: HU :: Region
+ Web.Google.Maps.Common: Hebrew :: Language
+ Web.Google.Maps.Common: Hindi :: Language
+ Web.Google.Maps.Common: Hungarian :: Language
+ Web.Google.Maps.Common: ID :: Region
+ Web.Google.Maps.Common: IE :: Region
+ Web.Google.Maps.Common: IL :: Region
+ Web.Google.Maps.Common: IM :: Region
+ Web.Google.Maps.Common: IN :: Region
+ Web.Google.Maps.Common: IO :: Region
+ Web.Google.Maps.Common: IQ :: Region
+ Web.Google.Maps.Common: IR :: Region
+ Web.Google.Maps.Common: IS :: Region
+ Web.Google.Maps.Common: IT :: Region
+ Web.Google.Maps.Common: Indonesian :: Language
+ Web.Google.Maps.Common: Italian :: Language
+ Web.Google.Maps.Common: JE :: Region
+ Web.Google.Maps.Common: JM :: Region
+ Web.Google.Maps.Common: JO :: Region
+ Web.Google.Maps.Common: JP :: Region
+ Web.Google.Maps.Common: Japanese :: Language
+ Web.Google.Maps.Common: KE :: Region
+ Web.Google.Maps.Common: KG :: Region
+ Web.Google.Maps.Common: KH :: Region
+ Web.Google.Maps.Common: KI :: Region
+ Web.Google.Maps.Common: KM :: Region
+ Web.Google.Maps.Common: KN :: Region
+ Web.Google.Maps.Common: KP :: Region
+ Web.Google.Maps.Common: KR :: Region
+ Web.Google.Maps.Common: KW :: Region
+ Web.Google.Maps.Common: KY :: Region
+ Web.Google.Maps.Common: KZ :: Region
+ Web.Google.Maps.Common: Kannada :: Language
+ Web.Google.Maps.Common: Korean :: Language
+ Web.Google.Maps.Common: LA :: Region
+ Web.Google.Maps.Common: LB :: Region
+ Web.Google.Maps.Common: LC :: Region
+ Web.Google.Maps.Common: LI :: Region
+ Web.Google.Maps.Common: LK :: Region
+ Web.Google.Maps.Common: LR :: Region
+ Web.Google.Maps.Common: LS :: Region
+ Web.Google.Maps.Common: LT :: Region
+ Web.Google.Maps.Common: LU :: Region
+ Web.Google.Maps.Common: LV :: Region
+ Web.Google.Maps.Common: LY :: Region
+ Web.Google.Maps.Common: LatLng :: Double -> Double -> LatLng
+ Web.Google.Maps.Common: Latvian :: Language
+ Web.Google.Maps.Common: Lithuanian :: Language
+ Web.Google.Maps.Common: Locale :: Address -> Location
+ Web.Google.Maps.Common: MA :: Region
+ Web.Google.Maps.Common: MC :: Region
+ Web.Google.Maps.Common: MD :: Region
+ Web.Google.Maps.Common: ME :: Region
+ Web.Google.Maps.Common: MF :: Region
+ Web.Google.Maps.Common: MG :: Region
+ Web.Google.Maps.Common: MH :: Region
+ Web.Google.Maps.Common: MK :: Region
+ Web.Google.Maps.Common: ML :: Region
+ Web.Google.Maps.Common: MM :: Region
+ Web.Google.Maps.Common: MN :: Region
+ Web.Google.Maps.Common: MO :: Region
+ Web.Google.Maps.Common: MP :: Region
+ Web.Google.Maps.Common: MQ :: Region
+ Web.Google.Maps.Common: MR :: Region
+ Web.Google.Maps.Common: MS :: Region
+ Web.Google.Maps.Common: MT :: Region
+ Web.Google.Maps.Common: MU :: Region
+ Web.Google.Maps.Common: MV :: Region
+ Web.Google.Maps.Common: MW :: Region
+ Web.Google.Maps.Common: MX :: Region
+ Web.Google.Maps.Common: MY :: Region
+ Web.Google.Maps.Common: MZ :: Region
+ Web.Google.Maps.Common: Malayalam :: Language
+ Web.Google.Maps.Common: Marathi :: Language
+ Web.Google.Maps.Common: NA :: Region
+ Web.Google.Maps.Common: NC :: Region
+ Web.Google.Maps.Common: NE :: Region
+ Web.Google.Maps.Common: NF :: Region
+ Web.Google.Maps.Common: NG :: Region
+ Web.Google.Maps.Common: NI :: Region
+ Web.Google.Maps.Common: NL :: Region
+ Web.Google.Maps.Common: NO :: Region
+ Web.Google.Maps.Common: NP :: Region
+ Web.Google.Maps.Common: NR :: Region
+ Web.Google.Maps.Common: NU :: Region
+ Web.Google.Maps.Common: NZ :: Region
+ Web.Google.Maps.Common: Norwegian :: Language
+ Web.Google.Maps.Common: OM :: Region
+ Web.Google.Maps.Common: PA :: Region
+ Web.Google.Maps.Common: PE :: Region
+ Web.Google.Maps.Common: PF :: Region
+ Web.Google.Maps.Common: PG :: Region
+ Web.Google.Maps.Common: PH :: Region
+ Web.Google.Maps.Common: PK :: Region
+ Web.Google.Maps.Common: PL :: Region
+ Web.Google.Maps.Common: PM :: Region
+ Web.Google.Maps.Common: PN :: Region
+ Web.Google.Maps.Common: PR :: Region
+ Web.Google.Maps.Common: PS :: Region
+ Web.Google.Maps.Common: PT :: Region
+ Web.Google.Maps.Common: PW :: Region
+ Web.Google.Maps.Common: PY :: Region
+ Web.Google.Maps.Common: Polish :: Language
+ Web.Google.Maps.Common: Portuguese :: Language
+ Web.Google.Maps.Common: PortugueseBrazil :: Language
+ Web.Google.Maps.Common: PortuguesePortugal :: Language
+ Web.Google.Maps.Common: QA :: Region
+ Web.Google.Maps.Common: RE :: Region
+ Web.Google.Maps.Common: RO :: Region
+ Web.Google.Maps.Common: RS :: Region
+ Web.Google.Maps.Common: RU :: Region
+ Web.Google.Maps.Common: RW :: Region
+ Web.Google.Maps.Common: Romanian :: Language
+ Web.Google.Maps.Common: Russian :: Language
+ Web.Google.Maps.Common: SA :: Region
+ Web.Google.Maps.Common: SB :: Region
+ Web.Google.Maps.Common: SC :: Region
+ Web.Google.Maps.Common: SD :: Region
+ Web.Google.Maps.Common: SE :: Region
+ Web.Google.Maps.Common: SG :: Region
+ Web.Google.Maps.Common: SH :: Region
+ Web.Google.Maps.Common: SI :: Region
+ Web.Google.Maps.Common: SJ :: Region
+ Web.Google.Maps.Common: SK :: Region
+ Web.Google.Maps.Common: SL :: Region
+ Web.Google.Maps.Common: SM :: Region
+ Web.Google.Maps.Common: SN :: Region
+ Web.Google.Maps.Common: SO :: Region
+ Web.Google.Maps.Common: SR :: Region
+ Web.Google.Maps.Common: SS :: Region
+ Web.Google.Maps.Common: ST :: Region
+ Web.Google.Maps.Common: SV :: Region
+ Web.Google.Maps.Common: SX :: Region
+ Web.Google.Maps.Common: SY :: Region
+ Web.Google.Maps.Common: SZ :: Region
+ Web.Google.Maps.Common: Serbian :: Language
+ Web.Google.Maps.Common: Slovak :: Language
+ Web.Google.Maps.Common: Slovenian :: Language
+ Web.Google.Maps.Common: Spanish :: Language
+ Web.Google.Maps.Common: Swedish :: Language
+ Web.Google.Maps.Common: TC :: Region
+ Web.Google.Maps.Common: TD :: Region
+ Web.Google.Maps.Common: TF :: Region
+ Web.Google.Maps.Common: TG :: Region
+ Web.Google.Maps.Common: TH :: Region
+ Web.Google.Maps.Common: TJ :: Region
+ Web.Google.Maps.Common: TK :: Region
+ Web.Google.Maps.Common: TL :: Region
+ Web.Google.Maps.Common: TM :: Region
+ Web.Google.Maps.Common: TN :: Region
+ Web.Google.Maps.Common: TO :: Region
+ Web.Google.Maps.Common: TR :: Region
+ Web.Google.Maps.Common: TT :: Region
+ Web.Google.Maps.Common: TV :: Region
+ Web.Google.Maps.Common: TW :: Region
+ Web.Google.Maps.Common: TZ :: Region
+ Web.Google.Maps.Common: Tagalog :: Language
+ Web.Google.Maps.Common: Tamil :: Language
+ Web.Google.Maps.Common: Telugu :: Language
+ Web.Google.Maps.Common: Thai :: Language
+ Web.Google.Maps.Common: Turkish :: Language
+ Web.Google.Maps.Common: UA :: Region
+ Web.Google.Maps.Common: UG :: Region
+ Web.Google.Maps.Common: UK :: Region
+ Web.Google.Maps.Common: UM :: Region
+ Web.Google.Maps.Common: US :: Region
+ Web.Google.Maps.Common: UY :: Region
+ Web.Google.Maps.Common: UZ :: Region
+ Web.Google.Maps.Common: Ukrainian :: Language
+ Web.Google.Maps.Common: VA :: Region
+ Web.Google.Maps.Common: VC :: Region
+ Web.Google.Maps.Common: VE :: Region
+ Web.Google.Maps.Common: VG :: Region
+ Web.Google.Maps.Common: VI :: Region
+ Web.Google.Maps.Common: VN :: Region
+ Web.Google.Maps.Common: VU :: Region
+ Web.Google.Maps.Common: Vietnamese :: Language
+ Web.Google.Maps.Common: WF :: Region
+ Web.Google.Maps.Common: WS :: Region
+ Web.Google.Maps.Common: YE :: Region
+ Web.Google.Maps.Common: YT :: Region
+ Web.Google.Maps.Common: ZA :: Region
+ Web.Google.Maps.Common: ZM :: Region
+ Web.Google.Maps.Common: ZW :: Region
+ Web.Google.Maps.Common: data Language
+ Web.Google.Maps.Common: data LatLng
+ Web.Google.Maps.Common: data Region
+ Web.Google.Maps.Common: instance Data.Aeson.Types.FromJSON.FromJSON Web.Google.Maps.Common.LatLng
+ Web.Google.Maps.Common: instance GHC.Classes.Eq Web.Google.Maps.Common.Address
+ Web.Google.Maps.Common: instance GHC.Classes.Eq Web.Google.Maps.Common.Language
+ Web.Google.Maps.Common: instance GHC.Classes.Eq Web.Google.Maps.Common.LatLng
+ Web.Google.Maps.Common: instance GHC.Classes.Eq Web.Google.Maps.Common.Region
+ Web.Google.Maps.Common: instance GHC.Generics.Generic Web.Google.Maps.Common.LatLng
+ Web.Google.Maps.Common: instance GHC.Show.Show Web.Google.Maps.Common.Address
+ Web.Google.Maps.Common: instance GHC.Show.Show Web.Google.Maps.Common.Language
+ Web.Google.Maps.Common: instance GHC.Show.Show Web.Google.Maps.Common.LatLng
+ Web.Google.Maps.Common: instance GHC.Show.Show Web.Google.Maps.Common.Region
+ Web.Google.Maps.Common: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Common.Address
+ Web.Google.Maps.Common: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Common.Language
+ Web.Google.Maps.Common: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Common.LatLng
+ Web.Google.Maps.Common: instance Web.Internal.HttpApiData.ToHttpApiData Web.Google.Maps.Common.Region
+ Web.Google.Maps.Common: newtype Address
+ Web.Google.Static.Maps: AC :: Region
+ Web.Google.Static.Maps: AD :: Region
+ Web.Google.Static.Maps: AE :: Region
+ Web.Google.Static.Maps: AF :: Region
+ Web.Google.Static.Maps: AG :: Region
+ Web.Google.Static.Maps: AI :: Region
+ Web.Google.Static.Maps: AL :: Region
+ Web.Google.Static.Maps: AM :: Region
+ Web.Google.Static.Maps: AO :: Region
+ Web.Google.Static.Maps: AQ :: Region
+ Web.Google.Static.Maps: AR :: Region
+ Web.Google.Static.Maps: AS :: Region
+ Web.Google.Static.Maps: AT :: Region
+ Web.Google.Static.Maps: AU :: Region
+ Web.Google.Static.Maps: AW :: Region
+ Web.Google.Static.Maps: AX :: Region
+ Web.Google.Static.Maps: AZ :: Region
+ Web.Google.Static.Maps: Address :: Text -> Address
+ Web.Google.Static.Maps: Arabic :: Language
+ Web.Google.Static.Maps: BA :: Region
+ Web.Google.Static.Maps: BB :: Region
+ Web.Google.Static.Maps: BD :: Region
+ Web.Google.Static.Maps: BE :: Region
+ Web.Google.Static.Maps: BF :: Region
+ Web.Google.Static.Maps: BG :: Region
+ Web.Google.Static.Maps: BH :: Region
+ Web.Google.Static.Maps: BI :: Region
+ Web.Google.Static.Maps: BJ :: Region
+ Web.Google.Static.Maps: BL :: Region
+ Web.Google.Static.Maps: BM :: Region
+ Web.Google.Static.Maps: BN :: Region
+ Web.Google.Static.Maps: BO :: Region
+ Web.Google.Static.Maps: BQ :: Region
+ Web.Google.Static.Maps: BR :: Region
+ Web.Google.Static.Maps: BS :: Region
+ Web.Google.Static.Maps: BT :: Region
+ Web.Google.Static.Maps: BV :: Region
+ Web.Google.Static.Maps: BW :: Region
+ Web.Google.Static.Maps: BY :: Region
+ Web.Google.Static.Maps: BZ :: Region
+ Web.Google.Static.Maps: Basque :: Language
+ Web.Google.Static.Maps: Bengali :: Language
+ Web.Google.Static.Maps: Bulgarian :: Language
+ Web.Google.Static.Maps: CA :: Region
+ Web.Google.Static.Maps: CC :: Region
+ Web.Google.Static.Maps: CD :: Region
+ Web.Google.Static.Maps: CF :: Region
+ Web.Google.Static.Maps: CG :: Region
+ Web.Google.Static.Maps: CH :: Region
+ Web.Google.Static.Maps: CI :: Region
+ Web.Google.Static.Maps: CK :: Region
+ Web.Google.Static.Maps: CL :: Region
+ Web.Google.Static.Maps: CM :: Region
+ Web.Google.Static.Maps: CN :: Region
+ Web.Google.Static.Maps: CO :: Region
+ Web.Google.Static.Maps: CR :: Region
+ Web.Google.Static.Maps: CU :: Region
+ Web.Google.Static.Maps: CV :: Region
+ Web.Google.Static.Maps: CW :: Region
+ Web.Google.Static.Maps: CX :: Region
+ Web.Google.Static.Maps: CY :: Region
+ Web.Google.Static.Maps: CZ :: Region
+ Web.Google.Static.Maps: Catalan :: Language
+ Web.Google.Static.Maps: ChineseSimplified :: Language
+ Web.Google.Static.Maps: ChineseTraditional :: Language
+ Web.Google.Static.Maps: Coords :: LatLng -> Location
+ Web.Google.Static.Maps: Croatian :: Language
+ Web.Google.Static.Maps: Czech :: Language
+ Web.Google.Static.Maps: DE :: Region
+ Web.Google.Static.Maps: DJ :: Region
+ Web.Google.Static.Maps: DK :: Region
+ Web.Google.Static.Maps: DM :: Region
+ Web.Google.Static.Maps: DO :: Region
+ Web.Google.Static.Maps: DZ :: Region
+ Web.Google.Static.Maps: Danish :: Language
+ Web.Google.Static.Maps: Dutch :: Language
+ Web.Google.Static.Maps: EC :: Region
+ Web.Google.Static.Maps: EE :: Region
+ Web.Google.Static.Maps: EG :: Region
+ Web.Google.Static.Maps: EH :: Region
+ Web.Google.Static.Maps: ER :: Region
+ Web.Google.Static.Maps: ES :: Region
+ Web.Google.Static.Maps: ET :: Region
+ Web.Google.Static.Maps: EU :: Region
+ Web.Google.Static.Maps: English :: Language
+ Web.Google.Static.Maps: EnglishAustralian :: Language
+ Web.Google.Static.Maps: EnglishBritish :: Language
+ Web.Google.Static.Maps: FI :: Region
+ Web.Google.Static.Maps: FJ :: Region
+ Web.Google.Static.Maps: FK :: Region
+ Web.Google.Static.Maps: FM :: Region
+ Web.Google.Static.Maps: FO :: Region
+ Web.Google.Static.Maps: FR :: Region
+ Web.Google.Static.Maps: Farsi :: Language
+ Web.Google.Static.Maps: Filipino :: Language
+ Web.Google.Static.Maps: Finnish :: Language
+ Web.Google.Static.Maps: French :: Language
+ Web.Google.Static.Maps: GA :: Region
+ Web.Google.Static.Maps: GB :: Region
+ Web.Google.Static.Maps: GD :: Region
+ Web.Google.Static.Maps: GE :: Region
+ Web.Google.Static.Maps: GF :: Region
+ Web.Google.Static.Maps: GG :: Region
+ Web.Google.Static.Maps: GH :: Region
+ Web.Google.Static.Maps: GI :: Region
+ Web.Google.Static.Maps: GL :: Region
+ Web.Google.Static.Maps: GM :: Region
+ Web.Google.Static.Maps: GN :: Region
+ Web.Google.Static.Maps: GP :: Region
+ Web.Google.Static.Maps: GQ :: Region
+ Web.Google.Static.Maps: GR :: Region
+ Web.Google.Static.Maps: GS :: Region
+ Web.Google.Static.Maps: GT :: Region
+ Web.Google.Static.Maps: GU :: Region
+ Web.Google.Static.Maps: GW :: Region
+ Web.Google.Static.Maps: GY :: Region
+ Web.Google.Static.Maps: Galician :: Language
+ Web.Google.Static.Maps: German :: Language
+ Web.Google.Static.Maps: Greek :: Language
+ Web.Google.Static.Maps: Gujarati :: Language
+ Web.Google.Static.Maps: HK :: Region
+ Web.Google.Static.Maps: HM :: Region
+ Web.Google.Static.Maps: HN :: Region
+ Web.Google.Static.Maps: HR :: Region
+ Web.Google.Static.Maps: HT :: Region
+ Web.Google.Static.Maps: HU :: Region
+ Web.Google.Static.Maps: Hebrew :: Language
+ Web.Google.Static.Maps: Hindi :: Language
+ Web.Google.Static.Maps: Hungarian :: Language
+ Web.Google.Static.Maps: ID :: Region
+ Web.Google.Static.Maps: IE :: Region
+ Web.Google.Static.Maps: IL :: Region
+ Web.Google.Static.Maps: IM :: Region
+ Web.Google.Static.Maps: IN :: Region
+ Web.Google.Static.Maps: IO :: Region
+ Web.Google.Static.Maps: IQ :: Region
+ Web.Google.Static.Maps: IR :: Region
+ Web.Google.Static.Maps: IS :: Region
+ Web.Google.Static.Maps: IT :: Region
+ Web.Google.Static.Maps: Indonesian :: Language
+ Web.Google.Static.Maps: Italian :: Language
+ Web.Google.Static.Maps: JE :: Region
+ Web.Google.Static.Maps: JM :: Region
+ Web.Google.Static.Maps: JO :: Region
+ Web.Google.Static.Maps: JP :: Region
+ Web.Google.Static.Maps: Japanese :: Language
+ Web.Google.Static.Maps: KE :: Region
+ Web.Google.Static.Maps: KG :: Region
+ Web.Google.Static.Maps: KH :: Region
+ Web.Google.Static.Maps: KI :: Region
+ Web.Google.Static.Maps: KM :: Region
+ Web.Google.Static.Maps: KN :: Region
+ Web.Google.Static.Maps: KP :: Region
+ Web.Google.Static.Maps: KR :: Region
+ Web.Google.Static.Maps: KW :: Region
+ Web.Google.Static.Maps: KY :: Region
+ Web.Google.Static.Maps: KZ :: Region
+ Web.Google.Static.Maps: Kannada :: Language
+ Web.Google.Static.Maps: Korean :: Language
+ Web.Google.Static.Maps: LA :: Region
+ Web.Google.Static.Maps: LB :: Region
+ Web.Google.Static.Maps: LC :: Region
+ Web.Google.Static.Maps: LI :: Region
+ Web.Google.Static.Maps: LK :: Region
+ Web.Google.Static.Maps: LR :: Region
+ Web.Google.Static.Maps: LS :: Region
+ Web.Google.Static.Maps: LT :: Region
+ Web.Google.Static.Maps: LU :: Region
+ Web.Google.Static.Maps: LV :: Region
+ Web.Google.Static.Maps: LY :: Region
+ Web.Google.Static.Maps: LatLng :: Double -> Double -> LatLng
+ Web.Google.Static.Maps: Latvian :: Language
+ Web.Google.Static.Maps: Lithuanian :: Language
+ Web.Google.Static.Maps: Locale :: Address -> Location
+ Web.Google.Static.Maps: MA :: Region
+ Web.Google.Static.Maps: MC :: Region
+ Web.Google.Static.Maps: MD :: Region
+ Web.Google.Static.Maps: ME :: Region
+ Web.Google.Static.Maps: MF :: Region
+ Web.Google.Static.Maps: MG :: Region
+ Web.Google.Static.Maps: MH :: Region
+ Web.Google.Static.Maps: MK :: Region
+ Web.Google.Static.Maps: ML :: Region
+ Web.Google.Static.Maps: MM :: Region
+ Web.Google.Static.Maps: MN :: Region
+ Web.Google.Static.Maps: MO :: Region
+ Web.Google.Static.Maps: MP :: Region
+ Web.Google.Static.Maps: MQ :: Region
+ Web.Google.Static.Maps: MR :: Region
+ Web.Google.Static.Maps: MS :: Region
+ Web.Google.Static.Maps: MT :: Region
+ Web.Google.Static.Maps: MU :: Region
+ Web.Google.Static.Maps: MV :: Region
+ Web.Google.Static.Maps: MW :: Region
+ Web.Google.Static.Maps: MX :: Region
+ Web.Google.Static.Maps: MY :: Region
+ Web.Google.Static.Maps: MZ :: Region
+ Web.Google.Static.Maps: Malayalam :: Language
+ Web.Google.Static.Maps: Marathi :: Language
+ Web.Google.Static.Maps: NA :: Region
+ Web.Google.Static.Maps: NC :: Region
+ Web.Google.Static.Maps: NE :: Region
+ Web.Google.Static.Maps: NF :: Region
+ Web.Google.Static.Maps: NG :: Region
+ Web.Google.Static.Maps: NI :: Region
+ Web.Google.Static.Maps: NL :: Region
+ Web.Google.Static.Maps: NO :: Region
+ Web.Google.Static.Maps: NP :: Region
+ Web.Google.Static.Maps: NR :: Region
+ Web.Google.Static.Maps: NU :: Region
+ Web.Google.Static.Maps: NZ :: Region
+ Web.Google.Static.Maps: Norwegian :: Language
+ Web.Google.Static.Maps: OM :: Region
+ Web.Google.Static.Maps: PA :: Region
+ Web.Google.Static.Maps: PE :: Region
+ Web.Google.Static.Maps: PF :: Region
+ Web.Google.Static.Maps: PG :: Region
+ Web.Google.Static.Maps: PH :: Region
+ Web.Google.Static.Maps: PK :: Region
+ Web.Google.Static.Maps: PL :: Region
+ Web.Google.Static.Maps: PM :: Region
+ Web.Google.Static.Maps: PN :: Region
+ Web.Google.Static.Maps: PR :: Region
+ Web.Google.Static.Maps: PS :: Region
+ Web.Google.Static.Maps: PT :: Region
+ Web.Google.Static.Maps: PW :: Region
+ Web.Google.Static.Maps: PY :: Region
+ Web.Google.Static.Maps: Polish :: Language
+ Web.Google.Static.Maps: Portuguese :: Language
+ Web.Google.Static.Maps: PortugueseBrazil :: Language
+ Web.Google.Static.Maps: PortuguesePortugal :: Language
+ Web.Google.Static.Maps: QA :: Region
+ Web.Google.Static.Maps: RE :: Region
+ Web.Google.Static.Maps: RO :: Region
+ Web.Google.Static.Maps: RS :: Region
+ Web.Google.Static.Maps: RU :: Region
+ Web.Google.Static.Maps: RW :: Region
+ Web.Google.Static.Maps: Romanian :: Language
+ Web.Google.Static.Maps: Russian :: Language
+ Web.Google.Static.Maps: SA :: Region
+ Web.Google.Static.Maps: SB :: Region
+ Web.Google.Static.Maps: SC :: Region
+ Web.Google.Static.Maps: SD :: Region
+ Web.Google.Static.Maps: SE :: Region
+ Web.Google.Static.Maps: SG :: Region
+ Web.Google.Static.Maps: SH :: Region
+ Web.Google.Static.Maps: SI :: Region
+ Web.Google.Static.Maps: SJ :: Region
+ Web.Google.Static.Maps: SK :: Region
+ Web.Google.Static.Maps: SL :: Region
+ Web.Google.Static.Maps: SM :: Region
+ Web.Google.Static.Maps: SN :: Region
+ Web.Google.Static.Maps: SO :: Region
+ Web.Google.Static.Maps: SR :: Region
+ Web.Google.Static.Maps: SS :: Region
+ Web.Google.Static.Maps: ST :: Region
+ Web.Google.Static.Maps: SV :: Region
+ Web.Google.Static.Maps: SX :: Region
+ Web.Google.Static.Maps: SY :: Region
+ Web.Google.Static.Maps: SZ :: Region
+ Web.Google.Static.Maps: Secret :: Text -> Secret
+ Web.Google.Static.Maps: Serbian :: Language
+ Web.Google.Static.Maps: Slovak :: Language
+ Web.Google.Static.Maps: Slovenian :: Language
+ Web.Google.Static.Maps: Spanish :: Language
+ Web.Google.Static.Maps: Swedish :: Language
+ Web.Google.Static.Maps: TC :: Region
+ Web.Google.Static.Maps: TD :: Region
+ Web.Google.Static.Maps: TF :: Region
+ Web.Google.Static.Maps: TG :: Region
+ Web.Google.Static.Maps: TH :: Region
+ Web.Google.Static.Maps: TJ :: Region
+ Web.Google.Static.Maps: TK :: Region
+ Web.Google.Static.Maps: TL :: Region
+ Web.Google.Static.Maps: TM :: Region
+ Web.Google.Static.Maps: TN :: Region
+ Web.Google.Static.Maps: TO :: Region
+ Web.Google.Static.Maps: TR :: Region
+ Web.Google.Static.Maps: TT :: Region
+ Web.Google.Static.Maps: TV :: Region
+ Web.Google.Static.Maps: TW :: Region
+ Web.Google.Static.Maps: TZ :: Region
+ Web.Google.Static.Maps: Tagalog :: Language
+ Web.Google.Static.Maps: Tamil :: Language
+ Web.Google.Static.Maps: Telugu :: Language
+ Web.Google.Static.Maps: Thai :: Language
+ Web.Google.Static.Maps: Turkish :: Language
+ Web.Google.Static.Maps: UA :: Region
+ Web.Google.Static.Maps: UG :: Region
+ Web.Google.Static.Maps: UK :: Region
+ Web.Google.Static.Maps: UM :: Region
+ Web.Google.Static.Maps: US :: Region
+ Web.Google.Static.Maps: UY :: Region
+ Web.Google.Static.Maps: UZ :: Region
+ Web.Google.Static.Maps: Ukrainian :: Language
+ Web.Google.Static.Maps: VA :: Region
+ Web.Google.Static.Maps: VC :: Region
+ Web.Google.Static.Maps: VE :: Region
+ Web.Google.Static.Maps: VG :: Region
+ Web.Google.Static.Maps: VI :: Region
+ Web.Google.Static.Maps: VN :: Region
+ Web.Google.Static.Maps: VU :: Region
+ Web.Google.Static.Maps: Vietnamese :: Language
+ Web.Google.Static.Maps: WF :: Region
+ Web.Google.Static.Maps: WS :: Region
+ Web.Google.Static.Maps: YE :: Region
+ Web.Google.Static.Maps: YT :: Region
+ Web.Google.Static.Maps: ZA :: Region
+ Web.Google.Static.Maps: ZM :: Region
+ Web.Google.Static.Maps: ZW :: Region
+ Web.Google.Static.Maps: data Language
+ Web.Google.Static.Maps: data LatLng
+ Web.Google.Static.Maps: data Region
+ Web.Google.Static.Maps: instance GHC.Classes.Eq Web.Google.Static.Maps.Secret
+ Web.Google.Static.Maps: instance GHC.Show.Show Web.Google.Static.Maps.Secret
+ Web.Google.Static.Maps: newtype Address
+ Web.Google.Static.Maps: newtype Secret
- Web.Google.Maps.Common: [lat] :: Location -> Double
+ Web.Google.Maps.Common: [lat] :: LatLng -> Double
- Web.Google.Maps.Common: [lng] :: Location -> Double
+ Web.Google.Maps.Common: [lng] :: LatLng -> Double
- Web.Google.Static.Maps: [lat] :: Location -> Double
+ Web.Google.Static.Maps: [lat] :: LatLng -> Double
- Web.Google.Static.Maps: [lng] :: Location -> Double
+ Web.Google.Static.Maps: [lng] :: LatLng -> Double
- Web.Google.Static.Maps: staticmap :: Manager -> Key -> Maybe Signature -> Maybe Center -> Maybe Zoom -> Size -> Maybe Scale -> Maybe Format -> [MapStyle] -> Maybe MapType -> [Markers] -> [Path] -> Maybe Visible -> IO (Either ServantError StaticmapResponse)
+ Web.Google.Static.Maps: staticmap :: Manager -> Key -> Maybe Secret -> Maybe Center -> Maybe Zoom -> Size -> Maybe Scale -> Maybe Format -> [MapStyle] -> Maybe MapType -> Maybe Language -> Maybe Region -> [Markers] -> [Path] -> Maybe Visible -> IO (Either ServantError StaticmapResponse)
- Web.Google.Static.Maps: type GoogleStaticMapsAPI = "staticmap" :> (QueryParam "key" Key :> (QueryParam "signature" Signature :> (QueryParam "center" Center :> (QueryParam "zoom" Zoom :> (QueryParam "size" Size :> (QueryParam "scale" Scale :> (QueryParam "format" Format :> (QueryParams "style" MapStyle :> (QueryParam "maptype" MapType :> (QueryParams "markers" Markers :> (QueryParams "path" Path :> (QueryParam "visible" Visible :> Get '[PNG] StaticmapResponse))))))))))))
+ Web.Google.Static.Maps: type GoogleStaticMapsAPI = "staticmap" :> (QueryParam "key" Key :> (QueryParam "center" Center :> (QueryParam "zoom" Zoom :> (QueryParam "size" Size :> (QueryParam "scale" Scale :> (QueryParam "format" Format :> (QueryParams "style" MapStyle :> (QueryParam "maptype" MapType :> (QueryParam "language" Language :> (QueryParam "region" Region :> (QueryParams "markers" Markers :> (QueryParams "path" Path :> (QueryParam "visible" Visible :> (QueryParam "signature" Signature :> Get '[PNG] StaticmapResponse))))))))))))))
Files
- changelog.md +7/−1
- google-static-maps.cabal +50/−44
- src/Web/Google/Maps/Common.hs +664/−14
- src/Web/Google/Static/Maps.hs +108/−55
changelog.md view
@@ -1,3 +1,9 @@+# 0.4.0.0 + +* Implement `language` and `region` parameters + +* Implement digital signatures + # 0.3.0.0 * Fix bug in instance of `ToHttpApiData` for `Location` @@ -10,7 +16,7 @@ # 0.2.0.0 -* Implementation of `signature` and custom marker icons +* Implement `signature` and custom marker icons * Move `staticmap` from the end of the base URL to the start of the API type
google-static-maps.cabal view
@@ -1,44 +1,50 @@-name: google-static-maps-version: 0.3.0.0-synopsis: Bindings to the Google Static Maps API-description: The <https://developers.google.com/maps/documentation/static-maps/intro Google Static Maps API>- returns a map as an image via an HTTP request. This library- provides bindings in Haskell to that API.- .- NB: The use of the Google Static Maps API services is- subject to the <https://developers.google.com/maps/terms Google Maps APIs Terms of Service>,- which terms restrict the use of content.- .- This package has no connection with Google Inc. or its- affiliates.-homepage: https://github.com/mpilgrem/google-static-maps#readme-license: BSD3-license-file: LICENSE-author: Mike Pilgrem-maintainer: public@pilgrem.com-copyright: Mike Pilgrem-category: Web-build-type: Simple-extra-source-files: changelog.md-cabal-version: >=1.10--library- hs-source-dirs: src- exposed-modules: Web.Google.Static.Maps- , Web.Google.Maps.Common- build-depends: base >= 4.7 && < 5- , aeson >= 1.0 && < 1.1- , bytedump >= 1.0 && < 1.1- , double-conversion >= 2.0 && < 2.1- , http-client >= 0.5 && < 0.6- , JuicyPixels >= 3.2 && < 3.3- , network-uri >= 2.6 && < 2.7- , servant >= 0.9 && < 0.10- , servant-client >= 0.9 && < 0.10- , servant-JuicyPixels >= 0.3 && < 0.4- , text >= 1.2 && < 1.3- default-language: Haskell2010--source-repository head- type: git- location: https://github.com/mpilgrem/google-static-maps+name: google-static-maps +version: 0.4.0.0 +synopsis: Bindings to the Google Static Maps API +description: The <https://developers.google.com/maps/documentation/static-maps/intro Google Static Maps API> + returns a map as an image via an HTTP request. This library + provides bindings in Haskell to that API. + . + NB: The use of the Google Static Maps API services is + subject to the <https://developers.google.com/maps/terms Google Maps APIs Terms of Service>, + which terms restrict the use of content. + . + This package has no connection with Google Inc. or its + affiliates. +homepage: https://github.com/mpilgrem/google-static-maps#readme +license: BSD3 +license-file: LICENSE +author: Mike Pilgrem +maintainer: public@pilgrem.com +copyright: Mike Pilgrem +category: Web +build-type: Simple +extra-source-files: changelog.md +cabal-version: >=1.10 + +library + hs-source-dirs: src + exposed-modules: Web.Google.Static.Maps + , Web.Google.Maps.Common + build-depends: base >= 4.7 && < 5 + , base64-bytestring >= 1.0 && < 1.1 + , bytestring >= 0.10 && < 0.11 + , aeson >= 1.0 && < 1.1 + , bytedump >= 1.0 && < 1.1 + , cryptonite >= 0.21 && < 0.22 + , double-conversion >= 2.0 && < 2.1 + , http-client >= 0.5 && < 0.6 + , JuicyPixels >= 3.2 && < 3.3 + , memory >= 0.14 && < 0.15 + , MissingH >=1.4 && < 1.5 + , network-uri >= 2.6 && < 2.7 + , servant >= 0.9 && < 0.10 + , servant-client >= 0.9 && < 0.10 + , servant-JuicyPixels >= 0.3 && < 0.4 + , text >= 1.2 && < 1.3 + , utf8-string >= 1.0 && < 1.1 + default-language: Haskell2010 + +source-repository head + type: git + location: https://github.com/mpilgrem/google-static-maps
src/Web/Google/Maps/Common.hs view
@@ -1,6 +1,7 @@-{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} -- | @@ -15,43 +16,692 @@ ( -- * Functions googleMapsApis -- * Types + , Address (..) , Key (..) + , Language (..) + , LatLng (..) , Location (..) + , Region (..) ) where import Data.Aeson (FromJSON) import Data.Double.Conversion.Text (toFixed) -import Data.List (intersperse) +import Data.Either (Either (..)) +import Data.Eq (Eq) +import Data.Function (($)) +import Data.List (intersperse, map) import Data.Text (Text) import qualified Data.Text as T (concat) +import GHC.Exts (Double) import GHC.Generics (Generic) import Servant.API (ToHttpApiData (..)) import Servant.Client (BaseUrl (..), Scheme (..)) +import Text.Show (Show) -- | API key newtype Key = Key Text deriving (Eq, Show, ToHttpApiData) --- | Location: precision in latitude or longitude beyond 6 decimal places is --- ignored. -data Location = Location +-- | Location +data Location + = Coords LatLng + | Locale Address + deriving (Eq, Show) + +instance ToHttpApiData Location where + toUrlPiece location + | Coords latlng <- location + = toUrlPiece latlng + | Locale address <- location + = toUrlPiece address + +instance ToHttpApiData [Location] where + toUrlPiece [] = "" + toUrlPiece ls = T.concat $ intersperse "|" $ map toUrlPiece ls + +-- | Latitude and longitude: precision beyond 6 decimal places is ignored. +data LatLng = LatLng { lat :: Double -- ^ Takes any value between -90 and 90. , lng :: Double -- ^ Takes any value between -180 and 180. } deriving (Eq, Show, Generic) -instance ToHttpApiData Location where - toUrlPiece (Location lat' lng') = T.concat [toFixed precision lat', ",", - toFixed precision lng'] +instance ToHttpApiData LatLng where + toUrlPiece (LatLng lat' lng') + = T.concat [toFixed precision lat', ",", toFixed precision lng'] where precision = 6 -- Precision beyond 6 decimal places is ignored. -instance ToHttpApiData [Location] where - toUrlPiece [] = "" - toUrlPiece ls = T.concat $ intersperse pipe $ map toUrlPiece ls - where - pipe = toUrlPiece ("|" :: Text) +instance FromJSON LatLng -instance FromJSON Location +-- | Address +newtype Address = Address Text + deriving (Eq, Show, ToHttpApiData) + +-- | Language: supported languages based on the list at +-- <https://developers.google.com/maps/faq#languagesupport> (as at 13 March +-- 2017). +data Language + = Arabic + | Basque + | Bengali + | Bulgarian + | Catalan + | ChineseSimplified + | ChineseTraditional + | Croatian + | Czech + | Danish + | Dutch + | German + | Greek + | English + | EnglishAustralian + | EnglishBritish + | Farsi + | Filipino + | Finnish + | French + | Galician + | Gujarati + | Hebrew + | Hindi + | Hungarian + | Indonesian + | Italian + | Japanese + | Kannada + | Korean + | Latvian + | Lithuanian + | Malayalam + | Marathi + | Norwegian + | Polish + | Portuguese + | PortugueseBrazil + | PortuguesePortugal + | Romanian + | Russian + | Serbian + | Slovak + | Slovenian + | Spanish + | Swedish + | Tagalog + | Tamil + | Telugu + | Thai + | Turkish + | Ukrainian + | Vietnamese + deriving (Eq, Show) + +instance ToHttpApiData Language where + toUrlPiece language = case language of + Arabic -> "ar" + Basque -> "eu" + Bengali -> "bn" + Bulgarian -> "bg" + Catalan -> "ca" + ChineseSimplified -> "zh-CN" + ChineseTraditional -> "zh-TW" + Croatian -> "hr" + Czech -> "cs" + Danish -> "da" + Dutch -> "nl" + German -> "de" + Greek -> "el" + English -> "en" + EnglishAustralian -> "en-AU" + EnglishBritish -> "en-GB" + Farsi -> "fa" + Filipino -> "fil" + Finnish -> "fi" + French -> "fr" + Galician -> "gl" + Gujarati -> "gu" + Hebrew -> "iw" + Hindi -> "hi" + Hungarian -> "hu" + Indonesian -> "id" + Italian -> "it" + Japanese -> "ja" + Kannada -> "kn" + Korean -> "ko" + Latvian -> "lv" + Lithuanian -> "lt" + Malayalam -> "ml" + Marathi -> "mr" + Norwegian -> "no" + Polish -> "pl" + Portuguese -> "pt" + PortugueseBrazil -> "pt-BR" + PortuguesePortugal -> "pt-PT" + Romanian -> "ro" + Russian -> "ru" + Serbian -> "sr" + Slovak -> "sk" + Slovenian -> "sl" + Spanish -> "es" + Swedish -> "sv" + Tagalog -> "tl" + Tamil -> "ta" + Telugu -> "te" + Thai -> "th" + Turkish -> "tr" + Ukrainian -> "uk" + Vietnamese -> "vi" + +-- | Region: a ccTLD (country code top level domain). +data Region + = AD + | AE + | AF + | AG + | AI + | AL + | AM + | AO + | AQ + | AR + | AS + | AT + | AU + | AW + | AX + | AZ + | BA + | BB + | BD + | BE + | BF + | BG + | BH + | BI + | BJ + | BL + | BM + | BN + | BO + | BQ + | BR + | BS + | BT + | BV + | BW + | BY + | BZ + | CA + | CC + | CD + | CF + | CG + | CH + | CI + | CK + | CL + | CM + | CN + | CO + | CR + | CU + | CV + | CW + | CX + | CY + | CZ + | DE + | DJ + | DK + | DM + | DO + | DZ + | EC + | EE + | EG + | EH + | ER + | ES + | ET + | FI + | FJ + | FK + | FM + | FO + | FR + | GA + | GB + | GD + | GE + | GF + | GG + | GH + | GI + | GL + | GM + | GN + | GP + | GQ + | GR + | GS + | GT + | GU + | GW + | GY + | HK + | HM + | HN + | HR + | HT + | HU + | ID + | IE + | IL + | IM + | IN + | IO + | IQ + | IR + | IS + | IT + | JE + | JM + | JO + | JP + | KE + | KG + | KH + | KI + | KM + | KN + | KP + | KR + | KW + | KY + | KZ + | LA + | LB + | LC + | LI + | LK + | LR + | LS + | LT + | LU + | LV + | LY + | MA + | MC + | MD + | ME + | MF + | MG + | MH + | MK + | ML + | MM + | MN + | MO + | MP + | MQ + | MR + | MS + | MT + | MU + | MV + | MW + | MX + | MY + | MZ + | NA + | NC + | NE + | NF + | NG + | NI + | NL + | NO + | NP + | NR + | NU + | NZ + | OM + | PA + | PE + | PF + | PG + | PH + | PK + | PL + | PM + | PN + | PR + | PS + | PT + | PW + | PY + | QA + | RE + | RO + | RS + | RU + | RW + | SA + | SB + | SC + | SD + | SE + | SG + | SH + | SI + | SJ + | SK + | SL + | SM + | SN + | SO + | SR + | SS + | ST + | SV + | SX + | SY + | SZ + | TC + | TD + | TF + | TG + | TH + | TJ + | TK + | TL + | TM + | TN + | TO + | TR + | TT + | TV + | TW + | TZ + | UA + | UG + | UM + | US + | UY + | UZ + | VA + | VC + | VE + | VG + | VI + | VN + | VU + | WF + | WS + | YE + | YT + | ZA + | ZM + | ZW + | AC -- Saint Helena, Ascension and Tristan da Cunha + | UK -- United Kingdom of Great Britain and Northern Ireland + | EU -- European Union + deriving (Eq, Show) + +instance ToHttpApiData Region where + toUrlPiece region = case region of + AD -> "ad" + AE -> "ae" + AF -> "af" + AG -> "ag" + AI -> "ai" + AL -> "al" + AM -> "am" + AO -> "ao" + AQ -> "aq" + AR -> "ar" + AS -> "as" + AT -> "at" + AU -> "au" + AW -> "aw" + AX -> "ax" + AZ -> "az" + BA -> "ba" + BB -> "bb" + BD -> "bd" + BE -> "be" + BF -> "bf" + BG -> "bg" + BH -> "bh" + BI -> "bi" + BJ -> "bj" + BL -> "bl" + BM -> "bm" + BN -> "bn" + BO -> "bo" + BQ -> "bq" + BR -> "br" + BS -> "bs" + BT -> "bt" + BV -> "bv" + BW -> "bw" + BY -> "by" + BZ -> "bz" + CA -> "ca" + CC -> "cc" + CD -> "cd" + CF -> "cf" + CG -> "cg" + CH -> "ch" + CI -> "ci" + CK -> "ck" + CL -> "cl" + CM -> "cm" + CN -> "cn" + CO -> "co" + CR -> "cr" + CU -> "cu" + CV -> "cv" + CW -> "cw" + CX -> "cx" + CY -> "cy" + CZ -> "cz" + DE -> "de" + DJ -> "dj" + DK -> "dk" + DM -> "dm" + DO -> "do" + DZ -> "dz" + EC -> "ec" + EE -> "ee" + EG -> "eg" + EH -> "eh" + ER -> "er" + ES -> "es" + ET -> "et" + FI -> "fi" + FJ -> "fj" + FK -> "fk" + FM -> "fm" + FO -> "fo" + FR -> "fr" + GA -> "ga" + GB -> "gb" + GD -> "gd" + GE -> "ge" + GF -> "gf" + GG -> "gg" + GH -> "gh" + GI -> "gi" + GL -> "gl" + GM -> "gm" + GN -> "gn" + GP -> "gp" + GQ -> "gq" + GR -> "gr" + GS -> "gs" + GT -> "gt" + GU -> "gu" + GW -> "gw" + GY -> "gy" + HK -> "hk" + HM -> "hm" + HN -> "hn" + HR -> "hr" + HT -> "ht" + HU -> "hu" + ID -> "id" + IE -> "ie" + IL -> "il" + IM -> "im" + IN -> "in" + IO -> "io" + IQ -> "iq" + IR -> "ir" + IS -> "is" + IT -> "it" + JE -> "je" + JM -> "jm" + JO -> "jo" + JP -> "jp" + KE -> "ke" + KG -> "kg" + KH -> "kh" + KI -> "ki" + KM -> "km" + KN -> "kn" + KP -> "kp" + KR -> "kr" + KW -> "kw" + KY -> "ky" + KZ -> "kz" + LA -> "la" + LB -> "lb" + LC -> "lc" + LI -> "li" + LK -> "lk" + LR -> "lr" + LS -> "ls" + LT -> "lt" + LU -> "lu" + LV -> "lv" + LY -> "ly" + MA -> "ma" + MC -> "mc" + MD -> "md" + ME -> "me" + MF -> "mf" + MG -> "mg" + MH -> "mh" + MK -> "mk" + ML -> "ml" + MM -> "mm" + MN -> "mn" + MO -> "mo" + MP -> "mp" + MQ -> "mq" + MR -> "mr" + MS -> "ms" + MT -> "mt" + MU -> "mu" + MV -> "mv" + MW -> "mw" + MX -> "mx" + MY -> "my" + MZ -> "mz" + NA -> "na" + NC -> "nc" + NE -> "ne" + NF -> "nf" + NG -> "ng" + NI -> "ni" + NL -> "nl" + NO -> "no" + NP -> "np" + NR -> "nr" + NU -> "nu" + NZ -> "nz" + OM -> "om" + PA -> "pa" + PE -> "pe" + PF -> "pf" + PG -> "pg" + PH -> "ph" + PK -> "pk" + PL -> "pl" + PM -> "pm" + PN -> "pn" + PR -> "pr" + PS -> "ps" + PT -> "pt" + PW -> "pw" + PY -> "py" + QA -> "qa" + RE -> "re" + RO -> "ro" + RS -> "rs" + RU -> "ru" + RW -> "rw" + SA -> "sa" + SB -> "sb" + SC -> "sc" + SD -> "sd" + SE -> "se" + SG -> "sg" + SH -> "sh" + SI -> "si" + SJ -> "sj" + SK -> "sk" + SL -> "sl" + SM -> "sm" + SN -> "sn" + SO -> "so" + SR -> "sr" + SS -> "ss" + ST -> "st" + SV -> "sv" + SX -> "sx" + SY -> "sy" + SZ -> "sz" + TC -> "tc" + TD -> "td" + TF -> "tf" + TG -> "tg" + TH -> "th" + TJ -> "tj" + TK -> "tk" + TL -> "tl" + TM -> "tm" + TN -> "tn" + TO -> "to" + TR -> "tr" + TT -> "tt" + TV -> "tv" + TW -> "tw" + TZ -> "tz" + UA -> "ua" + UG -> "ug" + UM -> "um" + US -> "us" + UY -> "uy" + UZ -> "uz" + VA -> "va" + VC -> "vc" + VE -> "ve" + VG -> "vg" + VI -> "vi" + VN -> "vn" + VU -> "vu" + WF -> "wf" + WS -> "ws" + YE -> "ye" + YT -> "yt" + ZA -> "za" + ZM -> "zm" + ZW -> "zw" + AC -> "ac" -- Saint Helena, Ascension and Tristan da Cunha + UK -> "uk" -- United Kingdom of Great Britain and Northern Ireland + EU -> "eu" -- European Union -- | The base URL for the Google Maps APIs. googleMapsApis :: BaseUrl
src/Web/Google/Static/Maps.hs view
@@ -21,9 +21,8 @@ -- <https://developers.google.com/maps/terms Google Maps APIs Terms of Service>, -- which terms restrict the use of content. -- --- The following are not yet implemented: certain optional parameters --- ('language', and 'region'); address locations; non-PNG image --- formats; and encoded polyline paths. +-- The following are not yet implemented: non-PNG image formats; and encoded +-- polyline paths. -- -- The code below is an example console application to test the use of the -- library with the Google Static Maps API. @@ -47,13 +46,15 @@ -- > \at https://developers.google.com/maps/terms.\n" -- > mgr <- newManager tlsManagerSettings -- > let apiKey = Key "<REPLACE_THIS_WITH_YOUR_ACTUAL_GOOGLE_API_KEY>" +-- > secret = Just $ Secret "<REPLACE_THIS_WITH_YOUR_ACTUAL_GOOGLE_\ +-- > \URL_SIGNING_SECRET>" -- If using a digital signature -- > center = Just $ Center (Location 42.165950 (-71.362015)) -- > zoom = Just $ Zoom 17 -- > w = 400 -- > h = 400 -- > size = Size w h --- > result <- staticmap mgr apiKey Nothing center zoom size Nothing Nothing --- > [] Nothing [] [] Nothing +-- > result <- staticmap mgr apiKey secret center zoom size Nothing Nothing +-- > [] Nothing Nothing Nothing [] [] Nothing -- > case result of -- > Right response -> do -- > let picture = fromJust $ fromDynamicImage response @@ -69,19 +70,24 @@ , api -- * Types , Key (..) + , Secret (..) , Signature (..) , Center (..) , Location (..) + , LatLng (..) + , Address (..) , Zoom (..) , Size (..) , Scale (..) , Format (..) - , MapType (..) , MapStyle (..) , Feature (..) , Element (..) , MapStyleOp (..) , Visibility (..) + , MapType (..) + , Language (..) + , Region (..) , Markers (..) , MarkerStyle (..) , MarkerSize (..) @@ -102,21 +108,37 @@ ) where import Codec.Picture.Types (DynamicImage (..)) +import Crypto.Hash.Algorithms (SHA1) +import Crypto.MAC.HMAC (HMAC, hmac) +import Data.ByteArray (convert) +import qualified Data.ByteString as B (pack, unpack) +import Data.ByteString.Base64.URL (decode, encode) +import qualified Data.ByteString.Lazy as L (unpack) +import Data.ByteString.Builder (stringUtf8, toLazyByteString) +import Data.ByteString.UTF8 as UTF8 (fromString) import Data.List (intersperse) import Data.Maybe (catMaybes) import Data.Proxy (Proxy (..)) +import Data.String.Utils (replace) import Data.Text (Text) import qualified Data.Text as T (append, concat, pack) +import Data.Text.Encoding (decodeUtf8, encodeUtf8) import Data.Word (Word8) +import Debug.Trace (trace) import Network.HTTP.Client (Manager) import Network.URI (URI (..), URIAuth (..), uriToString) -import Servant.API ((:>), Get, QueryParam, QueryParams, ToHttpApiData (..)) -import Servant.Client (client, ClientEnv (..), ClientM, runClientM, - ServantError) +import Servant.API ((:>), Get, QueryParam, QueryParams, safeLink, + ToHttpApiData (..)) +import Servant.Client (BaseUrl (..), client, ClientEnv (..), ClientM, + runClientM, ServantError) import Servant.JuicyPixels (PNG) import Text.Bytedump (hexString) +import Web.Google.Maps.Common (Address (..), googleMapsApis, Key (..), + Language (..), LatLng (..), Location (..), Region (..)) -import Web.Google.Maps.Common (googleMapsApis, Key (..), Location (..)) +-- | Secret for digital signature +newtype Secret = Secret Text + deriving (Eq, Show) -- | Signature newtype Signature = Signature Text @@ -166,31 +188,15 @@ Png8 -> "png8" Png32 -> "png32" --- | Map type -data MapType - = RoadMap -- ^ The default value. - | Satellite - | Hybrid - | Terrain - deriving (Eq, Show) - -instance ToHttpApiData MapType where - toUrlPiece mapType = case mapType of - RoadMap -> "roadmap" - Satellite -> "satellite" - Hybrid -> "hybrid" - Terrain -> "terrain" - -- | MapStyle data MapStyle = MapStyle (Maybe Feature) (Maybe Element) [MapStyleOp] deriving (Eq, Show) instance ToHttpApiData MapStyle where toUrlPiece (MapStyle featureOpt elementOpt ops) = - T.concat $ intersperse pipe $ catMaybes [featureUrl, elementUrl] ++ + T.concat $ intersperse "|" $ catMaybes [featureUrl, elementUrl] ++ [opsUrl] where - pipe = toUrlPiece ("|" :: Text) featureUrl = T.append "feature:" . toUrlPiece <$> featureOpt elementUrl = T.append "element:" . toUrlPiece <$> elementOpt opsUrl = toUrlPiece ops @@ -325,9 +331,7 @@ = T.concat ["weight:", toUrlPiece w] instance ToHttpApiData [MapStyleOp] where - toUrlPiece ops = T.concat $ intersperse pipe $ map toUrlPiece ops - where - pipe = toUrlPiece ("|" :: Text) + toUrlPiece ops = T.concat $ intersperse "|" $ map toUrlPiece ops -- | Visibility data Visibility @@ -342,6 +346,21 @@ Off -> "off" Simplified -> "simplified" +-- | Map type +data MapType + = RoadMap -- ^ The default value. + | Satellite + | Hybrid + | Terrain + deriving (Eq, Show) + +instance ToHttpApiData MapType where + toUrlPiece mapType = case mapType of + RoadMap -> "roadmap" + Satellite -> "satellite" + Hybrid -> "hybrid" + Terrain -> "terrain" + -- | Markers data Markers = Markers (Maybe MarkerStyle) [Location] deriving (Eq, Show) @@ -377,14 +396,12 @@ color' = T.append "color:" . toUrlPiece <$> mc label' = T.append "label:" . toUrlPiece <$> ml opts = catMaybes [size', color', label'] - in T.concat $ intersperse pipe opts + in T.concat $ intersperse "|" opts | CustomIcon url ma <- markerStyle = let icon' = T.concat ["icon:", toUrlPiece $ uriToString id url ""] in case ma of Nothing -> icon' - Just a -> T.concat [icon', pipe, "anchor:", toUrlPiece a] - where - pipe = toUrlPiece ("|" :: Text) + Just a -> T.concat [icon', "|", "anchor:", toUrlPiece a] -- | Marker size data MarkerSize @@ -504,9 +521,8 @@ instance ToHttpApiData PathStyle where toUrlPiece (PathStyle mw mc mfc mg) = - T.concat $ intersperse pipe opts + T.concat $ intersperse "|" opts where - pipe = toUrlPiece ("|" :: Text) weightUrl = T.append "weight:" . toUrlPiece <$> mw colorUrl = T.append "color:" . toUrlPiece <$> mc fillColorUrl = T.append "fillcolor:" . toUrlPiece <$> mfc @@ -543,18 +559,20 @@ -- | Google Static Maps API type GoogleStaticMapsAPI = "staticmap" - :> QueryParam "key" Key - :> QueryParam "signature" Signature - :> QueryParam "center" Center - :> QueryParam "zoom" Zoom - :> QueryParam "size" Size - :> QueryParam "scale" Scale - :> QueryParam "format" Format - :> QueryParams "style" MapStyle - :> QueryParam "maptype" MapType - :> QueryParams "markers" Markers - :> QueryParams "path" Path - :> QueryParam "visible" Visible + :> QueryParam "key" Key + :> QueryParam "center" Center + :> QueryParam "zoom" Zoom + :> QueryParam "size" Size + :> QueryParam "scale" Scale + :> QueryParam "format" Format + :> QueryParams "style" MapStyle + :> QueryParam "maptype" MapType + :> QueryParam "language" Language + :> QueryParam "region" Region + :> QueryParams "markers" Markers + :> QueryParams "path" Path + :> QueryParam "visible" Visible + :> QueryParam "signature" Signature :> Get '[PNG] StaticmapResponse -- | StaticmapResponse @@ -566,7 +584,6 @@ staticmap' :: Maybe Key - -> Maybe Signature -> Maybe Center -> Maybe Zoom -> Maybe Size @@ -574,9 +591,12 @@ -> Maybe Format -> [MapStyle] -> Maybe MapType + -> Maybe Language + -> Maybe Region -> [Markers] -> [Path] -> Maybe Visible + -> Maybe Signature -> ClientM StaticmapResponse staticmap' = client api @@ -585,7 +605,7 @@ staticmap :: Manager -> Key - -> Maybe Signature + -> Maybe Secret -> Maybe Center -> Maybe Zoom -> Size @@ -593,6 +613,8 @@ -> Maybe Format -> [MapStyle] -> Maybe MapType + -> Maybe Language + -> Maybe Region -> [Markers] -> [Path] -> Maybe Visible @@ -600,7 +622,7 @@ staticmap mgr key - signatureOpt + secretOpt centerOpt zoomOpt size @@ -608,10 +630,41 @@ formatOpt mapStyles mapTypeOpt + languageOpt + regionOpt markerss paths visibleOpt - = runClientM (staticmap' (Just key) signatureOpt centerOpt zoomOpt - (Just size) scaleOpt formatOpt mapStyles mapTypeOpt markerss paths - visibleOpt) - (ClientEnv mgr googleMapsApis) + = case secretOpt of + Nothing -> runClientM (eval staticmap' Nothing) + (ClientEnv mgr googleMapsApis) + Just secret -> do + let url = fixUrl $ eval (safeLink api api) Nothing + signatureOpt = sign secret googleMapsApis url + runClientM (eval staticmap' signatureOpt) + (ClientEnv mgr googleMapsApis) + where + eval f = f (Just key) centerOpt zoomOpt (Just size) scaleOpt formatOpt + mapStyles mapTypeOpt languageOpt regionOpt markerss paths + visibleOpt + +sign :: Secret -> BaseUrl -> URI -> Maybe Signature +sign (Secret secret) baseUrl url = do + secret' <- either (const Nothing) Just (decode $ encodeUtf8 secret) + let url' = UTF8.fromString $ baseUrlPath baseUrl ++ "/" ++ uriToString id url "" + signature = hmac secret' url' :: HMAC SHA1 + signature' = decodeUtf8 $ encode $ convert signature + return $ Signature signature' + +-- A hack required because in package servant-0.9.1.1, the function `linkURI` +-- adds unwanted `[]` to specified parameter names for QueryParams (reported as +-- issue #715). The result is that `safeLink` does not return the correct URI. +-- The hack is not ideal as there is a very small but positive probability that +-- another part of the URI will contain by coincidence the characters that need +-- to be replaced. +fixUrl :: URI -> URI +fixUrl url = url {uriQuery = uri'} + where + uri = uriQuery url + uri' = replace "path[]=" "path=" $ replace "markers[]=" "markers=" $ replace + "style[]=" "style=" uri