packages feed

google-server-api 0.3.3.1 → 0.4.0.0

raw patch · 4 files changed

+97/−17 lines, 4 filesdep ~base64-bytestringdep ~servant-clientPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base64-bytestring, servant-client

API changes (from Hackage documentation)

- Google.Response: instance Data.Aeson.Types.ToJSON.ToJSON Google.Response.CalendarEvent
- Google.Response: instance Data.Aeson.Types.ToJSON.ToJSON Google.Response.CalendarEventList
- Google.Response: instance Web.Internal.FormUrlEncoded.FromForm Google.Response.CalendarEvent
- Google.Response: instance Web.Internal.FormUrlEncoded.ToForm Google.Response.CalendarEvent
+ Google.Form: ExtendedProperties :: HashMap Text Text -> HashMap Text Text -> ExtendedProperties
+ Google.Form: ExtendedProperty :: (Text, Text) -> ExtendedProperty
+ Google.Form: [$sel:extendedProperties:CalendarEvent] :: CalendarEvent -> Maybe ExtendedProperties
+ Google.Form: [$sel:pair:ExtendedProperty] :: ExtendedProperty -> (Text, Text)
+ Google.Form: [$sel:private:ExtendedProperties] :: ExtendedProperties -> HashMap Text Text
+ Google.Form: [$sel:shared:ExtendedProperties] :: ExtendedProperties -> HashMap Text Text
+ Google.Form: data ExtendedProperties
+ Google.Form: instance Data.Aeson.Types.FromJSON.FromJSON Google.Form.ExtendedProperties
+ Google.Form: instance Data.Aeson.Types.ToJSON.ToJSON Google.Form.ExtendedProperties
+ Google.Form: instance GHC.Classes.Eq Google.Form.ExtendedProperties
+ Google.Form: instance GHC.Classes.Eq Google.Form.ExtendedProperty
+ Google.Form: instance GHC.Generics.Generic Google.Form.ExtendedProperties
+ Google.Form: instance GHC.Generics.Generic Google.Form.ExtendedProperty
+ Google.Form: instance GHC.Show.Show Google.Form.ExtendedProperties
+ Google.Form: instance GHC.Show.Show Google.Form.ExtendedProperty
+ Google.Form: instance Web.Internal.HttpApiData.ToHttpApiData Google.Form.ExtendedProperty
+ Google.Form: newtype ExtendedProperty
+ Google.Response: [$sel:extendedProperties:CalendarEvent] :: CalendarEvent -> Maybe ExtendedProperties
+ Google.Response: [$sel:organizer:CalendarEvent] :: CalendarEvent -> Account
+ Google.Response: instance Data.Aeson.Types.FromJSON.FromJSON Google.Response.ExtendedProperties
+ Google.Response: instance GHC.Classes.Eq Google.Response.ExtendedProperties
+ Google.Response: instance GHC.Generics.Generic Google.Response.ExtendedProperties
+ Google.Response: instance GHC.Show.Show Google.Response.ExtendedProperties
- Google.Client: getCalendarEventList :: Token -> Text -> Maybe Bool -> Maybe DateTime -> Maybe DateTime -> Maybe Text -> IO (Either ClientError CalendarEventList)
+ Google.Client: getCalendarEventList :: Token -> Text -> Maybe Bool -> Maybe DateTime -> Maybe DateTime -> Maybe Text -> [ExtendedProperty] -> [ExtendedProperty] -> IO (Either ClientError CalendarEventList)
- Google.Form: CalendarEvent :: Account -> [Account] -> Text -> Text -> DateTime -> DateTime -> CalendarEvent
+ Google.Form: CalendarEvent :: Account -> [Account] -> Text -> Text -> DateTime -> DateTime -> Maybe ExtendedProperties -> CalendarEvent
- Google.Response: CalendarEvent :: Text -> Account -> Maybe [Account] -> Maybe Text -> Maybe Text -> Maybe ZonedDateTime -> Maybe ZonedDateTime -> CalendarEvent
+ Google.Response: CalendarEvent :: Text -> Account -> Account -> Maybe [Account] -> Maybe Text -> Maybe Text -> Maybe ZonedDateTime -> Maybe ZonedDateTime -> Maybe ExtendedProperties -> CalendarEvent

Files

