This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Haskforce.SForce.Common where | |
import Data.Text (Text) | |
import Data.Aeson | |
import Data.Aeson.Types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Example where | |
import Data.Text (Text) | |
import Data.Aeson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Optionals = HML.HashMap Text Text | |
type SFApiNumber = Text | |
data SFClient = SFClient SFApiNumber AuthResponse deriving Show | |
data UserCred = UserCred | |
{ username :: Maybe Username | |
, password :: Maybe UserPassword | |
, secretKey :: Maybe SecretKey | |
, clientId :: Text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This function uses getSObjectRow to get an Account by id number. | |
-- The (Proxy @Account) just tell the function what we are expecting back (of course an Account). | |
-- | |
getAcc :: IO (Either ServantError (SObject Account)) | |
getAcc = do | |
(Right client) <- sfclient | |
getSObjectRow (SObjectId "0016A00000JcdjK") (Proxy @Account) client | |
-- This a helper function for the updateAcc. It just retrieves an account | |
-- and return the account with the sfclient as a tuple. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
import Data.Text (Text) | |
import Haskforce | |
import Haskforce.API.Resources | |
-- User Credential, they are fake so dont try those... | |
-- We have a type UserCred which will hold all of our salesforce user credential. | |
-- For security reason these values would be set as environment variable. | |
cred :: UserCred |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE TypeApplications #-} | |
import Data.Text (Text) | |
import Data.Aeson | |
import Data.Proxy | |
import GHC.Generics | |
import Servant.Client | |
import Haskforce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
traverseIntMapWithKeyWithAdjustImpl :: forall t w v' p p' v m. (PatchTarget (p' (Dynamic t w)) ~ IntMap (Dynamic t w), PatchTarget (p' w) ~ IntMap w, Patch (p' w), Patch (p' (Dynamic t w)), MonadFix m, Monoid w, Reflex t, MonadHold t m, Functor p, p ~ p') | |
=> ( (IntMap.Key -> v -> m ((v', Dynamic t w))) | |
-> IntMap v | |
-> Event t (p v) | |
-> m (IntMap (v', Dynamic t w), Event t (p (v', Dynamic t w))) | |
) | |
-> (Incremental t (p' (Dynamic t w)) -> Incremental t (p' w)) | |
-> (IntMap.Key -> v -> DynamicWriterT t w m v') | |
-> IntMap v | |
-> Event t (p v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Web.Cookie (SetCookie,parseSetCookie,renderSetCookie) | |
-- | | |
-- >>> let Right c = parseUrlPiece "SESSID=r2t5uvjq435r4q7ib3vtdjq120" :: Either Text SetCookie | |
-- >>> toUrlPiece c | |
-- "\"SESSID=r2t5uvjq435r4q7ib3vtdjq120\"" | |
instance ToHttpApiData SetCookie where | |
toUrlPiece = showt . BS.toLazyByteString . renderSetCookie | |
toEncodedUrlPiece = renderSetCookie |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE CPP #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Devel ( | |
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div_ :: [Attribute action] -> [View action] -> View action |