google-server-api.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack ----- hash: a0f7961e20660b0657db7262b80d50981c8e43c6eb3f88bfc556e0010bf9dc0b+-- hash: df1c304623fa830cc6950b4ac5554efac4fc3e9b26ac708c523fad3ed0bed0e6  name:           google-server-api-version:        0.3.3.1+version:        0.4.0.0 synopsis:       Google APIs for server to server applications description:    This library provides a way to use Google API for server to server applications. category:       Web@@ -37,7 +37,46 @@       Paths_google_server_api   hs-source-dirs:       src-  default-extensions: BangPatterns BinaryLiterals ConstraintKinds DataKinds DefaultSignatures DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable DoAndIfThenElse DuplicateRecordFields EmptyDataDecls ExistentialQuantification FlexibleContexts FlexibleInstances FunctionalDependencies GADTs GeneralizedNewtypeDeriving InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns OverloadedStrings PartialTypeSignatures PatternGuards PolyKinds RankNTypes RecordWildCards ScopedTypeVariables StandaloneDeriving Strict StrictData TupleSections TypeFamilies TypeSynonymInstances ViewPatterns+  default-extensions:+      BangPatterns+      BinaryLiterals+      ConstraintKinds+      DataKinds+      DefaultSignatures+      DeriveDataTypeable+      DeriveFoldable+      DeriveFunctor+      DeriveGeneric+      DeriveTraversable+      DoAndIfThenElse+      DuplicateRecordFields+      EmptyDataDecls+      ExistentialQuantification+      FlexibleContexts+      FlexibleInstances+      FunctionalDependencies+      GADTs+      GeneralizedNewtypeDeriving+      InstanceSigs+      KindSignatures+      LambdaCase+      MultiParamTypeClasses+      MultiWayIf+      NamedFieldPuns+      OverloadedStrings+      PartialTypeSignatures+      PatternGuards+      PolyKinds+      RankNTypes+      RecordWildCards+      ScopedTypeVariables+      StandaloneDeriving+      Strict+      StrictData+      TupleSections+      TypeFamilies+      TypeSynonymInstances+      ViewPatterns   ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints   build-depends:       HsOpenSSL >=0.11.4.13 && <0.12@@ -45,7 +84,7 @@     , aeson >=1.2.4.0 && <1.6     , aeson-casing >=0.1.0.5 && <0.3     , base >=4.9 && <5-    , base64-bytestring >=1.0.0.1 && <1.2+    , base64-bytestring >=1.0.0.1 && <1.3     , bytestring >=0.10.8.2 && <0.11     , http-api-data >=0.3.7.2 && <0.5     , http-client >=0.5.10 && <0.7@@ -56,7 +95,7 @@     , monad-logger >=0.3.28.1 && <0.4     , mtl >=2.2.2 && <2.3     , servant >=0.13 && <0.19-    , servant-client >=0.13 && <0.19+    , servant-client >=0.13 && <0.20     , text >=1.2.3.0 && <1.3     , time >=1.8.0.2 && <1.10     , transformers >=0.5.2.0 && <0.6
src/Google/Client.hs view
@@ -45,6 +45,7 @@   , JSON   , Post   , QueryParam+  , QueryParams   , ReqBody   , ToHttpApiData   )@@ -67,6 +68,7 @@ import qualified Google.JWT as JWT import qualified Google.Response as Response import qualified Google.Type as Type+import Google.Form (ExtendedProperty)  #if !MIN_VERSION_servant(0, 16, 0) type ClientError = ServantError@@ -98,6 +100,8 @@     QueryParam "timeMin" Form.DateTime :>     QueryParam "timeMax" Form.DateTime :>     QueryParam "orderBy" Text :>+    QueryParams "privateExtendedProperty" ExtendedProperty :>+    QueryParams "sharedExtendedProperty" ExtendedProperty :>     Get '[ JSON] Response.CalendarEventList   :<|> "calendar" :> "v3" :> "calendars" :>     Capture "calendarId" Text :>@@ -147,6 +151,8 @@   -> Maybe Form.DateTime   -> Maybe Form.DateTime   -> Maybe Text+  -> [ExtendedProperty]+  -> [ExtendedProperty]   -> ClientM Response.CalendarEventList postCalendarEvent' ::      Text@@ -205,8 +211,10 @@   -> Maybe Form.DateTime   -> Maybe Form.DateTime   -> Maybe Text+  -> [ExtendedProperty]+  -> [ExtendedProperty]   -> IO (Either ClientError Response.CalendarEventList)-getCalendarEventList token calendarId singleEvents timeMin timeMax orderBy = do+getCalendarEventList token calendarId singleEvents timeMin timeMax orderBy privateExtendedProperties sharedExtendedProperties = do   manager <- newManager tlsManagerSettings   runClientM     (getCalendarEventList'@@ -215,7 +223,9 @@        singleEvents        timeMin        timeMax-       orderBy)+       orderBy+       privateExtendedProperties+       sharedExtendedProperties)     (mkClientEnv manager googleBaseUrl)  postCalendarEvent ::
src/Google/Form.hs view
@@ -11,6 +11,8 @@   , GmailSend(..)   , Account(..)   , DateTime(..)+  , ExtendedProperty(..)+  , ExtendedProperties(..)   , Email(..)   , toMail   , MultipartBody(..)@@ -38,6 +40,7 @@ import Servant.API (MimeRender(..)) import Web.FormUrlEncoded (Form(..), ToForm(toForm)) import Web.HttpApiData (ToHttpApiData(..))+import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as HashMap  import Google.Type@@ -67,6 +70,21 @@  deriveJSON defaultOptions ''DateTime +newtype ExtendedProperty = ExtendedProperty+  { pair :: (Text, Text)+  } deriving (Eq, Generic, Show, Typeable)++instance ToHttpApiData ExtendedProperty where+  toQueryParam ExtendedProperty {..} =+    fst pair <> "=" <> snd pair++data ExtendedProperties = ExtendedProperties+  { private :: HashMap Text Text+  , shared :: HashMap Text Text+  } deriving (Eq, Generic, Show, Typeable)++deriveJSON defaultOptions ''ExtendedProperties+ data CalendarEvent = CalendarEvent   { creator :: Account   , attendees :: [Account]@@ -74,6 +92,7 @@   , description :: Text   , start :: DateTime   , end :: DateTime+  , extendedProperties :: Maybe ExtendedProperties   } deriving (Eq, Generic, Show, Typeable)  deriveJSON defaultOptions ''CalendarEvent
src/Google/Response.hs view
@@ -20,10 +20,13 @@   , MediaContent(..)   ) where +import Data.Aeson (FromJSON(..), (.:?), withObject) import Data.Aeson.Casing (snakeCase)-import Data.Aeson.TH (Options(..), defaultOptions, deriveJSON)-import Data.Text (Text)-import Data.Text (intercalate, splitOn)+import Data.Aeson.TH (Options(..), defaultOptions, deriveFromJSON, deriveJSON)+import Data.HashMap.Strict (HashMap)+import qualified Data.HashMap.Strict as HashMap+import Data.Maybe (fromMaybe)+import Data.Text (Text, intercalate, splitOn) import Data.Typeable (Typeable) import GHC.Generics (Generic) import Web.FormUrlEncoded (FromForm, ToForm)@@ -82,21 +85,30 @@         (toUTC x) == (toUTC y)     ) +data ExtendedProperties = ExtendedProperties+  { private :: HashMap Text Text+  , shared :: HashMap Text Text+  } deriving (Eq, Generic, Show, Typeable)++instance FromJSON ExtendedProperties where+  parseJSON = withObject "ExtendedProperties" $ \v ->+    ExtendedProperties+      <$> (fromMaybe HashMap.empty <$> v .:? "private")+      <*> (fromMaybe HashMap.empty <$> v .:? "shared")+ data CalendarEvent = CalendarEvent   { status :: Text+  , organizer :: Account   , creator :: Account   , attendees :: Maybe [Account]   , summary :: Maybe Text   , description :: Maybe Text   , start :: Maybe ZonedDateTime   , end :: Maybe ZonedDateTime+  , extendedProperties :: Maybe ExtendedProperties   } deriving (Eq, Generic, Show, Typeable) -deriveJSON defaultOptions ''CalendarEvent--instance FromForm CalendarEvent--instance ToForm CalendarEvent+deriveFromJSON defaultOptions ''CalendarEvent   data CalendarEventList = CalendarEventList@@ -105,7 +117,7 @@   , items :: [CalendarEvent]   } deriving (Eq, Generic, Show, Typeable) -deriveJSON defaultOptions ''CalendarEventList+deriveFromJSON defaultOptions ''CalendarEventList   data GmailSend = GmailSend