code
stringlengths 5
1.03M
| repo_name
stringlengths 5
90
| path
stringlengths 4
158
| license
stringclasses 15
values | size
int64 5
1.03M
| n_ast_errors
int64 0
53.9k
| ast_max_depth
int64 2
4.17k
| n_whitespaces
int64 0
365k
| n_ast_nodes
int64 3
317k
| n_ast_terminals
int64 1
171k
| n_ast_nonterminals
int64 1
146k
| loc
int64 -1
37.3k
| cycloplexity
int64 -1
1.31k
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
-----------------------------------------------------------------------------
-- Copyright 2012 Microsoft Corporation.
--
-- This is free software; you can redistribute it and/or modify it under the
-- terms of the Apache License, Version 2.0. A copy of the License can be
-- found in the file "license.txt" at the root of this distribution.
-----------------------------------------------------------------------------
{- |
Finite maps from 'Common.Name.Name's to ...
-}
module Common.NameMap
( NameMap, module Data.Map
, find
) where
import Data.Map
import Common.Name
import Common.Failure
----------------------------------------------------------------
-- Types
----------------------------------------------------------------
-- | A map from names to values
type NameMap a = Map Name a
find :: Name -> NameMap a -> a
find name nameMap
= case Data.Map.lookup name nameMap of
Just x -> x
Nothing -> failure ("Common.NameMap.find: could not find: " ++ show name)
|
lpeterse/koka
|
src/Common/NameMap.hs
|
apache-2.0
| 1,018
| 0
| 11
| 177
| 125
| 73
| 52
| 12
| 2
|
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-- |Contains the dictionary of localized messages for the program.
module Crawling.Hephaestos.I18N (
Msg(..),
MsgMessage(..),
msg,
msgs,
Lang,
) where
import Prelude hiding (FilePath)
import qualified Data.Text as TS
import Data.Text.Lazy
import Text.Shakespeare.I18N hiding (renderMessage)
import qualified Text.Shakespeare.I18N as I
data Msg = Msg
instance ToMessage Int where
toMessage = TS.pack . show
instance ToMessage Text where
toMessage = toStrict
mkMessage "Msg" "lang/" "en"
-- |Use this to insert localized messages.
msg :: Lang -> MsgMessage -> Text
msg x = fromStrict . I.renderMessage Msg [x]
-- |Like msgS, but inserts a single space character after the message.
-- This is useful because Shakespreare trims trailing whitespace.
msgs :: Lang -> MsgMessage -> Text
msgs l = (`append` " ") . msg l
|
jtapolczai/Hephaestos
|
Crawling/Hephaestos/I18N.hs
|
apache-2.0
| 952
| 0
| 7
| 168
| 202
| 123
| 79
| 24
| 1
|
t2s h m s = ( ( h * 60 ) + m ) * 60 + s
s2t t =
let s = t `mod` 60
m = (t `div` 60) `mod` 60
h = (t `div` 60) `div` 60
in
[h,m,s]
ans (h0:m0:s0:h1:m1:s1:_) =
let t0 = t2s h0 m0 s0
t1 = t2s h1 m1 s1
in
s2t (t1-t0)
main = do
c <- getContents
let i = map (map read) $ map words $ lines c :: [[Int]]
o = map ans i
mapM_ putStrLn $ map unwords $ map (map show) o
|
a143753/AOJ
|
0532.hs
|
apache-2.0
| 406
| 0
| 14
| 145
| 275
| 143
| 132
| 15
| 1
|
module Emulator.CPU.Instructions.ARM.OpcodesSpec where
import Emulator.CPU
import Emulator.CPU.Instructions.ARM.Opcodes
import Emulator.Types
import Control.Lens
import Control.Monad.State.Class (MonadState(..))
import Control.Monad.Trans.State
import Data.Default.Class
import Test.Hspec
main :: IO ()
main = hspec spec
spec :: Spec
spec = do
describe "cmp" $ do
context "CMP _ (r1 = 5) 0" $ do
let res = exec (def & r1 .~ 0x5) $ cmp () r1 (operand2Lens $ Right $ Rotated 0 0) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should set carry" $
res ^. flags.carry `shouldBe` True
it "should not set overflow" $
res ^. flags.overflow `shouldBe` False
it "should not set zero" $
res ^. flags.zero `shouldBe` False
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "CMP _ (r1 = 0) 0" $ do
let res = exec (def & r1 .~ 0x0) $ cmp () r1 (operand2Lens $ Right $ Rotated 0 0) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should set carry" $
res ^. flags.carry `shouldBe` True
it "should not set overflow" $
res ^. flags.overflow `shouldBe` False
it "should not set zero" $
res ^. flags.zero `shouldBe` True
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "CMP _ (r1 = a) a" $ do
let res = exec (def & r1 .~ 0xA) $ cmp () r1 (operand2Lens $ Right $ Rotated 0 0xA) True
it "should set the zero flag, false the negative, carry and overflow" $ do
res ^. flags.carry `shouldBe` False
res ^. flags.zero `shouldBe` True
res ^. flags.overflow `shouldBe` False
res ^. flags.negative `shouldBe` False
describe "mov" $ do
context "MOV r0 _ 5" $ do
let res = exec def $ mov r0 () (operand2Lens $ Right $ Rotated 0 5) True
it "should not set result" $
res ^. r0 `shouldBe` 0x5
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should not set zero" $
res ^. flags.zero `shouldBe` False
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "MOV r0 _ 0" $ do
let res = exec def $ mov r0 () (operand2Lens $ Right $ Rotated 0 0) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should not set zero" $
res ^. flags.zero `shouldBe` True
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "MOV r0 _ (r2 = 1 << 2)" $ do
let res = exec (def & r2 .~ 0x1) $ mov r0 () (operand2Lens $ Left $ AmountShift 2 LogicalLeft $ RegisterName 2) True
it "should not set result" $
res ^. r0 `shouldBe` 0x4
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should not set zero" $
res ^. flags.zero `shouldBe` False
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "MOV r0 _ (r2 = 15 << r3 = 2)" $ do
let res = exec (def & r2 .~ 0xF & r3 .~ 0x2) $ mov r0 () (operand2Lens $ Left $ RegisterShift (RegisterName 3) LogicalLeft (RegisterName 2)) True
it "should not set result" $
res ^. r0 `shouldBe` 0x3C
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should not set zero" $
res ^. flags.zero `shouldBe` False
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "MOV r0 _ (r15 = 0x00000000)" $ return ()
describe "add" $ do
context "ADD r0 (r1 = 0) 0" $ do
let res = exec def $ add r0 r1 (operand2Lens $ Right $ Rotated 0 0) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should set zero" $
res ^. flags.zero `shouldBe` True
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "ADD r0 (r1 = 0xFFFFFFFF) (r2 = 0xFFFFFFFF)" $ do
let res = exec (def & r1 .~ 0xFFFFFFFF & r2 .~ 0xFFFFFFFF) $ add r0 r1 (operand2Lens $ Left $ AmountShift 0 LogicalLeft $ RegisterName 2) True
it "should not set result" $
res ^. r0 `shouldBe` 0xFFFFFFFE
it "should set carry" $
res ^. flags.carry `shouldBe` True
it "should set overflow" $
res ^. flags.overflow `shouldBe` True
it "should not set zero" $
res ^. flags.zero `shouldBe` False
it "should set negative" $
res ^. flags.negative `shouldBe` True
describe "cmn" $ do
context "CMN _ (r1 = 0) 0" $ do
let res = exec def $ cmn () r1 (operand2Lens $ Right $ Rotated 0 0) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should set zero" $
res ^. flags.zero `shouldBe` True
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "CMN _ (r1 = 0) 1" $ do
let res = exec def $ cmn () r1 (operand2Lens $ Right $ Rotated 0 1) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should not set zero" $
res ^. flags.zero `shouldBe` False
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "CMN _ (r1 = 0xFFFFFFFF) (r2 = 0xFFFFFFFF)" $ do
let res = exec (def & r1 .~ 0xFFFFFFFF & r2 .~ 0xFFFFFFFF) $ cmn () r1 (operand2Lens $ Left $ AmountShift 0 LogicalLeft $ RegisterName 2) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should set carry" $
res ^. flags.carry `shouldBe` True
it "should set overflow" $
res ^. flags.overflow `shouldBe` True
it "should not set zero" $
res ^. flags.zero `shouldBe` False
it "should set negative" $
res ^. flags.negative `shouldBe` True
describe "teq" $ do
context "TEQ _ (r1 = 0) 0" $ do
let res = exec (def & r0 .~ 0x1) $ teq () r1 (operand2Lens $ Right $ Rotated 0 0) True
it "should not set result" $
res ^. r0 `shouldBe` 0x1
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should set zero" $
res ^. flags.zero `shouldBe` True
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "TEQ _ (r1 = 2) 1" $ do
let res = exec (def & r1 .~ 0x2 & flags.zero .~ True) $ teq () r1 (operand2Lens $ Right $ Rotated 0 1) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should not set zero" $
res ^. flags.zero `shouldBe` False
it "should not set negative" $
res ^. flags.negative `shouldBe` False
describe "orr" $ do
context "ORR r0 (r1 = 0) 0" $ do
let res = exec def $ orr r0 r1 (operand2Lens $ Right $ Rotated 0 0) True
it "should set result" $
res ^. r0 `shouldBe` 0x0
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should set zero" $
res ^. flags.zero `shouldBe` True
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "ORR r0 (r1 = 1) 4" $ do
let res = exec (def & r1 .~ 0x1) $ orr r0 r1 (operand2Lens $ Right $ Rotated 0 4) True
it "should set result" $
res ^. r0 `shouldBe` 0x5
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should not set zero" $
res ^. flags.zero `shouldBe` False
it "should not set negative" $
res ^. flags.negative `shouldBe` False
describe "tst" $ do
context "TST _ (r1 = 0) 0" $ do
let res = exec def $ tst () r1 (operand2Lens $ Right $ Rotated 0 0) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should set zero" $
res ^. flags.zero `shouldBe` True
it "should not set negative" $
res ^. flags.negative `shouldBe` False
context "TST _ (r1 = 3) 2" $ do
let res = exec (def & r1 .~ 0x3) $ tst () r1 (operand2Lens $ Right $ Rotated 0 2) True
it "should not set result" $
res ^. r0 `shouldBe` 0x0
it "should not affect carry" $
res ^. flags.carry `shouldBe` False
it "should not affect overflow" $
res ^. flags.overflow `shouldBe` False
it "should set zero" $
res ^. flags.zero `shouldBe` False
it "should not set negative" $
res ^. flags.negative `shouldBe` False
newtype OpcodeState a = OpcodeState (State Registers a)
deriving (Functor, Applicative, Monad, MonadState Registers)
exec :: Registers -> OpcodeState () -> Registers
exec r (OpcodeState x) = execState x r
|
intolerable/GroupProject
|
test/Emulator/CPU/Instructions/ARM/OpcodesSpec.hs
|
bsd-2-clause
| 10,197
| 0
| 22
| 3,061
| 3,298
| 1,615
| 1,683
| -1
| -1
|
module Database.VCache.Open
( openVCache
) where
import Control.Monad
import Control.Exception
import System.FileLock (FileLock)
import qualified System.FileLock as FileLock
import qualified System.EasyFile as EasyFile
import qualified System.IO.Error as IOE
import Foreign.Storable
import Foreign.Marshal.Alloc
import Foreign.Ptr
import Data.Bits
import Data.IORef
import Data.Maybe
import qualified Data.Map.Strict as Map
import qualified Data.ByteString as BS
import qualified Data.List as L
import Control.Concurrent.MVar
import Control.Concurrent.STM.TVar
import Control.Concurrent
import qualified System.IO as Sys
import qualified System.Exit as Sys
import Database.LMDB.Raw
import Database.VCache.Types
import Database.VCache.RWLock
import Database.VCache.Aligned
import Database.VCache.Write
import Database.VCache.Clean
-- | Open a VCache with a given database file.
--
-- In most cases, a Haskell process should open VCache in the Main
-- module then pass it as an argument to the different libraries,
-- frameworks, plugins, and other software components that require
-- persistent storage. Use vcacheSubdir to progect against namespace
-- collisions.
--
-- When opening VCache, developers decide the maximum size and the file
-- name. For example:
--
-- > vc <- openVCache 100 "db"
--
-- This would open a VCache whose file-size limit is 100 megabytes,
-- with the name "db", plus an additional "db-lock" lockfile. An
-- exception will be raised if these files cannot be created, locked,
-- or opened. The size limit is passed to LMDB and is separate from
-- setVRefsCacheSize.
--
-- Once opened, VCache typically remains open until process halt.
-- If errors are detected, e.g. due to writing an undefined value
-- to a PVar or running out of space, VCache will attempt to halt
-- the process.
--
openVCache :: Int -> FilePath -> IO VCache
openVCache nMB fp = do
let (fdir,fn) = EasyFile.splitFileName fp
let eBadFile = fp ++ " not recognized as a file name"
when (L.null fn) (fail $ "openVCache: " ++ eBadFile)
EasyFile.createDirectoryIfMissing True fdir
let fpLock = fp ++ "-lock"
let nBytes = max 1 nMB * 1024 * 1024
mbLock <- FileLock.tryLockFile fpLock FileLock.Exclusive
case mbLock of
Nothing -> ioError $ IOE.mkIOError
IOE.alreadyInUseErrorType
"openVCache lockfile"
Nothing (Just fpLock)
Just fl -> openVC' nBytes fl fp
`onException` FileLock.unlockFile fl
vcFlags :: [MDB_EnvFlag]
vcFlags = [MDB_NOSUBDIR -- open file name, not directory name
,MDB_NOLOCK -- leave lock management to VCache
]
--
-- I'm providing a non-empty root bytestring. There are a few reasons
-- for this. LMDB doesn't support zero-sized keys. And the empty
-- bytestring will indicate anonymous PVars in the allocator. And if
-- I ever want PVar roots within VCache, I can use a different prefix.
--
-- The maximum path, including the PVar name, is 511 bytes. That is
-- enough for almost any use case, especially since roots should not
-- depend on domain data. Too large a path results in runtime error.
vcRootPath :: BS.ByteString
vcRootPath = BS.singleton 47
-- Default address for allocation. We start this high to help
-- regulate serialization sizes and simplify debugging.
vcAllocStart :: Address
vcAllocStart = 999999999
-- Default cache size is somewhat arbitrary. I've chosen to set it
-- to about ten megabytes (as documented in the Cache module).
vcDefaultCacheLimit :: Int
vcDefaultCacheLimit = 10 * 1000 * 1000
-- initial cache size
vcInitCacheSizeEst :: CacheSizeEst
vcInitCacheSizeEst = CacheSizeEst
{ csze_addr_size = sz -- err likely on high side to start
, csze_addr_sqsz = sz * sz
}
where sz = 2048 -- err likely on high side to start
-- Checking for a `-threaded` runtime
threaded :: Bool
threaded = rtsSupportsBoundThreads
openVC' :: Int -> FileLock -> FilePath -> IO VCache
openVC' nBytes fl fp = do
unless threaded (fail "VCache needs -threaded runtime")
dbEnv <- mdb_env_create
mdb_env_set_mapsize dbEnv nBytes
mdb_env_set_maxdbs dbEnv 5
mdb_env_open dbEnv fp vcFlags
flip onException (mdb_env_close dbEnv) $ do
-- initial transaction to grab database handles and init allocator
txnInit <- mdb_txn_begin dbEnv Nothing False
dbiMemory <- mdb_dbi_open' txnInit (Just "@") [MDB_CREATE, MDB_INTEGERKEY]
dbiRoots <- mdb_dbi_open' txnInit (Just "/") [MDB_CREATE]
dbiHashes <- mdb_dbi_open' txnInit (Just "#") [MDB_CREATE, MDB_INTEGERKEY, MDB_DUPSORT, MDB_DUPFIXED, MDB_INTEGERDUP]
dbiRefct <- mdb_dbi_open' txnInit (Just "^") [MDB_CREATE, MDB_INTEGERKEY]
dbiRefct0 <- mdb_dbi_open' txnInit (Just "%") [MDB_CREATE, MDB_INTEGERKEY]
allocEnd <- findLastAddrAllocated txnInit dbiMemory
mdb_txn_commit txnInit
-- ephemeral resources
let allocStart = nextAllocAddress allocEnd
memory <- newMVar (initMemory allocStart)
tvWrites <- newTVarIO (Writes Map.empty [])
mvSignal <- newMVar ()
cLimit <- newIORef vcDefaultCacheLimit
cSize <- newIORef vcInitCacheSizeEst
cVRefs <- newMVar Map.empty
gcStart <- newIORef Nothing
gcCount <- newIORef 0
rwLock <- newRWLock
-- finalizer, in unlikely event of closure
_ <- mkWeakMVar mvSignal $ do
mdb_env_close dbEnv
FileLock.unlockFile fl
let vc = VCache
{ vcache_path = vcRootPath
, vcache_space = VSpace
{ vcache_lockfile = fl
, vcache_db_env = dbEnv
, vcache_db_memory = dbiMemory
, vcache_db_vroots = dbiRoots
, vcache_db_caddrs = dbiHashes
, vcache_db_refcts = dbiRefct
, vcache_db_refct0 = dbiRefct0
, vcache_memory = memory
, vcache_signal = mvSignal
, vcache_writes = tvWrites
, vcache_rwlock = rwLock
, vcache_climit = cLimit
, vcache_csize = cSize
, vcache_cvrefs = cVRefs
, vcache_alloc_init = allocStart
, vcache_gc_start = gcStart
, vcache_gc_count = gcCount
}
}
initVCacheThreads (vcache_space vc)
return $! vc
-- our allocator should be set for the next *even* address.
nextAllocAddress :: Address -> Address
nextAllocAddress addr | 0 == (addr .&. 1) = 2 + addr
| otherwise = 1 + addr
-- Determine the last VCache VRef address allocated, based on the
-- actual database contents. If nothing is
findLastAddrAllocated :: MDB_txn -> MDB_dbi' -> IO Address
findLastAddrAllocated txn dbiMemory = alloca $ \ pKey ->
mdb_cursor_open' txn dbiMemory >>= \ crs ->
mdb_cursor_get' MDB_LAST crs pKey nullPtr >>= \ bFound ->
mdb_cursor_close' crs >>
if not bFound then return vcAllocStart else
peek pKey >>= \ key ->
let bBadSize = fromIntegral (sizeOf vcAllocStart) /= mv_size key in
if bBadSize then fail "VCache memory table corrupted" else
peekAligned (castPtr (mv_data key))
-- initialize memory based on initial allocation position
initMemory :: Address -> Memory
initMemory addr = m0 where
af = AllocFrame Map.empty Map.empty [] addr
ac = Allocator addr af af af
gcf = GCFrame Map.empty
gc = GC gcf gcf
m0 = Memory Map.empty Map.empty gc ac
-- | Create background threads needed by VCache.
initVCacheThreads :: VSpace -> IO ()
initVCacheThreads vc = begin where
begin = do
task (writeStep vc)
task (cleanStep vc)
return ()
task step = void (forkIO (forever step `catch` onE))
onE :: SomeException -> IO ()
onE e | isBlockedOnMVar e = return () -- full GC of VCache
onE e = do
putErrLn "VCache background thread has failed."
putErrLn (indent " " (show e))
putErrLn "Halting program."
Sys.exitFailure
isBlockedOnMVar :: (Exception e) => e -> Bool
isBlockedOnMVar = isJust . test . toException where
test :: SomeException -> Maybe BlockedIndefinitelyOnMVar
test = fromException
putErrLn :: String -> IO ()
putErrLn = Sys.hPutStrLn Sys.stderr
indent :: String -> String -> String
indent ws = (ws ++) . indent' where
indent' ('\n':s) = '\n' : ws ++ indent' s
indent' (c:s) = c : indent' s
indent' [] = []
|
dmbarbour/haskell-vcache
|
hsrc_lib/Database/VCache/Open.hs
|
bsd-2-clause
| 8,591
| 0
| 22
| 2,182
| 1,748
| 928
| 820
| 156
| 3
|
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Time.ES.Corpus
( corpus
, latentCorpus
) where
import Data.String
import Prelude
import Duckling.Locale
import Duckling.Resolve
import Duckling.Time.Corpus
import Duckling.TimeGrain.Types hiding (add)
import Duckling.Testing.Types hiding (examples)
context :: Context
context = testContext {locale = makeLocale ES Nothing}
latentCorpus :: Corpus
latentCorpus = (context, testOptions {withLatent = True}, xs)
where
xs = concat
[ examples (datetime (2013, 2, 12, 13, 0, 0) Hour)
[ "una hora"
]
]
corpus :: Corpus
corpus = (context, testOptions, allExamples)
allExamples :: [Example]
allExamples = concat
[ examples (datetime (2013, 2, 12, 4, 30, 0) Second)
[ "ahora"
, "ya"
, "ahorita"
, "cuanto antes"
]
, examples (datetime (2013, 2, 12, 0, 0, 0) Day)
[ "hoy"
, "en este momento"
]
, examples (datetime (2013, 2, 11, 0, 0, 0) Day)
[ "ayer"
]
, examples (datetime (2013, 2, 10, 0, 0, 0) Day)
[ "anteayer"
, "antier"
]
{--
This is intentional
The purpose is to steer the classifier towards "tomorrow" rule
instead of "morning" rule.
--}
, examples (datetime (2013, 2, 13, 0, 0, 0) Day)
[ "mañana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
, "manana"
, "mañana"
, "manana"
, "mañana"
, "manana"
]
, examples (datetime (2013, 2, 14, 0, 0, 0) Day)
[ "pasado mañana"
]
, examples (datetime (2013, 2, 18, 0, 0, 0) Day)
[ "lunes"
, "lu"
, "lun."
, "este lunes"
]
, examples (datetime (2013, 2, 22, 0, 0, 0) Day)
[ "el próximo viernes"
, "proximo viernes"
]
, examples (datetime (2013, 2, 18, 0, 0, 0) Day)
[ "lunes, 18 de febrero"
]
, examples (datetime (2013, 2, 19, 0, 0, 0) Day)
[ "martes"
, "ma"
, "ma."
]
, examples (datetime (2013, 2, 13, 0, 0, 0) Day)
[ "miercoles"
, "miércoles"
, "mx"
, "mié."
]
, examples (datetime (2013, 2, 14, 0, 0, 0) Day)
[ "jueves"
]
, examples (datetime (2013, 2, 15, 0, 0, 0) Day)
[ "viernes"
]
, examples (datetime (2013, 2, 16, 0, 0, 0) Day)
[ "sabado"
]
, examples (datetime (2013, 2, 17, 0, 0, 0) Day)
[ "domingo"
]
, examples (datetime (2013, 5, 5, 0, 0, 0) Day)
[ "el 5 de mayo"
, "el cinco de mayo"
]
, examples (datetime (2013, 5, 5, 0, 0, 0) Day)
[ "el cinco de mayo de 2013"
, "mayo 5 del 2013"
, "5-5-2013"
]
, examples (datetime (2013, 7, 4, 0, 0, 0) Day)
[ "el 4 de julio"
, "el 4/7"
]
, examples (datetime (2013, 3, 3, 0, 0, 0) Day)
[ "el 3 de marzo"
, "3 de marzo"
, "3 marzo"
, "marzo 3"
, "el 3-3"
]
, examples (datetime (2013, 4, 5, 0, 0, 0) Day)
[ "el 5 de abril"
, "5 de abril"
, "5 abril"
, "abril 5"
]
, examples (datetime (2013, 3, 1, 0, 0, 0) Day)
[ "el 1 de marzo"
, "1 de marzo"
, "el primero de marzo"
, "el uno de marzo"
, "primero de marzo"
, "uno de marzo"
]
, examples (datetime (2013, 3, 1, 0, 0, 0) Day)
[ "1-3-2013"
, "1.3.2013"
, "1/3/2013"
]
, examples (datetime (2013, 2, 16, 0, 0, 0) Day)
[ "el 16"
, "16 de febrero"
]
, examples (datetime (2013, 2, 17, 0, 0, 0) Day)
[ "el 17"
, "17 de febrero"
, "17-2"
, "el 17/2"
]
, examples (datetime (2013, 2, 20, 0, 0, 0) Day)
[ "el 20"
, "20 de febrero"
, "20/2"
]
, examples (datetime (1974, 10, 31, 0, 0, 0) Day)
[ "31/10/1974"
, "31/10/74"
]
, examples (datetime (2013, 2, 19, 0, 0, 0) Day)
[ "el martes que viene"
]
, examples (datetime (2013, 2, 20, 0, 0, 0) Day)
[ "miércoles que viene"
, "el miércoles de la semana que viene"
, "miercoles de la próxima semana"
]
, examples (datetime (2013, 2, 11, 0, 0, 0) Day)
[ "el lunes de esta semana"
]
, examples (datetime (2013, 2, 12, 0, 0, 0) Day)
[ "martes de esta semana"
]
, examples (datetime (2013, 2, 13, 0, 0, 0) Day)
[ "el miércoles de esta semana"
]
, examples (datetime (2013, 2, 11, 0, 0, 0) Week)
[ "esta semana"
]
, examples (datetime (2013, 2, 4, 0, 0, 0) Week)
[ "la semana pasada"
]
, examples (datetime (2013, 2, 18, 0, 0, 0) Week)
[ "la semana que viene"
, "la proxima semana"
, "semana que viene"
, "proxima semana"
, "proximas semana"
, "próxima semana"
, "siguiente semana"
]
, examples (datetime (2013, 1, 1, 0, 0, 0) Month)
[ "el pasado mes"
]
, examples (datetime (2013, 3, 0, 0, 0, 0) Month)
[ "el mes que viene"
, "el proximo mes"
]
, examples (datetime (2012, 0, 0, 0, 0, 0) Year)
[ "el año pasado"
]
, examples (datetime (2013, 0, 0, 0, 0, 0) Year)
[ "este ano"
]
, examples (datetime (2014, 0, 0, 0, 0, 0) Year)
[ "el año que viene"
, "el proximo ano"
]
, examples (datetime (2013, 2, 10, 0, 0, 0) Day)
[ "el domingo pasado"
, "el domingo de la semana pasada"
]
, examples (datetime (2013, 2, 5, 0, 0, 0) Day)
[ "el martes pasado"
]
, examples (datetime (2013, 2, 12, 15, 0, 0) Hour)
[ "a las tres de la tarde"
, "a las tres"
, "a las 3 pm"
, "a las 15 horas"
]
, examples (datetime (2013, 2, 12, 20, 0, 0) Hour)
[ "a las ocho de la tarde"
]
, examples (datetime (2013, 2, 12, 15, 0, 0) Minute)
[ "15:00"
, "15.00"
]
, examples (datetime (2013, 2, 13, 0, 0, 0) Hour)
[ "medianoche"
]
, examples (datetime (2013, 2, 12, 12, 0, 0) Hour)
[ "mediodía"
, "las doce"
, "medio dia"
, "medio día"
]
, examples (datetime (2013, 2, 12, 12, 15, 0) Minute)
[ "las doce y cuarto"
]
, examples (datetime (2013, 2, 12, 11, 55, 0) Minute)
[ "las doce menos cinco"
]
, examples (datetime (2013, 2, 12, 12, 30, 0) Minute)
[ "las doce y media"
]
, examples (datetime (2013, 2, 13, 3, 0, 0) Hour)
[ "las tres de la manana"
, "las tres en la manana"
]
, examples (datetime (2013, 2, 12, 15, 15, 0) Minute)
[ "a las tres y quince"
, "a las 3 y cuarto"
, "a las tres y cuarto de la tarde"
, "a las tres y cuarto en la tarde"
, "15:15"
, "15.15"
]
, examples (datetime (2013, 2, 12, 15, 30, 0) Minute)
[ "a las tres y media"
, "a las 3 y treinta"
, "a las tres y media de la tarde"
, "a las 3 y treinta del mediodía"
, "15:30"
, "15.30"
]
, examples (datetime (2013, 2, 12, 11, 45, 0) Minute)
[ "las doce menos cuarto"
, "11:45"
, "las once y cuarenta y cinco"
, "hoy a las doce menos cuarto"
, "hoy a las once y cuarenta y cinco"
]
, examples (datetime (2013, 2, 12, 5, 15, 0) Minute)
[ "5 y cuarto"
]
, examples (datetime (2013, 2, 12, 6, 0, 0) Hour)
[ "6 de la mañana"
]
, examples (datetime (2013, 2, 13, 11, 0, 0) Hour)
[ "miércoles a las once de la mañana"
]
, examples (datetime (2013, 2, 13, 11, 0, 0) Hour)
[ "mañana a las once"
, "mañana a 11"
]
, examples (datetime (2014, 9, 12, 0, 0, 0) Day)
[ "viernes, el 12 de septiembre de 2014"
]
, examples (datetime (2013, 2, 12, 4, 30, 1) Second)
[ "en un segundo"
]
, examples (datetime (2013, 2, 12, 4, 31, 0) Second)
[ "en un minuto"
, "en 1 min"
]
, examples (datetime (2013, 2, 12, 4, 32, 0) Second)
[ "en 2 minutos"
, "en dos minutos"
]
, examples (datetime (2013, 2, 12, 5, 30, 0) Second)
[ "en 60 minutos"
]
, examples (datetime (2013, 2, 12, 5, 30, 0) Minute)
[ "en una hora"
]
, examples (datetime (2013, 2, 12, 2, 30, 0) Minute)
[ "hace dos horas"
]
, examples (datetime (2013, 2, 13, 4, 30, 0) Minute)
[ "en 24 horas"
, "en veinticuatro horas"
]
, examples (datetime (2013, 2, 13, 4, 0, 0) Hour)
[ "en un dia"
]
, examples (datetime (2013, 2, 19, 4, 0, 0) Hour)
[ "en 7 dias"
]
, examples (datetime (2013, 2, 19, 0, 0, 0) Day)
[ "en una semana"
]
, examples (datetime (2013, 1, 22, 0, 0, 0) Day)
[ "hace tres semanas"
]
, examples (datetime (2013, 4, 12, 0, 0, 0) Day)
[ "en dos meses"
]
, examples (datetime (2012, 11, 12, 0, 0, 0) Day)
[ "hace tres meses"
]
, examples (datetime (2014, 2, 0, 0, 0, 0) Month)
[ "en un ano"
, "en 1 año"
]
, examples (datetime (2011, 2, 0, 0, 0, 0) Month)
[ "hace dos años"
]
, examples (datetimeInterval ((2013, 6, 21, 0, 0, 0), (2013, 9, 24, 0, 0, 0)) Day)
[ "este verano"
]
, examples (datetimeInterval ((2012, 12, 21, 0, 0, 0), (2013, 3, 21, 0, 0, 0)) Day)
[ "este invierno"
]
, examples (datetime (2013, 12, 25, 0, 0, 0) Day)
[ "Navidad"
, "la Navidad"
]
, examples (datetime (2013, 12, 31, 0, 0, 0) Day)
[ "Nochevieja"
]
, examples (datetime (2014, 1, 1, 0, 0, 0) Day)
[ "ano nuevo"
, "año nuevo"
]
, examples (datetime (2013, 2, 12, 21, 0, 0) Hour)
[ "nueve de la noche"
]
, examples (datetimeInterval ((2013, 2, 12, 18, 0, 0), (2013, 2, 13, 0, 0, 0)) Hour)
[ "esta noche"
]
, examples (datetimeInterval ((2013, 2, 13, 18, 0, 0), (2013, 2, 14, 0, 0, 0)) Hour)
[ "mañana por la noche"
]
, examples (datetimeInterval ((2013, 2, 11, 18, 0, 0), (2013, 2, 12, 0, 0, 0)) Hour)
[ "ayer por la noche"
]
, examples (datetimeInterval ((2013, 2, 15, 18, 0, 0), (2013, 2, 18, 0, 0, 0)) Hour)
[ "este weekend"
, "este fin de semana"
]
, examples (datetimeInterval ((2013, 2, 18, 4, 0, 0), (2013, 2, 18, 12, 0, 0)) Hour)
[ "lunes por la mañana"
]
, examples (datetimeInterval ((2013, 2, 15, 4, 0, 0), (2013, 2, 15, 12, 0, 0)) Hour)
[ "el 15 de febrero por la mañana"
]
, examples (datetime (2013, 2, 12, 20, 0, 0) Hour)
[ "a las 8 de la tarde"
]
, examples (datetimeInterval ((2013, 2, 12, 4, 29, 58), (2013, 2, 12, 4, 30, 0)) Second)
[ "pasados 2 segundos"
]
, examples (datetimeInterval ((2013, 2, 12, 4, 30, 1), (2013, 2, 12, 4, 30, 4)) Second)
[ "proximos 3 segundos"
]
, examples (datetimeInterval ((2013, 2, 12, 4, 28, 0), (2013, 2, 12, 4, 30, 0)) Minute)
[ "pasados 2 minutos"
]
, examples (datetimeInterval ((2013, 2, 12, 4, 31, 0), (2013, 2, 12, 4, 34, 0)) Minute)
[ "proximos 3 minutos"
]
, examples (datetimeInterval ((2013, 2, 12, 5, 0, 0), (2013, 2, 12, 8, 0, 0)) Hour)
[ "proximas 3 horas"
]
, examples (datetimeInterval ((2013, 2, 10, 0, 0, 0), (2013, 2, 12, 0, 0, 0)) Day)
[ "pasados 2 dias"
]
, examples (datetimeInterval ((2013, 2, 13, 0, 0, 0), (2013, 2, 16, 0, 0, 0)) Day)
[ "proximos 3 dias"
]
, examples (datetimeInterval ((2013, 1, 28, 0, 0, 0), (2013, 2, 11, 0, 0, 0)) Week)
[ "pasadas dos semanas"
]
, examples (datetimeInterval ((2013, 2, 18, 0, 0, 0), (2013, 3, 11, 0, 0, 0)) Week)
[ "3 proximas semanas"
, "3 semanas que vienen"
]
, examples (datetimeInterval ((2012, 12, 0, 0, 0, 0), (2013, 2, 0, 0, 0, 0)) Month)
[ "pasados 2 meses"
, "dos pasados meses"
]
, examples (datetimeInterval ((2013, 3, 0, 0, 0, 0), (2013, 6, 0, 0, 0, 0)) Month)
[ "3 próximos meses"
, "proximos tres meses"
, "tres meses que vienen"
]
, examples (datetimeInterval ((2011, 0, 0, 0, 0, 0), (2013, 0, 0, 0, 0, 0)) Year)
[ "pasados 2 anos"
, "dos pasados años"
]
, examples (datetimeInterval ((2014, 0, 0, 0, 0, 0), (2017, 0, 0, 0, 0, 0)) Year)
[ "3 próximos años"
, "proximo tres años"
, "3 años que vienen"
]
, examples (datetimeInterval ((2013, 7, 13, 0, 0, 0), (2013, 7, 16, 0, 0, 0)) Day)
[ "13 a 15 de julio"
, "13 - 15 de julio de 2013"
]
, examples (datetimeInterval ((2013, 2, 12, 9, 30, 0), (2013, 2, 12, 11, 0, 0)) Minute)
[ "9:30 - 11:00"
]
, examples (datetimeInterval ((2013, 12, 21, 0, 0, 0), (2014, 1, 7, 0, 0, 0)) Day)
[ "21 de Dic. a 6 de Ene"
]
, examples (datetimeInterval ((2013, 2, 12, 4, 30, 0), (2013, 2, 12, 7, 30, 0)) Second)
[ "dentro de tres horas"
]
, examples (datetime (2013, 2, 12, 16, 0, 0) Hour)
[ "a las cuatro de la tarde"
]
, examples (datetime (2013, 2, 12, 13, 0, 0) Minute)
[ "a las cuatro CET"
]
, examples (datetime (2013, 8, 15, 0, 0, 0) Day)
[ "jue 15"
]
, examples (datetimeHoliday (2013, 12, 18, 0, 0, 0) Day "Día Mundial de la Lengua Árabe")
[ "dia mundial de la lengua arabe"
, "día mundial de la lengua árabe"
]
, examples (datetimeHoliday (2013, 3, 1, 0, 0, 0) Day "Día de la Cero Discriminación")
[ "dia de la cero discriminacion"
, "día de la cero discriminación"
]
, examples (datetimeHoliday (2019, 7, 6, 0, 0, 0) Day "Día Internacional de las Cooperativas")
[ "día internacional de las cooperativas del 2019"
]
, examples (datetimeHoliday (2013, 11, 17, 0, 0, 0) Day "Día de la Prematuridad Mundial")
[ "día de la prematuridad mundial"
, "día mundial del prematuro"
, "día mundial del niño prematuro"
]
, examples (datetimeHoliday (2013, 4, 1, 0, 0, 0) Day "Día de los Inocentes de Abril")
[ "día de los inocentes"
, "día de los inocentes de abril"
, "día de las bromas de abril"
, "día de las bromas"
]
, examples (datetime (2013, 3, 9, 0, 0, 0) Day)
[ "día nueve"
]
, examples (datetime (2013, 2, 15, 0, 0, 0) Day)
[ "día quince"
]
, examples (datetime (2013, 3, 11, 0, 0, 0) Day)
[ "día once"
]
, examples (datetime (2013, 2, 12, 18, 2, 0) Minute)
[
"las seis cero dos pm"
, "las seis zero dos pm"
, "para las seis cero dos pm"
, "para las seis zero dos pm"
, "a las seis cero dos pm"
, "a las seis zero dos pm"
, "al las seis cero dos pm"
, "al las seis zero dos pm"
, "para las 6 0 2 pm"
, "a las 6 0 2 pm"
, "al las 6 0 2 pm"
, "seis cero dos pm"
]
, examples (datetime (2013, 2, 12, 18, 2, 0) Minute)
[ "seis dos de la tarde"
]
, examples (datetime (1990, 0, 0, 0, 0, 0) Year)
[
"mil novecientos noventa"
]
, examples (datetime (1990, 5, 4, 0, 0, 0) Day)
[
"cuatro de mayo de mil novecientos noventa"
]
]
|
facebookincubator/duckling
|
Duckling/Time/ES/Corpus.hs
|
bsd-3-clause
| 18,771
| 0
| 12
| 8,147
| 5,647
| 3,440
| 2,207
| 417
| 1
|
-- |
-- Module : $Header$
-- Copyright : (c) 2013-2014 Galois, Inc.
-- License : BSD3
-- Maintainer : cryptol@galois.com
-- Stability : provisional
-- Portability : portable
{-# LANGUAGE RecordWildCards, CPP, Safe #-}
#if __GLASGOW_HASKELL__ >= 706
{-# LANGUAGE RecursiveDo #-}
#else
{-# LANGUAGE DoRec #-}
#endif
module Cryptol.TypeCheck.Monad
( module Cryptol.TypeCheck.Monad
, module Cryptol.TypeCheck.InferTypes
) where
import Cryptol.Parser.Position
import qualified Cryptol.Parser.AST as P
import Cryptol.TypeCheck.AST
import Cryptol.TypeCheck.Subst
import Cryptol.TypeCheck.Unify(mgu, Result(..), UnificationError(..))
import Cryptol.TypeCheck.InferTypes
import Cryptol.Utils.PP(pp, (<+>), Doc, text, quotes)
import Cryptol.Utils.Panic(panic)
import qualified Data.Map as Map
import qualified Data.Set as Set
import Data.Map (Map)
import Data.Set (Set)
import Data.List(find)
import Data.Maybe(mapMaybe)
import MonadLib
import Control.Monad.Fix(MonadFix(..))
import Data.Functor
-- | Information needed for type inference.
data InferInput = InferInput
{ inpRange :: Range -- ^ Location of program source
, inpVars :: Map QName Schema -- ^ Variables that are in scope
, inpTSyns :: Map QName TySyn -- ^ Type synonyms that are in scope
, inpNewtypes :: Map QName Newtype -- ^ Newtypes in scope
, inpNameSeeds :: NameSeeds -- ^ Private state of type-checker
} deriving Show
-- | This is used for generating various names.
data NameSeeds = NameSeeds
{ seedTVar :: !Int
, seedGoal :: !Int
} deriving Show
-- | The initial seeds, used when checking a fresh program.
nameSeeds :: NameSeeds
nameSeeds = NameSeeds { seedTVar = 10, seedGoal = 0 }
-- | The results of type inference.
data InferOutput a
= InferFailed [(Range,Warning)] [(Range,Error)]
-- ^ We found some errors
| InferOK [(Range,Warning)] NameSeeds a
-- ^ Type inference was successful.
deriving Show
runInferM :: TVars a => InferInput -> InferM a -> IO (InferOutput a)
runInferM info (IM m) =
do rec ro <- return RO { iRange = inpRange info
, iVars = Map.map ExtVar (inpVars info)
, iTVars = []
, iTSyns = fmap mkExternal (inpTSyns info)
, iNewtypes = fmap mkExternal (inpNewtypes info)
, iSolvedHasLazy = iSolvedHas finalRW -- RECURSION
}
(result, finalRW) <- runStateT rw $ runReaderT ro m -- RECURSION
let theSu = iSubst finalRW
defSu = defaultingSubst theSu
warns = [(r,apSubst theSu w) | (r,w) <- iWarnings finalRW ]
case iErrors finalRW of
[] ->
case (iCts finalRW, iHasCts finalRW) of
([],[]) -> return $ InferOK warns
(iNameSeeds finalRW)
(apSubst defSu result)
(cts,has) -> return $ InferFailed warns
[ ( goalRange g
, UnsolvedGoal (apSubst theSu g)
) | g <- cts ++ map hasGoal has
]
errs -> return $ InferFailed warns [(r,apSubst theSu e) | (r,e) <- errs]
where
mkExternal x = (IsExternal, x)
rw = RW { iErrors = []
, iWarnings = []
, iSubst = emptySubst
, iExistTVars = []
, iNameSeeds = inpNameSeeds info
, iCts = []
, iHasCts = []
, iSolvedHas = Map.empty
}
newtype InferM a = IM { unIM :: ReaderT RO (StateT RW IO) a }
data DefLoc = IsLocal | IsExternal
-- | Read-only component of the monad.
data RO = RO
{ iRange :: Range -- ^ Source code being analysed
, iVars :: Map QName VarType -- ^ Type of variable that are in scope
{- NOTE: We assume no shadowing between these two, so it does not matter
where we look first. Similarly, we assume no shadowing with
the existential type variable (in RW). See `checkTShadowing`. -}
, iTVars :: [TParam] -- ^ Type variable that are in scope
, iTSyns :: Map QName (DefLoc, TySyn) -- ^ Type synonyms that are in scope
, iNewtypes :: Map QName (DefLoc, Newtype)
-- ^ Newtype delcarations in scope
--
-- NOTE: type synonyms take precedence over newtype. The reason is
-- that we can define local type synonyms, but not local newtypes.
-- So, either a type-synonym shadows a newtype, or it was declared
-- at the top-level, but then there can't be a newtype with the
-- same name (this should be caught by the renamer).
, iSolvedHasLazy :: Map Int (Expr -> Expr)
-- ^ NOTE: This field is lazy in an important way! It is the
-- final version of `iSolvedHas` in `RW`, and the two are tied
-- together through recursion. The field is here so that we can
-- look thing up before they are defined, which is OK because we
-- don't need to know the results until everything is done.
}
-- | Read-write component of the monad.
data RW = RW
{ iErrors :: ![(Range,Error)] -- ^ Collected errors
, iWarnings :: ![(Range,Warning)] -- ^ Collected warnings
, iSubst :: !Subst -- ^ Accumulated substitution
, iExistTVars :: [Map QName Type]
-- ^ These keeps track of what existential type variables are available.
-- When we start checking a function, we push a new scope for
-- its arguments, and we pop it when we are done checking the function
-- body. The front element of the list is the current scope, which is
-- the only thing that will be modified, as follows. When we encounter
-- a existential type variable:
-- 1. we look in all scopes to see if it is already defined.
-- 2. if it was not defined, we create a fresh type variable,
-- and we add it to the current scope.
-- 3. it is an error if we encoutner an existential variable but we
-- have no current scope.
, iSolvedHas :: Map Int (Expr -> Expr)
-- ^ Selector constraints that have been solved (ref. iSolvedSelectorsLazy)
-- Generating names
, iNameSeeds :: !NameSeeds
-- Constraints that need solving
, iCts :: ![Goal] -- ^ Ordinary constraints
, iHasCts :: ![HasGoal]
{- ^ Tuple/record projection constraints. The `Int` is the "name"
of the constraint, used so that we can name it solution properly. -}
}
instance Functor InferM where
fmap f (IM m) = IM (fmap f m)
instance Monad InferM where
return x = IM (return x)
fail x = IM (fail x)
IM m >>= f = IM (m >>= unIM . f)
instance MonadFix InferM where
mfix f = IM (mfix (unIM . f))
io :: IO a -> InferM a
io m = IM $ inBase m
-- | The monadic computation is about the given range of source code.
-- This is useful for error reporting.
inRange :: Range -> InferM a -> InferM a
inRange r (IM m) = IM $ mapReader (\ro -> ro { iRange = r }) m
inRangeMb :: Maybe Range -> InferM a -> InferM a
inRangeMb Nothing m = m
inRangeMb (Just r) m = inRange r m
-- | This is the current range that we are working on.
curRange :: InferM Range
curRange = IM $ asks iRange
-- | Report an error.
recordError :: Error -> InferM ()
recordError e =
do r <- curRange
IM $ sets_ $ \s -> s { iErrors = (r,e) : iErrors s }
recordWarning :: Warning -> InferM ()
recordWarning w =
do r <- curRange
IM $ sets_ $ \s -> s { iWarnings = (r,w) : iWarnings s }
--------------------------------------------------------------------------------
newGoal :: ConstraintSource -> Prop -> InferM Goal
newGoal goalSource goal =
do goalRange <- curRange
return Goal { .. }
-- | Record some constraints that need to be solved.
-- The string explains where the constraints came from.
newGoals :: ConstraintSource -> [Prop] -> InferM ()
newGoals src ps = addGoals =<< mapM (newGoal src) ps
{- | The constraints are removed, and returned to the caller.
The substitution IS applied to them. -}
getGoals :: InferM [Goal]
getGoals = applySubst =<< IM (sets $ \s -> (iCts s, s { iCts = [] }))
-- | Add a bunch of goals that need solving.
addGoals :: [Goal] -> InferM ()
addGoals gs = IM $ sets_ $ \s -> s { iCts = gs ++ iCts s }
-- | Collect the goals emitted by the given sub-computation.
-- Does not emit any new goals.
collectGoals :: InferM a -> InferM (a, [Goal])
collectGoals m =
do origGs <- getGoals
a <- m
newGs <- getGoals
addGoals origGs
return (a, newGs)
{- | Record a constraint that when we select from the first type,
we should get a value of the second type.
The returned function should be used to wrap the expression from
which we are selecting (i.e., the record or tuple). Plese note
that the resulting expression should not be forced before the
constraint is solved.
-}
newHasGoal :: P.Selector -> Type -> Type -> InferM (Expr -> Expr)
newHasGoal l ty f =
do goalName <- newGoalName
g <- newGoal CtSelector (pHas l ty f)
IM $ sets_ $ \s -> s { iHasCts = HasGoal goalName g : iHasCts s }
solns <- IM $ fmap iSolvedHasLazy ask
return $ case Map.lookup goalName solns of
Just e1 -> e1
Nothing -> panic "newHasGoal" ["Unsolved has goal in result"]
-- | Add a previously generate has constrained
addHasGoal :: HasGoal -> InferM ()
addHasGoal g = IM $ sets_ $ \s -> s { iHasCts = g : iHasCts s }
-- | Get the `Has` constraints. Each of this should either be solved,
-- or added back using `addHasGoal`.
getHasGoals :: InferM [HasGoal]
getHasGoals = do gs <- IM $ sets $ \s -> (iHasCts s, s { iHasCts = [] })
applySubst gs
-- | Specify the solution (`Expr -> Expr`) for the given constraitn (`Int`).
solveHasGoal :: Int -> (Expr -> Expr) -> InferM ()
solveHasGoal n e =
IM $ sets_ $ \s -> s { iSolvedHas = Map.insert n e (iSolvedHas s) }
--------------------------------------------------------------------------------
newName :: (NameSeeds -> (a , NameSeeds)) -> InferM a
newName upd = IM $ sets $ \s -> let (x,seeds) = upd (iNameSeeds s)
in (x, s { iNameSeeds = seeds })
-- | Generate a new name for a goal.
newGoalName :: InferM Int
newGoalName = newName $ \s -> let x = seedGoal s
in (x, s { seedGoal = x + 1})
-- | Generate a new free type variable.
newTVar :: Doc -> Kind -> InferM TVar
newTVar src k =
do bound <- getBoundInScope
newName $ \s -> let x = seedTVar s
in (TVFree x k bound src, s { seedTVar = x + 1 })
-- | Generate a new free type variable.
newTParam :: Maybe QName -> Kind -> InferM TParam
newTParam nm k = newName $ \s -> let x = seedTVar s
in (TParam { tpUnique = x
, tpKind = k
, tpName = nm
}
, s { seedTVar = x + 1 })
-- | Generate an unknown type. The doc is a note about what is this type about.
newType :: Doc -> Kind -> InferM Type
newType src k = TVar `fmap` newTVar src k
--------------------------------------------------------------------------------
-- | Record that the two types should be syntactically equal.
unify :: Type -> Type -> InferM [Prop]
unify t1 t2 =
do t1' <- applySubst t1
t2' <- applySubst t2
case mgu t1' t2' of
OK (su1,ps) -> extendSubst su1 >> return ps
Error err ->
do case err of
UniTypeLenMismatch _ _ -> recordError (TypeMismatch t1' t2')
UniTypeMismatch s1 s2 -> recordError (TypeMismatch s1 s2)
UniKindMismatch k1 k2 -> recordError (KindMismatch k1 k2)
UniRecursive x t -> recordError (RecursiveType (TVar x) t)
UniNonPolyDepends x vs -> recordError
(TypeVariableEscaped (TVar x) vs)
UniNonPoly x t -> recordError (NotForAll x t)
return []
-- | Apply the accumulated substitution to something with free type variables.
applySubst :: TVars t => t -> InferM t
applySubst t =
do su <- getSubst
return (apSubst su t)
-- | Get the substitution that we have accumulated so far.
getSubst :: InferM Subst
getSubst = IM $ fmap iSubst get
-- | Add to the accumulated substitution.
extendSubst :: Subst -> InferM ()
extendSubst su = IM $ sets_ $ \s -> s { iSubst = su @@ iSubst s }
-- | Variables that are either mentioned in the environment or in
-- a selector constraint.
varsWithAsmps :: InferM (Set TVar)
varsWithAsmps =
do env <- IM $ fmap (Map.elems . iVars) ask
fromEnv <- forM env $ \v ->
case v of
ExtVar sch -> getVars sch
CurSCC _ t -> getVars t
sels <- IM $ fmap (map (goal . hasGoal) . iHasCts) get
fromSels <- mapM getVars sels
fromEx <- (getVars . concatMap Map.elems) =<< IM (fmap iExistTVars get)
return (Set.unions fromEnv `Set.union` Set.unions fromSels
`Set.union` fromEx)
where
getVars x = fvs `fmap` applySubst x
--------------------------------------------------------------------------------
-- | Lookup the type of a variable.
lookupVar :: QName -> InferM VarType
lookupVar x =
do mb <- IM $ asks $ Map.lookup x . iVars
case mb of
Just t -> return t
Nothing ->
do mbNT <- lookupNewtype x
case mbNT of
Just nt -> return (ExtVar (newtypeConType nt))
Nothing -> do recordError $ UndefinedVariable x
a <- newType (text "type of" <+> pp x) KType
return $ ExtVar $ Forall [] [] a
-- | Lookup a type variable. Return `Nothing` if there is no such variable
-- in scope, in schich case we must be dealing with a type constant.
lookupTVar :: QName -> InferM (Maybe Type)
lookupTVar x = IM $ asks $ fmap (TVar . tpVar) . find this . iTVars
where this tp = tpName tp == Just x
-- | Lookup the definition of a type synonym.
lookupTSyn :: QName -> InferM (Maybe TySyn)
lookupTSyn x = fmap (fmap snd . Map.lookup x) getTSyns
-- | Lookup the definition of a newtype
lookupNewtype :: QName -> InferM (Maybe Newtype)
lookupNewtype x = fmap (fmap snd . Map.lookup x) getNewtypes
-- | Check if we already have a name for this existential type variable and,
-- if so, return the definition. If not, try to create a new definition,
-- if this is allowed. If not, returns nothing.
existVar :: QName -> Kind -> InferM Type
existVar x k =
do scopes <- iExistTVars <$> IM get
case msum (map (Map.lookup x) scopes) of
Just ty -> return ty
Nothing ->
case scopes of
[] ->
do recordError $ ErrorMsg $
text "Undefined type" <+> quotes (pp x)
newType (text "undefined existential type varible" <+>
quotes (pp x)) k
sc : more ->
do ty <- newType (text "existential type variable"
<+> quotes (pp x)) k
IM $ sets_ $ \s -> s{ iExistTVars = Map.insert x ty sc : more }
return ty
-- | Returns the type synonyms that are currently in scope.
getTSyns :: InferM (Map QName (DefLoc,TySyn))
getTSyns = IM $ asks iTSyns
-- | Returns the newtype declarations that are in scope.
getNewtypes :: InferM (Map QName (DefLoc,Newtype))
getNewtypes = IM $ asks iNewtypes
-- | Get the ste of bound type variable that are in scope.
getTVars :: InferM (Set QName)
getTVars = IM $ asks $ Set.fromList . mapMaybe tpName . iTVars
-- | Return the keys of the bound variablese that are in scope.
getBoundInScope :: InferM (Set TVar)
getBoundInScope = IM $ asks $ Set.fromList . map tpVar . iTVars
{- | We disallow shadowing between type synonyms and type variables
because it is confusing. As a bonus, in the implementaiton we don't
need to worry about where we lookup things (i.e., in the variable or
type synonym environmnet. -}
checkTShadowing :: String -> QName -> InferM ()
checkTShadowing this new =
do ro <- IM ask
rw <- IM get
let shadowed =
do _ <- Map.lookup new (iTSyns ro)
return "type synonym"
`mplus`
do guard (new `elem` mapMaybe tpName (iTVars ro))
return "type variable"
`mplus`
do _ <- msum (map (Map.lookup new) (iExistTVars rw))
return "type"
case shadowed of
Nothing -> return ()
Just that ->
recordError $ ErrorMsg $
text "Type" <+> text this <+> quotes (pp new) <+>
text "shadows an existing" <+>
text that <+> text "with the same name."
-- | The sub-computation is performed with the given type parameter in scope.
withTParam :: TParam -> InferM a -> InferM a
withTParam p (IM m) =
do case tpName p of
Just x -> checkTShadowing "variable" x
Nothing -> return ()
IM $ mapReader (\r -> r { iTVars = p : iTVars r }) m
withTParams :: [TParam] -> InferM a -> InferM a
withTParams ps m = foldr withTParam m ps
-- | The sub-computation is performed with the given type-synonym in scope.
withTySyn :: TySyn -> InferM a -> InferM a
withTySyn t (IM m) =
do let x = tsName t
checkTShadowing "synonym" x
IM $ mapReader (\r -> r { iTSyns = Map.insert x (IsLocal,t) (iTSyns r) }) m
withNewtype :: Newtype -> InferM a -> InferM a
withNewtype t (IM m) =
IM $ mapReader
(\r -> r { iNewtypes = Map.insert (ntName t) (IsLocal,t)
(iNewtypes r) }) m
-- | The sub-computation is performed with the given variable in scope.
withVarType :: QName -> VarType -> InferM a -> InferM a
withVarType x s (IM m) =
IM $ mapReader (\r -> r { iVars = Map.insert x s (iVars r) }) m
withVarTypes :: [(QName,VarType)] -> InferM a -> InferM a
withVarTypes xs m = foldr (uncurry withVarType) m xs
withVar :: QName -> Schema -> InferM a -> InferM a
withVar x s = withVarType x (ExtVar s)
-- | The sub-computation is performed with the given variables in scope.
withMonoType :: (QName,Located Type) -> InferM a -> InferM a
withMonoType (x,lt) = withVar x (Forall [] [] (thing lt))
-- | The sub-computation is performed with the given variables in scope.
withMonoTypes :: Map QName (Located Type) -> InferM a -> InferM a
withMonoTypes xs m = foldr withMonoType m (Map.toList xs)
-- | The sub-computation is performed with the given type synonyms
-- and variables in scope.
withDecls :: ([TySyn], Map QName Schema) -> InferM a -> InferM a
withDecls (ts,vs) m = foldr withTySyn (foldr add m (Map.toList vs)) ts
where
add (x,t) = withVar x t
-- | Perform the given computation in a new scope (i.e., the subcomputation
-- may use existential type variables).
inNewScope :: InferM a -> InferM a
inNewScope m =
do curScopes <- iExistTVars <$> IM get
IM $ sets_ $ \s -> s { iExistTVars = Map.empty : curScopes }
a <- m
IM $ sets_ $ \s -> s { iExistTVars = curScopes }
return a
--------------------------------------------------------------------------------
-- Kind checking
newtype KindM a = KM { unKM :: ReaderT KRO (StateT KRW InferM) a }
data KRO = KRO { lazyTVars :: Map QName Type -- ^ lazy map, with tyvars.
, allowWild :: Bool -- ^ are type-wild cards allowed?
}
data KRW = KRW { typeParams :: Map QName Kind -- ^ kinds of (known) vars.
}
instance Functor KindM where
fmap f (KM m) = KM (fmap f m)
instance Monad KindM where
return x = KM (return x)
fail x = KM (fail x)
KM m >>= k = KM (m >>= unKM . k)
{- | The arguments to this function are as follows:
(type param. name, kind signature (opt.), a type representing the param)
The type representing the parameter is just a thunk that we should not force.
The reason is that the type depnds on the kind of parameter, that we are
in the process of computing.
As a result we return the value of the sub-computation and the computed
kinds of the type parameters. -}
runKindM :: Bool -- Are type-wild cards allowed?
-> [(QName, Maybe Kind, Type)] -- ^ See comment
-> KindM a -> InferM (a, Map QName Kind)
runKindM wildOK vs (KM m) =
do (a,kw) <- runStateT krw (runReaderT kro m)
return (a, typeParams kw)
where
tys = Map.fromList [ (x,t) | (x,_,t) <- vs ]
kro = KRO { allowWild = wildOK, lazyTVars = tys }
krw = KRW { typeParams = Map.fromList [ (x,k) | (x,Just k,_) <- vs ] }
-- | This is waht's returned when we lookup variables during kind checking.
data LkpTyVar = TLocalVar Type (Maybe Kind) -- ^ Locally bound variable.
| TOuterVar Type -- ^ An outer binding.
-- | Check if a name refers to a type variable.
kLookupTyVar :: QName -> KindM (Maybe LkpTyVar)
kLookupTyVar x = KM $
do vs <- lazyTVars `fmap` ask
ss <- get
case Map.lookup x vs of
Just t -> return $ Just $ TLocalVar t $ Map.lookup x $ typeParams ss
Nothing -> lift $ lift $ do t <- lookupTVar x
return (fmap TOuterVar t)
-- | Are type wild-cards OK in this context?
kWildOK :: KindM Bool
kWildOK = KM $ fmap allowWild ask
-- | Reports an error.
kRecordError :: Error -> KindM ()
kRecordError e = kInInferM $ recordError e
kRecordWarning :: Warning -> KindM ()
kRecordWarning w = kInInferM $ recordWarning w
-- | Generate a fresh unification variable of the given kind.
kNewType :: Doc -> Kind -> KindM Type
kNewType src k = kInInferM $ newType src k
-- | Lookup the definition of a type synonym.
kLookupTSyn :: QName -> KindM (Maybe TySyn)
kLookupTSyn x = kInInferM $ lookupTSyn x
-- | Lookup the definition of a newtype.
kLookupNewtype :: QName -> KindM (Maybe Newtype)
kLookupNewtype x = kInInferM $ lookupNewtype x
kExistTVar :: QName -> Kind -> KindM Type
kExistTVar x k = kInInferM $ existVar x k
-- | Replace the given bound variables with concrete types.
kInstantiateT :: Type -> [(TParam,Type)] -> KindM Type
kInstantiateT t as = return (apSubst su t)
where su = listSubst [ (tpVar x, t1) | (x,t1) <- as ]
{- | Record the kind for a local type variable.
This assumes that we already checked that there was no other valid
kind for the variable (if there was one, it gets over-written). -}
kSetKind :: QName -> Kind -> KindM ()
kSetKind v k = KM $ sets_ $ \s -> s{ typeParams = Map.insert v k (typeParams s)}
-- | The sub-computation is about the given range of the source code.
kInRange :: Range -> KindM a -> KindM a
kInRange r (KM m) = KM $
do e <- ask
s <- get
(a,s1) <- lift $ lift $ inRange r $ runStateT s $ runReaderT e m
set s1
return a
kNewGoals :: ConstraintSource -> [Prop] -> KindM ()
kNewGoals c ps = kInInferM $ newGoals c ps
kInInferM :: InferM a -> KindM a
kInInferM m = KM $ lift $ lift m
|
dylanmc/cryptol
|
src/Cryptol/TypeCheck/Monad.hs
|
bsd-3-clause
| 23,200
| 0
| 21
| 6,651
| 6,099
| 3,166
| 2,933
| 382
| 7
|
module PatternRecogn where
|
EsGeh/pattern-recognition
|
src/PatternRecogn.hs
|
bsd-3-clause
| 27
| 0
| 2
| 3
| 4
| 3
| 1
| 1
| 0
|
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
--
-- Maybe.hs --- Optional Ivory values.
--
-- Copyright (C) 2013, Galois, Inc.
-- All Rights Reserved.
--
-- This software is released under the "BSD3" license. Read the file
-- "LICENSE" for more information.
--
-- | This module provides an interface for a nullable Ivory type.
--
-- To define a type like Haskell's @Maybe Float@, define an
-- Ivory structure type, and make the structure an instance
-- of 'MaybeType'.
--
-- > [ivory|
-- > struct maybe_float
-- > { mf_valid :: Stored IBool
-- > ; mf_value :: Stored IFloat
-- > }
-- > |]
-- >
-- > instance MaybeType "maybe_float" IFloat where
-- > maybeValidLabel = mf_valid
-- > maybeValueLabel = mf_value
--
-- With this definition in place, any of the functions in this
-- module will accept a @Struct \"maybe_float\"@.
--
-- These structure types must be defined in an Ivory module as
-- usual, and it is recommended to make them private unless they
-- are necessary as part of the module's public interface.
module Ivory.Stdlib.Maybe
(
-- * Interface
MaybeType(..)
-- * Initialization
, initJust, initNothing
-- * Getting
, getMaybe
-- * Setting
, setJust, setNothing
, setDefault, setDefault_
-- * Modifying
, mapMaybe
, mapMaybeM, mapMaybeM_
, forMaybeM, forMaybeM_
) where
import GHC.TypeLits
import Ivory.Language
class (IvoryStruct sym, IvoryExpr t, IvoryStore t, IvoryInit t) =>
MaybeType (sym :: Symbol) t | sym -> t where
-- | Return a boolean field indicating whether the value is valid.
maybeValidLabel :: Label sym (Stored IBool)
-- | Return the field containing a value, if it is valid.
maybeValueLabel :: Label sym (Stored t)
-- | Return an initializer for a maybe type with a valid value.
initJust :: MaybeType sym a => a -> Init (Struct sym)
initJust x =
istruct
[ maybeValidLabel .= ival true
, maybeValueLabel .= ival x
]
-- | Return an initializer for a maybe type with no value.
initNothing :: MaybeType sym a => Init (Struct sym)
initNothing =
istruct
[ maybeValidLabel .= ival false
]
-- | Retrieve a maybe's value given a default if it is nothing.
getMaybe :: MaybeType sym a
=> ConstRef s1 (Struct sym)
-> a
-> Ivory eff a
getMaybe ref def = do
valid <- deref (ref ~> maybeValidLabel)
value <- deref (ref ~> maybeValueLabel)
assign (valid ? (value, def))
-- | Set a maybe's value to a default if it is nothing, returning
-- the current value.
setDefault :: MaybeType sym a
=> Ref s1 (Struct sym)
-> a
-> Ivory eff a
setDefault ref def = do
setDefault_ ref def
deref (ref ~> maybeValueLabel)
-- | Set a maybe's value to a default value if it is nothing.
setDefault_ :: MaybeType sym a
=> Ref s1 (Struct sym)
-> a
-> Ivory eff ()
setDefault_ ref def = do
valid <- deref (ref ~> maybeValidLabel)
ifte_ (iNot valid)
(do store (ref ~> maybeValidLabel) true
store (ref ~> maybeValueLabel) def)
(return ())
-- | Modify a maybe value by an expression if it is not nothing.
mapMaybe :: MaybeType sym a
=> (a -> a)
-> Ref s1 (Struct sym)
-> Ivory eff ()
mapMaybe f ref = mapMaybeM (return . f) ref
-- | Modify a maybe value by an action if it is not nothing.
mapMaybeM :: MaybeType sym a
=> (a -> Ivory eff a)
-> Ref s1 (Struct sym)
-> Ivory eff ()
mapMaybeM f ref = do
valid <- deref (ref ~> maybeValidLabel)
ifte_ valid
(do value <- deref (ref ~> maybeValueLabel)
value' <- f value
store (ref ~> maybeValueLabel) value')
(return ())
-- | Flipped version of 'mapMaybeM'.
forMaybeM :: MaybeType sym a
=> Ref s1 (Struct sym)
-> (a -> Ivory eff a)
-> Ivory eff ()
forMaybeM = flip mapMaybeM
-- | Call an action with a maybe value if it is not nothing.
mapMaybeM_ :: MaybeType sym a
=> (a -> Ivory eff ())
-> Ref s1 (Struct sym)
-> Ivory eff ()
mapMaybeM_ f ref = do
valid <- deref (ref ~> maybeValidLabel)
ifte_ valid
(do value <- deref (ref ~> maybeValueLabel)
f value)
(return ())
-- | Flipped version of 'mapMaybeM_'.
forMaybeM_ :: MaybeType sym a
=> Ref s1 (Struct sym)
-> (a -> Ivory eff ())
-> Ivory eff ()
forMaybeM_ = flip mapMaybeM_
-- | Set a maybe value to a valid value.
setJust :: MaybeType sym a
=> Ref s1 (Struct sym)
-> a
-> Ivory eff ()
setJust ref x = do
store (ref ~> maybeValidLabel) true
store (ref ~> maybeValueLabel) x
-- | Set a maybe value to an invalid value.
setNothing :: MaybeType sym a
=> Ref s1 (Struct sym)
-> Ivory eff ()
setNothing ref = store (ref ~> maybeValidLabel) false
|
Hodapp87/ivory
|
ivory-stdlib/src/Ivory/Stdlib/Maybe.hs
|
bsd-3-clause
| 4,931
| 0
| 14
| 1,294
| 1,188
| 613
| 575
| 102
| 1
|
module Main ( main ) where
import qualified Data.Foldable as F
import Data.Map ( Map )
import qualified Data.Map as M
import Data.Maybe ( fromMaybe, mapMaybe )
import Data.Monoid
import Data.Set ( Set )
import qualified Data.Set as S
import System.Environment ( getArgs, withArgs )
import System.FilePath ( (<.>) )
import Test.HUnit ( assertEqual )
import LLVM.Analysis
import LLVM.Analysis.Util.Testing
import LLVM.Parse
import Foreign.Inference.Interface
import Foreign.Inference.Preprocessing
import Foreign.Inference.Analysis.ErrorHandling
import Foreign.Inference.Analysis.IndirectCallResolver
import Foreign.Inference.Analysis.Util.CompositeSummary
main :: IO ()
main = do
args <- getArgs
let pattern = case args of
[] -> "tests/error-handling/*.c"
[infile] -> infile
ds <- loadDependencies ["tests/error-handling"] []
let testDescriptors = [ TestDescriptor { testPattern = pattern
, testExpectedMapping = (<.> "expected")
, testResultBuilder = analyzeErrors ds
, testResultComparator = assertEqual
}
]
withArgs [] $ testAgainstExpected requiredOptimizations bcParser testDescriptors
where
bcParser = parseLLVMFile defaultParserOptions
type TestFormat = Map String (Set String, ErrorReturn)
analyzeErrors :: DependencySummary -> Module -> TestFormat
analyzeErrors ds m = toTestFormat eres fs
where
pta = identifyIndirectCallTargets m
fs = moduleDefinedFunctions m
funcLikes :: [FunctionMetadata]
funcLikes = map fromFunction (moduleDefinedFunctions m)
eres = identifyErrorHandling funcLikes ds pta
toTestFormat :: ErrorSummary -> [Function] -> TestFormat
toTestFormat eres = foldr checkSummary mempty
where
checkSummary f acc = fromMaybe acc $ do
let s = summarizeFunction f eres
(FAReportsErrors acts rcs, _) <- F.find isErrRetAnnot s
let fname = identifierAsString (functionName f)
return $ M.insert fname (errorFuncs acts, rcs) acc
isErrRetAnnot :: (FuncAnnotation, a) -> Bool
isErrRetAnnot (a, _) =
case a of
FAReportsErrors _ _ -> True
_ -> False
errorFuncs :: Set ErrorAction -> Set String
errorFuncs = S.fromList . mapMaybe toErrFunc . S.toList
where
toErrFunc a =
case a of
FunctionCall fname _ -> return fname
_ -> Nothing
|
travitch/foreign-inference
|
tests/ErrorHandlingTests.hs
|
bsd-3-clause
| 2,456
| 0
| 15
| 601
| 651
| 353
| 298
| 58
| 2
|
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Sigym4.Geometry.Types (
Geometry (..)
, LineString (..)
, MultiLineString (..)
, LinearRing (..)
, Vertex
, Point (..)
, MultiPoint (..)
, Polygon (..)
, MultiPolygon (..)
, Triangle (..)
, TIN (..)
, PolyhedralSurface (..)
, GeometryCollection (..)
, Feature
, FeatureCollection
, FeatureT (..)
, FeatureCollectionT (..)
, VectorSpace (..)
, HasOffset (..)
, Pixel (..)
, Size (..)
, Offset (..)
, RowMajor
, ColumnMajor
, Extent (..)
, GeoTransform (..)
, Raster (..)
, indexRaster
, northUpGeoTransform
, GeoReference (..)
, mkGeoReference
, pointOffset
, grScalarSize
, scalarSize
, grForward
, grBackward
, mkLineString
, mkLinearRing
, mkPolygon
, mkTriangle
, pointCoordinates
, lineStringCoordinates
, polygonCoordinates
, polygonRings
, triangleCoordinates
, convertRasterOffsetType
, gSrid
, hasSrid
, withSrid
, eSize
-- lenses & prisms
, pVertex
, fGeom
, fData
, fcFeatures
, mpPoints
, lrPoints
, lsPoints
, mlLineStrings
, pOuterRing
, pRings
, mpPolygons
, psPolygons
, tinTriangles
, gcGeometries
, _GeoPoint
, _GeoMultiPoint
, _GeoLineString
, _GeoMultiLineString
, _GeoPolygon
, _GeoMultiPolygon
, _GeoTriangle
, _GeoPolyhedralSurface
, _GeoTIN
, _GeoCollection
, NoSrid
-- re-exports
, KnownNat
, Nat
, module V2
, module V3
) where
import Control.Lens
import Data.Foldable (product)
import Data.Proxy (Proxy (..))
import qualified Data.Semigroup as SG
import qualified Data.Vector as V
import qualified Data.Vector.Generic as GV
import qualified Data.Vector.Unboxed as U
import Data.Vector.Unboxed.Deriving (derivingUnbox)
import GHC.TypeLits
import Linear.Matrix (inv22, inv33, (!*), (*!))
import Linear.Metric (Metric)
import Linear.V2 as V2
import Linear.V3 as V3
import Prelude hiding (product)
-- | A vertex
type Vertex v = v Double
-- | A square Matrix
type SqMatrix v = v (Vertex v)
-- | A vector space
class ( Num (Vertex v), Fractional (Vertex v)
, Show (Vertex v), Eq (Vertex v), U.Unbox (Vertex v)
, Show (v Int), Eq (v Int), Eq (v Bool)
, Num (SqMatrix v), Show (SqMatrix v), Eq (SqMatrix v)
, Metric v, Applicative v, Foldable v)
=> VectorSpace v where
inv :: SqMatrix v -> SqMatrix v
dim :: Proxy v -> Int
coords :: Vertex v -> [Double]
fromCoords :: [Double] -> Maybe (Vertex v)
instance VectorSpace V2 where
inv = inv22
dim _ = 2
coords (V2 u v) = [u, v]
fromCoords [u, v] = Just $ V2 u v
fromCoords _ = Nothing
{-# INLINE dim #-}
{-# INLINE fromCoords #-}
{-# INLINE coords #-}
instance VectorSpace V3 where
inv = inv33
dim _ = 3
coords (V3 u v z) = [u, v, z]
fromCoords [u, v, z] = Just $ V3 u v z
fromCoords _ = Nothing
{-# INLINE dim #-}
{-# INLINE fromCoords #-}
{-# INLINE coords #-}
newtype Offset (t :: OffsetType) = Offset {unOff :: Int}
deriving (Eq, Show, Ord, Num)
data OffsetType = RowMajor | ColumnMajor
type RowMajor = 'RowMajor
type ColumnMajor = 'ColumnMajor
class HasOffset v (t :: OffsetType) where
toOffset :: Size v -> Pixel v -> Maybe (Offset t)
fromOffset :: Size v -> Offset t -> Maybe (Pixel v)
unsafeToOffset :: Size v -> Pixel v -> Offset t
unsafeFromOffset :: Size v -> Offset t -> Pixel v
instance HasOffset V2 RowMajor where
toOffset s p
| 0<=px && px < sx
, 0<=py && py < sy = Just (unsafeToOffset s p)
| otherwise = Nothing
where V2 sx sy = unSize s
V2 px py = fmap floor $ unPx p
{-# INLINE toOffset #-}
unsafeToOffset s p = Offset $ py * sx + px
where V2 sx _ = unSize s
V2 px py = fmap floor $ unPx p
{-# INLINE unsafeToOffset #-}
fromOffset s@(Size (V2 sx sy)) o@(Offset o')
| 0<=o' && o'<sx*sy = Just (unsafeFromOffset s o)
| otherwise = Nothing
{-# INLINE fromOffset #-}
unsafeFromOffset (Size (V2 sx _)) (Offset o)
= Pixel (V2 (fromIntegral px) (fromIntegral py))
where (py,px) = o `divMod` sx
{-# INLINE unsafeFromOffset #-}
instance HasOffset V2 ColumnMajor where
toOffset s p
| 0<=px && px < sx
, 0<=py && py < sy = Just (unsafeToOffset s p)
| otherwise = Nothing
where V2 sx sy = unSize s
V2 px py = fmap floor $ unPx p
{-# INLINE toOffset #-}
unsafeToOffset s p = Offset $ px * sy + py
where V2 _ sy = unSize s
V2 px py = fmap floor $ unPx p
{-# INLINE unsafeToOffset #-}
fromOffset s@(Size (V2 sx sy)) o@(Offset o')
| 0<=o' && o'<sx*sy = Just (unsafeFromOffset s o)
| otherwise = Nothing
{-# INLINE fromOffset #-}
unsafeFromOffset (Size (V2 _ sy)) (Offset o)
= Pixel (V2 (fromIntegral px) (fromIntegral py))
where (px,py) = o `divMod` sy
{-# INLINE unsafeFromOffset #-}
instance HasOffset V3 RowMajor where
toOffset s p
| 0<=px && px < sx
, 0<=py && py < sy
, 0<=pz && pz < sz = Just (unsafeToOffset s p)
| otherwise = Nothing
where V3 sx sy sz = unSize s
V3 px py pz = fmap floor $ unPx p
{-# INLINE toOffset #-}
unsafeToOffset s p = Offset $ (pz * sx * sy) + (py * sx) + px
where V3 sx sy _ = unSize s
V3 px py pz = fmap floor $ unPx p
{-# INLINE unsafeToOffset #-}
fromOffset s@(Size (V3 sx sy sz)) o@(Offset o')
| 0<=o' && o'<sx*sy*sz = Just (unsafeFromOffset s o)
| otherwise = Nothing
{-# INLINE fromOffset #-}
unsafeFromOffset (Size (V3 sx sy _)) (Offset o)
= Pixel (V3 (fromIntegral px) (fromIntegral py) (fromIntegral pz))
where (pz, r) = o `divMod` (sx*sy)
(py,px) = r `divMod` sx
{-# INLINE unsafeFromOffset #-}
instance HasOffset V3 ColumnMajor where
toOffset s p
| 0<=px && px < sx
, 0<=py && py < sy
, 0<=pz && pz < sz = Just (unsafeToOffset s p)
| otherwise = Nothing
where V3 sx sy sz = unSize s
V3 px py pz = fmap floor $ unPx p
{-# INLINE toOffset #-}
unsafeToOffset s p = Offset $ (px * sz * sy) + (py * sz) + pz
where V3 _ sy sz = unSize s
V3 px py pz = fmap floor $ unPx p
{-# INLINE unsafeToOffset #-}
fromOffset s@(Size (V3 sx sy sz)) o@(Offset o')
| 0<=o' && o'<sx*sy*sz = Just (unsafeFromOffset s o)
| otherwise = Nothing
{-# INLINE fromOffset #-}
unsafeFromOffset (Size (V3 _ sy sz)) (Offset o)
= Pixel (V3 (fromIntegral px) (fromIntegral py) (fromIntegral pz))
where (px, r) = o `divMod` (sz*sy)
(py,pz) = r `divMod` sz
{-# INLINE unsafeFromOffset #-}
type NoSrid = 0
-- | An extent in v space is a pair of minimum and maximum vertices
data Extent v (srid :: Nat) = Extent {eMin :: !(Vertex v), eMax :: !(Vertex v)}
deriving instance VectorSpace v => Eq (Extent v srid)
deriving instance VectorSpace v => Show (Extent v srid)
eSize :: VectorSpace v => Extent v srid -> Vertex v
eSize e = eMax e - eMin e
instance VectorSpace v => SG.Semigroup (Extent v srid) where
Extent a0 a1 <> Extent b0 b1
= Extent (min <$> a0 <*> b0) (max <$> a1 <*> b1)
-- | A pixel is a newtype around a vertex
newtype Pixel v = Pixel {unPx :: Vertex v}
deriving instance VectorSpace v => Show (Pixel v)
deriving instance VectorSpace v => Eq (Pixel v)
newtype Size v = Size {unSize :: v Int}
deriving instance VectorSpace v => Eq (Size v)
deriving instance VectorSpace v => Show (Size v)
scalarSize :: VectorSpace v => Size v -> Int
scalarSize = product . unSize
-- A GeoTransform defines how we translate from geographic 'Vertex'es to
-- 'Pixel' coordinates and back. gtMatrix *must* be inversible so smart
-- constructors are provided
data GeoTransform v (srid :: Nat) = GeoTransform
{ gtMatrix :: !(SqMatrix v)
, gtOrigin :: !(Vertex v)
}
deriving instance VectorSpace v => Eq (GeoTransform v srid)
deriving instance VectorSpace v => Show (GeoTransform v srid)
northUpGeoTransform :: Extent V2 srid -> Size V2
-> Either String (GeoTransform V2 srid)
northUpGeoTransform e s
| not isValidBox = Left "northUpGeoTransform: invalid extent"
| not isValidSize = Left "northUpGeoTransform: invalid size"
| otherwise = Right $ GeoTransform matrix origin
where
isValidBox = fmap (> 0) (eMax e - eMin e) == pure True
isValidSize = fmap (> 0) s' == pure True
V2 x0 _ = eMin e
V2 _ y1 = eMax e
origin = V2 x0 y1
s' = fmap fromIntegral $ unSize s
V2 dx dy = (eMax e - eMin e)/s'
matrix = V2 (V2 dx 0) (V2 0 (-dy))
gtForward :: VectorSpace v => GeoTransform v srid -> Point v srid -> Pixel v
gtForward gt (Point v) = Pixel $ m !* (v-v0)
where m = inv $ gtMatrix gt
v0 = gtOrigin gt
gtBackward :: VectorSpace v => GeoTransform v srid -> Pixel v -> Point v srid
gtBackward gt p = Point $ v0 + (unPx p) *! m
where m = gtMatrix gt
v0 = gtOrigin gt
data GeoReference v srid = GeoReference
{ grTransform :: GeoTransform v srid
, grSize :: Size v
}
deriving instance VectorSpace v => Eq (GeoReference v srid)
deriving instance VectorSpace v => Show (GeoReference v srid)
grScalarSize :: VectorSpace v => GeoReference v srid -> Int
grScalarSize = scalarSize . grSize
pointOffset :: (HasOffset v t, VectorSpace v)
=> GeoReference v srid -> Point v srid -> Maybe (Offset t)
pointOffset gr = toOffset (grSize gr) . grForward gr
{-# INLINEABLE pointOffset #-}
grForward :: VectorSpace v => GeoReference v srid -> Point v srid -> Pixel v
grForward gr = gtForward (grTransform gr)
{-# INLINE grForward #-}
grBackward :: VectorSpace v => GeoReference v srid -> Pixel v -> Point v srid
grBackward gr = gtBackward (grTransform gr)
{-# INLINE grBackward #-}
mkGeoReference :: Extent V2 srid -> Size V2 -> Either String (GeoReference V2 srid)
mkGeoReference e s = fmap (\gt -> GeoReference gt s) (northUpGeoTransform e s)
newtype Point v (srid :: Nat) = Point {_pVertex:: Vertex v}
deriving instance VectorSpace v => Show (Point v srid)
deriving instance VectorSpace v => Eq (Point v srid)
pVertex :: VectorSpace v => Lens' (Point v srid) (Vertex v)
pVertex = lens _pVertex (\point v -> point { _pVertex = v })
{-# INLINE pVertex #-}
derivingUnbox "Point"
[t| forall v srid. VectorSpace v => Point v srid -> Vertex v |]
[| \(Point v) -> v |]
[| \v -> Point v|]
derivingUnbox "Pixel"
[t| forall v. VectorSpace v => Pixel v -> Vertex v |]
[| \(Pixel v) -> v |]
[| \v -> Pixel v|]
derivingUnbox "Offset"
[t| forall t. Offset (t :: OffsetType) -> Int |]
[| \(Offset o) -> o |]
[| \o -> Offset o|]
newtype MultiPoint v srid = MultiPoint {
_mpPoints :: V.Vector (Point v srid)
} deriving (Eq, Show)
makeLenses ''MultiPoint
newtype LinearRing v srid = LinearRing {_lrPoints :: U.Vector (Point v srid)}
deriving (Eq, Show)
makeLenses ''LinearRing
newtype LineString v srid = LineString {_lsPoints :: U.Vector (Point v srid)}
deriving (Eq, Show)
makeLenses ''LineString
newtype MultiLineString v srid = MultiLineString {
_mlLineStrings :: V.Vector (LineString v srid)
} deriving (Eq, Show)
makeLenses ''MultiLineString
data Triangle v srid = Triangle !(Point v srid) !(Point v srid) !(Point v srid)
deriving (Eq, Show)
derivingUnbox "Triangle"
[t| forall v srid. VectorSpace v => Triangle v srid -> (Point v srid, Point v srid, Point v srid) |]
[| \(Triangle a b c) -> (a, b, c) |]
[| \(a, b, c) -> Triangle a b c|]
data Polygon v srid = Polygon {
_pOuterRing :: LinearRing v srid
, _pRings :: V.Vector (LinearRing v srid)
} deriving (Eq, Show)
makeLenses ''Polygon
newtype MultiPolygon v srid = MultiPolygon {
_mpPolygons :: V.Vector (Polygon v srid)
} deriving (Eq, Show)
makeLenses ''MultiPolygon
newtype PolyhedralSurface v srid = PolyhedralSurface {
_psPolygons :: V.Vector (Polygon v srid)
} deriving (Eq, Show)
makeLenses ''PolyhedralSurface
newtype TIN v srid = TIN {
_tinTriangles :: U.Vector (Triangle v srid)
} deriving (Eq, Show)
makeLenses ''TIN
data Geometry v (srid::Nat)
= GeoPoint (Point v srid)
| GeoMultiPoint (MultiPoint v srid)
| GeoLineString (LineString v srid)
| GeoMultiLineString (MultiLineString v srid)
| GeoPolygon (Polygon v srid)
| GeoMultiPolygon (MultiPolygon v srid)
| GeoTriangle (Triangle v srid)
| GeoPolyhedralSurface (PolyhedralSurface v srid)
| GeoTIN (TIN v srid)
| GeoCollection (GeometryCollection v srid)
deriving (Eq, Show)
newtype GeometryCollection v srid = GeometryCollection {
_gcGeometries :: V.Vector (Geometry v srid)
} deriving (Eq, Show)
makeLenses ''GeometryCollection
makePrisms ''Geometry
gSrid :: KnownNat srid => proxy srid -> Integer
gSrid = natVal
withSrid
:: Integer
-> (forall srid. KnownNat srid => Proxy srid -> a)
-> Maybe a
withSrid srid f
= case someNatVal srid of
Just (SomeNat a) -> Just (f a)
Nothing -> Nothing
hasSrid :: KnownNat srid => Geometry v srid -> Bool
hasSrid = (/= 0) . gSrid
mkLineString :: VectorSpace v => [Point v srid] -> Maybe (LineString v srid)
mkLineString ls
| U.length v >= 2 = Just $ LineString v
| otherwise = Nothing
where v = U.fromList ls
mkLinearRing :: VectorSpace v => [Point v srid] -> Maybe (LinearRing v srid)
mkLinearRing ls
| U.length v >= 4, U.last v == U.head v = Just $ LinearRing v
| otherwise = Nothing
where v = U.fromList ls
mkPolygon :: [LinearRing v srid] -> Maybe (Polygon v srid)
mkPolygon (oRing:rings) = Just $ Polygon oRing $ V.fromList rings
mkPolygon _ = Nothing
mkTriangle :: VectorSpace v
=> Point v srid -> Point v srid -> Point v srid -> Maybe (Triangle v srid)
mkTriangle a b c | a/=b, b/=c, a/=c = Just $ Triangle a b c
| otherwise = Nothing
pointCoordinates :: VectorSpace v => Point v srid -> [Double]
pointCoordinates = views pVertex coords
lineStringCoordinates :: VectorSpace v => LineString v srid -> [[Double]]
lineStringCoordinates = vectorCoordinates . _lsPoints
linearRingCoordinates :: VectorSpace v => LinearRing v srid -> [[Double]]
linearRingCoordinates = vectorCoordinates . _lrPoints
polygonCoordinates :: VectorSpace v => Polygon v srid -> [[[Double]]]
polygonCoordinates = V.toList . V.map linearRingCoordinates . polygonRings
polygonRings :: Polygon v srid -> V.Vector (LinearRing v srid)
polygonRings (Polygon ir rs) = V.cons ir rs
triangleCoordinates :: VectorSpace v => Triangle v srid -> [[Double]]
triangleCoordinates (Triangle a b c) = map pointCoordinates [a, b, c, a]
vectorCoordinates :: VectorSpace v => U.Vector (Point v srid) -> [[Double]]
vectorCoordinates = V.toList . V.map pointCoordinates . V.convert
-- | A feature of 'GeometryType' t, vertex type 'v' and associated data 'd'
data FeatureT (g :: (* -> *) -> Nat -> *) v (srid::Nat) d = Feature {
_fGeom :: g v srid
, _fData :: d
} deriving (Eq, Show, Functor)
makeLenses ''FeatureT
type Feature = FeatureT Geometry
newtype FeatureCollectionT (g :: (* -> *) -> Nat -> *) v (srid::Nat) d = FeatureCollection {
_fcFeatures :: [FeatureT g v srid d]
} deriving (Eq, Show, Functor)
makeLenses ''FeatureCollectionT
type FeatureCollection = FeatureCollectionT Geometry
instance Monoid (FeatureCollectionT g v srid d) where
mempty = FeatureCollection mempty
(FeatureCollection as) `mappend` (FeatureCollection bs)
= FeatureCollection $ as `mappend` bs
data Raster vs (t :: OffsetType) srid v a
= Raster {
rGeoReference :: !(GeoReference vs srid)
, rData :: !(v a)
} deriving (Eq, Show)
indexRaster
:: forall vs t srid v a. (GV.Vector v a, HasOffset vs t)
=> Raster vs t srid v a -> Pixel vs -> Maybe a
indexRaster raster px = fmap (GV.unsafeIndex arr . unOff) offset
where
offset :: Maybe (Offset t)
offset = toOffset (grSize (rGeoReference raster)) px
arr = rData raster
{-# INLINE indexRaster #-}
convertRasterOffsetType
:: forall vs t1 t2 srid v a. (GV.Vector v a, HasOffset vs t1, HasOffset vs t2)
=> Raster vs t1 srid v a -> Raster vs t2 srid v a
convertRasterOffsetType r = r {rData = GV.generate n go}
where go i = let px = unsafeFromOffset s (Offset i :: Offset t2)
Offset i' = unsafeToOffset s px :: Offset t1
in rd `GV.unsafeIndex` i'
s = grSize (rGeoReference r)
rd = rData r
n = GV.length rd
|
krisajenkins/sigym4-geometry
|
Sigym4/Geometry/Types.hs
|
bsd-3-clause
| 17,424
| 0
| 13
| 4,630
| 6,112
| 3,221
| 2,891
| 465
| 2
|
module Tester where
import LazyCrossCheck
main :: IO ()
main = test
test :: IO ()
test = lazyCrossCheck 5 "version" $
(version1 --> version2) `with` [ ints ==> [1,2,3] ]
version1 :: Maybe Int -> Int
version1 Nothing = 1
version1 (Just x) = x
version2 :: Maybe Int -> Int
version2 Nothing = 1
version2 (Just _) = 2
|
TristanAllwood/lazyCrossCheck
|
Tester.hs
|
bsd-3-clause
| 327
| 0
| 8
| 74
| 143
| 77
| 66
| 13
| 1
|
module Main where
import Foundation
import MougiIwasa (runMougiIwasa)
main :: IO ()
main = runMougiIwasa
|
ttoe/diffeq-hs
|
src/Main.hs
|
bsd-3-clause
| 108
| 0
| 6
| 18
| 30
| 18
| 12
| 5
| 1
|
{-# OPTIONS_GHC -Wno-missing-signatures #-}
{-# LANGUAGE ParallelListComp #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeApplications #-}
module Cm.RGA where
import Prelude hiding (fail)
import Control.Monad.State.Strict (execStateT, runStateT)
import Data.Foldable (toList)
import qualified Data.Map.Strict as Map
import Data.Maybe (isJust)
import Test.QuickCheck (Property, conjoin, counterexample, (.&&.),
(===))
import CRDT.Arbitrary (NoNul (..))
import CRDT.Cm (apply, initial, makeAndApplyOp, makeOp)
import CRDT.Cm.RGA (RGA (OpAddAfter, OpRemove), RgaIntent (AddAfter),
RgaPayload (RgaPayload), fromString, load,
toString)
import CRDT.LamportClock (LamportTime (LamportTime), Pid (Pid),
advance)
import CRDT.LamportClock.Simulation (ProcessSim, runLamportClockSim,
runProcessSim)
import CRDT.Laws (cmrdtLaw)
import GHC.Exts (fromList)
import Util (pattern (:-), expectRightK, fail, ok)
prop_makeOp = isJust $ makeOp @(RGA Char) @ProcessSim
(AddAfter Nothing 'a')
(initial @(RGA Char))
prop_makeAndApplyOp = conjoin
[ counterexample "result3" $ expectRightK result3 $ \(op, payload) ->
counterexample ("op = " ++ show op) (opsEqWoTime op op3)
.&&. counterexample "payload" (payloadsEqWoTime payload payload3)
, counterexample "result2" $ expectRightK result2 $ \(op, payload) ->
counterexample ("op = " ++ show op) (opsEqWoTime op op2)
.&&. counterexample "payload" (payloadsEqWoTime payload payload2)
, counterexample "result1" $ expectRightK result1 $ \(op, payload) ->
counterexample ("op = " ++ show op) (opsEqWoTime op op1)
.&&. counterexample "payload" (payloadsEqWoTime payload payload1)
, counterexample "result12" $ result12 === payload12
, counterexample "results=" $ result21 === result12
]
where
time1 = LamportTime 4 $ Pid 1 -- TODO(cblp, 2018-02-11) arbitrary pids
time2 = LamportTime 4 $ Pid 2
time3 = LamportTime 3 $ Pid 3
op1 = OpAddAfter Nothing '1' time1
op2 = OpAddAfter Nothing '2' time2
op3 = OpAddAfter Nothing '3' time3
payload3 = load $ fromList [time3 :- '3']
payload1 = load $ fromList [time1 :- '1', time3 :- '3']
payload2 = load $ fromList [time2 :- '2', time3 :- '3']
payload12 = load $ fromList [time2 :- '2', time1 :- '1', time3 :- '3']
result3 =
runLamportClockSim
. runProcessSim (Pid 3)
. (`runStateT` initial @(RGA Char))
$ do
advance 2
makeAndApplyOp @(RGA Char) (AddAfter Nothing '3')
result2 =
runLamportClockSim . runProcessSim (Pid 2) . (`runStateT` payload3) $ do
advance 1
makeAndApplyOp @(RGA Char) (AddAfter Nothing '2')
result1 =
runLamportClockSim
. runProcessSim (Pid 1)
. (`runStateT` payload3)
$ makeAndApplyOp @(RGA Char) (AddAfter Nothing '1')
result12 = apply op2 payload1
result21 = apply op1 payload2
prop_fromString (NoNul s) pid =
expectRightK result $ payloadsEqWoTime $ load $ fromList
[ LamportTime t pid :- c | t <- [1..] | c <- s ]
where
result =
runLamportClockSim
. runProcessSim pid
. (`execStateT` initial @(RGA Char))
$ fromString s
prop_fromString_toString (NoNul s) pid = expectRightK result
$ \s' -> toString s' === s
where
result =
runLamportClockSim
. runProcessSim pid
. (`execStateT` initial @(RGA Char))
$ fromString s
prop_Cm = cmrdtLaw @(RGA Char)
-- | Ops equal without local times
opsEqWoTime (OpAddAfter parent1 atom1 id1) (OpAddAfter parent2 atom2 id2) =
conjoin
[ counterexample "parent" $ pidsMaybeEq parent1 parent2
, counterexample "atom" $ atom1 === atom2
, counterexample "id" $ pidsEqWoTime id1 id2
]
opsEqWoTime (OpRemove parent1) (OpRemove parent2) =
counterexample "parent" $ pidsEqWoTime parent1 parent2
opsEqWoTime x y = fail $ show x ++ " /= " ++ show y
pidsEqWoTime (LamportTime _ pid1) (LamportTime _ pid2) = pid1 === pid2
pidsMaybeEq Nothing Nothing = ok
pidsMaybeEq (Just x) (Just y) = pidsEqWoTime x y
pidsMaybeEq x y = fail $ show x ++ " /= " ++ show y
payloadsEqWoTime :: (Eq a, Show a) => RgaPayload a -> RgaPayload a -> Property
payloadsEqWoTime (RgaPayload vertices1 vertexIxs1) (RgaPayload vertices2 vertexIxs2)
= conjoin
[ counterexample "vertices" $ conjoin
[ counterexample ("[" ++ show i ++ "]")
$ counterexample "id" (pidsEqWoTime id1 id2)
.&&. counterexample "atom" (a1 === a2)
| i <- [0 :: Int ..] | (id1, a1) <- toList vertices1 | (id2, a2) <- toList vertices2
]
, counterexample "vertexIxs" $ conjoin
[ counterexample "id" (pidsEqWoTime id1 id2)
.&&. counterexample "ix" (ix1 === ix2)
| (id1, ix1) <- Map.assocs vertexIxs1 | (id2, ix2) <- Map.assocs vertexIxs2
]
]
|
cblp/crdt
|
crdt-test/test/Cm/RGA.hs
|
bsd-3-clause
| 5,380
| 9
| 16
| 1,631
| 1,570
| 841
| 729
| 107
| 1
|
module P008 where
import Arrays (window)
run :: IO ()
run = print result
where
input = "73167176531330624919225119674426574742355349194934\
\96983520312774506326239578318016984801869478851843\
\85861560789112949495459501737958331952853208805511\
\12540698747158523863050715693290963295227443043557\
\66896648950445244523161731856403098711121722383113\
\62229893423380308135336276614282806444486645238749\
\30358907296290491560440772390713810515859307960866\
\70172427121883998797908792274921901699720888093776\
\65727333001053367881220235421809751254540594752243\
\52584907711670556013604839586446706324415722155397\
\53697817977846174064955149290862569321978468622482\
\83972241375657056057490261407972968652414535100474\
\82166370484403199890008895243450658541227588666881\
\16427171479924442928230863465674813919123162824586\
\17866458359124566529476545682848912883142607690042\
\24219022671055626321111109370544217506941658960408\
\07198403850962455444362981230987879927244284909188\
\84580156166097919133875499200524063689912560717606\
\05886116467109405077541002256983155200055935729725\
\71636269561882670428252483600823257530420752963450"
digits = map (read . pure) input :: [Integer]
result = maximum . map product . window 13 $ digits
|
tyehle/euler-haskell
|
src/P008.hs
|
bsd-3-clause
| 1,489
| 0
| 10
| 301
| 83
| 45
| 38
| 7
| 1
|
module Time (
Time,
fromDays,
fromHours,
fromMinutes,
fromSeconds,
toDays,
toHours,
toMinutes,
toSeconds,
offset,
multiply,
) where
daysToHours :: (RealFrac a) => a -> a
daysToHours = (24 *)
daysToMinutes :: (RealFrac a) => a -> a
daysToMinutes = hoursToMinutes . daysToHours
daysToSeconds :: (RealFrac a) => a -> a
daysToSeconds = minutesToSeconds . daysToMinutes
hoursToDays :: (RealFrac a) => a -> a
hoursToDays = (/ 24)
hoursToMinutes :: (RealFrac a) => a -> a
hoursToMinutes = (60 *)
hoursToSeconds :: (RealFrac a) => a -> a
hoursToSeconds = minutesToSeconds . hoursToMinutes
minutesToDays :: (RealFrac a) => a -> a
minutesToDays = hoursToDays . minutesToHours
minutesToHours :: (RealFrac a) => a -> a
minutesToHours = (/ 60)
minutesToSeconds :: (RealFrac a) => a -> a
minutesToSeconds = (60 *)
secondsToDays :: (RealFrac a) => a -> a
secondsToDays = hoursToDays . secondsToHours
secondsToHours :: (RealFrac a) => a -> a
secondsToHours = minutesToHours . secondsToMinutes
secondsToMinutes :: (RealFrac a) => a -> a
secondsToMinutes = (/ 60)
newtype Time a = Seconds a
fromDays :: (RealFrac a) => a -> Time a
fromDays t = Seconds $ daysToSeconds t
fromHours :: (RealFrac a) => a -> Time a
fromHours t = Seconds $ hoursToSeconds t
fromMinutes :: (RealFrac a) => a -> Time a
fromMinutes t = Seconds $ minutesToSeconds t
fromSeconds :: (RealFrac a) => a -> Time a
fromSeconds t = Seconds t
toDays :: (RealFrac a) => Time a -> a
toDays (Seconds t) = secondsToDays t
toHours :: (RealFrac a) => Time a -> a
toHours (Seconds t) = secondsToHours t
toMinutes :: (RealFrac a) => Time a -> a
toMinutes (Seconds t) = secondsToMinutes t
toSeconds :: (RealFrac a) => Time a -> a
toSeconds (Seconds t) = t
offset :: (RealFrac a) => Time a -> Time a -> Time a
(Seconds t) `offset` (Seconds o) = Seconds $ t + o
multiply :: (RealFrac a) => Time a -> a -> Time a
(Seconds t) `multiply` m = Seconds $ t * m
|
siliconbrain/khaland
|
src/Time.hs
|
bsd-3-clause
| 1,959
| 0
| 8
| 406
| 781
| 424
| 357
| 57
| 1
|
{-# LANGUAGE TemplateHaskell #-}
module Reproduce.StandaloneHaddock where
import Lens.Family.TH
data Foo = Foo { _bar :: Int }
makeLenses ''Foo
|
Gabriel439/min-standalone
|
Reproduce/StandaloneHaddock.hs
|
bsd-3-clause
| 148
| 0
| 8
| 24
| 36
| 21
| 15
| 5
| 0
|
{-# LANGUAGE FlexibleInstances #-}
{-# OPTIONS_GHC -fno-warn-missing-methods #-}
-- http://www.seas.upenn.edu/~cis194/spring13/hw/06-laziness.pdf
module Ch6
(
knapsackExample,
fib,
fibs1,
fibs2,
Stream (Empty, Stream),
streamToList,
streamRepeat,
streamMap,
streamFromSeed,
nats,
ruler,
fibs3,
Matrix2 (..),
fib4
) where
import Data.Array
import Debug.Trace
knapsack01 :: [Double] -- values
-> [Integer] -- nonnegative weights
-> Integer -- knapsack size
-> Double -- max possible value
knapsack01 vs ws maxW = m!(numItems-1, maxW)
where
numItems = length vs
m = array ((-1, 0), (numItems-1, maxW)) $
[((-1, w), 0) | w <- [0..maxW]] ++
[((i, 0), 0) | i <- [0..numItems-1]] ++
[((i, w), best) | i <- [0..numItems-1], w <- [1..maxW], let best | ws!!i > w = m!(i-1, w) | otherwise = max (m!(i-1, w)) (m!(i-1, w-ws!!i) + vs!!i)]
knapsackExample = knapsack01 [3, 4, 5, 8, 10] [2, 3, 4, 5, 9] 20
-- Exercise 1
-- fib n computes the nth Fibonacci number Fn
fib :: Integer -> Integer
fib n = fibInner n 0 1
fibInner :: Integer -> Integer -> Integer -> Integer
fibInner 0 a b = a
fibInner n a b = fibInner (n - 1) b (a + b)
-- The infinite list of all Fibonacci numbers
fibs1 :: [Integer]
fibs1 = map fib [1..]
-- Exercise 2
-- More efficient implementation for fibs
fibs2 :: [Integer]
fibs2 = fibs2Inner 1 1
fibs2Inner :: Integer -> Integer -> [Integer]
fibs2Inner a b = a: fibs2Inner b (a + b)
-- Exercise 3
data Stream a = Empty
| Stream a (Stream a)
streamToList :: Stream a -> [a]
streamToList Empty = []
streamToList (Stream x stream) = x: streamToList stream
instance Show a => Show (Stream a) where
show stream = unwords $ map show $ take 20 $ streamToList stream
-- Exercise 4
streamRepeat :: a -> Stream a
streamRepeat x = Stream x (streamRepeat x)
streamMap :: (a -> b) -> Stream a -> Stream b
streamMap _ Empty = Empty
streamMap fun (Stream x stream) = Stream (fun x) (streamMap fun stream)
streamFromSeed :: (a -> a) -> a -> Stream a
streamFromSeed transform seed = Stream seed (streamFromSeed transform (transform seed))
-- Exercise 5
nats :: Stream Integer
nats = streamFromSeed (+1) 0
-- interleave streams [[0, 0, ...], [1, 1, ...], [2, 2, ...], ...]
ruler :: Stream Integer
ruler = interleaveStreams (streamMap streamRepeat nats)
-- interleave two streams
interleaveTwoStreams :: Stream Integer -> Stream Integer -> Stream Integer
interleaveTwoStreams (Stream x stream1) stream2 = Stream x (interleaveTwoStreams stream2 stream1)
-- interleave the Stream of Stream of Integer
interleaveStreams :: Stream (Stream Integer) -> Stream Integer
interleaveStreams (Stream xs restStream) = interleaveTwoStreams xs (interleaveStreams restStream)
-- Exercise 6 (Optional)
--
-- The essential idea is to work with generating functions of the form
-- a0 + a1x + a2x2 + · · · + anxn + . . .
-- where x is just a “formal parameter” (that is, we will never actually
-- substitute any values for x; we just use it as a placeholder) and all the
-- coefficients ai are integers. We will store the coefficients a0, a1, a2, . . .
-- in a Stream Integer.
-- x = 0 + 1x + 0x^2 + 0x^3 + ...
-- x :: Stream Integer
instance Num (Stream Integer) where
-- n = n + 0x + 0x^2 + 0x^3 + ...
fromInteger n = Stream n (streamRepeat 0)
-- to negate a generating function, negate all its coefficients
negate = streamMap negate
-- (a0 + a1x + a2x^2 + . . .) + (b0 + b1x + b2x^2 + . . .) =
-- (a0 + b0) + (a1 + b1)x + (a2 + b2)x^2 + . . .
(+) (Stream x stream1) (Stream y stream2) = Stream (x + y) (stream1 + stream2)
(+) Empty stream2 = stream2
(+) stream1 Empty = stream1
-- Suppose A = a0 + xA' and B = b0 + xB'
-- AB = (a0 + xA')B
-- = a0B + xA'B
-- = a0(b0 + xB') + xA'B
-- = a0b0 + x(a0B' + A'B)
(*) (Stream a0 a') (Stream b0 b') = Stream (a0 * b0) (streamMap (* a0) b' + (a' * Stream b0 b'))
(*) Empty _ = Empty
(*) _ Empty = Empty
-- Suppose A = a0 + xA' and B = b0 + xB'
-- A/B = (a0 / b0) + x((1 / b0)(A' - QB'))
instance Fractional (Stream Integer) where
(Stream a0 a') / (Stream b0 b') = q where
tr x0 = floor (fromIntegral x0 / fromIntegral b0 :: Double)
hed = floor (fromIntegral a0 / fromIntegral b0 :: Double)
q = Stream hed (streamMap tr (a' - (q * b')))
-- F(x) = x / (1 - x - x^2)
fibs3 :: Stream Integer
fibs3 = Stream 0 (Stream 1 Empty) / Stream 1 (Stream (-1) (Stream (-1) Empty))
-- Exercise 7: Fibonacci numbers via matrices
--
data Matrix2 a = Matrix2 a a a a
deriving (Show, Eq)
instance Num (Matrix2 Integer) where
(*) (Matrix2 a00 a01 a10 a11) (Matrix2 b00 b01 b10 b11) =
Matrix2 (a00 * b00 + a01 * b10) (a00 * b01 + a01 * b11) (a10 * b00 + a11 * b10) (a10 * b01 + a11 * b11)
fib4 :: Integer -> Integer
fib4 0 = 0
fib4 n = a11 (fib4Inner m n) where
a11 (Matrix2 _ _ _ a) = a
fib4Inner m n = foldl (*) m (replicate (fromIntegral n) m)
m = Matrix2 1 1 1 0
|
wangwangwar/cis194
|
src/ch6/Ch6.hs
|
bsd-3-clause
| 5,110
| 0
| 21
| 1,270
| 1,695
| 916
| 779
| 94
| 1
|
module Control.Applicative.Acme where
{- |
Application with the inverse lifting behavior of fmap.
Issue #1
-}
pamf :: Applicative f => f (a -> b) -> a -> f b
pamf f a = f <*> pure a
{- |
Operator version of pamf
Issue #1
-}
(>$<) :: Applicative f => f (a -> b) -> a -> f b
(>$<) = pamf
|
marcosdumay/acme-kitchen-sink
|
src/Control/Applicative/Acme.hs
|
bsd-3-clause
| 290
| 0
| 9
| 68
| 101
| 54
| 47
| 5
| 1
|
module IAU2000.Table53.Multipliers (multipliers) where
import Numeric.Units.Dimensional.Prelude
import qualified Prelude
import IAU2000.Table53.LunisolarMultipliers
import IAU2000.Table53.PlanetaryMultipliers
-- | Returns the series of fundamental argument multipliers. The multipliers
-- are on the order [m10,m11,m12,m13,m14,m1,m2,m3,m4,m5,m6,m7,m8,m9] where
-- the indices correspond to those of the fundamental arguments on page 46
-- of [3]. For the luni-solar terms (the first 678 terms in the series) only
-- m10 through m14 are provided.
multipliers :: Fractional a => [[Dimensionless a]]
multipliers = lunisolarMultipliers ++ planetaryMultipliers
|
bjornbm/astro-tables
|
IAU2000/Table53/Multipliers.hs
|
bsd-3-clause
| 658
| 0
| 8
| 79
| 70
| 45
| 25
| 7
| 1
|
{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
module Ration.Layout where
import Haste.JSON
import Haste.Serialize
import Data.Time.Calendar
import Data.Time.Format
import Data.Maybe
import Data.Typeable
import Control.Applicative
import Ration.Person
import Ration.Food
data FoodLayout = FoodLayout {
foodLayoutName :: String
, foodLayoutDate :: Maybe Day
, foodLayoutPersons :: [Person]
, foodLayoutDays :: [LayoutDay]
, foodLayoutFood :: [Food]
} deriving (Typeable, Show, Eq)
instance Serialize FoodLayout where
toJSON v = Dict $ [
("foodLayoutName", toJSON $ foodLayoutName v) ]
++ (maybe [] (\v' -> [("foodLayoutDate", toJSON $ showDay v')]) (foodLayoutDate v)) ++
[ ("foodLayoutPersons", toJSON $ foodLayoutPersons v)
, ("foodLayoutDays", toJSON $ foodLayoutDays v)
, ("foodLayoutFood", toJSON $ foodLayoutFood v)
]
where showDay = formatTime defaultTimeLocale (iso8601DateFormat Nothing)
parseJSON j = FoodLayout
<$> j .: "foodLayoutName"
<*> (fmap readDay <$> j .:? "foodLayoutDate")
<*> j .: "foodLayoutPersons"
<*> j .: "foodLayoutDays"
<*> j .: "foodLayoutFood"
where readDay = parseTimeOrError True defaultTimeLocale (iso8601DateFormat Nothing)
data LayoutDay = LayoutDay
deriving (Typeable, Show, Eq)
instance Serialize LayoutDay where
toJSON v = Dict $ [
]
parseJSON j = pure LayoutDay
newFoodLayout :: String -> FoodLayout
newFoodLayout name = FoodLayout {
foodLayoutName = name
, foodLayoutDate = Nothing
, foodLayoutPersons = []
, foodLayoutDays = []
, foodLayoutFood = []
}
|
NCrashed/pohodnik-ration
|
src/Ration/Layout.hs
|
bsd-3-clause
| 1,605
| 0
| 16
| 304
| 460
| 256
| 204
| 45
| 1
|
{-|
Copyright : (c) Dave Laing, 2017
License : BSD3
Maintainer : dave.laing.80@gmail.com
Stability : experimental
Portability : non-portable
-}
{-# LANGUAGE ConstraintKinds #-}
module Fragment.Pair.Rules.Type (
PairNormalizeConstraint
, pairNormalizeRules
) where
import Control.Lens (review, preview)
import Rules.Type
import Ast.Type
import Fragment.Pair.Ast.Type
type PairNormalizeConstraint ki ty a = AsTyPair ki ty
normalizePair :: PairNormalizeConstraint ki ty a
=> (Type ki ty a -> Type ki ty a)
-> Type ki ty a
-> Maybe (Type ki ty a)
normalizePair normalizeFn ty = do
(p1, p2) <- preview _TyPair ty
return $ review _TyPair (normalizeFn p1, normalizeFn p2)
pairNormalizeRules :: PairNormalizeConstraint ki ty a
=> NormalizeInput ki ty a
pairNormalizeRules =
NormalizeInput [ NormalizeTypeRecurse normalizePair ]
|
dalaing/type-systems
|
src/Fragment/Pair/Rules/Type.hs
|
bsd-3-clause
| 910
| 0
| 10
| 205
| 216
| 115
| 101
| 20
| 1
|
{-# LANGUAGE NoImplicitPrelude #-}
module Protocol.ROC.PointTypes.PointType47 where
import Data.Binary.Get (getByteString,
getWord8,
getWord32le,
Get)
import Data.ByteString (ByteString)
import Data.Word (Word8,Word32)
import Prelude (($),
return,
Bool,
Eq,
Float,
Read,
Show)
import Protocol.ROC.Float (getIeeeFloat32)
import Protocol.ROC.Utils (anyButNull)
data PointType47 = PointType47 {
pointType47FlowRatePerDay :: !PointType47FlowRatePerDay
,pointType47EnergyRatePerDay :: !PointType47EnergyRatePerDay
,pointType47FlowRatePerHour :: !PointType47FlowRatePerHour
,pointType47EnergyRatePerHour :: !PointType47EnergyRatePerHour
,pointType47OrPressExtLinMeterUncrtdFlow :: !PointType47OrPressExtLinMeterUncrtdFlow
,pointType47OrExpFactorTbFpm :: !PointType47OrExpFactorTbFpm
,pointType47OrCdFT :: !PointType47OrCdFT
,pointType47OrFmTbFtm :: !PointType47OrFmTbFtm
,pointType47Fpb :: !PointType47Fpb
,pointType47Ftb :: !PointType47Ftb
,pointType47Ftf :: !PointType47Ftf
,pointType47Fgr :: !PointType47Fgr
,pointType47Fpv :: !PointType47Fpv
,pointType47ZsCompStndCond :: !PointType47ZsCompStndCond
,pointType47ZbCompBaseCond :: !PointType47ZbCompBaseCond
,pointType47Zf1CompFlowingCond :: !PointType47Zf1CompFlowingCond
,pointType47OrIntegMultValueTbBaseMultValue :: !PointType47OrIntegMultValueTbBaseMultValue
,pointType47OrPlateBoreDiamFlowingCond :: !PointType47OrPlateBoreDiamFlowingCond
,pointType47MeterTubeIntDiamFlowingCond :: !PointType47MeterTubeIntDiamFlowingCond
,pointType47DiamRatioBeta :: !PointType47DiamRatioBeta
,pointType47VelocityOfApproachEV :: !PointType47VelocityOfApproachEV
,pointType47OrAvghLinMeterTotalCountsLastBMP :: !PointType47OrAvghLinMeterTotalCountsLastBMP
,pointType47PfAvgFlowingPress :: !PointType47PfAvgFlowingPress
,pointType47TfAvgFlowingTemp :: !PointType47TfAvgFlowingTemp
,pointType47FlowingDensity :: !PointType47FlowingDensity
,pointType47BaseDensity :: !PointType47BaseDensity
,pointType47ReynoldsNum :: !PointType47ReynoldsNum
,pointType47UpStrmStaticPress :: !PointType47UpStrmStaticPress
,pointType47MolecularWeight :: !PointType47MolecularWeight
,pointType47Fam :: !PointType47Fam
,pointType47Fwt :: !PointType47Fwt
,pointType47Fwl :: !PointType47Fwl
,pointType47LocalGravCrctStaticPress :: !PointType47LocalGravCrctStaticPress
,pointType47LocalGravCrctDP :: !PointType47LocalGravCrctDP
,pointType47Fhgm :: !PointType47Fhgm
,pointType47Fhgt :: !PointType47Fhgt
,pointType47FlowToday :: !PointType47FlowToday
,pointType47FlowYesterday :: !PointType47FlowYesterday
,pointType47FlowMonth :: !PointType47FlowMonth
,pointType47FlowPrvsMonth :: !PointType47FlowPrvsMonth
,pointType47FlowAccum :: !PointType47FlowAccum
,pointType47MinutesToday :: !PointType47MinutesToday
,pointType47MinutesYesterday :: !PointType47MinutesYesterday
,pointType47MinutesMonth :: !PointType47MinutesMonth
,pointType47MinutesPrvsMonth :: !PointType47MinutesPrvsMonth
,pointType47MinutesAccum :: !PointType47MinutesAccum
,pointType47EnergyToday :: !PointType47EnergyToday
,pointType47EnergyYesterday :: !PointType47EnergyYesterday
,pointType47EnergyMonth :: !PointType47EnergyMonth
,pointType47EnergyPrvsMonth :: !PointType47EnergyPrvsMonth
,pointType47EnergyAccum :: !PointType47EnergyAccum
,pointType47UncrtdToday :: !PointType47UncrtdToday
,pointType47UncrtdYesterday :: !PointType47UncrtdYesterday
,pointType47UncrtdMonth :: !PointType47UncrtdMonth
,pointType47UncrtdPrvsMonth :: !PointType47UncrtdPrvsMonth
,pointType47UncrtdAccum :: !PointType47UncrtdAccum
,pointType47PartialRecalcFlag :: !PointType47PartialRecalcFlag
,pointType47RedundantFlowRatePerDay :: !PointType47RedundantFlowRatePerDay
,pointType47RedundantTotalCounts :: !PointType47RedundantTotalCounts
,pointType47LinMeterRawPulses :: !PointType47LinMeterRawPulses
,pointType47MeterFlowingStatus :: !PointType47MeterFlowingStatus
,pointType47DailyMassFlowRate :: !PointType47DailyMassFlowRate
,pointType47HourlyMassFlowRate :: !PointType47HourlyMassFlowRate
,pointType47MassFlowToday :: !PointType47MassFlowToday
,pointType47MassFlowYesterday :: !PointType47MassFlowYesterday
,pointType47MassFlowCurrentMonth :: !PointType47MassFlowCurrentMonth
,pointType47MassFlowPrvsMonth :: !PointType47MassFlowPrvsMonth
,pointType47MassFlowAccumLastReset :: !PointType47MassFlowAccumLastReset
,pointType47FlowCalcCFG :: !PointType47FlowCalcCFG
,pointType47FlowCalcAGA7PressMult :: !PointType47FlowCalcAGA7PressMult
,pointType47FlowCalcAGA7TempMult :: !PointType47FlowCalcAGA7TempMult
,pointType47FlowCalcAGA7CompMult :: !PointType47FlowCalcAGA7CompMult
,pointType47DescActiveFlowCalc :: !PointType47DescActiveFlowCalc
,pointType47DescActivePropCalc :: !PointType47DescActivePropCalc
,pointType47UpStrmFlowingTemp :: !PointType47UpStrmFlowingTemp
} deriving (Read,Eq, Show)
type PointType47FlowRatePerDay = Float
type PointType47EnergyRatePerDay = Float
type PointType47FlowRatePerHour = Float
type PointType47EnergyRatePerHour = Float
type PointType47OrPressExtLinMeterUncrtdFlow = Float
type PointType47OrExpFactorTbFpm = Float
type PointType47OrCdFT = Float
type PointType47OrFmTbFtm = Float
type PointType47Fpb = Float
type PointType47Ftb = Float
type PointType47Ftf = Float
type PointType47Fgr = Float
type PointType47Fpv = Float
type PointType47ZsCompStndCond = Float
type PointType47ZbCompBaseCond = Float
type PointType47Zf1CompFlowingCond = Float
type PointType47OrIntegMultValueTbBaseMultValue = Float
type PointType47OrPlateBoreDiamFlowingCond = Float
type PointType47MeterTubeIntDiamFlowingCond = Float
type PointType47DiamRatioBeta = Float
type PointType47VelocityOfApproachEV = Float
type PointType47OrAvghLinMeterTotalCountsLastBMP = Float
type PointType47PfAvgFlowingPress = Float
type PointType47TfAvgFlowingTemp = Float
type PointType47FlowingDensity = Float
type PointType47BaseDensity = Float
type PointType47ReynoldsNum = Float
type PointType47UpStrmStaticPress = Float
type PointType47MolecularWeight = Float
type PointType47Fam = Float
type PointType47Fwt = Float
type PointType47Fwl = Float
type PointType47LocalGravCrctStaticPress = Float
type PointType47LocalGravCrctDP = Float
type PointType47Fhgm = Float
type PointType47Fhgt = Float
type PointType47FlowToday = Float
type PointType47FlowYesterday = Float
type PointType47FlowMonth = Float
type PointType47FlowPrvsMonth = Float
type PointType47FlowAccum = Float
type PointType47MinutesToday = Float
type PointType47MinutesYesterday = Float
type PointType47MinutesMonth = Float
type PointType47MinutesPrvsMonth = Float
type PointType47MinutesAccum = Float
type PointType47EnergyToday = Float
type PointType47EnergyYesterday = Float
type PointType47EnergyMonth = Float
type PointType47EnergyPrvsMonth = Float
type PointType47EnergyAccum = Float
type PointType47UncrtdToday = Float
type PointType47UncrtdYesterday = Float
type PointType47UncrtdMonth = Float
type PointType47UncrtdPrvsMonth = Float
type PointType47UncrtdAccum = Float
type PointType47PartialRecalcFlag = Word8
type PointType47RedundantFlowRatePerDay = Float
type PointType47RedundantTotalCounts = Float
type PointType47LinMeterRawPulses = Word32
type PointType47MeterFlowingStatus = Bool
type PointType47DailyMassFlowRate = Float
type PointType47HourlyMassFlowRate = Float
type PointType47MassFlowToday = Float
type PointType47MassFlowYesterday = Float
type PointType47MassFlowCurrentMonth = Float
type PointType47MassFlowPrvsMonth = Float
type PointType47MassFlowAccumLastReset = Float
type PointType47FlowCalcCFG = Word8
type PointType47FlowCalcAGA7PressMult = Float
type PointType47FlowCalcAGA7TempMult = Float
type PointType47FlowCalcAGA7CompMult = Float
type PointType47DescActiveFlowCalc = ByteString
type PointType47DescActivePropCalc = ByteString
type PointType47UpStrmFlowingTemp = Float
pointType47Parser :: Get PointType47
pointType47Parser = do
flowRatePerDay <- getIeeeFloat32
energyRatePerDay <- getIeeeFloat32
flowRatePerHour <- getIeeeFloat32
energyRatePerHour <- getIeeeFloat32
orPressExtLinMeterUncrtdFlow <- getIeeeFloat32
orExpFactorTbFpm <- getIeeeFloat32
orCdFT <- getIeeeFloat32
orFmTbFtm <- getIeeeFloat32
fpb <- getIeeeFloat32
ftb <- getIeeeFloat32
ftf <- getIeeeFloat32
fgr <- getIeeeFloat32
fpv <- getIeeeFloat32
zsCompStndCond <- getIeeeFloat32
zbCompBaseCond <- getIeeeFloat32
zf1CompFlowingCond <- getIeeeFloat32
orIntegMultValueTbBaseMultValue <- getIeeeFloat32
orPlateBoreDiamFlowingCond <- getIeeeFloat32
meterTubeIntDiamFlowingCond <- getIeeeFloat32
diamRatioBeta <- getIeeeFloat32
velocityOfApproachEV <- getIeeeFloat32
orAvghLinMeterTotalCountsLastBMP <- getIeeeFloat32
pfAvgFlowingPress <- getIeeeFloat32
tfAvgFlowingTemp <- getIeeeFloat32
flowingDensity <- getIeeeFloat32
baseDensity <- getIeeeFloat32
reynoldsNum <- getIeeeFloat32
upStrmStaticPress <- getIeeeFloat32
molecularWeight <- getIeeeFloat32
fam <- getIeeeFloat32
fwt <- getIeeeFloat32
fwl <- getIeeeFloat32
localGravCrctStaticPress <- getIeeeFloat32
localGravCrctDP <- getIeeeFloat32
fhgm <- getIeeeFloat32
fhgt <- getIeeeFloat32
flowToday <- getIeeeFloat32
flowYesterday <- getIeeeFloat32
flowMonth <- getIeeeFloat32
flowPrvsMonth <- getIeeeFloat32
flowAccum <- getIeeeFloat32
minutesToday <- getIeeeFloat32
minutesYesterday <- getIeeeFloat32
minutesMonth <- getIeeeFloat32
minutesPrvsMonth <- getIeeeFloat32
minutesAccum <- getIeeeFloat32
energyToday <- getIeeeFloat32
energyYesterday <- getIeeeFloat32
energyMonth <- getIeeeFloat32
energyPrvsMonth <- getIeeeFloat32
energyAccum <- getIeeeFloat32
uncrtdToday <- getIeeeFloat32
uncrtdYesterday <- getIeeeFloat32
uncrtdMonth <- getIeeeFloat32
uncrtdPrvsMonth <- getIeeeFloat32
uncrtdAccum <- getIeeeFloat32
partialRecalcFlag <- getWord8
redundantFlowRatePerDay <- getIeeeFloat32
redundantTotalCounts <- getIeeeFloat32
linMeterRawPulses <- getWord32le
meterFlowingStatus <- anyButNull
dailyMassFlowRate <- getIeeeFloat32
hourlyMassFlowRate <- getIeeeFloat32
massFlowToday <- getIeeeFloat32
massFlowYesterday <- getIeeeFloat32
massFlowCurrentMonth <- getIeeeFloat32
massFlowPrvsMonth <- getIeeeFloat32
massFlowAccumLastReset <- getIeeeFloat32
flowCalcCFG <- getWord8
flowCalcAGA7PressMult <- getIeeeFloat32
flowCalcAGA7TempMult <- getIeeeFloat32
flowCalcAGA7CompMult <- getIeeeFloat32
descActiveFlowCalc <- getByteString 20
descActivePropCalc <- getByteString 20
upStrmFlowingTemp <- getIeeeFloat32
return $ PointType47 flowRatePerDay energyRatePerDay flowRatePerHour energyRatePerHour orPressExtLinMeterUncrtdFlow orExpFactorTbFpm orCdFT orFmTbFtm fpb ftb ftf fgr fpv
zsCompStndCond zbCompBaseCond zf1CompFlowingCond orIntegMultValueTbBaseMultValue orPlateBoreDiamFlowingCond meterTubeIntDiamFlowingCond diamRatioBeta
velocityOfApproachEV orAvghLinMeterTotalCountsLastBMP pfAvgFlowingPress tfAvgFlowingTemp flowingDensity baseDensity reynoldsNum upStrmStaticPress
molecularWeight fam fwt fwl localGravCrctStaticPress localGravCrctDP fhgm fhgt flowToday flowYesterday flowMonth flowPrvsMonth flowAccum minutesToday
minutesYesterday minutesMonth minutesPrvsMonth minutesAccum energyToday energyYesterday energyMonth energyPrvsMonth energyAccum uncrtdToday uncrtdYesterday
uncrtdMonth uncrtdPrvsMonth uncrtdAccum partialRecalcFlag redundantFlowRatePerDay redundantTotalCounts linMeterRawPulses meterFlowingStatus dailyMassFlowRate
hourlyMassFlowRate massFlowToday massFlowYesterday massFlowCurrentMonth massFlowPrvsMonth massFlowAccumLastReset flowCalcCFG flowCalcAGA7PressMult
flowCalcAGA7TempMult flowCalcAGA7CompMult descActiveFlowCalc descActivePropCalc upStrmFlowingTemp
|
plow-technologies/roc-translator
|
src/Protocol/ROC/PointTypes/PointType47.hs
|
bsd-3-clause
| 16,325
| 0
| 9
| 5,766
| 1,803
| 992
| 811
| 404
| 1
|
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
-- |
-- Module : Data.Array.Accelerate.Trafo.Common
-- Copyright : [2012] Manuel M T Chakravarty, Gabriele Keller, Trevor L. McDonell
-- License : BSD3
--
-- Maintainer : Manuel M T Chakravarty <chak@cse.unsw.edu.au>
-- Stability : experimental
-- Portability : non-portable (GHC extensions)
--
module Data.Array.Accelerate.Trafo.Common (
-- Controlling optimisations
until,
-- Environments
Gamma(..), incExp, prjExp, lookupExp,
Delta(..), incAcc, prjAcc, lookupAcc,
) where
-- standard library
import Prelude hiding ( until )
-- friends
import Data.Array.Accelerate.AST
import Data.Array.Accelerate.Analysis.Match
import Data.Array.Accelerate.Trafo.Substitution
#include "accelerate.h"
-- Repeatedly evaluate a transformation until no changes are made, or an
-- iteration limit (10) is reached.
--
until :: forall f done. (f -> f -> Maybe done) -> (f -> f) -> f -> f
until stop go = fix 0
where
fix :: Int -> f -> f
fix !i !x | i < lIMIT, Nothing <- stop x x' = fix (i+1) x'
| otherwise = x'
where
!lIMIT = 10
!x' = go x
-- Environments
-- ------------
-- An environment that holds let-bound scalar expressions. The second
-- environment variable env' is used to project out the corresponding
-- index when looking up in the environment congruent expressions.
--
data Gamma env env' aenv where
EmptyExp :: Gamma env env' aenv
PushExp :: Gamma env env' aenv
-> OpenExp env aenv t
-> Gamma env (env', t) aenv
incExp :: Gamma env env' aenv -> Gamma (env, s) env' aenv
incExp EmptyExp = EmptyExp
incExp (PushExp env e) = incExp env `PushExp` weakenE e
prjExp :: Idx env' t -> Gamma env env' aenv -> OpenExp env aenv t
prjExp ZeroIdx (PushExp _ v) = v
prjExp (SuccIdx ix) (PushExp env _) = prjExp ix env
prjExp _ _ = INTERNAL_ERROR(error) "prjExp" "inconsistent valuation"
lookupExp :: Gamma env env' aenv -> OpenExp env aenv t -> Maybe (Idx env' t)
lookupExp EmptyExp _ = Nothing
lookupExp (PushExp env e) x
| Just REFL <- matchOpenExp e x = Just ZeroIdx
| otherwise = SuccIdx `fmap` lookupExp env x
-- An environment which holds let-bound array expressions.
--
data Delta aenv aenv' where
EmptyAcc :: Delta aenv aenv'
PushAcc :: Delta aenv aenv'
-> OpenAcc aenv a
-> Delta aenv (aenv', a)
incAcc :: Delta aenv aenv' -> Delta (aenv,s) aenv'
incAcc EmptyAcc = EmptyAcc
incAcc (PushAcc aenv a) = incAcc aenv `PushAcc` weakenA a
prjAcc :: Idx aenv' t -> Delta aenv aenv' -> OpenAcc aenv t
prjAcc ZeroIdx (PushAcc _ v) = v
prjAcc (SuccIdx ix) (PushAcc env _) = prjAcc ix env
prjAcc _ _ = INTERNAL_ERROR(error) "prjAcc" "inconsistent valuation"
lookupAcc :: Delta aenv aenv' -> OpenAcc aenv a -> Maybe (Idx aenv' a)
lookupAcc EmptyAcc _ = Nothing
lookupAcc (PushAcc aenv a) x
| Just REFL <- matchOpenAcc a x = Just ZeroIdx
| otherwise = SuccIdx `fmap` lookupAcc aenv x
|
robeverest/accelerate
|
Data/Array/Accelerate/Trafo/Common.hs
|
bsd-3-clause
| 3,421
| 0
| 11
| 983
| 896
| 473
| 423
| 55
| 1
|
module Main ( main ) where
import qualified Types.BotTypes as BT
import Control.Monad (forever)
import Data.Aeson (decode)
import qualified Data.Map as Map
import qualified Data.Text.Lazy.Encoding as T
import qualified Data.Text.Lazy.IO as T
import System.Environment (getArgs)
import System.Exit (ExitCode(ExitSuccess, ExitFailure))
import System.IO (stdout, stdin, hSetBuffering, BufferMode(..))
import System.Process (readProcessWithExitCode)
import Text.Regex.PCRE ((=~))
main :: IO ()
main = do
(nick:_) <- getArgs
hSetBuffering stdout LineBuffering
hSetBuffering stdin LineBuffering
forever $ do
line <- T.getLine
handleMessage nick $ (decode . T.encodeUtf8) line
handleMessage :: String -> Maybe BT.ServerMessage -> IO ()
handleMessage nick (Just (BT.ServerPrivMsg _ _ msg))
| str =~ helpPattern = help nick
| [[_, url]] <- str =~ runPattern1 = asciipicture url
| [[_, url]] <- str =~ runPattern2 = asciipicture url
| [[_, url]] <- str =~ runPattern3 = asciipicture url
| [[_, url]] <- str =~ runPattern4 = asciipicture url
where
str = BT.getMessage msg
helpPattern = concat ["^", sp, nick, ":", ps, "asciipicture", ps, "help",
sp, "$"]
runPattern1 = concat ["^", sp, "asciipicture:", ps, "(.*)$"]
runPattern2 = concat ["^", sp, "asciiart:", ps, "(.*)$"]
runPattern3 = concat ["^", sp, nick, ":", ps, "asciiart", ps, "(.*)$"]
runPattern4 = concat ["^", sp, nick, ":", ps, "asciipicture", ps, "(.*)$"]
sp = "[ \\t]*"
ps = "[ \\t]+"
handleMessage _ _ = return ()
asciipicture :: String -> IO ()
asciipicture picRef = case Map.lookup picRef buildIn of
Just url -> generatePicture url
Nothing -> generatePicture picRef
generatePicture :: String -> IO ()
generatePicture url = do
(e, s, _) <- readProcessWithExitCode "/usr/bin/jp2a"
[url, "--width=80", "--background=light"] []
case e of
ExitSuccess -> putStrLn s
ExitFailure _ -> return ()
help :: String -> IO ()
help nick = putStrLn $ unlines
[ nick ++ ": asciipicture help - show this message"
, "asciipicture: url - show asciipicture of jpg linked to"
]
buildIn :: Map.Map String String
buildIn = Map.fromList
[ ("dickbutt", "https://static1.fjcdn.com/thumbnails/comments/" ++
"Dickbut+for+everybody+zentertainments+gets+a+dickbut+_" ++
"fc88e4d586c873f470964fab580a9518.jpg")
, ("(y)", "http://clipartix.com/wp-content/uploads/2016/04/Thumbs-up" ++
"-clipart-cliparts-for-you.jpg")
, ("pepe", "https://ih1.redbubble.net/image.53530799.0943/" ++
"flat,800x800,070,f.jpg")
, ("wewlad", "http://vignette1.wikia.nocookie.net/trollpasta/images/e/" ++
"e6/Wew_lad.jpg")
, ("just right", "http://static3.depositphotos.com/1001914/142/i/950/" ++
"depositphotos_1429391-Hand-sign-ok.jpg")
]
|
bus000/Dikunt
|
plugins/AsciiPicture/Main.hs
|
bsd-3-clause
| 2,871
| 0
| 14
| 569
| 855
| 473
| 382
| 65
| 2
|
module Util.Safe
( runWithFiles
) where
import Pipes.Safe (runSafeT)
import Pipes.Safe.Prelude (withFile)
import Universum hiding (withFile)
runWithFile :: (MonadIO m, MonadMask m) => FilePath -> IOMode -> (Handle -> m r) -> m r
runWithFile fp mode f = runSafeT $ withFile fp mode $ lift . f
runWithFiles :: (MonadIO m, MonadMask m) => [(a, FilePath)] -> IOMode -> ([(a, Handle)]-> m r) -> m r
runWithFiles [] _ f = f []
runWithFiles ((a, fp) : xs) mode f = runWithFile fp mode $ \h ->
runWithFiles xs mode $ \ys -> f $ (a, h) : ys
|
input-output-hk/pos-haskell-prototype
|
tools/post-mortem/src/Util/Safe.hs
|
mit
| 594
| 0
| 12
| 162
| 264
| 143
| 121
| 11
| 1
|
module Test where
import Test.QuickCheck (Property, (==>))
import Submission (celsiusToFarenheit, nCopies, numEvens, numManyEvens)
import qualified Submission as Soln (celsiusToFarenheit, nCopies, numEvens, numManyEvens)
prop_celsius0 :: Bool
prop_celsius0 =
celsiusToFarenheit 0 == 32
prop_celsius37 :: Bool
prop_celsius37 =
celsiusToFarenheit 37 == 99
prop_nCopiesLength :: [Char] -> Int -> Property
prop_nCopiesLength s n =
n >= 0 ==> (length (nCopies s n) == (length s) * n)
prop_numEvensLength :: [Int] -> Bool
prop_numEvensLength nums =
numEvens nums <= length nums
-- | What do you think this property says?
prop_numManyEvensDoubled :: [[Int]] -> Bool
prop_numManyEvensDoubled listsOfNums =
let doubled = listsOfNums ++ listsOfNums
in
numManyEvens doubled == 2 * (numManyEvens listsOfNums)
prop_celsiusAgainstReference :: Float -> Bool
prop_celsiusAgainstReference x = celsiusToFarenheit x == Soln.celsiusToFarenheit x
prop_nCopiesAgainstReference :: [Char] -> Int -> Property
prop_nCopiesAgainstReference s x =
x >= 0 ==> nCopies s x == Soln.nCopies s x
prop_numEvensAgainstReference :: [Int] -> Bool
prop_numEvensAgainstReference x = numEvens x == Soln.numEvens x
prop_numManyEvensAgainstReference :: [[Int]] -> Bool
prop_numManyEvensAgainstReference x = numManyEvens x == Soln.numManyEvens x
-- main :: IO ()
-- main = do
-- quickCheck prop_celsius0
-- quickCheck prop_celsius37
-- quickCheck prop_nCopiesLength
-- quickCheck prop_numEvensLength
-- quickCheck prop_numManyEvensDoubled
-- quickCheck prop_celsiusAgainstReference
-- quickCheck prop_nCopiesAgainstReference
-- quickCheck prop_numEvensAgainstReference
-- quickCheck prop_numManyEvensAgainstReference
|
benjaminvialle/Markus
|
db/data/autotest_files/haskell/script_files/Test.hs
|
mit
| 1,745
| 0
| 11
| 277
| 395
| 216
| 179
| -1
| -1
|
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}
module Options.Cabal where
import qualified Data.Set as S
import Control.Monad.M
import qualified Data.List as L
import Control.Monad
import qualified Distribution.PackageDescription.Parse as C
import qualified Distribution.Package as C
import qualified Distribution.Version as C
import qualified Distribution.PackageDescription as C
import Data.String.Util
import Control.Monad.IO.Class
import Data.Function (on)
import Data.Maybe
toPkgName :: C.Dependency -> String
toPkgName (C.Dependency (C.PackageName name) _) = name
vintersection :: C.Dependency -> C.Dependency -> Bool
vintersection (C.Dependency _ lv) (C.Dependency _ rv) =
not $ C.intersectVersionRanges lv rv == C.noVersion
-- | Post-condition: no version overlap
nub' :: [C.Dependency] -> [C.Dependency]
nub' = L.nubBy (\l r -> toPkgName l == toPkgName r && vintersection l r)
fromExclusions :: S.Set String -> [C.Dependency] -> M [C.Dependency]
fromExclusions exclusions deps = do
-- Print packages which were intended to be excluded, but
-- weren't found anyway.
unless (S.null unfound_exclusions) $
warning
. listing
. ("packages to exclude were not found:":)
. map toString
. S.toList
$ excluded
-- Print version overlapped (removed packages) if any.
unless (L.null overlapped) $
warning $
("removed the following packages from processing due version"
++ " range overlap:\n") ++ (indenting 2 . listing $ overlapped)
return disjoint
where
excluded = S.intersection (S.fromList $ map toPkgName deps) exclusions
unfound_exclusions = S.difference exclusions excluded
unexcluded = L.filter (not . flip S.member excluded . toPkgName) deps
sorted = L.sortBy (on compare toPkgName) unexcluded -- for readability
disjoint = nub' sorted
-- | Calculate the packages with overlapped ranges
overlapped = sorted L.\\ disjoint
-- | Given the defined exclusion set, return a list with the
-- following properties:
-- 1 version overlap is not a relation for deps's taken as a set
-- 2 unversioned packageId's satisfy cabal constraints
readPackages :: FilePath -> S.Set String -> M [C.Dependency]
readPackages cabal_path exclusions = do
parse_result <- liftIO $ C.parsePackageDescription <$> readFile cabal_path
case parse_result of
(C.ParseFailed fail_msg) ->
err . show $ fail_msg
(C.ParseOk warnings desc) -> do
unless (L.null warnings) . warning $
preposition
"warnings during parse" "of" "cabal file" "warnings"
(map show warnings)
msg $ "parsing cabal file: " ++ cabal_path
fromExclusions exclusions . toDeps $ desc
where
toDeps :: C.GenericPackageDescription -> [C.Dependency]
toDeps gpd =
concatMap ($ gpd) [
concatDeps . maybeToList . C.condLibrary,
concatDeps . map snd . C.condExecutables,
concatDeps . map snd . C.condTestSuites,
concatDeps . map snd . C.condBenchmarks
]
where
concatDeps :: [C.CondTree v [C.Dependency] a] -> [C.Dependency]
concatDeps = concatMap C.condTreeConstraints
|
jfeltz/dash-haskell
|
src/Options/Cabal.hs
|
lgpl-3.0
| 3,255
| 0
| 17
| 748
| 821
| 435
| 386
| 64
| 2
|
module SwiftNav.SBP.Acquisition where
import Control.Monad
import Control.Monad.Loops
import Data.Binary
import Data.Binary.Get
import Data.Binary.IEEE754
import Data.Binary.Put
import Data.ByteString
import Data.ByteString.Lazy hiding ( ByteString )
import Data.Int
import Data.Word
msgAcqResult :: Word16
msgAcqResult = 0x0014
data MsgAcqResult = MsgAcqResult
{ msgAcqResultSnr :: Float
, msgAcqResultCp :: Float
, msgAcqResultCf :: Float
, msgAcqResultSid :: Word32
} deriving ( Show, Read, Eq )
instance Binary MsgAcqResult where
get = do
msgAcqResultSnr <- getFloat32le
msgAcqResultCp <- getFloat32le
msgAcqResultCf <- getFloat32le
msgAcqResultSid <- getWord32le
return MsgAcqResult {..}
put MsgAcqResult {..} = do
putFloat32le msgAcqResultSnr
putFloat32le msgAcqResultCp
putFloat32le msgAcqResultCf
putWord32le msgAcqResultSid
msgAcqResultDepA :: Word16
msgAcqResultDepA = 0x0015
data MsgAcqResultDepA = MsgAcqResultDepA
{ msgAcqResultDepASnr :: Float
, msgAcqResultDepACp :: Float
, msgAcqResultDepACf :: Float
, msgAcqResultDepAPrn :: Word8
} deriving ( Show, Read, Eq )
instance Binary MsgAcqResultDepA where
get = do
msgAcqResultDepASnr <- getFloat32le
msgAcqResultDepACp <- getFloat32le
msgAcqResultDepACf <- getFloat32le
msgAcqResultDepAPrn <- getWord8
return MsgAcqResultDepA {..}
put MsgAcqResultDepA {..} = do
putFloat32le msgAcqResultDepASnr
putFloat32le msgAcqResultDepACp
putFloat32le msgAcqResultDepACf
putWord8 msgAcqResultDepAPrn
|
hankaiwen/libsbp
|
haskell/src/SwiftNav/SBP/Acquisition.hs
|
lgpl-3.0
| 1,564
| 0
| 9
| 276
| 364
| 192
| 172
| -1
| -1
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 2.0//EN" "http://java.sun.com/products/javahelp/helpset_2_0.dtd">
<helpset version="2.0" xml:lang="el-GR">
<title>TLS Debug | ZAP Extension</title>
<maps>
<homeID>top</homeID>
<mapref location="map.jhm"/>
</maps>
<view>
<name>TOC</name>
<label>Contents</label>
<type>org.zaproxy.zap.extension.help.ZapTocView</type>
<data>toc.xml</data>
</view>
<view>
<name>Index</name>
<label>Index</label>
<type>javax.help.IndexView</type>
<data>index.xml</data>
</view>
<view>
<name>Search</name>
<label>Search</label>
<type>javax.help.SearchView</type>
<data engine="com.sun.java.help.search.DefaultSearchEngine">
JavaHelpSearch
</data>
</view>
<view>
<name>Favorites</name>
<label>Favorites</label>
<type>javax.help.FavoritesView</type>
</view>
</helpset>
|
veggiespam/zap-extensions
|
addOns/tlsdebug/src/main/javahelp/org/zaproxy/zap/extension/tlsdebug/resources/help_el_GR/helpset_el_GR.hs
|
apache-2.0
| 971
| 80
| 66
| 160
| 415
| 210
| 205
| -1
| -1
|
{-# LANGUAGE OverloadedStrings #-}
import Network.PushNotify.Mpns
import Text.XML
import Network
import Network.HTTP.Conduit
import qualified Data.HashSet as HS
main :: IO ()
main = send def
send :: MPNSmessage -> IO ()
send msg = withSocketsDo $ do
m <- newManagerMPNS def
res <- sendMPNS m def msg{
deviceURIs = HS.singleton "DeviceUri" -- here you complete with the device URI.
, restXML = parseText_ def "<?xml version=\"1.0\" encoding=\"utf-8\"?> <root> <value1> Hello World!! </value1> </root>"
}
print res
return ()
|
MarcosPividori/GSoC-push-notify
|
test/testMPNS/exampleMPNS.hs
|
mit
| 636
| 0
| 13
| 191
| 137
| 71
| 66
| 16
| 1
|
{-
Copyright (C) 2006-8 John MacFarlane <jgm@berkeley.edu>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-}
{- |
Module : Text.Pandoc.Writers.LaTeX
Copyright : Copyright (C) 2006-8 John MacFarlane
License : GNU GPL, version 2 or above
Maintainer : John MacFarlane <jgm@berkeley.edu>
Stability : alpha
Portability : portable
Conversion of 'Pandoc' format into LaTeX.
-}
module Text.Pandoc.Writers.LaTeX ( writeLaTeX ) where
import Text.Pandoc.Definition
import Text.Pandoc.Shared
import Text.Pandoc.Templates
import Text.Printf ( printf )
import Data.List ( (\\), isSuffixOf, isPrefixOf, intersperse )
import Data.Char ( toLower )
import Control.Monad.State
import Text.PrettyPrint.HughesPJ hiding ( Str )
data WriterState =
WriterState { stInNote :: Bool -- @True@ if we're in a note
, stOLLevel :: Int -- level of ordered list nesting
, stOptions :: WriterOptions -- writer options, so they don't have to be parameter
, stVerbInNote :: Bool -- true if document has verbatim text in note
, stEnumerate :: Bool -- true if document needs fancy enumerated lists
, stTable :: Bool -- true if document has a table
, stStrikeout :: Bool -- true if document has strikeout
, stSubscript :: Bool -- true if document has subscript
, stUrl :: Bool -- true if document has visible URL link
, stGraphics :: Bool -- true if document contains images
, stLHS :: Bool -- true if document has literate haskell code
, stBook :: Bool -- true if document uses book or memoir class
}
-- | Convert Pandoc to LaTeX.
writeLaTeX :: WriterOptions -> Pandoc -> String
writeLaTeX options document =
evalState (pandocToLaTeX options document) $
WriterState { stInNote = False, stOLLevel = 1, stOptions = options,
stVerbInNote = False, stEnumerate = False,
stTable = False, stStrikeout = False, stSubscript = False,
stUrl = False, stGraphics = False,
stLHS = False, stBook = False }
pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String
pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
let template = writerTemplate options
let usesBookClass x = "\\documentclass" `isPrefixOf` x &&
("{memoir}" `isSuffixOf` x || "{book}" `isSuffixOf` x ||
"{report}" `isSuffixOf` x)
when (any usesBookClass (lines template)) $
modify $ \s -> s{stBook = True}
titletext <- liftM render $ inlineListToLaTeX title
authorsText <- mapM (liftM render . inlineListToLaTeX) authors
dateText <- liftM render $ inlineListToLaTeX date
body <- blockListToLaTeX blocks
let main = render body
st <- get
let context = writerVariables options ++
[ ("toc", if writerTableOfContents options then "yes" else "")
, ("body", main)
, ("title", titletext)
, ("date", dateText) ] ++
[ ("author", a) | a <- authorsText ] ++
[ ("xetex", "yes") | writerXeTeX options ] ++
[ ("verbatim-in-note", "yes") | stVerbInNote st ] ++
[ ("fancy-enums", "yes") | stEnumerate st ] ++
[ ("tables", "yes") | stTable st ] ++
[ ("strikeout", "yes") | stStrikeout st ] ++
[ ("subscript", "yes") | stSubscript st ] ++
[ ("url", "yes") | stUrl st ] ++
[ ("numbersections", "yes") | writerNumberSections options ] ++
[ ("lhs", "yes") | stLHS st ] ++
[ ("graphics", "yes") | stGraphics st ]
return $ if writerStandalone options
then renderTemplate context template
else main
-- escape things as needed for LaTeX
stringToLaTeX :: String -> String
stringToLaTeX = escapeStringUsing latexEscapes
where latexEscapes = backslashEscapes "{}$%&_#" ++
[ ('^', "\\^{}")
, ('\\', "\\textbackslash{}")
, ('~', "\\ensuremath{\\sim}")
, ('|', "\\textbar{}")
, ('<', "\\textless{}")
, ('>', "\\textgreater{}")
, ('\160', "~")
]
-- | Puts contents into LaTeX command.
inCmd :: String -> Doc -> Doc
inCmd cmd contents = char '\\' <> text cmd <> braces contents
-- | Remove all code elements from list of inline elements
-- (because it's illegal to have verbatim inside some command arguments)
deVerb :: [Inline] -> [Inline]
deVerb [] = []
deVerb ((Code str):rest) =
(TeX $ "\\texttt{" ++ stringToLaTeX str ++ "}"):(deVerb rest)
deVerb (other:rest) = other:(deVerb rest)
-- | Convert Pandoc block element to LaTeX.
blockToLaTeX :: Block -- ^ Block to convert
-> State WriterState Doc
blockToLaTeX Null = return empty
blockToLaTeX (Plain lst) = do
st <- get
let opts = stOptions st
wrapTeXIfNeeded opts True inlineListToLaTeX lst
blockToLaTeX (Para [Image txt (src,tit)]) = do
capt <- inlineListToLaTeX txt
img <- inlineToLaTeX (Image txt (src,tit))
return $ text "\\begin{figure}[htb]" $$ text "\\centering" $$ img $$
(text "\\caption{" <> capt <> char '}') $$ text "\\end{figure}\n"
blockToLaTeX (Para lst) = do
st <- get
let opts = stOptions st
result <- wrapTeXIfNeeded opts True inlineListToLaTeX lst
return $ result <> char '\n'
blockToLaTeX (BlockQuote lst) = do
contents <- blockListToLaTeX lst
return $ text "\\begin{quote}" $$ contents $$ text "\\end{quote}"
blockToLaTeX (CodeBlock (_,classes,_) str) = do
st <- get
env <- if writerLiterateHaskell (stOptions st) && "haskell" `elem` classes &&
"literate" `elem` classes
then do
modify $ \s -> s{ stLHS = True }
return "code"
else if stInNote st
then do
modify $ \s -> s{ stVerbInNote = True }
return "Verbatim"
else return "verbatim"
return $ text ("\\begin{" ++ env ++ "}\n") <> text str <>
text ("\n\\end{" ++ env ++ "}")
blockToLaTeX (RawHtml _) = return empty
blockToLaTeX (BulletList lst) = do
items <- mapM listItemToLaTeX lst
return $ text "\\begin{itemize}" $$ vcat items $$ text "\\end{itemize}"
blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do
st <- get
let oldlevel = stOLLevel st
put $ st {stOLLevel = oldlevel + 1}
items <- mapM listItemToLaTeX lst
modify (\s -> s {stOLLevel = oldlevel})
exemplar <- if numstyle /= DefaultStyle || numdelim /= DefaultDelim
then do
modify $ \s -> s{ stEnumerate = True }
return $ char '[' <>
text (head (orderedListMarkers (1, numstyle,
numdelim))) <> char ']'
else return empty
let resetcounter = if start /= 1 && oldlevel <= 4
then text $ "\\setcounter{enum" ++
map toLower (toRomanNumeral oldlevel) ++
"}{" ++ show (start - 1) ++ "}"
else empty
return $ text "\\begin{enumerate}" <> exemplar $$ resetcounter $$
vcat items $$ text "\\end{enumerate}"
blockToLaTeX (DefinitionList lst) = do
items <- mapM defListItemToLaTeX lst
return $ text "\\begin{description}" $$ vcat items $$
text "\\end{description}"
blockToLaTeX HorizontalRule = return $ text $
"\\begin{center}\\rule{3in}{0.4pt}\\end{center}\n"
blockToLaTeX (Header level lst) = do
let lst' = deVerb lst
txt <- inlineListToLaTeX lst'
let noNote (Note _) = Str ""
noNote x = x
let lstNoNotes = processWith noNote lst'
-- footnotes in sections don't work unless you specify an optional
-- argument: \section[mysec]{mysec\footnote{blah}}
optional <- if lstNoNotes == lst'
then return empty
else do
res <- inlineListToLaTeX lstNoNotes
return $ char '[' <> res <> char ']'
let stuffing = optional <> char '{' <> txt <> char '}'
book <- liftM stBook get
return $ case (book, level) of
(True, 1) -> text "\\chapter" <> stuffing <> char '\n'
(True, 2) -> text "\\section" <> stuffing <> char '\n'
(True, 3) -> text "\\subsection" <> stuffing <> char '\n'
(True, 4) -> text "\\subsubsection" <> stuffing <> char '\n'
(False, 1) -> text "\\section" <> stuffing <> char '\n'
(False, 2) -> text "\\subsection" <> stuffing <> char '\n'
(False, 3) -> text "\\subsubsection" <> stuffing <> char '\n'
_ -> txt <> char '\n'
blockToLaTeX (Table caption aligns widths heads rows) = do
headers <- if all null heads
then return empty
else liftM ($$ text "\\hline") $ tableRowToLaTeX heads
captionText <- inlineListToLaTeX caption
rows' <- mapM tableRowToLaTeX rows
let colDescriptors = concat $ zipWith toColDescriptor widths aligns
let tableBody = text ("\\begin{tabular}{" ++ colDescriptors ++ "}") $$
headers $$ vcat rows' $$ text "\\end{tabular}"
let centered txt = text "\\begin{center}" $$ txt $$ text "\\end{center}"
modify $ \s -> s{ stTable = True }
return $ if isEmpty captionText
then centered tableBody <> char '\n'
else text "\\begin{table}[h]" $$ centered tableBody $$
inCmd "caption" captionText $$ text "\\end{table}\n"
toColDescriptor :: Double -> Alignment -> String
toColDescriptor 0 align =
case align of
AlignLeft -> "l"
AlignRight -> "r"
AlignCenter -> "c"
AlignDefault -> "l"
toColDescriptor width align = ">{\\PBS" ++
(case align of
AlignLeft -> "\\raggedright"
AlignRight -> "\\raggedleft"
AlignCenter -> "\\centering"
AlignDefault -> "\\raggedright") ++
"\\hspace{0pt}}p{" ++ printf "%.2f" width ++
"\\columnwidth}"
blockListToLaTeX :: [Block] -> State WriterState Doc
blockListToLaTeX lst = mapM blockToLaTeX lst >>= return . vcat
tableRowToLaTeX :: [[Block]] -> State WriterState Doc
tableRowToLaTeX cols = mapM blockListToLaTeX cols >>=
return . ($$ text "\\\\") . foldl (\row item -> row $$
(if isEmpty row then text "" else text " & ") <> item) empty
listItemToLaTeX :: [Block] -> State WriterState Doc
listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) .
(nest 2)
defListItemToLaTeX :: ([Inline], [[Block]]) -> State WriterState Doc
defListItemToLaTeX (term, defs) = do
term' <- inlineListToLaTeX $ deVerb term
def' <- liftM (vcat . intersperse (text "")) $ mapM blockListToLaTeX defs
return $ text "\\item[" <> term' <> text "]" $$ def'
-- | Convert list of inline elements to LaTeX.
inlineListToLaTeX :: [Inline] -- ^ Inlines to convert
-> State WriterState Doc
inlineListToLaTeX lst = mapM inlineToLaTeX lst >>= return . hcat
isQuoted :: Inline -> Bool
isQuoted (Quoted _ _) = True
isQuoted Apostrophe = True
isQuoted _ = False
-- | Convert inline element to LaTeX
inlineToLaTeX :: Inline -- ^ Inline to convert
-> State WriterState Doc
inlineToLaTeX (Emph lst) =
inlineListToLaTeX (deVerb lst) >>= return . inCmd "emph"
inlineToLaTeX (Strong lst) =
inlineListToLaTeX (deVerb lst) >>= return . inCmd "textbf"
inlineToLaTeX (Strikeout lst) = do
contents <- inlineListToLaTeX $ deVerb lst
modify $ \s -> s{ stStrikeout = True }
return $ inCmd "sout" contents
inlineToLaTeX (Superscript lst) =
inlineListToLaTeX (deVerb lst) >>= return . inCmd "textsuperscript"
inlineToLaTeX (Subscript lst) = do
modify $ \s -> s{ stSubscript = True }
contents <- inlineListToLaTeX $ deVerb lst
-- oddly, latex includes \textsuperscript but not \textsubscript
-- so we have to define it (using a different name so as not to conflict with memoir class):
return $ inCmd "textsubscr" contents
inlineToLaTeX (SmallCaps lst) =
inlineListToLaTeX (deVerb lst) >>= return . inCmd "textsc"
inlineToLaTeX (Cite _ lst) =
inlineListToLaTeX lst
inlineToLaTeX (Code str) = do
st <- get
when (stInNote st) $ modify $ \s -> s{ stVerbInNote = True }
let chr = ((enumFromTo '!' '~') \\ str) !! 0
return $ text $ "\\verb" ++ [chr] ++ str ++ [chr]
inlineToLaTeX (Quoted SingleQuote lst) = do
contents <- inlineListToLaTeX lst
let s1 = if (not (null lst)) && (isQuoted (head lst))
then text "\\,"
else empty
let s2 = if (not (null lst)) && (isQuoted (last lst))
then text "\\,"
else empty
return $ char '`' <> s1 <> contents <> s2 <> char '\''
inlineToLaTeX (Quoted DoubleQuote lst) = do
contents <- inlineListToLaTeX lst
let s1 = if (not (null lst)) && (isQuoted (head lst))
then text "\\,"
else empty
let s2 = if (not (null lst)) && (isQuoted (last lst))
then text "\\,"
else empty
return $ text "``" <> s1 <> contents <> s2 <> text "''"
inlineToLaTeX Apostrophe = return $ char '\''
inlineToLaTeX EmDash = return $ text "---"
inlineToLaTeX EnDash = return $ text "--"
inlineToLaTeX Ellipses = return $ text "\\ldots{}"
inlineToLaTeX (Str str) = return $ text $ stringToLaTeX str
inlineToLaTeX (Math InlineMath str) = return $ char '$' <> text str <> char '$'
inlineToLaTeX (Math DisplayMath str) = return $ text "\\[" <> text str <> text "\\]"
inlineToLaTeX (TeX str) = return $ text str
inlineToLaTeX (HtmlInline _) = return empty
inlineToLaTeX (LineBreak) = return $ text "\\\\"
inlineToLaTeX Space = return $ char ' '
inlineToLaTeX (Link txt (src, _)) =
case txt of
[Code x] | x == src -> -- autolink
do modify $ \s -> s{ stUrl = True }
return $ text $ "\\url{" ++ x ++ "}"
_ -> do contents <- inlineListToLaTeX $ deVerb txt
return $ text ("\\href{" ++ src ++ "}{") <> contents <>
char '}'
inlineToLaTeX (Image _ (source, _)) = do
modify $ \s -> s{ stGraphics = True }
return $ text $ "\\includegraphics{" ++ source ++ "}"
inlineToLaTeX (Note contents) = do
st <- get
put (st {stInNote = True})
contents' <- blockListToLaTeX contents
modify (\s -> s {stInNote = False})
let rawnote = stripTrailingNewlines $ render contents'
-- note: a \n before } is needed when note ends with a Verbatim environment
let optNewline = "\\end{Verbatim}" `isSuffixOf` rawnote
return $ text "\\footnote{" <>
text rawnote <> (if optNewline then char '\n' else empty) <> char '}'
|
khajavi/pandoc
|
src/Text/Pandoc/Writers/LaTeX.hs
|
gpl-2.0
| 15,592
| 0
| 25
| 4,461
| 4,395
| 2,224
| 2,171
| 291
| 16
|
module M1 (g) where
import M
f :: T -> Int
f (C1 x y) = x + y
g = f (C1 1 2)
l = k
|
SAdams601/HaRe
|
old/testing/removeCon/M1.hs
|
bsd-3-clause
| 89
| 0
| 7
| 34
| 62
| 34
| 28
| 6
| 1
|
-----------------------------------------------------------------------------
-- |
-- Module : Window
-- Copyright : (c) 2011-15 Jose A. Ortega Ruiz
-- : (c) 2012 Jochen Keil
-- License : BSD-style (see LICENSE)
--
-- Maintainer : Jose A. Ortega Ruiz <jao@gnu.org>
-- Stability : unstable
-- Portability : unportable
--
-- Window manipulation functions
--
-----------------------------------------------------------------------------
module Window where
import Prelude
import Control.Applicative ((<$>))
import Control.Monad (when, unless)
import Graphics.X11.Xlib hiding (textExtents, textWidth)
import Graphics.X11.Xlib.Extras
import Graphics.X11.Xinerama
import Foreign.C.Types (CLong)
import Data.Function (on)
import Data.List (maximumBy)
import Data.Maybe (fromMaybe)
import System.Posix.Process (getProcessID)
import Config
import XUtil
-- $window
-- | The function to create the initial window
createWin :: Display -> XFont -> Config -> IO (Rectangle,Window)
createWin d fs c = do
let dflt = defaultScreen d
srs <- getScreenInfo d
rootw <- rootWindow d dflt
(as,ds) <- textExtents fs "0"
let ht = as + ds + 4
r = setPosition c (position c) srs (fi ht)
win <- newWindow d (defaultScreenOfDisplay d) rootw r (overrideRedirect c)
setProperties c d win
setStruts r c d win srs
when (lowerOnStart c) $ lowerWindow d win
unless (hideOnStart c) $ showWindow r c d win
return (r,win)
-- | Updates the size and position of the window
repositionWin :: Display -> Window -> XFont -> Config -> IO Rectangle
repositionWin d win fs c = do
srs <- getScreenInfo d
(as,ds) <- textExtents fs "0"
let ht = as + ds + 4
r = setPosition c (position c) srs (fi ht)
moveResizeWindow d win (rect_x r) (rect_y r) (rect_width r) (rect_height r)
setStruts r c d win srs
return r
setPosition :: Config -> XPosition -> [Rectangle] -> Dimension -> Rectangle
setPosition c p rs ht =
case p' of
Top -> Rectangle rx ry rw h
TopP l r -> Rectangle (rx + fi l) ry (rw - fi l - fi r) h
TopW a i -> Rectangle (ax a i) ry (nw i) h
TopSize a i ch -> Rectangle (ax a i) ry (nw i) (mh ch)
Bottom -> Rectangle rx ny rw h
BottomW a i -> Rectangle (ax a i) ny (nw i) h
BottomP l r -> Rectangle (rx + fi l) ny (rw - fi l - fi r) h
BottomSize a i ch -> Rectangle (ax a i) (ny' ch) (nw i) (mh ch)
Static cx cy cw ch -> Rectangle (fi cx) (fi cy) (fi cw) (fi ch)
OnScreen _ p'' -> setPosition c p'' [scr] ht
where
(scr@(Rectangle rx ry rw rh), p') =
case p of OnScreen i x -> (fromMaybe (picker rs) $ safeIndex i rs, x)
_ -> (picker rs, p)
ny = ry + fi (rh - ht)
center i = rx + fi (div (remwid i) 2)
right i = rx + fi (remwid i)
remwid i = rw - pw (fi i)
ax L = const rx
ax R = right
ax C = center
pw i = rw * min 100 i `div` 100
nw = fi . pw . fi
h = fi ht
mh h' = max (fi h') h
ny' h' = ry + fi (rh - mh h')
safeIndex i = lookup i . zip [0..]
picker = if pickBroadest c
then maximumBy (compare `on` rect_width)
else head
setProperties :: Config -> Display -> Window -> IO ()
setProperties c d w = do
let mkatom n = internAtom d n False
card <- mkatom "CARDINAL"
atom <- mkatom "ATOM"
setTextProperty d w "xmobar" wM_CLASS
setTextProperty d w "xmobar" wM_NAME
wtype <- mkatom "_NET_WM_WINDOW_TYPE"
dock <- mkatom "_NET_WM_WINDOW_TYPE_DOCK"
changeProperty32 d w wtype atom propModeReplace [fi dock]
when (allDesktops c) $ do
desktop <- mkatom "_NET_WM_DESKTOP"
changeProperty32 d w desktop card propModeReplace [0xffffffff]
pid <- mkatom "_NET_WM_PID"
getProcessID >>= changeProperty32 d w pid card propModeReplace . return . fi
setStruts' :: Display -> Window -> [Foreign.C.Types.CLong] -> IO ()
setStruts' d w svs = do
let mkatom n = internAtom d n False
card <- mkatom "CARDINAL"
pstrut <- mkatom "_NET_WM_STRUT_PARTIAL"
strut <- mkatom "_NET_WM_STRUT"
changeProperty32 d w pstrut card propModeReplace svs
changeProperty32 d w strut card propModeReplace (take 4 svs)
setStruts :: Rectangle -> Config -> Display -> Window -> [Rectangle] -> IO ()
setStruts r c d w rs = do
let svs = map fi $ getStrutValues r (position c) (getRootWindowHeight rs)
setStruts' d w svs
getRootWindowHeight :: [Rectangle] -> Int
getRootWindowHeight srs = maximum (map getMaxScreenYCoord srs)
where
getMaxScreenYCoord sr = fi (rect_y sr) + fi (rect_height sr)
getStrutValues :: Rectangle -> XPosition -> Int -> [Int]
getStrutValues r@(Rectangle x y w h) p rwh =
case p of
OnScreen _ p' -> getStrutValues r p' rwh
Top -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopP _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopW _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopSize {} -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
Bottom -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomP _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomW _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomSize {} -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
Static {} -> getStaticStrutValues p rwh
where st = fi y + fi h
sb = rwh - fi y
nx = fi x
nw = fi (x + fi w - 1)
-- get some reaonable strut values for static placement.
getStaticStrutValues :: XPosition -> Int -> [Int]
getStaticStrutValues (Static cx cy cw ch) rwh
-- if the yPos is in the top half of the screen, then assume a Top
-- placement, otherwise, it's a Bottom placement
| cy < (rwh `div` 2) = [0, 0, st, 0, 0, 0, 0, 0, xs, xe, 0, 0]
| otherwise = [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, xs, xe]
where st = cy + ch
sb = rwh - cy
xs = cx -- a simple calculation for horizontal (x) placement
xe = xs + cw
getStaticStrutValues _ _ = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
drawBorder :: Border -> Int -> Display -> Drawable -> GC -> Pixel
-> Dimension -> Dimension -> IO ()
drawBorder b lw d p gc c wi ht = case b of
NoBorder -> return ()
TopB -> drawBorder (TopBM 0) lw d p gc c wi ht
BottomB -> drawBorder (BottomBM 0) lw d p gc c wi ht
FullB -> drawBorder (FullBM 0) lw d p gc c wi ht
TopBM m -> sf >> sla >>
drawLine d p gc 0 (fi m + boff) (fi wi) (fi m + boff)
BottomBM m -> let rw = fi ht - fi m + boff in
sf >> sla >> drawLine d p gc 0 rw (fi wi) rw
FullBM m -> let mp = fi m
pad = 2 * fi mp + fi lw
in sf >> sla >>
drawRectangle d p gc mp mp (wi - pad + 1) (ht - pad)
where sf = setForeground d gc c
sla = setLineAttributes d gc (fi lw) lineSolid capNotLast joinMiter
boff = borderOffset b lw
-- boff' = calcBorderOffset lw :: Int
hideWindow :: Display -> Window -> IO ()
hideWindow d w = do
setStruts' d w (replicate 12 0)
unmapWindow d w >> sync d False
showWindow :: Rectangle -> Config -> Display -> Window -> IO ()
showWindow r c d w = do
mapWindow d w
getScreenInfo d >>= setStruts r c d w
sync d False
isMapped :: Display -> Window -> IO Bool
isMapped d w = ism <$> getWindowAttributes d w
where ism (WindowAttributes { wa_map_state = wms }) = wms /= waIsUnmapped
borderOffset :: (Integral a) => Border -> Int -> a
borderOffset b lw =
case b of
BottomB -> negate boffs
BottomBM _ -> negate boffs
TopB -> boffs
TopBM _ -> boffs
_ -> 0
where boffs = calcBorderOffset lw
calcBorderOffset :: (Integral a) => Int -> a
calcBorderOffset = ceiling . (/2) . toDouble
where toDouble = fi :: (Integral a) => a -> Double
|
dsalisbury/xmobar
|
src/Window.hs
|
bsd-3-clause
| 7,751
| 0
| 14
| 2,158
| 3,281
| 1,685
| 1,596
| 167
| 14
|
module If where
-- what's a reasonable type to give to `if_` so that we can verify `bog` ?
{-@ type TT = {v: Bool | (Prop v)} @-}
{-@ type FF = {v: Bool | not (Prop v)} @-}
{-@ if_ :: b:Bool -> x:a -> y:a -> a @-}
if_ :: Bool -> a -> a -> a
if_ True x _ = x
if_ False _ y = y
{-@ bog :: Nat @-}
bog :: Int
bog =
let b = (0 < 1) -- :: TT
xs = [1 , 2, 3] -- :: [Nat]
ys = [-1, -2, -3] -- :: [Int]
zs = if_ b xs ys -- :: [Nat]
in
case xs of
h:_ -> h
_ -> 0
|
mightymoose/liquidhaskell
|
tests/todo/if.hs
|
bsd-3-clause
| 527
| 0
| 10
| 200
| 148
| 85
| 63
| 13
| 2
|
{-# LANGUAGE MagicHash #-}
module Main where
import GHC.Exts
go :: () -> Int#
go () = 0#
main = print (lazy (I# (go $ ())))
|
urbanslug/ghc
|
testsuite/tests/typecheck/should_run/T8739.hs
|
bsd-3-clause
| 128
| 0
| 12
| 30
| 60
| 33
| 27
| 6
| 1
|
module Examples.Print where
import Types
import Statements
import BasicPrelude
import qualified Data.Map.Lazy as M
zero :: Value
zero = Value $ NumberConst (0 :: Int)
one :: Value
one = Value $ NumberConst (1 :: Int)
textStore :: M.Map Text Value
textStore = M.fromList [("n", Value $ SquanchyString ("25" :: Text))]
textTest :: Prog
textTest = Seq [Print (Value $ (SquanchyVar "n" :: Expr Text))]
boolStore :: M.Map Text Value
boolStore = M.fromList [("n", Value $ BoolConst (True :: Bool))]
boolTest :: Prog
boolTest = Seq [Print (Value $ (SquanchyVar "n" :: Expr Bool))]
intStore :: M.Map Text Value
intStore = M.fromList [("n", Value $ NumberConst (1 :: Int))]
intTest :: Prog
intTest = Seq [Print (Value $ (SquanchyVar "n" :: Expr Int))]
floatStore :: M.Map Text Value
floatStore = M.fromList [("n", Value $ NumberConst (1 :: Float))]
floatTest :: Prog
floatTest = Seq [Print (Value $ (SquanchyVar "n" :: Expr Float))]
|
mlitchard/squanchy
|
src/Examples/Print.hs
|
isc
| 936
| 0
| 11
| 164
| 398
| 219
| 179
| 25
| 1
|
-------------------------------------------------------------
--
-- 篩系
--
-- Module : MyModule.Sieve
-- Coding : Little Schemer
--
-------------------------------------------------------------
module MyModule.Sieve where
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import Control.Monad.ST
import Control.Monad
import Data.List
--
-- エラトステネスの篩による素数リスト
--
-- + ex : primeList 20 => [2,3,5,7,11,13,17,19]
--
primeList :: Int -> [Int]
primeList n = 2 : (map indexToValue $ U.toList $ U.elemIndices True $ sieve)
where
indexToValue i = 2 * i + 3
valueToIndex v = div (v - 3) 2
lastIndex = valueToIndex n
sieve = runST $ do
mVec <- UM.replicate (lastIndex + 1) True
forM_ [0 .. valueToIndex (floor $ sqrt $ fromIntegral n)] $ \i -> do
v <- UM.unsafeRead mVec i
when v $ do
let (s, d) = (2 * i * (i + 3) + 3, indexToValue i)
forM_ [s, s + d .. lastIndex] $ \j -> do
UM.unsafeWrite mVec j False
U.unsafeFreeze mVec
--
-- 1 〜 n までの約数のリスト
--
-- + ex : divisorsList 5 => [[1],[1,2],[1,3],[1,2,4],[1,5]]
--
divisorsList :: Int -> [[Int]]
divisorsList n = tail $ V.toList $ sieve
where
sieve = runST $ do
mVec <- VM.replicate (n + 1) []
forM_ [n, n - 1 .. 1] $ \i -> do
forM_ [i, i + i .. n] $ \j -> do
lst <- VM.unsafeRead mVec j
VM.unsafeWrite mVec j (i : lst)
V.unsafeFreeze mVec
--
-- 1 〜 n までの素因数分解のリスト
--
-- ex : factorsList' 5 => [[],[2],[3],[2,2],[5]]
-- ex : factorsList 5 => [[],[(2,1)],[(3,1)],[(2,2)],[(5,1)]]
--
factorsList :: Int -> [[(Int, Int)]]
factorsList n = map f $ factorsList' n
where f xs = [(p, length ps) | ps@(p : _) <- group xs]
factorsList' :: Int -> [[Int]]
factorsList' n = tail $ map reverse $ V.toList $ sieve
where
sieve = runST $ do
vec <- VM.replicate (n + 1) []
forM_ [2 .. n] $ \i -> do
v <- VM.unsafeRead vec i
when (null v) $ do
forM_ (takeWhile (<= n) $ iterate (* i) i) $ \j -> do
forM_ [j, 2 * j .. n] $ \k -> do
ps <- VM.unsafeRead vec k
VM.unsafeWrite vec k (i : ps)
V.unsafeFreeze vec
--
-- 1 〜 n までのオイラーのφ関数のリスト
--
-- ex : phiList 10 => [1,1,2,2,4,2,6,4,6,4]
--
phiList :: Int -> [Int]
phiList n = map f $ factorsList n
where f xs = product [p^(i - 1) * (p - 1) | (p, i) <- xs]
|
little-schemer/MyModule
|
Sieve.hs
|
mit
| 2,644
| 0
| 27
| 713
| 926
| 494
| 432
| 49
| 1
|
module Parser where
import Text.Parsec
import Text.Parsec.String
import Control.Monad (void)
import Arith
boolTrue :: Parser Term
boolTrue = do
void $ string "T" <* spaces
return TmTrue
boolFalse :: Parser Term
boolFalse = do
void $ string "F" <* spaces
return TmFalse
ifThen :: Parser Term
ifThen = do
void $ string "if" <* spaces
b <- expr
void $ spaces *> string "then" <* spaces
t1 <- expr
void $ spaces *> string "else" <* spaces
t2 <- expr
return $ TmIf b t1 t2
succ' :: Parser Term
succ' = do
void $ string "S" <* spaces
t1 <- expr
return $ TmSucc t1
isZero :: Parser Term
isZero = do
void $ string "Z?" <* spaces
t1 <- expr
return $ TmIsZero t1
zero :: Parser Term
zero = do
void $ string "Z" <* spaces
return TmZero
expr :: Parser Term
expr = try boolFalse
<|> try boolTrue
<|> ifThen
<|> succ'
<|> try isZero
<|> zero
modl :: Parser [Term]
modl = many expr
contents :: Parser a -> Parser a
contents p = do
r <- p
eof
return r
parseProgram :: SourceName -> String -> Either ParseError [Term]
parseProgram = parse (contents modl)
|
kellino/TypeSystems
|
arith/Parser.hs
|
mit
| 1,155
| 0
| 10
| 317
| 448
| 212
| 236
| 52
| 1
|
myLength :: [a] -> Int
myLength (x:xs) = 1 + myLength xs
myLength [] = 0
main = do
print $ myLength [123, 456, 789]
print $ myLength "Hello, world!"
|
veeenu/ninetynine-haskell-problems
|
src/problem04.hs
|
mit
| 162
| 0
| 9
| 43
| 79
| 40
| 39
| 6
| 1
|
module Data.Smashy.Types where
import Data.Vector.Storable.Mutable (IOVector)
import Data.Word (Word8, Word32, Word64)
import Data.Smashy.Constants
data PositionInfo = KeyFoundAt Word32
| KeyValueFoundAt Word32
| SameSizeDifferentValue Word32 Word32 Word32
| DifferentSize Word32 Word32 Word32
| FreeAt Word32
| HashTableFull
| TermListFull
| ValueListFull deriving Show
data HashMap a b = HashMap {getMapLocation :: Location,
getMapHash :: HashTable Word64,
getMapKeys :: TermList a,
getMapValues :: TermList b}
data HashSet a = HashSet {getSetLocation :: Location,
getSetHash :: HashTable Word32,
getSetTerms :: TermList a}
data HashTable a = HashTable {getHashSize :: Word32,
getHashData :: IOVector a,
getHashSpace :: Int}
data TermList a = TermList {getPosition :: Position,
getSize :: Int,
getData :: IOVector Word8,
getSpace :: Int}
type Position = Int
data Location = Ram
| Disk FilePath
| Hybrid FilePath deriving Show
data DataLocation = InRam
| OnDisk FilePath deriving (Read, Show)
decrTableSpace :: HashTable a -> HashTable a
decrTableSpace (HashTable hashSize hashData hashSpace)
= HashTable hashSize hashData (hashSpace - 1)
advanceTo :: TermList a -> Position -> TermList a
advanceTo (TermList termPos termSize termData termSpace) termPos'
= TermList termPos' termSize termData (termSpace - (termPos' - termPos))
getHashLocation :: Location -> DataLocation
getHashLocation Ram = InRam
getHashLocation (Hybrid _) = InRam
getHashLocation (Disk fp) = OnDisk (fp ++ hashFileName)
getKeysLocation :: Location -> DataLocation
getKeysLocation Ram = InRam
getKeysLocation (Hybrid fp) = OnDisk (fp ++ keyFileName)
getKeysLocation (Disk fp) = OnDisk (fp ++ keyFileName)
getValsLocation :: Location -> DataLocation
getValsLocation Ram = InRam
getValsLocation (Hybrid fp) = OnDisk (fp ++ valFileName)
getValsLocation (Disk fp) = OnDisk (fp ++ valFileName)
getBasePath :: Location -> Maybe FilePath
getBasePath loc = case loc of
Ram -> Nothing
Disk fp -> Just fp
Hybrid fp -> Just fp
data TermComparison = Matched
| SSDV
| DS deriving Show
|
jahaynes/smashy
|
src/Data/Smashy/Types.hs
|
mit
| 2,764
| 0
| 9
| 1,011
| 651
| 357
| 294
| 58
| 3
|
module Nanc.AST.ConstantExpression where
import Debug.Trace
import Data.Word
import Language.C
intValue :: CExpr -> Word64
intValue (CConst (CIntConst i _)) = fromIntegral $ getCInteger i
intValue expr = trace ("Unknown ConstantIntExpression: " ++ (show expr)) undefined
|
tinco/nanc
|
Nanc/AST/ConstantExpression.hs
|
mit
| 274
| 0
| 9
| 38
| 86
| 46
| 40
| 7
| 1
|
#!/usr/bin/env stack
-- stack --install-ghc runghc --package turtle
{-# LANGUAGE OverloadedStrings #-}
import Turtle
main = do
let cmd = "false"
x <- shell cmd empty
case x of
ExitSuccess -> return ()
ExitFailure n -> die (cmd <> " failed with exit code: " <> repr n)
|
JoshuaGross/haskell-learning-log
|
Code/turtle/shellcase.hs
|
mit
| 311
| 0
| 13
| 91
| 77
| 37
| 40
| 8
| 2
|
module Comparisons.Fauxter where
import Control.Category hiding ((>>>), (<<<))
import Control.Applicative
import Prelude hiding ((.), id)
import Melchior.Control
import Melchior.Data.String
import Melchior.Dom
import Melchior.Dom.Events
import Melchior.Dom.Html
import Melchior.Dom.Selectors
import Melchior.Remote.Json
import Melchior.Remote.XHR
import Melchior.Sink
import Melchior.Time
main :: IO ()
main = runDom setupFauxter
setupFauxter :: [Element] -> Dom ()
setupFauxter html = do
initialiseTabs html
container <- Dom $ assuredly $ select (byId "container" . from) html
append container (request GET "/next" $ every second :: Signal Fauxt)
initialiseTabs html = do
links <- Dom $ select (byClass "link" . from) html
clicks <- sequence $ clickListener "innerHTML" <$> links
sequence $ (\click -> return $ (rmClassFromParentSiblings >>> addClassTo >>> (hideSiblings &&& showCurrent)) click) <$> clicks
data Fauxt = Fauxt { author :: String, body :: String }
instance JsonSerialisable Fauxt where
fromJson Nothing = Fauxt "" ""
fromJson (Just x) = Fauxt (def $ getJsonString "author" x) (def $ getJsonString "body" x)
where def Nothing = ""
def (Just x) = x
instance Renderable Fauxt where
render x = stringToJSString $ "<div class='row-fluid marketing'><h4>"++(author x)++"</h4><p>"++(body x)++"</p></div>"
addClassTo :: SF (IO JSString) (IO JSString)
addClassTo s = addSingle <$> s
where addSingle = (\x -> do { cls <- x; elems <- select ((byClass $ jsStringToString cls) . from) root;
return $ map (\y -> addClass "active" $ parentOf y) elems; return cls })
rmClassFromParentSiblings :: Signal (JSString) -> Signal (IO JSString)
rmClassFromParentSiblings s = rmSingle <$> s
where rmSingle = (\x -> do { elems <- select ((byClass $ jsStringToString x) . from) root;
return $ map (\y -> (removeClass "active") y ) $ concatMap (\x -> siblings $ parentOf x) elems; return x })
clickListener s e = createEventedSignalOf (Of $ stringToJSString "jsstring") e (MouseEvt ClickEvt) s
applyById op s = (\x -> x >>= \idS -> op <$> select ((byId $ jsStringToString idS) . from) root) <$> s
hideSiblings = applyById (\e -> UHC.Base.head <$> (\y -> map (addClass "hidden") y) <$> (siblings <$> e))
showCurrent = applyById (\e -> removeClass "hidden" <$> e)
|
kjgorman/melchior
|
comparison/fauxter/resources/melchior/application.hs
|
mit
| 2,417
| 0
| 18
| 504
| 895
| 468
| 427
| 45
| 1
|
--------------- letLinesiNiceNice -----------------------
main :: IO ()
main = do
line1 <- getLine
line2 <- getLine
let lines = line1 ++ " " ++ line2
putStrLn lines
|
HaskellForCats/HaskellForCats
|
IO/letLinesiNiceNice.hs
|
mit
| 192
| 0
| 11
| 54
| 54
| 25
| 29
| 6
| 1
|
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Elm.Marshall.Internal.Class
( ElmMarshall(..)
) where
import "this" Elm.Marshall.Internal.Type
import "base" GHC.Generics
import "base" Data.String ( fromString )
import "ghcjs-base" GHCJS.Types ( JSVal, jsval, isNull )
import "ghcjs-base" GHCJS.Foreign ( toJSBool, fromJSBool, jsNull )
import "ghcjs-base" GHCJS.Marshal ( fromJSValUnchecked, toJSVal )
import qualified "ghcjs-base" JavaScript.Array as A ( fromList, toList, (!) )
import "ghcjs-base" JavaScript.Array.Internal ( JSArray, SomeJSArray(..) )
import "ghcjs-base" Data.JSString ( pack, unpack )
import "ghcjs-base" Data.JSString.Text ( textFromJSVal, textToJSString )
import qualified "ghcjs-base" JavaScript.Object as Obj
import "ghcjs-base" JavaScript.Object.Internal ( Object(..) )
import qualified "text" Data.Text as T
------------------------------------------------------------
-- | The main class that provides marshalling to and from Elm
class ElmMarshall a where
-- | Turns a value into a Javascript object that can e.g. pass through a
-- port
toElm :: a -> IO (ElmValue a)
-- | Converts a Javascript value coming from Elm into a Haskell type.
fromElm :: ElmValue a -> IO a
default toElm :: (Generic a, GenericElmMarshall (Rep a)) => a -> IO (ElmValue a)
toElm x = ElmValue <$> (genericToElm $ from x)
default fromElm :: (Generic a, GenericElmMarshall (Rep a)) => ElmValue a -> IO a
fromElm x = genericFromElm (unElmValue x) >>= pure . to
class GenericElmMarshall f where
genericToElm :: f a -> IO JSVal
genericFromElm :: JSVal -> IO (f a)
instance (Datatype d, GenericElmMarshall f) =>
GenericElmMarshall (D1 d f) where
genericToElm datatype = genericToElm $ unM1 datatype
genericFromElm jsv = M1 <$> genericFromElm jsv
instance (Constructor c, GenericElmMarshallSelector f) =>
GenericElmMarshall (C1 c f) where
genericToElm constructor = do
obj <- Obj.create
fields <- genericToElmSelector $ unM1 constructor
mapM_ (\(name, val) -> Obj.setProp (fromString name) val obj) fields
pure $ jsval obj
genericFromElm jsv = M1 <$> genericFromElmSelector (Object jsv)
class GenericElmMarshallSelector f where
genericToElmSelector :: f a -> IO [(String, JSVal)]
genericFromElmSelector :: Obj.Object -> IO (f a)
instance (Selector ('MetaSel ('Just u) v w x), GenericElmMarshall a) =>
GenericElmMarshallSelector (S1 ('MetaSel ('Just u) v w x) a) where
genericToElmSelector selector =
case selName selector of
name -> do
val <- genericToElm $ unM1 selector
pure [(name, val)]
genericFromElmSelector obj =
case selName (undefined :: t ('MetaSel ('Just u) v w x) a p) of
name -> do
prop <- Obj.getProp (fromString name) obj
val <- genericFromElm prop
pure $ M1 val
instance (GenericElmMarshallSelector f, GenericElmMarshallSelector g) =>
GenericElmMarshallSelector (f :*: g) where
genericToElmSelector (l :*: r) =
(++) <$> genericToElmSelector l <*> genericToElmSelector r
genericFromElmSelector obj =
(:*:) <$> genericFromElmSelector obj <*> genericFromElmSelector obj
instance ElmMarshall a => GenericElmMarshall (Rec0 a) where
genericToElm rec = unElmValue <$> (toElm $ unK1 rec)
genericFromElm val =
K1 <$> fromElm (ElmValue val)
--------------
instance ElmMarshall Bool where
toElm = pure . ElmValue . toJSBool
fromElm = pure . fromJSBool . unElmValue
instance ElmMarshall Float where
toElm = fmap ElmValue . toJSVal
fromElm = fromJSValUnchecked . unElmValue
instance ElmMarshall Double where
toElm = fmap ElmValue . toJSVal
fromElm = fromJSValUnchecked . unElmValue
instance ElmMarshall Int where
toElm = fmap ElmValue . toJSVal
fromElm = fromJSValUnchecked . unElmValue
instance {-# OVERLAPPING #-} ElmMarshall String where
toElm = fmap ElmValue . toJSVal . pack
fromElm x =
fromJSValUnchecked (unElmValue x) >>= fromJSValUnchecked
instance ElmMarshall T.Text where
toElm = fmap ElmValue . toJSVal . textToJSString
fromElm = pure . textFromJSVal . unElmValue
instance ElmMarshall a => ElmMarshall [a] where
toElm xs = do
xs' <- mapM (fmap unElmValue . toElm) xs
pure $ ElmValue $ jsval $ A.fromList xs'
fromElm xs =
mapM (fromElm . ElmValue) $ A.toList $ SomeJSArray $ unElmValue xs
instance ElmMarshall a => ElmMarshall (Maybe a) where
toElm (Just x) = fmap (ElmValue . unElmValue) $ toElm x
toElm Nothing = pure $ ElmValue jsNull
fromElm x =
if isNull $ unElmValue x then
pure Nothing
else
Just <$> fromElm (ElmValue $ unElmValue x)
instance ElmMarshall JSVal where
toElm = pure . ElmValue
fromElm = pure . unElmValue
instance ElmMarshall () where
toElm () = fmap (ElmValue . unElmValue) $ toElm ([] :: [Int])
fromElm _ = pure ()
instance (ElmMarshall a, ElmMarshall b) =>
ElmMarshall (a, b) where
toElm (a, b) = do
a' <- toElm a
b' <- toElm b
fmap (ElmValue . unElmValue) $ toElm [unElmValue a', unElmValue b']
fromElm x = do
a' <- fromElm $ ElmValue $ xArr A.! 0
b' <- fromElm $ ElmValue $ xArr A.! 1
pure $ (a', b')
where
xArr :: JSArray
xArr = SomeJSArray $ unElmValue x
instance (ElmMarshall a, ElmMarshall b, ElmMarshall c) =>
ElmMarshall (a, b, c) where
toElm (a, b, c) = do
a' <- toElm a
b' <- toElm b
c' <- toElm c
fmap (ElmValue . unElmValue) $ toElm [unElmValue a', unElmValue b', unElmValue c']
fromElm x = do
a' <- fromElm $ ElmValue $ xArr A.! 0
b' <- fromElm $ ElmValue $ xArr A.! 1
c' <- fromElm $ ElmValue $ xArr A.! 2
pure $ (a', b', c')
where
xArr :: JSArray
xArr = SomeJSArray $ unElmValue x
instance (ElmMarshall a, ElmMarshall b, ElmMarshall c, ElmMarshall d) =>
ElmMarshall (a, b, c, d) where
toElm (a, b, c, d) = do
a' <- toElm a
b' <- toElm b
c' <- toElm c
d' <- toElm d
fmap (ElmValue . unElmValue) $ toElm [unElmValue a', unElmValue b', unElmValue c', unElmValue d']
fromElm x = do
a' <- fromElm $ ElmValue $ xArr A.! 0
b' <- fromElm $ ElmValue $ xArr A.! 1
c' <- fromElm $ ElmValue $ xArr A.! 2
d' <- fromElm $ ElmValue $ xArr A.! 2
pure $ (a', b', c', d')
where
xArr :: JSArray
xArr = SomeJSArray $ unElmValue x
|
FPtje/elm-marshall
|
src/Elm/Marshall/Internal/Class.hs
|
mit
| 6,900
| 0
| 14
| 1,714
| 2,227
| 1,149
| 1,078
| 153
| 0
|
data Bintree a = Leaf
| Branch a (Bintree a) (Bintree a)
deriving Show
instance Functor Bintree where
fmap _ Leaf = Leaf
fmap f (Branch x l r) = Branch (f x) (fmap f l) (fmap f r)
doubleValues :: Functor f => f Int -> f Int
doubleValues = fmap (*2)
sumUpAssociatedToValues :: [Int] -> [(Int, Int)] -> Maybe Int
sumUpAssociatedToValues keys pairs = fmap sum $ sequence (
map (flip lookup pairs) keys)
main = do
print $ tree
print $ fmap (>10) tree
print $ doubleValues tree
print $ doubleValues [1..10]
print $ doubleValues (Just 10)
print $ doubleValues (Nothing)
print $ "sumUpAssociatedToValues"
print $ sumUpAssociatedToValues [0] l
print $ sumUpAssociatedToValues [] l
print $ sumUpAssociatedToValues [3] l
print $ sumUpAssociatedToValues [3,1] l
where tree = (Branch 10 Leaf (Branch 4 Leaf Leaf))
l = [(1, 2), (3, 8)]
|
kdungs/coursework-functional-programming
|
10/functors.hs
|
mit
| 967
| 0
| 10
| 287
| 399
| 200
| 199
| 25
| 1
|
module Network.IRC.Client.Connection.TLSContext
( ciphers
, addTLSContext ) where
import Network.TLS
import Network.TLS.Extra
import qualified Crypto.Random.AESCtr as RA
import System.IO
import Data.Maybe
#if __GLASGOW_HASKELL__ <= 704
import Prelude hiding (catch)
#else
import Prelude
#endif
-- | set up cipher setting array
ciphers :: [Cipher]
ciphers =
[ cipher_AES128_SHA1
, cipher_AES256_SHA1
, cipher_RC4_128_MD5
, cipher_RC4_128_SHA1
]
-- | add TLS Context
addTLSContext :: Handle -> IO (Maybe Context)
addTLSContext h = do
let params = defaultParamsClient{pCiphers = ciphers}
g <- RA.makeSystem
con <- contextNewOnHandle h params g
handshake con
return $ Just con
|
cosmo0920/hs-IRC
|
Network/IRC/Client/Connection/TLSContext.hs
|
mit
| 730
| 0
| 11
| 148
| 168
| 97
| 71
| 22
| 1
|
{-# LANGUAGE OverloadedStrings #-}
module ParseEmailHtml where
import Control.Applicative
import qualified Data.ByteString as BS
import Data.Text.Encoding
import qualified Data.Text as T
-- import System.IO
import Data.Maybe
import Network.HTTP.Types.URI
import Text.HTML.TagSoup
parseEmailHtml
:: T.Text -> [BS.ByteString]
parseEmailHtml eHtml
= mapMaybe fTitle $ parseTags eHtml
extractRef :: T.Text -> Maybe (Maybe BS.ByteString)
extractRef = lookup "kd" . parseQuery . (urlDecode False) . encodeUtf8
unForwardRef :: T.Text -> T.Text
unForwardRef ref =
case T.breakOn "/expose/" $ T.takeWhile (/= '?') ref of
(p1,p2) -> case T.breakOnEnd "/" p1 of
(p11, _) -> T.concat [T.replace "forward" "www" p11, T.tail p2]
fTitle :: Tag T.Text -> Maybe BS.ByteString
fTitle tag = case tag of
TagOpen "a" attrs
-> case lookup "name" attrs of
Just "TITLE" -> (lookup "href" attrs) >>= extractRef >>= id
_ -> case lookup "class" attrs of
Just x | T.isPrefixOf "real-estate-title-link" x
-> encodeUtf8 <$> unForwardRef <$> lookup "href" attrs
_ -> Nothing
_ -> Nothing
|
habbler/immo
|
ParseEmailHtml.hs
|
mit
| 1,314
| 0
| 18
| 411
| 376
| 195
| 181
| 30
| 4
|
{-# LANGUAGE OverloadedStrings #-}
module Net.WebServer where
import Web.Scotty
import Data.Monoid (mconcat)
main = scotty 3000 $ do
get "/:word" $ do
beam <- param "word"
html $ mconcat ["<h1>Scotty, ", beam, " me up!</h1>"]
|
korczis/skull-haskell
|
src/Lib/Net/WebServer.hs
|
mit
| 239
| 0
| 13
| 48
| 73
| 38
| 35
| 8
| 1
|
module System.SshdLint.CheckSpec (spec) where
import Test.Hspec
import System.SshdLint.Check
import qualified Data.Set as Set
import qualified Data.Map as Map
spec :: Spec
spec =
describe "normalizing and validating settings" $ do
describe "duplicatedValues" $ do
it "returns a list of keys found multiple times" $
duplicatedValues [ "PermitEmptyPasswords"
, "PermitEmptyPasswords" ] `shouldBe`
Set.fromList ["permitemptypasswords"]
it "finds duplicated elements regardless of case" $
duplicatedValues [ "PermitEmptyPasswords"
, "permitemptypasswords" ] `shouldBe`
Set.fromList ["permitemptypasswords"]
it "allows duplicate HostKey values" $
duplicatedValues [ "HostKey"
, "hostkey" ] `shouldBe`
Set.empty
describe "activeSettings" $
it "returns settings based on their first occurrence in the list" $
activeSettings [ ("PermitEmptyPasswords", ["yes"])
, ("PermitEmptyPasswords", ["no"]) ]
`shouldBe` Map.fromList [ ("permitemptypasswords", ["yes"]) ]
describe "recommendations" $ do
it "returns all settings that are unsafe, along with better alternatives" $
recommendations (Map.fromList [("permitemptypasswords", ["no"])])
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` ["permitemptypasswords should be [\"no\"], found [\"yes\"]"]
it "finds recommendations even when there are case differences" $
recommendations (Map.fromList [("PermitEmptyPasswords", ["no"])])
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` ["permitemptypasswords should be [\"no\"], found [\"yes\"]"]
it "passes over config options for which we have no recommendations" $
recommendations Map.empty
(Map.fromList [("permitemptypasswords", ["yes"])])
`shouldBe` [ ]
it "doesn't care about ordering of values" $
recommendations (Map.fromList [("AcceptEnv", ["LANG", "LC_*"])])
(Map.fromList [("acceptenv", ["LC_*", "LANG"])])
`shouldBe` [ ]
|
stackbuilders/sshd-lint
|
spec/System/SshdLint/CheckSpec.hs
|
mit
| 2,190
| 0
| 18
| 556
| 478
| 265
| 213
| 43
| 1
|
{- |
Module : Sonnex-Generator
Description : Takes a rules file and compiles it into PHP code
Copyright : (c) Frédéric BISSON, 2016
License : GPL-3
Maintainer : zigazou@free.fr
Stability : experimental
Portability : POSIX
-}
module Main where
import Text.ParserCombinators.Parsec (parse)
import Parser.Parser (rules)
import Generator.PHP (phpRules)
-- | Sonnex-Generator
main :: IO ()
main = do
-- Load the rules file
sonnexfile <- readFile "src/sonnex.rules"
-- Parses every rule
let sonnexrulesE = parse rules "sonnex.rules" sonnexfile
-- Compiles the rules into PHP code
case sonnexrulesE of
Left err -> print err
Right sonnexrules -> putStrLn $ phpRules sonnexrules
|
Zigazou/Sonnex-Generator
|
src/Main.hs
|
gpl-2.0
| 731
| 0
| 11
| 159
| 116
| 61
| 55
| 11
| 2
|
--
-- hsExpand.hs
--
-- Copyright 2014 Mark Kolloros <uvthenfuv@gmail.com>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-- MA 02110-1301, USA.
--
-- TODO: More thorough documentation.
-- TODO: Make it work well on any kind of Haskell98 code.
module Main where
import System.Environment ( getArgs )
import Language.Haskell.Parser ( parseModuleWithMode, ParseMode(..), ParseResult(..) )
import Language.Haskell.Syntax -- for the types
import Language.Haskell.Pretty ( prettyPrint )
import Data.Maybe ( isNothing, fromJust )
import Data.List ( find )
import System.Console.GetOpt
import Debug.Trace ( trace )
import BracketPrint ( bracketIndent )
-- The elements are, in order: filename, # of lines to print.
data Params = Params String Integer
defaultLinesToPrint :: Integer
defaultLinesToPrint = 5
usage :: String
usage = "Usage: TODO"
optionDecriptions :: [OptDescr Integer]
optionDecriptions = [
Option "ln" ["lines"] (ReqArg read "0") "Number of lines to print.",
Option "hv" ["help", "version"] (NoArg 0) "Display a usage message instead of doing anything."]
main = do
args <- getArgs
let (options, filenames, err) = (getOpt Permute optionDecriptions args)
if err /= [] then putStrLn (concat err) else do
if 0 `elem` options || filenames == [] then putStrLn usage else do
let filename = head filenames
text <- readFile filename
putStrLn $ evaluate (makeParam filename options) $ parseModuleWithMode (ParseMode filename) text
makeParam :: String -> [Integer] -> Params
makeParam f [] = Params f defaultLinesToPrint
makeParam f [n] = Params f n
makeParam f _ = error "Unexpected multiple parameters."
evaluate :: Params -> ParseResult HsModule -> String
evaluate _ (ParseFailed loc error) = parseError loc error
evaluate params (ParseOk (HsModule srcloc mod _ _ decls))
| isNothing maybeMain = "Error: No main was found!"
| otherwise = expandingLines (fromJust maybeMain) decls (linesToPrint params)
where
maybeMain = find (isPatBind "main") decls
linesToPrint :: Params -> Integer
linesToPrint (Params _ n) = n
parseError :: SrcLoc -> String -> String
parseError (SrcLoc filename line column) error = filename++":"++(show line)++":"++(show column)++": "++error
isPatBind :: String -> HsDecl -> Bool
isPatBind name (HsPatBind _ pat _ _) = pat == (HsPVar (HsIdent name))
isPatBind _ _ = False
expandingLines :: HsDecl -> [HsDecl] -> Integer -> String
expandingLines mainDecl context 1 = (prettyPrint mainDecl)
expandingLines mainDecl context n = (prettyPrint mainDecl)++"\n"++rest
where
rest = expandingLines (expandMain mainDecl context) context (pred n)
expandMain :: HsDecl -> [HsDecl] -> HsDecl
expandMain (HsPatBind sl lhs (HsGuardedRhss _ ) decls) context = error "Placeholder: expanding guarded right-hand side."
expandMain (HsPatBind sl lhs (HsUnGuardedRhs exp) decls) context = (HsPatBind sl lhs rhs newDecls)
where
rhs = (HsUnGuardedRhs expanded)
newDecls = decls
expanded = expandExpr (decls++context) exp
-- Expanding expressions in general. (Function applications, infix applications, etc.)
-- TODO: Treat applications and infix applications the same way by
-- converting back and forth between infix and non-infix and
-- calling a separate function that does basic function
-- expansion.
-- TODO: Make the automatic parentheses adding code result in
-- nice-looking code.
expandExpr :: [HsDecl] -> HsExp -> HsExp
-- expandExpr decls exp | trace ("expandExpr exp: " ++ bracketIndent (show exp)) False = undefined
expandExpr decls (HsApp fn@(HsVar (UnQual (HsIdent f))) value)
| varExpansion = (HsApp fn (expandExpr decls value))
| otherwise = HsParen (expandFn matches value)
where
varExpansion = isNothing maybeMatches || (requiresLit matches && not (isLit value))
matches :: [HsMatch]
matches = fromJust maybeMatches
maybeMatches :: Maybe [HsMatch]
maybeMatches = find (isFnDef f) decls >>= return . getMatches
getMatches :: HsDecl -> [HsMatch]
getMatches (HsFunBind matches) = matches
expandExpr decls (HsInfixApp exp1 op exp2) -- this is a hack, we should treat infix and non-infix applications the same way
-- "Builtins."
| op == (HsQVarOp (UnQual (HsSymbol "+"))) && isLit exp1 && isLit exp2 = (expIntFn (+)) exp1 exp2
| op == (HsQVarOp (UnQual (HsSymbol "-"))) && isLit exp1 && isLit exp2 = (expIntFn (-)) exp1 exp2
| op == (HsQVarOp (UnQual (HsSymbol "*"))) && isLit exp1 && isLit exp2 = (expIntFn (*)) exp1 exp2
| otherwise = HsInfixApp (expandExpr decls exp1) op (expandExpr decls exp2)
expandExpr decls (HsParen inner@(HsParen _)) = (expandExpr decls inner)
expandExpr decls (HsParen exp)
| isLit expanded = expanded
| otherwise = (HsParen expanded)
where expanded = (expandExpr decls exp)
expandExpr _ (HsLit a) = (HsLit a)
expandExpr _ exp = error $ "Placeholder: Can't expand \"" ++ show exp ++ "\""
-- Decides whether the given name is the name of the function the given declaration defines.
isFnDef :: String -> HsDecl -> Bool
isFnDef f (HsFunBind ((HsMatch _ (HsIdent name) _ _ _):matches)) = f == name
isFnDef _ _ = False
-- Decides whether a function definition requires the argument(s) to be literals.
requiresLit :: [HsMatch] -> Bool
requiresLit matches = or (map isLitPat patterns)
where
patterns = concat $ map patternsOf matches
patternsOf :: HsMatch -> [HsPat]
patternsOf (HsMatch _ _ pats _ _) = pats
-- Expand a function application, replacing the application with its definition.
-- TODO: Rewrite so the error msg includes the name of the function and the value that wasn't matched.
expandFn :: [HsMatch] -> HsExp -> HsExp
-- expandFn patterns value | trace ("expandFn value: " ++ show value) False = undefined
expandFn [] _ = error "expandFn: None of the patterns matched."
expandFn ((HsMatch _ _ patterns rhs _):ms) value
| length patterns /= 1 = error ("Placeholder: number of patterns in function match is " ++ show (length patterns) ++ ", not one.")
| isNothing expanded = expandFn ms value
| otherwise = fromJust expanded
where
expanded :: Maybe HsExp
expanded = trySubstitute value (head patterns) rhs
-- See if the given expression matches the given pattern, and if so, substitute the expression into the given right-hand side.
trySubstitute :: HsExp -> HsPat -> HsRhs -> Maybe HsExp
-- trySubstitute exp pat rhs | trace ("trySubstitute (" ++ show exp ++ "), (" ++ show pat ++ "), (" ++ show rhs ++ ")") False = undefined
trySubstitute (HsLit lit) (HsPLit plit) (HsUnGuardedRhs exp)
| lit == plit = Just exp
| otherwise = Nothing
trySubstitute value (HsPVar (HsIdent varname)) (HsUnGuardedRhs exp) = Just (replaceAll varname value exp)
trySubstitute value (HsPLit plit) rhs = Nothing
trySubstitute _ pat rhs = error "Placeholder: trying to substitute for undefined pattern-type or right-hand side"
-- Given the name of the variable we want to replace, the expression
-- we want to replace the variable with ("value"), and an expression
-- that might contain that variable, replace all occurences of that
-- variable in the expression with the value.
-- TODO: Maybe I should do this with generics?
replaceAll :: String -> HsExp -> HsExp -> HsExp
-- replaceAll name value exp | trace ("replaceAll " ++ name ++ " (" ++ show value ++ ") (" ++ show exp ++ ")") False = undefined
replaceAll name value exp@(HsVar (UnQual (HsIdent varname)))
| name == varname = value
| otherwise = exp
replaceAll name value (HsInfixApp exp1 op exp2) = HsInfixApp (replaceAll name value exp1) op (replaceAll name value exp2)
replaceAll name value (HsParen exp) = HsParen (replaceAll name value exp)
replaceAll name value (HsApp exp1 exp2) = HsApp (replaceAll name value exp1) (replaceAll name value exp2)
replaceAll name value (HsLit a) = HsLit a
replaceAll _ _ exp = error $ "Placeholder: trying to replaceAll for undefined expression: " ++ show exp
-- General helper functions.
expIntFn :: (Integer -> Integer -> Integer) -> (HsExp -> HsExp -> HsExp)
expIntFn fn = inner
where
inner :: HsExp -> HsExp -> HsExp
inner (HsLit (HsInt a)) (HsLit (HsInt b)) = (HsLit (HsInt (fn a b)))
isLit :: HsExp -> Bool
isLit (HsLit _) = True
isLit _ = False
isLitPat :: HsPat -> Bool
isLitPat (HsPLit _) = True
isLitPat _ = False
|
uvthenfuv/HsExpand
|
hsExpand.hs
|
gpl-2.0
| 9,237
| 0
| 17
| 1,937
| 2,381
| 1,225
| 1,156
| 119
| 3
|
{-# LANGUAGE FlexibleContexts #-}
module Error (
InterpreterError,
underflow, multipleAssign, lookupNonString, bindNonString, builtInError,
libraryError, unboundVariable, indexWithNoNumber, executeNonCode) where
import Object
import Control.Monad.Except
import Text.Parsec
data InterpreterError e a
= UnboundVariable String
| CriticalError String
| StackUnderflow
| MultipleAssignmentError String
| BindingToNonStringError (Object e a)
| LookingUpNonStringError (Object e a)
| IndexingWithNonNumberError (Object e a)
| ExecutedNonCodeError (Object e a)
| BuiltinTypeError String
| CannotCompareCodeError
| LibraryError ParseError
deriving Show
underflow :: (MonadError (InterpreterError e a) m) => m x
underflow = throwError StackUnderflow
multipleAssign :: (MonadError (InterpreterError e a) m) => String -> m x
multipleAssign = throwError . MultipleAssignmentError
bindNonString :: (MonadError (InterpreterError e a) m) => Object e a -> m x
bindNonString = throwError . BindingToNonStringError
lookupNonString :: (MonadError (InterpreterError e a) m) => Object e a -> m x
lookupNonString = throwError . LookingUpNonStringError
builtInError :: (MonadError (InterpreterError e a) m) => String -> m x
builtInError = throwError . BuiltinTypeError
libraryError :: (MonadError (InterpreterError e a) m) => ParseError -> m x
libraryError = throwError . LibraryError
unboundVariable :: (MonadError (InterpreterError e a) m) => String -> m x
unboundVariable = throwError . UnboundVariable
indexWithNoNumber :: (MonadError (InterpreterError e a) m) => Object e a -> m x
indexWithNoNumber = throwError . IndexingWithNonNumberError
executeNonCode :: (MonadError (InterpreterError e a) m) => Object e a -> m x
executeNonCode = throwError . ExecutedNonCodeError
|
kavigupta/N-programming-language
|
src/Error.hs
|
gpl-3.0
| 1,826
| 0
| 8
| 303
| 518
| 281
| 237
| 39
| 1
|
import System.Process
-- import GHC.Exts
-- import Data.Char
import Data.List
import System.FilePath
import Control.Applicative
-- import Control.Monad
-- import System.Directory
-- import System.Posix.Files
import System.Environment
import Control.Concurrent.Async
import Control.Concurrent.BoundedChan
import Control.Concurrent (forkIO)
-- import Data.Set (Set)
import qualified Data.Set as Set
-- import Data.ByteString (ByteString)
-- import qualified Data.ByteString as B
-- import qualified Data.ByteString.Lazy as L
-- import Data.Serialize
-- import GHC.Generics
-- import Data.Digest.Pure.SHA
import Common
main :: IO ()
main = do
[fsroot] <- getArgs -- pattern is usually "*.pdf" pdf djvu ps tex dvi and .gz versions
let repoPath = fsroot </> file_repository
files <- filter isCandidate . lines <$> readProcess "find" [fsroot, "-type", "f"] ""
mapM_ print files
sums <- sort . flip zip files <$> mapNConcurrently 3 (map sha1sum files)
mapM_ print sums
mapM_ (storeFile repoPath) sums
db <- readRepository repoPath
let dbS = db `Set.union` Set.fromList sums
writeRepository repoPath dbS
mapNConcurrently :: Int -> [IO a] -> IO [a]
mapNConcurrently n rs = do
c <- newBoundedChan n
forkIO (mapM_ (writeChan c . Just) rs >> sequence_ (replicate n (writeChan c Nothing)))
concat <$> mapConcurrently (const $ process c) [1..n]
process :: BoundedChan (Maybe (IO a)) -> IO [a]
process channel = do
action <- readChan channel
case action of
Nothing -> return []
Just a -> do
v <- a
rest <- process channel
return (v:rest)
|
mjansen/document-repository-tool
|
merge-into-repository.hs
|
gpl-3.0
| 1,598
| 0
| 14
| 299
| 471
| 236
| 235
| 36
| 2
|
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Game.Regret.Internal (playouts) where
import Control.Monad (forM, forM_, replicateM_)
import Control.Monad.Random (Randomizable, uniformList, uniformListSubset)
import Data.Foldable (foldl')
import qualified Data.List.NonEmpty as NonEmpty
import Data.Maybe (fromMaybe)
import qualified Data.Tuple as Tuple
import Control.Monad.Scale (scaleBy)
import Data.Dist hiding (normalize)
import qualified Data.Dist as Dist
import Data.Map.Generic (Key, Map)
import qualified Data.Map.Generic as Map
import Data.Normalizing (Normalizing(..))
import Data.SelectionMap (SelectionMap, SelectionPath(..), noPaths, nullPaths)
import qualified Data.SelectionMap as S
import Data.Vector.Class (Vector(..))
import qualified Data.Vector.Class as Vector
import Game
import Game.PlayerMap (PlayerIndex, PlayerMap, initPlayerMap, playerList)
import Game.Regret.Monad (Regret, TopRegret)
import qualified Game.Regret.Monad as Monad
data IndividualResult am v = MyTurn (am v) | NotMyTurn v
type RG g = Regret (InfoMap g) (Node (ActionMap g))
type TRG g = TopRegret (InfoMap g) (Node (ActionMap g))
fetchPolicy :: Game g => g -> InfoSet g -> RG g (Dist (Action g))
fetchPolicy g info = fromMaybe startNode <$> Monad.regretValue info
where
startNode = normalize $ Node $ Map.map (const 0) $ getActions g info
getInfos :: Game g => g -> Game.State g -> PlayerMap (InfoSet g)
getInfos g curState = initPlayerMap $ \i -> getInfoSet g i curState
probe :: Game g => g -> Game.State g -> RG g (Value g)
probe g curState = case getPrimitiveValue g curState of
Just val -> return val
Nothing -> do
let infosets = getInfos g curState
policies <- forM infosets $ fetchPolicy g
selections <- mapM sample policies
sample (applyActions g selections curState) >>= probe g
selectPlayerActions :: (Map a, Map.MapValue a (), Map.MapValue a (Int, Float), Randomizable m Int)
=> a () -> SelectionPath -> m (SelectionMap a)
selectPlayerActions acts (SelectionPath npaths) =
if
| npaths > Map.size acts -> do
let numEach = npaths `quot` Map.size acts
return $ S.map (const (SelectionPath numEach, 1)) acts
| npaths == 1 -> do
selected <- uniformList $ NonEmpty.fromList $ Map.keys acts
return $ S.singleton selected (SelectionPath 1, 1 / fromIntegral (Map.size acts))
| otherwise -> do
selecteds <- uniformListSubset npaths $ Map.keys acts
let probScale = fromIntegral npaths / fromIntegral (Map.size acts)
return $ S.fromList $ map (, (SelectionPath 1, probScale)) selecteds
outcomes :: Game g
=> g -> PlayerIndex -> SelectionPath -> Game.State g -> PlayerMap (Dist (Action g))
-> RG g (IndividualResult (ActionMap g) (Value g))
outcomes g p path curState policies = do
selections <- mapM sample policies
case getActions g <$> getInfoSet g p curState of
Nothing -> NotMyTurn <$> doActions selections path
Just acts -> do
selected <- selectPlayerActions acts path
let allActs = S.union selected (S.map (const (noPaths, 0)) acts)
fmap MyTurn $ S.forMWithKey allActs $ \a (newpath, probScale) ->
if nullPaths newpath
then sample (applyActions g (Map.insert p a selections) curState) >>= probe g
else scaleBy (1 / probScale) (doActions (Map.insert p a selections) newpath)
where
doActions ma newpath = sample (applyActions g ma curState) >>= playout g p newpath
processRegrets :: Game g
=> g -> PlayerIndex -> InfoSet g -> Dist (Action g) -> ActionMap g (Value g)
-> RG g (Value g)
processRegrets g p info myPolicy r = do
let ut = getUtility g p
ev = expected $ (r Map.!) <$> myPolicy
utev = ut ev
Monad.addRegret info $ Node $ Map.map (\v -> ut v - utev) r
return ev
playout :: Game g => g -> PlayerIndex -> SelectionPath -> Game.State g -> RG g (Value g)
playout g p path curState =
case getPrimitiveValue g curState of
Just val -> return val
Nothing -> do
let infosets = getInfos g curState
policies <- forM infosets $ fetchPolicy g
outcomes g p path curState policies >>= \case
MyTurn v -> processRegrets g p (infosets Map.! p) (policies Map.! p) v
NotMyTurn v -> return v
newtype Node m = Node (m Float)
instance (Map.MapValue m Float, Map m) => Vector (Node m) where
scale c (Node m) = Node $ Vector.genericScaleMap c m
add (Node v) (Node w) = Node $ Vector.genericAddMap v w
zero = Node Vector.genericZeroMap
vnegate (Node m) = Node $ Vector.genericVNegateMap m
vsum = Node . Vector.genericVSumMap . map (\(Node m) -> m)
instance (Map.MapValue m Float, Map m) => Normalizing (Node m) where
type Normal (Node m) = Dist (Key m)
normalize (Node m) = Dist.normalize $ NonEmpty.fromList $ map Tuple.swap $ Map.toList m
forget = Node . Map.fromList . map Tuple.swap . Dist.pieces
untypedNormalize (Node m)
| Map.null m = error "Empty map"
| otherwise = Node $
Map.map (if tot <= 0
then const (1 / fromIntegral (Map.size m))
else (\x -> if x <= 0 then 0 else x / tot)
) m
where
tot = foldl' (\v x -> if x <= 0 then v else v + x) 0 (Map.elems m)
playouts :: Game g => g -> Int -> Int -> TRG g ()
playouts g count npaths = do
let start = startState g
replicateM_ count $
forM_ playerList $ \p ->
Monad.saveRegrets_ $ playout g p (SelectionPath npaths) start
|
davidspies/regret-solver
|
regret/src/Game/Regret/Internal.hs
|
gpl-3.0
| 5,599
| 0
| 21
| 1,209
| 2,194
| 1,112
| 1,082
| 117
| 3
|
module HeroesAndCowards.HACFrontend where
import Data.IORef
import qualified Graphics.Gloss as GLO
winSizeX :: Int
winSizeX = 800
winSizeY :: Int
winSizeY = 800
agentSize :: Float
agentSize = 1
display :: GLO.Display
display = (GLO.InWindow "Heroes & Cowards CONC (Gloss)" (winSizeX, winSizeY) (0, 0))
renderFrame :: [(Double, Double, Bool)] -> GLO.Picture
renderFrame as = GLO.Pictures $ agentPics
where
agentPics = map renderAgent as
renderAgent :: (Double, Double, Bool) -> GLO.Picture
renderAgent (x, y, hero) = GLO.color color $ GLO.translate xPix yPix $ GLO.ThickCircle agentSize (2*agentSize)
where
xPix = fromRational (toRational (x * fromRational halfXSize))
yPix = fromRational (toRational (y * fromRational halfYSize))
color = agentColor hero
halfXSize = toRational winSizeX / 2.0
halfYSize = toRational winSizeY / 2.0
agentColor :: Bool -> GLO.Color
agentColor True = GLO.green
agentColor False = GLO.red
|
thalerjonathan/phd
|
public/ArtIterating/code/haskell/PureAgentsConc/src/HeroesAndCowards/HACFrontend.hs
|
gpl-3.0
| 980
| 0
| 12
| 193
| 318
| 174
| 144
| 24
| 1
|
module Foundation where
import Prelude
import Yesod
import Yesod.Static
--import Yesod.Auth
--import Yesod.Auth.BrowserId
import Yesod.Default.Config
import Yesod.Default.Util (addStaticContentExternal)
import Network.HTTP.Client.Conduit (Manager, HasHttpManager (getHttpManager))
import qualified Settings
import Settings.Development (development)
import Settings.StaticFiles
import Settings (widgetFile, Extra (..))
import Text.Jasmine (minifym)
import Text.Hamlet (hamletFile)
import Yesod.Core.Types (Logger)
import RouteTypes ()
import Audit.VersionedChange (AuditId)
import Db.AuditStore (AuditStore)
import Util.EntityKey (EntityKey)
-- | The site argument for your application. This can be a good place to
-- keep settings and values requiring initialization before your application
-- starts running, such as database connections. Every handler will have
-- access to the data present here.
data App = App
{ settings :: AppConfig DefaultEnv Extra
, getStatic :: Static -- ^ Settings for static file serving.
, httpManager :: Manager
, appLogger :: Logger
, db :: AuditStore
}
instance HasHttpManager App where
getHttpManager = httpManager
-- Set up i18n messages. See the message folder.
mkMessage "App" "messages" "en"
-- This is where we define all of the routes in our application. For a full
-- explanation of the syntax, please see:
-- http://www.yesodweb.com/book/routing-and-handlers
--
-- Note that this is really half the story; in Application.hs, mkYesodDispatch
-- generates the rest of the code. Please see the linked documentation for an
-- explanation for this split.
mkYesodData "App" $(parseRoutesFile "config/routes")
type AppRoute = Route App
type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
-- Please see the documentation for the Yesod typeclass. There are a number
-- of settings which can be configured by overriding methods here.
instance Yesod App where
approot = ApprootMaster $ appRoot . settings
-- Store session data on the client in encrypted cookies,
-- default session idle timeout is 120 minutes
makeSessionBackend _ = fmap Just $ defaultClientSessionBackend
120 -- timeout in minutes
"config/client_session_key.aes"
defaultLayout widget = do
master <- getYesod
mmsg <- getMessage
-- We break up the default layout into two components:
-- default-layout is the contents of the body tag, and
-- default-layout-wrapper is the entire page. Since the final
-- value passed to hamletToRepHtml cannot be a widget, this allows
-- you to use normal widget features in default-layout.
pc <- widgetToPageContent $ do
$(combineStylesheets 'StaticR
[ css_normalize_css
, css_bootstrap_css
])
$(widgetFile "default-layout")
giveUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
-- This is done to provide an optimization for serving static files from
-- a separate domain. Please see the staticRoot setting in Settings.hs
urlRenderOverride y (StaticR s) =
Just $ uncurry (joinPath y (Settings.staticRoot $ settings y)) $ renderRoute s
urlRenderOverride _ _ = Nothing
-- This function creates static content files in the static folder
-- and names them based on a hash of their content. This allows
-- expiration dates to be set far in the future without worry of
-- users receiving stale content.
addStaticContent =
addStaticContentExternal minifym genFileName Settings.staticDir (StaticR . flip StaticRoute [])
where
-- Generate a unique filename based on the content itself
genFileName lbs
| development = "autogen-" ++ base64md5 lbs
| otherwise = base64md5 lbs
-- Place Javascript at bottom of the body tag so the rest of the page loads first
jsLoader _ = BottomOfBody
-- What messages should be logged. The following includes all messages when
-- in development, and warnings and errors in production.
shouldLog _ _source level =
development || level == LevelWarn || level == LevelError
makeLogger = return . appLogger
-- This instance is required to use forms. You can modify renderMessage to
-- achieve customized and internationalized form validation messages.
instance RenderMessage App FormMessage where
renderMessage _ _ = defaultFormMessage
-- | Get the 'Extra' value, used to hold data from the settings.yml file.
getExtra :: Handler Extra
getExtra = fmap (appExtra . settings) getYesod
-- Note: previous versions of the scaffolding included a deliver function to
-- send emails. Unfortunately, there are too many different options for us to
-- give a reasonable default. Instead, the information is available on the
-- wiki:
--
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
c0c0n3/audidoza
|
Foundation.hs
|
gpl-3.0
| 4,930
| 0
| 15
| 1,025
| 651
| 367
| 284
| -1
| -1
|
-- this is adapted from ghc/syslib-hbc
module Parse(
Parser, (+.+), (..+), (+..), (|||), (>>>), (||!), (|!!), (.>),
into, lit, litp, many, many1, succeed, sepBy, count, sepBy1, testp, token, recover,
ParseResult, parse, sParse, simpleParse,
act, failP
) where
infixr 8 +.+ , ..+ , +..
infix 6 `act` , >>>, `into` , .>
infixr 4 ||| , ||! , |!!
type ErrMsg = String
{-
data FailAt a
= FailAt !Int [ErrMsg] a -- token pos, list of acceptable tokens, rest of tokens
deriving (Show)
data ParseResult a b
= Many [(b, Int, a)] (FailAt a) -- parse succeeded with many (>1) parses)
| One b !Int a !(FailAt a) -- parse succeeded with one parse
| None !Bool !(FailAt a) -- parse failed. The Bool indicates hard fail
deriving (Show)
-}
data FailAt a
= FailAt Int [ErrMsg] a -- token pos, list of acceptable tokens, rest of tokens
deriving (Show)
data ParseResult a b
= Many [(b, Int, a)] (FailAt a) -- parse succeeded with many (>1) parses)
| One b Int a (FailAt a) -- parse succeeded with one parse
| None Bool (FailAt a) -- parse failed. The Bool indicates hard fail
deriving (Show)
type Parser a b = a -> Int -> ParseResult a b
noFail = FailAt (-1) [] (error "noFail") -- indicates no failure yet
updFail f (None w f') = None w (bestFailAt f f')
updFail f (One c n as f') = One c n as (bestFailAt f f')
updFail f (Many cas f') = let r = bestFailAt f f' in seq r (Many cas r)
bestFailAt f@(FailAt i a t) f'@(FailAt j a' _) =
if i > j then
f
else if j > i then
f'
else if i == -1 then
noFail --FailAt (-1) [] []
else
FailAt i (a ++ a') t
-- Alternative
(|||) :: Parser a b -> Parser a b -> Parser a b
p ||| q = \as n ->
case (p as n, q as n) of
(pr@(None True _), _ ) -> pr
(pr@(None _ f), qr ) -> updFail f qr
( One b k as f , qr ) -> Many ((b,k,as) : l') (bestFailAt f f') where (l',f') = lf qr
( Many l f , qr ) -> Many ( l++l') (bestFailAt f f') where (l',f') = lf qr
where lf (Many l f) = (l, f)
lf (One b k as f) = ([(b,k,as)], f)
lf (None _ f) = ([], f)
-- Alternative, but with committed choice
(||!) :: Parser a b -> Parser a b -> Parser a b
p ||! q = \as n ->
case (p as n, q as n) of
(pr@(None True _), _ ) -> pr
( None _ f , qr ) -> updFail f qr
(pr , _ ) -> pr
process f [] [] = seq f (None False f)
process f [(b,k,as)] [] = seq f (One b k as f)
process f rs [] = seq f (Many rs f)
process f rs (w@(None True _):_) = seq f w
process f rs (None False f':rws) = process (bestFailAt f f') rs rws
process f rs (One b k as f':rws) = process (bestFailAt f f') (rs++[(b,k,as)]) rws
process f rs (Many rs' f' :rws) = process (bestFailAt f f') (rs++rs') rws
doMany g cas f = Many [ (g c, n, as) | (c,n,as) <- cas] f
-- Sequence
(+.+) :: Parser a b -> Parser a c -> Parser a (b,c)
p +.+ q =
\as n->
case p as n of
None w f -> None w f
One b n' as' f ->
case q as' n' of
None w f' -> None w (bestFailAt f f')
One c n'' as'' f' -> One (b,c) n'' as'' (bestFailAt f f')
Many cas f' -> doMany (\x->(b,x)) cas (bestFailAt f f')
Many bas f ->
let rss = [ case q as' n' of { None w f -> None w f;
One c n'' as'' f' -> One (b,c) n'' as'' f';
Many cas f' -> doMany (\x->(b,x)) cas f' }
| (b,n',as') <- bas ]
in process f [] rss
-- Sequence, throw away first part
(..+) :: Parser a b -> Parser a c -> Parser a c
p ..+ q = -- p +.+ q `act` snd
\as n->
case p as n of
None w f -> None w f
One _ n' as' f -> updFail f (q as' n')
Many bas f -> process f [] [ q as' n' | (_,n',as') <- bas ]
-- Sequence, throw away second part
(+..) :: Parser a b -> Parser a c -> Parser a b
p +.. q = -- p +.+ q `act` fst
\as n->
case p as n of
None w f -> None w f
One b n' as' f ->
case q as' n' of
None w f' -> None w (bestFailAt f f')
One _ n'' as'' f' -> One b n'' as'' (bestFailAt f f')
Many cas f' -> doMany (const b) cas (bestFailAt f f')
Many bas f ->
let rss = [ case q as' n' of { None w f -> None w f;
One _ n'' as'' f' -> One b n'' as'' f';
Many cas f' -> doMany (const b) cas f' }
| (b,n',as') <- bas ]
in process f [] rss
-- Return a fixed value
(.>) :: Parser a b -> c -> Parser a c
p .> v =
\as n->
case p as n of
None w f -> None w f
One _ n' as' f' -> One v n' as' f'
Many bas f -> doMany (const v) bas f
-- Action
act :: Parser a b -> (b->c) -> Parser a c
p `act` f = \as n->
case p as n of
None w f -> None w f
One b n as' ff -> One (f b) n as' ff
Many bas ff -> doMany f bas ff
-- Action on two items
(>>>) :: Parser a (b,c) -> (b->c->d) -> Parser a d
p >>> f = \as n->
case p as n of
None w ff -> None w ff
One (b,c) n as' ff -> One (f b c) n as' ff
Many bas ff -> doMany (\ (x,y)->f x y) bas ff
-- Use value
into :: Parser a b -> (b -> Parser a c) -> Parser a c
p `into` fq = \as n ->
case p as n of
None w f -> None w f
One b n' as' f -> updFail f (fq b as' n')
Many bas f -> process f [] [ fq b as' n' | (b,n',as') <- bas ]
-- Succeeds with a value
succeed :: b -> Parser a b
succeed v = \as n -> One v n as noFail
-- Always fails.
failP :: ErrMsg -> Parser a b
failP s = \as n -> None False (FailAt n [s] as)
-- Fail completely if parsing proceeds a bit and then fails
mustAll :: Parser a b -> Parser a b
mustAll p = \as n->
case p as n of
None False f@(FailAt x _ _) | x/=n -> None True f
r -> r
-- If first alternative gives partial parse it's a failure
p |!! q = mustAll p ||! q
-- Kleene star
many :: Parser a b -> Parser a [b]
many p = p `into` (\v-> many p `act` (v:))
||! succeed []
many1 :: Parser a b -> Parser a [b]
many1 p = p `into` (\v-> many p `act` (v:))
-- Parse an exact number of items
count :: Parser a b -> Int -> Parser a [b]
count p 0 = succeed []
count p k = p +.+ count p (k-1) >>> (:)
-- Non-empty sequence of items separated by something
sepBy1 :: Parser a b -> Parser a c -> Parser a [b]
p `sepBy1` q = p `into` (\v-> many (q ..+ p) `act` (v:)) -- p +.+ many (q ..+ p) >>> (:) is slower
-- Sequence of items separated by something
sepBy :: Parser a b -> Parser a c -> Parser a [b]
p `sepBy` q = p `sepBy1` q
||! succeed []
-- Recognize a literal token
lit :: (Eq a, Show a) => a -> Parser [a] a
lit x = \as n ->
case as of
a:as' | a==x -> One a (n+1) as' noFail
_ -> None False (FailAt n [show x] as)
-- Recognize a token with a predicate
litp :: ErrMsg -> (a->Bool) -> Parser [a] a
litp s p = \as n->
case as of
a:as' | p a -> One a (n+1) as' noFail
_ -> None False (FailAt n [s] as)
-- Generic token recognizer
token :: (a -> Either ErrMsg (b,a)) -> Parser a b
token f = \as n->
case f as of
Left s -> None False (FailAt n [s] as)
Right (b, as') -> One b (n+1) as' noFail
-- Test a semantic value
testp :: String -> (b->Bool) -> Parser a b -> Parser a b
testp s tst p = \ as n ->
case p as n of
None w f -> None w f
o@(One b _ _ _) -> if tst b then o else None False (FailAt n [s] as)
Many bas f ->
case [ r | r@(b, _, _) <- bas, tst b] of
[] -> None False (FailAt n [s] as)
[(x,y,z)] -> One x y z f
rs -> Many rs f
-- Try error recovery.
recover :: Parser a b -> ([ErrMsg] -> a -> Maybe (a, b)) -> Parser a b
recover p f = \ as n ->
case p as n of
r@(None _ fa@(FailAt n ss ts)) ->
case f ss ts of
Nothing -> r
Just (a, b) -> One b (n+1) a fa
r -> r
-- Parse, and check if it was ok.
parse :: Parser a b -> a -> Either ([ErrMsg],a) [(b, a)]
parse p as =
case p as 0 of
None w (FailAt _ ss ts) -> Left (ss,ts)
One b _ ts _ -> Right [(b,ts)]
Many bas _ -> Right [(b,ts) | (b,_,ts) <- bas ]
sParse :: (Show a) => Parser [a] b -> [a] -> Either String b
sParse p as =
case parse p as of
Left (ss,ts) -> Left ("Parse failed at token "++pshow ts++", expected "++unwords ss++"\n")
where pshow [] = "<EOF>"
pshow (t:_) = show t
Right ((b,[]):_) -> Right b
Right ((_,t:_):_) -> Left ("Parse failed at token "++show t++", expected <EOF>\n")
simpleParse :: (Show a) => Parser [a] b -> [a] -> b
simpleParse p as =
case sParse p as of
Left msg -> error msg
Right x -> x
|
jwaldmann/rx
|
src/Parse.hs
|
gpl-3.0
| 8,506
| 78
| 23
| 2,667
| 4,424
| 2,294
| 2,130
| 193
| 7
|
module Test.Benchmark.Function where
import Text.Printf
import Data.Time
import System.IO
import Data.Char
import System.Random
runData f = do
randomChar <- randomIO
if (last (show f)) == randomChar then return () else return ()
timeAction action = do
t1 <- getCurrentTime
g <- action
t2 <- getCurrentTime
let timeInUnits = (realToFrac $ diffUTCTime t2 t1 :: Float)
return timeInUnits
timeData d = timeAction (runData d)
timeAndPrintData d = timeAndPrintAction (runData d)
timeAndPrintAction action = do
time <- timeAction action
printf "%f\n" time
|
xpika/Benchmark-Function
|
Test/Benchmark/Function.hs
|
gpl-3.0
| 577
| 0
| 12
| 108
| 203
| 99
| 104
| 20
| 2
|
module System.DevUtils.Base.Url.Auth (
Auth(..),
defaultAuth
) where
data Auth = Auth {
_user :: String,
_pass :: Maybe String
} deriving (Show, Read)
defaultAuth :: Auth
defaultAuth = Auth { _user = "unknown", _pass = Nothing }
|
adarqui/DevUtils-Base
|
src/System/DevUtils/Base/Url/Auth.hs
|
gpl-3.0
| 235
| 0
| 9
| 43
| 80
| 50
| 30
| 9
| 1
|
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- |
-- Module : Network.Google.Resource.File.Projects.Locations.List
-- Copyright : (c) 2015-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists information about the supported locations for this service.
--
-- /See:/ <https://cloud.google.com/filestore/ Cloud Filestore API Reference> for @file.projects.locations.list@.
module Network.Google.Resource.File.Projects.Locations.List
(
-- * REST Resource
ProjectsLocationsListResource
-- * Creating a Request
, projectsLocationsList
, ProjectsLocationsList
-- * Request Lenses
, pllXgafv
, pllUploadProtocol
, pllAccessToken
, pllUploadType
, pllName
, pllFilter
, pllPageToken
, pllPageSize
, pllCallback
, pllIncludeUnrevealedLocations
) where
import Network.Google.File.Types
import Network.Google.Prelude
-- | A resource alias for @file.projects.locations.list@ method which the
-- 'ProjectsLocationsList' request conforms to.
type ProjectsLocationsListResource =
"v1" :>
Capture "name" Text :>
"locations" :>
QueryParam "$.xgafv" Xgafv :>
QueryParam "upload_protocol" Text :>
QueryParam "access_token" Text :>
QueryParam "uploadType" Text :>
QueryParam "filter" Text :>
QueryParam "pageToken" Text :>
QueryParam "pageSize" (Textual Int32) :>
QueryParam "callback" Text :>
QueryParam "includeUnrevealedLocations" Bool :>
QueryParam "alt" AltJSON :>
Get '[JSON] ListLocationsResponse
-- | Lists information about the supported locations for this service.
--
-- /See:/ 'projectsLocationsList' smart constructor.
data ProjectsLocationsList =
ProjectsLocationsList'
{ _pllXgafv :: !(Maybe Xgafv)
, _pllUploadProtocol :: !(Maybe Text)
, _pllAccessToken :: !(Maybe Text)
, _pllUploadType :: !(Maybe Text)
, _pllName :: !Text
, _pllFilter :: !(Maybe Text)
, _pllPageToken :: !(Maybe Text)
, _pllPageSize :: !(Maybe (Textual Int32))
, _pllCallback :: !(Maybe Text)
, _pllIncludeUnrevealedLocations :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ProjectsLocationsList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pllXgafv'
--
-- * 'pllUploadProtocol'
--
-- * 'pllAccessToken'
--
-- * 'pllUploadType'
--
-- * 'pllName'
--
-- * 'pllFilter'
--
-- * 'pllPageToken'
--
-- * 'pllPageSize'
--
-- * 'pllCallback'
--
-- * 'pllIncludeUnrevealedLocations'
projectsLocationsList
:: Text -- ^ 'pllName'
-> ProjectsLocationsList
projectsLocationsList pPllName_ =
ProjectsLocationsList'
{ _pllXgafv = Nothing
, _pllUploadProtocol = Nothing
, _pllAccessToken = Nothing
, _pllUploadType = Nothing
, _pllName = pPllName_
, _pllFilter = Nothing
, _pllPageToken = Nothing
, _pllPageSize = Nothing
, _pllCallback = Nothing
, _pllIncludeUnrevealedLocations = Nothing
}
-- | V1 error format.
pllXgafv :: Lens' ProjectsLocationsList (Maybe Xgafv)
pllXgafv = lens _pllXgafv (\ s a -> s{_pllXgafv = a})
-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pllUploadProtocol :: Lens' ProjectsLocationsList (Maybe Text)
pllUploadProtocol
= lens _pllUploadProtocol
(\ s a -> s{_pllUploadProtocol = a})
-- | OAuth access token.
pllAccessToken :: Lens' ProjectsLocationsList (Maybe Text)
pllAccessToken
= lens _pllAccessToken
(\ s a -> s{_pllAccessToken = a})
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
pllUploadType :: Lens' ProjectsLocationsList (Maybe Text)
pllUploadType
= lens _pllUploadType
(\ s a -> s{_pllUploadType = a})
-- | The resource that owns the locations collection, if applicable.
pllName :: Lens' ProjectsLocationsList Text
pllName = lens _pllName (\ s a -> s{_pllName = a})
-- | A filter to narrow down results to a preferred subset. The filtering
-- language accepts strings like \"displayName=tokyo\", and is documented
-- in more detail in [AIP-160](https:\/\/google.aip.dev\/160).
pllFilter :: Lens' ProjectsLocationsList (Maybe Text)
pllFilter
= lens _pllFilter (\ s a -> s{_pllFilter = a})
-- | A page token received from the \`next_page_token\` field in the
-- response. Send that page token to receive the subsequent page.
pllPageToken :: Lens' ProjectsLocationsList (Maybe Text)
pllPageToken
= lens _pllPageToken (\ s a -> s{_pllPageToken = a})
-- | The maximum number of results to return. If not set, the service selects
-- a default.
pllPageSize :: Lens' ProjectsLocationsList (Maybe Int32)
pllPageSize
= lens _pllPageSize (\ s a -> s{_pllPageSize = a}) .
mapping _Coerce
-- | JSONP
pllCallback :: Lens' ProjectsLocationsList (Maybe Text)
pllCallback
= lens _pllCallback (\ s a -> s{_pllCallback = a})
-- | If true, the returned list will include locations which are not yet
-- revealed.
pllIncludeUnrevealedLocations :: Lens' ProjectsLocationsList (Maybe Bool)
pllIncludeUnrevealedLocations
= lens _pllIncludeUnrevealedLocations
(\ s a -> s{_pllIncludeUnrevealedLocations = a})
instance GoogleRequest ProjectsLocationsList where
type Rs ProjectsLocationsList = ListLocationsResponse
type Scopes ProjectsLocationsList =
'["https://www.googleapis.com/auth/cloud-platform"]
requestClient ProjectsLocationsList'{..}
= go _pllName _pllXgafv _pllUploadProtocol
_pllAccessToken
_pllUploadType
_pllFilter
_pllPageToken
_pllPageSize
_pllCallback
_pllIncludeUnrevealedLocations
(Just AltJSON)
fileService
where go
= buildClient
(Proxy :: Proxy ProjectsLocationsListResource)
mempty
|
brendanhay/gogol
|
gogol-file/gen/Network/Google/Resource/File/Projects/Locations/List.hs
|
mpl-2.0
| 6,662
| 0
| 20
| 1,558
| 1,043
| 602
| 441
| 144
| 1
|
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- |
-- Module : Network.Google.DFAReporting.Types.Product
-- Copyright : (c) 2015-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
module Network.Google.DFAReporting.Types.Product where
import Network.Google.DFAReporting.Types.Sum
import Network.Google.Prelude
-- | Video Offset
--
-- /See:/ 'videoOffSet' smart constructor.
data VideoOffSet =
VideoOffSet'
{ _vosOffSetPercentage :: !(Maybe (Textual Int32))
, _vosOffSetSeconds :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'VideoOffSet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vosOffSetPercentage'
--
-- * 'vosOffSetSeconds'
videoOffSet
:: VideoOffSet
videoOffSet =
VideoOffSet' {_vosOffSetPercentage = Nothing, _vosOffSetSeconds = Nothing}
-- | Duration, as a percentage of video duration. Do not set when
-- offsetSeconds is set. Acceptable values are 0 to 100, inclusive.
vosOffSetPercentage :: Lens' VideoOffSet (Maybe Int32)
vosOffSetPercentage
= lens _vosOffSetPercentage
(\ s a -> s{_vosOffSetPercentage = a})
. mapping _Coerce
-- | Duration, in seconds. Do not set when offsetPercentage is set.
-- Acceptable values are 0 to 86399, inclusive.
vosOffSetSeconds :: Lens' VideoOffSet (Maybe Int32)
vosOffSetSeconds
= lens _vosOffSetSeconds
(\ s a -> s{_vosOffSetSeconds = a})
. mapping _Coerce
instance FromJSON VideoOffSet where
parseJSON
= withObject "VideoOffSet"
(\ o ->
VideoOffSet' <$>
(o .:? "offsetPercentage") <*>
(o .:? "offsetSeconds"))
instance ToJSON VideoOffSet where
toJSON VideoOffSet'{..}
= object
(catMaybes
[("offsetPercentage" .=) <$> _vosOffSetPercentage,
("offsetSeconds" .=) <$> _vosOffSetSeconds])
-- | Contains information about a landing page deep link.
--
-- /See:/ 'deepLink' smart constructor.
data DeepLink =
DeepLink'
{ _dlRemarketingListIds :: !(Maybe [Textual Int64])
, _dlKind :: !(Maybe Text)
, _dlFallbackURL :: !(Maybe Text)
, _dlAppURL :: !(Maybe Text)
, _dlMobileApp :: !(Maybe MobileApp)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DeepLink' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dlRemarketingListIds'
--
-- * 'dlKind'
--
-- * 'dlFallbackURL'
--
-- * 'dlAppURL'
--
-- * 'dlMobileApp'
deepLink
:: DeepLink
deepLink =
DeepLink'
{ _dlRemarketingListIds = Nothing
, _dlKind = Nothing
, _dlFallbackURL = Nothing
, _dlAppURL = Nothing
, _dlMobileApp = Nothing
}
-- | Ads served to users on these remarketing lists will use this deep link.
-- Applicable when mobileApp.directory is APPLE_APP_STORE.
dlRemarketingListIds :: Lens' DeepLink [Int64]
dlRemarketingListIds
= lens _dlRemarketingListIds
(\ s a -> s{_dlRemarketingListIds = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#deepLink\".
dlKind :: Lens' DeepLink (Maybe Text)
dlKind = lens _dlKind (\ s a -> s{_dlKind = a})
-- | The fallback URL. This URL will be served to users who do not have the
-- mobile app installed.
dlFallbackURL :: Lens' DeepLink (Maybe Text)
dlFallbackURL
= lens _dlFallbackURL
(\ s a -> s{_dlFallbackURL = a})
-- | The URL of the mobile app being linked to.
dlAppURL :: Lens' DeepLink (Maybe Text)
dlAppURL = lens _dlAppURL (\ s a -> s{_dlAppURL = a})
-- | The mobile app targeted by this deep link.
dlMobileApp :: Lens' DeepLink (Maybe MobileApp)
dlMobileApp
= lens _dlMobileApp (\ s a -> s{_dlMobileApp = a})
instance FromJSON DeepLink where
parseJSON
= withObject "DeepLink"
(\ o ->
DeepLink' <$>
(o .:? "remarketingListIds" .!= mempty) <*>
(o .:? "kind")
<*> (o .:? "fallbackUrl")
<*> (o .:? "appUrl")
<*> (o .:? "mobileApp"))
instance ToJSON DeepLink where
toJSON DeepLink'{..}
= object
(catMaybes
[("remarketingListIds" .=) <$> _dlRemarketingListIds,
("kind" .=) <$> _dlKind,
("fallbackUrl" .=) <$> _dlFallbackURL,
("appUrl" .=) <$> _dlAppURL,
("mobileApp" .=) <$> _dlMobileApp])
-- | Represents a Disjunctive Match Statement resource, which is a
-- conjunction (and) of disjunctive (or) boolean statements.
--
-- /See:/ 'disjunctiveMatchStatement' smart constructor.
data DisjunctiveMatchStatement =
DisjunctiveMatchStatement'
{ _dmsEventFilters :: !(Maybe [EventFilter])
, _dmsKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DisjunctiveMatchStatement' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dmsEventFilters'
--
-- * 'dmsKind'
disjunctiveMatchStatement
:: DisjunctiveMatchStatement
disjunctiveMatchStatement =
DisjunctiveMatchStatement' {_dmsEventFilters = Nothing, _dmsKind = Nothing}
-- | The event filters contained within this disjunctive match statement.
dmsEventFilters :: Lens' DisjunctiveMatchStatement [EventFilter]
dmsEventFilters
= lens _dmsEventFilters
(\ s a -> s{_dmsEventFilters = a})
. _Default
. _Coerce
-- | The kind of resource this is, in this case
-- dfareporting#disjunctiveMatchStatement.
dmsKind :: Lens' DisjunctiveMatchStatement (Maybe Text)
dmsKind = lens _dmsKind (\ s a -> s{_dmsKind = a})
instance FromJSON DisjunctiveMatchStatement where
parseJSON
= withObject "DisjunctiveMatchStatement"
(\ o ->
DisjunctiveMatchStatement' <$>
(o .:? "eventFilters" .!= mempty) <*> (o .:? "kind"))
instance ToJSON DisjunctiveMatchStatement where
toJSON DisjunctiveMatchStatement'{..}
= object
(catMaybes
[("eventFilters" .=) <$> _dmsEventFilters,
("kind" .=) <$> _dmsKind])
-- | List of files for a report.
--
-- /See:/ 'fileList' smart constructor.
data FileList =
FileList'
{ _flEtag :: !(Maybe Text)
, _flNextPageToken :: !(Maybe Text)
, _flKind :: !(Maybe Text)
, _flItems :: !(Maybe [File])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FileList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'flEtag'
--
-- * 'flNextPageToken'
--
-- * 'flKind'
--
-- * 'flItems'
fileList
:: FileList
fileList =
FileList'
{ _flEtag = Nothing
, _flNextPageToken = Nothing
, _flKind = Nothing
, _flItems = Nothing
}
-- | Etag of this resource.
flEtag :: Lens' FileList (Maybe Text)
flEtag = lens _flEtag (\ s a -> s{_flEtag = a})
-- | Continuation token used to page through files. To retrieve the next page
-- of results, set the next request\'s \"pageToken\" to the value of this
-- field. The page token is only valid for a limited amount of time and
-- should not be persisted.
flNextPageToken :: Lens' FileList (Maybe Text)
flNextPageToken
= lens _flNextPageToken
(\ s a -> s{_flNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#fileList\".
flKind :: Lens' FileList (Maybe Text)
flKind = lens _flKind (\ s a -> s{_flKind = a})
-- | The files returned in this response.
flItems :: Lens' FileList [File]
flItems
= lens _flItems (\ s a -> s{_flItems = a}) . _Default
. _Coerce
instance FromJSON FileList where
parseJSON
= withObject "FileList"
(\ o ->
FileList' <$>
(o .:? "etag") <*> (o .:? "nextPageToken") <*>
(o .:? "kind")
<*> (o .:? "items" .!= mempty))
instance ToJSON FileList where
toJSON FileList'{..}
= object
(catMaybes
[("etag" .=) <$> _flEtag,
("nextPageToken" .=) <$> _flNextPageToken,
("kind" .=) <$> _flKind, ("items" .=) <$> _flItems])
-- | Represents fields that are compatible to be selected for a report of
-- type \"PATH\".
--
-- /See:/ 'pathReportCompatibleFields' smart constructor.
data PathReportCompatibleFields =
PathReportCompatibleFields'
{ _prcfMetrics :: !(Maybe [Metric])
, _prcfChannelGroupings :: !(Maybe [Dimension])
, _prcfKind :: !(Maybe Text)
, _prcfPathFilters :: !(Maybe [Dimension])
, _prcfDimensions :: !(Maybe [Dimension])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PathReportCompatibleFields' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'prcfMetrics'
--
-- * 'prcfChannelGroupings'
--
-- * 'prcfKind'
--
-- * 'prcfPathFilters'
--
-- * 'prcfDimensions'
pathReportCompatibleFields
:: PathReportCompatibleFields
pathReportCompatibleFields =
PathReportCompatibleFields'
{ _prcfMetrics = Nothing
, _prcfChannelGroupings = Nothing
, _prcfKind = Nothing
, _prcfPathFilters = Nothing
, _prcfDimensions = Nothing
}
-- | Metrics which are compatible to be selected in the \"metricNames\"
-- section of the report.
prcfMetrics :: Lens' PathReportCompatibleFields [Metric]
prcfMetrics
= lens _prcfMetrics (\ s a -> s{_prcfMetrics = a}) .
_Default
. _Coerce
-- | Dimensions which are compatible to be selected in the
-- \"channelGroupings\" section of the report.
prcfChannelGroupings :: Lens' PathReportCompatibleFields [Dimension]
prcfChannelGroupings
= lens _prcfChannelGroupings
(\ s a -> s{_prcfChannelGroupings = a})
. _Default
. _Coerce
-- | The kind of resource this is, in this case
-- dfareporting#pathReportCompatibleFields.
prcfKind :: Lens' PathReportCompatibleFields (Maybe Text)
prcfKind = lens _prcfKind (\ s a -> s{_prcfKind = a})
-- | Dimensions which are compatible to be selected in the \"pathFilters\"
-- section of the report.
prcfPathFilters :: Lens' PathReportCompatibleFields [Dimension]
prcfPathFilters
= lens _prcfPathFilters
(\ s a -> s{_prcfPathFilters = a})
. _Default
. _Coerce
-- | Dimensions which are compatible to be selected in the \"dimensions\"
-- section of the report.
prcfDimensions :: Lens' PathReportCompatibleFields [Dimension]
prcfDimensions
= lens _prcfDimensions
(\ s a -> s{_prcfDimensions = a})
. _Default
. _Coerce
instance FromJSON PathReportCompatibleFields where
parseJSON
= withObject "PathReportCompatibleFields"
(\ o ->
PathReportCompatibleFields' <$>
(o .:? "metrics" .!= mempty) <*>
(o .:? "channelGroupings" .!= mempty)
<*> (o .:? "kind")
<*> (o .:? "pathFilters" .!= mempty)
<*> (o .:? "dimensions" .!= mempty))
instance ToJSON PathReportCompatibleFields where
toJSON PathReportCompatibleFields'{..}
= object
(catMaybes
[("metrics" .=) <$> _prcfMetrics,
("channelGroupings" .=) <$> _prcfChannelGroupings,
("kind" .=) <$> _prcfKind,
("pathFilters" .=) <$> _prcfPathFilters,
("dimensions" .=) <$> _prcfDimensions])
-- | Creative optimization activity.
--
-- /See:/ 'optimizationActivity' smart constructor.
data OptimizationActivity =
OptimizationActivity'
{ _oaWeight :: !(Maybe (Textual Int32))
, _oaFloodlightActivityId :: !(Maybe (Textual Int64))
, _oaFloodlightActivityIdDimensionValue :: !(Maybe DimensionValue)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OptimizationActivity' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oaWeight'
--
-- * 'oaFloodlightActivityId'
--
-- * 'oaFloodlightActivityIdDimensionValue'
optimizationActivity
:: OptimizationActivity
optimizationActivity =
OptimizationActivity'
{ _oaWeight = Nothing
, _oaFloodlightActivityId = Nothing
, _oaFloodlightActivityIdDimensionValue = Nothing
}
-- | Weight associated with this optimization. The weight assigned will be
-- understood in proportion to the weights assigned to the other
-- optimization activities. Value must be greater than or equal to 1.
oaWeight :: Lens' OptimizationActivity (Maybe Int32)
oaWeight
= lens _oaWeight (\ s a -> s{_oaWeight = a}) .
mapping _Coerce
-- | Floodlight activity ID of this optimization activity. This is a required
-- field.
oaFloodlightActivityId :: Lens' OptimizationActivity (Maybe Int64)
oaFloodlightActivityId
= lens _oaFloodlightActivityId
(\ s a -> s{_oaFloodlightActivityId = a})
. mapping _Coerce
-- | Dimension value for the ID of the floodlight activity. This is a
-- read-only, auto-generated field.
oaFloodlightActivityIdDimensionValue :: Lens' OptimizationActivity (Maybe DimensionValue)
oaFloodlightActivityIdDimensionValue
= lens _oaFloodlightActivityIdDimensionValue
(\ s a ->
s{_oaFloodlightActivityIdDimensionValue = a})
instance FromJSON OptimizationActivity where
parseJSON
= withObject "OptimizationActivity"
(\ o ->
OptimizationActivity' <$>
(o .:? "weight") <*> (o .:? "floodlightActivityId")
<*> (o .:? "floodlightActivityIdDimensionValue"))
instance ToJSON OptimizationActivity where
toJSON OptimizationActivity'{..}
= object
(catMaybes
[("weight" .=) <$> _oaWeight,
("floodlightActivityId" .=) <$>
_oaFloodlightActivityId,
("floodlightActivityIdDimensionValue" .=) <$>
_oaFloodlightActivityIdDimensionValue])
-- | A group clause made up of list population terms representing constraints
-- joined by ORs.
--
-- /See:/ 'listPopulationClause' smart constructor.
newtype ListPopulationClause =
ListPopulationClause'
{ _lpcTerms :: Maybe [ListPopulationTerm]
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ListPopulationClause' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lpcTerms'
listPopulationClause
:: ListPopulationClause
listPopulationClause = ListPopulationClause' {_lpcTerms = Nothing}
-- | Terms of this list population clause. Each clause is made up of list
-- population terms representing constraints and are joined by ORs.
lpcTerms :: Lens' ListPopulationClause [ListPopulationTerm]
lpcTerms
= lens _lpcTerms (\ s a -> s{_lpcTerms = a}) .
_Default
. _Coerce
instance FromJSON ListPopulationClause where
parseJSON
= withObject "ListPopulationClause"
(\ o ->
ListPopulationClause' <$> (o .:? "terms" .!= mempty))
instance ToJSON ListPopulationClause where
toJSON ListPopulationClause'{..}
= object (catMaybes [("terms" .=) <$> _lpcTerms])
-- | Campaign ad blocking settings.
--
-- /See:/ 'adBlockingConfiguration' smart constructor.
newtype AdBlockingConfiguration =
AdBlockingConfiguration'
{ _abcEnabled :: Maybe Bool
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AdBlockingConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'abcEnabled'
adBlockingConfiguration
:: AdBlockingConfiguration
adBlockingConfiguration = AdBlockingConfiguration' {_abcEnabled = Nothing}
-- | Whether this campaign has enabled ad blocking. When true, ad blocking is
-- enabled for placements in the campaign, but this may be overridden by
-- site and placement settings. When false, ad blocking is disabled for all
-- placements under the campaign, regardless of site and placement
-- settings.
abcEnabled :: Lens' AdBlockingConfiguration (Maybe Bool)
abcEnabled
= lens _abcEnabled (\ s a -> s{_abcEnabled = a})
instance FromJSON AdBlockingConfiguration where
parseJSON
= withObject "AdBlockingConfiguration"
(\ o ->
AdBlockingConfiguration' <$> (o .:? "enabled"))
instance ToJSON AdBlockingConfiguration where
toJSON AdBlockingConfiguration'{..}
= object (catMaybes [("enabled" .=) <$> _abcEnabled])
-- | Creative Custom Event.
--
-- /See:/ 'creativeCustomEvent' smart constructor.
data CreativeCustomEvent =
CreativeCustomEvent'
{ _cceAdvertiserCustomEventId :: !(Maybe (Textual Int64))
, _cceAdvertiserCustomEventType :: !(Maybe CreativeCustomEventAdvertiserCustomEventType)
, _cceAdvertiserCustomEventName :: !(Maybe Text)
, _cceExitClickThroughURL :: !(Maybe CreativeClickThroughURL)
, _cceTargetType :: !(Maybe CreativeCustomEventTargetType)
, _ccePopupWindowProperties :: !(Maybe PopupWindowProperties)
, _cceVideoReportingId :: !(Maybe Text)
, _cceId :: !(Maybe (Textual Int64))
, _cceArtworkLabel :: !(Maybe Text)
, _cceArtworkType :: !(Maybe CreativeCustomEventArtworkType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeCustomEvent' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cceAdvertiserCustomEventId'
--
-- * 'cceAdvertiserCustomEventType'
--
-- * 'cceAdvertiserCustomEventName'
--
-- * 'cceExitClickThroughURL'
--
-- * 'cceTargetType'
--
-- * 'ccePopupWindowProperties'
--
-- * 'cceVideoReportingId'
--
-- * 'cceId'
--
-- * 'cceArtworkLabel'
--
-- * 'cceArtworkType'
creativeCustomEvent
:: CreativeCustomEvent
creativeCustomEvent =
CreativeCustomEvent'
{ _cceAdvertiserCustomEventId = Nothing
, _cceAdvertiserCustomEventType = Nothing
, _cceAdvertiserCustomEventName = Nothing
, _cceExitClickThroughURL = Nothing
, _cceTargetType = Nothing
, _ccePopupWindowProperties = Nothing
, _cceVideoReportingId = Nothing
, _cceId = Nothing
, _cceArtworkLabel = Nothing
, _cceArtworkType = Nothing
}
-- | Unique ID of this event used by Reporting and Data Transfer. This is a
-- read-only field.
cceAdvertiserCustomEventId :: Lens' CreativeCustomEvent (Maybe Int64)
cceAdvertiserCustomEventId
= lens _cceAdvertiserCustomEventId
(\ s a -> s{_cceAdvertiserCustomEventId = a})
. mapping _Coerce
-- | Type of the event. This is a read-only field.
cceAdvertiserCustomEventType :: Lens' CreativeCustomEvent (Maybe CreativeCustomEventAdvertiserCustomEventType)
cceAdvertiserCustomEventType
= lens _cceAdvertiserCustomEventType
(\ s a -> s{_cceAdvertiserCustomEventType = a})
-- | User-entered name for the event.
cceAdvertiserCustomEventName :: Lens' CreativeCustomEvent (Maybe Text)
cceAdvertiserCustomEventName
= lens _cceAdvertiserCustomEventName
(\ s a -> s{_cceAdvertiserCustomEventName = a})
-- | Exit click-through URL for the event. This field is used only for exit
-- events.
cceExitClickThroughURL :: Lens' CreativeCustomEvent (Maybe CreativeClickThroughURL)
cceExitClickThroughURL
= lens _cceExitClickThroughURL
(\ s a -> s{_cceExitClickThroughURL = a})
-- | Target type used by the event.
cceTargetType :: Lens' CreativeCustomEvent (Maybe CreativeCustomEventTargetType)
cceTargetType
= lens _cceTargetType
(\ s a -> s{_cceTargetType = a})
-- | Properties for rich media popup windows. This field is used only for
-- exit events.
ccePopupWindowProperties :: Lens' CreativeCustomEvent (Maybe PopupWindowProperties)
ccePopupWindowProperties
= lens _ccePopupWindowProperties
(\ s a -> s{_ccePopupWindowProperties = a})
-- | Video reporting ID, used to differentiate multiple videos in a single
-- creative. This is a read-only field.
cceVideoReportingId :: Lens' CreativeCustomEvent (Maybe Text)
cceVideoReportingId
= lens _cceVideoReportingId
(\ s a -> s{_cceVideoReportingId = a})
-- | ID of this event. This is a required field and should not be modified
-- after insertion.
cceId :: Lens' CreativeCustomEvent (Maybe Int64)
cceId
= lens _cceId (\ s a -> s{_cceId = a}) .
mapping _Coerce
-- | Artwork label column, used to link events in Campaign Manager back to
-- events in Studio. This is a required field and should not be modified
-- after insertion.
cceArtworkLabel :: Lens' CreativeCustomEvent (Maybe Text)
cceArtworkLabel
= lens _cceArtworkLabel
(\ s a -> s{_cceArtworkLabel = a})
-- | Artwork type used by the creative.This is a read-only field.
cceArtworkType :: Lens' CreativeCustomEvent (Maybe CreativeCustomEventArtworkType)
cceArtworkType
= lens _cceArtworkType
(\ s a -> s{_cceArtworkType = a})
instance FromJSON CreativeCustomEvent where
parseJSON
= withObject "CreativeCustomEvent"
(\ o ->
CreativeCustomEvent' <$>
(o .:? "advertiserCustomEventId") <*>
(o .:? "advertiserCustomEventType")
<*> (o .:? "advertiserCustomEventName")
<*> (o .:? "exitClickThroughUrl")
<*> (o .:? "targetType")
<*> (o .:? "popupWindowProperties")
<*> (o .:? "videoReportingId")
<*> (o .:? "id")
<*> (o .:? "artworkLabel")
<*> (o .:? "artworkType"))
instance ToJSON CreativeCustomEvent where
toJSON CreativeCustomEvent'{..}
= object
(catMaybes
[("advertiserCustomEventId" .=) <$>
_cceAdvertiserCustomEventId,
("advertiserCustomEventType" .=) <$>
_cceAdvertiserCustomEventType,
("advertiserCustomEventName" .=) <$>
_cceAdvertiserCustomEventName,
("exitClickThroughUrl" .=) <$>
_cceExitClickThroughURL,
("targetType" .=) <$> _cceTargetType,
("popupWindowProperties" .=) <$>
_ccePopupWindowProperties,
("videoReportingId" .=) <$> _cceVideoReportingId,
("id" .=) <$> _cceId,
("artworkLabel" .=) <$> _cceArtworkLabel,
("artworkType" .=) <$> _cceArtworkType])
-- | Creative Click Tag.
--
-- /See:/ 'clickTag' smart constructor.
data ClickTag =
ClickTag'
{ _ctClickThroughURL :: !(Maybe CreativeClickThroughURL)
, _ctName :: !(Maybe Text)
, _ctEventName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ClickTag' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ctClickThroughURL'
--
-- * 'ctName'
--
-- * 'ctEventName'
clickTag
:: ClickTag
clickTag =
ClickTag'
{_ctClickThroughURL = Nothing, _ctName = Nothing, _ctEventName = Nothing}
-- | Parameter value for the specified click tag. This field contains a
-- click-through url.
ctClickThroughURL :: Lens' ClickTag (Maybe CreativeClickThroughURL)
ctClickThroughURL
= lens _ctClickThroughURL
(\ s a -> s{_ctClickThroughURL = a})
-- | Parameter name for the specified click tag. For DISPLAY_IMAGE_GALLERY
-- creative assets, this field must match the value of the creative
-- asset\'s creativeAssetId.name field.
ctName :: Lens' ClickTag (Maybe Text)
ctName = lens _ctName (\ s a -> s{_ctName = a})
-- | Advertiser event name associated with the click tag. This field is used
-- by DISPLAY_IMAGE_GALLERY and HTML5_BANNER creatives. Applicable to
-- DISPLAY when the primary asset type is not HTML_IMAGE.
ctEventName :: Lens' ClickTag (Maybe Text)
ctEventName
= lens _ctEventName (\ s a -> s{_ctEventName = a})
instance FromJSON ClickTag where
parseJSON
= withObject "ClickTag"
(\ o ->
ClickTag' <$>
(o .:? "clickThroughUrl") <*> (o .:? "name") <*>
(o .:? "eventName"))
instance ToJSON ClickTag where
toJSON ClickTag'{..}
= object
(catMaybes
[("clickThroughUrl" .=) <$> _ctClickThroughURL,
("name" .=) <$> _ctName,
("eventName" .=) <$> _ctEventName])
-- | Campaign List Response
--
-- /See:/ 'campaignsListResponse' smart constructor.
data CampaignsListResponse =
CampaignsListResponse'
{ _clrNextPageToken :: !(Maybe Text)
, _clrCampaigns :: !(Maybe [Campaign])
, _clrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CampaignsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'clrNextPageToken'
--
-- * 'clrCampaigns'
--
-- * 'clrKind'
campaignsListResponse
:: CampaignsListResponse
campaignsListResponse =
CampaignsListResponse'
{_clrNextPageToken = Nothing, _clrCampaigns = Nothing, _clrKind = Nothing}
-- | Pagination token to be used for the next list operation.
clrNextPageToken :: Lens' CampaignsListResponse (Maybe Text)
clrNextPageToken
= lens _clrNextPageToken
(\ s a -> s{_clrNextPageToken = a})
-- | Campaign collection.
clrCampaigns :: Lens' CampaignsListResponse [Campaign]
clrCampaigns
= lens _clrCampaigns (\ s a -> s{_clrCampaigns = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#campaignsListResponse\".
clrKind :: Lens' CampaignsListResponse (Maybe Text)
clrKind = lens _clrKind (\ s a -> s{_clrKind = a})
instance FromJSON CampaignsListResponse where
parseJSON
= withObject "CampaignsListResponse"
(\ o ->
CampaignsListResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "campaigns" .!= mempty)
<*> (o .:? "kind"))
instance ToJSON CampaignsListResponse where
toJSON CampaignsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _clrNextPageToken,
("campaigns" .=) <$> _clrCampaigns,
("kind" .=) <$> _clrKind])
-- | Geographical Targeting.
--
-- /See:/ 'geoTargeting' smart constructor.
data GeoTargeting =
GeoTargeting'
{ _gtRegions :: !(Maybe [Region])
, _gtCountries :: !(Maybe [Country])
, _gtCities :: !(Maybe [City])
, _gtMetros :: !(Maybe [Metro])
, _gtExcludeCountries :: !(Maybe Bool)
, _gtPostalCodes :: !(Maybe [PostalCode])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'GeoTargeting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gtRegions'
--
-- * 'gtCountries'
--
-- * 'gtCities'
--
-- * 'gtMetros'
--
-- * 'gtExcludeCountries'
--
-- * 'gtPostalCodes'
geoTargeting
:: GeoTargeting
geoTargeting =
GeoTargeting'
{ _gtRegions = Nothing
, _gtCountries = Nothing
, _gtCities = Nothing
, _gtMetros = Nothing
, _gtExcludeCountries = Nothing
, _gtPostalCodes = Nothing
}
-- | Regions to be targeted. For each region only dartId is required. The
-- other fields are populated automatically when the ad is inserted or
-- updated. If targeting a region, do not target or exclude the country of
-- the region.
gtRegions :: Lens' GeoTargeting [Region]
gtRegions
= lens _gtRegions (\ s a -> s{_gtRegions = a}) .
_Default
. _Coerce
-- | Countries to be targeted or excluded from targeting, depending on the
-- setting of the excludeCountries field. For each country only dartId is
-- required. The other fields are populated automatically when the ad is
-- inserted or updated. If targeting or excluding a country, do not target
-- regions, cities, metros, or postal codes in the same country.
gtCountries :: Lens' GeoTargeting [Country]
gtCountries
= lens _gtCountries (\ s a -> s{_gtCountries = a}) .
_Default
. _Coerce
-- | Cities to be targeted. For each city only dartId is required. The other
-- fields are populated automatically when the ad is inserted or updated.
-- If targeting a city, do not target or exclude the country of the city,
-- and do not target the metro or region of the city.
gtCities :: Lens' GeoTargeting [City]
gtCities
= lens _gtCities (\ s a -> s{_gtCities = a}) .
_Default
. _Coerce
-- | Metros to be targeted. For each metro only dmaId is required. The other
-- fields are populated automatically when the ad is inserted or updated.
-- If targeting a metro, do not target or exclude the country of the metro.
gtMetros :: Lens' GeoTargeting [Metro]
gtMetros
= lens _gtMetros (\ s a -> s{_gtMetros = a}) .
_Default
. _Coerce
-- | Whether or not to exclude the countries in the countries field from
-- targeting. If false, the countries field refers to countries which will
-- be targeted by the ad.
gtExcludeCountries :: Lens' GeoTargeting (Maybe Bool)
gtExcludeCountries
= lens _gtExcludeCountries
(\ s a -> s{_gtExcludeCountries = a})
-- | Postal codes to be targeted. For each postal code only id is required.
-- The other fields are populated automatically when the ad is inserted or
-- updated. If targeting a postal code, do not target or exclude the
-- country of the postal code.
gtPostalCodes :: Lens' GeoTargeting [PostalCode]
gtPostalCodes
= lens _gtPostalCodes
(\ s a -> s{_gtPostalCodes = a})
. _Default
. _Coerce
instance FromJSON GeoTargeting where
parseJSON
= withObject "GeoTargeting"
(\ o ->
GeoTargeting' <$>
(o .:? "regions" .!= mempty) <*>
(o .:? "countries" .!= mempty)
<*> (o .:? "cities" .!= mempty)
<*> (o .:? "metros" .!= mempty)
<*> (o .:? "excludeCountries")
<*> (o .:? "postalCodes" .!= mempty))
instance ToJSON GeoTargeting where
toJSON GeoTargeting'{..}
= object
(catMaybes
[("regions" .=) <$> _gtRegions,
("countries" .=) <$> _gtCountries,
("cities" .=) <$> _gtCities,
("metros" .=) <$> _gtMetros,
("excludeCountries" .=) <$> _gtExcludeCountries,
("postalCodes" .=) <$> _gtPostalCodes])
-- | Video Settings
--
-- /See:/ 'videoSettings' smart constructor.
data VideoSettings =
VideoSettings'
{ _vsKind :: !(Maybe Text)
, _vsCompanionSettings :: !(Maybe CompanionSetting)
, _vsObaSettings :: !(Maybe ObaIcon)
, _vsObaEnabled :: !(Maybe Bool)
, _vsTranscodeSettings :: !(Maybe TranscodeSetting)
, _vsDurationSeconds :: !(Maybe (Textual Int32))
, _vsOrientation :: !(Maybe VideoSettingsOrientation)
, _vsSkippableSettings :: !(Maybe SkippableSetting)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'VideoSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vsKind'
--
-- * 'vsCompanionSettings'
--
-- * 'vsObaSettings'
--
-- * 'vsObaEnabled'
--
-- * 'vsTranscodeSettings'
--
-- * 'vsDurationSeconds'
--
-- * 'vsOrientation'
--
-- * 'vsSkippableSettings'
videoSettings
:: VideoSettings
videoSettings =
VideoSettings'
{ _vsKind = Nothing
, _vsCompanionSettings = Nothing
, _vsObaSettings = Nothing
, _vsObaEnabled = Nothing
, _vsTranscodeSettings = Nothing
, _vsDurationSeconds = Nothing
, _vsOrientation = Nothing
, _vsSkippableSettings = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#videoSettings\".
vsKind :: Lens' VideoSettings (Maybe Text)
vsKind = lens _vsKind (\ s a -> s{_vsKind = a})
-- | Settings for the companion creatives of video creatives served to this
-- placement.
vsCompanionSettings :: Lens' VideoSettings (Maybe CompanionSetting)
vsCompanionSettings
= lens _vsCompanionSettings
(\ s a -> s{_vsCompanionSettings = a})
-- | Settings for the OBA icon of video creatives served to this placement.
-- If this object is provided, the creative-level OBA settings will be
-- overridden.
vsObaSettings :: Lens' VideoSettings (Maybe ObaIcon)
vsObaSettings
= lens _vsObaSettings
(\ s a -> s{_vsObaSettings = a})
-- | Whether OBA icons are enabled for this placement.
vsObaEnabled :: Lens' VideoSettings (Maybe Bool)
vsObaEnabled
= lens _vsObaEnabled (\ s a -> s{_vsObaEnabled = a})
-- | Settings for the transcodes of video creatives served to this placement.
-- If this object is provided, the creative-level transcode settings will
-- be overridden.
vsTranscodeSettings :: Lens' VideoSettings (Maybe TranscodeSetting)
vsTranscodeSettings
= lens _vsTranscodeSettings
(\ s a -> s{_vsTranscodeSettings = a})
-- | Duration of a video placement in seconds.
vsDurationSeconds :: Lens' VideoSettings (Maybe Int32)
vsDurationSeconds
= lens _vsDurationSeconds
(\ s a -> s{_vsDurationSeconds = a})
. mapping _Coerce
-- | Orientation of a video placement. If this value is set, placement will
-- return assets matching the specified orientation.
vsOrientation :: Lens' VideoSettings (Maybe VideoSettingsOrientation)
vsOrientation
= lens _vsOrientation
(\ s a -> s{_vsOrientation = a})
-- | Settings for the skippability of video creatives served to this
-- placement. If this object is provided, the creative-level skippable
-- settings will be overridden.
vsSkippableSettings :: Lens' VideoSettings (Maybe SkippableSetting)
vsSkippableSettings
= lens _vsSkippableSettings
(\ s a -> s{_vsSkippableSettings = a})
instance FromJSON VideoSettings where
parseJSON
= withObject "VideoSettings"
(\ o ->
VideoSettings' <$>
(o .:? "kind") <*> (o .:? "companionSettings") <*>
(o .:? "obaSettings")
<*> (o .:? "obaEnabled")
<*> (o .:? "transcodeSettings")
<*> (o .:? "durationSeconds")
<*> (o .:? "orientation")
<*> (o .:? "skippableSettings"))
instance ToJSON VideoSettings where
toJSON VideoSettings'{..}
= object
(catMaybes
[("kind" .=) <$> _vsKind,
("companionSettings" .=) <$> _vsCompanionSettings,
("obaSettings" .=) <$> _vsObaSettings,
("obaEnabled" .=) <$> _vsObaEnabled,
("transcodeSettings" .=) <$> _vsTranscodeSettings,
("durationSeconds" .=) <$> _vsDurationSeconds,
("orientation" .=) <$> _vsOrientation,
("skippableSettings" .=) <$> _vsSkippableSettings])
-- | Represents fields that are compatible to be selected for a report of
-- type \"REACH\".
--
-- /See:/ 'reachReportCompatibleFields' smart constructor.
data ReachReportCompatibleFields =
ReachReportCompatibleFields'
{ _rrcfMetrics :: !(Maybe [Metric])
, _rrcfReachByFrequencyMetrics :: !(Maybe [Metric])
, _rrcfKind :: !(Maybe Text)
, _rrcfDimensionFilters :: !(Maybe [Dimension])
, _rrcfPivotedActivityMetrics :: !(Maybe [Metric])
, _rrcfDimensions :: !(Maybe [Dimension])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReachReportCompatibleFields' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rrcfMetrics'
--
-- * 'rrcfReachByFrequencyMetrics'
--
-- * 'rrcfKind'
--
-- * 'rrcfDimensionFilters'
--
-- * 'rrcfPivotedActivityMetrics'
--
-- * 'rrcfDimensions'
reachReportCompatibleFields
:: ReachReportCompatibleFields
reachReportCompatibleFields =
ReachReportCompatibleFields'
{ _rrcfMetrics = Nothing
, _rrcfReachByFrequencyMetrics = Nothing
, _rrcfKind = Nothing
, _rrcfDimensionFilters = Nothing
, _rrcfPivotedActivityMetrics = Nothing
, _rrcfDimensions = Nothing
}
-- | Metrics which are compatible to be selected in the \"metricNames\"
-- section of the report.
rrcfMetrics :: Lens' ReachReportCompatibleFields [Metric]
rrcfMetrics
= lens _rrcfMetrics (\ s a -> s{_rrcfMetrics = a}) .
_Default
. _Coerce
-- | Metrics which are compatible to be selected in the
-- \"reachByFrequencyMetricNames\" section of the report.
rrcfReachByFrequencyMetrics :: Lens' ReachReportCompatibleFields [Metric]
rrcfReachByFrequencyMetrics
= lens _rrcfReachByFrequencyMetrics
(\ s a -> s{_rrcfReachByFrequencyMetrics = a})
. _Default
. _Coerce
-- | The kind of resource this is, in this case
-- dfareporting#reachReportCompatibleFields.
rrcfKind :: Lens' ReachReportCompatibleFields (Maybe Text)
rrcfKind = lens _rrcfKind (\ s a -> s{_rrcfKind = a})
-- | Dimensions which are compatible to be selected in the
-- \"dimensionFilters\" section of the report.
rrcfDimensionFilters :: Lens' ReachReportCompatibleFields [Dimension]
rrcfDimensionFilters
= lens _rrcfDimensionFilters
(\ s a -> s{_rrcfDimensionFilters = a})
. _Default
. _Coerce
-- | Metrics which are compatible to be selected as activity metrics to pivot
-- on in the \"activities\" section of the report.
rrcfPivotedActivityMetrics :: Lens' ReachReportCompatibleFields [Metric]
rrcfPivotedActivityMetrics
= lens _rrcfPivotedActivityMetrics
(\ s a -> s{_rrcfPivotedActivityMetrics = a})
. _Default
. _Coerce
-- | Dimensions which are compatible to be selected in the \"dimensions\"
-- section of the report.
rrcfDimensions :: Lens' ReachReportCompatibleFields [Dimension]
rrcfDimensions
= lens _rrcfDimensions
(\ s a -> s{_rrcfDimensions = a})
. _Default
. _Coerce
instance FromJSON ReachReportCompatibleFields where
parseJSON
= withObject "ReachReportCompatibleFields"
(\ o ->
ReachReportCompatibleFields' <$>
(o .:? "metrics" .!= mempty) <*>
(o .:? "reachByFrequencyMetrics" .!= mempty)
<*> (o .:? "kind")
<*> (o .:? "dimensionFilters" .!= mempty)
<*> (o .:? "pivotedActivityMetrics" .!= mempty)
<*> (o .:? "dimensions" .!= mempty))
instance ToJSON ReachReportCompatibleFields where
toJSON ReachReportCompatibleFields'{..}
= object
(catMaybes
[("metrics" .=) <$> _rrcfMetrics,
("reachByFrequencyMetrics" .=) <$>
_rrcfReachByFrequencyMetrics,
("kind" .=) <$> _rrcfKind,
("dimensionFilters" .=) <$> _rrcfDimensionFilters,
("pivotedActivityMetrics" .=) <$>
_rrcfPivotedActivityMetrics,
("dimensions" .=) <$> _rrcfDimensions])
-- | Contains information about a browser that can be targeted by ads.
--
-- /See:/ 'browser' smart constructor.
data Browser =
Browser'
{ _bMinorVersion :: !(Maybe Text)
, _bKind :: !(Maybe Text)
, _bBrowserVersionId :: !(Maybe (Textual Int64))
, _bMajorVersion :: !(Maybe Text)
, _bName :: !(Maybe Text)
, _bDartId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Browser' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bMinorVersion'
--
-- * 'bKind'
--
-- * 'bBrowserVersionId'
--
-- * 'bMajorVersion'
--
-- * 'bName'
--
-- * 'bDartId'
browser
:: Browser
browser =
Browser'
{ _bMinorVersion = Nothing
, _bKind = Nothing
, _bBrowserVersionId = Nothing
, _bMajorVersion = Nothing
, _bName = Nothing
, _bDartId = Nothing
}
-- | Minor version number (number after first dot on left) of this browser.
-- For example, for Chrome 5.0.375.86 beta, this field should be set to 0.
-- An asterisk (*) may be used to target any version number, and a question
-- mark (?) may be used to target cases where the version number cannot be
-- identified. For example, Chrome *.* targets any version of Chrome: 1.2,
-- 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0.
-- Firefox ?.? targets cases where the ad server knows the browser is
-- Firefox but can\'t tell which version it is.
bMinorVersion :: Lens' Browser (Maybe Text)
bMinorVersion
= lens _bMinorVersion
(\ s a -> s{_bMinorVersion = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#browser\".
bKind :: Lens' Browser (Maybe Text)
bKind = lens _bKind (\ s a -> s{_bKind = a})
-- | ID referring to this grouping of browser and version numbers. This is
-- the ID used for targeting.
bBrowserVersionId :: Lens' Browser (Maybe Int64)
bBrowserVersionId
= lens _bBrowserVersionId
(\ s a -> s{_bBrowserVersionId = a})
. mapping _Coerce
-- | Major version number (leftmost number) of this browser. For example, for
-- Chrome 5.0.376.86 beta, this field should be set to 5. An asterisk (*)
-- may be used to target any version number, and a question mark (?) may be
-- used to target cases where the version number cannot be identified. For
-- example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so
-- on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets
-- cases where the ad server knows the browser is Firefox but can\'t tell
-- which version it is.
bMajorVersion :: Lens' Browser (Maybe Text)
bMajorVersion
= lens _bMajorVersion
(\ s a -> s{_bMajorVersion = a})
-- | Name of this browser.
bName :: Lens' Browser (Maybe Text)
bName = lens _bName (\ s a -> s{_bName = a})
-- | DART ID of this browser. This is the ID used when generating reports.
bDartId :: Lens' Browser (Maybe Int64)
bDartId
= lens _bDartId (\ s a -> s{_bDartId = a}) .
mapping _Coerce
instance FromJSON Browser where
parseJSON
= withObject "Browser"
(\ o ->
Browser' <$>
(o .:? "minorVersion") <*> (o .:? "kind") <*>
(o .:? "browserVersionId")
<*> (o .:? "majorVersion")
<*> (o .:? "name")
<*> (o .:? "dartId"))
instance ToJSON Browser where
toJSON Browser'{..}
= object
(catMaybes
[("minorVersion" .=) <$> _bMinorVersion,
("kind" .=) <$> _bKind,
("browserVersionId" .=) <$> _bBrowserVersionId,
("majorVersion" .=) <$> _bMajorVersion,
("name" .=) <$> _bName, ("dartId" .=) <$> _bDartId])
-- | Creative Group Assignment.
--
-- /See:/ 'creativeGroupAssignment' smart constructor.
data CreativeGroupAssignment =
CreativeGroupAssignment'
{ _cgaCreativeGroupNumber :: !(Maybe CreativeGroupAssignmentCreativeGroupNumber)
, _cgaCreativeGroupId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeGroupAssignment' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cgaCreativeGroupNumber'
--
-- * 'cgaCreativeGroupId'
creativeGroupAssignment
:: CreativeGroupAssignment
creativeGroupAssignment =
CreativeGroupAssignment'
{_cgaCreativeGroupNumber = Nothing, _cgaCreativeGroupId = Nothing}
-- | Creative group number of the creative group assignment.
cgaCreativeGroupNumber :: Lens' CreativeGroupAssignment (Maybe CreativeGroupAssignmentCreativeGroupNumber)
cgaCreativeGroupNumber
= lens _cgaCreativeGroupNumber
(\ s a -> s{_cgaCreativeGroupNumber = a})
-- | ID of the creative group to be assigned.
cgaCreativeGroupId :: Lens' CreativeGroupAssignment (Maybe Int64)
cgaCreativeGroupId
= lens _cgaCreativeGroupId
(\ s a -> s{_cgaCreativeGroupId = a})
. mapping _Coerce
instance FromJSON CreativeGroupAssignment where
parseJSON
= withObject "CreativeGroupAssignment"
(\ o ->
CreativeGroupAssignment' <$>
(o .:? "creativeGroupNumber") <*>
(o .:? "creativeGroupId"))
instance ToJSON CreativeGroupAssignment where
toJSON CreativeGroupAssignment'{..}
= object
(catMaybes
[("creativeGroupNumber" .=) <$>
_cgaCreativeGroupNumber,
("creativeGroupId" .=) <$> _cgaCreativeGroupId])
-- | Directory Site Settings
--
-- /See:/ 'directorySiteSettings' smart constructor.
data DirectorySiteSettings =
DirectorySiteSettings'
{ _dssInterstitialPlacementAccepted :: !(Maybe Bool)
, _dssInstreamVideoPlacementAccepted :: !(Maybe Bool)
, _dssActiveViewOptOut :: !(Maybe Bool)
, _dssDfpSettings :: !(Maybe DfpSettings)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DirectorySiteSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dssInterstitialPlacementAccepted'
--
-- * 'dssInstreamVideoPlacementAccepted'
--
-- * 'dssActiveViewOptOut'
--
-- * 'dssDfpSettings'
directorySiteSettings
:: DirectorySiteSettings
directorySiteSettings =
DirectorySiteSettings'
{ _dssInterstitialPlacementAccepted = Nothing
, _dssInstreamVideoPlacementAccepted = Nothing
, _dssActiveViewOptOut = Nothing
, _dssDfpSettings = Nothing
}
-- | Whether this site accepts interstitial ads.
dssInterstitialPlacementAccepted :: Lens' DirectorySiteSettings (Maybe Bool)
dssInterstitialPlacementAccepted
= lens _dssInterstitialPlacementAccepted
(\ s a -> s{_dssInterstitialPlacementAccepted = a})
-- | Whether this site accepts in-stream video ads.
dssInstreamVideoPlacementAccepted :: Lens' DirectorySiteSettings (Maybe Bool)
dssInstreamVideoPlacementAccepted
= lens _dssInstreamVideoPlacementAccepted
(\ s a -> s{_dssInstreamVideoPlacementAccepted = a})
-- | Whether this directory site has disabled active view creatives.
dssActiveViewOptOut :: Lens' DirectorySiteSettings (Maybe Bool)
dssActiveViewOptOut
= lens _dssActiveViewOptOut
(\ s a -> s{_dssActiveViewOptOut = a})
-- | Directory site Ad Manager settings.
dssDfpSettings :: Lens' DirectorySiteSettings (Maybe DfpSettings)
dssDfpSettings
= lens _dssDfpSettings
(\ s a -> s{_dssDfpSettings = a})
instance FromJSON DirectorySiteSettings where
parseJSON
= withObject "DirectorySiteSettings"
(\ o ->
DirectorySiteSettings' <$>
(o .:? "interstitialPlacementAccepted") <*>
(o .:? "instreamVideoPlacementAccepted")
<*> (o .:? "activeViewOptOut")
<*> (o .:? "dfpSettings"))
instance ToJSON DirectorySiteSettings where
toJSON DirectorySiteSettings'{..}
= object
(catMaybes
[("interstitialPlacementAccepted" .=) <$>
_dssInterstitialPlacementAccepted,
("instreamVideoPlacementAccepted" .=) <$>
_dssInstreamVideoPlacementAccepted,
("activeViewOptOut" .=) <$> _dssActiveViewOptOut,
("dfpSettings" .=) <$> _dssDfpSettings])
-- | Online Behavioral Advertiser icon.
--
-- /See:/ 'obaIcon' smart constructor.
data ObaIcon =
ObaIcon'
{ _oiSize :: !(Maybe Size)
, _oiIconClickThroughURL :: !(Maybe Text)
, _oiYPosition :: !(Maybe Text)
, _oiIconClickTrackingURL :: !(Maybe Text)
, _oiXPosition :: !(Maybe Text)
, _oiProgram :: !(Maybe Text)
, _oiIconViewTrackingURL :: !(Maybe Text)
, _oiResourceURL :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ObaIcon' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oiSize'
--
-- * 'oiIconClickThroughURL'
--
-- * 'oiYPosition'
--
-- * 'oiIconClickTrackingURL'
--
-- * 'oiXPosition'
--
-- * 'oiProgram'
--
-- * 'oiIconViewTrackingURL'
--
-- * 'oiResourceURL'
obaIcon
:: ObaIcon
obaIcon =
ObaIcon'
{ _oiSize = Nothing
, _oiIconClickThroughURL = Nothing
, _oiYPosition = Nothing
, _oiIconClickTrackingURL = Nothing
, _oiXPosition = Nothing
, _oiProgram = Nothing
, _oiIconViewTrackingURL = Nothing
, _oiResourceURL = Nothing
}
-- | OBA icon size.
oiSize :: Lens' ObaIcon (Maybe Size)
oiSize = lens _oiSize (\ s a -> s{_oiSize = a})
-- | URL to redirect to when an OBA icon is clicked.
oiIconClickThroughURL :: Lens' ObaIcon (Maybe Text)
oiIconClickThroughURL
= lens _oiIconClickThroughURL
(\ s a -> s{_oiIconClickThroughURL = a})
-- | OBA icon y coordinate position. Accepted values are top or bottom.
oiYPosition :: Lens' ObaIcon (Maybe Text)
oiYPosition
= lens _oiYPosition (\ s a -> s{_oiYPosition = a})
-- | URL to track click when an OBA icon is clicked.
oiIconClickTrackingURL :: Lens' ObaIcon (Maybe Text)
oiIconClickTrackingURL
= lens _oiIconClickTrackingURL
(\ s a -> s{_oiIconClickTrackingURL = a})
-- | OBA icon x coordinate position. Accepted values are left or right.
oiXPosition :: Lens' ObaIcon (Maybe Text)
oiXPosition
= lens _oiXPosition (\ s a -> s{_oiXPosition = a})
-- | Identifies the industry initiative that the icon supports. For example,
-- AdChoices.
oiProgram :: Lens' ObaIcon (Maybe Text)
oiProgram
= lens _oiProgram (\ s a -> s{_oiProgram = a})
-- | URL to track view when an OBA icon is clicked.
oiIconViewTrackingURL :: Lens' ObaIcon (Maybe Text)
oiIconViewTrackingURL
= lens _oiIconViewTrackingURL
(\ s a -> s{_oiIconViewTrackingURL = a})
-- | OBA icon resource URL. Campaign Manager only supports image and
-- JavaScript icons. Learn more
oiResourceURL :: Lens' ObaIcon (Maybe Text)
oiResourceURL
= lens _oiResourceURL
(\ s a -> s{_oiResourceURL = a})
instance FromJSON ObaIcon where
parseJSON
= withObject "ObaIcon"
(\ o ->
ObaIcon' <$>
(o .:? "size") <*> (o .:? "iconClickThroughUrl") <*>
(o .:? "yPosition")
<*> (o .:? "iconClickTrackingUrl")
<*> (o .:? "xPosition")
<*> (o .:? "program")
<*> (o .:? "iconViewTrackingUrl")
<*> (o .:? "resourceUrl"))
instance ToJSON ObaIcon where
toJSON ObaIcon'{..}
= object
(catMaybes
[("size" .=) <$> _oiSize,
("iconClickThroughUrl" .=) <$>
_oiIconClickThroughURL,
("yPosition" .=) <$> _oiYPosition,
("iconClickTrackingUrl" .=) <$>
_oiIconClickTrackingURL,
("xPosition" .=) <$> _oiXPosition,
("program" .=) <$> _oiProgram,
("iconViewTrackingUrl" .=) <$>
_oiIconViewTrackingURL,
("resourceUrl" .=) <$> _oiResourceURL])
-- | Remarketing List Population Rule.
--
-- /See:/ 'listPopulationRule' smart constructor.
data ListPopulationRule =
ListPopulationRule'
{ _lprFloodlightActivityName :: !(Maybe Text)
, _lprFloodlightActivityId :: !(Maybe (Textual Int64))
, _lprListPopulationClauses :: !(Maybe [ListPopulationClause])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ListPopulationRule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lprFloodlightActivityName'
--
-- * 'lprFloodlightActivityId'
--
-- * 'lprListPopulationClauses'
listPopulationRule
:: ListPopulationRule
listPopulationRule =
ListPopulationRule'
{ _lprFloodlightActivityName = Nothing
, _lprFloodlightActivityId = Nothing
, _lprListPopulationClauses = Nothing
}
-- | Name of floodlight activity associated with this rule. This is a
-- read-only, auto-generated field.
lprFloodlightActivityName :: Lens' ListPopulationRule (Maybe Text)
lprFloodlightActivityName
= lens _lprFloodlightActivityName
(\ s a -> s{_lprFloodlightActivityName = a})
-- | Floodlight activity ID associated with this rule. This field can be left
-- blank.
lprFloodlightActivityId :: Lens' ListPopulationRule (Maybe Int64)
lprFloodlightActivityId
= lens _lprFloodlightActivityId
(\ s a -> s{_lprFloodlightActivityId = a})
. mapping _Coerce
-- | Clauses that make up this list population rule. Clauses are joined by
-- ANDs, and the clauses themselves are made up of list population terms
-- which are joined by ORs.
lprListPopulationClauses :: Lens' ListPopulationRule [ListPopulationClause]
lprListPopulationClauses
= lens _lprListPopulationClauses
(\ s a -> s{_lprListPopulationClauses = a})
. _Default
. _Coerce
instance FromJSON ListPopulationRule where
parseJSON
= withObject "ListPopulationRule"
(\ o ->
ListPopulationRule' <$>
(o .:? "floodlightActivityName") <*>
(o .:? "floodlightActivityId")
<*> (o .:? "listPopulationClauses" .!= mempty))
instance ToJSON ListPopulationRule where
toJSON ListPopulationRule'{..}
= object
(catMaybes
[("floodlightActivityName" .=) <$>
_lprFloodlightActivityName,
("floodlightActivityId" .=) <$>
_lprFloodlightActivityId,
("listPopulationClauses" .=) <$>
_lprListPopulationClauses])
-- | Size List Response
--
-- /See:/ 'sizesListResponse' smart constructor.
data SizesListResponse =
SizesListResponse'
{ _slrKind :: !(Maybe Text)
, _slrSizes :: !(Maybe [Size])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SizesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'slrKind'
--
-- * 'slrSizes'
sizesListResponse
:: SizesListResponse
sizesListResponse = SizesListResponse' {_slrKind = Nothing, _slrSizes = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#sizesListResponse\".
slrKind :: Lens' SizesListResponse (Maybe Text)
slrKind = lens _slrKind (\ s a -> s{_slrKind = a})
-- | Size collection.
slrSizes :: Lens' SizesListResponse [Size]
slrSizes
= lens _slrSizes (\ s a -> s{_slrSizes = a}) .
_Default
. _Coerce
instance FromJSON SizesListResponse where
parseJSON
= withObject "SizesListResponse"
(\ o ->
SizesListResponse' <$>
(o .:? "kind") <*> (o .:? "sizes" .!= mempty))
instance ToJSON SizesListResponse where
toJSON SizesListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _slrKind,
("sizes" .=) <$> _slrSizes])
-- | Creative Rotation.
--
-- /See:/ 'creativeRotation' smart constructor.
data CreativeRotation =
CreativeRotation'
{ _crWeightCalculationStrategy :: !(Maybe CreativeRotationWeightCalculationStrategy)
, _crCreativeAssignments :: !(Maybe [CreativeAssignment])
, _crCreativeOptimizationConfigurationId :: !(Maybe (Textual Int64))
, _crType :: !(Maybe CreativeRotationType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeRotation' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'crWeightCalculationStrategy'
--
-- * 'crCreativeAssignments'
--
-- * 'crCreativeOptimizationConfigurationId'
--
-- * 'crType'
creativeRotation
:: CreativeRotation
creativeRotation =
CreativeRotation'
{ _crWeightCalculationStrategy = Nothing
, _crCreativeAssignments = Nothing
, _crCreativeOptimizationConfigurationId = Nothing
, _crType = Nothing
}
-- | Strategy for calculating weights. Used with
-- CREATIVE_ROTATION_TYPE_RANDOM.
crWeightCalculationStrategy :: Lens' CreativeRotation (Maybe CreativeRotationWeightCalculationStrategy)
crWeightCalculationStrategy
= lens _crWeightCalculationStrategy
(\ s a -> s{_crWeightCalculationStrategy = a})
-- | Creative assignments in this creative rotation.
crCreativeAssignments :: Lens' CreativeRotation [CreativeAssignment]
crCreativeAssignments
= lens _crCreativeAssignments
(\ s a -> s{_crCreativeAssignments = a})
. _Default
. _Coerce
-- | Creative optimization configuration that is used by this ad. It should
-- refer to one of the existing optimization configurations in the ad\'s
-- campaign. If it is unset or set to 0, then the campaign\'s default
-- optimization configuration will be used for this ad.
crCreativeOptimizationConfigurationId :: Lens' CreativeRotation (Maybe Int64)
crCreativeOptimizationConfigurationId
= lens _crCreativeOptimizationConfigurationId
(\ s a ->
s{_crCreativeOptimizationConfigurationId = a})
. mapping _Coerce
-- | Type of creative rotation. Can be used to specify whether to use
-- sequential or random rotation.
crType :: Lens' CreativeRotation (Maybe CreativeRotationType)
crType = lens _crType (\ s a -> s{_crType = a})
instance FromJSON CreativeRotation where
parseJSON
= withObject "CreativeRotation"
(\ o ->
CreativeRotation' <$>
(o .:? "weightCalculationStrategy") <*>
(o .:? "creativeAssignments" .!= mempty)
<*> (o .:? "creativeOptimizationConfigurationId")
<*> (o .:? "type"))
instance ToJSON CreativeRotation where
toJSON CreativeRotation'{..}
= object
(catMaybes
[("weightCalculationStrategy" .=) <$>
_crWeightCalculationStrategy,
("creativeAssignments" .=) <$>
_crCreativeAssignments,
("creativeOptimizationConfigurationId" .=) <$>
_crCreativeOptimizationConfigurationId,
("type" .=) <$> _crType])
-- | Technology Targeting.
--
-- /See:/ 'technologyTargeting' smart constructor.
data TechnologyTargeting =
TechnologyTargeting'
{ _ttMobileCarriers :: !(Maybe [MobileCarrier])
, _ttOperatingSystemVersions :: !(Maybe [OperatingSystemVersion])
, _ttPlatformTypes :: !(Maybe [PlatformType])
, _ttBrowsers :: !(Maybe [Browser])
, _ttConnectionTypes :: !(Maybe [ConnectionType])
, _ttOperatingSystems :: !(Maybe [OperatingSystem])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TechnologyTargeting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ttMobileCarriers'
--
-- * 'ttOperatingSystemVersions'
--
-- * 'ttPlatformTypes'
--
-- * 'ttBrowsers'
--
-- * 'ttConnectionTypes'
--
-- * 'ttOperatingSystems'
technologyTargeting
:: TechnologyTargeting
technologyTargeting =
TechnologyTargeting'
{ _ttMobileCarriers = Nothing
, _ttOperatingSystemVersions = Nothing
, _ttPlatformTypes = Nothing
, _ttBrowsers = Nothing
, _ttConnectionTypes = Nothing
, _ttOperatingSystems = Nothing
}
-- | Mobile carriers that this ad targets. For each mobile carrier only id is
-- required, and the other fields are populated automatically when the ad
-- is inserted or updated. If targeting a mobile carrier, do not set
-- targeting for any zip codes.
ttMobileCarriers :: Lens' TechnologyTargeting [MobileCarrier]
ttMobileCarriers
= lens _ttMobileCarriers
(\ s a -> s{_ttMobileCarriers = a})
. _Default
. _Coerce
-- | Operating system versions that this ad targets. To target all versions,
-- use operatingSystems. For each operating system version, only id is
-- required. The other fields are populated automatically when the ad is
-- inserted or updated. If targeting an operating system version, do not
-- set targeting for the corresponding operating system in
-- operatingSystems.
ttOperatingSystemVersions :: Lens' TechnologyTargeting [OperatingSystemVersion]
ttOperatingSystemVersions
= lens _ttOperatingSystemVersions
(\ s a -> s{_ttOperatingSystemVersions = a})
. _Default
. _Coerce
-- | Platform types that this ad targets. For example, desktop, mobile, or
-- tablet. For each platform type, only id is required, and the other
-- fields are populated automatically when the ad is inserted or updated.
ttPlatformTypes :: Lens' TechnologyTargeting [PlatformType]
ttPlatformTypes
= lens _ttPlatformTypes
(\ s a -> s{_ttPlatformTypes = a})
. _Default
. _Coerce
-- | Browsers that this ad targets. For each browser either set
-- browserVersionId or dartId along with the version numbers. If both are
-- specified, only browserVersionId will be used. The other fields are
-- populated automatically when the ad is inserted or updated.
ttBrowsers :: Lens' TechnologyTargeting [Browser]
ttBrowsers
= lens _ttBrowsers (\ s a -> s{_ttBrowsers = a}) .
_Default
. _Coerce
-- | Connection types that this ad targets. For each connection type only id
-- is required. The other fields are populated automatically when the ad is
-- inserted or updated.
ttConnectionTypes :: Lens' TechnologyTargeting [ConnectionType]
ttConnectionTypes
= lens _ttConnectionTypes
(\ s a -> s{_ttConnectionTypes = a})
. _Default
. _Coerce
-- | Operating systems that this ad targets. To target specific versions, use
-- operatingSystemVersions. For each operating system only dartId is
-- required. The other fields are populated automatically when the ad is
-- inserted or updated. If targeting an operating system, do not set
-- targeting for operating system versions for the same operating system.
ttOperatingSystems :: Lens' TechnologyTargeting [OperatingSystem]
ttOperatingSystems
= lens _ttOperatingSystems
(\ s a -> s{_ttOperatingSystems = a})
. _Default
. _Coerce
instance FromJSON TechnologyTargeting where
parseJSON
= withObject "TechnologyTargeting"
(\ o ->
TechnologyTargeting' <$>
(o .:? "mobileCarriers" .!= mempty) <*>
(o .:? "operatingSystemVersions" .!= mempty)
<*> (o .:? "platformTypes" .!= mempty)
<*> (o .:? "browsers" .!= mempty)
<*> (o .:? "connectionTypes" .!= mempty)
<*> (o .:? "operatingSystems" .!= mempty))
instance ToJSON TechnologyTargeting where
toJSON TechnologyTargeting'{..}
= object
(catMaybes
[("mobileCarriers" .=) <$> _ttMobileCarriers,
("operatingSystemVersions" .=) <$>
_ttOperatingSystemVersions,
("platformTypes" .=) <$> _ttPlatformTypes,
("browsers" .=) <$> _ttBrowsers,
("connectionTypes" .=) <$> _ttConnectionTypes,
("operatingSystems" .=) <$> _ttOperatingSystems])
-- | Represents a buy from the Planning inventory store.
--
-- /See:/ 'inventoryItem' smart constructor.
data InventoryItem =
InventoryItem'
{ _iiPlacementStrategyId :: !(Maybe (Textual Int64))
, _iiEstimatedClickThroughRate :: !(Maybe (Textual Int64))
, _iiPricing :: !(Maybe Pricing)
, _iiKind :: !(Maybe Text)
, _iiAdvertiserId :: !(Maybe (Textual Int64))
, _iiRfpId :: !(Maybe (Textual Int64))
, _iiContentCategoryId :: !(Maybe (Textual Int64))
, _iiInPlan :: !(Maybe Bool)
, _iiAccountId :: !(Maybe (Textual Int64))
, _iiName :: !(Maybe Text)
, _iiAdSlots :: !(Maybe [AdSlot])
, _iiNegotiationChannelId :: !(Maybe (Textual Int64))
, _iiLastModifiedInfo :: !(Maybe LastModifiedInfo)
, _iiId :: !(Maybe (Textual Int64))
, _iiEstimatedConversionRate :: !(Maybe (Textual Int64))
, _iiProjectId :: !(Maybe (Textual Int64))
, _iiSubAccountId :: !(Maybe (Textual Int64))
, _iiType :: !(Maybe InventoryItemType)
, _iiOrderId :: !(Maybe (Textual Int64))
, _iiSiteId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'InventoryItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'iiPlacementStrategyId'
--
-- * 'iiEstimatedClickThroughRate'
--
-- * 'iiPricing'
--
-- * 'iiKind'
--
-- * 'iiAdvertiserId'
--
-- * 'iiRfpId'
--
-- * 'iiContentCategoryId'
--
-- * 'iiInPlan'
--
-- * 'iiAccountId'
--
-- * 'iiName'
--
-- * 'iiAdSlots'
--
-- * 'iiNegotiationChannelId'
--
-- * 'iiLastModifiedInfo'
--
-- * 'iiId'
--
-- * 'iiEstimatedConversionRate'
--
-- * 'iiProjectId'
--
-- * 'iiSubAccountId'
--
-- * 'iiType'
--
-- * 'iiOrderId'
--
-- * 'iiSiteId'
inventoryItem
:: InventoryItem
inventoryItem =
InventoryItem'
{ _iiPlacementStrategyId = Nothing
, _iiEstimatedClickThroughRate = Nothing
, _iiPricing = Nothing
, _iiKind = Nothing
, _iiAdvertiserId = Nothing
, _iiRfpId = Nothing
, _iiContentCategoryId = Nothing
, _iiInPlan = Nothing
, _iiAccountId = Nothing
, _iiName = Nothing
, _iiAdSlots = Nothing
, _iiNegotiationChannelId = Nothing
, _iiLastModifiedInfo = Nothing
, _iiId = Nothing
, _iiEstimatedConversionRate = Nothing
, _iiProjectId = Nothing
, _iiSubAccountId = Nothing
, _iiType = Nothing
, _iiOrderId = Nothing
, _iiSiteId = Nothing
}
-- | Placement strategy ID of this inventory item.
iiPlacementStrategyId :: Lens' InventoryItem (Maybe Int64)
iiPlacementStrategyId
= lens _iiPlacementStrategyId
(\ s a -> s{_iiPlacementStrategyId = a})
. mapping _Coerce
-- | Estimated click-through rate of this inventory item.
iiEstimatedClickThroughRate :: Lens' InventoryItem (Maybe Int64)
iiEstimatedClickThroughRate
= lens _iiEstimatedClickThroughRate
(\ s a -> s{_iiEstimatedClickThroughRate = a})
. mapping _Coerce
-- | Pricing of this inventory item.
iiPricing :: Lens' InventoryItem (Maybe Pricing)
iiPricing
= lens _iiPricing (\ s a -> s{_iiPricing = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#inventoryItem\".
iiKind :: Lens' InventoryItem (Maybe Text)
iiKind = lens _iiKind (\ s a -> s{_iiKind = a})
-- | Advertiser ID of this inventory item.
iiAdvertiserId :: Lens' InventoryItem (Maybe Int64)
iiAdvertiserId
= lens _iiAdvertiserId
(\ s a -> s{_iiAdvertiserId = a})
. mapping _Coerce
-- | RFP ID of this inventory item.
iiRfpId :: Lens' InventoryItem (Maybe Int64)
iiRfpId
= lens _iiRfpId (\ s a -> s{_iiRfpId = a}) .
mapping _Coerce
-- | Content category ID of this inventory item.
iiContentCategoryId :: Lens' InventoryItem (Maybe Int64)
iiContentCategoryId
= lens _iiContentCategoryId
(\ s a -> s{_iiContentCategoryId = a})
. mapping _Coerce
-- | Whether this inventory item is in plan.
iiInPlan :: Lens' InventoryItem (Maybe Bool)
iiInPlan = lens _iiInPlan (\ s a -> s{_iiInPlan = a})
-- | Account ID of this inventory item.
iiAccountId :: Lens' InventoryItem (Maybe Int64)
iiAccountId
= lens _iiAccountId (\ s a -> s{_iiAccountId = a}) .
mapping _Coerce
-- | Name of this inventory item. For standalone inventory items, this is the
-- same name as that of its only ad slot. For group inventory items, this
-- can differ from the name of any of its ad slots.
iiName :: Lens' InventoryItem (Maybe Text)
iiName = lens _iiName (\ s a -> s{_iiName = a})
-- | Ad slots of this inventory item. If this inventory item represents a
-- standalone placement, there will be exactly one ad slot. If this
-- inventory item represents a placement group, there will be more than one
-- ad slot, each representing one child placement in that placement group.
iiAdSlots :: Lens' InventoryItem [AdSlot]
iiAdSlots
= lens _iiAdSlots (\ s a -> s{_iiAdSlots = a}) .
_Default
. _Coerce
-- | Negotiation channel ID of this inventory item.
iiNegotiationChannelId :: Lens' InventoryItem (Maybe Int64)
iiNegotiationChannelId
= lens _iiNegotiationChannelId
(\ s a -> s{_iiNegotiationChannelId = a})
. mapping _Coerce
-- | Information about the most recent modification of this inventory item.
iiLastModifiedInfo :: Lens' InventoryItem (Maybe LastModifiedInfo)
iiLastModifiedInfo
= lens _iiLastModifiedInfo
(\ s a -> s{_iiLastModifiedInfo = a})
-- | ID of this inventory item.
iiId :: Lens' InventoryItem (Maybe Int64)
iiId
= lens _iiId (\ s a -> s{_iiId = a}) .
mapping _Coerce
-- | Estimated conversion rate of this inventory item.
iiEstimatedConversionRate :: Lens' InventoryItem (Maybe Int64)
iiEstimatedConversionRate
= lens _iiEstimatedConversionRate
(\ s a -> s{_iiEstimatedConversionRate = a})
. mapping _Coerce
-- | Project ID of this inventory item.
iiProjectId :: Lens' InventoryItem (Maybe Int64)
iiProjectId
= lens _iiProjectId (\ s a -> s{_iiProjectId = a}) .
mapping _Coerce
-- | Subaccount ID of this inventory item.
iiSubAccountId :: Lens' InventoryItem (Maybe Int64)
iiSubAccountId
= lens _iiSubAccountId
(\ s a -> s{_iiSubAccountId = a})
. mapping _Coerce
-- | Type of inventory item.
iiType :: Lens' InventoryItem (Maybe InventoryItemType)
iiType = lens _iiType (\ s a -> s{_iiType = a})
-- | Order ID of this inventory item.
iiOrderId :: Lens' InventoryItem (Maybe Int64)
iiOrderId
= lens _iiOrderId (\ s a -> s{_iiOrderId = a}) .
mapping _Coerce
-- | ID of the site this inventory item is associated with.
iiSiteId :: Lens' InventoryItem (Maybe Int64)
iiSiteId
= lens _iiSiteId (\ s a -> s{_iiSiteId = a}) .
mapping _Coerce
instance FromJSON InventoryItem where
parseJSON
= withObject "InventoryItem"
(\ o ->
InventoryItem' <$>
(o .:? "placementStrategyId") <*>
(o .:? "estimatedClickThroughRate")
<*> (o .:? "pricing")
<*> (o .:? "kind")
<*> (o .:? "advertiserId")
<*> (o .:? "rfpId")
<*> (o .:? "contentCategoryId")
<*> (o .:? "inPlan")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "adSlots" .!= mempty)
<*> (o .:? "negotiationChannelId")
<*> (o .:? "lastModifiedInfo")
<*> (o .:? "id")
<*> (o .:? "estimatedConversionRate")
<*> (o .:? "projectId")
<*> (o .:? "subaccountId")
<*> (o .:? "type")
<*> (o .:? "orderId")
<*> (o .:? "siteId"))
instance ToJSON InventoryItem where
toJSON InventoryItem'{..}
= object
(catMaybes
[("placementStrategyId" .=) <$>
_iiPlacementStrategyId,
("estimatedClickThroughRate" .=) <$>
_iiEstimatedClickThroughRate,
("pricing" .=) <$> _iiPricing,
("kind" .=) <$> _iiKind,
("advertiserId" .=) <$> _iiAdvertiserId,
("rfpId" .=) <$> _iiRfpId,
("contentCategoryId" .=) <$> _iiContentCategoryId,
("inPlan" .=) <$> _iiInPlan,
("accountId" .=) <$> _iiAccountId,
("name" .=) <$> _iiName,
("adSlots" .=) <$> _iiAdSlots,
("negotiationChannelId" .=) <$>
_iiNegotiationChannelId,
("lastModifiedInfo" .=) <$> _iiLastModifiedInfo,
("id" .=) <$> _iiId,
("estimatedConversionRate" .=) <$>
_iiEstimatedConversionRate,
("projectId" .=) <$> _iiProjectId,
("subaccountId" .=) <$> _iiSubAccountId,
("type" .=) <$> _iiType,
("orderId" .=) <$> _iiOrderId,
("siteId" .=) <$> _iiSiteId])
-- | Project List Response
--
-- /See:/ 'projectsListResponse' smart constructor.
data ProjectsListResponse =
ProjectsListResponse'
{ _plrNextPageToken :: !(Maybe Text)
, _plrKind :: !(Maybe Text)
, _plrProjects :: !(Maybe [Project])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ProjectsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plrNextPageToken'
--
-- * 'plrKind'
--
-- * 'plrProjects'
projectsListResponse
:: ProjectsListResponse
projectsListResponse =
ProjectsListResponse'
{_plrNextPageToken = Nothing, _plrKind = Nothing, _plrProjects = Nothing}
-- | Pagination token to be used for the next list operation.
plrNextPageToken :: Lens' ProjectsListResponse (Maybe Text)
plrNextPageToken
= lens _plrNextPageToken
(\ s a -> s{_plrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#projectsListResponse\".
plrKind :: Lens' ProjectsListResponse (Maybe Text)
plrKind = lens _plrKind (\ s a -> s{_plrKind = a})
-- | Project collection.
plrProjects :: Lens' ProjectsListResponse [Project]
plrProjects
= lens _plrProjects (\ s a -> s{_plrProjects = a}) .
_Default
. _Coerce
instance FromJSON ProjectsListResponse where
parseJSON
= withObject "ProjectsListResponse"
(\ o ->
ProjectsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "projects" .!= mempty))
instance ToJSON ProjectsListResponse where
toJSON ProjectsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _plrNextPageToken,
("kind" .=) <$> _plrKind,
("projects" .=) <$> _plrProjects])
-- | Ad List Response
--
-- /See:/ 'adsListResponse' smart constructor.
data AdsListResponse =
AdsListResponse'
{ _alrNextPageToken :: !(Maybe Text)
, _alrKind :: !(Maybe Text)
, _alrAds :: !(Maybe [Ad])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AdsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'alrNextPageToken'
--
-- * 'alrKind'
--
-- * 'alrAds'
adsListResponse
:: AdsListResponse
adsListResponse =
AdsListResponse'
{_alrNextPageToken = Nothing, _alrKind = Nothing, _alrAds = Nothing}
-- | Pagination token to be used for the next list operation.
alrNextPageToken :: Lens' AdsListResponse (Maybe Text)
alrNextPageToken
= lens _alrNextPageToken
(\ s a -> s{_alrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#adsListResponse\".
alrKind :: Lens' AdsListResponse (Maybe Text)
alrKind = lens _alrKind (\ s a -> s{_alrKind = a})
-- | Ad collection.
alrAds :: Lens' AdsListResponse [Ad]
alrAds
= lens _alrAds (\ s a -> s{_alrAds = a}) . _Default .
_Coerce
instance FromJSON AdsListResponse where
parseJSON
= withObject "AdsListResponse"
(\ o ->
AdsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "ads" .!= mempty))
instance ToJSON AdsListResponse where
toJSON AdsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _alrNextPageToken,
("kind" .=) <$> _alrKind, ("ads" .=) <$> _alrAds])
-- | Video Settings
--
-- /See:/ 'siteVideoSettings' smart constructor.
data SiteVideoSettings =
SiteVideoSettings'
{ _svsKind :: !(Maybe Text)
, _svsCompanionSettings :: !(Maybe SiteCompanionSetting)
, _svsObaSettings :: !(Maybe ObaIcon)
, _svsObaEnabled :: !(Maybe Bool)
, _svsTranscodeSettings :: !(Maybe SiteTranscodeSetting)
, _svsOrientation :: !(Maybe SiteVideoSettingsOrientation)
, _svsSkippableSettings :: !(Maybe SiteSkippableSetting)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SiteVideoSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'svsKind'
--
-- * 'svsCompanionSettings'
--
-- * 'svsObaSettings'
--
-- * 'svsObaEnabled'
--
-- * 'svsTranscodeSettings'
--
-- * 'svsOrientation'
--
-- * 'svsSkippableSettings'
siteVideoSettings
:: SiteVideoSettings
siteVideoSettings =
SiteVideoSettings'
{ _svsKind = Nothing
, _svsCompanionSettings = Nothing
, _svsObaSettings = Nothing
, _svsObaEnabled = Nothing
, _svsTranscodeSettings = Nothing
, _svsOrientation = Nothing
, _svsSkippableSettings = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#siteVideoSettings\".
svsKind :: Lens' SiteVideoSettings (Maybe Text)
svsKind = lens _svsKind (\ s a -> s{_svsKind = a})
-- | Settings for the companion creatives of video creatives served to this
-- site.
svsCompanionSettings :: Lens' SiteVideoSettings (Maybe SiteCompanionSetting)
svsCompanionSettings
= lens _svsCompanionSettings
(\ s a -> s{_svsCompanionSettings = a})
-- | Settings for the OBA icon of video creatives served to this site. This
-- will act as default for new placements created under this site.
svsObaSettings :: Lens' SiteVideoSettings (Maybe ObaIcon)
svsObaSettings
= lens _svsObaSettings
(\ s a -> s{_svsObaSettings = a})
-- | Whether OBA icons are enabled for this placement.
svsObaEnabled :: Lens' SiteVideoSettings (Maybe Bool)
svsObaEnabled
= lens _svsObaEnabled
(\ s a -> s{_svsObaEnabled = a})
-- | Settings for the transcodes of video creatives served to this site. This
-- will act as default for new placements created under this site.
svsTranscodeSettings :: Lens' SiteVideoSettings (Maybe SiteTranscodeSetting)
svsTranscodeSettings
= lens _svsTranscodeSettings
(\ s a -> s{_svsTranscodeSettings = a})
-- | Orientation of a site template used for video. This will act as default
-- for new placements created under this site.
svsOrientation :: Lens' SiteVideoSettings (Maybe SiteVideoSettingsOrientation)
svsOrientation
= lens _svsOrientation
(\ s a -> s{_svsOrientation = a})
-- | Settings for the skippability of video creatives served to this site.
-- This will act as default for new placements created under this site.
svsSkippableSettings :: Lens' SiteVideoSettings (Maybe SiteSkippableSetting)
svsSkippableSettings
= lens _svsSkippableSettings
(\ s a -> s{_svsSkippableSettings = a})
instance FromJSON SiteVideoSettings where
parseJSON
= withObject "SiteVideoSettings"
(\ o ->
SiteVideoSettings' <$>
(o .:? "kind") <*> (o .:? "companionSettings") <*>
(o .:? "obaSettings")
<*> (o .:? "obaEnabled")
<*> (o .:? "transcodeSettings")
<*> (o .:? "orientation")
<*> (o .:? "skippableSettings"))
instance ToJSON SiteVideoSettings where
toJSON SiteVideoSettings'{..}
= object
(catMaybes
[("kind" .=) <$> _svsKind,
("companionSettings" .=) <$> _svsCompanionSettings,
("obaSettings" .=) <$> _svsObaSettings,
("obaEnabled" .=) <$> _svsObaEnabled,
("transcodeSettings" .=) <$> _svsTranscodeSettings,
("orientation" .=) <$> _svsOrientation,
("skippableSettings" .=) <$> _svsSkippableSettings])
-- | Remarketing List Population Rule Term.
--
-- /See:/ 'listPopulationTerm' smart constructor.
data ListPopulationTerm =
ListPopulationTerm'
{ _lptOperator :: !(Maybe ListPopulationTermOperator)
, _lptValue :: !(Maybe Text)
, _lptVariableFriendlyName :: !(Maybe Text)
, _lptNegation :: !(Maybe Bool)
, _lptVariableName :: !(Maybe Text)
, _lptRemarketingListId :: !(Maybe (Textual Int64))
, _lptType :: !(Maybe ListPopulationTermType)
, _lptContains :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ListPopulationTerm' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lptOperator'
--
-- * 'lptValue'
--
-- * 'lptVariableFriendlyName'
--
-- * 'lptNegation'
--
-- * 'lptVariableName'
--
-- * 'lptRemarketingListId'
--
-- * 'lptType'
--
-- * 'lptContains'
listPopulationTerm
:: ListPopulationTerm
listPopulationTerm =
ListPopulationTerm'
{ _lptOperator = Nothing
, _lptValue = Nothing
, _lptVariableFriendlyName = Nothing
, _lptNegation = Nothing
, _lptVariableName = Nothing
, _lptRemarketingListId = Nothing
, _lptType = Nothing
, _lptContains = Nothing
}
-- | Comparison operator of this term. This field is only relevant when type
-- is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM.
lptOperator :: Lens' ListPopulationTerm (Maybe ListPopulationTermOperator)
lptOperator
= lens _lptOperator (\ s a -> s{_lptOperator = a})
-- | Literal to compare the variable to. This field is only relevant when
-- type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM.
lptValue :: Lens' ListPopulationTerm (Maybe Text)
lptValue = lens _lptValue (\ s a -> s{_lptValue = a})
-- | Friendly name of this term\'s variable. This is a read-only,
-- auto-generated field. This field is only relevant when type is left
-- unset or set to CUSTOM_VARIABLE_TERM.
lptVariableFriendlyName :: Lens' ListPopulationTerm (Maybe Text)
lptVariableFriendlyName
= lens _lptVariableFriendlyName
(\ s a -> s{_lptVariableFriendlyName = a})
-- | Whether to negate the comparison result of this term during rule
-- evaluation. This field is only relevant when type is left unset or set
-- to CUSTOM_VARIABLE_TERM or REFERRER_TERM.
lptNegation :: Lens' ListPopulationTerm (Maybe Bool)
lptNegation
= lens _lptNegation (\ s a -> s{_lptNegation = a})
-- | Name of the variable (U1, U2, etc.) being compared in this term. This
-- field is only relevant when type is set to null, CUSTOM_VARIABLE_TERM or
-- REFERRER_TERM.
lptVariableName :: Lens' ListPopulationTerm (Maybe Text)
lptVariableName
= lens _lptVariableName
(\ s a -> s{_lptVariableName = a})
-- | ID of the list in question. This field is only relevant when type is set
-- to LIST_MEMBERSHIP_TERM.
lptRemarketingListId :: Lens' ListPopulationTerm (Maybe Int64)
lptRemarketingListId
= lens _lptRemarketingListId
(\ s a -> s{_lptRemarketingListId = a})
. mapping _Coerce
-- | List population term type determines the applicable fields in this
-- object. If left unset or set to CUSTOM_VARIABLE_TERM, then variableName,
-- variableFriendlyName, operator, value, and negation are applicable. If
-- set to LIST_MEMBERSHIP_TERM then remarketingListId and contains are
-- applicable. If set to REFERRER_TERM then operator, value, and negation
-- are applicable.
lptType :: Lens' ListPopulationTerm (Maybe ListPopulationTermType)
lptType = lens _lptType (\ s a -> s{_lptType = a})
-- | Will be true if the term should check if the user is in the list and
-- false if the term should check if the user is not in the list. This
-- field is only relevant when type is set to LIST_MEMBERSHIP_TERM. False
-- by default.
lptContains :: Lens' ListPopulationTerm (Maybe Bool)
lptContains
= lens _lptContains (\ s a -> s{_lptContains = a})
instance FromJSON ListPopulationTerm where
parseJSON
= withObject "ListPopulationTerm"
(\ o ->
ListPopulationTerm' <$>
(o .:? "operator") <*> (o .:? "value") <*>
(o .:? "variableFriendlyName")
<*> (o .:? "negation")
<*> (o .:? "variableName")
<*> (o .:? "remarketingListId")
<*> (o .:? "type")
<*> (o .:? "contains"))
instance ToJSON ListPopulationTerm where
toJSON ListPopulationTerm'{..}
= object
(catMaybes
[("operator" .=) <$> _lptOperator,
("value" .=) <$> _lptValue,
("variableFriendlyName" .=) <$>
_lptVariableFriendlyName,
("negation" .=) <$> _lptNegation,
("variableName" .=) <$> _lptVariableName,
("remarketingListId" .=) <$> _lptRemarketingListId,
("type" .=) <$> _lptType,
("contains" .=) <$> _lptContains])
-- | Dynamic and Image Tag Settings.
--
-- /See:/ 'tagSettings' smart constructor.
data TagSettings =
TagSettings'
{ _tsDynamicTagEnabled :: !(Maybe Bool)
, _tsImageTagEnabled :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TagSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tsDynamicTagEnabled'
--
-- * 'tsImageTagEnabled'
tagSettings
:: TagSettings
tagSettings =
TagSettings' {_tsDynamicTagEnabled = Nothing, _tsImageTagEnabled = Nothing}
-- | Whether dynamic floodlight tags are enabled.
tsDynamicTagEnabled :: Lens' TagSettings (Maybe Bool)
tsDynamicTagEnabled
= lens _tsDynamicTagEnabled
(\ s a -> s{_tsDynamicTagEnabled = a})
-- | Whether image tags are enabled.
tsImageTagEnabled :: Lens' TagSettings (Maybe Bool)
tsImageTagEnabled
= lens _tsImageTagEnabled
(\ s a -> s{_tsImageTagEnabled = a})
instance FromJSON TagSettings where
parseJSON
= withObject "TagSettings"
(\ o ->
TagSettings' <$>
(o .:? "dynamicTagEnabled") <*>
(o .:? "imageTagEnabled"))
instance ToJSON TagSettings where
toJSON TagSettings'{..}
= object
(catMaybes
[("dynamicTagEnabled" .=) <$> _tsDynamicTagEnabled,
("imageTagEnabled" .=) <$> _tsImageTagEnabled])
-- | Subaccount List Response
--
-- /See:/ 'subAccountsListResponse' smart constructor.
data SubAccountsListResponse =
SubAccountsListResponse'
{ _salrNextPageToken :: !(Maybe Text)
, _salrKind :: !(Maybe Text)
, _salrSubAccounts :: !(Maybe [SubAccount])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SubAccountsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'salrNextPageToken'
--
-- * 'salrKind'
--
-- * 'salrSubAccounts'
subAccountsListResponse
:: SubAccountsListResponse
subAccountsListResponse =
SubAccountsListResponse'
{ _salrNextPageToken = Nothing
, _salrKind = Nothing
, _salrSubAccounts = Nothing
}
-- | Pagination token to be used for the next list operation.
salrNextPageToken :: Lens' SubAccountsListResponse (Maybe Text)
salrNextPageToken
= lens _salrNextPageToken
(\ s a -> s{_salrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#subaccountsListResponse\".
salrKind :: Lens' SubAccountsListResponse (Maybe Text)
salrKind = lens _salrKind (\ s a -> s{_salrKind = a})
-- | Subaccount collection.
salrSubAccounts :: Lens' SubAccountsListResponse [SubAccount]
salrSubAccounts
= lens _salrSubAccounts
(\ s a -> s{_salrSubAccounts = a})
. _Default
. _Coerce
instance FromJSON SubAccountsListResponse where
parseJSON
= withObject "SubAccountsListResponse"
(\ o ->
SubAccountsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "subaccounts" .!= mempty))
instance ToJSON SubAccountsListResponse where
toJSON SubAccountsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _salrNextPageToken,
("kind" .=) <$> _salrKind,
("subaccounts" .=) <$> _salrSubAccounts])
-- | Region List Response
--
-- /See:/ 'regionsListResponse' smart constructor.
data RegionsListResponse =
RegionsListResponse'
{ _rlrKind :: !(Maybe Text)
, _rlrRegions :: !(Maybe [Region])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'RegionsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rlrKind'
--
-- * 'rlrRegions'
regionsListResponse
:: RegionsListResponse
regionsListResponse =
RegionsListResponse' {_rlrKind = Nothing, _rlrRegions = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#regionsListResponse\".
rlrKind :: Lens' RegionsListResponse (Maybe Text)
rlrKind = lens _rlrKind (\ s a -> s{_rlrKind = a})
-- | Region collection.
rlrRegions :: Lens' RegionsListResponse [Region]
rlrRegions
= lens _rlrRegions (\ s a -> s{_rlrRegions = a}) .
_Default
. _Coerce
instance FromJSON RegionsListResponse where
parseJSON
= withObject "RegionsListResponse"
(\ o ->
RegionsListResponse' <$>
(o .:? "kind") <*> (o .:? "regions" .!= mempty))
instance ToJSON RegionsListResponse where
toJSON RegionsListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _rlrKind,
("regions" .=) <$> _rlrRegions])
-- | Dynamic Tag
--
-- /See:/ 'floodlightActivityDynamicTag' smart constructor.
data FloodlightActivityDynamicTag =
FloodlightActivityDynamicTag'
{ _fadtTag :: !(Maybe Text)
, _fadtName :: !(Maybe Text)
, _fadtId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightActivityDynamicTag' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fadtTag'
--
-- * 'fadtName'
--
-- * 'fadtId'
floodlightActivityDynamicTag
:: FloodlightActivityDynamicTag
floodlightActivityDynamicTag =
FloodlightActivityDynamicTag'
{_fadtTag = Nothing, _fadtName = Nothing, _fadtId = Nothing}
-- | Tag code.
fadtTag :: Lens' FloodlightActivityDynamicTag (Maybe Text)
fadtTag = lens _fadtTag (\ s a -> s{_fadtTag = a})
-- | Name of this tag.
fadtName :: Lens' FloodlightActivityDynamicTag (Maybe Text)
fadtName = lens _fadtName (\ s a -> s{_fadtName = a})
-- | ID of this dynamic tag. This is a read-only, auto-generated field.
fadtId :: Lens' FloodlightActivityDynamicTag (Maybe Int64)
fadtId
= lens _fadtId (\ s a -> s{_fadtId = a}) .
mapping _Coerce
instance FromJSON FloodlightActivityDynamicTag where
parseJSON
= withObject "FloodlightActivityDynamicTag"
(\ o ->
FloodlightActivityDynamicTag' <$>
(o .:? "tag") <*> (o .:? "name") <*> (o .:? "id"))
instance ToJSON FloodlightActivityDynamicTag where
toJSON FloodlightActivityDynamicTag'{..}
= object
(catMaybes
[("tag" .=) <$> _fadtTag, ("name" .=) <$> _fadtName,
("id" .=) <$> _fadtId])
-- | Contains information about supported video formats.
--
-- /See:/ 'videoFormat' smart constructor.
data VideoFormat =
VideoFormat'
{ _vfKind :: !(Maybe Text)
, _vfFileType :: !(Maybe VideoFormatFileType)
, _vfResolution :: !(Maybe Size)
, _vfTargetBitRate :: !(Maybe (Textual Int32))
, _vfId :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'VideoFormat' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vfKind'
--
-- * 'vfFileType'
--
-- * 'vfResolution'
--
-- * 'vfTargetBitRate'
--
-- * 'vfId'
videoFormat
:: VideoFormat
videoFormat =
VideoFormat'
{ _vfKind = Nothing
, _vfFileType = Nothing
, _vfResolution = Nothing
, _vfTargetBitRate = Nothing
, _vfId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#videoFormat\".
vfKind :: Lens' VideoFormat (Maybe Text)
vfKind = lens _vfKind (\ s a -> s{_vfKind = a})
-- | File type of the video format.
vfFileType :: Lens' VideoFormat (Maybe VideoFormatFileType)
vfFileType
= lens _vfFileType (\ s a -> s{_vfFileType = a})
-- | The resolution of this video format.
vfResolution :: Lens' VideoFormat (Maybe Size)
vfResolution
= lens _vfResolution (\ s a -> s{_vfResolution = a})
-- | The target bit rate of this video format.
vfTargetBitRate :: Lens' VideoFormat (Maybe Int32)
vfTargetBitRate
= lens _vfTargetBitRate
(\ s a -> s{_vfTargetBitRate = a})
. mapping _Coerce
-- | ID of the video format.
vfId :: Lens' VideoFormat (Maybe Int32)
vfId
= lens _vfId (\ s a -> s{_vfId = a}) .
mapping _Coerce
instance FromJSON VideoFormat where
parseJSON
= withObject "VideoFormat"
(\ o ->
VideoFormat' <$>
(o .:? "kind") <*> (o .:? "fileType") <*>
(o .:? "resolution")
<*> (o .:? "targetBitRate")
<*> (o .:? "id"))
instance ToJSON VideoFormat where
toJSON VideoFormat'{..}
= object
(catMaybes
[("kind" .=) <$> _vfKind,
("fileType" .=) <$> _vfFileType,
("resolution" .=) <$> _vfResolution,
("targetBitRate" .=) <$> _vfTargetBitRate,
("id" .=) <$> _vfId])
-- | DirectorySites contains properties of a website from the Site Directory.
-- Sites need to be added to an account via the Sites resource before they
-- can be assigned to a placement.
--
-- /See:/ 'directorySite' smart constructor.
data DirectorySite =
DirectorySite'
{ _dsSettings :: !(Maybe DirectorySiteSettings)
, _dsInterstitialTagFormats :: !(Maybe [DirectorySiteInterstitialTagFormatsItem])
, _dsKind :: !(Maybe Text)
, _dsURL :: !(Maybe Text)
, _dsIdDimensionValue :: !(Maybe DimensionValue)
, _dsInpageTagFormats :: !(Maybe [DirectorySiteInpageTagFormatsItem])
, _dsName :: !(Maybe Text)
, _dsId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DirectorySite' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dsSettings'
--
-- * 'dsInterstitialTagFormats'
--
-- * 'dsKind'
--
-- * 'dsURL'
--
-- * 'dsIdDimensionValue'
--
-- * 'dsInpageTagFormats'
--
-- * 'dsName'
--
-- * 'dsId'
directorySite
:: DirectorySite
directorySite =
DirectorySite'
{ _dsSettings = Nothing
, _dsInterstitialTagFormats = Nothing
, _dsKind = Nothing
, _dsURL = Nothing
, _dsIdDimensionValue = Nothing
, _dsInpageTagFormats = Nothing
, _dsName = Nothing
, _dsId = Nothing
}
-- | Directory site settings.
dsSettings :: Lens' DirectorySite (Maybe DirectorySiteSettings)
dsSettings
= lens _dsSettings (\ s a -> s{_dsSettings = a})
-- | Tag types for interstitial placements. Acceptable values are: -
-- \"IFRAME_JAVASCRIPT_INTERSTITIAL\" - \"INTERNAL_REDIRECT_INTERSTITIAL\"
-- - \"JAVASCRIPT_INTERSTITIAL\"
dsInterstitialTagFormats :: Lens' DirectorySite [DirectorySiteInterstitialTagFormatsItem]
dsInterstitialTagFormats
= lens _dsInterstitialTagFormats
(\ s a -> s{_dsInterstitialTagFormats = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#directorySite\".
dsKind :: Lens' DirectorySite (Maybe Text)
dsKind = lens _dsKind (\ s a -> s{_dsKind = a})
-- | URL of this directory site.
dsURL :: Lens' DirectorySite (Maybe Text)
dsURL = lens _dsURL (\ s a -> s{_dsURL = a})
-- | Dimension value for the ID of this directory site. This is a read-only,
-- auto-generated field.
dsIdDimensionValue :: Lens' DirectorySite (Maybe DimensionValue)
dsIdDimensionValue
= lens _dsIdDimensionValue
(\ s a -> s{_dsIdDimensionValue = a})
-- | Tag types for regular placements. Acceptable values are: - \"STANDARD\"
-- - \"IFRAME_JAVASCRIPT_INPAGE\" - \"INTERNAL_REDIRECT_INPAGE\" -
-- \"JAVASCRIPT_INPAGE\"
dsInpageTagFormats :: Lens' DirectorySite [DirectorySiteInpageTagFormatsItem]
dsInpageTagFormats
= lens _dsInpageTagFormats
(\ s a -> s{_dsInpageTagFormats = a})
. _Default
. _Coerce
-- | Name of this directory site.
dsName :: Lens' DirectorySite (Maybe Text)
dsName = lens _dsName (\ s a -> s{_dsName = a})
-- | ID of this directory site. This is a read-only, auto-generated field.
dsId :: Lens' DirectorySite (Maybe Int64)
dsId
= lens _dsId (\ s a -> s{_dsId = a}) .
mapping _Coerce
instance FromJSON DirectorySite where
parseJSON
= withObject "DirectorySite"
(\ o ->
DirectorySite' <$>
(o .:? "settings") <*>
(o .:? "interstitialTagFormats" .!= mempty)
<*> (o .:? "kind")
<*> (o .:? "url")
<*> (o .:? "idDimensionValue")
<*> (o .:? "inpageTagFormats" .!= mempty)
<*> (o .:? "name")
<*> (o .:? "id"))
instance ToJSON DirectorySite where
toJSON DirectorySite'{..}
= object
(catMaybes
[("settings" .=) <$> _dsSettings,
("interstitialTagFormats" .=) <$>
_dsInterstitialTagFormats,
("kind" .=) <$> _dsKind, ("url" .=) <$> _dsURL,
("idDimensionValue" .=) <$> _dsIdDimensionValue,
("inpageTagFormats" .=) <$> _dsInpageTagFormats,
("name" .=) <$> _dsName, ("id" .=) <$> _dsId])
-- | The properties of the report.
--
-- /See:/ 'reportFloodlightCriteriaReportProperties' smart constructor.
data ReportFloodlightCriteriaReportProperties =
ReportFloodlightCriteriaReportProperties'
{ _rfcrpIncludeUnattributedIPConversions :: !(Maybe Bool)
, _rfcrpIncludeUnattributedCookieConversions :: !(Maybe Bool)
, _rfcrpIncludeAttributedIPConversions :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportFloodlightCriteriaReportProperties' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rfcrpIncludeUnattributedIPConversions'
--
-- * 'rfcrpIncludeUnattributedCookieConversions'
--
-- * 'rfcrpIncludeAttributedIPConversions'
reportFloodlightCriteriaReportProperties
:: ReportFloodlightCriteriaReportProperties
reportFloodlightCriteriaReportProperties =
ReportFloodlightCriteriaReportProperties'
{ _rfcrpIncludeUnattributedIPConversions = Nothing
, _rfcrpIncludeUnattributedCookieConversions = Nothing
, _rfcrpIncludeAttributedIPConversions = Nothing
}
-- | Include conversions that have no associated cookies and no exposures.
-- It’s therefore impossible to know how the user was exposed to your ads
-- during the lookback window prior to a conversion.
rfcrpIncludeUnattributedIPConversions :: Lens' ReportFloodlightCriteriaReportProperties (Maybe Bool)
rfcrpIncludeUnattributedIPConversions
= lens _rfcrpIncludeUnattributedIPConversions
(\ s a ->
s{_rfcrpIncludeUnattributedIPConversions = a})
-- | Include conversions of users with a DoubleClick cookie but without an
-- exposure. That means the user did not click or see an ad from the
-- advertiser within the Floodlight group, or that the interaction happened
-- outside the lookback window.
rfcrpIncludeUnattributedCookieConversions :: Lens' ReportFloodlightCriteriaReportProperties (Maybe Bool)
rfcrpIncludeUnattributedCookieConversions
= lens _rfcrpIncludeUnattributedCookieConversions
(\ s a ->
s{_rfcrpIncludeUnattributedCookieConversions = a})
-- | Include conversions that have no cookie, but do have an exposure path.
rfcrpIncludeAttributedIPConversions :: Lens' ReportFloodlightCriteriaReportProperties (Maybe Bool)
rfcrpIncludeAttributedIPConversions
= lens _rfcrpIncludeAttributedIPConversions
(\ s a ->
s{_rfcrpIncludeAttributedIPConversions = a})
instance FromJSON
ReportFloodlightCriteriaReportProperties
where
parseJSON
= withObject
"ReportFloodlightCriteriaReportProperties"
(\ o ->
ReportFloodlightCriteriaReportProperties' <$>
(o .:? "includeUnattributedIPConversions") <*>
(o .:? "includeUnattributedCookieConversions")
<*> (o .:? "includeAttributedIPConversions"))
instance ToJSON
ReportFloodlightCriteriaReportProperties
where
toJSON ReportFloodlightCriteriaReportProperties'{..}
= object
(catMaybes
[("includeUnattributedIPConversions" .=) <$>
_rfcrpIncludeUnattributedIPConversions,
("includeUnattributedCookieConversions" .=) <$>
_rfcrpIncludeUnattributedCookieConversions,
("includeAttributedIPConversions" .=) <$>
_rfcrpIncludeAttributedIPConversions])
-- | Contains properties of a Floodlight activity group.
--
-- /See:/ 'floodlightActivityGroup' smart constructor.
data FloodlightActivityGroup =
FloodlightActivityGroup'
{ _fagTagString :: !(Maybe Text)
, _fagFloodlightConfigurationId :: !(Maybe (Textual Int64))
, _fagKind :: !(Maybe Text)
, _fagAdvertiserId :: !(Maybe (Textual Int64))
, _fagAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _fagIdDimensionValue :: !(Maybe DimensionValue)
, _fagAccountId :: !(Maybe (Textual Int64))
, _fagName :: !(Maybe Text)
, _fagId :: !(Maybe (Textual Int64))
, _fagSubAccountId :: !(Maybe (Textual Int64))
, _fagType :: !(Maybe FloodlightActivityGroupType)
, _fagFloodlightConfigurationIdDimensionValue :: !(Maybe DimensionValue)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightActivityGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fagTagString'
--
-- * 'fagFloodlightConfigurationId'
--
-- * 'fagKind'
--
-- * 'fagAdvertiserId'
--
-- * 'fagAdvertiserIdDimensionValue'
--
-- * 'fagIdDimensionValue'
--
-- * 'fagAccountId'
--
-- * 'fagName'
--
-- * 'fagId'
--
-- * 'fagSubAccountId'
--
-- * 'fagType'
--
-- * 'fagFloodlightConfigurationIdDimensionValue'
floodlightActivityGroup
:: FloodlightActivityGroup
floodlightActivityGroup =
FloodlightActivityGroup'
{ _fagTagString = Nothing
, _fagFloodlightConfigurationId = Nothing
, _fagKind = Nothing
, _fagAdvertiserId = Nothing
, _fagAdvertiserIdDimensionValue = Nothing
, _fagIdDimensionValue = Nothing
, _fagAccountId = Nothing
, _fagName = Nothing
, _fagId = Nothing
, _fagSubAccountId = Nothing
, _fagType = Nothing
, _fagFloodlightConfigurationIdDimensionValue = Nothing
}
-- | Value of the type= parameter in the floodlight tag, which the ad servers
-- use to identify the activity group that the activity belongs to. This is
-- optional: if empty, a new tag string will be generated for you. This
-- string must be 1 to 8 characters long, with valid characters being
-- a-z0-9[ _ ]. This tag string must also be unique among activity groups
-- of the same floodlight configuration. This field is read-only after
-- insertion.
fagTagString :: Lens' FloodlightActivityGroup (Maybe Text)
fagTagString
= lens _fagTagString (\ s a -> s{_fagTagString = a})
-- | Floodlight configuration ID of this floodlight activity group. This is a
-- required field.
fagFloodlightConfigurationId :: Lens' FloodlightActivityGroup (Maybe Int64)
fagFloodlightConfigurationId
= lens _fagFloodlightConfigurationId
(\ s a -> s{_fagFloodlightConfigurationId = a})
. mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#floodlightActivityGroup\".
fagKind :: Lens' FloodlightActivityGroup (Maybe Text)
fagKind = lens _fagKind (\ s a -> s{_fagKind = a})
-- | Advertiser ID of this floodlight activity group. If this field is left
-- blank, the value will be copied over either from the floodlight
-- configuration\'s advertiser or from the existing activity group\'s
-- advertiser.
fagAdvertiserId :: Lens' FloodlightActivityGroup (Maybe Int64)
fagAdvertiserId
= lens _fagAdvertiserId
(\ s a -> s{_fagAdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
fagAdvertiserIdDimensionValue :: Lens' FloodlightActivityGroup (Maybe DimensionValue)
fagAdvertiserIdDimensionValue
= lens _fagAdvertiserIdDimensionValue
(\ s a -> s{_fagAdvertiserIdDimensionValue = a})
-- | Dimension value for the ID of this floodlight activity group. This is a
-- read-only, auto-generated field.
fagIdDimensionValue :: Lens' FloodlightActivityGroup (Maybe DimensionValue)
fagIdDimensionValue
= lens _fagIdDimensionValue
(\ s a -> s{_fagIdDimensionValue = a})
-- | Account ID of this floodlight activity group. This is a read-only field
-- that can be left blank.
fagAccountId :: Lens' FloodlightActivityGroup (Maybe Int64)
fagAccountId
= lens _fagAccountId (\ s a -> s{_fagAccountId = a})
. mapping _Coerce
-- | Name of this floodlight activity group. This is a required field. Must
-- be less than 65 characters long and cannot contain quotes.
fagName :: Lens' FloodlightActivityGroup (Maybe Text)
fagName = lens _fagName (\ s a -> s{_fagName = a})
-- | ID of this floodlight activity group. This is a read-only,
-- auto-generated field.
fagId :: Lens' FloodlightActivityGroup (Maybe Int64)
fagId
= lens _fagId (\ s a -> s{_fagId = a}) .
mapping _Coerce
-- | Subaccount ID of this floodlight activity group. This is a read-only
-- field that can be left blank.
fagSubAccountId :: Lens' FloodlightActivityGroup (Maybe Int64)
fagSubAccountId
= lens _fagSubAccountId
(\ s a -> s{_fagSubAccountId = a})
. mapping _Coerce
-- | Type of the floodlight activity group. This is a required field that is
-- read-only after insertion.
fagType :: Lens' FloodlightActivityGroup (Maybe FloodlightActivityGroupType)
fagType = lens _fagType (\ s a -> s{_fagType = a})
-- | Dimension value for the ID of the floodlight configuration. This is a
-- read-only, auto-generated field.
fagFloodlightConfigurationIdDimensionValue :: Lens' FloodlightActivityGroup (Maybe DimensionValue)
fagFloodlightConfigurationIdDimensionValue
= lens _fagFloodlightConfigurationIdDimensionValue
(\ s a ->
s{_fagFloodlightConfigurationIdDimensionValue = a})
instance FromJSON FloodlightActivityGroup where
parseJSON
= withObject "FloodlightActivityGroup"
(\ o ->
FloodlightActivityGroup' <$>
(o .:? "tagString") <*>
(o .:? "floodlightConfigurationId")
<*> (o .:? "kind")
<*> (o .:? "advertiserId")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "idDimensionValue")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "id")
<*> (o .:? "subaccountId")
<*> (o .:? "type")
<*>
(o .:? "floodlightConfigurationIdDimensionValue"))
instance ToJSON FloodlightActivityGroup where
toJSON FloodlightActivityGroup'{..}
= object
(catMaybes
[("tagString" .=) <$> _fagTagString,
("floodlightConfigurationId" .=) <$>
_fagFloodlightConfigurationId,
("kind" .=) <$> _fagKind,
("advertiserId" .=) <$> _fagAdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_fagAdvertiserIdDimensionValue,
("idDimensionValue" .=) <$> _fagIdDimensionValue,
("accountId" .=) <$> _fagAccountId,
("name" .=) <$> _fagName, ("id" .=) <$> _fagId,
("subaccountId" .=) <$> _fagSubAccountId,
("type" .=) <$> _fagType,
("floodlightConfigurationIdDimensionValue" .=) <$>
_fagFloodlightConfigurationIdDimensionValue])
-- | Represents fields that are compatible to be selected for a report of
-- type \"CROSS_DIMENSION_REACH\".
--
-- /See:/ 'crossDimensionReachReportCompatibleFields' smart constructor.
data CrossDimensionReachReportCompatibleFields =
CrossDimensionReachReportCompatibleFields'
{ _cdrrcfMetrics :: !(Maybe [Metric])
, _cdrrcfBreakdown :: !(Maybe [Dimension])
, _cdrrcfKind :: !(Maybe Text)
, _cdrrcfDimensionFilters :: !(Maybe [Dimension])
, _cdrrcfOverlapMetrics :: !(Maybe [Metric])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CrossDimensionReachReportCompatibleFields' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cdrrcfMetrics'
--
-- * 'cdrrcfBreakdown'
--
-- * 'cdrrcfKind'
--
-- * 'cdrrcfDimensionFilters'
--
-- * 'cdrrcfOverlapMetrics'
crossDimensionReachReportCompatibleFields
:: CrossDimensionReachReportCompatibleFields
crossDimensionReachReportCompatibleFields =
CrossDimensionReachReportCompatibleFields'
{ _cdrrcfMetrics = Nothing
, _cdrrcfBreakdown = Nothing
, _cdrrcfKind = Nothing
, _cdrrcfDimensionFilters = Nothing
, _cdrrcfOverlapMetrics = Nothing
}
-- | Metrics which are compatible to be selected in the \"metricNames\"
-- section of the report.
cdrrcfMetrics :: Lens' CrossDimensionReachReportCompatibleFields [Metric]
cdrrcfMetrics
= lens _cdrrcfMetrics
(\ s a -> s{_cdrrcfMetrics = a})
. _Default
. _Coerce
-- | Dimensions which are compatible to be selected in the \"breakdown\"
-- section of the report.
cdrrcfBreakdown :: Lens' CrossDimensionReachReportCompatibleFields [Dimension]
cdrrcfBreakdown
= lens _cdrrcfBreakdown
(\ s a -> s{_cdrrcfBreakdown = a})
. _Default
. _Coerce
-- | The kind of resource this is, in this case
-- dfareporting#crossDimensionReachReportCompatibleFields.
cdrrcfKind :: Lens' CrossDimensionReachReportCompatibleFields (Maybe Text)
cdrrcfKind
= lens _cdrrcfKind (\ s a -> s{_cdrrcfKind = a})
-- | Dimensions which are compatible to be selected in the
-- \"dimensionFilters\" section of the report.
cdrrcfDimensionFilters :: Lens' CrossDimensionReachReportCompatibleFields [Dimension]
cdrrcfDimensionFilters
= lens _cdrrcfDimensionFilters
(\ s a -> s{_cdrrcfDimensionFilters = a})
. _Default
. _Coerce
-- | Metrics which are compatible to be selected in the
-- \"overlapMetricNames\" section of the report.
cdrrcfOverlapMetrics :: Lens' CrossDimensionReachReportCompatibleFields [Metric]
cdrrcfOverlapMetrics
= lens _cdrrcfOverlapMetrics
(\ s a -> s{_cdrrcfOverlapMetrics = a})
. _Default
. _Coerce
instance FromJSON
CrossDimensionReachReportCompatibleFields
where
parseJSON
= withObject
"CrossDimensionReachReportCompatibleFields"
(\ o ->
CrossDimensionReachReportCompatibleFields' <$>
(o .:? "metrics" .!= mempty) <*>
(o .:? "breakdown" .!= mempty)
<*> (o .:? "kind")
<*> (o .:? "dimensionFilters" .!= mempty)
<*> (o .:? "overlapMetrics" .!= mempty))
instance ToJSON
CrossDimensionReachReportCompatibleFields
where
toJSON CrossDimensionReachReportCompatibleFields'{..}
= object
(catMaybes
[("metrics" .=) <$> _cdrrcfMetrics,
("breakdown" .=) <$> _cdrrcfBreakdown,
("kind" .=) <$> _cdrrcfKind,
("dimensionFilters" .=) <$> _cdrrcfDimensionFilters,
("overlapMetrics" .=) <$> _cdrrcfOverlapMetrics])
-- | Represents a DfaReporting channel grouping rule.
--
-- /See:/ 'channelGroupingRule' smart constructor.
data ChannelGroupingRule =
ChannelGroupingRule'
{ _cgrKind :: !(Maybe Text)
, _cgrName :: !(Maybe Text)
, _cgrDisjunctiveMatchStatements :: !(Maybe [DisjunctiveMatchStatement])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ChannelGroupingRule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cgrKind'
--
-- * 'cgrName'
--
-- * 'cgrDisjunctiveMatchStatements'
channelGroupingRule
:: ChannelGroupingRule
channelGroupingRule =
ChannelGroupingRule'
{ _cgrKind = Nothing
, _cgrName = Nothing
, _cgrDisjunctiveMatchStatements = Nothing
}
-- | The kind of resource this is, in this case
-- dfareporting#channelGroupingRule.
cgrKind :: Lens' ChannelGroupingRule (Maybe Text)
cgrKind = lens _cgrKind (\ s a -> s{_cgrKind = a})
-- | Rule name.
cgrName :: Lens' ChannelGroupingRule (Maybe Text)
cgrName = lens _cgrName (\ s a -> s{_cgrName = a})
-- | The disjunctive match statements contained within this rule.
cgrDisjunctiveMatchStatements :: Lens' ChannelGroupingRule [DisjunctiveMatchStatement]
cgrDisjunctiveMatchStatements
= lens _cgrDisjunctiveMatchStatements
(\ s a -> s{_cgrDisjunctiveMatchStatements = a})
. _Default
. _Coerce
instance FromJSON ChannelGroupingRule where
parseJSON
= withObject "ChannelGroupingRule"
(\ o ->
ChannelGroupingRule' <$>
(o .:? "kind") <*> (o .:? "name") <*>
(o .:? "disjunctiveMatchStatements" .!= mempty))
instance ToJSON ChannelGroupingRule where
toJSON ChannelGroupingRule'{..}
= object
(catMaybes
[("kind" .=) <$> _cgrKind, ("name" .=) <$> _cgrName,
("disjunctiveMatchStatements" .=) <$>
_cgrDisjunctiveMatchStatements])
-- | FsCommand.
--
-- /See:/ 'fsCommand' smart constructor.
data FsCommand =
FsCommand'
{ _fcPositionOption :: !(Maybe FsCommandPositionOption)
, _fcLeft :: !(Maybe (Textual Int32))
, _fcWindowHeight :: !(Maybe (Textual Int32))
, _fcWindowWidth :: !(Maybe (Textual Int32))
, _fcTop :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FsCommand' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fcPositionOption'
--
-- * 'fcLeft'
--
-- * 'fcWindowHeight'
--
-- * 'fcWindowWidth'
--
-- * 'fcTop'
fsCommand
:: FsCommand
fsCommand =
FsCommand'
{ _fcPositionOption = Nothing
, _fcLeft = Nothing
, _fcWindowHeight = Nothing
, _fcWindowWidth = Nothing
, _fcTop = Nothing
}
-- | Position in the browser where the window will open.
fcPositionOption :: Lens' FsCommand (Maybe FsCommandPositionOption)
fcPositionOption
= lens _fcPositionOption
(\ s a -> s{_fcPositionOption = a})
-- | Distance from the left of the browser.Applicable when positionOption is
-- DISTANCE_FROM_TOP_LEFT_CORNER.
fcLeft :: Lens' FsCommand (Maybe Int32)
fcLeft
= lens _fcLeft (\ s a -> s{_fcLeft = a}) .
mapping _Coerce
-- | Height of the window.
fcWindowHeight :: Lens' FsCommand (Maybe Int32)
fcWindowHeight
= lens _fcWindowHeight
(\ s a -> s{_fcWindowHeight = a})
. mapping _Coerce
-- | Width of the window.
fcWindowWidth :: Lens' FsCommand (Maybe Int32)
fcWindowWidth
= lens _fcWindowWidth
(\ s a -> s{_fcWindowWidth = a})
. mapping _Coerce
-- | Distance from the top of the browser. Applicable when positionOption is
-- DISTANCE_FROM_TOP_LEFT_CORNER.
fcTop :: Lens' FsCommand (Maybe Int32)
fcTop
= lens _fcTop (\ s a -> s{_fcTop = a}) .
mapping _Coerce
instance FromJSON FsCommand where
parseJSON
= withObject "FsCommand"
(\ o ->
FsCommand' <$>
(o .:? "positionOption") <*> (o .:? "left") <*>
(o .:? "windowHeight")
<*> (o .:? "windowWidth")
<*> (o .:? "top"))
instance ToJSON FsCommand where
toJSON FsCommand'{..}
= object
(catMaybes
[("positionOption" .=) <$> _fcPositionOption,
("left" .=) <$> _fcLeft,
("windowHeight" .=) <$> _fcWindowHeight,
("windowWidth" .=) <$> _fcWindowWidth,
("top" .=) <$> _fcTop])
-- | Placement Assignment.
--
-- /See:/ 'placementAssignment' smart constructor.
data PlacementAssignment =
PlacementAssignment'
{ _paPlacementId :: !(Maybe (Textual Int64))
, _paPlacementIdDimensionValue :: !(Maybe DimensionValue)
, _paActive :: !(Maybe Bool)
, _paSSLRequired :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlacementAssignment' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'paPlacementId'
--
-- * 'paPlacementIdDimensionValue'
--
-- * 'paActive'
--
-- * 'paSSLRequired'
placementAssignment
:: PlacementAssignment
placementAssignment =
PlacementAssignment'
{ _paPlacementId = Nothing
, _paPlacementIdDimensionValue = Nothing
, _paActive = Nothing
, _paSSLRequired = Nothing
}
-- | ID of the placement to be assigned. This is a required field.
paPlacementId :: Lens' PlacementAssignment (Maybe Int64)
paPlacementId
= lens _paPlacementId
(\ s a -> s{_paPlacementId = a})
. mapping _Coerce
-- | Dimension value for the ID of the placement. This is a read-only,
-- auto-generated field.
paPlacementIdDimensionValue :: Lens' PlacementAssignment (Maybe DimensionValue)
paPlacementIdDimensionValue
= lens _paPlacementIdDimensionValue
(\ s a -> s{_paPlacementIdDimensionValue = a})
-- | Whether this placement assignment is active. When true, the placement
-- will be included in the ad\'s rotation.
paActive :: Lens' PlacementAssignment (Maybe Bool)
paActive = lens _paActive (\ s a -> s{_paActive = a})
-- | Whether the placement to be assigned requires SSL. This is a read-only
-- field that is auto-generated when the ad is inserted or updated.
paSSLRequired :: Lens' PlacementAssignment (Maybe Bool)
paSSLRequired
= lens _paSSLRequired
(\ s a -> s{_paSSLRequired = a})
instance FromJSON PlacementAssignment where
parseJSON
= withObject "PlacementAssignment"
(\ o ->
PlacementAssignment' <$>
(o .:? "placementId") <*>
(o .:? "placementIdDimensionValue")
<*> (o .:? "active")
<*> (o .:? "sslRequired"))
instance ToJSON PlacementAssignment where
toJSON PlacementAssignment'{..}
= object
(catMaybes
[("placementId" .=) <$> _paPlacementId,
("placementIdDimensionValue" .=) <$>
_paPlacementIdDimensionValue,
("active" .=) <$> _paActive,
("sslRequired" .=) <$> _paSSLRequired])
-- | Contains properties of a creative field value.
--
-- /See:/ 'creativeFieldValue' smart constructor.
data CreativeFieldValue =
CreativeFieldValue'
{ _cfvKind :: !(Maybe Text)
, _cfvValue :: !(Maybe Text)
, _cfvId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeFieldValue' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cfvKind'
--
-- * 'cfvValue'
--
-- * 'cfvId'
creativeFieldValue
:: CreativeFieldValue
creativeFieldValue =
CreativeFieldValue'
{_cfvKind = Nothing, _cfvValue = Nothing, _cfvId = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#creativeFieldValue\".
cfvKind :: Lens' CreativeFieldValue (Maybe Text)
cfvKind = lens _cfvKind (\ s a -> s{_cfvKind = a})
-- | Value of this creative field value. It needs to be less than 256
-- characters in length and unique per creative field.
cfvValue :: Lens' CreativeFieldValue (Maybe Text)
cfvValue = lens _cfvValue (\ s a -> s{_cfvValue = a})
-- | ID of this creative field value. This is a read-only, auto-generated
-- field.
cfvId :: Lens' CreativeFieldValue (Maybe Int64)
cfvId
= lens _cfvId (\ s a -> s{_cfvId = a}) .
mapping _Coerce
instance FromJSON CreativeFieldValue where
parseJSON
= withObject "CreativeFieldValue"
(\ o ->
CreativeFieldValue' <$>
(o .:? "kind") <*> (o .:? "value") <*> (o .:? "id"))
instance ToJSON CreativeFieldValue where
toJSON CreativeFieldValue'{..}
= object
(catMaybes
[("kind" .=) <$> _cfvKind,
("value" .=) <$> _cfvValue, ("id" .=) <$> _cfvId])
-- | Represents a DimensionValuesRequest.
--
-- /See:/ 'dimensionValueRequest' smart constructor.
data DimensionValueRequest =
DimensionValueRequest'
{ _dvrKind :: !(Maybe Text)
, _dvrEndDate :: !(Maybe Date')
, _dvrFilters :: !(Maybe [DimensionFilter])
, _dvrStartDate :: !(Maybe Date')
, _dvrDimensionName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DimensionValueRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dvrKind'
--
-- * 'dvrEndDate'
--
-- * 'dvrFilters'
--
-- * 'dvrStartDate'
--
-- * 'dvrDimensionName'
dimensionValueRequest
:: DimensionValueRequest
dimensionValueRequest =
DimensionValueRequest'
{ _dvrKind = Nothing
, _dvrEndDate = Nothing
, _dvrFilters = Nothing
, _dvrStartDate = Nothing
, _dvrDimensionName = Nothing
}
-- | The kind of request this is, in this case
-- dfareporting#dimensionValueRequest .
dvrKind :: Lens' DimensionValueRequest (Maybe Text)
dvrKind = lens _dvrKind (\ s a -> s{_dvrKind = a})
dvrEndDate :: Lens' DimensionValueRequest (Maybe Day)
dvrEndDate
= lens _dvrEndDate (\ s a -> s{_dvrEndDate = a}) .
mapping _Date
-- | The list of filters by which to filter values. The filters are ANDed.
dvrFilters :: Lens' DimensionValueRequest [DimensionFilter]
dvrFilters
= lens _dvrFilters (\ s a -> s{_dvrFilters = a}) .
_Default
. _Coerce
dvrStartDate :: Lens' DimensionValueRequest (Maybe Day)
dvrStartDate
= lens _dvrStartDate (\ s a -> s{_dvrStartDate = a})
. mapping _Date
-- | The name of the dimension for which values should be requested.
dvrDimensionName :: Lens' DimensionValueRequest (Maybe Text)
dvrDimensionName
= lens _dvrDimensionName
(\ s a -> s{_dvrDimensionName = a})
instance FromJSON DimensionValueRequest where
parseJSON
= withObject "DimensionValueRequest"
(\ o ->
DimensionValueRequest' <$>
(o .:? "kind") <*> (o .:? "endDate") <*>
(o .:? "filters" .!= mempty)
<*> (o .:? "startDate")
<*> (o .:? "dimensionName"))
instance ToJSON DimensionValueRequest where
toJSON DimensionValueRequest'{..}
= object
(catMaybes
[("kind" .=) <$> _dvrKind,
("endDate" .=) <$> _dvrEndDate,
("filters" .=) <$> _dvrFilters,
("startDate" .=) <$> _dvrStartDate,
("dimensionName" .=) <$> _dvrDimensionName])
-- | Floodlight Configuration List Response
--
-- /See:/ 'floodlightConfigurationsListResponse' smart constructor.
data FloodlightConfigurationsListResponse =
FloodlightConfigurationsListResponse'
{ _fclrKind :: !(Maybe Text)
, _fclrFloodlightConfigurations :: !(Maybe [FloodlightConfiguration])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightConfigurationsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fclrKind'
--
-- * 'fclrFloodlightConfigurations'
floodlightConfigurationsListResponse
:: FloodlightConfigurationsListResponse
floodlightConfigurationsListResponse =
FloodlightConfigurationsListResponse'
{_fclrKind = Nothing, _fclrFloodlightConfigurations = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#floodlightConfigurationsListResponse\".
fclrKind :: Lens' FloodlightConfigurationsListResponse (Maybe Text)
fclrKind = lens _fclrKind (\ s a -> s{_fclrKind = a})
-- | Floodlight configuration collection.
fclrFloodlightConfigurations :: Lens' FloodlightConfigurationsListResponse [FloodlightConfiguration]
fclrFloodlightConfigurations
= lens _fclrFloodlightConfigurations
(\ s a -> s{_fclrFloodlightConfigurations = a})
. _Default
. _Coerce
instance FromJSON
FloodlightConfigurationsListResponse
where
parseJSON
= withObject "FloodlightConfigurationsListResponse"
(\ o ->
FloodlightConfigurationsListResponse' <$>
(o .:? "kind") <*>
(o .:? "floodlightConfigurations" .!= mempty))
instance ToJSON FloodlightConfigurationsListResponse
where
toJSON FloodlightConfigurationsListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _fclrKind,
("floodlightConfigurations" .=) <$>
_fclrFloodlightConfigurations])
-- | Floodlight Activity List Response
--
-- /See:/ 'floodlightActivitiesListResponse' smart constructor.
data FloodlightActivitiesListResponse =
FloodlightActivitiesListResponse'
{ _falrNextPageToken :: !(Maybe Text)
, _falrKind :: !(Maybe Text)
, _falrFloodlightActivities :: !(Maybe [FloodlightActivity])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightActivitiesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'falrNextPageToken'
--
-- * 'falrKind'
--
-- * 'falrFloodlightActivities'
floodlightActivitiesListResponse
:: FloodlightActivitiesListResponse
floodlightActivitiesListResponse =
FloodlightActivitiesListResponse'
{ _falrNextPageToken = Nothing
, _falrKind = Nothing
, _falrFloodlightActivities = Nothing
}
-- | Pagination token to be used for the next list operation.
falrNextPageToken :: Lens' FloodlightActivitiesListResponse (Maybe Text)
falrNextPageToken
= lens _falrNextPageToken
(\ s a -> s{_falrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#floodlightActivitiesListResponse\".
falrKind :: Lens' FloodlightActivitiesListResponse (Maybe Text)
falrKind = lens _falrKind (\ s a -> s{_falrKind = a})
-- | Floodlight activity collection.
falrFloodlightActivities :: Lens' FloodlightActivitiesListResponse [FloodlightActivity]
falrFloodlightActivities
= lens _falrFloodlightActivities
(\ s a -> s{_falrFloodlightActivities = a})
. _Default
. _Coerce
instance FromJSON FloodlightActivitiesListResponse
where
parseJSON
= withObject "FloodlightActivitiesListResponse"
(\ o ->
FloodlightActivitiesListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "floodlightActivities" .!= mempty))
instance ToJSON FloodlightActivitiesListResponse
where
toJSON FloodlightActivitiesListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _falrNextPageToken,
("kind" .=) <$> _falrKind,
("floodlightActivities" .=) <$>
_falrFloodlightActivities])
-- | Creative Field Assignment.
--
-- /See:/ 'creativeFieldAssignment' smart constructor.
data CreativeFieldAssignment =
CreativeFieldAssignment'
{ _cfaCreativeFieldId :: !(Maybe (Textual Int64))
, _cfaCreativeFieldValueId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeFieldAssignment' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cfaCreativeFieldId'
--
-- * 'cfaCreativeFieldValueId'
creativeFieldAssignment
:: CreativeFieldAssignment
creativeFieldAssignment =
CreativeFieldAssignment'
{_cfaCreativeFieldId = Nothing, _cfaCreativeFieldValueId = Nothing}
-- | ID of the creative field.
cfaCreativeFieldId :: Lens' CreativeFieldAssignment (Maybe Int64)
cfaCreativeFieldId
= lens _cfaCreativeFieldId
(\ s a -> s{_cfaCreativeFieldId = a})
. mapping _Coerce
-- | ID of the creative field value.
cfaCreativeFieldValueId :: Lens' CreativeFieldAssignment (Maybe Int64)
cfaCreativeFieldValueId
= lens _cfaCreativeFieldValueId
(\ s a -> s{_cfaCreativeFieldValueId = a})
. mapping _Coerce
instance FromJSON CreativeFieldAssignment where
parseJSON
= withObject "CreativeFieldAssignment"
(\ o ->
CreativeFieldAssignment' <$>
(o .:? "creativeFieldId") <*>
(o .:? "creativeFieldValueId"))
instance ToJSON CreativeFieldAssignment where
toJSON CreativeFieldAssignment'{..}
= object
(catMaybes
[("creativeFieldId" .=) <$> _cfaCreativeFieldId,
("creativeFieldValueId" .=) <$>
_cfaCreativeFieldValueId])
-- | Groups advertisers together so that reports can be generated for the
-- entire group at once.
--
-- /See:/ 'advertiserGroup' smart constructor.
data AdvertiserGroup =
AdvertiserGroup'
{ _agKind :: !(Maybe Text)
, _agAccountId :: !(Maybe (Textual Int64))
, _agName :: !(Maybe Text)
, _agId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AdvertiserGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'agKind'
--
-- * 'agAccountId'
--
-- * 'agName'
--
-- * 'agId'
advertiserGroup
:: AdvertiserGroup
advertiserGroup =
AdvertiserGroup'
{ _agKind = Nothing
, _agAccountId = Nothing
, _agName = Nothing
, _agId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#advertiserGroup\".
agKind :: Lens' AdvertiserGroup (Maybe Text)
agKind = lens _agKind (\ s a -> s{_agKind = a})
-- | Account ID of this advertiser group. This is a read-only field that can
-- be left blank.
agAccountId :: Lens' AdvertiserGroup (Maybe Int64)
agAccountId
= lens _agAccountId (\ s a -> s{_agAccountId = a}) .
mapping _Coerce
-- | Name of this advertiser group. This is a required field and must be less
-- than 256 characters long and unique among advertiser groups of the same
-- account.
agName :: Lens' AdvertiserGroup (Maybe Text)
agName = lens _agName (\ s a -> s{_agName = a})
-- | ID of this advertiser group. This is a read-only, auto-generated field.
agId :: Lens' AdvertiserGroup (Maybe Int64)
agId
= lens _agId (\ s a -> s{_agId = a}) .
mapping _Coerce
instance FromJSON AdvertiserGroup where
parseJSON
= withObject "AdvertiserGroup"
(\ o ->
AdvertiserGroup' <$>
(o .:? "kind") <*> (o .:? "accountId") <*>
(o .:? "name")
<*> (o .:? "id"))
instance ToJSON AdvertiserGroup where
toJSON AdvertiserGroup'{..}
= object
(catMaybes
[("kind" .=) <$> _agKind,
("accountId" .=) <$> _agAccountId,
("name" .=) <$> _agName, ("id" .=) <$> _agId])
-- | Placement Tag Data
--
-- /See:/ 'tagData' smart constructor.
data TagData =
TagData'
{ _tdClickTag :: !(Maybe Text)
, _tdFormat :: !(Maybe TagDataFormat)
, _tdCreativeId :: !(Maybe (Textual Int64))
, _tdAdId :: !(Maybe (Textual Int64))
, _tdImpressionTag :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TagData' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tdClickTag'
--
-- * 'tdFormat'
--
-- * 'tdCreativeId'
--
-- * 'tdAdId'
--
-- * 'tdImpressionTag'
tagData
:: TagData
tagData =
TagData'
{ _tdClickTag = Nothing
, _tdFormat = Nothing
, _tdCreativeId = Nothing
, _tdAdId = Nothing
, _tdImpressionTag = Nothing
}
-- | Tag string to record a click.
tdClickTag :: Lens' TagData (Maybe Text)
tdClickTag
= lens _tdClickTag (\ s a -> s{_tdClickTag = a})
-- | TagData tag format of this tag.
tdFormat :: Lens' TagData (Maybe TagDataFormat)
tdFormat = lens _tdFormat (\ s a -> s{_tdFormat = a})
-- | Creative associated with this placement tag. Applicable only when format
-- is PLACEMENT_TAG_TRACKING.
tdCreativeId :: Lens' TagData (Maybe Int64)
tdCreativeId
= lens _tdCreativeId (\ s a -> s{_tdCreativeId = a})
. mapping _Coerce
-- | Ad associated with this placement tag. Applicable only when format is
-- PLACEMENT_TAG_TRACKING.
tdAdId :: Lens' TagData (Maybe Int64)
tdAdId
= lens _tdAdId (\ s a -> s{_tdAdId = a}) .
mapping _Coerce
-- | Tag string for serving an ad.
tdImpressionTag :: Lens' TagData (Maybe Text)
tdImpressionTag
= lens _tdImpressionTag
(\ s a -> s{_tdImpressionTag = a})
instance FromJSON TagData where
parseJSON
= withObject "TagData"
(\ o ->
TagData' <$>
(o .:? "clickTag") <*> (o .:? "format") <*>
(o .:? "creativeId")
<*> (o .:? "adId")
<*> (o .:? "impressionTag"))
instance ToJSON TagData where
toJSON TagData'{..}
= object
(catMaybes
[("clickTag" .=) <$> _tdClickTag,
("format" .=) <$> _tdFormat,
("creativeId" .=) <$> _tdCreativeId,
("adId" .=) <$> _tdAdId,
("impressionTag" .=) <$> _tdImpressionTag])
-- | Day Part Targeting.
--
-- /See:/ 'dayPartTargeting' smart constructor.
data DayPartTargeting =
DayPartTargeting'
{ _dptDaysOfWeek :: !(Maybe [DayPartTargetingDaysOfWeekItem])
, _dptHoursOfDay :: !(Maybe [Textual Int32])
, _dptUserLocalTime :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DayPartTargeting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dptDaysOfWeek'
--
-- * 'dptHoursOfDay'
--
-- * 'dptUserLocalTime'
dayPartTargeting
:: DayPartTargeting
dayPartTargeting =
DayPartTargeting'
{ _dptDaysOfWeek = Nothing
, _dptHoursOfDay = Nothing
, _dptUserLocalTime = Nothing
}
-- | Days of the week when the ad will serve. Acceptable values are: -
-- \"SUNDAY\" - \"MONDAY\" - \"TUESDAY\" - \"WEDNESDAY\" - \"THURSDAY\" -
-- \"FRIDAY\" - \"SATURDAY\"
dptDaysOfWeek :: Lens' DayPartTargeting [DayPartTargetingDaysOfWeekItem]
dptDaysOfWeek
= lens _dptDaysOfWeek
(\ s a -> s{_dptDaysOfWeek = a})
. _Default
. _Coerce
-- | Hours of the day when the ad will serve, where 0 is midnight to 1 AM and
-- 23 is 11 PM to midnight. Can be specified with days of week, in which
-- case the ad would serve during these hours on the specified days. For
-- example if Monday, Wednesday, Friday are the days of week specified and
-- 9-10am, 3-5pm (hours 9, 15, and 16) is specified, the ad would serve
-- Monday, Wednesdays, and Fridays at 9-10am and 3-5pm. Acceptable values
-- are 0 to 23, inclusive.
dptHoursOfDay :: Lens' DayPartTargeting [Int32]
dptHoursOfDay
= lens _dptHoursOfDay
(\ s a -> s{_dptHoursOfDay = a})
. _Default
. _Coerce
-- | Whether or not to use the user\'s local time. If false, the America\/New
-- York time zone applies.
dptUserLocalTime :: Lens' DayPartTargeting (Maybe Bool)
dptUserLocalTime
= lens _dptUserLocalTime
(\ s a -> s{_dptUserLocalTime = a})
instance FromJSON DayPartTargeting where
parseJSON
= withObject "DayPartTargeting"
(\ o ->
DayPartTargeting' <$>
(o .:? "daysOfWeek" .!= mempty) <*>
(o .:? "hoursOfDay" .!= mempty)
<*> (o .:? "userLocalTime"))
instance ToJSON DayPartTargeting where
toJSON DayPartTargeting'{..}
= object
(catMaybes
[("daysOfWeek" .=) <$> _dptDaysOfWeek,
("hoursOfDay" .=) <$> _dptHoursOfDay,
("userLocalTime" .=) <$> _dptUserLocalTime])
-- | Creative optimization settings.
--
-- /See:/ 'creativeOptimizationConfiguration' smart constructor.
data CreativeOptimizationConfiguration =
CreativeOptimizationConfiguration'
{ _cocOptimizationModel :: !(Maybe CreativeOptimizationConfigurationOptimizationModel)
, _cocName :: !(Maybe Text)
, _cocOptimizationActivitys :: !(Maybe [OptimizationActivity])
, _cocId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeOptimizationConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cocOptimizationModel'
--
-- * 'cocName'
--
-- * 'cocOptimizationActivitys'
--
-- * 'cocId'
creativeOptimizationConfiguration
:: CreativeOptimizationConfiguration
creativeOptimizationConfiguration =
CreativeOptimizationConfiguration'
{ _cocOptimizationModel = Nothing
, _cocName = Nothing
, _cocOptimizationActivitys = Nothing
, _cocId = Nothing
}
-- | Optimization model for this configuration.
cocOptimizationModel :: Lens' CreativeOptimizationConfiguration (Maybe CreativeOptimizationConfigurationOptimizationModel)
cocOptimizationModel
= lens _cocOptimizationModel
(\ s a -> s{_cocOptimizationModel = a})
-- | Name of this creative optimization config. This is a required field and
-- must be less than 129 characters long.
cocName :: Lens' CreativeOptimizationConfiguration (Maybe Text)
cocName = lens _cocName (\ s a -> s{_cocName = a})
-- | List of optimization activities associated with this configuration.
cocOptimizationActivitys :: Lens' CreativeOptimizationConfiguration [OptimizationActivity]
cocOptimizationActivitys
= lens _cocOptimizationActivitys
(\ s a -> s{_cocOptimizationActivitys = a})
. _Default
. _Coerce
-- | ID of this creative optimization config. This field is auto-generated
-- when the campaign is inserted or updated. It can be null for existing
-- campaigns.
cocId :: Lens' CreativeOptimizationConfiguration (Maybe Int64)
cocId
= lens _cocId (\ s a -> s{_cocId = a}) .
mapping _Coerce
instance FromJSON CreativeOptimizationConfiguration
where
parseJSON
= withObject "CreativeOptimizationConfiguration"
(\ o ->
CreativeOptimizationConfiguration' <$>
(o .:? "optimizationModel") <*> (o .:? "name") <*>
(o .:? "optimizationActivitys" .!= mempty)
<*> (o .:? "id"))
instance ToJSON CreativeOptimizationConfiguration
where
toJSON CreativeOptimizationConfiguration'{..}
= object
(catMaybes
[("optimizationModel" .=) <$> _cocOptimizationModel,
("name" .=) <$> _cocName,
("optimizationActivitys" .=) <$>
_cocOptimizationActivitys,
("id" .=) <$> _cocId])
-- | Transcode Settings
--
-- /See:/ 'siteTranscodeSetting' smart constructor.
data SiteTranscodeSetting =
SiteTranscodeSetting'
{ _stsKind :: !(Maybe Text)
, _stsEnabledVideoFormats :: !(Maybe [Textual Int32])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SiteTranscodeSetting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'stsKind'
--
-- * 'stsEnabledVideoFormats'
siteTranscodeSetting
:: SiteTranscodeSetting
siteTranscodeSetting =
SiteTranscodeSetting' {_stsKind = Nothing, _stsEnabledVideoFormats = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#siteTranscodeSetting\".
stsKind :: Lens' SiteTranscodeSetting (Maybe Text)
stsKind = lens _stsKind (\ s a -> s{_stsKind = a})
-- | Allowlist of video formats to be served to this site template. Set this
-- list to null or empty to serve all video formats.
stsEnabledVideoFormats :: Lens' SiteTranscodeSetting [Int32]
stsEnabledVideoFormats
= lens _stsEnabledVideoFormats
(\ s a -> s{_stsEnabledVideoFormats = a})
. _Default
. _Coerce
instance FromJSON SiteTranscodeSetting where
parseJSON
= withObject "SiteTranscodeSetting"
(\ o ->
SiteTranscodeSetting' <$>
(o .:? "kind") <*>
(o .:? "enabledVideoFormats" .!= mempty))
instance ToJSON SiteTranscodeSetting where
toJSON SiteTranscodeSetting'{..}
= object
(catMaybes
[("kind" .=) <$> _stsKind,
("enabledVideoFormats" .=) <$>
_stsEnabledVideoFormats])
-- | Click-through URL
--
-- /See:/ 'creativeClickThroughURL' smart constructor.
data CreativeClickThroughURL =
CreativeClickThroughURL'
{ _cctuComputedClickThroughURL :: !(Maybe Text)
, _cctuCustomClickThroughURL :: !(Maybe Text)
, _cctuLandingPageId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeClickThroughURL' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cctuComputedClickThroughURL'
--
-- * 'cctuCustomClickThroughURL'
--
-- * 'cctuLandingPageId'
creativeClickThroughURL
:: CreativeClickThroughURL
creativeClickThroughURL =
CreativeClickThroughURL'
{ _cctuComputedClickThroughURL = Nothing
, _cctuCustomClickThroughURL = Nothing
, _cctuLandingPageId = Nothing
}
-- | Read-only convenience field representing the actual URL that will be
-- used for this click-through. The URL is computed as follows: - If
-- landingPageId is specified then that landing page\'s URL is assigned to
-- this field. - Otherwise, the customClickThroughUrl is assigned to this
-- field.
cctuComputedClickThroughURL :: Lens' CreativeClickThroughURL (Maybe Text)
cctuComputedClickThroughURL
= lens _cctuComputedClickThroughURL
(\ s a -> s{_cctuComputedClickThroughURL = a})
-- | Custom click-through URL. Applicable if the landingPageId field is left
-- unset.
cctuCustomClickThroughURL :: Lens' CreativeClickThroughURL (Maybe Text)
cctuCustomClickThroughURL
= lens _cctuCustomClickThroughURL
(\ s a -> s{_cctuCustomClickThroughURL = a})
-- | ID of the landing page for the click-through URL.
cctuLandingPageId :: Lens' CreativeClickThroughURL (Maybe Int64)
cctuLandingPageId
= lens _cctuLandingPageId
(\ s a -> s{_cctuLandingPageId = a})
. mapping _Coerce
instance FromJSON CreativeClickThroughURL where
parseJSON
= withObject "CreativeClickThroughURL"
(\ o ->
CreativeClickThroughURL' <$>
(o .:? "computedClickThroughUrl") <*>
(o .:? "customClickThroughUrl")
<*> (o .:? "landingPageId"))
instance ToJSON CreativeClickThroughURL where
toJSON CreativeClickThroughURL'{..}
= object
(catMaybes
[("computedClickThroughUrl" .=) <$>
_cctuComputedClickThroughURL,
("customClickThroughUrl" .=) <$>
_cctuCustomClickThroughURL,
("landingPageId" .=) <$> _cctuLandingPageId])
-- | The report criteria for a report of type \"STANDARD\".
--
-- /See:/ 'reportCriteria' smart constructor.
data ReportCriteria =
ReportCriteria'
{ _rcMetricNames :: !(Maybe [Text])
, _rcCustomRichMediaEvents :: !(Maybe CustomRichMediaEvents)
, _rcDimensionFilters :: !(Maybe [DimensionValue])
, _rcActivities :: !(Maybe Activities)
, _rcDateRange :: !(Maybe DateRange)
, _rcDimensions :: !(Maybe [SortedDimension])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportCriteria' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rcMetricNames'
--
-- * 'rcCustomRichMediaEvents'
--
-- * 'rcDimensionFilters'
--
-- * 'rcActivities'
--
-- * 'rcDateRange'
--
-- * 'rcDimensions'
reportCriteria
:: ReportCriteria
reportCriteria =
ReportCriteria'
{ _rcMetricNames = Nothing
, _rcCustomRichMediaEvents = Nothing
, _rcDimensionFilters = Nothing
, _rcActivities = Nothing
, _rcDateRange = Nothing
, _rcDimensions = Nothing
}
-- | The list of names of metrics the report should include.
rcMetricNames :: Lens' ReportCriteria [Text]
rcMetricNames
= lens _rcMetricNames
(\ s a -> s{_rcMetricNames = a})
. _Default
. _Coerce
-- | Custom Rich Media Events group.
rcCustomRichMediaEvents :: Lens' ReportCriteria (Maybe CustomRichMediaEvents)
rcCustomRichMediaEvents
= lens _rcCustomRichMediaEvents
(\ s a -> s{_rcCustomRichMediaEvents = a})
-- | The list of filters on which dimensions are filtered. Filters for
-- different dimensions are ANDed, filters for the same dimension are
-- grouped together and ORed.
rcDimensionFilters :: Lens' ReportCriteria [DimensionValue]
rcDimensionFilters
= lens _rcDimensionFilters
(\ s a -> s{_rcDimensionFilters = a})
. _Default
. _Coerce
-- | Activity group.
rcActivities :: Lens' ReportCriteria (Maybe Activities)
rcActivities
= lens _rcActivities (\ s a -> s{_rcActivities = a})
-- | The date range for which this report should be run.
rcDateRange :: Lens' ReportCriteria (Maybe DateRange)
rcDateRange
= lens _rcDateRange (\ s a -> s{_rcDateRange = a})
-- | The list of standard dimensions the report should include.
rcDimensions :: Lens' ReportCriteria [SortedDimension]
rcDimensions
= lens _rcDimensions (\ s a -> s{_rcDimensions = a})
. _Default
. _Coerce
instance FromJSON ReportCriteria where
parseJSON
= withObject "ReportCriteria"
(\ o ->
ReportCriteria' <$>
(o .:? "metricNames" .!= mempty) <*>
(o .:? "customRichMediaEvents")
<*> (o .:? "dimensionFilters" .!= mempty)
<*> (o .:? "activities")
<*> (o .:? "dateRange")
<*> (o .:? "dimensions" .!= mempty))
instance ToJSON ReportCriteria where
toJSON ReportCriteria'{..}
= object
(catMaybes
[("metricNames" .=) <$> _rcMetricNames,
("customRichMediaEvents" .=) <$>
_rcCustomRichMediaEvents,
("dimensionFilters" .=) <$> _rcDimensionFilters,
("activities" .=) <$> _rcActivities,
("dateRange" .=) <$> _rcDateRange,
("dimensions" .=) <$> _rcDimensions])
-- | Placement Strategy List Response
--
-- /See:/ 'placementStrategiesListResponse' smart constructor.
data PlacementStrategiesListResponse =
PlacementStrategiesListResponse'
{ _pslrPlacementStrategies :: !(Maybe [PlacementStrategy])
, _pslrNextPageToken :: !(Maybe Text)
, _pslrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlacementStrategiesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pslrPlacementStrategies'
--
-- * 'pslrNextPageToken'
--
-- * 'pslrKind'
placementStrategiesListResponse
:: PlacementStrategiesListResponse
placementStrategiesListResponse =
PlacementStrategiesListResponse'
{ _pslrPlacementStrategies = Nothing
, _pslrNextPageToken = Nothing
, _pslrKind = Nothing
}
-- | Placement strategy collection.
pslrPlacementStrategies :: Lens' PlacementStrategiesListResponse [PlacementStrategy]
pslrPlacementStrategies
= lens _pslrPlacementStrategies
(\ s a -> s{_pslrPlacementStrategies = a})
. _Default
. _Coerce
-- | Pagination token to be used for the next list operation.
pslrNextPageToken :: Lens' PlacementStrategiesListResponse (Maybe Text)
pslrNextPageToken
= lens _pslrNextPageToken
(\ s a -> s{_pslrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#placementStrategiesListResponse\".
pslrKind :: Lens' PlacementStrategiesListResponse (Maybe Text)
pslrKind = lens _pslrKind (\ s a -> s{_pslrKind = a})
instance FromJSON PlacementStrategiesListResponse
where
parseJSON
= withObject "PlacementStrategiesListResponse"
(\ o ->
PlacementStrategiesListResponse' <$>
(o .:? "placementStrategies" .!= mempty) <*>
(o .:? "nextPageToken")
<*> (o .:? "kind"))
instance ToJSON PlacementStrategiesListResponse where
toJSON PlacementStrategiesListResponse'{..}
= object
(catMaybes
[("placementStrategies" .=) <$>
_pslrPlacementStrategies,
("nextPageToken" .=) <$> _pslrNextPageToken,
("kind" .=) <$> _pslrKind])
-- | Update Conversions Response.
--
-- /See:/ 'conversionsBatchUpdateResponse' smart constructor.
data ConversionsBatchUpdateResponse =
ConversionsBatchUpdateResponse'
{ _cburStatus :: !(Maybe [ConversionStatus])
, _cburKind :: !(Maybe Text)
, _cburHasFailures :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ConversionsBatchUpdateResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cburStatus'
--
-- * 'cburKind'
--
-- * 'cburHasFailures'
conversionsBatchUpdateResponse
:: ConversionsBatchUpdateResponse
conversionsBatchUpdateResponse =
ConversionsBatchUpdateResponse'
{_cburStatus = Nothing, _cburKind = Nothing, _cburHasFailures = Nothing}
-- | The update status of each conversion. Statuses are returned in the same
-- order that conversions are updated.
cburStatus :: Lens' ConversionsBatchUpdateResponse [ConversionStatus]
cburStatus
= lens _cburStatus (\ s a -> s{_cburStatus = a}) .
_Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#conversionsBatchUpdateResponse\".
cburKind :: Lens' ConversionsBatchUpdateResponse (Maybe Text)
cburKind = lens _cburKind (\ s a -> s{_cburKind = a})
-- | Indicates that some or all conversions failed to update.
cburHasFailures :: Lens' ConversionsBatchUpdateResponse (Maybe Bool)
cburHasFailures
= lens _cburHasFailures
(\ s a -> s{_cburHasFailures = a})
instance FromJSON ConversionsBatchUpdateResponse
where
parseJSON
= withObject "ConversionsBatchUpdateResponse"
(\ o ->
ConversionsBatchUpdateResponse' <$>
(o .:? "status" .!= mempty) <*> (o .:? "kind") <*>
(o .:? "hasFailures"))
instance ToJSON ConversionsBatchUpdateResponse where
toJSON ConversionsBatchUpdateResponse'{..}
= object
(catMaybes
[("status" .=) <$> _cburStatus,
("kind" .=) <$> _cburKind,
("hasFailures" .=) <$> _cburHasFailures])
-- | Contains properties of a Campaign Manager subaccount.
--
-- /See:/ 'subAccount' smart constructor.
data SubAccount =
SubAccount'
{ _saKind :: !(Maybe Text)
, _saAvailablePermissionIds :: !(Maybe [Textual Int64])
, _saAccountId :: !(Maybe (Textual Int64))
, _saName :: !(Maybe Text)
, _saId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SubAccount' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'saKind'
--
-- * 'saAvailablePermissionIds'
--
-- * 'saAccountId'
--
-- * 'saName'
--
-- * 'saId'
subAccount
:: SubAccount
subAccount =
SubAccount'
{ _saKind = Nothing
, _saAvailablePermissionIds = Nothing
, _saAccountId = Nothing
, _saName = Nothing
, _saId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#subaccount\".
saKind :: Lens' SubAccount (Maybe Text)
saKind = lens _saKind (\ s a -> s{_saKind = a})
-- | IDs of the available user role permissions for this subaccount.
saAvailablePermissionIds :: Lens' SubAccount [Int64]
saAvailablePermissionIds
= lens _saAvailablePermissionIds
(\ s a -> s{_saAvailablePermissionIds = a})
. _Default
. _Coerce
-- | ID of the account that contains this subaccount. This is a read-only
-- field that can be left blank.
saAccountId :: Lens' SubAccount (Maybe Int64)
saAccountId
= lens _saAccountId (\ s a -> s{_saAccountId = a}) .
mapping _Coerce
-- | Name of this subaccount. This is a required field. Must be less than 128
-- characters long and be unique among subaccounts of the same account.
saName :: Lens' SubAccount (Maybe Text)
saName = lens _saName (\ s a -> s{_saName = a})
-- | ID of this subaccount. This is a read-only, auto-generated field.
saId :: Lens' SubAccount (Maybe Int64)
saId
= lens _saId (\ s a -> s{_saId = a}) .
mapping _Coerce
instance FromJSON SubAccount where
parseJSON
= withObject "SubAccount"
(\ o ->
SubAccount' <$>
(o .:? "kind") <*>
(o .:? "availablePermissionIds" .!= mempty)
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "id"))
instance ToJSON SubAccount where
toJSON SubAccount'{..}
= object
(catMaybes
[("kind" .=) <$> _saKind,
("availablePermissionIds" .=) <$>
_saAvailablePermissionIds,
("accountId" .=) <$> _saAccountId,
("name" .=) <$> _saName, ("id" .=) <$> _saId])
-- | Inventory item List Response
--
-- /See:/ 'inventoryItemsListResponse' smart constructor.
data InventoryItemsListResponse =
InventoryItemsListResponse'
{ _iilrInventoryItems :: !(Maybe [InventoryItem])
, _iilrNextPageToken :: !(Maybe Text)
, _iilrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'InventoryItemsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'iilrInventoryItems'
--
-- * 'iilrNextPageToken'
--
-- * 'iilrKind'
inventoryItemsListResponse
:: InventoryItemsListResponse
inventoryItemsListResponse =
InventoryItemsListResponse'
{ _iilrInventoryItems = Nothing
, _iilrNextPageToken = Nothing
, _iilrKind = Nothing
}
-- | Inventory item collection
iilrInventoryItems :: Lens' InventoryItemsListResponse [InventoryItem]
iilrInventoryItems
= lens _iilrInventoryItems
(\ s a -> s{_iilrInventoryItems = a})
. _Default
. _Coerce
-- | Pagination token to be used for the next list operation.
iilrNextPageToken :: Lens' InventoryItemsListResponse (Maybe Text)
iilrNextPageToken
= lens _iilrNextPageToken
(\ s a -> s{_iilrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#inventoryItemsListResponse\".
iilrKind :: Lens' InventoryItemsListResponse (Maybe Text)
iilrKind = lens _iilrKind (\ s a -> s{_iilrKind = a})
instance FromJSON InventoryItemsListResponse where
parseJSON
= withObject "InventoryItemsListResponse"
(\ o ->
InventoryItemsListResponse' <$>
(o .:? "inventoryItems" .!= mempty) <*>
(o .:? "nextPageToken")
<*> (o .:? "kind"))
instance ToJSON InventoryItemsListResponse where
toJSON InventoryItemsListResponse'{..}
= object
(catMaybes
[("inventoryItems" .=) <$> _iilrInventoryItems,
("nextPageToken" .=) <$> _iilrNextPageToken,
("kind" .=) <$> _iilrKind])
-- | A Universal Ad ID as per the VAST 4.0 spec. Applicable to the following
-- creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and VPAID.
--
-- /See:/ 'universalAdId' smart constructor.
data UniversalAdId =
UniversalAdId'
{ _uaiValue :: !(Maybe Text)
, _uaiRegistry :: !(Maybe UniversalAdIdRegistry)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UniversalAdId' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'uaiValue'
--
-- * 'uaiRegistry'
universalAdId
:: UniversalAdId
universalAdId = UniversalAdId' {_uaiValue = Nothing, _uaiRegistry = Nothing}
-- | ID value for this creative. Only alphanumeric characters and the
-- following symbols are valid: \"_\/\\-\". Maximum length is 64
-- characters. Read only when registry is DCM.
uaiValue :: Lens' UniversalAdId (Maybe Text)
uaiValue = lens _uaiValue (\ s a -> s{_uaiValue = a})
-- | Registry used for the Ad ID value.
uaiRegistry :: Lens' UniversalAdId (Maybe UniversalAdIdRegistry)
uaiRegistry
= lens _uaiRegistry (\ s a -> s{_uaiRegistry = a})
instance FromJSON UniversalAdId where
parseJSON
= withObject "UniversalAdId"
(\ o ->
UniversalAdId' <$>
(o .:? "value") <*> (o .:? "registry"))
instance ToJSON UniversalAdId where
toJSON UniversalAdId'{..}
= object
(catMaybes
[("value" .=) <$> _uaiValue,
("registry" .=) <$> _uaiRegistry])
-- | Contains properties of a Campaign Manager ad.
--
-- /See:/ 'ad' smart constructor.
data Ad =
Ad'
{ _aTargetingTemplateId :: !(Maybe (Textual Int64))
, _aCreativeGroupAssignments :: !(Maybe [CreativeGroupAssignment])
, _aGeoTargeting :: !(Maybe GeoTargeting)
, _aCreativeRotation :: !(Maybe CreativeRotation)
, _aTechnologyTargeting :: !(Maybe TechnologyTargeting)
, _aAudienceSegmentId :: !(Maybe (Textual Int64))
, _aDayPartTargeting :: !(Maybe DayPartTargeting)
, _aSize :: !(Maybe Size)
, _aStartTime :: !(Maybe DateTime')
, _aKind :: !(Maybe Text)
, _aClickThroughURLSuffixProperties :: !(Maybe ClickThroughURLSuffixProperties)
, _aCampaignIdDimensionValue :: !(Maybe DimensionValue)
, _aAdvertiserId :: !(Maybe (Textual Int64))
, _aAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _aSSLCompliant :: !(Maybe Bool)
, _aCampaignId :: !(Maybe (Textual Int64))
, _aIdDimensionValue :: !(Maybe DimensionValue)
, _aClickThroughURL :: !(Maybe ClickThroughURL)
, _aDeliverySchedule :: !(Maybe DeliverySchedule)
, _aEventTagOverrides :: !(Maybe [EventTagOverride])
, _aActive :: !(Maybe Bool)
, _aAccountId :: !(Maybe (Textual Int64))
, _aName :: !(Maybe Text)
, _aKeyValueTargetingExpression :: !(Maybe KeyValueTargetingExpression)
, _aEndTime :: !(Maybe DateTime')
, _aCreateInfo :: !(Maybe LastModifiedInfo)
, _aLastModifiedInfo :: !(Maybe LastModifiedInfo)
, _aId :: !(Maybe (Textual Int64))
, _aSSLRequired :: !(Maybe Bool)
, _aComments :: !(Maybe Text)
, _aSubAccountId :: !(Maybe (Textual Int64))
, _aType :: !(Maybe AdType)
, _aRemarketingListExpression :: !(Maybe ListTargetingExpression)
, _aLanguageTargeting :: !(Maybe LanguageTargeting)
, _aDynamicClickTracker :: !(Maybe Bool)
, _aCompatibility :: !(Maybe AdCompatibility)
, _aArchived :: !(Maybe Bool)
, _aDefaultClickThroughEventTagProperties :: !(Maybe DefaultClickThroughEventTagProperties)
, _aPlacementAssignments :: !(Maybe [PlacementAssignment])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Ad' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aTargetingTemplateId'
--
-- * 'aCreativeGroupAssignments'
--
-- * 'aGeoTargeting'
--
-- * 'aCreativeRotation'
--
-- * 'aTechnologyTargeting'
--
-- * 'aAudienceSegmentId'
--
-- * 'aDayPartTargeting'
--
-- * 'aSize'
--
-- * 'aStartTime'
--
-- * 'aKind'
--
-- * 'aClickThroughURLSuffixProperties'
--
-- * 'aCampaignIdDimensionValue'
--
-- * 'aAdvertiserId'
--
-- * 'aAdvertiserIdDimensionValue'
--
-- * 'aSSLCompliant'
--
-- * 'aCampaignId'
--
-- * 'aIdDimensionValue'
--
-- * 'aClickThroughURL'
--
-- * 'aDeliverySchedule'
--
-- * 'aEventTagOverrides'
--
-- * 'aActive'
--
-- * 'aAccountId'
--
-- * 'aName'
--
-- * 'aKeyValueTargetingExpression'
--
-- * 'aEndTime'
--
-- * 'aCreateInfo'
--
-- * 'aLastModifiedInfo'
--
-- * 'aId'
--
-- * 'aSSLRequired'
--
-- * 'aComments'
--
-- * 'aSubAccountId'
--
-- * 'aType'
--
-- * 'aRemarketingListExpression'
--
-- * 'aLanguageTargeting'
--
-- * 'aDynamicClickTracker'
--
-- * 'aCompatibility'
--
-- * 'aArchived'
--
-- * 'aDefaultClickThroughEventTagProperties'
--
-- * 'aPlacementAssignments'
ad
:: Ad
ad =
Ad'
{ _aTargetingTemplateId = Nothing
, _aCreativeGroupAssignments = Nothing
, _aGeoTargeting = Nothing
, _aCreativeRotation = Nothing
, _aTechnologyTargeting = Nothing
, _aAudienceSegmentId = Nothing
, _aDayPartTargeting = Nothing
, _aSize = Nothing
, _aStartTime = Nothing
, _aKind = Nothing
, _aClickThroughURLSuffixProperties = Nothing
, _aCampaignIdDimensionValue = Nothing
, _aAdvertiserId = Nothing
, _aAdvertiserIdDimensionValue = Nothing
, _aSSLCompliant = Nothing
, _aCampaignId = Nothing
, _aIdDimensionValue = Nothing
, _aClickThroughURL = Nothing
, _aDeliverySchedule = Nothing
, _aEventTagOverrides = Nothing
, _aActive = Nothing
, _aAccountId = Nothing
, _aName = Nothing
, _aKeyValueTargetingExpression = Nothing
, _aEndTime = Nothing
, _aCreateInfo = Nothing
, _aLastModifiedInfo = Nothing
, _aId = Nothing
, _aSSLRequired = Nothing
, _aComments = Nothing
, _aSubAccountId = Nothing
, _aType = Nothing
, _aRemarketingListExpression = Nothing
, _aLanguageTargeting = Nothing
, _aDynamicClickTracker = Nothing
, _aCompatibility = Nothing
, _aArchived = Nothing
, _aDefaultClickThroughEventTagProperties = Nothing
, _aPlacementAssignments = Nothing
}
-- | Targeting template ID, used to apply preconfigured targeting information
-- to this ad. This cannot be set while any of dayPartTargeting,
-- geoTargeting, keyValueTargetingExpression, languageTargeting,
-- remarketingListExpression, or technologyTargeting are set. Applicable
-- when type is AD_SERVING_STANDARD_AD.
aTargetingTemplateId :: Lens' Ad (Maybe Int64)
aTargetingTemplateId
= lens _aTargetingTemplateId
(\ s a -> s{_aTargetingTemplateId = a})
. mapping _Coerce
-- | Creative group assignments for this ad. Applicable when type is
-- AD_SERVING_CLICK_TRACKER. Only one assignment per creative group number
-- is allowed for a maximum of two assignments.
aCreativeGroupAssignments :: Lens' Ad [CreativeGroupAssignment]
aCreativeGroupAssignments
= lens _aCreativeGroupAssignments
(\ s a -> s{_aCreativeGroupAssignments = a})
. _Default
. _Coerce
-- | Geographical targeting information for this ad. This field must be left
-- blank if the ad is using a targeting template. Applicable when type is
-- AD_SERVING_STANDARD_AD.
aGeoTargeting :: Lens' Ad (Maybe GeoTargeting)
aGeoTargeting
= lens _aGeoTargeting
(\ s a -> s{_aGeoTargeting = a})
-- | Creative rotation for this ad. Applicable when type is
-- AD_SERVING_DEFAULT_AD, AD_SERVING_STANDARD_AD, or AD_SERVING_TRACKING.
-- When type is AD_SERVING_DEFAULT_AD, this field should have exactly one
-- creativeAssignment .
aCreativeRotation :: Lens' Ad (Maybe CreativeRotation)
aCreativeRotation
= lens _aCreativeRotation
(\ s a -> s{_aCreativeRotation = a})
-- | Technology platform targeting information for this ad. This field must
-- be left blank if the ad is using a targeting template. Applicable when
-- type is AD_SERVING_STANDARD_AD.
aTechnologyTargeting :: Lens' Ad (Maybe TechnologyTargeting)
aTechnologyTargeting
= lens _aTechnologyTargeting
(\ s a -> s{_aTechnologyTargeting = a})
-- | Audience segment ID that is being targeted for this ad. Applicable when
-- type is AD_SERVING_STANDARD_AD.
aAudienceSegmentId :: Lens' Ad (Maybe Int64)
aAudienceSegmentId
= lens _aAudienceSegmentId
(\ s a -> s{_aAudienceSegmentId = a})
. mapping _Coerce
-- | Time and day targeting information for this ad. This field must be left
-- blank if the ad is using a targeting template. Applicable when type is
-- AD_SERVING_STANDARD_AD.
aDayPartTargeting :: Lens' Ad (Maybe DayPartTargeting)
aDayPartTargeting
= lens _aDayPartTargeting
(\ s a -> s{_aDayPartTargeting = a})
-- | Size of this ad. Applicable when type is AD_SERVING_DEFAULT_AD.
aSize :: Lens' Ad (Maybe Size)
aSize = lens _aSize (\ s a -> s{_aSize = a})
aStartTime :: Lens' Ad (Maybe UTCTime)
aStartTime
= lens _aStartTime (\ s a -> s{_aStartTime = a}) .
mapping _DateTime
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#ad\".
aKind :: Lens' Ad (Maybe Text)
aKind = lens _aKind (\ s a -> s{_aKind = a})
-- | Click-through URL suffix properties for this ad. Applies to the URL in
-- the ad or (if overriding ad properties) the URL in the creative.
aClickThroughURLSuffixProperties :: Lens' Ad (Maybe ClickThroughURLSuffixProperties)
aClickThroughURLSuffixProperties
= lens _aClickThroughURLSuffixProperties
(\ s a -> s{_aClickThroughURLSuffixProperties = a})
-- | Dimension value for the ID of the campaign. This is a read-only,
-- auto-generated field.
aCampaignIdDimensionValue :: Lens' Ad (Maybe DimensionValue)
aCampaignIdDimensionValue
= lens _aCampaignIdDimensionValue
(\ s a -> s{_aCampaignIdDimensionValue = a})
-- | Advertiser ID of this ad. This is a required field on insertion.
aAdvertiserId :: Lens' Ad (Maybe Int64)
aAdvertiserId
= lens _aAdvertiserId
(\ s a -> s{_aAdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
aAdvertiserIdDimensionValue :: Lens' Ad (Maybe DimensionValue)
aAdvertiserIdDimensionValue
= lens _aAdvertiserIdDimensionValue
(\ s a -> s{_aAdvertiserIdDimensionValue = a})
-- | Whether this ad is ssl compliant. This is a read-only field that is
-- auto-generated when the ad is inserted or updated.
aSSLCompliant :: Lens' Ad (Maybe Bool)
aSSLCompliant
= lens _aSSLCompliant
(\ s a -> s{_aSSLCompliant = a})
-- | Campaign ID of this ad. This is a required field on insertion.
aCampaignId :: Lens' Ad (Maybe Int64)
aCampaignId
= lens _aCampaignId (\ s a -> s{_aCampaignId = a}) .
mapping _Coerce
-- | Dimension value for the ID of this ad. This is a read-only,
-- auto-generated field.
aIdDimensionValue :: Lens' Ad (Maybe DimensionValue)
aIdDimensionValue
= lens _aIdDimensionValue
(\ s a -> s{_aIdDimensionValue = a})
-- | Click-through URL for this ad. This is a required field on insertion.
-- Applicable when type is AD_SERVING_CLICK_TRACKER.
aClickThroughURL :: Lens' Ad (Maybe ClickThroughURL)
aClickThroughURL
= lens _aClickThroughURL
(\ s a -> s{_aClickThroughURL = a})
-- | Delivery schedule information for this ad. Applicable when type is
-- AD_SERVING_STANDARD_AD or AD_SERVING_TRACKING. This field along with
-- subfields priority and impressionRatio are required on insertion when
-- type is AD_SERVING_STANDARD_AD.
aDeliverySchedule :: Lens' Ad (Maybe DeliverySchedule)
aDeliverySchedule
= lens _aDeliverySchedule
(\ s a -> s{_aDeliverySchedule = a})
-- | Event tag overrides for this ad.
aEventTagOverrides :: Lens' Ad [EventTagOverride]
aEventTagOverrides
= lens _aEventTagOverrides
(\ s a -> s{_aEventTagOverrides = a})
. _Default
. _Coerce
-- | Whether this ad is active. When true, archived must be false.
aActive :: Lens' Ad (Maybe Bool)
aActive = lens _aActive (\ s a -> s{_aActive = a})
-- | Account ID of this ad. This is a read-only field that can be left blank.
aAccountId :: Lens' Ad (Maybe Int64)
aAccountId
= lens _aAccountId (\ s a -> s{_aAccountId = a}) .
mapping _Coerce
-- | Name of this ad. This is a required field and must be less than 256
-- characters long.
aName :: Lens' Ad (Maybe Text)
aName = lens _aName (\ s a -> s{_aName = a})
-- | Key-value targeting information for this ad. This field must be left
-- blank if the ad is using a targeting template. Applicable when type is
-- AD_SERVING_STANDARD_AD.
aKeyValueTargetingExpression :: Lens' Ad (Maybe KeyValueTargetingExpression)
aKeyValueTargetingExpression
= lens _aKeyValueTargetingExpression
(\ s a -> s{_aKeyValueTargetingExpression = a})
aEndTime :: Lens' Ad (Maybe UTCTime)
aEndTime
= lens _aEndTime (\ s a -> s{_aEndTime = a}) .
mapping _DateTime
-- | Information about the creation of this ad. This is a read-only field.
aCreateInfo :: Lens' Ad (Maybe LastModifiedInfo)
aCreateInfo
= lens _aCreateInfo (\ s a -> s{_aCreateInfo = a})
-- | Information about the most recent modification of this ad. This is a
-- read-only field.
aLastModifiedInfo :: Lens' Ad (Maybe LastModifiedInfo)
aLastModifiedInfo
= lens _aLastModifiedInfo
(\ s a -> s{_aLastModifiedInfo = a})
-- | ID of this ad. This is a read-only, auto-generated field.
aId :: Lens' Ad (Maybe Int64)
aId
= lens _aId (\ s a -> s{_aId = a}) . mapping _Coerce
-- | Whether this ad requires ssl. This is a read-only field that is
-- auto-generated when the ad is inserted or updated.
aSSLRequired :: Lens' Ad (Maybe Bool)
aSSLRequired
= lens _aSSLRequired (\ s a -> s{_aSSLRequired = a})
-- | Comments for this ad.
aComments :: Lens' Ad (Maybe Text)
aComments
= lens _aComments (\ s a -> s{_aComments = a})
-- | Subaccount ID of this ad. This is a read-only field that can be left
-- blank.
aSubAccountId :: Lens' Ad (Maybe Int64)
aSubAccountId
= lens _aSubAccountId
(\ s a -> s{_aSubAccountId = a})
. mapping _Coerce
-- | Type of ad. This is a required field on insertion. Note that default ads
-- ( AD_SERVING_DEFAULT_AD) cannot be created directly (see Creative
-- resource).
aType :: Lens' Ad (Maybe AdType)
aType = lens _aType (\ s a -> s{_aType = a})
-- | Remarketing list targeting expression for this ad. This field must be
-- left blank if the ad is using a targeting template. Applicable when type
-- is AD_SERVING_STANDARD_AD.
aRemarketingListExpression :: Lens' Ad (Maybe ListTargetingExpression)
aRemarketingListExpression
= lens _aRemarketingListExpression
(\ s a -> s{_aRemarketingListExpression = a})
-- | Language targeting information for this ad. This field must be left
-- blank if the ad is using a targeting template. Applicable when type is
-- AD_SERVING_STANDARD_AD.
aLanguageTargeting :: Lens' Ad (Maybe LanguageTargeting)
aLanguageTargeting
= lens _aLanguageTargeting
(\ s a -> s{_aLanguageTargeting = a})
-- | Whether this ad is a dynamic click tracker. Applicable when type is
-- AD_SERVING_CLICK_TRACKER. This is a required field on insert, and is
-- read-only after insert.
aDynamicClickTracker :: Lens' Ad (Maybe Bool)
aDynamicClickTracker
= lens _aDynamicClickTracker
(\ s a -> s{_aDynamicClickTracker = a})
-- | Compatibility of this ad. Applicable when type is AD_SERVING_DEFAULT_AD.
-- DISPLAY and DISPLAY_INTERSTITIAL refer to either rendering on desktop or
-- on mobile devices or in mobile apps for regular or interstitial ads,
-- respectively. APP and APP_INTERSTITIAL are only used for existing
-- default ads. New mobile placements must be assigned DISPLAY or
-- DISPLAY_INTERSTITIAL and default ads created for those placements will
-- be limited to those compatibility types. IN_STREAM_VIDEO refers to
-- rendering in-stream video ads developed with the VAST standard.
aCompatibility :: Lens' Ad (Maybe AdCompatibility)
aCompatibility
= lens _aCompatibility
(\ s a -> s{_aCompatibility = a})
-- | Whether this ad is archived. When true, active must be false.
aArchived :: Lens' Ad (Maybe Bool)
aArchived
= lens _aArchived (\ s a -> s{_aArchived = a})
-- | Default click-through event tag properties for this ad.
aDefaultClickThroughEventTagProperties :: Lens' Ad (Maybe DefaultClickThroughEventTagProperties)
aDefaultClickThroughEventTagProperties
= lens _aDefaultClickThroughEventTagProperties
(\ s a ->
s{_aDefaultClickThroughEventTagProperties = a})
-- | Placement assignments for this ad.
aPlacementAssignments :: Lens' Ad [PlacementAssignment]
aPlacementAssignments
= lens _aPlacementAssignments
(\ s a -> s{_aPlacementAssignments = a})
. _Default
. _Coerce
instance FromJSON Ad where
parseJSON
= withObject "Ad"
(\ o ->
Ad' <$>
(o .:? "targetingTemplateId") <*>
(o .:? "creativeGroupAssignments" .!= mempty)
<*> (o .:? "geoTargeting")
<*> (o .:? "creativeRotation")
<*> (o .:? "technologyTargeting")
<*> (o .:? "audienceSegmentId")
<*> (o .:? "dayPartTargeting")
<*> (o .:? "size")
<*> (o .:? "startTime")
<*> (o .:? "kind")
<*> (o .:? "clickThroughUrlSuffixProperties")
<*> (o .:? "campaignIdDimensionValue")
<*> (o .:? "advertiserId")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "sslCompliant")
<*> (o .:? "campaignId")
<*> (o .:? "idDimensionValue")
<*> (o .:? "clickThroughUrl")
<*> (o .:? "deliverySchedule")
<*> (o .:? "eventTagOverrides" .!= mempty)
<*> (o .:? "active")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "keyValueTargetingExpression")
<*> (o .:? "endTime")
<*> (o .:? "createInfo")
<*> (o .:? "lastModifiedInfo")
<*> (o .:? "id")
<*> (o .:? "sslRequired")
<*> (o .:? "comments")
<*> (o .:? "subaccountId")
<*> (o .:? "type")
<*> (o .:? "remarketingListExpression")
<*> (o .:? "languageTargeting")
<*> (o .:? "dynamicClickTracker")
<*> (o .:? "compatibility")
<*> (o .:? "archived")
<*> (o .:? "defaultClickThroughEventTagProperties")
<*> (o .:? "placementAssignments" .!= mempty))
instance ToJSON Ad where
toJSON Ad'{..}
= object
(catMaybes
[("targetingTemplateId" .=) <$>
_aTargetingTemplateId,
("creativeGroupAssignments" .=) <$>
_aCreativeGroupAssignments,
("geoTargeting" .=) <$> _aGeoTargeting,
("creativeRotation" .=) <$> _aCreativeRotation,
("technologyTargeting" .=) <$> _aTechnologyTargeting,
("audienceSegmentId" .=) <$> _aAudienceSegmentId,
("dayPartTargeting" .=) <$> _aDayPartTargeting,
("size" .=) <$> _aSize,
("startTime" .=) <$> _aStartTime,
("kind" .=) <$> _aKind,
("clickThroughUrlSuffixProperties" .=) <$>
_aClickThroughURLSuffixProperties,
("campaignIdDimensionValue" .=) <$>
_aCampaignIdDimensionValue,
("advertiserId" .=) <$> _aAdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_aAdvertiserIdDimensionValue,
("sslCompliant" .=) <$> _aSSLCompliant,
("campaignId" .=) <$> _aCampaignId,
("idDimensionValue" .=) <$> _aIdDimensionValue,
("clickThroughUrl" .=) <$> _aClickThroughURL,
("deliverySchedule" .=) <$> _aDeliverySchedule,
("eventTagOverrides" .=) <$> _aEventTagOverrides,
("active" .=) <$> _aActive,
("accountId" .=) <$> _aAccountId,
("name" .=) <$> _aName,
("keyValueTargetingExpression" .=) <$>
_aKeyValueTargetingExpression,
("endTime" .=) <$> _aEndTime,
("createInfo" .=) <$> _aCreateInfo,
("lastModifiedInfo" .=) <$> _aLastModifiedInfo,
("id" .=) <$> _aId,
("sslRequired" .=) <$> _aSSLRequired,
("comments" .=) <$> _aComments,
("subaccountId" .=) <$> _aSubAccountId,
("type" .=) <$> _aType,
("remarketingListExpression" .=) <$>
_aRemarketingListExpression,
("languageTargeting" .=) <$> _aLanguageTargeting,
("dynamicClickTracker" .=) <$> _aDynamicClickTracker,
("compatibility" .=) <$> _aCompatibility,
("archived" .=) <$> _aArchived,
("defaultClickThroughEventTagProperties" .=) <$>
_aDefaultClickThroughEventTagProperties,
("placementAssignments" .=) <$>
_aPlacementAssignments])
-- | Contains properties of a Planning project.
--
-- /See:/ 'project' smart constructor.
data Project =
Project'
{ _pTargetClicks :: !(Maybe (Textual Int64))
, _pClientBillingCode :: !(Maybe Text)
, _pTargetCpmNanos :: !(Maybe (Textual Int64))
, _pTargetConversions :: !(Maybe (Textual Int64))
, _pBudget :: !(Maybe (Textual Int64))
, _pKind :: !(Maybe Text)
, _pAdvertiserId :: !(Maybe (Textual Int64))
, _pEndDate :: !(Maybe Date')
, _pOverview :: !(Maybe Text)
, _pTargetImpressions :: !(Maybe (Textual Int64))
, _pStartDate :: !(Maybe Date')
, _pTargetCpcNanos :: !(Maybe (Textual Int64))
, _pAccountId :: !(Maybe (Textual Int64))
, _pName :: !(Maybe Text)
, _pLastModifiedInfo :: !(Maybe LastModifiedInfo)
, _pId :: !(Maybe (Textual Int64))
, _pAudienceAgeGroup :: !(Maybe ProjectAudienceAgeGroup)
, _pSubAccountId :: !(Maybe (Textual Int64))
, _pTargetCpmActiveViewNanos :: !(Maybe (Textual Int64))
, _pAudienceGender :: !(Maybe ProjectAudienceGender)
, _pClientName :: !(Maybe Text)
, _pTargetCpaNanos :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Project' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pTargetClicks'
--
-- * 'pClientBillingCode'
--
-- * 'pTargetCpmNanos'
--
-- * 'pTargetConversions'
--
-- * 'pBudget'
--
-- * 'pKind'
--
-- * 'pAdvertiserId'
--
-- * 'pEndDate'
--
-- * 'pOverview'
--
-- * 'pTargetImpressions'
--
-- * 'pStartDate'
--
-- * 'pTargetCpcNanos'
--
-- * 'pAccountId'
--
-- * 'pName'
--
-- * 'pLastModifiedInfo'
--
-- * 'pId'
--
-- * 'pAudienceAgeGroup'
--
-- * 'pSubAccountId'
--
-- * 'pTargetCpmActiveViewNanos'
--
-- * 'pAudienceGender'
--
-- * 'pClientName'
--
-- * 'pTargetCpaNanos'
project
:: Project
project =
Project'
{ _pTargetClicks = Nothing
, _pClientBillingCode = Nothing
, _pTargetCpmNanos = Nothing
, _pTargetConversions = Nothing
, _pBudget = Nothing
, _pKind = Nothing
, _pAdvertiserId = Nothing
, _pEndDate = Nothing
, _pOverview = Nothing
, _pTargetImpressions = Nothing
, _pStartDate = Nothing
, _pTargetCpcNanos = Nothing
, _pAccountId = Nothing
, _pName = Nothing
, _pLastModifiedInfo = Nothing
, _pId = Nothing
, _pAudienceAgeGroup = Nothing
, _pSubAccountId = Nothing
, _pTargetCpmActiveViewNanos = Nothing
, _pAudienceGender = Nothing
, _pClientName = Nothing
, _pTargetCpaNanos = Nothing
}
-- | Number of clicks that the advertiser is targeting.
pTargetClicks :: Lens' Project (Maybe Int64)
pTargetClicks
= lens _pTargetClicks
(\ s a -> s{_pTargetClicks = a})
. mapping _Coerce
-- | Client billing code of this project.
pClientBillingCode :: Lens' Project (Maybe Text)
pClientBillingCode
= lens _pClientBillingCode
(\ s a -> s{_pClientBillingCode = a})
-- | CPM that the advertiser is targeting.
pTargetCpmNanos :: Lens' Project (Maybe Int64)
pTargetCpmNanos
= lens _pTargetCpmNanos
(\ s a -> s{_pTargetCpmNanos = a})
. mapping _Coerce
-- | Number of conversions that the advertiser is targeting.
pTargetConversions :: Lens' Project (Maybe Int64)
pTargetConversions
= lens _pTargetConversions
(\ s a -> s{_pTargetConversions = a})
. mapping _Coerce
-- | Budget of this project in the currency specified by the current account.
-- The value stored in this field represents only the non-fractional
-- amount. For example, for USD, the smallest value that can be represented
-- by this field is 1 US dollar.
pBudget :: Lens' Project (Maybe Int64)
pBudget
= lens _pBudget (\ s a -> s{_pBudget = a}) .
mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#project\".
pKind :: Lens' Project (Maybe Text)
pKind = lens _pKind (\ s a -> s{_pKind = a})
-- | Advertiser ID of this project.
pAdvertiserId :: Lens' Project (Maybe Int64)
pAdvertiserId
= lens _pAdvertiserId
(\ s a -> s{_pAdvertiserId = a})
. mapping _Coerce
pEndDate :: Lens' Project (Maybe Day)
pEndDate
= lens _pEndDate (\ s a -> s{_pEndDate = a}) .
mapping _Date
-- | Overview of this project.
pOverview :: Lens' Project (Maybe Text)
pOverview
= lens _pOverview (\ s a -> s{_pOverview = a})
-- | Number of impressions that the advertiser is targeting.
pTargetImpressions :: Lens' Project (Maybe Int64)
pTargetImpressions
= lens _pTargetImpressions
(\ s a -> s{_pTargetImpressions = a})
. mapping _Coerce
pStartDate :: Lens' Project (Maybe Day)
pStartDate
= lens _pStartDate (\ s a -> s{_pStartDate = a}) .
mapping _Date
-- | CPC that the advertiser is targeting.
pTargetCpcNanos :: Lens' Project (Maybe Int64)
pTargetCpcNanos
= lens _pTargetCpcNanos
(\ s a -> s{_pTargetCpcNanos = a})
. mapping _Coerce
-- | Account ID of this project.
pAccountId :: Lens' Project (Maybe Int64)
pAccountId
= lens _pAccountId (\ s a -> s{_pAccountId = a}) .
mapping _Coerce
-- | Name of this project.
pName :: Lens' Project (Maybe Text)
pName = lens _pName (\ s a -> s{_pName = a})
-- | Information about the most recent modification of this project.
pLastModifiedInfo :: Lens' Project (Maybe LastModifiedInfo)
pLastModifiedInfo
= lens _pLastModifiedInfo
(\ s a -> s{_pLastModifiedInfo = a})
-- | ID of this project. This is a read-only, auto-generated field.
pId :: Lens' Project (Maybe Int64)
pId
= lens _pId (\ s a -> s{_pId = a}) . mapping _Coerce
-- | Audience age group of this project.
pAudienceAgeGroup :: Lens' Project (Maybe ProjectAudienceAgeGroup)
pAudienceAgeGroup
= lens _pAudienceAgeGroup
(\ s a -> s{_pAudienceAgeGroup = a})
-- | Subaccount ID of this project.
pSubAccountId :: Lens' Project (Maybe Int64)
pSubAccountId
= lens _pSubAccountId
(\ s a -> s{_pSubAccountId = a})
. mapping _Coerce
-- | vCPM from Active View that the advertiser is targeting.
pTargetCpmActiveViewNanos :: Lens' Project (Maybe Int64)
pTargetCpmActiveViewNanos
= lens _pTargetCpmActiveViewNanos
(\ s a -> s{_pTargetCpmActiveViewNanos = a})
. mapping _Coerce
-- | Audience gender of this project.
pAudienceGender :: Lens' Project (Maybe ProjectAudienceGender)
pAudienceGender
= lens _pAudienceGender
(\ s a -> s{_pAudienceGender = a})
-- | Name of the project client.
pClientName :: Lens' Project (Maybe Text)
pClientName
= lens _pClientName (\ s a -> s{_pClientName = a})
-- | CPA that the advertiser is targeting.
pTargetCpaNanos :: Lens' Project (Maybe Int64)
pTargetCpaNanos
= lens _pTargetCpaNanos
(\ s a -> s{_pTargetCpaNanos = a})
. mapping _Coerce
instance FromJSON Project where
parseJSON
= withObject "Project"
(\ o ->
Project' <$>
(o .:? "targetClicks") <*>
(o .:? "clientBillingCode")
<*> (o .:? "targetCpmNanos")
<*> (o .:? "targetConversions")
<*> (o .:? "budget")
<*> (o .:? "kind")
<*> (o .:? "advertiserId")
<*> (o .:? "endDate")
<*> (o .:? "overview")
<*> (o .:? "targetImpressions")
<*> (o .:? "startDate")
<*> (o .:? "targetCpcNanos")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "lastModifiedInfo")
<*> (o .:? "id")
<*> (o .:? "audienceAgeGroup")
<*> (o .:? "subaccountId")
<*> (o .:? "targetCpmActiveViewNanos")
<*> (o .:? "audienceGender")
<*> (o .:? "clientName")
<*> (o .:? "targetCpaNanos"))
instance ToJSON Project where
toJSON Project'{..}
= object
(catMaybes
[("targetClicks" .=) <$> _pTargetClicks,
("clientBillingCode" .=) <$> _pClientBillingCode,
("targetCpmNanos" .=) <$> _pTargetCpmNanos,
("targetConversions" .=) <$> _pTargetConversions,
("budget" .=) <$> _pBudget, ("kind" .=) <$> _pKind,
("advertiserId" .=) <$> _pAdvertiserId,
("endDate" .=) <$> _pEndDate,
("overview" .=) <$> _pOverview,
("targetImpressions" .=) <$> _pTargetImpressions,
("startDate" .=) <$> _pStartDate,
("targetCpcNanos" .=) <$> _pTargetCpcNanos,
("accountId" .=) <$> _pAccountId,
("name" .=) <$> _pName,
("lastModifiedInfo" .=) <$> _pLastModifiedInfo,
("id" .=) <$> _pId,
("audienceAgeGroup" .=) <$> _pAudienceAgeGroup,
("subaccountId" .=) <$> _pSubAccountId,
("targetCpmActiveViewNanos" .=) <$>
_pTargetCpmActiveViewNanos,
("audienceGender" .=) <$> _pAudienceGender,
("clientName" .=) <$> _pClientName,
("targetCpaNanos" .=) <$> _pTargetCpaNanos])
-- | The report criteria for a report of type \"FLOODLIGHT\".
--
-- /See:/ 'reportFloodlightCriteria' smart constructor.
data ReportFloodlightCriteria =
ReportFloodlightCriteria'
{ _rfcReportProperties :: !(Maybe ReportFloodlightCriteriaReportProperties)
, _rfcMetricNames :: !(Maybe [Text])
, _rfcCustomRichMediaEvents :: !(Maybe [DimensionValue])
, _rfcDimensionFilters :: !(Maybe [DimensionValue])
, _rfcDateRange :: !(Maybe DateRange)
, _rfcFloodlightConfigId :: !(Maybe DimensionValue)
, _rfcDimensions :: !(Maybe [SortedDimension])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportFloodlightCriteria' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rfcReportProperties'
--
-- * 'rfcMetricNames'
--
-- * 'rfcCustomRichMediaEvents'
--
-- * 'rfcDimensionFilters'
--
-- * 'rfcDateRange'
--
-- * 'rfcFloodlightConfigId'
--
-- * 'rfcDimensions'
reportFloodlightCriteria
:: ReportFloodlightCriteria
reportFloodlightCriteria =
ReportFloodlightCriteria'
{ _rfcReportProperties = Nothing
, _rfcMetricNames = Nothing
, _rfcCustomRichMediaEvents = Nothing
, _rfcDimensionFilters = Nothing
, _rfcDateRange = Nothing
, _rfcFloodlightConfigId = Nothing
, _rfcDimensions = Nothing
}
-- | The properties of the report.
rfcReportProperties :: Lens' ReportFloodlightCriteria (Maybe ReportFloodlightCriteriaReportProperties)
rfcReportProperties
= lens _rfcReportProperties
(\ s a -> s{_rfcReportProperties = a})
-- | The list of names of metrics the report should include.
rfcMetricNames :: Lens' ReportFloodlightCriteria [Text]
rfcMetricNames
= lens _rfcMetricNames
(\ s a -> s{_rfcMetricNames = a})
. _Default
. _Coerce
-- | The list of custom rich media events to include.
rfcCustomRichMediaEvents :: Lens' ReportFloodlightCriteria [DimensionValue]
rfcCustomRichMediaEvents
= lens _rfcCustomRichMediaEvents
(\ s a -> s{_rfcCustomRichMediaEvents = a})
. _Default
. _Coerce
-- | The list of filters on which dimensions are filtered. Filters for
-- different dimensions are ANDed, filters for the same dimension are
-- grouped together and ORed.
rfcDimensionFilters :: Lens' ReportFloodlightCriteria [DimensionValue]
rfcDimensionFilters
= lens _rfcDimensionFilters
(\ s a -> s{_rfcDimensionFilters = a})
. _Default
. _Coerce
-- | The date range this report should be run for.
rfcDateRange :: Lens' ReportFloodlightCriteria (Maybe DateRange)
rfcDateRange
= lens _rfcDateRange (\ s a -> s{_rfcDateRange = a})
-- | The floodlight ID for which to show data in this report. All advertisers
-- associated with that ID will automatically be added. The dimension of
-- the value needs to be \'dfa:floodlightConfigId\'.
rfcFloodlightConfigId :: Lens' ReportFloodlightCriteria (Maybe DimensionValue)
rfcFloodlightConfigId
= lens _rfcFloodlightConfigId
(\ s a -> s{_rfcFloodlightConfigId = a})
-- | The list of dimensions the report should include.
rfcDimensions :: Lens' ReportFloodlightCriteria [SortedDimension]
rfcDimensions
= lens _rfcDimensions
(\ s a -> s{_rfcDimensions = a})
. _Default
. _Coerce
instance FromJSON ReportFloodlightCriteria where
parseJSON
= withObject "ReportFloodlightCriteria"
(\ o ->
ReportFloodlightCriteria' <$>
(o .:? "reportProperties") <*>
(o .:? "metricNames" .!= mempty)
<*> (o .:? "customRichMediaEvents" .!= mempty)
<*> (o .:? "dimensionFilters" .!= mempty)
<*> (o .:? "dateRange")
<*> (o .:? "floodlightConfigId")
<*> (o .:? "dimensions" .!= mempty))
instance ToJSON ReportFloodlightCriteria where
toJSON ReportFloodlightCriteria'{..}
= object
(catMaybes
[("reportProperties" .=) <$> _rfcReportProperties,
("metricNames" .=) <$> _rfcMetricNames,
("customRichMediaEvents" .=) <$>
_rfcCustomRichMediaEvents,
("dimensionFilters" .=) <$> _rfcDimensionFilters,
("dateRange" .=) <$> _rfcDateRange,
("floodlightConfigId" .=) <$> _rfcFloodlightConfigId,
("dimensions" .=) <$> _rfcDimensions])
-- | Represents the dimensions of ads, placements, creatives, or creative
-- assets.
--
-- /See:/ 'size' smart constructor.
data Size =
Size'
{ _sHeight :: !(Maybe (Textual Int32))
, _sKind :: !(Maybe Text)
, _sWidth :: !(Maybe (Textual Int32))
, _sIab :: !(Maybe Bool)
, _sId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Size' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sHeight'
--
-- * 'sKind'
--
-- * 'sWidth'
--
-- * 'sIab'
--
-- * 'sId'
size
:: Size
size =
Size'
{ _sHeight = Nothing
, _sKind = Nothing
, _sWidth = Nothing
, _sIab = Nothing
, _sId = Nothing
}
-- | Height of this size. Acceptable values are 0 to 32767, inclusive.
sHeight :: Lens' Size (Maybe Int32)
sHeight
= lens _sHeight (\ s a -> s{_sHeight = a}) .
mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#size\".
sKind :: Lens' Size (Maybe Text)
sKind = lens _sKind (\ s a -> s{_sKind = a})
-- | Width of this size. Acceptable values are 0 to 32767, inclusive.
sWidth :: Lens' Size (Maybe Int32)
sWidth
= lens _sWidth (\ s a -> s{_sWidth = a}) .
mapping _Coerce
-- | IAB standard size. This is a read-only, auto-generated field.
sIab :: Lens' Size (Maybe Bool)
sIab = lens _sIab (\ s a -> s{_sIab = a})
-- | ID of this size. This is a read-only, auto-generated field.
sId :: Lens' Size (Maybe Int64)
sId
= lens _sId (\ s a -> s{_sId = a}) . mapping _Coerce
instance FromJSON Size where
parseJSON
= withObject "Size"
(\ o ->
Size' <$>
(o .:? "height") <*> (o .:? "kind") <*>
(o .:? "width")
<*> (o .:? "iab")
<*> (o .:? "id"))
instance ToJSON Size where
toJSON Size'{..}
= object
(catMaybes
[("height" .=) <$> _sHeight, ("kind" .=) <$> _sKind,
("width" .=) <$> _sWidth, ("iab" .=) <$> _sIab,
("id" .=) <$> _sId])
-- | Object Filter.
--
-- /See:/ 'objectFilter' smart constructor.
data ObjectFilter =
ObjectFilter'
{ _ofStatus :: !(Maybe ObjectFilterStatus)
, _ofKind :: !(Maybe Text)
, _ofObjectIds :: !(Maybe [Textual Int64])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ObjectFilter' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ofStatus'
--
-- * 'ofKind'
--
-- * 'ofObjectIds'
objectFilter
:: ObjectFilter
objectFilter =
ObjectFilter' {_ofStatus = Nothing, _ofKind = Nothing, _ofObjectIds = Nothing}
-- | Status of the filter. NONE means the user has access to none of the
-- objects. ALL means the user has access to all objects. ASSIGNED means
-- the user has access to the objects with IDs in the objectIds list.
ofStatus :: Lens' ObjectFilter (Maybe ObjectFilterStatus)
ofStatus = lens _ofStatus (\ s a -> s{_ofStatus = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#objectFilter\".
ofKind :: Lens' ObjectFilter (Maybe Text)
ofKind = lens _ofKind (\ s a -> s{_ofKind = a})
-- | Applicable when status is ASSIGNED. The user has access to objects with
-- these object IDs.
ofObjectIds :: Lens' ObjectFilter [Int64]
ofObjectIds
= lens _ofObjectIds (\ s a -> s{_ofObjectIds = a}) .
_Default
. _Coerce
instance FromJSON ObjectFilter where
parseJSON
= withObject "ObjectFilter"
(\ o ->
ObjectFilter' <$>
(o .:? "status") <*> (o .:? "kind") <*>
(o .:? "objectIds" .!= mempty))
instance ToJSON ObjectFilter where
toJSON ObjectFilter'{..}
= object
(catMaybes
[("status" .=) <$> _ofStatus,
("kind" .=) <$> _ofKind,
("objectIds" .=) <$> _ofObjectIds])
-- | Skippable Settings
--
-- /See:/ 'skippableSetting' smart constructor.
data SkippableSetting =
SkippableSetting'
{ _ssSkipOffSet :: !(Maybe VideoOffSet)
, _ssProgressOffSet :: !(Maybe VideoOffSet)
, _ssKind :: !(Maybe Text)
, _ssSkippable :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SkippableSetting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ssSkipOffSet'
--
-- * 'ssProgressOffSet'
--
-- * 'ssKind'
--
-- * 'ssSkippable'
skippableSetting
:: SkippableSetting
skippableSetting =
SkippableSetting'
{ _ssSkipOffSet = Nothing
, _ssProgressOffSet = Nothing
, _ssKind = Nothing
, _ssSkippable = Nothing
}
-- | Amount of time to play videos served to this placement before the skip
-- button should appear. Applicable when skippable is true.
ssSkipOffSet :: Lens' SkippableSetting (Maybe VideoOffSet)
ssSkipOffSet
= lens _ssSkipOffSet (\ s a -> s{_ssSkipOffSet = a})
-- | Amount of time to play videos served to this placement before counting a
-- view. Applicable when skippable is true.
ssProgressOffSet :: Lens' SkippableSetting (Maybe VideoOffSet)
ssProgressOffSet
= lens _ssProgressOffSet
(\ s a -> s{_ssProgressOffSet = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#skippableSetting\".
ssKind :: Lens' SkippableSetting (Maybe Text)
ssKind = lens _ssKind (\ s a -> s{_ssKind = a})
-- | Whether the user can skip creatives served to this placement.
ssSkippable :: Lens' SkippableSetting (Maybe Bool)
ssSkippable
= lens _ssSkippable (\ s a -> s{_ssSkippable = a})
instance FromJSON SkippableSetting where
parseJSON
= withObject "SkippableSetting"
(\ o ->
SkippableSetting' <$>
(o .:? "skipOffset") <*> (o .:? "progressOffset") <*>
(o .:? "kind")
<*> (o .:? "skippable"))
instance ToJSON SkippableSetting where
toJSON SkippableSetting'{..}
= object
(catMaybes
[("skipOffset" .=) <$> _ssSkipOffSet,
("progressOffset" .=) <$> _ssProgressOffSet,
("kind" .=) <$> _ssKind,
("skippable" .=) <$> _ssSkippable])
-- | Reporting Configuration
--
-- /See:/ 'reportsConfiguration' smart constructor.
data ReportsConfiguration =
ReportsConfiguration'
{ _rcExposureToConversionEnabled :: !(Maybe Bool)
, _rcReportGenerationTimeZoneId :: !(Maybe (Textual Int64))
, _rcLookbackConfiguration :: !(Maybe LookbackConfiguration)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportsConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rcExposureToConversionEnabled'
--
-- * 'rcReportGenerationTimeZoneId'
--
-- * 'rcLookbackConfiguration'
reportsConfiguration
:: ReportsConfiguration
reportsConfiguration =
ReportsConfiguration'
{ _rcExposureToConversionEnabled = Nothing
, _rcReportGenerationTimeZoneId = Nothing
, _rcLookbackConfiguration = Nothing
}
-- | Whether the exposure to conversion report is enabled. This report shows
-- detailed pathway information on up to 10 of the most recent ad exposures
-- seen by a user before converting.
rcExposureToConversionEnabled :: Lens' ReportsConfiguration (Maybe Bool)
rcExposureToConversionEnabled
= lens _rcExposureToConversionEnabled
(\ s a -> s{_rcExposureToConversionEnabled = a})
-- | Report generation time zone ID of this account. This is a required field
-- that can only be changed by a superuser. Acceptable values are: - \"1\"
-- for \"America\/New_York\" - \"2\" for \"Europe\/London\" - \"3\" for
-- \"Europe\/Paris\" - \"4\" for \"Africa\/Johannesburg\" - \"5\" for
-- \"Asia\/Jerusalem\" - \"6\" for \"Asia\/Shanghai\" - \"7\" for
-- \"Asia\/Hong_Kong\" - \"8\" for \"Asia\/Tokyo\" - \"9\" for
-- \"Australia\/Sydney\" - \"10\" for \"Asia\/Dubai\" - \"11\" for
-- \"America\/Los_Angeles\" - \"12\" for \"Pacific\/Auckland\" - \"13\" for
-- \"America\/Sao_Paulo\" - \"16\" for \"America\/Asuncion\" - \"17\" for
-- \"America\/Chicago\" - \"18\" for \"America\/Denver\" - \"19\" for
-- \"America\/St_Johns\" - \"20\" for \"Asia\/Dhaka\" - \"21\" for
-- \"Asia\/Jakarta\" - \"22\" for \"Asia\/Kabul\" - \"23\" for
-- \"Asia\/Karachi\" - \"24\" for \"Asia\/Calcutta\" - \"25\" for
-- \"Asia\/Pyongyang\" - \"26\" for \"Asia\/Rangoon\" - \"27\" for
-- \"Atlantic\/Cape_Verde\" - \"28\" for \"Atlantic\/South_Georgia\" -
-- \"29\" for \"Australia\/Adelaide\" - \"30\" for \"Australia\/Lord_Howe\"
-- - \"31\" for \"Europe\/Moscow\" - \"32\" for \"Pacific\/Kiritimati\" -
-- \"35\" for \"Pacific\/Norfolk\" - \"36\" for \"Pacific\/Tongatapu\"
rcReportGenerationTimeZoneId :: Lens' ReportsConfiguration (Maybe Int64)
rcReportGenerationTimeZoneId
= lens _rcReportGenerationTimeZoneId
(\ s a -> s{_rcReportGenerationTimeZoneId = a})
. mapping _Coerce
-- | Default lookback windows for new advertisers in this account.
rcLookbackConfiguration :: Lens' ReportsConfiguration (Maybe LookbackConfiguration)
rcLookbackConfiguration
= lens _rcLookbackConfiguration
(\ s a -> s{_rcLookbackConfiguration = a})
instance FromJSON ReportsConfiguration where
parseJSON
= withObject "ReportsConfiguration"
(\ o ->
ReportsConfiguration' <$>
(o .:? "exposureToConversionEnabled") <*>
(o .:? "reportGenerationTimeZoneId")
<*> (o .:? "lookbackConfiguration"))
instance ToJSON ReportsConfiguration where
toJSON ReportsConfiguration'{..}
= object
(catMaybes
[("exposureToConversionEnabled" .=) <$>
_rcExposureToConversionEnabled,
("reportGenerationTimeZoneId" .=) <$>
_rcReportGenerationTimeZoneId,
("lookbackConfiguration" .=) <$>
_rcLookbackConfiguration])
-- | Pricing Schedule
--
-- /See:/ 'pricingSchedule' smart constructor.
data PricingSchedule =
PricingSchedule'
{ _psTestingStartDate :: !(Maybe Date')
, _psFloodlightActivityId :: !(Maybe (Textual Int64))
, _psEndDate :: !(Maybe Date')
, _psStartDate :: !(Maybe Date')
, _psCapCostOption :: !(Maybe PricingScheduleCapCostOption)
, _psPricingType :: !(Maybe PricingSchedulePricingType)
, _psPricingPeriods :: !(Maybe [PricingSchedulePricingPeriod])
, _psFlighted :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PricingSchedule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'psTestingStartDate'
--
-- * 'psFloodlightActivityId'
--
-- * 'psEndDate'
--
-- * 'psStartDate'
--
-- * 'psCapCostOption'
--
-- * 'psPricingType'
--
-- * 'psPricingPeriods'
--
-- * 'psFlighted'
pricingSchedule
:: PricingSchedule
pricingSchedule =
PricingSchedule'
{ _psTestingStartDate = Nothing
, _psFloodlightActivityId = Nothing
, _psEndDate = Nothing
, _psStartDate = Nothing
, _psCapCostOption = Nothing
, _psPricingType = Nothing
, _psPricingPeriods = Nothing
, _psFlighted = Nothing
}
psTestingStartDate :: Lens' PricingSchedule (Maybe Day)
psTestingStartDate
= lens _psTestingStartDate
(\ s a -> s{_psTestingStartDate = a})
. mapping _Date
-- | Floodlight activity ID associated with this placement. This field should
-- be set when placement pricing type is set to PRICING_TYPE_CPA.
psFloodlightActivityId :: Lens' PricingSchedule (Maybe Int64)
psFloodlightActivityId
= lens _psFloodlightActivityId
(\ s a -> s{_psFloodlightActivityId = a})
. mapping _Coerce
psEndDate :: Lens' PricingSchedule (Maybe Day)
psEndDate
= lens _psEndDate (\ s a -> s{_psEndDate = a}) .
mapping _Date
psStartDate :: Lens' PricingSchedule (Maybe Day)
psStartDate
= lens _psStartDate (\ s a -> s{_psStartDate = a}) .
mapping _Date
-- | Placement cap cost option.
psCapCostOption :: Lens' PricingSchedule (Maybe PricingScheduleCapCostOption)
psCapCostOption
= lens _psCapCostOption
(\ s a -> s{_psCapCostOption = a})
-- | Placement pricing type. This field is required on insertion.
psPricingType :: Lens' PricingSchedule (Maybe PricingSchedulePricingType)
psPricingType
= lens _psPricingType
(\ s a -> s{_psPricingType = a})
-- | Pricing periods for this placement.
psPricingPeriods :: Lens' PricingSchedule [PricingSchedulePricingPeriod]
psPricingPeriods
= lens _psPricingPeriods
(\ s a -> s{_psPricingPeriods = a})
. _Default
. _Coerce
-- | Whether this placement is flighted. If true, pricing periods will be
-- computed automatically.
psFlighted :: Lens' PricingSchedule (Maybe Bool)
psFlighted
= lens _psFlighted (\ s a -> s{_psFlighted = a})
instance FromJSON PricingSchedule where
parseJSON
= withObject "PricingSchedule"
(\ o ->
PricingSchedule' <$>
(o .:? "testingStartDate") <*>
(o .:? "floodlightActivityId")
<*> (o .:? "endDate")
<*> (o .:? "startDate")
<*> (o .:? "capCostOption")
<*> (o .:? "pricingType")
<*> (o .:? "pricingPeriods" .!= mempty)
<*> (o .:? "flighted"))
instance ToJSON PricingSchedule where
toJSON PricingSchedule'{..}
= object
(catMaybes
[("testingStartDate" .=) <$> _psTestingStartDate,
("floodlightActivityId" .=) <$>
_psFloodlightActivityId,
("endDate" .=) <$> _psEndDate,
("startDate" .=) <$> _psStartDate,
("capCostOption" .=) <$> _psCapCostOption,
("pricingType" .=) <$> _psPricingType,
("pricingPeriods" .=) <$> _psPricingPeriods,
("flighted" .=) <$> _psFlighted])
-- | Contains information about a postal code that can be targeted by ads.
--
-- /See:/ 'postalCode' smart constructor.
data PostalCode =
PostalCode'
{ _pcKind :: !(Maybe Text)
, _pcCode :: !(Maybe Text)
, _pcCountryCode :: !(Maybe Text)
, _pcId :: !(Maybe Text)
, _pcCountryDartId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PostalCode' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pcKind'
--
-- * 'pcCode'
--
-- * 'pcCountryCode'
--
-- * 'pcId'
--
-- * 'pcCountryDartId'
postalCode
:: PostalCode
postalCode =
PostalCode'
{ _pcKind = Nothing
, _pcCode = Nothing
, _pcCountryCode = Nothing
, _pcId = Nothing
, _pcCountryDartId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#postalCode\".
pcKind :: Lens' PostalCode (Maybe Text)
pcKind = lens _pcKind (\ s a -> s{_pcKind = a})
-- | Postal code. This is equivalent to the id field.
pcCode :: Lens' PostalCode (Maybe Text)
pcCode = lens _pcCode (\ s a -> s{_pcCode = a})
-- | Country code of the country to which this postal code belongs.
pcCountryCode :: Lens' PostalCode (Maybe Text)
pcCountryCode
= lens _pcCountryCode
(\ s a -> s{_pcCountryCode = a})
-- | ID of this postal code.
pcId :: Lens' PostalCode (Maybe Text)
pcId = lens _pcId (\ s a -> s{_pcId = a})
-- | DART ID of the country to which this postal code belongs.
pcCountryDartId :: Lens' PostalCode (Maybe Int64)
pcCountryDartId
= lens _pcCountryDartId
(\ s a -> s{_pcCountryDartId = a})
. mapping _Coerce
instance FromJSON PostalCode where
parseJSON
= withObject "PostalCode"
(\ o ->
PostalCode' <$>
(o .:? "kind") <*> (o .:? "code") <*>
(o .:? "countryCode")
<*> (o .:? "id")
<*> (o .:? "countryDartId"))
instance ToJSON PostalCode where
toJSON PostalCode'{..}
= object
(catMaybes
[("kind" .=) <$> _pcKind, ("code" .=) <$> _pcCode,
("countryCode" .=) <$> _pcCountryCode,
("id" .=) <$> _pcId,
("countryDartId" .=) <$> _pcCountryDartId])
-- | Account Permission List Response
--
-- /See:/ 'accountPermissionsListResponse' smart constructor.
data AccountPermissionsListResponse =
AccountPermissionsListResponse'
{ _aplrKind :: !(Maybe Text)
, _aplrAccountPermissions :: !(Maybe [AccountPermission])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AccountPermissionsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aplrKind'
--
-- * 'aplrAccountPermissions'
accountPermissionsListResponse
:: AccountPermissionsListResponse
accountPermissionsListResponse =
AccountPermissionsListResponse'
{_aplrKind = Nothing, _aplrAccountPermissions = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#accountPermissionsListResponse\".
aplrKind :: Lens' AccountPermissionsListResponse (Maybe Text)
aplrKind = lens _aplrKind (\ s a -> s{_aplrKind = a})
-- | Account permission collection.
aplrAccountPermissions :: Lens' AccountPermissionsListResponse [AccountPermission]
aplrAccountPermissions
= lens _aplrAccountPermissions
(\ s a -> s{_aplrAccountPermissions = a})
. _Default
. _Coerce
instance FromJSON AccountPermissionsListResponse
where
parseJSON
= withObject "AccountPermissionsListResponse"
(\ o ->
AccountPermissionsListResponse' <$>
(o .:? "kind") <*>
(o .:? "accountPermissions" .!= mempty))
instance ToJSON AccountPermissionsListResponse where
toJSON AccountPermissionsListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _aplrKind,
("accountPermissions" .=) <$>
_aplrAccountPermissions])
-- | Contains information about a country that can be targeted by ads.
--
-- /See:/ 'country' smart constructor.
data Country =
Country'
{ _cKind :: !(Maybe Text)
, _cName :: !(Maybe Text)
, _cCountryCode :: !(Maybe Text)
, _cDartId :: !(Maybe (Textual Int64))
, _cSSLEnabled :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Country' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cKind'
--
-- * 'cName'
--
-- * 'cCountryCode'
--
-- * 'cDartId'
--
-- * 'cSSLEnabled'
country
:: Country
country =
Country'
{ _cKind = Nothing
, _cName = Nothing
, _cCountryCode = Nothing
, _cDartId = Nothing
, _cSSLEnabled = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#country\".
cKind :: Lens' Country (Maybe Text)
cKind = lens _cKind (\ s a -> s{_cKind = a})
-- | Name of this country.
cName :: Lens' Country (Maybe Text)
cName = lens _cName (\ s a -> s{_cName = a})
-- | Country code.
cCountryCode :: Lens' Country (Maybe Text)
cCountryCode
= lens _cCountryCode (\ s a -> s{_cCountryCode = a})
-- | DART ID of this country. This is the ID used for targeting and
-- generating reports.
cDartId :: Lens' Country (Maybe Int64)
cDartId
= lens _cDartId (\ s a -> s{_cDartId = a}) .
mapping _Coerce
-- | Whether ad serving supports secure servers in this country.
cSSLEnabled :: Lens' Country (Maybe Bool)
cSSLEnabled
= lens _cSSLEnabled (\ s a -> s{_cSSLEnabled = a})
instance FromJSON Country where
parseJSON
= withObject "Country"
(\ o ->
Country' <$>
(o .:? "kind") <*> (o .:? "name") <*>
(o .:? "countryCode")
<*> (o .:? "dartId")
<*> (o .:? "sslEnabled"))
instance ToJSON Country where
toJSON Country'{..}
= object
(catMaybes
[("kind" .=) <$> _cKind, ("name" .=) <$> _cName,
("countryCode" .=) <$> _cCountryCode,
("dartId" .=) <$> _cDartId,
("sslEnabled" .=) <$> _cSSLEnabled])
-- | Operating System Version List Response
--
-- /See:/ 'operatingSystemVersionsListResponse' smart constructor.
data OperatingSystemVersionsListResponse =
OperatingSystemVersionsListResponse'
{ _osvlrKind :: !(Maybe Text)
, _osvlrOperatingSystemVersions :: !(Maybe [OperatingSystemVersion])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OperatingSystemVersionsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'osvlrKind'
--
-- * 'osvlrOperatingSystemVersions'
operatingSystemVersionsListResponse
:: OperatingSystemVersionsListResponse
operatingSystemVersionsListResponse =
OperatingSystemVersionsListResponse'
{_osvlrKind = Nothing, _osvlrOperatingSystemVersions = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#operatingSystemVersionsListResponse\".
osvlrKind :: Lens' OperatingSystemVersionsListResponse (Maybe Text)
osvlrKind
= lens _osvlrKind (\ s a -> s{_osvlrKind = a})
-- | Operating system version collection.
osvlrOperatingSystemVersions :: Lens' OperatingSystemVersionsListResponse [OperatingSystemVersion]
osvlrOperatingSystemVersions
= lens _osvlrOperatingSystemVersions
(\ s a -> s{_osvlrOperatingSystemVersions = a})
. _Default
. _Coerce
instance FromJSON OperatingSystemVersionsListResponse
where
parseJSON
= withObject "OperatingSystemVersionsListResponse"
(\ o ->
OperatingSystemVersionsListResponse' <$>
(o .:? "kind") <*>
(o .:? "operatingSystemVersions" .!= mempty))
instance ToJSON OperatingSystemVersionsListResponse
where
toJSON OperatingSystemVersionsListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _osvlrKind,
("operatingSystemVersions" .=) <$>
_osvlrOperatingSystemVersions])
-- | Click Through URL Suffix settings.
--
-- /See:/ 'clickThroughURLSuffixProperties' smart constructor.
data ClickThroughURLSuffixProperties =
ClickThroughURLSuffixProperties'
{ _ctuspOverrideInheritedSuffix :: !(Maybe Bool)
, _ctuspClickThroughURLSuffix :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ClickThroughURLSuffixProperties' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ctuspOverrideInheritedSuffix'
--
-- * 'ctuspClickThroughURLSuffix'
clickThroughURLSuffixProperties
:: ClickThroughURLSuffixProperties
clickThroughURLSuffixProperties =
ClickThroughURLSuffixProperties'
{ _ctuspOverrideInheritedSuffix = Nothing
, _ctuspClickThroughURLSuffix = Nothing
}
-- | Whether this entity should override the inherited click-through URL
-- suffix with its own defined value.
ctuspOverrideInheritedSuffix :: Lens' ClickThroughURLSuffixProperties (Maybe Bool)
ctuspOverrideInheritedSuffix
= lens _ctuspOverrideInheritedSuffix
(\ s a -> s{_ctuspOverrideInheritedSuffix = a})
-- | Click-through URL suffix to apply to all ads in this entity\'s scope.
-- Must be less than 128 characters long.
ctuspClickThroughURLSuffix :: Lens' ClickThroughURLSuffixProperties (Maybe Text)
ctuspClickThroughURLSuffix
= lens _ctuspClickThroughURLSuffix
(\ s a -> s{_ctuspClickThroughURLSuffix = a})
instance FromJSON ClickThroughURLSuffixProperties
where
parseJSON
= withObject "ClickThroughURLSuffixProperties"
(\ o ->
ClickThroughURLSuffixProperties' <$>
(o .:? "overrideInheritedSuffix") <*>
(o .:? "clickThroughUrlSuffix"))
instance ToJSON ClickThroughURLSuffixProperties where
toJSON ClickThroughURLSuffixProperties'{..}
= object
(catMaybes
[("overrideInheritedSuffix" .=) <$>
_ctuspOverrideInheritedSuffix,
("clickThroughUrlSuffix" .=) <$>
_ctuspClickThroughURLSuffix])
-- | Pricing Information
--
-- /See:/ 'pricing' smart constructor.
data Pricing =
Pricing'
{ _priEndDate :: !(Maybe Date')
, _priStartDate :: !(Maybe Date')
, _priGroupType :: !(Maybe PricingGroupType)
, _priPricingType :: !(Maybe PricingPricingType)
, _priFlights :: !(Maybe [Flight])
, _priCapCostType :: !(Maybe PricingCapCostType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Pricing' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'priEndDate'
--
-- * 'priStartDate'
--
-- * 'priGroupType'
--
-- * 'priPricingType'
--
-- * 'priFlights'
--
-- * 'priCapCostType'
pricing
:: Pricing
pricing =
Pricing'
{ _priEndDate = Nothing
, _priStartDate = Nothing
, _priGroupType = Nothing
, _priPricingType = Nothing
, _priFlights = Nothing
, _priCapCostType = Nothing
}
priEndDate :: Lens' Pricing (Maybe Day)
priEndDate
= lens _priEndDate (\ s a -> s{_priEndDate = a}) .
mapping _Date
priStartDate :: Lens' Pricing (Maybe Day)
priStartDate
= lens _priStartDate (\ s a -> s{_priStartDate = a})
. mapping _Date
-- | Group type of this inventory item if it represents a placement group. Is
-- null otherwise. There are two type of placement groups:
-- PLANNING_PLACEMENT_GROUP_TYPE_PACKAGE is a simple group of inventory
-- items that acts as a single pricing point for a group of tags.
-- PLANNING_PLACEMENT_GROUP_TYPE_ROADBLOCK is a group of inventory items
-- that not only acts as a single pricing point, but also assumes that all
-- the tags in it will be served at the same time. A roadblock requires one
-- of its assigned inventory items to be marked as primary.
priGroupType :: Lens' Pricing (Maybe PricingGroupType)
priGroupType
= lens _priGroupType (\ s a -> s{_priGroupType = a})
-- | Pricing type of this inventory item.
priPricingType :: Lens' Pricing (Maybe PricingPricingType)
priPricingType
= lens _priPricingType
(\ s a -> s{_priPricingType = a})
-- | Flights of this inventory item. A flight (a.k.a. pricing period)
-- represents the inventory item pricing information for a specific period
-- of time.
priFlights :: Lens' Pricing [Flight]
priFlights
= lens _priFlights (\ s a -> s{_priFlights = a}) .
_Default
. _Coerce
-- | Cap cost type of this inventory item.
priCapCostType :: Lens' Pricing (Maybe PricingCapCostType)
priCapCostType
= lens _priCapCostType
(\ s a -> s{_priCapCostType = a})
instance FromJSON Pricing where
parseJSON
= withObject "Pricing"
(\ o ->
Pricing' <$>
(o .:? "endDate") <*> (o .:? "startDate") <*>
(o .:? "groupType")
<*> (o .:? "pricingType")
<*> (o .:? "flights" .!= mempty)
<*> (o .:? "capCostType"))
instance ToJSON Pricing where
toJSON Pricing'{..}
= object
(catMaybes
[("endDate" .=) <$> _priEndDate,
("startDate" .=) <$> _priStartDate,
("groupType" .=) <$> _priGroupType,
("pricingType" .=) <$> _priPricingType,
("flights" .=) <$> _priFlights,
("capCostType" .=) <$> _priCapCostType])
-- | Audience Segment Group.
--
-- /See:/ 'audienceSegmentGroup' smart constructor.
data AudienceSegmentGroup =
AudienceSegmentGroup'
{ _asgAudienceSegments :: !(Maybe [AudienceSegment])
, _asgName :: !(Maybe Text)
, _asgId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AudienceSegmentGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'asgAudienceSegments'
--
-- * 'asgName'
--
-- * 'asgId'
audienceSegmentGroup
:: AudienceSegmentGroup
audienceSegmentGroup =
AudienceSegmentGroup'
{_asgAudienceSegments = Nothing, _asgName = Nothing, _asgId = Nothing}
-- | Audience segments assigned to this group. The number of segments must be
-- between 2 and 100.
asgAudienceSegments :: Lens' AudienceSegmentGroup [AudienceSegment]
asgAudienceSegments
= lens _asgAudienceSegments
(\ s a -> s{_asgAudienceSegments = a})
. _Default
. _Coerce
-- | Name of this audience segment group. This is a required field and must
-- be less than 65 characters long.
asgName :: Lens' AudienceSegmentGroup (Maybe Text)
asgName = lens _asgName (\ s a -> s{_asgName = a})
-- | ID of this audience segment group. This is a read-only, auto-generated
-- field.
asgId :: Lens' AudienceSegmentGroup (Maybe Int64)
asgId
= lens _asgId (\ s a -> s{_asgId = a}) .
mapping _Coerce
instance FromJSON AudienceSegmentGroup where
parseJSON
= withObject "AudienceSegmentGroup"
(\ o ->
AudienceSegmentGroup' <$>
(o .:? "audienceSegments" .!= mempty) <*>
(o .:? "name")
<*> (o .:? "id"))
instance ToJSON AudienceSegmentGroup where
toJSON AudienceSegmentGroup'{..}
= object
(catMaybes
[("audienceSegments" .=) <$> _asgAudienceSegments,
("name" .=) <$> _asgName, ("id" .=) <$> _asgId])
-- | Contains information about an operating system that can be targeted by
-- ads.
--
-- /See:/ 'operatingSystem' smart constructor.
data OperatingSystem =
OperatingSystem'
{ _osDesktop :: !(Maybe Bool)
, _osKind :: !(Maybe Text)
, _osName :: !(Maybe Text)
, _osMobile :: !(Maybe Bool)
, _osDartId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OperatingSystem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'osDesktop'
--
-- * 'osKind'
--
-- * 'osName'
--
-- * 'osMobile'
--
-- * 'osDartId'
operatingSystem
:: OperatingSystem
operatingSystem =
OperatingSystem'
{ _osDesktop = Nothing
, _osKind = Nothing
, _osName = Nothing
, _osMobile = Nothing
, _osDartId = Nothing
}
-- | Whether this operating system is for desktop.
osDesktop :: Lens' OperatingSystem (Maybe Bool)
osDesktop
= lens _osDesktop (\ s a -> s{_osDesktop = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#operatingSystem\".
osKind :: Lens' OperatingSystem (Maybe Text)
osKind = lens _osKind (\ s a -> s{_osKind = a})
-- | Name of this operating system.
osName :: Lens' OperatingSystem (Maybe Text)
osName = lens _osName (\ s a -> s{_osName = a})
-- | Whether this operating system is for mobile.
osMobile :: Lens' OperatingSystem (Maybe Bool)
osMobile = lens _osMobile (\ s a -> s{_osMobile = a})
-- | DART ID of this operating system. This is the ID used for targeting.
osDartId :: Lens' OperatingSystem (Maybe Int64)
osDartId
= lens _osDartId (\ s a -> s{_osDartId = a}) .
mapping _Coerce
instance FromJSON OperatingSystem where
parseJSON
= withObject "OperatingSystem"
(\ o ->
OperatingSystem' <$>
(o .:? "desktop") <*> (o .:? "kind") <*>
(o .:? "name")
<*> (o .:? "mobile")
<*> (o .:? "dartId"))
instance ToJSON OperatingSystem where
toJSON OperatingSystem'{..}
= object
(catMaybes
[("desktop" .=) <$> _osDesktop,
("kind" .=) <$> _osKind, ("name" .=) <$> _osName,
("mobile" .=) <$> _osMobile,
("dartId" .=) <$> _osDartId])
-- | Flight
--
-- /See:/ 'flight' smart constructor.
data Flight =
Flight'
{ _fRateOrCost :: !(Maybe (Textual Int64))
, _fEndDate :: !(Maybe Date')
, _fStartDate :: !(Maybe Date')
, _fUnits :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Flight' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fRateOrCost'
--
-- * 'fEndDate'
--
-- * 'fStartDate'
--
-- * 'fUnits'
flight
:: Flight
flight =
Flight'
{ _fRateOrCost = Nothing
, _fEndDate = Nothing
, _fStartDate = Nothing
, _fUnits = Nothing
}
-- | Rate or cost of this flight.
fRateOrCost :: Lens' Flight (Maybe Int64)
fRateOrCost
= lens _fRateOrCost (\ s a -> s{_fRateOrCost = a}) .
mapping _Coerce
fEndDate :: Lens' Flight (Maybe Day)
fEndDate
= lens _fEndDate (\ s a -> s{_fEndDate = a}) .
mapping _Date
fStartDate :: Lens' Flight (Maybe Day)
fStartDate
= lens _fStartDate (\ s a -> s{_fStartDate = a}) .
mapping _Date
-- | Units of this flight.
fUnits :: Lens' Flight (Maybe Int64)
fUnits
= lens _fUnits (\ s a -> s{_fUnits = a}) .
mapping _Coerce
instance FromJSON Flight where
parseJSON
= withObject "Flight"
(\ o ->
Flight' <$>
(o .:? "rateOrCost") <*> (o .:? "endDate") <*>
(o .:? "startDate")
<*> (o .:? "units"))
instance ToJSON Flight where
toJSON Flight'{..}
= object
(catMaybes
[("rateOrCost" .=) <$> _fRateOrCost,
("endDate" .=) <$> _fEndDate,
("startDate" .=) <$> _fStartDate,
("units" .=) <$> _fUnits])
-- | City List Response
--
-- /See:/ 'citiesListResponse' smart constructor.
data CitiesListResponse =
CitiesListResponse'
{ _citKind :: !(Maybe Text)
, _citCities :: !(Maybe [City])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CitiesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'citKind'
--
-- * 'citCities'
citiesListResponse
:: CitiesListResponse
citiesListResponse =
CitiesListResponse' {_citKind = Nothing, _citCities = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#citiesListResponse\".
citKind :: Lens' CitiesListResponse (Maybe Text)
citKind = lens _citKind (\ s a -> s{_citKind = a})
-- | City collection.
citCities :: Lens' CitiesListResponse [City]
citCities
= lens _citCities (\ s a -> s{_citCities = a}) .
_Default
. _Coerce
instance FromJSON CitiesListResponse where
parseJSON
= withObject "CitiesListResponse"
(\ o ->
CitiesListResponse' <$>
(o .:? "kind") <*> (o .:? "cities" .!= mempty))
instance ToJSON CitiesListResponse where
toJSON CitiesListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _citKind,
("cities" .=) <$> _citCities])
-- | Represents a dimension.
--
-- /See:/ 'dimension' smart constructor.
data Dimension =
Dimension'
{ _dKind :: !(Maybe Text)
, _dName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Dimension' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dKind'
--
-- * 'dName'
dimension
:: Dimension
dimension = Dimension' {_dKind = Nothing, _dName = Nothing}
-- | The kind of resource this is, in this case dfareporting#dimension.
dKind :: Lens' Dimension (Maybe Text)
dKind = lens _dKind (\ s a -> s{_dKind = a})
-- | The dimension name, e.g. dfa:advertiser
dName :: Lens' Dimension (Maybe Text)
dName = lens _dName (\ s a -> s{_dName = a})
instance FromJSON Dimension where
parseJSON
= withObject "Dimension"
(\ o ->
Dimension' <$> (o .:? "kind") <*> (o .:? "name"))
instance ToJSON Dimension where
toJSON Dimension'{..}
= object
(catMaybes
[("kind" .=) <$> _dKind, ("name" .=) <$> _dName])
-- | The report criteria for a report of type \"REACH\".
--
-- /See:/ 'reportReachCriteria' smart constructor.
data ReportReachCriteria =
ReportReachCriteria'
{ _rrcReachByFrequencyMetricNames :: !(Maybe [Text])
, _rrcEnableAllDimensionCombinations :: !(Maybe Bool)
, _rrcMetricNames :: !(Maybe [Text])
, _rrcCustomRichMediaEvents :: !(Maybe CustomRichMediaEvents)
, _rrcDimensionFilters :: !(Maybe [DimensionValue])
, _rrcActivities :: !(Maybe Activities)
, _rrcDateRange :: !(Maybe DateRange)
, _rrcDimensions :: !(Maybe [SortedDimension])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportReachCriteria' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rrcReachByFrequencyMetricNames'
--
-- * 'rrcEnableAllDimensionCombinations'
--
-- * 'rrcMetricNames'
--
-- * 'rrcCustomRichMediaEvents'
--
-- * 'rrcDimensionFilters'
--
-- * 'rrcActivities'
--
-- * 'rrcDateRange'
--
-- * 'rrcDimensions'
reportReachCriteria
:: ReportReachCriteria
reportReachCriteria =
ReportReachCriteria'
{ _rrcReachByFrequencyMetricNames = Nothing
, _rrcEnableAllDimensionCombinations = Nothing
, _rrcMetricNames = Nothing
, _rrcCustomRichMediaEvents = Nothing
, _rrcDimensionFilters = Nothing
, _rrcActivities = Nothing
, _rrcDateRange = Nothing
, _rrcDimensions = Nothing
}
-- | The list of names of Reach By Frequency metrics the report should
-- include.
rrcReachByFrequencyMetricNames :: Lens' ReportReachCriteria [Text]
rrcReachByFrequencyMetricNames
= lens _rrcReachByFrequencyMetricNames
(\ s a -> s{_rrcReachByFrequencyMetricNames = a})
. _Default
. _Coerce
-- | Whether to enable all reach dimension combinations in the report.
-- Defaults to false. If enabled, the date range of the report should be
-- within the last 42 days.
rrcEnableAllDimensionCombinations :: Lens' ReportReachCriteria (Maybe Bool)
rrcEnableAllDimensionCombinations
= lens _rrcEnableAllDimensionCombinations
(\ s a -> s{_rrcEnableAllDimensionCombinations = a})
-- | The list of names of metrics the report should include.
rrcMetricNames :: Lens' ReportReachCriteria [Text]
rrcMetricNames
= lens _rrcMetricNames
(\ s a -> s{_rrcMetricNames = a})
. _Default
. _Coerce
-- | Custom Rich Media Events group.
rrcCustomRichMediaEvents :: Lens' ReportReachCriteria (Maybe CustomRichMediaEvents)
rrcCustomRichMediaEvents
= lens _rrcCustomRichMediaEvents
(\ s a -> s{_rrcCustomRichMediaEvents = a})
-- | The list of filters on which dimensions are filtered. Filters for
-- different dimensions are ANDed, filters for the same dimension are
-- grouped together and ORed.
rrcDimensionFilters :: Lens' ReportReachCriteria [DimensionValue]
rrcDimensionFilters
= lens _rrcDimensionFilters
(\ s a -> s{_rrcDimensionFilters = a})
. _Default
. _Coerce
-- | Activity group.
rrcActivities :: Lens' ReportReachCriteria (Maybe Activities)
rrcActivities
= lens _rrcActivities
(\ s a -> s{_rrcActivities = a})
-- | The date range this report should be run for.
rrcDateRange :: Lens' ReportReachCriteria (Maybe DateRange)
rrcDateRange
= lens _rrcDateRange (\ s a -> s{_rrcDateRange = a})
-- | The list of dimensions the report should include.
rrcDimensions :: Lens' ReportReachCriteria [SortedDimension]
rrcDimensions
= lens _rrcDimensions
(\ s a -> s{_rrcDimensions = a})
. _Default
. _Coerce
instance FromJSON ReportReachCriteria where
parseJSON
= withObject "ReportReachCriteria"
(\ o ->
ReportReachCriteria' <$>
(o .:? "reachByFrequencyMetricNames" .!= mempty) <*>
(o .:? "enableAllDimensionCombinations")
<*> (o .:? "metricNames" .!= mempty)
<*> (o .:? "customRichMediaEvents")
<*> (o .:? "dimensionFilters" .!= mempty)
<*> (o .:? "activities")
<*> (o .:? "dateRange")
<*> (o .:? "dimensions" .!= mempty))
instance ToJSON ReportReachCriteria where
toJSON ReportReachCriteria'{..}
= object
(catMaybes
[("reachByFrequencyMetricNames" .=) <$>
_rrcReachByFrequencyMetricNames,
("enableAllDimensionCombinations" .=) <$>
_rrcEnableAllDimensionCombinations,
("metricNames" .=) <$> _rrcMetricNames,
("customRichMediaEvents" .=) <$>
_rrcCustomRichMediaEvents,
("dimensionFilters" .=) <$> _rrcDimensionFilters,
("activities" .=) <$> _rrcActivities,
("dateRange" .=) <$> _rrcDateRange,
("dimensions" .=) <$> _rrcDimensions])
-- | Represents a Custom Rich Media Events group.
--
-- /See:/ 'customRichMediaEvents' smart constructor.
data CustomRichMediaEvents =
CustomRichMediaEvents'
{ _crmeKind :: !(Maybe Text)
, _crmeFilteredEventIds :: !(Maybe [DimensionValue])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CustomRichMediaEvents' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'crmeKind'
--
-- * 'crmeFilteredEventIds'
customRichMediaEvents
:: CustomRichMediaEvents
customRichMediaEvents =
CustomRichMediaEvents' {_crmeKind = Nothing, _crmeFilteredEventIds = Nothing}
-- | The kind of resource this is, in this case
-- dfareporting#customRichMediaEvents.
crmeKind :: Lens' CustomRichMediaEvents (Maybe Text)
crmeKind = lens _crmeKind (\ s a -> s{_crmeKind = a})
-- | List of custom rich media event IDs. Dimension values must be all of
-- type dfa:richMediaEventTypeIdAndName.
crmeFilteredEventIds :: Lens' CustomRichMediaEvents [DimensionValue]
crmeFilteredEventIds
= lens _crmeFilteredEventIds
(\ s a -> s{_crmeFilteredEventIds = a})
. _Default
. _Coerce
instance FromJSON CustomRichMediaEvents where
parseJSON
= withObject "CustomRichMediaEvents"
(\ o ->
CustomRichMediaEvents' <$>
(o .:? "kind") <*>
(o .:? "filteredEventIds" .!= mempty))
instance ToJSON CustomRichMediaEvents where
toJSON CustomRichMediaEvents'{..}
= object
(catMaybes
[("kind" .=) <$> _crmeKind,
("filteredEventIds" .=) <$> _crmeFilteredEventIds])
-- | Language List Response
--
-- /See:/ 'languagesListResponse' smart constructor.
data LanguagesListResponse =
LanguagesListResponse'
{ _llrKind :: !(Maybe Text)
, _llrLanguages :: !(Maybe [Language])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'LanguagesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'llrKind'
--
-- * 'llrLanguages'
languagesListResponse
:: LanguagesListResponse
languagesListResponse =
LanguagesListResponse' {_llrKind = Nothing, _llrLanguages = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#languagesListResponse\".
llrKind :: Lens' LanguagesListResponse (Maybe Text)
llrKind = lens _llrKind (\ s a -> s{_llrKind = a})
-- | Language collection.
llrLanguages :: Lens' LanguagesListResponse [Language]
llrLanguages
= lens _llrLanguages (\ s a -> s{_llrLanguages = a})
. _Default
. _Coerce
instance FromJSON LanguagesListResponse where
parseJSON
= withObject "LanguagesListResponse"
(\ o ->
LanguagesListResponse' <$>
(o .:? "kind") <*> (o .:? "languages" .!= mempty))
instance ToJSON LanguagesListResponse where
toJSON LanguagesListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _llrKind,
("languages" .=) <$> _llrLanguages])
-- | The attributes, like playtime and percent onscreen, that define the
-- Custom Viewability Metric.
--
-- /See:/ 'customViewabilityMetricConfiguration' smart constructor.
data CustomViewabilityMetricConfiguration =
CustomViewabilityMetricConfiguration'
{ _cvmcViewabilityPercent :: !(Maybe (Textual Int32))
, _cvmcTimePercent :: !(Maybe (Textual Int32))
, _cvmcAudible :: !(Maybe Bool)
, _cvmcTimeMillis :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CustomViewabilityMetricConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cvmcViewabilityPercent'
--
-- * 'cvmcTimePercent'
--
-- * 'cvmcAudible'
--
-- * 'cvmcTimeMillis'
customViewabilityMetricConfiguration
:: CustomViewabilityMetricConfiguration
customViewabilityMetricConfiguration =
CustomViewabilityMetricConfiguration'
{ _cvmcViewabilityPercent = Nothing
, _cvmcTimePercent = Nothing
, _cvmcAudible = Nothing
, _cvmcTimeMillis = Nothing
}
-- | The percentage of video that must be on screen for the Custom
-- Viewability Metric to count an impression.
cvmcViewabilityPercent :: Lens' CustomViewabilityMetricConfiguration (Maybe Int32)
cvmcViewabilityPercent
= lens _cvmcViewabilityPercent
(\ s a -> s{_cvmcViewabilityPercent = a})
. mapping _Coerce
-- | The percentage of video that must play for the Custom Viewability Metric
-- to count an impression. If both this and timeMillis are specified, the
-- earlier of the two will be used.
cvmcTimePercent :: Lens' CustomViewabilityMetricConfiguration (Maybe Int32)
cvmcTimePercent
= lens _cvmcTimePercent
(\ s a -> s{_cvmcTimePercent = a})
. mapping _Coerce
-- | Whether the video must be audible to count an impression.
cvmcAudible :: Lens' CustomViewabilityMetricConfiguration (Maybe Bool)
cvmcAudible
= lens _cvmcAudible (\ s a -> s{_cvmcAudible = a})
-- | The time in milliseconds the video must play for the Custom Viewability
-- Metric to count an impression. If both this and timePercent are
-- specified, the earlier of the two will be used.
cvmcTimeMillis :: Lens' CustomViewabilityMetricConfiguration (Maybe Int32)
cvmcTimeMillis
= lens _cvmcTimeMillis
(\ s a -> s{_cvmcTimeMillis = a})
. mapping _Coerce
instance FromJSON
CustomViewabilityMetricConfiguration
where
parseJSON
= withObject "CustomViewabilityMetricConfiguration"
(\ o ->
CustomViewabilityMetricConfiguration' <$>
(o .:? "viewabilityPercent") <*>
(o .:? "timePercent")
<*> (o .:? "audible")
<*> (o .:? "timeMillis"))
instance ToJSON CustomViewabilityMetricConfiguration
where
toJSON CustomViewabilityMetricConfiguration'{..}
= object
(catMaybes
[("viewabilityPercent" .=) <$>
_cvmcViewabilityPercent,
("timePercent" .=) <$> _cvmcTimePercent,
("audible" .=) <$> _cvmcAudible,
("timeMillis" .=) <$> _cvmcTimeMillis])
-- | The report criteria for a report of type \"PATH\".
--
-- /See:/ 'reportPathCriteria' smart constructor.
data ReportPathCriteria =
ReportPathCriteria'
{ _rpcCustomChannelGrouping :: !(Maybe ChannelGrouping)
, _rpcMetricNames :: !(Maybe [Text])
, _rpcDateRange :: !(Maybe DateRange)
, _rpcPathFilters :: !(Maybe [PathFilter])
, _rpcFloodlightConfigId :: !(Maybe DimensionValue)
, _rpcDimensions :: !(Maybe [SortedDimension])
, _rpcActivityFilters :: !(Maybe [DimensionValue])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportPathCriteria' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rpcCustomChannelGrouping'
--
-- * 'rpcMetricNames'
--
-- * 'rpcDateRange'
--
-- * 'rpcPathFilters'
--
-- * 'rpcFloodlightConfigId'
--
-- * 'rpcDimensions'
--
-- * 'rpcActivityFilters'
reportPathCriteria
:: ReportPathCriteria
reportPathCriteria =
ReportPathCriteria'
{ _rpcCustomChannelGrouping = Nothing
, _rpcMetricNames = Nothing
, _rpcDateRange = Nothing
, _rpcPathFilters = Nothing
, _rpcFloodlightConfigId = Nothing
, _rpcDimensions = Nothing
, _rpcActivityFilters = Nothing
}
-- | Channel Grouping.
rpcCustomChannelGrouping :: Lens' ReportPathCriteria (Maybe ChannelGrouping)
rpcCustomChannelGrouping
= lens _rpcCustomChannelGrouping
(\ s a -> s{_rpcCustomChannelGrouping = a})
-- | The list of names of metrics the report should include.
rpcMetricNames :: Lens' ReportPathCriteria [Text]
rpcMetricNames
= lens _rpcMetricNames
(\ s a -> s{_rpcMetricNames = a})
. _Default
. _Coerce
-- | The date range this report should be run for.
rpcDateRange :: Lens' ReportPathCriteria (Maybe DateRange)
rpcDateRange
= lens _rpcDateRange (\ s a -> s{_rpcDateRange = a})
-- | Path Filters.
rpcPathFilters :: Lens' ReportPathCriteria [PathFilter]
rpcPathFilters
= lens _rpcPathFilters
(\ s a -> s{_rpcPathFilters = a})
. _Default
. _Coerce
-- | The floodlight ID for which to show data in this report. All advertisers
-- associated with that ID will automatically be added. The dimension of
-- the value needs to be \'dfa:floodlightConfigId\'.
rpcFloodlightConfigId :: Lens' ReportPathCriteria (Maybe DimensionValue)
rpcFloodlightConfigId
= lens _rpcFloodlightConfigId
(\ s a -> s{_rpcFloodlightConfigId = a})
-- | The list of dimensions the report should include.
rpcDimensions :: Lens' ReportPathCriteria [SortedDimension]
rpcDimensions
= lens _rpcDimensions
(\ s a -> s{_rpcDimensions = a})
. _Default
. _Coerce
-- | The list of \'dfa:activity\' values to filter on.
rpcActivityFilters :: Lens' ReportPathCriteria [DimensionValue]
rpcActivityFilters
= lens _rpcActivityFilters
(\ s a -> s{_rpcActivityFilters = a})
. _Default
. _Coerce
instance FromJSON ReportPathCriteria where
parseJSON
= withObject "ReportPathCriteria"
(\ o ->
ReportPathCriteria' <$>
(o .:? "customChannelGrouping") <*>
(o .:? "metricNames" .!= mempty)
<*> (o .:? "dateRange")
<*> (o .:? "pathFilters" .!= mempty)
<*> (o .:? "floodlightConfigId")
<*> (o .:? "dimensions" .!= mempty)
<*> (o .:? "activityFilters" .!= mempty))
instance ToJSON ReportPathCriteria where
toJSON ReportPathCriteria'{..}
= object
(catMaybes
[("customChannelGrouping" .=) <$>
_rpcCustomChannelGrouping,
("metricNames" .=) <$> _rpcMetricNames,
("dateRange" .=) <$> _rpcDateRange,
("pathFilters" .=) <$> _rpcPathFilters,
("floodlightConfigId" .=) <$> _rpcFloodlightConfigId,
("dimensions" .=) <$> _rpcDimensions,
("activityFilters" .=) <$> _rpcActivityFilters])
-- | Targetable remarketing list response
--
-- /See:/ 'targetableRemarketingListsListResponse' smart constructor.
data TargetableRemarketingListsListResponse =
TargetableRemarketingListsListResponse'
{ _trllrNextPageToken :: !(Maybe Text)
, _trllrKind :: !(Maybe Text)
, _trllrTargetableRemarketingLists :: !(Maybe [TargetableRemarketingList])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TargetableRemarketingListsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'trllrNextPageToken'
--
-- * 'trllrKind'
--
-- * 'trllrTargetableRemarketingLists'
targetableRemarketingListsListResponse
:: TargetableRemarketingListsListResponse
targetableRemarketingListsListResponse =
TargetableRemarketingListsListResponse'
{ _trllrNextPageToken = Nothing
, _trllrKind = Nothing
, _trllrTargetableRemarketingLists = Nothing
}
-- | Pagination token to be used for the next list operation.
trllrNextPageToken :: Lens' TargetableRemarketingListsListResponse (Maybe Text)
trllrNextPageToken
= lens _trllrNextPageToken
(\ s a -> s{_trllrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#targetableRemarketingListsListResponse\".
trllrKind :: Lens' TargetableRemarketingListsListResponse (Maybe Text)
trllrKind
= lens _trllrKind (\ s a -> s{_trllrKind = a})
-- | Targetable remarketing list collection.
trllrTargetableRemarketingLists :: Lens' TargetableRemarketingListsListResponse [TargetableRemarketingList]
trllrTargetableRemarketingLists
= lens _trllrTargetableRemarketingLists
(\ s a -> s{_trllrTargetableRemarketingLists = a})
. _Default
. _Coerce
instance FromJSON
TargetableRemarketingListsListResponse
where
parseJSON
= withObject "TargetableRemarketingListsListResponse"
(\ o ->
TargetableRemarketingListsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "targetableRemarketingLists" .!= mempty))
instance ToJSON
TargetableRemarketingListsListResponse
where
toJSON TargetableRemarketingListsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _trllrNextPageToken,
("kind" .=) <$> _trllrKind,
("targetableRemarketingLists" .=) <$>
_trllrTargetableRemarketingLists])
-- | Change Log List Response
--
-- /See:/ 'changeLogsListResponse' smart constructor.
data ChangeLogsListResponse =
ChangeLogsListResponse'
{ _cllrNextPageToken :: !(Maybe Text)
, _cllrKind :: !(Maybe Text)
, _cllrChangeLogs :: !(Maybe [ChangeLog])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ChangeLogsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cllrNextPageToken'
--
-- * 'cllrKind'
--
-- * 'cllrChangeLogs'
changeLogsListResponse
:: ChangeLogsListResponse
changeLogsListResponse =
ChangeLogsListResponse'
{ _cllrNextPageToken = Nothing
, _cllrKind = Nothing
, _cllrChangeLogs = Nothing
}
-- | Pagination token to be used for the next list operation.
cllrNextPageToken :: Lens' ChangeLogsListResponse (Maybe Text)
cllrNextPageToken
= lens _cllrNextPageToken
(\ s a -> s{_cllrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#changeLogsListResponse\".
cllrKind :: Lens' ChangeLogsListResponse (Maybe Text)
cllrKind = lens _cllrKind (\ s a -> s{_cllrKind = a})
-- | Change log collection.
cllrChangeLogs :: Lens' ChangeLogsListResponse [ChangeLog]
cllrChangeLogs
= lens _cllrChangeLogs
(\ s a -> s{_cllrChangeLogs = a})
. _Default
. _Coerce
instance FromJSON ChangeLogsListResponse where
parseJSON
= withObject "ChangeLogsListResponse"
(\ o ->
ChangeLogsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "changeLogs" .!= mempty))
instance ToJSON ChangeLogsListResponse where
toJSON ChangeLogsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _cllrNextPageToken,
("kind" .=) <$> _cllrKind,
("changeLogs" .=) <$> _cllrChangeLogs])
-- | AccountUserProfiles contains properties of a Campaign Manager user
-- profile. This resource is specifically for managing user profiles,
-- whereas UserProfiles is for accessing the API.
--
-- /See:/ 'accountUserProFile' smart constructor.
data AccountUserProFile =
AccountUserProFile'
{ _aupfEmail :: !(Maybe Text)
, _aupfUserRoleFilter :: !(Maybe ObjectFilter)
, _aupfAdvertiserFilter :: !(Maybe ObjectFilter)
, _aupfUserRoleId :: !(Maybe (Textual Int64))
, _aupfKind :: !(Maybe Text)
, _aupfLocale :: !(Maybe Text)
, _aupfSiteFilter :: !(Maybe ObjectFilter)
, _aupfTraffickerType :: !(Maybe AccountUserProFileTraffickerType)
, _aupfActive :: !(Maybe Bool)
, _aupfAccountId :: !(Maybe (Textual Int64))
, _aupfName :: !(Maybe Text)
, _aupfId :: !(Maybe (Textual Int64))
, _aupfUserAccessType :: !(Maybe AccountUserProFileUserAccessType)
, _aupfComments :: !(Maybe Text)
, _aupfSubAccountId :: !(Maybe (Textual Int64))
, _aupfCampaignFilter :: !(Maybe ObjectFilter)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AccountUserProFile' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aupfEmail'
--
-- * 'aupfUserRoleFilter'
--
-- * 'aupfAdvertiserFilter'
--
-- * 'aupfUserRoleId'
--
-- * 'aupfKind'
--
-- * 'aupfLocale'
--
-- * 'aupfSiteFilter'
--
-- * 'aupfTraffickerType'
--
-- * 'aupfActive'
--
-- * 'aupfAccountId'
--
-- * 'aupfName'
--
-- * 'aupfId'
--
-- * 'aupfUserAccessType'
--
-- * 'aupfComments'
--
-- * 'aupfSubAccountId'
--
-- * 'aupfCampaignFilter'
accountUserProFile
:: AccountUserProFile
accountUserProFile =
AccountUserProFile'
{ _aupfEmail = Nothing
, _aupfUserRoleFilter = Nothing
, _aupfAdvertiserFilter = Nothing
, _aupfUserRoleId = Nothing
, _aupfKind = Nothing
, _aupfLocale = Nothing
, _aupfSiteFilter = Nothing
, _aupfTraffickerType = Nothing
, _aupfActive = Nothing
, _aupfAccountId = Nothing
, _aupfName = Nothing
, _aupfId = Nothing
, _aupfUserAccessType = Nothing
, _aupfComments = Nothing
, _aupfSubAccountId = Nothing
, _aupfCampaignFilter = Nothing
}
-- | Email of the user profile. The email addresss must be linked to a Google
-- Account. This field is required on insertion and is read-only after
-- insertion.
aupfEmail :: Lens' AccountUserProFile (Maybe Text)
aupfEmail
= lens _aupfEmail (\ s a -> s{_aupfEmail = a})
-- | Filter that describes which user roles are visible to the user profile.
aupfUserRoleFilter :: Lens' AccountUserProFile (Maybe ObjectFilter)
aupfUserRoleFilter
= lens _aupfUserRoleFilter
(\ s a -> s{_aupfUserRoleFilter = a})
-- | Filter that describes which advertisers are visible to the user profile.
aupfAdvertiserFilter :: Lens' AccountUserProFile (Maybe ObjectFilter)
aupfAdvertiserFilter
= lens _aupfAdvertiserFilter
(\ s a -> s{_aupfAdvertiserFilter = a})
-- | User role ID of the user profile. This is a required field.
aupfUserRoleId :: Lens' AccountUserProFile (Maybe Int64)
aupfUserRoleId
= lens _aupfUserRoleId
(\ s a -> s{_aupfUserRoleId = a})
. mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#accountUserProfile\".
aupfKind :: Lens' AccountUserProFile (Maybe Text)
aupfKind = lens _aupfKind (\ s a -> s{_aupfKind = a})
-- | Locale of the user profile. This is a required field. Acceptable values
-- are: - \"cs\" (Czech) - \"de\" (German) - \"en\" (English) - \"en-GB\"
-- (English United Kingdom) - \"es\" (Spanish) - \"fr\" (French) - \"it\"
-- (Italian) - \"ja\" (Japanese) - \"ko\" (Korean) - \"pl\" (Polish) -
-- \"pt-BR\" (Portuguese Brazil) - \"ru\" (Russian) - \"sv\" (Swedish) -
-- \"tr\" (Turkish) - \"zh-CN\" (Chinese Simplified) - \"zh-TW\" (Chinese
-- Traditional)
aupfLocale :: Lens' AccountUserProFile (Maybe Text)
aupfLocale
= lens _aupfLocale (\ s a -> s{_aupfLocale = a})
-- | Filter that describes which sites are visible to the user profile.
aupfSiteFilter :: Lens' AccountUserProFile (Maybe ObjectFilter)
aupfSiteFilter
= lens _aupfSiteFilter
(\ s a -> s{_aupfSiteFilter = a})
-- | Trafficker type of this user profile. This is a read-only field.
aupfTraffickerType :: Lens' AccountUserProFile (Maybe AccountUserProFileTraffickerType)
aupfTraffickerType
= lens _aupfTraffickerType
(\ s a -> s{_aupfTraffickerType = a})
-- | Whether this user profile is active. This defaults to false, and must be
-- set true on insert for the user profile to be usable.
aupfActive :: Lens' AccountUserProFile (Maybe Bool)
aupfActive
= lens _aupfActive (\ s a -> s{_aupfActive = a})
-- | Account ID of the user profile. This is a read-only field that can be
-- left blank.
aupfAccountId :: Lens' AccountUserProFile (Maybe Int64)
aupfAccountId
= lens _aupfAccountId
(\ s a -> s{_aupfAccountId = a})
. mapping _Coerce
-- | Name of the user profile. This is a required field. Must be less than 64
-- characters long, must be globally unique, and cannot contain whitespace
-- or any of the following characters: \"&;\<>\"#%,\".
aupfName :: Lens' AccountUserProFile (Maybe Text)
aupfName = lens _aupfName (\ s a -> s{_aupfName = a})
-- | ID of the user profile. This is a read-only, auto-generated field.
aupfId :: Lens' AccountUserProFile (Maybe Int64)
aupfId
= lens _aupfId (\ s a -> s{_aupfId = a}) .
mapping _Coerce
-- | User type of the user profile. This is a read-only field that can be
-- left blank.
aupfUserAccessType :: Lens' AccountUserProFile (Maybe AccountUserProFileUserAccessType)
aupfUserAccessType
= lens _aupfUserAccessType
(\ s a -> s{_aupfUserAccessType = a})
-- | Comments for this user profile.
aupfComments :: Lens' AccountUserProFile (Maybe Text)
aupfComments
= lens _aupfComments (\ s a -> s{_aupfComments = a})
-- | Subaccount ID of the user profile. This is a read-only field that can be
-- left blank.
aupfSubAccountId :: Lens' AccountUserProFile (Maybe Int64)
aupfSubAccountId
= lens _aupfSubAccountId
(\ s a -> s{_aupfSubAccountId = a})
. mapping _Coerce
-- | Filter that describes which campaigns are visible to the user profile.
aupfCampaignFilter :: Lens' AccountUserProFile (Maybe ObjectFilter)
aupfCampaignFilter
= lens _aupfCampaignFilter
(\ s a -> s{_aupfCampaignFilter = a})
instance FromJSON AccountUserProFile where
parseJSON
= withObject "AccountUserProFile"
(\ o ->
AccountUserProFile' <$>
(o .:? "email") <*> (o .:? "userRoleFilter") <*>
(o .:? "advertiserFilter")
<*> (o .:? "userRoleId")
<*> (o .:? "kind")
<*> (o .:? "locale")
<*> (o .:? "siteFilter")
<*> (o .:? "traffickerType")
<*> (o .:? "active")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "id")
<*> (o .:? "userAccessType")
<*> (o .:? "comments")
<*> (o .:? "subaccountId")
<*> (o .:? "campaignFilter"))
instance ToJSON AccountUserProFile where
toJSON AccountUserProFile'{..}
= object
(catMaybes
[("email" .=) <$> _aupfEmail,
("userRoleFilter" .=) <$> _aupfUserRoleFilter,
("advertiserFilter" .=) <$> _aupfAdvertiserFilter,
("userRoleId" .=) <$> _aupfUserRoleId,
("kind" .=) <$> _aupfKind,
("locale" .=) <$> _aupfLocale,
("siteFilter" .=) <$> _aupfSiteFilter,
("traffickerType" .=) <$> _aupfTraffickerType,
("active" .=) <$> _aupfActive,
("accountId" .=) <$> _aupfAccountId,
("name" .=) <$> _aupfName, ("id" .=) <$> _aupfId,
("userAccessType" .=) <$> _aupfUserAccessType,
("comments" .=) <$> _aupfComments,
("subaccountId" .=) <$> _aupfSubAccountId,
("campaignFilter" .=) <$> _aupfCampaignFilter])
-- | Represents a DimensionValue resource.
--
-- /See:/ 'dimensionValue' smart constructor.
data DimensionValue =
DimensionValue'
{ _dvEtag :: !(Maybe Text)
, _dvKind :: !(Maybe Text)
, _dvValue :: !(Maybe Text)
, _dvMatchType :: !(Maybe DimensionValueMatchType)
, _dvDimensionName :: !(Maybe Text)
, _dvId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DimensionValue' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dvEtag'
--
-- * 'dvKind'
--
-- * 'dvValue'
--
-- * 'dvMatchType'
--
-- * 'dvDimensionName'
--
-- * 'dvId'
dimensionValue
:: DimensionValue
dimensionValue =
DimensionValue'
{ _dvEtag = Nothing
, _dvKind = Nothing
, _dvValue = Nothing
, _dvMatchType = Nothing
, _dvDimensionName = Nothing
, _dvId = Nothing
}
-- | The eTag of this response for caching purposes.
dvEtag :: Lens' DimensionValue (Maybe Text)
dvEtag = lens _dvEtag (\ s a -> s{_dvEtag = a})
-- | The kind of resource this is, in this case dfareporting#dimensionValue.
dvKind :: Lens' DimensionValue (Maybe Text)
dvKind = lens _dvKind (\ s a -> s{_dvKind = a})
-- | The value of the dimension.
dvValue :: Lens' DimensionValue (Maybe Text)
dvValue = lens _dvValue (\ s a -> s{_dvValue = a})
-- | Determines how the \'value\' field is matched when filtering. If not
-- specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, \'*\' is
-- allowed as a placeholder for variable length character sequences, and it
-- can be escaped with a backslash. Note, only paid search dimensions
-- (\'dfa:paidSearch*\') allow a matchType other than EXACT.
dvMatchType :: Lens' DimensionValue (Maybe DimensionValueMatchType)
dvMatchType
= lens _dvMatchType (\ s a -> s{_dvMatchType = a})
-- | The name of the dimension.
dvDimensionName :: Lens' DimensionValue (Maybe Text)
dvDimensionName
= lens _dvDimensionName
(\ s a -> s{_dvDimensionName = a})
-- | The ID associated with the value if available.
dvId :: Lens' DimensionValue (Maybe Text)
dvId = lens _dvId (\ s a -> s{_dvId = a})
instance FromJSON DimensionValue where
parseJSON
= withObject "DimensionValue"
(\ o ->
DimensionValue' <$>
(o .:? "etag") <*> (o .:? "kind") <*> (o .:? "value")
<*> (o .:? "matchType")
<*> (o .:? "dimensionName")
<*> (o .:? "id"))
instance ToJSON DimensionValue where
toJSON DimensionValue'{..}
= object
(catMaybes
[("etag" .=) <$> _dvEtag, ("kind" .=) <$> _dvKind,
("value" .=) <$> _dvValue,
("matchType" .=) <$> _dvMatchType,
("dimensionName" .=) <$> _dvDimensionName,
("id" .=) <$> _dvId])
-- | Represents an activity group.
--
-- /See:/ 'activities' smart constructor.
data Activities =
Activities'
{ _actKind :: !(Maybe Text)
, _actMetricNames :: !(Maybe [Text])
, _actFilters :: !(Maybe [DimensionValue])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Activities' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'actKind'
--
-- * 'actMetricNames'
--
-- * 'actFilters'
activities
:: Activities
activities =
Activities'
{_actKind = Nothing, _actMetricNames = Nothing, _actFilters = Nothing}
-- | The kind of resource this is, in this case dfareporting#activities.
actKind :: Lens' Activities (Maybe Text)
actKind = lens _actKind (\ s a -> s{_actKind = a})
-- | List of names of floodlight activity metrics.
actMetricNames :: Lens' Activities [Text]
actMetricNames
= lens _actMetricNames
(\ s a -> s{_actMetricNames = a})
. _Default
. _Coerce
-- | List of activity filters. The dimension values need to be all either of
-- type \"dfa:activity\" or \"dfa:activityGroup\".
actFilters :: Lens' Activities [DimensionValue]
actFilters
= lens _actFilters (\ s a -> s{_actFilters = a}) .
_Default
. _Coerce
instance FromJSON Activities where
parseJSON
= withObject "Activities"
(\ o ->
Activities' <$>
(o .:? "kind") <*> (o .:? "metricNames" .!= mempty)
<*> (o .:? "filters" .!= mempty))
instance ToJSON Activities where
toJSON Activities'{..}
= object
(catMaybes
[("kind" .=) <$> _actKind,
("metricNames" .=) <$> _actMetricNames,
("filters" .=) <$> _actFilters])
-- | User Role Permission Group List Response
--
-- /See:/ 'userRolePermissionGroupsListResponse' smart constructor.
data UserRolePermissionGroupsListResponse =
UserRolePermissionGroupsListResponse'
{ _urpglrUserRolePermissionGroups :: !(Maybe [UserRolePermissionGroup])
, _urpglrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UserRolePermissionGroupsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'urpglrUserRolePermissionGroups'
--
-- * 'urpglrKind'
userRolePermissionGroupsListResponse
:: UserRolePermissionGroupsListResponse
userRolePermissionGroupsListResponse =
UserRolePermissionGroupsListResponse'
{_urpglrUserRolePermissionGroups = Nothing, _urpglrKind = Nothing}
-- | User role permission group collection.
urpglrUserRolePermissionGroups :: Lens' UserRolePermissionGroupsListResponse [UserRolePermissionGroup]
urpglrUserRolePermissionGroups
= lens _urpglrUserRolePermissionGroups
(\ s a -> s{_urpglrUserRolePermissionGroups = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#userRolePermissionGroupsListResponse\".
urpglrKind :: Lens' UserRolePermissionGroupsListResponse (Maybe Text)
urpglrKind
= lens _urpglrKind (\ s a -> s{_urpglrKind = a})
instance FromJSON
UserRolePermissionGroupsListResponse
where
parseJSON
= withObject "UserRolePermissionGroupsListResponse"
(\ o ->
UserRolePermissionGroupsListResponse' <$>
(o .:? "userRolePermissionGroups" .!= mempty) <*>
(o .:? "kind"))
instance ToJSON UserRolePermissionGroupsListResponse
where
toJSON UserRolePermissionGroupsListResponse'{..}
= object
(catMaybes
[("userRolePermissionGroups" .=) <$>
_urpglrUserRolePermissionGroups,
("kind" .=) <$> _urpglrKind])
-- | Placement Tag
--
-- /See:/ 'placementTag' smart constructor.
data PlacementTag =
PlacementTag'
{ _ptPlacementId :: !(Maybe (Textual Int64))
, _ptTagDatas :: !(Maybe [TagData])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlacementTag' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ptPlacementId'
--
-- * 'ptTagDatas'
placementTag
:: PlacementTag
placementTag = PlacementTag' {_ptPlacementId = Nothing, _ptTagDatas = Nothing}
-- | Placement ID
ptPlacementId :: Lens' PlacementTag (Maybe Int64)
ptPlacementId
= lens _ptPlacementId
(\ s a -> s{_ptPlacementId = a})
. mapping _Coerce
-- | Tags generated for this placement.
ptTagDatas :: Lens' PlacementTag [TagData]
ptTagDatas
= lens _ptTagDatas (\ s a -> s{_ptTagDatas = a}) .
_Default
. _Coerce
instance FromJSON PlacementTag where
parseJSON
= withObject "PlacementTag"
(\ o ->
PlacementTag' <$>
(o .:? "placementId") <*>
(o .:? "tagDatas" .!= mempty))
instance ToJSON PlacementTag where
toJSON PlacementTag'{..}
= object
(catMaybes
[("placementId" .=) <$> _ptPlacementId,
("tagDatas" .=) <$> _ptTagDatas])
-- | Remarketing list response
--
-- /See:/ 'remarketingListsListResponse' smart constructor.
data RemarketingListsListResponse =
RemarketingListsListResponse'
{ _rllrNextPageToken :: !(Maybe Text)
, _rllrRemarketingLists :: !(Maybe [RemarketingList])
, _rllrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'RemarketingListsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rllrNextPageToken'
--
-- * 'rllrRemarketingLists'
--
-- * 'rllrKind'
remarketingListsListResponse
:: RemarketingListsListResponse
remarketingListsListResponse =
RemarketingListsListResponse'
{ _rllrNextPageToken = Nothing
, _rllrRemarketingLists = Nothing
, _rllrKind = Nothing
}
-- | Pagination token to be used for the next list operation.
rllrNextPageToken :: Lens' RemarketingListsListResponse (Maybe Text)
rllrNextPageToken
= lens _rllrNextPageToken
(\ s a -> s{_rllrNextPageToken = a})
-- | Remarketing list collection.
rllrRemarketingLists :: Lens' RemarketingListsListResponse [RemarketingList]
rllrRemarketingLists
= lens _rllrRemarketingLists
(\ s a -> s{_rllrRemarketingLists = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#remarketingListsListResponse\".
rllrKind :: Lens' RemarketingListsListResponse (Maybe Text)
rllrKind = lens _rllrKind (\ s a -> s{_rllrKind = a})
instance FromJSON RemarketingListsListResponse where
parseJSON
= withObject "RemarketingListsListResponse"
(\ o ->
RemarketingListsListResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "remarketingLists" .!= mempty)
<*> (o .:? "kind"))
instance ToJSON RemarketingListsListResponse where
toJSON RemarketingListsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _rllrNextPageToken,
("remarketingLists" .=) <$> _rllrRemarketingLists,
("kind" .=) <$> _rllrKind])
-- | Contains properties of a dynamic targeting key. Dynamic targeting keys
-- are unique, user-friendly labels, created at the advertiser level in
-- DCM, that can be assigned to ads, creatives, and placements and used for
-- targeting with Studio dynamic creatives. Use these labels instead of
-- numeric Campaign Manager IDs (such as placement IDs) to save time and
-- avoid errors in your dynamic feeds.
--
-- /See:/ 'dynamicTargetingKey' smart constructor.
data DynamicTargetingKey =
DynamicTargetingKey'
{ _dtkObjectType :: !(Maybe DynamicTargetingKeyObjectType)
, _dtkKind :: !(Maybe Text)
, _dtkObjectId :: !(Maybe (Textual Int64))
, _dtkName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DynamicTargetingKey' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dtkObjectType'
--
-- * 'dtkKind'
--
-- * 'dtkObjectId'
--
-- * 'dtkName'
dynamicTargetingKey
:: DynamicTargetingKey
dynamicTargetingKey =
DynamicTargetingKey'
{ _dtkObjectType = Nothing
, _dtkKind = Nothing
, _dtkObjectId = Nothing
, _dtkName = Nothing
}
-- | Type of the object of this dynamic targeting key. This is a required
-- field.
dtkObjectType :: Lens' DynamicTargetingKey (Maybe DynamicTargetingKeyObjectType)
dtkObjectType
= lens _dtkObjectType
(\ s a -> s{_dtkObjectType = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#dynamicTargetingKey\".
dtkKind :: Lens' DynamicTargetingKey (Maybe Text)
dtkKind = lens _dtkKind (\ s a -> s{_dtkKind = a})
-- | ID of the object of this dynamic targeting key. This is a required
-- field.
dtkObjectId :: Lens' DynamicTargetingKey (Maybe Int64)
dtkObjectId
= lens _dtkObjectId (\ s a -> s{_dtkObjectId = a}) .
mapping _Coerce
-- | Name of this dynamic targeting key. This is a required field. Must be
-- less than 256 characters long and cannot contain commas. All characters
-- are converted to lowercase.
dtkName :: Lens' DynamicTargetingKey (Maybe Text)
dtkName = lens _dtkName (\ s a -> s{_dtkName = a})
instance FromJSON DynamicTargetingKey where
parseJSON
= withObject "DynamicTargetingKey"
(\ o ->
DynamicTargetingKey' <$>
(o .:? "objectType") <*> (o .:? "kind") <*>
(o .:? "objectId")
<*> (o .:? "name"))
instance ToJSON DynamicTargetingKey where
toJSON DynamicTargetingKey'{..}
= object
(catMaybes
[("objectType" .=) <$> _dtkObjectType,
("kind" .=) <$> _dtkKind,
("objectId" .=) <$> _dtkObjectId,
("name" .=) <$> _dtkName])
-- | Contains properties of a Creative.
--
-- /See:/ 'creative' smart constructor.
data Creative =
Creative'
{ _creConvertFlashToHTML5 :: !(Maybe Bool)
, _creBackupImageTargetWindow :: !(Maybe TargetWindow)
, _creRenderingIdDimensionValue :: !(Maybe DimensionValue)
, _creCustomKeyValues :: !(Maybe [Text])
, _creSkipOffSet :: !(Maybe VideoOffSet)
, _creObaIcon :: !(Maybe ObaIcon)
, _creRenderingId :: !(Maybe (Textual Int64))
, _creThirdPartyBackupImageImpressionsURL :: !(Maybe Text)
, _creFsCommand :: !(Maybe FsCommand)
, _creAllowScriptAccess :: !(Maybe Bool)
, _creHTMLCodeLocked :: !(Maybe Bool)
, _creRequiredFlashPluginVersion :: !(Maybe Text)
, _creUniversalAdId :: !(Maybe UniversalAdId)
, _creAuthoringTool :: !(Maybe CreativeAuthoringTool)
, _creSize :: !(Maybe Size)
, _creThirdPartyURLs :: !(Maybe [ThirdPartyTrackingURL])
, _creProgressOffSet :: !(Maybe VideoOffSet)
, _creCounterCustomEvents :: !(Maybe [CreativeCustomEvent])
, _creKind :: !(Maybe Text)
, _creSSLOverride :: !(Maybe Bool)
, _creHTMLCode :: !(Maybe Text)
, _creAdvertiserId :: !(Maybe (Textual Int64))
, _creRequiredFlashVersion :: !(Maybe (Textual Int32))
, _creBackgRoundColor :: !(Maybe Text)
, _creAdTagKeys :: !(Maybe [Text])
, _creSkippable :: !(Maybe Bool)
, _creSSLCompliant :: !(Maybe Bool)
, _creIdDimensionValue :: !(Maybe DimensionValue)
, _creBackupImageReportingLabel :: !(Maybe Text)
, _creCommercialId :: !(Maybe Text)
, _creActive :: !(Maybe Bool)
, _creExitCustomEvents :: !(Maybe [CreativeCustomEvent])
, _creAccountId :: !(Maybe (Textual Int64))
, _creBackupImageClickThroughURL :: !(Maybe CreativeClickThroughURL)
, _creName :: !(Maybe Text)
, _creOverrideCss :: !(Maybe Text)
, _creAdditionalSizes :: !(Maybe [Size])
, _creClickTags :: !(Maybe [ClickTag])
, _creAdParameters :: !(Maybe Text)
, _creVersion :: !(Maybe (Textual Int32))
, _creMediaDescription :: !(Maybe Text)
, _creMediaDuration :: !(Maybe (Textual Double))
, _creLatestTraffickedCreativeId :: !(Maybe (Textual Int64))
, _creThirdPartyRichMediaImpressionsURL :: !(Maybe Text)
, _creDynamicAssetSelection :: !(Maybe Bool)
, _creLastModifiedInfo :: !(Maybe LastModifiedInfo)
, _creId :: !(Maybe (Textual Int64))
, _creAuthoringSource :: !(Maybe CreativeAuthoringSource)
, _creStudioAdvertiserId :: !(Maybe (Textual Int64))
, _creCreativeAssets :: !(Maybe [CreativeAsset])
, _creSubAccountId :: !(Maybe (Textual Int64))
, _creType :: !(Maybe CreativeType)
, _creTimerCustomEvents :: !(Maybe [CreativeCustomEvent])
, _creCreativeAssetSelection :: !(Maybe CreativeAssetSelection)
, _creStudioCreativeId :: !(Maybe (Textual Int64))
, _creCompatibility :: !(Maybe [CreativeCompatibilityItem])
, _creBackupImageFeatures :: !(Maybe [CreativeBackupImageFeaturesItem])
, _creArtworkType :: !(Maybe CreativeArtworkType)
, _creArchived :: !(Maybe Bool)
, _creCompanionCreatives :: !(Maybe [Textual Int64])
, _creTotalFileSize :: !(Maybe (Textual Int64))
, _creStudioTraffickedCreativeId :: !(Maybe (Textual Int64))
, _creAutoAdvanceImages :: !(Maybe Bool)
, _creRedirectURL :: !(Maybe Text)
, _creCreativeFieldAssignments :: !(Maybe [CreativeFieldAssignment])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Creative' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'creConvertFlashToHTML5'
--
-- * 'creBackupImageTargetWindow'
--
-- * 'creRenderingIdDimensionValue'
--
-- * 'creCustomKeyValues'
--
-- * 'creSkipOffSet'
--
-- * 'creObaIcon'
--
-- * 'creRenderingId'
--
-- * 'creThirdPartyBackupImageImpressionsURL'
--
-- * 'creFsCommand'
--
-- * 'creAllowScriptAccess'
--
-- * 'creHTMLCodeLocked'
--
-- * 'creRequiredFlashPluginVersion'
--
-- * 'creUniversalAdId'
--
-- * 'creAuthoringTool'
--
-- * 'creSize'
--
-- * 'creThirdPartyURLs'
--
-- * 'creProgressOffSet'
--
-- * 'creCounterCustomEvents'
--
-- * 'creKind'
--
-- * 'creSSLOverride'
--
-- * 'creHTMLCode'
--
-- * 'creAdvertiserId'
--
-- * 'creRequiredFlashVersion'
--
-- * 'creBackgRoundColor'
--
-- * 'creAdTagKeys'
--
-- * 'creSkippable'
--
-- * 'creSSLCompliant'
--
-- * 'creIdDimensionValue'
--
-- * 'creBackupImageReportingLabel'
--
-- * 'creCommercialId'
--
-- * 'creActive'
--
-- * 'creExitCustomEvents'
--
-- * 'creAccountId'
--
-- * 'creBackupImageClickThroughURL'
--
-- * 'creName'
--
-- * 'creOverrideCss'
--
-- * 'creAdditionalSizes'
--
-- * 'creClickTags'
--
-- * 'creAdParameters'
--
-- * 'creVersion'
--
-- * 'creMediaDescription'
--
-- * 'creMediaDuration'
--
-- * 'creLatestTraffickedCreativeId'
--
-- * 'creThirdPartyRichMediaImpressionsURL'
--
-- * 'creDynamicAssetSelection'
--
-- * 'creLastModifiedInfo'
--
-- * 'creId'
--
-- * 'creAuthoringSource'
--
-- * 'creStudioAdvertiserId'
--
-- * 'creCreativeAssets'
--
-- * 'creSubAccountId'
--
-- * 'creType'
--
-- * 'creTimerCustomEvents'
--
-- * 'creCreativeAssetSelection'
--
-- * 'creStudioCreativeId'
--
-- * 'creCompatibility'
--
-- * 'creBackupImageFeatures'
--
-- * 'creArtworkType'
--
-- * 'creArchived'
--
-- * 'creCompanionCreatives'
--
-- * 'creTotalFileSize'
--
-- * 'creStudioTraffickedCreativeId'
--
-- * 'creAutoAdvanceImages'
--
-- * 'creRedirectURL'
--
-- * 'creCreativeFieldAssignments'
creative
:: Creative
creative =
Creative'
{ _creConvertFlashToHTML5 = Nothing
, _creBackupImageTargetWindow = Nothing
, _creRenderingIdDimensionValue = Nothing
, _creCustomKeyValues = Nothing
, _creSkipOffSet = Nothing
, _creObaIcon = Nothing
, _creRenderingId = Nothing
, _creThirdPartyBackupImageImpressionsURL = Nothing
, _creFsCommand = Nothing
, _creAllowScriptAccess = Nothing
, _creHTMLCodeLocked = Nothing
, _creRequiredFlashPluginVersion = Nothing
, _creUniversalAdId = Nothing
, _creAuthoringTool = Nothing
, _creSize = Nothing
, _creThirdPartyURLs = Nothing
, _creProgressOffSet = Nothing
, _creCounterCustomEvents = Nothing
, _creKind = Nothing
, _creSSLOverride = Nothing
, _creHTMLCode = Nothing
, _creAdvertiserId = Nothing
, _creRequiredFlashVersion = Nothing
, _creBackgRoundColor = Nothing
, _creAdTagKeys = Nothing
, _creSkippable = Nothing
, _creSSLCompliant = Nothing
, _creIdDimensionValue = Nothing
, _creBackupImageReportingLabel = Nothing
, _creCommercialId = Nothing
, _creActive = Nothing
, _creExitCustomEvents = Nothing
, _creAccountId = Nothing
, _creBackupImageClickThroughURL = Nothing
, _creName = Nothing
, _creOverrideCss = Nothing
, _creAdditionalSizes = Nothing
, _creClickTags = Nothing
, _creAdParameters = Nothing
, _creVersion = Nothing
, _creMediaDescription = Nothing
, _creMediaDuration = Nothing
, _creLatestTraffickedCreativeId = Nothing
, _creThirdPartyRichMediaImpressionsURL = Nothing
, _creDynamicAssetSelection = Nothing
, _creLastModifiedInfo = Nothing
, _creId = Nothing
, _creAuthoringSource = Nothing
, _creStudioAdvertiserId = Nothing
, _creCreativeAssets = Nothing
, _creSubAccountId = Nothing
, _creType = Nothing
, _creTimerCustomEvents = Nothing
, _creCreativeAssetSelection = Nothing
, _creStudioCreativeId = Nothing
, _creCompatibility = Nothing
, _creBackupImageFeatures = Nothing
, _creArtworkType = Nothing
, _creArchived = Nothing
, _creCompanionCreatives = Nothing
, _creTotalFileSize = Nothing
, _creStudioTraffickedCreativeId = Nothing
, _creAutoAdvanceImages = Nothing
, _creRedirectURL = Nothing
, _creCreativeFieldAssignments = Nothing
}
-- | Whether Flash assets associated with the creative need to be
-- automatically converted to HTML5. This flag is enabled by default and
-- users can choose to disable it if they don\'t want the system to
-- generate and use HTML5 asset for this creative. Applicable to the
-- following creative type: FLASH_INPAGE. Applicable to DISPLAY when the
-- primary asset type is not HTML_IMAGE.
creConvertFlashToHTML5 :: Lens' Creative (Maybe Bool)
creConvertFlashToHTML5
= lens _creConvertFlashToHTML5
(\ s a -> s{_creConvertFlashToHTML5 = a})
-- | Target window for backup image. Applicable to the following creative
-- types: FLASH_INPAGE and HTML5_BANNER. Applicable to DISPLAY when the
-- primary asset type is not HTML_IMAGE.
creBackupImageTargetWindow :: Lens' Creative (Maybe TargetWindow)
creBackupImageTargetWindow
= lens _creBackupImageTargetWindow
(\ s a -> s{_creBackupImageTargetWindow = a})
-- | Dimension value for the rendering ID of this creative. This is a
-- read-only field. Applicable to all creative types.
creRenderingIdDimensionValue :: Lens' Creative (Maybe DimensionValue)
creRenderingIdDimensionValue
= lens _creRenderingIdDimensionValue
(\ s a -> s{_creRenderingIdDimensionValue = a})
-- | Custom key-values for a Rich Media creative. Key-values let you
-- customize the creative settings of a Rich Media ad running on your site
-- without having to contact the advertiser. You can use key-values to
-- dynamically change the look or functionality of a creative. Applicable
-- to the following creative types: all RICH_MEDIA, and all VPAID.
creCustomKeyValues :: Lens' Creative [Text]
creCustomKeyValues
= lens _creCustomKeyValues
(\ s a -> s{_creCustomKeyValues = a})
. _Default
. _Coerce
-- | Amount of time to play the video before the skip button appears.
-- Applicable to the following creative types: all INSTREAM_VIDEO.
creSkipOffSet :: Lens' Creative (Maybe VideoOffSet)
creSkipOffSet
= lens _creSkipOffSet
(\ s a -> s{_creSkipOffSet = a})
-- | Online behavioral advertising icon to be added to the creative.
-- Applicable to the following creative types: all INSTREAM_VIDEO.
creObaIcon :: Lens' Creative (Maybe ObaIcon)
creObaIcon
= lens _creObaIcon (\ s a -> s{_creObaIcon = a})
-- | ID of current rendering version. This is a read-only field. Applicable
-- to all creative types.
creRenderingId :: Lens' Creative (Maybe Int64)
creRenderingId
= lens _creRenderingId
(\ s a -> s{_creRenderingId = a})
. mapping _Coerce
-- | Third-party URL used to record backup image impressions. Applicable to
-- the following creative types: all RICH_MEDIA.
creThirdPartyBackupImageImpressionsURL :: Lens' Creative (Maybe Text)
creThirdPartyBackupImageImpressionsURL
= lens _creThirdPartyBackupImageImpressionsURL
(\ s a ->
s{_creThirdPartyBackupImageImpressionsURL = a})
-- | OpenWindow FSCommand of this creative. This lets the SWF file
-- communicate with either Flash Player or the program hosting Flash
-- Player, such as a web browser. This is only triggered if
-- allowScriptAccess field is true. Applicable to the following creative
-- types: FLASH_INPAGE.
creFsCommand :: Lens' Creative (Maybe FsCommand)
creFsCommand
= lens _creFsCommand (\ s a -> s{_creFsCommand = a})
-- | Whether script access is allowed for this creative. This is a read-only
-- and deprecated field which will automatically be set to true on update.
-- Applicable to the following creative types: FLASH_INPAGE.
creAllowScriptAccess :: Lens' Creative (Maybe Bool)
creAllowScriptAccess
= lens _creAllowScriptAccess
(\ s a -> s{_creAllowScriptAccess = a})
-- | Whether HTML code is generated by Campaign Manager or manually entered.
-- Set to true to ignore changes to htmlCode. Applicable to the following
-- creative types: FLASH_INPAGE and HTML5_BANNER.
creHTMLCodeLocked :: Lens' Creative (Maybe Bool)
creHTMLCodeLocked
= lens _creHTMLCodeLocked
(\ s a -> s{_creHTMLCodeLocked = a})
-- | The minimum required Flash plugin version for this creative. For
-- example, 11.2.202.235. This is a read-only field. Applicable to the
-- following creative types: all RICH_MEDIA, and all VPAID.
creRequiredFlashPluginVersion :: Lens' Creative (Maybe Text)
creRequiredFlashPluginVersion
= lens _creRequiredFlashPluginVersion
(\ s a -> s{_creRequiredFlashPluginVersion = a})
-- | A Universal Ad ID as per the VAST 4.0 spec. Applicable to the following
-- creative types: INSTREAM_AUDIO and INSTREAM_VIDEO and VPAID.
creUniversalAdId :: Lens' Creative (Maybe UniversalAdId)
creUniversalAdId
= lens _creUniversalAdId
(\ s a -> s{_creUniversalAdId = a})
-- | Authoring tool for HTML5 banner creatives. This is a read-only field.
-- Applicable to the following creative types: HTML5_BANNER.
creAuthoringTool :: Lens' Creative (Maybe CreativeAuthoringTool)
creAuthoringTool
= lens _creAuthoringTool
(\ s a -> s{_creAuthoringTool = a})
-- | Size associated with this creative. When inserting or updating a
-- creative either the size ID field or size width and height fields can be
-- used. This is a required field when applicable; however for IMAGE,
-- FLASH_INPAGE creatives, and for DISPLAY creatives with a primary asset
-- of type HTML_IMAGE, if left blank, this field will be automatically set
-- using the actual size of the associated image assets. Applicable to the
-- following creative types: DISPLAY, DISPLAY_IMAGE_GALLERY, FLASH_INPAGE,
-- HTML5_BANNER, IMAGE, and all RICH_MEDIA.
creSize :: Lens' Creative (Maybe Size)
creSize = lens _creSize (\ s a -> s{_creSize = a})
-- | Third-party URLs for tracking in-stream creative events. Applicable to
-- the following creative types: all INSTREAM_VIDEO, all INSTREAM_AUDIO,
-- and all VPAID.
creThirdPartyURLs :: Lens' Creative [ThirdPartyTrackingURL]
creThirdPartyURLs
= lens _creThirdPartyURLs
(\ s a -> s{_creThirdPartyURLs = a})
. _Default
. _Coerce
-- | Amount of time to play the video before counting a view. Applicable to
-- the following creative types: all INSTREAM_VIDEO.
creProgressOffSet :: Lens' Creative (Maybe VideoOffSet)
creProgressOffSet
= lens _creProgressOffSet
(\ s a -> s{_creProgressOffSet = a})
-- | List of counter events configured for the creative. For
-- DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated
-- from clickTags. Applicable to the following creative types:
-- DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID.
creCounterCustomEvents :: Lens' Creative [CreativeCustomEvent]
creCounterCustomEvents
= lens _creCounterCustomEvents
(\ s a -> s{_creCounterCustomEvents = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#creative\".
creKind :: Lens' Creative (Maybe Text)
creKind = lens _creKind (\ s a -> s{_creKind = a})
-- | Whether creative should be treated as SSL compliant even if the system
-- scan shows it\'s not. Applicable to all creative types.
creSSLOverride :: Lens' Creative (Maybe Bool)
creSSLOverride
= lens _creSSLOverride
(\ s a -> s{_creSSLOverride = a})
-- | HTML code for the creative. This is a required field when applicable.
-- This field is ignored if htmlCodeLocked is true. Applicable to the
-- following creative types: all CUSTOM, FLASH_INPAGE, and HTML5_BANNER,
-- and all RICH_MEDIA.
creHTMLCode :: Lens' Creative (Maybe Text)
creHTMLCode
= lens _creHTMLCode (\ s a -> s{_creHTMLCode = a})
-- | Advertiser ID of this creative. This is a required field. Applicable to
-- all creative types.
creAdvertiserId :: Lens' Creative (Maybe Int64)
creAdvertiserId
= lens _creAdvertiserId
(\ s a -> s{_creAdvertiserId = a})
. mapping _Coerce
-- | The internal Flash version for this creative as calculated by Studio.
-- This is a read-only field. Applicable to the following creative types:
-- FLASH_INPAGE all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when
-- the primary asset type is not HTML_IMAGE.
creRequiredFlashVersion :: Lens' Creative (Maybe Int32)
creRequiredFlashVersion
= lens _creRequiredFlashVersion
(\ s a -> s{_creRequiredFlashVersion = a})
. mapping _Coerce
-- | The 6-character HTML color code, beginning with #, for the background of
-- the window area where the Flash file is displayed. Default is white.
-- Applicable to the following creative types: FLASH_INPAGE.
creBackgRoundColor :: Lens' Creative (Maybe Text)
creBackgRoundColor
= lens _creBackgRoundColor
(\ s a -> s{_creBackgRoundColor = a})
-- | Keywords for a Rich Media creative. Keywords let you customize the
-- creative settings of a Rich Media ad running on your site without having
-- to contact the advertiser. You can use keywords to dynamically change
-- the look or functionality of a creative. Applicable to the following
-- creative types: all RICH_MEDIA, and all VPAID.
creAdTagKeys :: Lens' Creative [Text]
creAdTagKeys
= lens _creAdTagKeys (\ s a -> s{_creAdTagKeys = a})
. _Default
. _Coerce
-- | Whether the user can choose to skip the creative. Applicable to the
-- following creative types: all INSTREAM_VIDEO and all VPAID.
creSkippable :: Lens' Creative (Maybe Bool)
creSkippable
= lens _creSkippable (\ s a -> s{_creSkippable = a})
-- | Whether the creative is SSL-compliant. This is a read-only field.
-- Applicable to all creative types.
creSSLCompliant :: Lens' Creative (Maybe Bool)
creSSLCompliant
= lens _creSSLCompliant
(\ s a -> s{_creSSLCompliant = a})
-- | Dimension value for the ID of this creative. This is a read-only field.
-- Applicable to all creative types.
creIdDimensionValue :: Lens' Creative (Maybe DimensionValue)
creIdDimensionValue
= lens _creIdDimensionValue
(\ s a -> s{_creIdDimensionValue = a})
-- | Reporting label used for HTML5 banner backup image. Applicable to the
-- following creative types: DISPLAY when the primary asset type is not
-- HTML_IMAGE.
creBackupImageReportingLabel :: Lens' Creative (Maybe Text)
creBackupImageReportingLabel
= lens _creBackupImageReportingLabel
(\ s a -> s{_creBackupImageReportingLabel = a})
-- | Industry standard ID assigned to creative for reach and frequency.
-- Applicable to INSTREAM_VIDEO_REDIRECT creatives.
creCommercialId :: Lens' Creative (Maybe Text)
creCommercialId
= lens _creCommercialId
(\ s a -> s{_creCommercialId = a})
-- | Whether the creative is active. Applicable to all creative types.
creActive :: Lens' Creative (Maybe Bool)
creActive
= lens _creActive (\ s a -> s{_creActive = a})
-- | List of exit events configured for the creative. For DISPLAY and
-- DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated
-- from clickTags, For DISPLAY, an event is also created from the
-- backupImageReportingLabel. Applicable to the following creative types:
-- DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to
-- DISPLAY when the primary asset type is not HTML_IMAGE.
creExitCustomEvents :: Lens' Creative [CreativeCustomEvent]
creExitCustomEvents
= lens _creExitCustomEvents
(\ s a -> s{_creExitCustomEvents = a})
. _Default
. _Coerce
-- | Account ID of this creative. This field, if left unset, will be
-- auto-generated for both insert and update operations. Applicable to all
-- creative types.
creAccountId :: Lens' Creative (Maybe Int64)
creAccountId
= lens _creAccountId (\ s a -> s{_creAccountId = a})
. mapping _Coerce
-- | Click-through URL for backup image. Applicable to ENHANCED_BANNER when
-- the primary asset type is not HTML_IMAGE.
creBackupImageClickThroughURL :: Lens' Creative (Maybe CreativeClickThroughURL)
creBackupImageClickThroughURL
= lens _creBackupImageClickThroughURL
(\ s a -> s{_creBackupImageClickThroughURL = a})
-- | Name of the creative. This is a required field and must be less than 256
-- characters long. Applicable to all creative types.
creName :: Lens' Creative (Maybe Text)
creName = lens _creName (\ s a -> s{_creName = a})
-- | Override CSS value for rich media creatives. Applicable to the following
-- creative types: all RICH_MEDIA.
creOverrideCss :: Lens' Creative (Maybe Text)
creOverrideCss
= lens _creOverrideCss
(\ s a -> s{_creOverrideCss = a})
-- | Additional sizes associated with a responsive creative. When inserting
-- or updating a creative either the size ID field or size width and height
-- fields can be used. Applicable to DISPLAY creatives when the primary
-- asset type is HTML_IMAGE.
creAdditionalSizes :: Lens' Creative [Size]
creAdditionalSizes
= lens _creAdditionalSizes
(\ s a -> s{_creAdditionalSizes = a})
. _Default
. _Coerce
-- | Click tags of the creative. For DISPLAY, FLASH_INPAGE, and HTML5_BANNER
-- creatives, this is a subset of detected click tags for the assets
-- associated with this creative. After creating a flash asset, detected
-- click tags will be returned in the creativeAssetMetadata. When inserting
-- the creative, populate the creative clickTags field using the
-- creativeAssetMetadata.clickTags field. For DISPLAY_IMAGE_GALLERY
-- creatives, there should be exactly one entry in this list for each image
-- creative asset. A click tag is matched with a corresponding creative
-- asset by matching the clickTag.name field with the
-- creativeAsset.assetIdentifier.name field. Applicable to the following
-- creative types: DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER.
-- Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
creClickTags :: Lens' Creative [ClickTag]
creClickTags
= lens _creClickTags (\ s a -> s{_creClickTags = a})
. _Default
. _Coerce
-- | Ad parameters user for VPAID creative. This is a read-only field.
-- Applicable to the following creative types: all VPAID.
creAdParameters :: Lens' Creative (Maybe Text)
creAdParameters
= lens _creAdParameters
(\ s a -> s{_creAdParameters = a})
-- | The version number helps you keep track of multiple versions of your
-- creative in your reports. The version number will always be
-- auto-generated during insert operations to start at 1. For tracking
-- creatives the version cannot be incremented and will always remain at 1.
-- For all other creative types the version can be incremented only by 1
-- during update operations. In addition, the version will be automatically
-- incremented by 1 when undergoing Rich Media creative merging. Applicable
-- to all creative types.
creVersion :: Lens' Creative (Maybe Int32)
creVersion
= lens _creVersion (\ s a -> s{_creVersion = a}) .
mapping _Coerce
-- | Description of the audio or video ad. Applicable to the following
-- creative types: all INSTREAM_VIDEO, INSTREAM_AUDIO, and all VPAID.
creMediaDescription :: Lens' Creative (Maybe Text)
creMediaDescription
= lens _creMediaDescription
(\ s a -> s{_creMediaDescription = a})
-- | Creative audio or video duration in seconds. This is a read-only field.
-- Applicable to the following creative types: INSTREAM_VIDEO,
-- INSTREAM_AUDIO, all RICH_MEDIA, and all VPAID.
creMediaDuration :: Lens' Creative (Maybe Double)
creMediaDuration
= lens _creMediaDuration
(\ s a -> s{_creMediaDuration = a})
. mapping _Coerce
-- | Latest Studio trafficked creative ID associated with rich media and
-- VPAID creatives. This is a read-only field. Applicable to the following
-- creative types: all RICH_MEDIA, and all VPAID.
creLatestTraffickedCreativeId :: Lens' Creative (Maybe Int64)
creLatestTraffickedCreativeId
= lens _creLatestTraffickedCreativeId
(\ s a -> s{_creLatestTraffickedCreativeId = a})
. mapping _Coerce
-- | Third-party URL used to record rich media impressions. Applicable to the
-- following creative types: all RICH_MEDIA.
creThirdPartyRichMediaImpressionsURL :: Lens' Creative (Maybe Text)
creThirdPartyRichMediaImpressionsURL
= lens _creThirdPartyRichMediaImpressionsURL
(\ s a ->
s{_creThirdPartyRichMediaImpressionsURL = a})
-- | Set this to true to enable the use of rules to target individual assets
-- in this creative. When set to true creativeAssetSelection must be set.
-- This also controls asset-level companions. When this is true, companion
-- creatives should be assigned to creative assets. Learn more. Applicable
-- to INSTREAM_VIDEO creatives.
creDynamicAssetSelection :: Lens' Creative (Maybe Bool)
creDynamicAssetSelection
= lens _creDynamicAssetSelection
(\ s a -> s{_creDynamicAssetSelection = a})
-- | Creative last modification information. This is a read-only field.
-- Applicable to all creative types.
creLastModifiedInfo :: Lens' Creative (Maybe LastModifiedInfo)
creLastModifiedInfo
= lens _creLastModifiedInfo
(\ s a -> s{_creLastModifiedInfo = a})
-- | ID of this creative. This is a read-only, auto-generated field.
-- Applicable to all creative types.
creId :: Lens' Creative (Maybe Int64)
creId
= lens _creId (\ s a -> s{_creId = a}) .
mapping _Coerce
-- | Source application where creative was authored. Presently, only DBM
-- authored creatives will have this field set. Applicable to all creative
-- types.
creAuthoringSource :: Lens' Creative (Maybe CreativeAuthoringSource)
creAuthoringSource
= lens _creAuthoringSource
(\ s a -> s{_creAuthoringSource = a})
-- | Studio advertiser ID associated with rich media and VPAID creatives.
-- This is a read-only field. Applicable to the following creative types:
-- all RICH_MEDIA, and all VPAID.
creStudioAdvertiserId :: Lens' Creative (Maybe Int64)
creStudioAdvertiserId
= lens _creStudioAdvertiserId
(\ s a -> s{_creStudioAdvertiserId = a})
. mapping _Coerce
-- | Assets associated with a creative. Applicable to all but the following
-- creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and
-- REDIRECT
creCreativeAssets :: Lens' Creative [CreativeAsset]
creCreativeAssets
= lens _creCreativeAssets
(\ s a -> s{_creCreativeAssets = a})
. _Default
. _Coerce
-- | Subaccount ID of this creative. This field, if left unset, will be
-- auto-generated for both insert and update operations. Applicable to all
-- creative types.
creSubAccountId :: Lens' Creative (Maybe Int64)
creSubAccountId
= lens _creSubAccountId
(\ s a -> s{_creSubAccountId = a})
. mapping _Coerce
-- | Type of this creative. This is a required field. Applicable to all
-- creative types. *Note:* FLASH_INPAGE, HTML5_BANNER, and IMAGE are only
-- used for existing creatives. New creatives should use DISPLAY as a
-- replacement for these types.
creType :: Lens' Creative (Maybe CreativeType)
creType = lens _creType (\ s a -> s{_creType = a})
-- | List of timer events configured for the creative. For
-- DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated
-- from clickTags. Applicable to the following creative types:
-- DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to
-- DISPLAY when the primary asset is not HTML_IMAGE.
creTimerCustomEvents :: Lens' Creative [CreativeCustomEvent]
creTimerCustomEvents
= lens _creTimerCustomEvents
(\ s a -> s{_creTimerCustomEvents = a})
. _Default
. _Coerce
-- | Required if dynamicAssetSelection is true.
creCreativeAssetSelection :: Lens' Creative (Maybe CreativeAssetSelection)
creCreativeAssetSelection
= lens _creCreativeAssetSelection
(\ s a -> s{_creCreativeAssetSelection = a})
-- | Studio creative ID associated with rich media and VPAID creatives. This
-- is a read-only field. Applicable to the following creative types: all
-- RICH_MEDIA, and all VPAID.
creStudioCreativeId :: Lens' Creative (Maybe Int64)
creStudioCreativeId
= lens _creStudioCreativeId
(\ s a -> s{_creStudioCreativeId = a})
. mapping _Coerce
-- | Compatibilities associated with this creative. This is a read-only
-- field. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on
-- desktop or on mobile devices or in mobile apps for regular or
-- interstitial ads, respectively. APP and APP_INTERSTITIAL are for
-- rendering in mobile apps. Only pre-existing creatives may have these
-- compatibilities since new creatives will either be assigned DISPLAY or
-- DISPLAY_INTERSTITIAL instead. IN_STREAM_VIDEO refers to rendering in
-- in-stream video ads developed with the VAST standard. IN_STREAM_AUDIO
-- refers to rendering in in-stream audio ads developed with the VAST
-- standard. Applicable to all creative types. Acceptable values are: -
-- \"APP\" - \"APP_INTERSTITIAL\" - \"IN_STREAM_VIDEO\" -
-- \"IN_STREAM_AUDIO\" - \"DISPLAY\" - \"DISPLAY_INTERSTITIAL\"
creCompatibility :: Lens' Creative [CreativeCompatibilityItem]
creCompatibility
= lens _creCompatibility
(\ s a -> s{_creCompatibility = a})
. _Default
. _Coerce
-- | List of feature dependencies that will cause a backup image to be served
-- if the browser that serves the ad does not support them. Feature
-- dependencies are features that a browser must be able to support in
-- order to render your HTML5 creative asset correctly. This field is
-- initially auto-generated to contain all features detected by Campaign
-- Manager for all the assets of this creative and can then be modified by
-- the client. To reset this field, copy over all the creativeAssets\'
-- detected features. Applicable to the following creative types:
-- HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not
-- HTML_IMAGE.
creBackupImageFeatures :: Lens' Creative [CreativeBackupImageFeaturesItem]
creBackupImageFeatures
= lens _creBackupImageFeatures
(\ s a -> s{_creBackupImageFeatures = a})
. _Default
. _Coerce
-- | Type of artwork used for the creative. This is a read-only field.
-- Applicable to the following creative types: all RICH_MEDIA, and all
-- VPAID.
creArtworkType :: Lens' Creative (Maybe CreativeArtworkType)
creArtworkType
= lens _creArtworkType
(\ s a -> s{_creArtworkType = a})
-- | Whether the creative is archived. Applicable to all creative types.
creArchived :: Lens' Creative (Maybe Bool)
creArchived
= lens _creArchived (\ s a -> s{_creArchived = a})
-- | List of companion creatives assigned to an in-Stream video creative.
-- Acceptable values include IDs of existing flash and image creatives.
-- Applicable to the following creative types: all VPAID, all
-- INSTREAM_AUDIO and all INSTREAM_VIDEO with dynamicAssetSelection set to
-- false.
creCompanionCreatives :: Lens' Creative [Int64]
creCompanionCreatives
= lens _creCompanionCreatives
(\ s a -> s{_creCompanionCreatives = a})
. _Default
. _Coerce
-- | Combined size of all creative assets. This is a read-only field.
-- Applicable to the following creative types: all RICH_MEDIA, and all
-- VPAID.
creTotalFileSize :: Lens' Creative (Maybe Int64)
creTotalFileSize
= lens _creTotalFileSize
(\ s a -> s{_creTotalFileSize = a})
. mapping _Coerce
-- | Studio trafficked creative ID associated with rich media and VPAID
-- creatives. This is a read-only field. Applicable to the following
-- creative types: all RICH_MEDIA, and all VPAID.
creStudioTraffickedCreativeId :: Lens' Creative (Maybe Int64)
creStudioTraffickedCreativeId
= lens _creStudioTraffickedCreativeId
(\ s a -> s{_creStudioTraffickedCreativeId = a})
. mapping _Coerce
-- | Whether images are automatically advanced for image gallery creatives.
-- Applicable to the following creative types: DISPLAY_IMAGE_GALLERY.
creAutoAdvanceImages :: Lens' Creative (Maybe Bool)
creAutoAdvanceImages
= lens _creAutoAdvanceImages
(\ s a -> s{_creAutoAdvanceImages = a})
-- | URL of hosted image or hosted video or another ad tag. For
-- INSTREAM_VIDEO_REDIRECT creatives this is the in-stream video redirect
-- URL. The standard for a VAST (Video Ad Serving Template) ad response
-- allows for a redirect link to another VAST 2.0 or 3.0 call. This is a
-- required field when applicable. Applicable to the following creative
-- types: DISPLAY_REDIRECT, INTERNAL_REDIRECT,
-- INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO_REDIRECT
creRedirectURL :: Lens' Creative (Maybe Text)
creRedirectURL
= lens _creRedirectURL
(\ s a -> s{_creRedirectURL = a})
-- | Creative field assignments for this creative. Applicable to all creative
-- types.
creCreativeFieldAssignments :: Lens' Creative [CreativeFieldAssignment]
creCreativeFieldAssignments
= lens _creCreativeFieldAssignments
(\ s a -> s{_creCreativeFieldAssignments = a})
. _Default
. _Coerce
instance FromJSON Creative where
parseJSON
= withObject "Creative"
(\ o ->
Creative' <$>
(o .:? "convertFlashToHtml5") <*>
(o .:? "backupImageTargetWindow")
<*> (o .:? "renderingIdDimensionValue")
<*> (o .:? "customKeyValues" .!= mempty)
<*> (o .:? "skipOffset")
<*> (o .:? "obaIcon")
<*> (o .:? "renderingId")
<*> (o .:? "thirdPartyBackupImageImpressionsUrl")
<*> (o .:? "fsCommand")
<*> (o .:? "allowScriptAccess")
<*> (o .:? "htmlCodeLocked")
<*> (o .:? "requiredFlashPluginVersion")
<*> (o .:? "universalAdId")
<*> (o .:? "authoringTool")
<*> (o .:? "size")
<*> (o .:? "thirdPartyUrls" .!= mempty)
<*> (o .:? "progressOffset")
<*> (o .:? "counterCustomEvents" .!= mempty)
<*> (o .:? "kind")
<*> (o .:? "sslOverride")
<*> (o .:? "htmlCode")
<*> (o .:? "advertiserId")
<*> (o .:? "requiredFlashVersion")
<*> (o .:? "backgroundColor")
<*> (o .:? "adTagKeys" .!= mempty)
<*> (o .:? "skippable")
<*> (o .:? "sslCompliant")
<*> (o .:? "idDimensionValue")
<*> (o .:? "backupImageReportingLabel")
<*> (o .:? "commercialId")
<*> (o .:? "active")
<*> (o .:? "exitCustomEvents" .!= mempty)
<*> (o .:? "accountId")
<*> (o .:? "backupImageClickThroughUrl")
<*> (o .:? "name")
<*> (o .:? "overrideCss")
<*> (o .:? "additionalSizes" .!= mempty)
<*> (o .:? "clickTags" .!= mempty)
<*> (o .:? "adParameters")
<*> (o .:? "version")
<*> (o .:? "mediaDescription")
<*> (o .:? "mediaDuration")
<*> (o .:? "latestTraffickedCreativeId")
<*> (o .:? "thirdPartyRichMediaImpressionsUrl")
<*> (o .:? "dynamicAssetSelection")
<*> (o .:? "lastModifiedInfo")
<*> (o .:? "id")
<*> (o .:? "authoringSource")
<*> (o .:? "studioAdvertiserId")
<*> (o .:? "creativeAssets" .!= mempty)
<*> (o .:? "subaccountId")
<*> (o .:? "type")
<*> (o .:? "timerCustomEvents" .!= mempty)
<*> (o .:? "creativeAssetSelection")
<*> (o .:? "studioCreativeId")
<*> (o .:? "compatibility" .!= mempty)
<*> (o .:? "backupImageFeatures" .!= mempty)
<*> (o .:? "artworkType")
<*> (o .:? "archived")
<*> (o .:? "companionCreatives" .!= mempty)
<*> (o .:? "totalFileSize")
<*> (o .:? "studioTraffickedCreativeId")
<*> (o .:? "autoAdvanceImages")
<*> (o .:? "redirectUrl")
<*> (o .:? "creativeFieldAssignments" .!= mempty))
instance ToJSON Creative where
toJSON Creative'{..}
= object
(catMaybes
[("convertFlashToHtml5" .=) <$>
_creConvertFlashToHTML5,
("backupImageTargetWindow" .=) <$>
_creBackupImageTargetWindow,
("renderingIdDimensionValue" .=) <$>
_creRenderingIdDimensionValue,
("customKeyValues" .=) <$> _creCustomKeyValues,
("skipOffset" .=) <$> _creSkipOffSet,
("obaIcon" .=) <$> _creObaIcon,
("renderingId" .=) <$> _creRenderingId,
("thirdPartyBackupImageImpressionsUrl" .=) <$>
_creThirdPartyBackupImageImpressionsURL,
("fsCommand" .=) <$> _creFsCommand,
("allowScriptAccess" .=) <$> _creAllowScriptAccess,
("htmlCodeLocked" .=) <$> _creHTMLCodeLocked,
("requiredFlashPluginVersion" .=) <$>
_creRequiredFlashPluginVersion,
("universalAdId" .=) <$> _creUniversalAdId,
("authoringTool" .=) <$> _creAuthoringTool,
("size" .=) <$> _creSize,
("thirdPartyUrls" .=) <$> _creThirdPartyURLs,
("progressOffset" .=) <$> _creProgressOffSet,
("counterCustomEvents" .=) <$>
_creCounterCustomEvents,
("kind" .=) <$> _creKind,
("sslOverride" .=) <$> _creSSLOverride,
("htmlCode" .=) <$> _creHTMLCode,
("advertiserId" .=) <$> _creAdvertiserId,
("requiredFlashVersion" .=) <$>
_creRequiredFlashVersion,
("backgroundColor" .=) <$> _creBackgRoundColor,
("adTagKeys" .=) <$> _creAdTagKeys,
("skippable" .=) <$> _creSkippable,
("sslCompliant" .=) <$> _creSSLCompliant,
("idDimensionValue" .=) <$> _creIdDimensionValue,
("backupImageReportingLabel" .=) <$>
_creBackupImageReportingLabel,
("commercialId" .=) <$> _creCommercialId,
("active" .=) <$> _creActive,
("exitCustomEvents" .=) <$> _creExitCustomEvents,
("accountId" .=) <$> _creAccountId,
("backupImageClickThroughUrl" .=) <$>
_creBackupImageClickThroughURL,
("name" .=) <$> _creName,
("overrideCss" .=) <$> _creOverrideCss,
("additionalSizes" .=) <$> _creAdditionalSizes,
("clickTags" .=) <$> _creClickTags,
("adParameters" .=) <$> _creAdParameters,
("version" .=) <$> _creVersion,
("mediaDescription" .=) <$> _creMediaDescription,
("mediaDuration" .=) <$> _creMediaDuration,
("latestTraffickedCreativeId" .=) <$>
_creLatestTraffickedCreativeId,
("thirdPartyRichMediaImpressionsUrl" .=) <$>
_creThirdPartyRichMediaImpressionsURL,
("dynamicAssetSelection" .=) <$>
_creDynamicAssetSelection,
("lastModifiedInfo" .=) <$> _creLastModifiedInfo,
("id" .=) <$> _creId,
("authoringSource" .=) <$> _creAuthoringSource,
("studioAdvertiserId" .=) <$> _creStudioAdvertiserId,
("creativeAssets" .=) <$> _creCreativeAssets,
("subaccountId" .=) <$> _creSubAccountId,
("type" .=) <$> _creType,
("timerCustomEvents" .=) <$> _creTimerCustomEvents,
("creativeAssetSelection" .=) <$>
_creCreativeAssetSelection,
("studioCreativeId" .=) <$> _creStudioCreativeId,
("compatibility" .=) <$> _creCompatibility,
("backupImageFeatures" .=) <$>
_creBackupImageFeatures,
("artworkType" .=) <$> _creArtworkType,
("archived" .=) <$> _creArchived,
("companionCreatives" .=) <$> _creCompanionCreatives,
("totalFileSize" .=) <$> _creTotalFileSize,
("studioTraffickedCreativeId" .=) <$>
_creStudioTraffickedCreativeId,
("autoAdvanceImages" .=) <$> _creAutoAdvanceImages,
("redirectUrl" .=) <$> _creRedirectURL,
("creativeFieldAssignments" .=) <$>
_creCreativeFieldAssignments])
-- | Companion Settings
--
-- /See:/ 'siteCompanionSetting' smart constructor.
data SiteCompanionSetting =
SiteCompanionSetting'
{ _scsKind :: !(Maybe Text)
, _scsImageOnly :: !(Maybe Bool)
, _scsCompanionsDisabled :: !(Maybe Bool)
, _scsEnabledSizes :: !(Maybe [Size])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SiteCompanionSetting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'scsKind'
--
-- * 'scsImageOnly'
--
-- * 'scsCompanionsDisabled'
--
-- * 'scsEnabledSizes'
siteCompanionSetting
:: SiteCompanionSetting
siteCompanionSetting =
SiteCompanionSetting'
{ _scsKind = Nothing
, _scsImageOnly = Nothing
, _scsCompanionsDisabled = Nothing
, _scsEnabledSizes = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#siteCompanionSetting\".
scsKind :: Lens' SiteCompanionSetting (Maybe Text)
scsKind = lens _scsKind (\ s a -> s{_scsKind = a})
-- | Whether to serve only static images as companions.
scsImageOnly :: Lens' SiteCompanionSetting (Maybe Bool)
scsImageOnly
= lens _scsImageOnly (\ s a -> s{_scsImageOnly = a})
-- | Whether companions are disabled for this site template.
scsCompanionsDisabled :: Lens' SiteCompanionSetting (Maybe Bool)
scsCompanionsDisabled
= lens _scsCompanionsDisabled
(\ s a -> s{_scsCompanionsDisabled = a})
-- | Allowlist of companion sizes to be served via this site template. Set
-- this list to null or empty to serve all companion sizes.
scsEnabledSizes :: Lens' SiteCompanionSetting [Size]
scsEnabledSizes
= lens _scsEnabledSizes
(\ s a -> s{_scsEnabledSizes = a})
. _Default
. _Coerce
instance FromJSON SiteCompanionSetting where
parseJSON
= withObject "SiteCompanionSetting"
(\ o ->
SiteCompanionSetting' <$>
(o .:? "kind") <*> (o .:? "imageOnly") <*>
(o .:? "companionsDisabled")
<*> (o .:? "enabledSizes" .!= mempty))
instance ToJSON SiteCompanionSetting where
toJSON SiteCompanionSetting'{..}
= object
(catMaybes
[("kind" .=) <$> _scsKind,
("imageOnly" .=) <$> _scsImageOnly,
("companionsDisabled" .=) <$> _scsCompanionsDisabled,
("enabledSizes" .=) <$> _scsEnabledSizes])
-- | Site Contact
--
-- /See:/ 'siteContact' smart constructor.
data SiteContact =
SiteContact'
{ _scEmail :: !(Maybe Text)
, _scPhone :: !(Maybe Text)
, _scLastName :: !(Maybe Text)
, _scAddress :: !(Maybe Text)
, _scFirstName :: !(Maybe Text)
, _scId :: !(Maybe (Textual Int64))
, _scTitle :: !(Maybe Text)
, _scContactType :: !(Maybe SiteContactContactType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SiteContact' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'scEmail'
--
-- * 'scPhone'
--
-- * 'scLastName'
--
-- * 'scAddress'
--
-- * 'scFirstName'
--
-- * 'scId'
--
-- * 'scTitle'
--
-- * 'scContactType'
siteContact
:: SiteContact
siteContact =
SiteContact'
{ _scEmail = Nothing
, _scPhone = Nothing
, _scLastName = Nothing
, _scAddress = Nothing
, _scFirstName = Nothing
, _scId = Nothing
, _scTitle = Nothing
, _scContactType = Nothing
}
-- | Email address of this site contact. This is a required field.
scEmail :: Lens' SiteContact (Maybe Text)
scEmail = lens _scEmail (\ s a -> s{_scEmail = a})
-- | Primary phone number of this site contact.
scPhone :: Lens' SiteContact (Maybe Text)
scPhone = lens _scPhone (\ s a -> s{_scPhone = a})
-- | Last name of this site contact.
scLastName :: Lens' SiteContact (Maybe Text)
scLastName
= lens _scLastName (\ s a -> s{_scLastName = a})
-- | Address of this site contact.
scAddress :: Lens' SiteContact (Maybe Text)
scAddress
= lens _scAddress (\ s a -> s{_scAddress = a})
-- | First name of this site contact.
scFirstName :: Lens' SiteContact (Maybe Text)
scFirstName
= lens _scFirstName (\ s a -> s{_scFirstName = a})
-- | ID of this site contact. This is a read-only, auto-generated field.
scId :: Lens' SiteContact (Maybe Int64)
scId
= lens _scId (\ s a -> s{_scId = a}) .
mapping _Coerce
-- | Title or designation of this site contact.
scTitle :: Lens' SiteContact (Maybe Text)
scTitle = lens _scTitle (\ s a -> s{_scTitle = a})
-- | Site contact type.
scContactType :: Lens' SiteContact (Maybe SiteContactContactType)
scContactType
= lens _scContactType
(\ s a -> s{_scContactType = a})
instance FromJSON SiteContact where
parseJSON
= withObject "SiteContact"
(\ o ->
SiteContact' <$>
(o .:? "email") <*> (o .:? "phone") <*>
(o .:? "lastName")
<*> (o .:? "address")
<*> (o .:? "firstName")
<*> (o .:? "id")
<*> (o .:? "title")
<*> (o .:? "contactType"))
instance ToJSON SiteContact where
toJSON SiteContact'{..}
= object
(catMaybes
[("email" .=) <$> _scEmail,
("phone" .=) <$> _scPhone,
("lastName" .=) <$> _scLastName,
("address" .=) <$> _scAddress,
("firstName" .=) <$> _scFirstName,
("id" .=) <$> _scId, ("title" .=) <$> _scTitle,
("contactType" .=) <$> _scContactType])
-- | Account List Response
--
-- /See:/ 'accountsListResponse' smart constructor.
data AccountsListResponse =
AccountsListResponse'
{ _accNextPageToken :: !(Maybe Text)
, _accAccounts :: !(Maybe [Account])
, _accKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AccountsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'accNextPageToken'
--
-- * 'accAccounts'
--
-- * 'accKind'
accountsListResponse
:: AccountsListResponse
accountsListResponse =
AccountsListResponse'
{_accNextPageToken = Nothing, _accAccounts = Nothing, _accKind = Nothing}
-- | Pagination token to be used for the next list operation.
accNextPageToken :: Lens' AccountsListResponse (Maybe Text)
accNextPageToken
= lens _accNextPageToken
(\ s a -> s{_accNextPageToken = a})
-- | Account collection.
accAccounts :: Lens' AccountsListResponse [Account]
accAccounts
= lens _accAccounts (\ s a -> s{_accAccounts = a}) .
_Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#accountsListResponse\".
accKind :: Lens' AccountsListResponse (Maybe Text)
accKind = lens _accKind (\ s a -> s{_accKind = a})
instance FromJSON AccountsListResponse where
parseJSON
= withObject "AccountsListResponse"
(\ o ->
AccountsListResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "accounts" .!= mempty)
<*> (o .:? "kind"))
instance ToJSON AccountsListResponse where
toJSON AccountsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _accNextPageToken,
("accounts" .=) <$> _accAccounts,
("kind" .=) <$> _accKind])
-- | Represents a date range.
--
-- /See:/ 'dateRange' smart constructor.
data DateRange =
DateRange'
{ _drKind :: !(Maybe Text)
, _drEndDate :: !(Maybe Date')
, _drStartDate :: !(Maybe Date')
, _drRelativeDateRange :: !(Maybe DateRangeRelativeDateRange)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DateRange' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'drKind'
--
-- * 'drEndDate'
--
-- * 'drStartDate'
--
-- * 'drRelativeDateRange'
dateRange
:: DateRange
dateRange =
DateRange'
{ _drKind = Nothing
, _drEndDate = Nothing
, _drStartDate = Nothing
, _drRelativeDateRange = Nothing
}
-- | The kind of resource this is, in this case dfareporting#dateRange.
drKind :: Lens' DateRange (Maybe Text)
drKind = lens _drKind (\ s a -> s{_drKind = a})
drEndDate :: Lens' DateRange (Maybe Day)
drEndDate
= lens _drEndDate (\ s a -> s{_drEndDate = a}) .
mapping _Date
drStartDate :: Lens' DateRange (Maybe Day)
drStartDate
= lens _drStartDate (\ s a -> s{_drStartDate = a}) .
mapping _Date
-- | The date range relative to the date of when the report is run.
drRelativeDateRange :: Lens' DateRange (Maybe DateRangeRelativeDateRange)
drRelativeDateRange
= lens _drRelativeDateRange
(\ s a -> s{_drRelativeDateRange = a})
instance FromJSON DateRange where
parseJSON
= withObject "DateRange"
(\ o ->
DateRange' <$>
(o .:? "kind") <*> (o .:? "endDate") <*>
(o .:? "startDate")
<*> (o .:? "relativeDateRange"))
instance ToJSON DateRange where
toJSON DateRange'{..}
= object
(catMaybes
[("kind" .=) <$> _drKind,
("endDate" .=) <$> _drEndDate,
("startDate" .=) <$> _drStartDate,
("relativeDateRange" .=) <$> _drRelativeDateRange])
-- | Represents a Report resource.
--
-- /See:/ 'report' smart constructor.
data Report =
Report'
{ _rDelivery :: !(Maybe ReportDelivery)
, _rEtag :: !(Maybe Text)
, _rOwnerProFileId :: !(Maybe (Textual Int64))
, _rSchedule :: !(Maybe ReportSchedule)
, _rPathToConversionCriteria :: !(Maybe ReportPathToConversionCriteria)
, _rKind :: !(Maybe Text)
, _rFormat :: !(Maybe ReportFormat)
, _rPathCriteria :: !(Maybe ReportPathCriteria)
, _rReachCriteria :: !(Maybe ReportReachCriteria)
, _rLastModifiedTime :: !(Maybe (Textual Word64))
, _rAccountId :: !(Maybe (Textual Int64))
, _rName :: !(Maybe Text)
, _rPathAttributionCriteria :: !(Maybe ReportPathAttributionCriteria)
, _rId :: !(Maybe (Textual Int64))
, _rCrossDimensionReachCriteria :: !(Maybe ReportCrossDimensionReachCriteria)
, _rType :: !(Maybe ReportType)
, _rSubAccountId :: !(Maybe (Textual Int64))
, _rFloodlightCriteria :: !(Maybe ReportFloodlightCriteria)
, _rCriteria :: !(Maybe ReportCriteria)
, _rFileName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Report' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rDelivery'
--
-- * 'rEtag'
--
-- * 'rOwnerProFileId'
--
-- * 'rSchedule'
--
-- * 'rPathToConversionCriteria'
--
-- * 'rKind'
--
-- * 'rFormat'
--
-- * 'rPathCriteria'
--
-- * 'rReachCriteria'
--
-- * 'rLastModifiedTime'
--
-- * 'rAccountId'
--
-- * 'rName'
--
-- * 'rPathAttributionCriteria'
--
-- * 'rId'
--
-- * 'rCrossDimensionReachCriteria'
--
-- * 'rType'
--
-- * 'rSubAccountId'
--
-- * 'rFloodlightCriteria'
--
-- * 'rCriteria'
--
-- * 'rFileName'
report
:: Report
report =
Report'
{ _rDelivery = Nothing
, _rEtag = Nothing
, _rOwnerProFileId = Nothing
, _rSchedule = Nothing
, _rPathToConversionCriteria = Nothing
, _rKind = Nothing
, _rFormat = Nothing
, _rPathCriteria = Nothing
, _rReachCriteria = Nothing
, _rLastModifiedTime = Nothing
, _rAccountId = Nothing
, _rName = Nothing
, _rPathAttributionCriteria = Nothing
, _rId = Nothing
, _rCrossDimensionReachCriteria = Nothing
, _rType = Nothing
, _rSubAccountId = Nothing
, _rFloodlightCriteria = Nothing
, _rCriteria = Nothing
, _rFileName = Nothing
}
-- | The report\'s email delivery settings.
rDelivery :: Lens' Report (Maybe ReportDelivery)
rDelivery
= lens _rDelivery (\ s a -> s{_rDelivery = a})
-- | The eTag of this response for caching purposes.
rEtag :: Lens' Report (Maybe Text)
rEtag = lens _rEtag (\ s a -> s{_rEtag = a})
-- | The user profile id of the owner of this report.
rOwnerProFileId :: Lens' Report (Maybe Int64)
rOwnerProFileId
= lens _rOwnerProFileId
(\ s a -> s{_rOwnerProFileId = a})
. mapping _Coerce
-- | The report\'s schedule. Can only be set if the report\'s \'dateRange\'
-- is a relative date range and the relative date range is not \"TODAY\".
rSchedule :: Lens' Report (Maybe ReportSchedule)
rSchedule
= lens _rSchedule (\ s a -> s{_rSchedule = a})
-- | The report criteria for a report of type \"PATH_TO_CONVERSION\".
rPathToConversionCriteria :: Lens' Report (Maybe ReportPathToConversionCriteria)
rPathToConversionCriteria
= lens _rPathToConversionCriteria
(\ s a -> s{_rPathToConversionCriteria = a})
-- | The kind of resource this is, in this case dfareporting#report.
rKind :: Lens' Report (Maybe Text)
rKind = lens _rKind (\ s a -> s{_rKind = a})
-- | The output format of the report. If not specified, default format is
-- \"CSV\". Note that the actual format in the completed report file might
-- differ if for instance the report\'s size exceeds the format\'s
-- capabilities. \"CSV\" will then be the fallback format.
rFormat :: Lens' Report (Maybe ReportFormat)
rFormat = lens _rFormat (\ s a -> s{_rFormat = a})
-- | The report criteria for a report of type \"PATH\".
rPathCriteria :: Lens' Report (Maybe ReportPathCriteria)
rPathCriteria
= lens _rPathCriteria
(\ s a -> s{_rPathCriteria = a})
-- | The report criteria for a report of type \"REACH\".
rReachCriteria :: Lens' Report (Maybe ReportReachCriteria)
rReachCriteria
= lens _rReachCriteria
(\ s a -> s{_rReachCriteria = a})
-- | The timestamp (in milliseconds since epoch) of when this report was last
-- modified.
rLastModifiedTime :: Lens' Report (Maybe Word64)
rLastModifiedTime
= lens _rLastModifiedTime
(\ s a -> s{_rLastModifiedTime = a})
. mapping _Coerce
-- | The account ID to which this report belongs.
rAccountId :: Lens' Report (Maybe Int64)
rAccountId
= lens _rAccountId (\ s a -> s{_rAccountId = a}) .
mapping _Coerce
-- | The name of the report.
rName :: Lens' Report (Maybe Text)
rName = lens _rName (\ s a -> s{_rName = a})
-- | The report criteria for a report of type \"PATH_ATTRIBUTION\".
rPathAttributionCriteria :: Lens' Report (Maybe ReportPathAttributionCriteria)
rPathAttributionCriteria
= lens _rPathAttributionCriteria
(\ s a -> s{_rPathAttributionCriteria = a})
-- | The unique ID identifying this report resource.
rId :: Lens' Report (Maybe Int64)
rId
= lens _rId (\ s a -> s{_rId = a}) . mapping _Coerce
-- | The report criteria for a report of type \"CROSS_DIMENSION_REACH\".
rCrossDimensionReachCriteria :: Lens' Report (Maybe ReportCrossDimensionReachCriteria)
rCrossDimensionReachCriteria
= lens _rCrossDimensionReachCriteria
(\ s a -> s{_rCrossDimensionReachCriteria = a})
-- | The type of the report.
rType :: Lens' Report (Maybe ReportType)
rType = lens _rType (\ s a -> s{_rType = a})
-- | The subaccount ID to which this report belongs if applicable.
rSubAccountId :: Lens' Report (Maybe Int64)
rSubAccountId
= lens _rSubAccountId
(\ s a -> s{_rSubAccountId = a})
. mapping _Coerce
-- | The report criteria for a report of type \"FLOODLIGHT\".
rFloodlightCriteria :: Lens' Report (Maybe ReportFloodlightCriteria)
rFloodlightCriteria
= lens _rFloodlightCriteria
(\ s a -> s{_rFloodlightCriteria = a})
-- | The report criteria for a report of type \"STANDARD\".
rCriteria :: Lens' Report (Maybe ReportCriteria)
rCriteria
= lens _rCriteria (\ s a -> s{_rCriteria = a})
-- | The filename used when generating report files for this report.
rFileName :: Lens' Report (Maybe Text)
rFileName
= lens _rFileName (\ s a -> s{_rFileName = a})
instance FromJSON Report where
parseJSON
= withObject "Report"
(\ o ->
Report' <$>
(o .:? "delivery") <*> (o .:? "etag") <*>
(o .:? "ownerProfileId")
<*> (o .:? "schedule")
<*> (o .:? "pathToConversionCriteria")
<*> (o .:? "kind")
<*> (o .:? "format")
<*> (o .:? "pathCriteria")
<*> (o .:? "reachCriteria")
<*> (o .:? "lastModifiedTime")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "pathAttributionCriteria")
<*> (o .:? "id")
<*> (o .:? "crossDimensionReachCriteria")
<*> (o .:? "type")
<*> (o .:? "subAccountId")
<*> (o .:? "floodlightCriteria")
<*> (o .:? "criteria")
<*> (o .:? "fileName"))
instance ToJSON Report where
toJSON Report'{..}
= object
(catMaybes
[("delivery" .=) <$> _rDelivery,
("etag" .=) <$> _rEtag,
("ownerProfileId" .=) <$> _rOwnerProFileId,
("schedule" .=) <$> _rSchedule,
("pathToConversionCriteria" .=) <$>
_rPathToConversionCriteria,
("kind" .=) <$> _rKind, ("format" .=) <$> _rFormat,
("pathCriteria" .=) <$> _rPathCriteria,
("reachCriteria" .=) <$> _rReachCriteria,
("lastModifiedTime" .=) <$> _rLastModifiedTime,
("accountId" .=) <$> _rAccountId,
("name" .=) <$> _rName,
("pathAttributionCriteria" .=) <$>
_rPathAttributionCriteria,
("id" .=) <$> _rId,
("crossDimensionReachCriteria" .=) <$>
_rCrossDimensionReachCriteria,
("type" .=) <$> _rType,
("subAccountId" .=) <$> _rSubAccountId,
("floodlightCriteria" .=) <$> _rFloodlightCriteria,
("criteria" .=) <$> _rCriteria,
("fileName" .=) <$> _rFileName])
-- | Skippable Settings
--
-- /See:/ 'siteSkippableSetting' smart constructor.
data SiteSkippableSetting =
SiteSkippableSetting'
{ _sssSkipOffSet :: !(Maybe VideoOffSet)
, _sssProgressOffSet :: !(Maybe VideoOffSet)
, _sssKind :: !(Maybe Text)
, _sssSkippable :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SiteSkippableSetting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sssSkipOffSet'
--
-- * 'sssProgressOffSet'
--
-- * 'sssKind'
--
-- * 'sssSkippable'
siteSkippableSetting
:: SiteSkippableSetting
siteSkippableSetting =
SiteSkippableSetting'
{ _sssSkipOffSet = Nothing
, _sssProgressOffSet = Nothing
, _sssKind = Nothing
, _sssSkippable = Nothing
}
-- | Amount of time to play videos served to this site before the skip button
-- should appear. Applicable when skippable is true.
sssSkipOffSet :: Lens' SiteSkippableSetting (Maybe VideoOffSet)
sssSkipOffSet
= lens _sssSkipOffSet
(\ s a -> s{_sssSkipOffSet = a})
-- | Amount of time to play videos served to this site template before
-- counting a view. Applicable when skippable is true.
sssProgressOffSet :: Lens' SiteSkippableSetting (Maybe VideoOffSet)
sssProgressOffSet
= lens _sssProgressOffSet
(\ s a -> s{_sssProgressOffSet = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#siteSkippableSetting\".
sssKind :: Lens' SiteSkippableSetting (Maybe Text)
sssKind = lens _sssKind (\ s a -> s{_sssKind = a})
-- | Whether the user can skip creatives served to this site. This will act
-- as default for new placements created under this site.
sssSkippable :: Lens' SiteSkippableSetting (Maybe Bool)
sssSkippable
= lens _sssSkippable (\ s a -> s{_sssSkippable = a})
instance FromJSON SiteSkippableSetting where
parseJSON
= withObject "SiteSkippableSetting"
(\ o ->
SiteSkippableSetting' <$>
(o .:? "skipOffset") <*> (o .:? "progressOffset") <*>
(o .:? "kind")
<*> (o .:? "skippable"))
instance ToJSON SiteSkippableSetting where
toJSON SiteSkippableSetting'{..}
= object
(catMaybes
[("skipOffset" .=) <$> _sssSkipOffSet,
("progressOffset" .=) <$> _sssProgressOffSet,
("kind" .=) <$> _sssKind,
("skippable" .=) <$> _sssSkippable])
-- | A rule associates an asset with a targeting template for asset-level
-- targeting. Applicable to INSTREAM_VIDEO creatives.
--
-- /See:/ 'rule' smart constructor.
data Rule =
Rule'
{ _rulTargetingTemplateId :: !(Maybe (Textual Int64))
, _rulName :: !(Maybe Text)
, _rulAssetId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Rule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rulTargetingTemplateId'
--
-- * 'rulName'
--
-- * 'rulAssetId'
rule
:: Rule
rule =
Rule'
{ _rulTargetingTemplateId = Nothing
, _rulName = Nothing
, _rulAssetId = Nothing
}
-- | A targeting template ID. The targeting from the targeting template will
-- be used to determine whether this asset should be served. This is a
-- required field.
rulTargetingTemplateId :: Lens' Rule (Maybe Int64)
rulTargetingTemplateId
= lens _rulTargetingTemplateId
(\ s a -> s{_rulTargetingTemplateId = a})
. mapping _Coerce
-- | A user-friendly name for this rule. This is a required field.
rulName :: Lens' Rule (Maybe Text)
rulName = lens _rulName (\ s a -> s{_rulName = a})
-- | A creativeAssets[].id. This should refer to one of the parent assets in
-- this creative. This is a required field.
rulAssetId :: Lens' Rule (Maybe Int64)
rulAssetId
= lens _rulAssetId (\ s a -> s{_rulAssetId = a}) .
mapping _Coerce
instance FromJSON Rule where
parseJSON
= withObject "Rule"
(\ o ->
Rule' <$>
(o .:? "targetingTemplateId") <*> (o .:? "name") <*>
(o .:? "assetId"))
instance ToJSON Rule where
toJSON Rule'{..}
= object
(catMaybes
[("targetingTemplateId" .=) <$>
_rulTargetingTemplateId,
("name" .=) <$> _rulName,
("assetId" .=) <$> _rulAssetId])
-- | Contains properties of a Campaign Manager campaign.
--
-- /See:/ 'campaign' smart constructor.
data Campaign =
Campaign'
{ _camMeasurementPartnerLink :: !(Maybe MeasurementPartnerCampaignLink)
, _camAdBlockingConfiguration :: !(Maybe AdBlockingConfiguration)
, _camCreativeOptimizationConfiguration :: !(Maybe CreativeOptimizationConfiguration)
, _camCreativeGroupIds :: !(Maybe [Textual Int64])
, _camNielsenOCREnabled :: !(Maybe Bool)
, _camKind :: !(Maybe Text)
, _camClickThroughURLSuffixProperties :: !(Maybe ClickThroughURLSuffixProperties)
, _camAdvertiserId :: !(Maybe (Textual Int64))
, _camEndDate :: !(Maybe Date')
, _camAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _camIdDimensionValue :: !(Maybe DimensionValue)
, _camEventTagOverrides :: !(Maybe [EventTagOverride])
, _camStartDate :: !(Maybe Date')
, _camAccountId :: !(Maybe (Textual Int64))
, _camName :: !(Maybe Text)
, _camAdvertiserGroupId :: !(Maybe (Textual Int64))
, _camBillingInvoiceCode :: !(Maybe Text)
, _camDefaultLandingPageId :: !(Maybe (Textual Int64))
, _camCreateInfo :: !(Maybe LastModifiedInfo)
, _camLastModifiedInfo :: !(Maybe LastModifiedInfo)
, _camId :: !(Maybe (Textual Int64))
, _camSubAccountId :: !(Maybe (Textual Int64))
, _camAdditionalCreativeOptimizationConfigurations :: !(Maybe [CreativeOptimizationConfiguration])
, _camExternalId :: !(Maybe Text)
, _camComment :: !(Maybe Text)
, _camAudienceSegmentGroups :: !(Maybe [AudienceSegmentGroup])
, _camArchived :: !(Maybe Bool)
, _camTraffickerEmails :: !(Maybe [Text])
, _camDefaultClickThroughEventTagProperties :: !(Maybe DefaultClickThroughEventTagProperties)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Campaign' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'camMeasurementPartnerLink'
--
-- * 'camAdBlockingConfiguration'
--
-- * 'camCreativeOptimizationConfiguration'
--
-- * 'camCreativeGroupIds'
--
-- * 'camNielsenOCREnabled'
--
-- * 'camKind'
--
-- * 'camClickThroughURLSuffixProperties'
--
-- * 'camAdvertiserId'
--
-- * 'camEndDate'
--
-- * 'camAdvertiserIdDimensionValue'
--
-- * 'camIdDimensionValue'
--
-- * 'camEventTagOverrides'
--
-- * 'camStartDate'
--
-- * 'camAccountId'
--
-- * 'camName'
--
-- * 'camAdvertiserGroupId'
--
-- * 'camBillingInvoiceCode'
--
-- * 'camDefaultLandingPageId'
--
-- * 'camCreateInfo'
--
-- * 'camLastModifiedInfo'
--
-- * 'camId'
--
-- * 'camSubAccountId'
--
-- * 'camAdditionalCreativeOptimizationConfigurations'
--
-- * 'camExternalId'
--
-- * 'camComment'
--
-- * 'camAudienceSegmentGroups'
--
-- * 'camArchived'
--
-- * 'camTraffickerEmails'
--
-- * 'camDefaultClickThroughEventTagProperties'
campaign
:: Campaign
campaign =
Campaign'
{ _camMeasurementPartnerLink = Nothing
, _camAdBlockingConfiguration = Nothing
, _camCreativeOptimizationConfiguration = Nothing
, _camCreativeGroupIds = Nothing
, _camNielsenOCREnabled = Nothing
, _camKind = Nothing
, _camClickThroughURLSuffixProperties = Nothing
, _camAdvertiserId = Nothing
, _camEndDate = Nothing
, _camAdvertiserIdDimensionValue = Nothing
, _camIdDimensionValue = Nothing
, _camEventTagOverrides = Nothing
, _camStartDate = Nothing
, _camAccountId = Nothing
, _camName = Nothing
, _camAdvertiserGroupId = Nothing
, _camBillingInvoiceCode = Nothing
, _camDefaultLandingPageId = Nothing
, _camCreateInfo = Nothing
, _camLastModifiedInfo = Nothing
, _camId = Nothing
, _camSubAccountId = Nothing
, _camAdditionalCreativeOptimizationConfigurations = Nothing
, _camExternalId = Nothing
, _camComment = Nothing
, _camAudienceSegmentGroups = Nothing
, _camArchived = Nothing
, _camTraffickerEmails = Nothing
, _camDefaultClickThroughEventTagProperties = Nothing
}
-- | Measurement partner campaign link for tag wrapping.
camMeasurementPartnerLink :: Lens' Campaign (Maybe MeasurementPartnerCampaignLink)
camMeasurementPartnerLink
= lens _camMeasurementPartnerLink
(\ s a -> s{_camMeasurementPartnerLink = a})
-- | Ad blocking settings for this campaign.
camAdBlockingConfiguration :: Lens' Campaign (Maybe AdBlockingConfiguration)
camAdBlockingConfiguration
= lens _camAdBlockingConfiguration
(\ s a -> s{_camAdBlockingConfiguration = a})
-- | Creative optimization configuration for the campaign.
camCreativeOptimizationConfiguration :: Lens' Campaign (Maybe CreativeOptimizationConfiguration)
camCreativeOptimizationConfiguration
= lens _camCreativeOptimizationConfiguration
(\ s a ->
s{_camCreativeOptimizationConfiguration = a})
-- | List of creative group IDs that are assigned to the campaign.
camCreativeGroupIds :: Lens' Campaign [Int64]
camCreativeGroupIds
= lens _camCreativeGroupIds
(\ s a -> s{_camCreativeGroupIds = a})
. _Default
. _Coerce
-- | Whether Nielsen reports are enabled for this campaign.
camNielsenOCREnabled :: Lens' Campaign (Maybe Bool)
camNielsenOCREnabled
= lens _camNielsenOCREnabled
(\ s a -> s{_camNielsenOCREnabled = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#campaign\".
camKind :: Lens' Campaign (Maybe Text)
camKind = lens _camKind (\ s a -> s{_camKind = a})
-- | Click-through URL suffix override properties for this campaign.
camClickThroughURLSuffixProperties :: Lens' Campaign (Maybe ClickThroughURLSuffixProperties)
camClickThroughURLSuffixProperties
= lens _camClickThroughURLSuffixProperties
(\ s a -> s{_camClickThroughURLSuffixProperties = a})
-- | Advertiser ID of this campaign. This is a required field.
camAdvertiserId :: Lens' Campaign (Maybe Int64)
camAdvertiserId
= lens _camAdvertiserId
(\ s a -> s{_camAdvertiserId = a})
. mapping _Coerce
camEndDate :: Lens' Campaign (Maybe Day)
camEndDate
= lens _camEndDate (\ s a -> s{_camEndDate = a}) .
mapping _Date
-- | Dimension value for the advertiser ID of this campaign. This is a
-- read-only, auto-generated field.
camAdvertiserIdDimensionValue :: Lens' Campaign (Maybe DimensionValue)
camAdvertiserIdDimensionValue
= lens _camAdvertiserIdDimensionValue
(\ s a -> s{_camAdvertiserIdDimensionValue = a})
-- | Dimension value for the ID of this campaign. This is a read-only,
-- auto-generated field.
camIdDimensionValue :: Lens' Campaign (Maybe DimensionValue)
camIdDimensionValue
= lens _camIdDimensionValue
(\ s a -> s{_camIdDimensionValue = a})
-- | Overrides that can be used to activate or deactivate advertiser event
-- tags.
camEventTagOverrides :: Lens' Campaign [EventTagOverride]
camEventTagOverrides
= lens _camEventTagOverrides
(\ s a -> s{_camEventTagOverrides = a})
. _Default
. _Coerce
camStartDate :: Lens' Campaign (Maybe Day)
camStartDate
= lens _camStartDate (\ s a -> s{_camStartDate = a})
. mapping _Date
-- | Account ID of this campaign. This is a read-only field that can be left
-- blank.
camAccountId :: Lens' Campaign (Maybe Int64)
camAccountId
= lens _camAccountId (\ s a -> s{_camAccountId = a})
. mapping _Coerce
-- | Name of this campaign. This is a required field and must be less than
-- 256 characters long and unique among campaigns of the same advertiser.
camName :: Lens' Campaign (Maybe Text)
camName = lens _camName (\ s a -> s{_camName = a})
-- | Advertiser group ID of the associated advertiser.
camAdvertiserGroupId :: Lens' Campaign (Maybe Int64)
camAdvertiserGroupId
= lens _camAdvertiserGroupId
(\ s a -> s{_camAdvertiserGroupId = a})
. mapping _Coerce
-- | Billing invoice code included in the Campaign Manager client billing
-- invoices associated with the campaign.
camBillingInvoiceCode :: Lens' Campaign (Maybe Text)
camBillingInvoiceCode
= lens _camBillingInvoiceCode
(\ s a -> s{_camBillingInvoiceCode = a})
-- | The default landing page ID for this campaign.
camDefaultLandingPageId :: Lens' Campaign (Maybe Int64)
camDefaultLandingPageId
= lens _camDefaultLandingPageId
(\ s a -> s{_camDefaultLandingPageId = a})
. mapping _Coerce
-- | Information about the creation of this campaign. This is a read-only
-- field.
camCreateInfo :: Lens' Campaign (Maybe LastModifiedInfo)
camCreateInfo
= lens _camCreateInfo
(\ s a -> s{_camCreateInfo = a})
-- | Information about the most recent modification of this campaign. This is
-- a read-only field.
camLastModifiedInfo :: Lens' Campaign (Maybe LastModifiedInfo)
camLastModifiedInfo
= lens _camLastModifiedInfo
(\ s a -> s{_camLastModifiedInfo = a})
-- | ID of this campaign. This is a read-only auto-generated field.
camId :: Lens' Campaign (Maybe Int64)
camId
= lens _camId (\ s a -> s{_camId = a}) .
mapping _Coerce
-- | Subaccount ID of this campaign. This is a read-only field that can be
-- left blank.
camSubAccountId :: Lens' Campaign (Maybe Int64)
camSubAccountId
= lens _camSubAccountId
(\ s a -> s{_camSubAccountId = a})
. mapping _Coerce
-- | Additional creative optimization configurations for the campaign.
camAdditionalCreativeOptimizationConfigurations :: Lens' Campaign [CreativeOptimizationConfiguration]
camAdditionalCreativeOptimizationConfigurations
= lens
_camAdditionalCreativeOptimizationConfigurations
(\ s a ->
s{_camAdditionalCreativeOptimizationConfigurations =
a})
. _Default
. _Coerce
-- | External ID for this campaign.
camExternalId :: Lens' Campaign (Maybe Text)
camExternalId
= lens _camExternalId
(\ s a -> s{_camExternalId = a})
-- | Arbitrary comments about this campaign. Must be less than 256 characters
-- long.
camComment :: Lens' Campaign (Maybe Text)
camComment
= lens _camComment (\ s a -> s{_camComment = a})
-- | Audience segment groups assigned to this campaign. Cannot have more than
-- 300 segment groups.
camAudienceSegmentGroups :: Lens' Campaign [AudienceSegmentGroup]
camAudienceSegmentGroups
= lens _camAudienceSegmentGroups
(\ s a -> s{_camAudienceSegmentGroups = a})
. _Default
. _Coerce
-- | Whether this campaign has been archived.
camArchived :: Lens' Campaign (Maybe Bool)
camArchived
= lens _camArchived (\ s a -> s{_camArchived = a})
-- | Campaign trafficker contact emails.
camTraffickerEmails :: Lens' Campaign [Text]
camTraffickerEmails
= lens _camTraffickerEmails
(\ s a -> s{_camTraffickerEmails = a})
. _Default
. _Coerce
-- | Click-through event tag ID override properties for this campaign.
camDefaultClickThroughEventTagProperties :: Lens' Campaign (Maybe DefaultClickThroughEventTagProperties)
camDefaultClickThroughEventTagProperties
= lens _camDefaultClickThroughEventTagProperties
(\ s a ->
s{_camDefaultClickThroughEventTagProperties = a})
instance FromJSON Campaign where
parseJSON
= withObject "Campaign"
(\ o ->
Campaign' <$>
(o .:? "measurementPartnerLink") <*>
(o .:? "adBlockingConfiguration")
<*> (o .:? "creativeOptimizationConfiguration")
<*> (o .:? "creativeGroupIds" .!= mempty)
<*> (o .:? "nielsenOcrEnabled")
<*> (o .:? "kind")
<*> (o .:? "clickThroughUrlSuffixProperties")
<*> (o .:? "advertiserId")
<*> (o .:? "endDate")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "idDimensionValue")
<*> (o .:? "eventTagOverrides" .!= mempty)
<*> (o .:? "startDate")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "advertiserGroupId")
<*> (o .:? "billingInvoiceCode")
<*> (o .:? "defaultLandingPageId")
<*> (o .:? "createInfo")
<*> (o .:? "lastModifiedInfo")
<*> (o .:? "id")
<*> (o .:? "subaccountId")
<*>
(o .:? "additionalCreativeOptimizationConfigurations"
.!= mempty)
<*> (o .:? "externalId")
<*> (o .:? "comment")
<*> (o .:? "audienceSegmentGroups" .!= mempty)
<*> (o .:? "archived")
<*> (o .:? "traffickerEmails" .!= mempty)
<*> (o .:? "defaultClickThroughEventTagProperties"))
instance ToJSON Campaign where
toJSON Campaign'{..}
= object
(catMaybes
[("measurementPartnerLink" .=) <$>
_camMeasurementPartnerLink,
("adBlockingConfiguration" .=) <$>
_camAdBlockingConfiguration,
("creativeOptimizationConfiguration" .=) <$>
_camCreativeOptimizationConfiguration,
("creativeGroupIds" .=) <$> _camCreativeGroupIds,
("nielsenOcrEnabled" .=) <$> _camNielsenOCREnabled,
("kind" .=) <$> _camKind,
("clickThroughUrlSuffixProperties" .=) <$>
_camClickThroughURLSuffixProperties,
("advertiserId" .=) <$> _camAdvertiserId,
("endDate" .=) <$> _camEndDate,
("advertiserIdDimensionValue" .=) <$>
_camAdvertiserIdDimensionValue,
("idDimensionValue" .=) <$> _camIdDimensionValue,
("eventTagOverrides" .=) <$> _camEventTagOverrides,
("startDate" .=) <$> _camStartDate,
("accountId" .=) <$> _camAccountId,
("name" .=) <$> _camName,
("advertiserGroupId" .=) <$> _camAdvertiserGroupId,
("billingInvoiceCode" .=) <$> _camBillingInvoiceCode,
("defaultLandingPageId" .=) <$>
_camDefaultLandingPageId,
("createInfo" .=) <$> _camCreateInfo,
("lastModifiedInfo" .=) <$> _camLastModifiedInfo,
("id" .=) <$> _camId,
("subaccountId" .=) <$> _camSubAccountId,
("additionalCreativeOptimizationConfigurations" .=)
<$> _camAdditionalCreativeOptimizationConfigurations,
("externalId" .=) <$> _camExternalId,
("comment" .=) <$> _camComment,
("audienceSegmentGroups" .=) <$>
_camAudienceSegmentGroups,
("archived" .=) <$> _camArchived,
("traffickerEmails" .=) <$> _camTraffickerEmails,
("defaultClickThroughEventTagProperties" .=) <$>
_camDefaultClickThroughEventTagProperties])
-- | Third Party Authentication Token
--
-- /See:/ 'thirdPartyAuthenticationToken' smart constructor.
data ThirdPartyAuthenticationToken =
ThirdPartyAuthenticationToken'
{ _tpatValue :: !(Maybe Text)
, _tpatName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ThirdPartyAuthenticationToken' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tpatValue'
--
-- * 'tpatName'
thirdPartyAuthenticationToken
:: ThirdPartyAuthenticationToken
thirdPartyAuthenticationToken =
ThirdPartyAuthenticationToken' {_tpatValue = Nothing, _tpatName = Nothing}
-- | Value of the third-party authentication token. This is a read-only,
-- auto-generated field.
tpatValue :: Lens' ThirdPartyAuthenticationToken (Maybe Text)
tpatValue
= lens _tpatValue (\ s a -> s{_tpatValue = a})
-- | Name of the third-party authentication token.
tpatName :: Lens' ThirdPartyAuthenticationToken (Maybe Text)
tpatName = lens _tpatName (\ s a -> s{_tpatName = a})
instance FromJSON ThirdPartyAuthenticationToken where
parseJSON
= withObject "ThirdPartyAuthenticationToken"
(\ o ->
ThirdPartyAuthenticationToken' <$>
(o .:? "value") <*> (o .:? "name"))
instance ToJSON ThirdPartyAuthenticationToken where
toJSON ThirdPartyAuthenticationToken'{..}
= object
(catMaybes
[("value" .=) <$> _tpatValue,
("name" .=) <$> _tpatName])
-- | Click-through URL
--
-- /See:/ 'clickThroughURL' smart constructor.
data ClickThroughURL =
ClickThroughURL'
{ _ctuDefaultLandingPage :: !(Maybe Bool)
, _ctuComputedClickThroughURL :: !(Maybe Text)
, _ctuCustomClickThroughURL :: !(Maybe Text)
, _ctuLandingPageId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ClickThroughURL' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ctuDefaultLandingPage'
--
-- * 'ctuComputedClickThroughURL'
--
-- * 'ctuCustomClickThroughURL'
--
-- * 'ctuLandingPageId'
clickThroughURL
:: ClickThroughURL
clickThroughURL =
ClickThroughURL'
{ _ctuDefaultLandingPage = Nothing
, _ctuComputedClickThroughURL = Nothing
, _ctuCustomClickThroughURL = Nothing
, _ctuLandingPageId = Nothing
}
-- | Whether the campaign default landing page is used.
ctuDefaultLandingPage :: Lens' ClickThroughURL (Maybe Bool)
ctuDefaultLandingPage
= lens _ctuDefaultLandingPage
(\ s a -> s{_ctuDefaultLandingPage = a})
-- | Read-only convenience field representing the actual URL that will be
-- used for this click-through. The URL is computed as follows: - If
-- defaultLandingPage is enabled then the campaign\'s default landing page
-- URL is assigned to this field. - If defaultLandingPage is not enabled
-- and a landingPageId is specified then that landing page\'s URL is
-- assigned to this field. - If neither of the above cases apply, then the
-- customClickThroughUrl is assigned to this field.
ctuComputedClickThroughURL :: Lens' ClickThroughURL (Maybe Text)
ctuComputedClickThroughURL
= lens _ctuComputedClickThroughURL
(\ s a -> s{_ctuComputedClickThroughURL = a})
-- | Custom click-through URL. Applicable if the defaultLandingPage field is
-- set to false and the landingPageId field is left unset.
ctuCustomClickThroughURL :: Lens' ClickThroughURL (Maybe Text)
ctuCustomClickThroughURL
= lens _ctuCustomClickThroughURL
(\ s a -> s{_ctuCustomClickThroughURL = a})
-- | ID of the landing page for the click-through URL. Applicable if the
-- defaultLandingPage field is set to false.
ctuLandingPageId :: Lens' ClickThroughURL (Maybe Int64)
ctuLandingPageId
= lens _ctuLandingPageId
(\ s a -> s{_ctuLandingPageId = a})
. mapping _Coerce
instance FromJSON ClickThroughURL where
parseJSON
= withObject "ClickThroughURL"
(\ o ->
ClickThroughURL' <$>
(o .:? "defaultLandingPage") <*>
(o .:? "computedClickThroughUrl")
<*> (o .:? "customClickThroughUrl")
<*> (o .:? "landingPageId"))
instance ToJSON ClickThroughURL where
toJSON ClickThroughURL'{..}
= object
(catMaybes
[("defaultLandingPage" .=) <$>
_ctuDefaultLandingPage,
("computedClickThroughUrl" .=) <$>
_ctuComputedClickThroughURL,
("customClickThroughUrl" .=) <$>
_ctuCustomClickThroughURL,
("landingPageId" .=) <$> _ctuLandingPageId])
-- | Browser List Response
--
-- /See:/ 'browsersListResponse' smart constructor.
data BrowsersListResponse =
BrowsersListResponse'
{ _blrKind :: !(Maybe Text)
, _blrBrowsers :: !(Maybe [Browser])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'BrowsersListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'blrKind'
--
-- * 'blrBrowsers'
browsersListResponse
:: BrowsersListResponse
browsersListResponse =
BrowsersListResponse' {_blrKind = Nothing, _blrBrowsers = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#browsersListResponse\".
blrKind :: Lens' BrowsersListResponse (Maybe Text)
blrKind = lens _blrKind (\ s a -> s{_blrKind = a})
-- | Browser collection.
blrBrowsers :: Lens' BrowsersListResponse [Browser]
blrBrowsers
= lens _blrBrowsers (\ s a -> s{_blrBrowsers = a}) .
_Default
. _Coerce
instance FromJSON BrowsersListResponse where
parseJSON
= withObject "BrowsersListResponse"
(\ o ->
BrowsersListResponse' <$>
(o .:? "kind") <*> (o .:? "browsers" .!= mempty))
instance ToJSON BrowsersListResponse where
toJSON BrowsersListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _blrKind,
("browsers" .=) <$> _blrBrowsers])
-- | Site Settings
--
-- /See:/ 'siteSettings' smart constructor.
data SiteSettings =
SiteSettings'
{ _ssDisableNewCookie :: !(Maybe Bool)
, _ssVideoActiveViewOptOutTemplate :: !(Maybe Bool)
, _ssAdBlockingOptOut :: !(Maybe Bool)
, _ssTagSetting :: !(Maybe TagSetting)
, _ssActiveViewOptOut :: !(Maybe Bool)
, _ssVpaidAdapterChoiceTemplate :: !(Maybe SiteSettingsVpaidAdapterChoiceTemplate)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SiteSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ssDisableNewCookie'
--
-- * 'ssVideoActiveViewOptOutTemplate'
--
-- * 'ssAdBlockingOptOut'
--
-- * 'ssTagSetting'
--
-- * 'ssActiveViewOptOut'
--
-- * 'ssVpaidAdapterChoiceTemplate'
siteSettings
:: SiteSettings
siteSettings =
SiteSettings'
{ _ssDisableNewCookie = Nothing
, _ssVideoActiveViewOptOutTemplate = Nothing
, _ssAdBlockingOptOut = Nothing
, _ssTagSetting = Nothing
, _ssActiveViewOptOut = Nothing
, _ssVpaidAdapterChoiceTemplate = Nothing
}
-- | Whether new cookies are disabled for this site.
ssDisableNewCookie :: Lens' SiteSettings (Maybe Bool)
ssDisableNewCookie
= lens _ssDisableNewCookie
(\ s a -> s{_ssDisableNewCookie = a})
-- | Whether Verification and ActiveView for in-stream video creatives are
-- disabled by default for new placements created under this site. This
-- value will be used to populate the placement.videoActiveViewOptOut
-- field, when no value is specified for the new placement.
ssVideoActiveViewOptOutTemplate :: Lens' SiteSettings (Maybe Bool)
ssVideoActiveViewOptOutTemplate
= lens _ssVideoActiveViewOptOutTemplate
(\ s a -> s{_ssVideoActiveViewOptOutTemplate = a})
-- | Whether this site opts out of ad blocking. When true, ad blocking is
-- disabled for all placements under the site, regardless of the individual
-- placement settings. When false, the campaign and placement settings take
-- effect.
ssAdBlockingOptOut :: Lens' SiteSettings (Maybe Bool)
ssAdBlockingOptOut
= lens _ssAdBlockingOptOut
(\ s a -> s{_ssAdBlockingOptOut = a})
-- | Configuration settings for dynamic and image floodlight tags.
ssTagSetting :: Lens' SiteSettings (Maybe TagSetting)
ssTagSetting
= lens _ssTagSetting (\ s a -> s{_ssTagSetting = a})
-- | Whether active view creatives are disabled for this site.
ssActiveViewOptOut :: Lens' SiteSettings (Maybe Bool)
ssActiveViewOptOut
= lens _ssActiveViewOptOut
(\ s a -> s{_ssActiveViewOptOut = a})
-- | Default VPAID adapter setting for new placements created under this
-- site. This value will be used to populate the
-- placements.vpaidAdapterChoice field, when no value is specified for the
-- new placement. Controls which VPAID format the measurement adapter will
-- use for in-stream video creatives assigned to the placement. The
-- publisher\'s specifications will typically determine this setting. For
-- VPAID creatives, the adapter format will match the VPAID format (HTML5
-- VPAID creatives use the HTML5 adapter). *Note:* Flash is no longer
-- supported. This field now defaults to HTML5 when the following values
-- are provided: FLASH, BOTH.
ssVpaidAdapterChoiceTemplate :: Lens' SiteSettings (Maybe SiteSettingsVpaidAdapterChoiceTemplate)
ssVpaidAdapterChoiceTemplate
= lens _ssVpaidAdapterChoiceTemplate
(\ s a -> s{_ssVpaidAdapterChoiceTemplate = a})
instance FromJSON SiteSettings where
parseJSON
= withObject "SiteSettings"
(\ o ->
SiteSettings' <$>
(o .:? "disableNewCookie") <*>
(o .:? "videoActiveViewOptOutTemplate")
<*> (o .:? "adBlockingOptOut")
<*> (o .:? "tagSetting")
<*> (o .:? "activeViewOptOut")
<*> (o .:? "vpaidAdapterChoiceTemplate"))
instance ToJSON SiteSettings where
toJSON SiteSettings'{..}
= object
(catMaybes
[("disableNewCookie" .=) <$> _ssDisableNewCookie,
("videoActiveViewOptOutTemplate" .=) <$>
_ssVideoActiveViewOptOutTemplate,
("adBlockingOptOut" .=) <$> _ssAdBlockingOptOut,
("tagSetting" .=) <$> _ssTagSetting,
("activeViewOptOut" .=) <$> _ssActiveViewOptOut,
("vpaidAdapterChoiceTemplate" .=) <$>
_ssVpaidAdapterChoiceTemplate])
-- | Content Category List Response
--
-- /See:/ 'contentCategoriesListResponse' smart constructor.
data ContentCategoriesListResponse =
ContentCategoriesListResponse'
{ _cclrNextPageToken :: !(Maybe Text)
, _cclrKind :: !(Maybe Text)
, _cclrContentCategories :: !(Maybe [ContentCategory])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ContentCategoriesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cclrNextPageToken'
--
-- * 'cclrKind'
--
-- * 'cclrContentCategories'
contentCategoriesListResponse
:: ContentCategoriesListResponse
contentCategoriesListResponse =
ContentCategoriesListResponse'
{ _cclrNextPageToken = Nothing
, _cclrKind = Nothing
, _cclrContentCategories = Nothing
}
-- | Pagination token to be used for the next list operation.
cclrNextPageToken :: Lens' ContentCategoriesListResponse (Maybe Text)
cclrNextPageToken
= lens _cclrNextPageToken
(\ s a -> s{_cclrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#contentCategoriesListResponse\".
cclrKind :: Lens' ContentCategoriesListResponse (Maybe Text)
cclrKind = lens _cclrKind (\ s a -> s{_cclrKind = a})
-- | Content category collection.
cclrContentCategories :: Lens' ContentCategoriesListResponse [ContentCategory]
cclrContentCategories
= lens _cclrContentCategories
(\ s a -> s{_cclrContentCategories = a})
. _Default
. _Coerce
instance FromJSON ContentCategoriesListResponse where
parseJSON
= withObject "ContentCategoriesListResponse"
(\ o ->
ContentCategoriesListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "contentCategories" .!= mempty))
instance ToJSON ContentCategoriesListResponse where
toJSON ContentCategoriesListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _cclrNextPageToken,
("kind" .=) <$> _cclrKind,
("contentCategories" .=) <$> _cclrContentCategories])
-- | The report criteria for a report of type \"PATH_ATTRIBUTION\".
--
-- /See:/ 'reportPathAttributionCriteria' smart constructor.
data ReportPathAttributionCriteria =
ReportPathAttributionCriteria'
{ _rpacCustomChannelGrouping :: !(Maybe ChannelGrouping)
, _rpacMetricNames :: !(Maybe [Text])
, _rpacDateRange :: !(Maybe DateRange)
, _rpacPathFilters :: !(Maybe [PathFilter])
, _rpacFloodlightConfigId :: !(Maybe DimensionValue)
, _rpacDimensions :: !(Maybe [SortedDimension])
, _rpacActivityFilters :: !(Maybe [DimensionValue])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportPathAttributionCriteria' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rpacCustomChannelGrouping'
--
-- * 'rpacMetricNames'
--
-- * 'rpacDateRange'
--
-- * 'rpacPathFilters'
--
-- * 'rpacFloodlightConfigId'
--
-- * 'rpacDimensions'
--
-- * 'rpacActivityFilters'
reportPathAttributionCriteria
:: ReportPathAttributionCriteria
reportPathAttributionCriteria =
ReportPathAttributionCriteria'
{ _rpacCustomChannelGrouping = Nothing
, _rpacMetricNames = Nothing
, _rpacDateRange = Nothing
, _rpacPathFilters = Nothing
, _rpacFloodlightConfigId = Nothing
, _rpacDimensions = Nothing
, _rpacActivityFilters = Nothing
}
-- | Channel Grouping.
rpacCustomChannelGrouping :: Lens' ReportPathAttributionCriteria (Maybe ChannelGrouping)
rpacCustomChannelGrouping
= lens _rpacCustomChannelGrouping
(\ s a -> s{_rpacCustomChannelGrouping = a})
-- | The list of names of metrics the report should include.
rpacMetricNames :: Lens' ReportPathAttributionCriteria [Text]
rpacMetricNames
= lens _rpacMetricNames
(\ s a -> s{_rpacMetricNames = a})
. _Default
. _Coerce
-- | The date range this report should be run for.
rpacDateRange :: Lens' ReportPathAttributionCriteria (Maybe DateRange)
rpacDateRange
= lens _rpacDateRange
(\ s a -> s{_rpacDateRange = a})
-- | Path Filters.
rpacPathFilters :: Lens' ReportPathAttributionCriteria [PathFilter]
rpacPathFilters
= lens _rpacPathFilters
(\ s a -> s{_rpacPathFilters = a})
. _Default
. _Coerce
-- | The floodlight ID for which to show data in this report. All advertisers
-- associated with that ID will automatically be added. The dimension of
-- the value needs to be \'dfa:floodlightConfigId\'.
rpacFloodlightConfigId :: Lens' ReportPathAttributionCriteria (Maybe DimensionValue)
rpacFloodlightConfigId
= lens _rpacFloodlightConfigId
(\ s a -> s{_rpacFloodlightConfigId = a})
-- | The list of dimensions the report should include.
rpacDimensions :: Lens' ReportPathAttributionCriteria [SortedDimension]
rpacDimensions
= lens _rpacDimensions
(\ s a -> s{_rpacDimensions = a})
. _Default
. _Coerce
-- | The list of \'dfa:activity\' values to filter on.
rpacActivityFilters :: Lens' ReportPathAttributionCriteria [DimensionValue]
rpacActivityFilters
= lens _rpacActivityFilters
(\ s a -> s{_rpacActivityFilters = a})
. _Default
. _Coerce
instance FromJSON ReportPathAttributionCriteria where
parseJSON
= withObject "ReportPathAttributionCriteria"
(\ o ->
ReportPathAttributionCriteria' <$>
(o .:? "customChannelGrouping") <*>
(o .:? "metricNames" .!= mempty)
<*> (o .:? "dateRange")
<*> (o .:? "pathFilters" .!= mempty)
<*> (o .:? "floodlightConfigId")
<*> (o .:? "dimensions" .!= mempty)
<*> (o .:? "activityFilters" .!= mempty))
instance ToJSON ReportPathAttributionCriteria where
toJSON ReportPathAttributionCriteria'{..}
= object
(catMaybes
[("customChannelGrouping" .=) <$>
_rpacCustomChannelGrouping,
("metricNames" .=) <$> _rpacMetricNames,
("dateRange" .=) <$> _rpacDateRange,
("pathFilters" .=) <$> _rpacPathFilters,
("floodlightConfigId" .=) <$>
_rpacFloodlightConfigId,
("dimensions" .=) <$> _rpacDimensions,
("activityFilters" .=) <$> _rpacActivityFilters])
-- | Creative List Response
--
-- /See:/ 'creativesListResponse' smart constructor.
data CreativesListResponse =
CreativesListResponse'
{ _clrlNextPageToken :: !(Maybe Text)
, _clrlKind :: !(Maybe Text)
, _clrlCreatives :: !(Maybe [Creative])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'clrlNextPageToken'
--
-- * 'clrlKind'
--
-- * 'clrlCreatives'
creativesListResponse
:: CreativesListResponse
creativesListResponse =
CreativesListResponse'
{ _clrlNextPageToken = Nothing
, _clrlKind = Nothing
, _clrlCreatives = Nothing
}
-- | Pagination token to be used for the next list operation.
clrlNextPageToken :: Lens' CreativesListResponse (Maybe Text)
clrlNextPageToken
= lens _clrlNextPageToken
(\ s a -> s{_clrlNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#creativesListResponse\".
clrlKind :: Lens' CreativesListResponse (Maybe Text)
clrlKind = lens _clrlKind (\ s a -> s{_clrlKind = a})
-- | Creative collection.
clrlCreatives :: Lens' CreativesListResponse [Creative]
clrlCreatives
= lens _clrlCreatives
(\ s a -> s{_clrlCreatives = a})
. _Default
. _Coerce
instance FromJSON CreativesListResponse where
parseJSON
= withObject "CreativesListResponse"
(\ o ->
CreativesListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "creatives" .!= mempty))
instance ToJSON CreativesListResponse where
toJSON CreativesListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _clrlNextPageToken,
("kind" .=) <$> _clrlKind,
("creatives" .=) <$> _clrlCreatives])
-- | Contains properties of a Campaign Manager account.
--
-- /See:/ 'account' smart constructor.
data Account =
Account'
{ _aaAccountPermissionIds :: !(Maybe [Textual Int64])
, _aaMaximumImageSize :: !(Maybe (Textual Int64))
, _aaCurrencyId :: !(Maybe (Textual Int64))
, _aaReportsConfiguration :: !(Maybe ReportsConfiguration)
, _aaNielsenOCREnabled :: !(Maybe Bool)
, _aaKind :: !(Maybe Text)
, _aaLocale :: !(Maybe Text)
, _aaActive :: !(Maybe Bool)
, _aaAvailablePermissionIds :: !(Maybe [Textual Int64])
, _aaTeaserSizeLimit :: !(Maybe (Textual Int64))
, _aaActiveViewOptOut :: !(Maybe Bool)
, _aaShareReportsWithTwitter :: !(Maybe Bool)
, _aaName :: !(Maybe Text)
, _aaAccountProFile :: !(Maybe AccountAccountProFile)
, _aaId :: !(Maybe (Textual Int64))
, _aaCountryId :: !(Maybe (Textual Int64))
, _aaActiveAdsLimitTier :: !(Maybe AccountActiveAdsLimitTier)
, _aaDefaultCreativeSizeId :: !(Maybe (Textual Int64))
, _aaDescription :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Account' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aaAccountPermissionIds'
--
-- * 'aaMaximumImageSize'
--
-- * 'aaCurrencyId'
--
-- * 'aaReportsConfiguration'
--
-- * 'aaNielsenOCREnabled'
--
-- * 'aaKind'
--
-- * 'aaLocale'
--
-- * 'aaActive'
--
-- * 'aaAvailablePermissionIds'
--
-- * 'aaTeaserSizeLimit'
--
-- * 'aaActiveViewOptOut'
--
-- * 'aaShareReportsWithTwitter'
--
-- * 'aaName'
--
-- * 'aaAccountProFile'
--
-- * 'aaId'
--
-- * 'aaCountryId'
--
-- * 'aaActiveAdsLimitTier'
--
-- * 'aaDefaultCreativeSizeId'
--
-- * 'aaDescription'
account
:: Account
account =
Account'
{ _aaAccountPermissionIds = Nothing
, _aaMaximumImageSize = Nothing
, _aaCurrencyId = Nothing
, _aaReportsConfiguration = Nothing
, _aaNielsenOCREnabled = Nothing
, _aaKind = Nothing
, _aaLocale = Nothing
, _aaActive = Nothing
, _aaAvailablePermissionIds = Nothing
, _aaTeaserSizeLimit = Nothing
, _aaActiveViewOptOut = Nothing
, _aaShareReportsWithTwitter = Nothing
, _aaName = Nothing
, _aaAccountProFile = Nothing
, _aaId = Nothing
, _aaCountryId = Nothing
, _aaActiveAdsLimitTier = Nothing
, _aaDefaultCreativeSizeId = Nothing
, _aaDescription = Nothing
}
-- | Account permissions assigned to this account.
aaAccountPermissionIds :: Lens' Account [Int64]
aaAccountPermissionIds
= lens _aaAccountPermissionIds
(\ s a -> s{_aaAccountPermissionIds = a})
. _Default
. _Coerce
-- | Maximum image size allowed for this account, in kilobytes. Value must be
-- greater than or equal to 1.
aaMaximumImageSize :: Lens' Account (Maybe Int64)
aaMaximumImageSize
= lens _aaMaximumImageSize
(\ s a -> s{_aaMaximumImageSize = a})
. mapping _Coerce
-- | ID of currency associated with this account. This is a required field.
-- Acceptable values are: - \"1\" for USD - \"2\" for GBP - \"3\" for ESP -
-- \"4\" for SEK - \"5\" for CAD - \"6\" for JPY - \"7\" for DEM - \"8\"
-- for AUD - \"9\" for FRF - \"10\" for ITL - \"11\" for DKK - \"12\" for
-- NOK - \"13\" for FIM - \"14\" for ZAR - \"15\" for IEP - \"16\" for NLG
-- - \"17\" for EUR - \"18\" for KRW - \"19\" for TWD - \"20\" for SGD -
-- \"21\" for CNY - \"22\" for HKD - \"23\" for NZD - \"24\" for MYR -
-- \"25\" for BRL - \"26\" for PTE - \"28\" for CLP - \"29\" for TRY -
-- \"30\" for ARS - \"31\" for PEN - \"32\" for ILS - \"33\" for CHF -
-- \"34\" for VEF - \"35\" for COP - \"36\" for GTQ - \"37\" for PLN -
-- \"39\" for INR - \"40\" for THB - \"41\" for IDR - \"42\" for CZK -
-- \"43\" for RON - \"44\" for HUF - \"45\" for RUB - \"46\" for AED -
-- \"47\" for BGN - \"48\" for HRK - \"49\" for MXN - \"50\" for NGN -
-- \"51\" for EGP
aaCurrencyId :: Lens' Account (Maybe Int64)
aaCurrencyId
= lens _aaCurrencyId (\ s a -> s{_aaCurrencyId = a})
. mapping _Coerce
-- | Reporting configuration of this account.
aaReportsConfiguration :: Lens' Account (Maybe ReportsConfiguration)
aaReportsConfiguration
= lens _aaReportsConfiguration
(\ s a -> s{_aaReportsConfiguration = a})
-- | Whether campaigns created in this account will be enabled for Nielsen
-- OCR reach ratings by default.
aaNielsenOCREnabled :: Lens' Account (Maybe Bool)
aaNielsenOCREnabled
= lens _aaNielsenOCREnabled
(\ s a -> s{_aaNielsenOCREnabled = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#account\".
aaKind :: Lens' Account (Maybe Text)
aaKind = lens _aaKind (\ s a -> s{_aaKind = a})
-- | Locale of this account. Acceptable values are: - \"cs\" (Czech) - \"de\"
-- (German) - \"en\" (English) - \"en-GB\" (English United Kingdom) -
-- \"es\" (Spanish) - \"fr\" (French) - \"it\" (Italian) - \"ja\"
-- (Japanese) - \"ko\" (Korean) - \"pl\" (Polish) - \"pt-BR\" (Portuguese
-- Brazil) - \"ru\" (Russian) - \"sv\" (Swedish) - \"tr\" (Turkish) -
-- \"zh-CN\" (Chinese Simplified) - \"zh-TW\" (Chinese Traditional)
aaLocale :: Lens' Account (Maybe Text)
aaLocale = lens _aaLocale (\ s a -> s{_aaLocale = a})
-- | Whether this account is active.
aaActive :: Lens' Account (Maybe Bool)
aaActive = lens _aaActive (\ s a -> s{_aaActive = a})
-- | User role permissions available to the user roles of this account.
aaAvailablePermissionIds :: Lens' Account [Int64]
aaAvailablePermissionIds
= lens _aaAvailablePermissionIds
(\ s a -> s{_aaAvailablePermissionIds = a})
. _Default
. _Coerce
-- | File size limit in kilobytes of Rich Media teaser creatives. Acceptable
-- values are 1 to 10240, inclusive.
aaTeaserSizeLimit :: Lens' Account (Maybe Int64)
aaTeaserSizeLimit
= lens _aaTeaserSizeLimit
(\ s a -> s{_aaTeaserSizeLimit = a})
. mapping _Coerce
-- | Whether to serve creatives with Active View tags. If disabled,
-- viewability data will not be available for any impressions.
aaActiveViewOptOut :: Lens' Account (Maybe Bool)
aaActiveViewOptOut
= lens _aaActiveViewOptOut
(\ s a -> s{_aaActiveViewOptOut = a})
-- | Share Path to Conversion reports with Twitter.
aaShareReportsWithTwitter :: Lens' Account (Maybe Bool)
aaShareReportsWithTwitter
= lens _aaShareReportsWithTwitter
(\ s a -> s{_aaShareReportsWithTwitter = a})
-- | Name of this account. This is a required field, and must be less than
-- 128 characters long and be globally unique.
aaName :: Lens' Account (Maybe Text)
aaName = lens _aaName (\ s a -> s{_aaName = a})
-- | Profile for this account. This is a read-only field that can be left
-- blank.
aaAccountProFile :: Lens' Account (Maybe AccountAccountProFile)
aaAccountProFile
= lens _aaAccountProFile
(\ s a -> s{_aaAccountProFile = a})
-- | ID of this account. This is a read-only, auto-generated field.
aaId :: Lens' Account (Maybe Int64)
aaId
= lens _aaId (\ s a -> s{_aaId = a}) .
mapping _Coerce
-- | ID of the country associated with this account.
aaCountryId :: Lens' Account (Maybe Int64)
aaCountryId
= lens _aaCountryId (\ s a -> s{_aaCountryId = a}) .
mapping _Coerce
-- | Maximum number of active ads allowed for this account.
aaActiveAdsLimitTier :: Lens' Account (Maybe AccountActiveAdsLimitTier)
aaActiveAdsLimitTier
= lens _aaActiveAdsLimitTier
(\ s a -> s{_aaActiveAdsLimitTier = a})
-- | Default placement dimensions for this account.
aaDefaultCreativeSizeId :: Lens' Account (Maybe Int64)
aaDefaultCreativeSizeId
= lens _aaDefaultCreativeSizeId
(\ s a -> s{_aaDefaultCreativeSizeId = a})
. mapping _Coerce
-- | Description of this account.
aaDescription :: Lens' Account (Maybe Text)
aaDescription
= lens _aaDescription
(\ s a -> s{_aaDescription = a})
instance FromJSON Account where
parseJSON
= withObject "Account"
(\ o ->
Account' <$>
(o .:? "accountPermissionIds" .!= mempty) <*>
(o .:? "maximumImageSize")
<*> (o .:? "currencyId")
<*> (o .:? "reportsConfiguration")
<*> (o .:? "nielsenOcrEnabled")
<*> (o .:? "kind")
<*> (o .:? "locale")
<*> (o .:? "active")
<*> (o .:? "availablePermissionIds" .!= mempty)
<*> (o .:? "teaserSizeLimit")
<*> (o .:? "activeViewOptOut")
<*> (o .:? "shareReportsWithTwitter")
<*> (o .:? "name")
<*> (o .:? "accountProfile")
<*> (o .:? "id")
<*> (o .:? "countryId")
<*> (o .:? "activeAdsLimitTier")
<*> (o .:? "defaultCreativeSizeId")
<*> (o .:? "description"))
instance ToJSON Account where
toJSON Account'{..}
= object
(catMaybes
[("accountPermissionIds" .=) <$>
_aaAccountPermissionIds,
("maximumImageSize" .=) <$> _aaMaximumImageSize,
("currencyId" .=) <$> _aaCurrencyId,
("reportsConfiguration" .=) <$>
_aaReportsConfiguration,
("nielsenOcrEnabled" .=) <$> _aaNielsenOCREnabled,
("kind" .=) <$> _aaKind, ("locale" .=) <$> _aaLocale,
("active" .=) <$> _aaActive,
("availablePermissionIds" .=) <$>
_aaAvailablePermissionIds,
("teaserSizeLimit" .=) <$> _aaTeaserSizeLimit,
("activeViewOptOut" .=) <$> _aaActiveViewOptOut,
("shareReportsWithTwitter" .=) <$>
_aaShareReportsWithTwitter,
("name" .=) <$> _aaName,
("accountProfile" .=) <$> _aaAccountProFile,
("id" .=) <$> _aaId,
("countryId" .=) <$> _aaCountryId,
("activeAdsLimitTier" .=) <$> _aaActiveAdsLimitTier,
("defaultCreativeSizeId" .=) <$>
_aaDefaultCreativeSizeId,
("description" .=) <$> _aaDescription])
-- | Insert Conversions Request.
--
-- /See:/ 'conversionsBatchInsertRequest' smart constructor.
data ConversionsBatchInsertRequest =
ConversionsBatchInsertRequest'
{ _cbirKind :: !(Maybe Text)
, _cbirConversions :: !(Maybe [Conversion])
, _cbirEncryptionInfo :: !(Maybe EncryptionInfo)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ConversionsBatchInsertRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cbirKind'
--
-- * 'cbirConversions'
--
-- * 'cbirEncryptionInfo'
conversionsBatchInsertRequest
:: ConversionsBatchInsertRequest
conversionsBatchInsertRequest =
ConversionsBatchInsertRequest'
{ _cbirKind = Nothing
, _cbirConversions = Nothing
, _cbirEncryptionInfo = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#conversionsBatchInsertRequest\".
cbirKind :: Lens' ConversionsBatchInsertRequest (Maybe Text)
cbirKind = lens _cbirKind (\ s a -> s{_cbirKind = a})
-- | The set of conversions to insert.
cbirConversions :: Lens' ConversionsBatchInsertRequest [Conversion]
cbirConversions
= lens _cbirConversions
(\ s a -> s{_cbirConversions = a})
. _Default
. _Coerce
-- | Describes how encryptedUserId or encryptedUserIdCandidates[] is
-- encrypted. This is a required field if encryptedUserId or
-- encryptedUserIdCandidates[] is used.
cbirEncryptionInfo :: Lens' ConversionsBatchInsertRequest (Maybe EncryptionInfo)
cbirEncryptionInfo
= lens _cbirEncryptionInfo
(\ s a -> s{_cbirEncryptionInfo = a})
instance FromJSON ConversionsBatchInsertRequest where
parseJSON
= withObject "ConversionsBatchInsertRequest"
(\ o ->
ConversionsBatchInsertRequest' <$>
(o .:? "kind") <*> (o .:? "conversions" .!= mempty)
<*> (o .:? "encryptionInfo"))
instance ToJSON ConversionsBatchInsertRequest where
toJSON ConversionsBatchInsertRequest'{..}
= object
(catMaybes
[("kind" .=) <$> _cbirKind,
("conversions" .=) <$> _cbirConversions,
("encryptionInfo" .=) <$> _cbirEncryptionInfo])
-- | Account User Profile List Response
--
-- /See:/ 'accountUserProFilesListResponse' smart constructor.
data AccountUserProFilesListResponse =
AccountUserProFilesListResponse'
{ _aupflrNextPageToken :: !(Maybe Text)
, _aupflrAccountUserProFiles :: !(Maybe [AccountUserProFile])
, _aupflrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AccountUserProFilesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aupflrNextPageToken'
--
-- * 'aupflrAccountUserProFiles'
--
-- * 'aupflrKind'
accountUserProFilesListResponse
:: AccountUserProFilesListResponse
accountUserProFilesListResponse =
AccountUserProFilesListResponse'
{ _aupflrNextPageToken = Nothing
, _aupflrAccountUserProFiles = Nothing
, _aupflrKind = Nothing
}
-- | Pagination token to be used for the next list operation.
aupflrNextPageToken :: Lens' AccountUserProFilesListResponse (Maybe Text)
aupflrNextPageToken
= lens _aupflrNextPageToken
(\ s a -> s{_aupflrNextPageToken = a})
-- | Account user profile collection.
aupflrAccountUserProFiles :: Lens' AccountUserProFilesListResponse [AccountUserProFile]
aupflrAccountUserProFiles
= lens _aupflrAccountUserProFiles
(\ s a -> s{_aupflrAccountUserProFiles = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#accountUserProfilesListResponse\".
aupflrKind :: Lens' AccountUserProFilesListResponse (Maybe Text)
aupflrKind
= lens _aupflrKind (\ s a -> s{_aupflrKind = a})
instance FromJSON AccountUserProFilesListResponse
where
parseJSON
= withObject "AccountUserProFilesListResponse"
(\ o ->
AccountUserProFilesListResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "accountUserProfiles" .!= mempty)
<*> (o .:? "kind"))
instance ToJSON AccountUserProFilesListResponse where
toJSON AccountUserProFilesListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _aupflrNextPageToken,
("accountUserProfiles" .=) <$>
_aupflrAccountUserProFiles,
("kind" .=) <$> _aupflrKind])
-- | Organizes placements according to the contents of their associated
-- webpages.
--
-- /See:/ 'contentCategory' smart constructor.
data ContentCategory =
ContentCategory'
{ _conKind :: !(Maybe Text)
, _conAccountId :: !(Maybe (Textual Int64))
, _conName :: !(Maybe Text)
, _conId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ContentCategory' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'conKind'
--
-- * 'conAccountId'
--
-- * 'conName'
--
-- * 'conId'
contentCategory
:: ContentCategory
contentCategory =
ContentCategory'
{ _conKind = Nothing
, _conAccountId = Nothing
, _conName = Nothing
, _conId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#contentCategory\".
conKind :: Lens' ContentCategory (Maybe Text)
conKind = lens _conKind (\ s a -> s{_conKind = a})
-- | Account ID of this content category. This is a read-only field that can
-- be left blank.
conAccountId :: Lens' ContentCategory (Maybe Int64)
conAccountId
= lens _conAccountId (\ s a -> s{_conAccountId = a})
. mapping _Coerce
-- | Name of this content category. This is a required field and must be less
-- than 256 characters long and unique among content categories of the same
-- account.
conName :: Lens' ContentCategory (Maybe Text)
conName = lens _conName (\ s a -> s{_conName = a})
-- | ID of this content category. This is a read-only, auto-generated field.
conId :: Lens' ContentCategory (Maybe Int64)
conId
= lens _conId (\ s a -> s{_conId = a}) .
mapping _Coerce
instance FromJSON ContentCategory where
parseJSON
= withObject "ContentCategory"
(\ o ->
ContentCategory' <$>
(o .:? "kind") <*> (o .:? "accountId") <*>
(o .:? "name")
<*> (o .:? "id"))
instance ToJSON ContentCategory where
toJSON ContentCategory'{..}
= object
(catMaybes
[("kind" .=) <$> _conKind,
("accountId" .=) <$> _conAccountId,
("name" .=) <$> _conName, ("id" .=) <$> _conId])
-- | Represents fields that are compatible to be selected for a report of
-- type \"STANDARD\".
--
-- /See:/ 'reportCompatibleFields' smart constructor.
data ReportCompatibleFields =
ReportCompatibleFields'
{ _rcfMetrics :: !(Maybe [Metric])
, _rcfKind :: !(Maybe Text)
, _rcfDimensionFilters :: !(Maybe [Dimension])
, _rcfPivotedActivityMetrics :: !(Maybe [Metric])
, _rcfDimensions :: !(Maybe [Dimension])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportCompatibleFields' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rcfMetrics'
--
-- * 'rcfKind'
--
-- * 'rcfDimensionFilters'
--
-- * 'rcfPivotedActivityMetrics'
--
-- * 'rcfDimensions'
reportCompatibleFields
:: ReportCompatibleFields
reportCompatibleFields =
ReportCompatibleFields'
{ _rcfMetrics = Nothing
, _rcfKind = Nothing
, _rcfDimensionFilters = Nothing
, _rcfPivotedActivityMetrics = Nothing
, _rcfDimensions = Nothing
}
-- | Metrics which are compatible to be selected in the \"metricNames\"
-- section of the report.
rcfMetrics :: Lens' ReportCompatibleFields [Metric]
rcfMetrics
= lens _rcfMetrics (\ s a -> s{_rcfMetrics = a}) .
_Default
. _Coerce
-- | The kind of resource this is, in this case
-- dfareporting#reportCompatibleFields.
rcfKind :: Lens' ReportCompatibleFields (Maybe Text)
rcfKind = lens _rcfKind (\ s a -> s{_rcfKind = a})
-- | Dimensions which are compatible to be selected in the
-- \"dimensionFilters\" section of the report.
rcfDimensionFilters :: Lens' ReportCompatibleFields [Dimension]
rcfDimensionFilters
= lens _rcfDimensionFilters
(\ s a -> s{_rcfDimensionFilters = a})
. _Default
. _Coerce
-- | Metrics which are compatible to be selected as activity metrics to pivot
-- on in the \"activities\" section of the report.
rcfPivotedActivityMetrics :: Lens' ReportCompatibleFields [Metric]
rcfPivotedActivityMetrics
= lens _rcfPivotedActivityMetrics
(\ s a -> s{_rcfPivotedActivityMetrics = a})
. _Default
. _Coerce
-- | Dimensions which are compatible to be selected in the \"dimensions\"
-- section of the report.
rcfDimensions :: Lens' ReportCompatibleFields [Dimension]
rcfDimensions
= lens _rcfDimensions
(\ s a -> s{_rcfDimensions = a})
. _Default
. _Coerce
instance FromJSON ReportCompatibleFields where
parseJSON
= withObject "ReportCompatibleFields"
(\ o ->
ReportCompatibleFields' <$>
(o .:? "metrics" .!= mempty) <*> (o .:? "kind") <*>
(o .:? "dimensionFilters" .!= mempty)
<*> (o .:? "pivotedActivityMetrics" .!= mempty)
<*> (o .:? "dimensions" .!= mempty))
instance ToJSON ReportCompatibleFields where
toJSON ReportCompatibleFields'{..}
= object
(catMaybes
[("metrics" .=) <$> _rcfMetrics,
("kind" .=) <$> _rcfKind,
("dimensionFilters" .=) <$> _rcfDimensionFilters,
("pivotedActivityMetrics" .=) <$>
_rcfPivotedActivityMetrics,
("dimensions" .=) <$> _rcfDimensions])
-- | Delivery Schedule.
--
-- /See:/ 'deliverySchedule' smart constructor.
data DeliverySchedule =
DeliverySchedule'
{ _dsHardCutoff :: !(Maybe Bool)
, _dsPriority :: !(Maybe DeliverySchedulePriority)
, _dsImpressionRatio :: !(Maybe (Textual Int64))
, _dsFrequencyCap :: !(Maybe FrequencyCap)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DeliverySchedule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dsHardCutoff'
--
-- * 'dsPriority'
--
-- * 'dsImpressionRatio'
--
-- * 'dsFrequencyCap'
deliverySchedule
:: DeliverySchedule
deliverySchedule =
DeliverySchedule'
{ _dsHardCutoff = Nothing
, _dsPriority = Nothing
, _dsImpressionRatio = Nothing
, _dsFrequencyCap = Nothing
}
-- | Whether or not hard cutoff is enabled. If true, the ad will not serve
-- after the end date and time. Otherwise the ad will continue to be served
-- until it has reached its delivery goals.
dsHardCutoff :: Lens' DeliverySchedule (Maybe Bool)
dsHardCutoff
= lens _dsHardCutoff (\ s a -> s{_dsHardCutoff = a})
-- | Serving priority of an ad, with respect to other ads. The lower the
-- priority number, the greater the priority with which it is served.
dsPriority :: Lens' DeliverySchedule (Maybe DeliverySchedulePriority)
dsPriority
= lens _dsPriority (\ s a -> s{_dsPriority = a})
-- | Impression ratio for this ad. This ratio determines how often each ad is
-- served relative to the others. For example, if ad A has an impression
-- ratio of 1 and ad B has an impression ratio of 3, then Campaign Manager
-- will serve ad B three times as often as ad A. Acceptable values are 1 to
-- 10, inclusive.
dsImpressionRatio :: Lens' DeliverySchedule (Maybe Int64)
dsImpressionRatio
= lens _dsImpressionRatio
(\ s a -> s{_dsImpressionRatio = a})
. mapping _Coerce
-- | Limit on the number of times an individual user can be served the ad
-- within a specified period of time.
dsFrequencyCap :: Lens' DeliverySchedule (Maybe FrequencyCap)
dsFrequencyCap
= lens _dsFrequencyCap
(\ s a -> s{_dsFrequencyCap = a})
instance FromJSON DeliverySchedule where
parseJSON
= withObject "DeliverySchedule"
(\ o ->
DeliverySchedule' <$>
(o .:? "hardCutoff") <*> (o .:? "priority") <*>
(o .:? "impressionRatio")
<*> (o .:? "frequencyCap"))
instance ToJSON DeliverySchedule where
toJSON DeliverySchedule'{..}
= object
(catMaybes
[("hardCutoff" .=) <$> _dsHardCutoff,
("priority" .=) <$> _dsPriority,
("impressionRatio" .=) <$> _dsImpressionRatio,
("frequencyCap" .=) <$> _dsFrequencyCap])
-- | Contains properties of a remarketing list. Remarketing enables you to
-- create lists of users who have performed specific actions on a site,
-- then target ads to members of those lists. This resource can be used to
-- manage remarketing lists that are owned by your advertisers. To see all
-- remarketing lists that are visible to your advertisers, including those
-- that are shared to your advertiser or account, use the
-- TargetableRemarketingLists resource.
--
-- /See:/ 'remarketingList' smart constructor.
data RemarketingList =
RemarketingList'
{ _rlListSize :: !(Maybe (Textual Int64))
, _rlListPopulationRule :: !(Maybe ListPopulationRule)
, _rlLifeSpan :: !(Maybe (Textual Int64))
, _rlKind :: !(Maybe Text)
, _rlAdvertiserId :: !(Maybe (Textual Int64))
, _rlAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _rlActive :: !(Maybe Bool)
, _rlAccountId :: !(Maybe (Textual Int64))
, _rlName :: !(Maybe Text)
, _rlListSource :: !(Maybe RemarketingListListSource)
, _rlId :: !(Maybe (Textual Int64))
, _rlSubAccountId :: !(Maybe (Textual Int64))
, _rlDescription :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'RemarketingList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rlListSize'
--
-- * 'rlListPopulationRule'
--
-- * 'rlLifeSpan'
--
-- * 'rlKind'
--
-- * 'rlAdvertiserId'
--
-- * 'rlAdvertiserIdDimensionValue'
--
-- * 'rlActive'
--
-- * 'rlAccountId'
--
-- * 'rlName'
--
-- * 'rlListSource'
--
-- * 'rlId'
--
-- * 'rlSubAccountId'
--
-- * 'rlDescription'
remarketingList
:: RemarketingList
remarketingList =
RemarketingList'
{ _rlListSize = Nothing
, _rlListPopulationRule = Nothing
, _rlLifeSpan = Nothing
, _rlKind = Nothing
, _rlAdvertiserId = Nothing
, _rlAdvertiserIdDimensionValue = Nothing
, _rlActive = Nothing
, _rlAccountId = Nothing
, _rlName = Nothing
, _rlListSource = Nothing
, _rlId = Nothing
, _rlSubAccountId = Nothing
, _rlDescription = Nothing
}
-- | Number of users currently in the list. This is a read-only field.
rlListSize :: Lens' RemarketingList (Maybe Int64)
rlListSize
= lens _rlListSize (\ s a -> s{_rlListSize = a}) .
mapping _Coerce
-- | Rule used to populate the remarketing list with users.
rlListPopulationRule :: Lens' RemarketingList (Maybe ListPopulationRule)
rlListPopulationRule
= lens _rlListPopulationRule
(\ s a -> s{_rlListPopulationRule = a})
-- | Number of days that a user should remain in the remarketing list without
-- an impression. Acceptable values are 1 to 540, inclusive.
rlLifeSpan :: Lens' RemarketingList (Maybe Int64)
rlLifeSpan
= lens _rlLifeSpan (\ s a -> s{_rlLifeSpan = a}) .
mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#remarketingList\".
rlKind :: Lens' RemarketingList (Maybe Text)
rlKind = lens _rlKind (\ s a -> s{_rlKind = a})
-- | Dimension value for the advertiser ID that owns this remarketing list.
-- This is a required field.
rlAdvertiserId :: Lens' RemarketingList (Maybe Int64)
rlAdvertiserId
= lens _rlAdvertiserId
(\ s a -> s{_rlAdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
rlAdvertiserIdDimensionValue :: Lens' RemarketingList (Maybe DimensionValue)
rlAdvertiserIdDimensionValue
= lens _rlAdvertiserIdDimensionValue
(\ s a -> s{_rlAdvertiserIdDimensionValue = a})
-- | Whether this remarketing list is active.
rlActive :: Lens' RemarketingList (Maybe Bool)
rlActive = lens _rlActive (\ s a -> s{_rlActive = a})
-- | Account ID of this remarketing list. This is a read-only, auto-generated
-- field that is only returned in GET requests.
rlAccountId :: Lens' RemarketingList (Maybe Int64)
rlAccountId
= lens _rlAccountId (\ s a -> s{_rlAccountId = a}) .
mapping _Coerce
-- | Name of the remarketing list. This is a required field. Must be no
-- greater than 128 characters long.
rlName :: Lens' RemarketingList (Maybe Text)
rlName = lens _rlName (\ s a -> s{_rlName = a})
-- | Product from which this remarketing list was originated.
rlListSource :: Lens' RemarketingList (Maybe RemarketingListListSource)
rlListSource
= lens _rlListSource (\ s a -> s{_rlListSource = a})
-- | Remarketing list ID. This is a read-only, auto-generated field.
rlId :: Lens' RemarketingList (Maybe Int64)
rlId
= lens _rlId (\ s a -> s{_rlId = a}) .
mapping _Coerce
-- | Subaccount ID of this remarketing list. This is a read-only,
-- auto-generated field that is only returned in GET requests.
rlSubAccountId :: Lens' RemarketingList (Maybe Int64)
rlSubAccountId
= lens _rlSubAccountId
(\ s a -> s{_rlSubAccountId = a})
. mapping _Coerce
-- | Remarketing list description.
rlDescription :: Lens' RemarketingList (Maybe Text)
rlDescription
= lens _rlDescription
(\ s a -> s{_rlDescription = a})
instance FromJSON RemarketingList where
parseJSON
= withObject "RemarketingList"
(\ o ->
RemarketingList' <$>
(o .:? "listSize") <*> (o .:? "listPopulationRule")
<*> (o .:? "lifeSpan")
<*> (o .:? "kind")
<*> (o .:? "advertiserId")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "active")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "listSource")
<*> (o .:? "id")
<*> (o .:? "subaccountId")
<*> (o .:? "description"))
instance ToJSON RemarketingList where
toJSON RemarketingList'{..}
= object
(catMaybes
[("listSize" .=) <$> _rlListSize,
("listPopulationRule" .=) <$> _rlListPopulationRule,
("lifeSpan" .=) <$> _rlLifeSpan,
("kind" .=) <$> _rlKind,
("advertiserId" .=) <$> _rlAdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_rlAdvertiserIdDimensionValue,
("active" .=) <$> _rlActive,
("accountId" .=) <$> _rlAccountId,
("name" .=) <$> _rlName,
("listSource" .=) <$> _rlListSource,
("id" .=) <$> _rlId,
("subaccountId" .=) <$> _rlSubAccountId,
("description" .=) <$> _rlDescription])
-- | Dynamic Targeting Key List Response
--
-- /See:/ 'dynamicTargetingKeysListResponse' smart constructor.
data DynamicTargetingKeysListResponse =
DynamicTargetingKeysListResponse'
{ _dtklrKind :: !(Maybe Text)
, _dtklrDynamicTargetingKeys :: !(Maybe [DynamicTargetingKey])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DynamicTargetingKeysListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dtklrKind'
--
-- * 'dtklrDynamicTargetingKeys'
dynamicTargetingKeysListResponse
:: DynamicTargetingKeysListResponse
dynamicTargetingKeysListResponse =
DynamicTargetingKeysListResponse'
{_dtklrKind = Nothing, _dtklrDynamicTargetingKeys = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#dynamicTargetingKeysListResponse\".
dtklrKind :: Lens' DynamicTargetingKeysListResponse (Maybe Text)
dtklrKind
= lens _dtklrKind (\ s a -> s{_dtklrKind = a})
-- | Dynamic targeting key collection.
dtklrDynamicTargetingKeys :: Lens' DynamicTargetingKeysListResponse [DynamicTargetingKey]
dtklrDynamicTargetingKeys
= lens _dtklrDynamicTargetingKeys
(\ s a -> s{_dtklrDynamicTargetingKeys = a})
. _Default
. _Coerce
instance FromJSON DynamicTargetingKeysListResponse
where
parseJSON
= withObject "DynamicTargetingKeysListResponse"
(\ o ->
DynamicTargetingKeysListResponse' <$>
(o .:? "kind") <*>
(o .:? "dynamicTargetingKeys" .!= mempty))
instance ToJSON DynamicTargetingKeysListResponse
where
toJSON DynamicTargetingKeysListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _dtklrKind,
("dynamicTargetingKeys" .=) <$>
_dtklrDynamicTargetingKeys])
-- | Represents the list of DimensionValue resources.
--
-- /See:/ 'dimensionValueList' smart constructor.
data DimensionValueList =
DimensionValueList'
{ _dvlEtag :: !(Maybe Text)
, _dvlNextPageToken :: !(Maybe Text)
, _dvlKind :: !(Maybe Text)
, _dvlItems :: !(Maybe [DimensionValue])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DimensionValueList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dvlEtag'
--
-- * 'dvlNextPageToken'
--
-- * 'dvlKind'
--
-- * 'dvlItems'
dimensionValueList
:: DimensionValueList
dimensionValueList =
DimensionValueList'
{ _dvlEtag = Nothing
, _dvlNextPageToken = Nothing
, _dvlKind = Nothing
, _dvlItems = Nothing
}
-- | The eTag of this response for caching purposes.
dvlEtag :: Lens' DimensionValueList (Maybe Text)
dvlEtag = lens _dvlEtag (\ s a -> s{_dvlEtag = a})
-- | Continuation token used to page through dimension values. To retrieve
-- the next page of results, set the next request\'s \"pageToken\" to the
-- value of this field. The page token is only valid for a limited amount
-- of time and should not be persisted.
dvlNextPageToken :: Lens' DimensionValueList (Maybe Text)
dvlNextPageToken
= lens _dvlNextPageToken
(\ s a -> s{_dvlNextPageToken = a})
-- | The kind of list this is, in this case dfareporting#dimensionValueList.
dvlKind :: Lens' DimensionValueList (Maybe Text)
dvlKind = lens _dvlKind (\ s a -> s{_dvlKind = a})
-- | The dimension values returned in this response.
dvlItems :: Lens' DimensionValueList [DimensionValue]
dvlItems
= lens _dvlItems (\ s a -> s{_dvlItems = a}) .
_Default
. _Coerce
instance FromJSON DimensionValueList where
parseJSON
= withObject "DimensionValueList"
(\ o ->
DimensionValueList' <$>
(o .:? "etag") <*> (o .:? "nextPageToken") <*>
(o .:? "kind")
<*> (o .:? "items" .!= mempty))
instance ToJSON DimensionValueList where
toJSON DimensionValueList'{..}
= object
(catMaybes
[("etag" .=) <$> _dvlEtag,
("nextPageToken" .=) <$> _dvlNextPageToken,
("kind" .=) <$> _dvlKind,
("items" .=) <$> _dvlItems])
-- | Represents fields that are compatible to be selected for a report of
-- type \"FlOODLIGHT\".
--
-- /See:/ 'floodlightReportCompatibleFields' smart constructor.
data FloodlightReportCompatibleFields =
FloodlightReportCompatibleFields'
{ _frcfMetrics :: !(Maybe [Metric])
, _frcfKind :: !(Maybe Text)
, _frcfDimensionFilters :: !(Maybe [Dimension])
, _frcfDimensions :: !(Maybe [Dimension])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightReportCompatibleFields' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'frcfMetrics'
--
-- * 'frcfKind'
--
-- * 'frcfDimensionFilters'
--
-- * 'frcfDimensions'
floodlightReportCompatibleFields
:: FloodlightReportCompatibleFields
floodlightReportCompatibleFields =
FloodlightReportCompatibleFields'
{ _frcfMetrics = Nothing
, _frcfKind = Nothing
, _frcfDimensionFilters = Nothing
, _frcfDimensions = Nothing
}
-- | Metrics which are compatible to be selected in the \"metricNames\"
-- section of the report.
frcfMetrics :: Lens' FloodlightReportCompatibleFields [Metric]
frcfMetrics
= lens _frcfMetrics (\ s a -> s{_frcfMetrics = a}) .
_Default
. _Coerce
-- | The kind of resource this is, in this case
-- dfareporting#floodlightReportCompatibleFields.
frcfKind :: Lens' FloodlightReportCompatibleFields (Maybe Text)
frcfKind = lens _frcfKind (\ s a -> s{_frcfKind = a})
-- | Dimensions which are compatible to be selected in the
-- \"dimensionFilters\" section of the report.
frcfDimensionFilters :: Lens' FloodlightReportCompatibleFields [Dimension]
frcfDimensionFilters
= lens _frcfDimensionFilters
(\ s a -> s{_frcfDimensionFilters = a})
. _Default
. _Coerce
-- | Dimensions which are compatible to be selected in the \"dimensions\"
-- section of the report.
frcfDimensions :: Lens' FloodlightReportCompatibleFields [Dimension]
frcfDimensions
= lens _frcfDimensions
(\ s a -> s{_frcfDimensions = a})
. _Default
. _Coerce
instance FromJSON FloodlightReportCompatibleFields
where
parseJSON
= withObject "FloodlightReportCompatibleFields"
(\ o ->
FloodlightReportCompatibleFields' <$>
(o .:? "metrics" .!= mempty) <*> (o .:? "kind") <*>
(o .:? "dimensionFilters" .!= mempty)
<*> (o .:? "dimensions" .!= mempty))
instance ToJSON FloodlightReportCompatibleFields
where
toJSON FloodlightReportCompatibleFields'{..}
= object
(catMaybes
[("metrics" .=) <$> _frcfMetrics,
("kind" .=) <$> _frcfKind,
("dimensionFilters" .=) <$> _frcfDimensionFilters,
("dimensions" .=) <$> _frcfDimensions])
-- | Represents a grouping of related user role permissions.
--
-- /See:/ 'userRolePermissionGroup' smart constructor.
data UserRolePermissionGroup =
UserRolePermissionGroup'
{ _urpgKind :: !(Maybe Text)
, _urpgName :: !(Maybe Text)
, _urpgId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UserRolePermissionGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'urpgKind'
--
-- * 'urpgName'
--
-- * 'urpgId'
userRolePermissionGroup
:: UserRolePermissionGroup
userRolePermissionGroup =
UserRolePermissionGroup'
{_urpgKind = Nothing, _urpgName = Nothing, _urpgId = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#userRolePermissionGroup\".
urpgKind :: Lens' UserRolePermissionGroup (Maybe Text)
urpgKind = lens _urpgKind (\ s a -> s{_urpgKind = a})
-- | Name of this user role permission group.
urpgName :: Lens' UserRolePermissionGroup (Maybe Text)
urpgName = lens _urpgName (\ s a -> s{_urpgName = a})
-- | ID of this user role permission.
urpgId :: Lens' UserRolePermissionGroup (Maybe Int64)
urpgId
= lens _urpgId (\ s a -> s{_urpgId = a}) .
mapping _Coerce
instance FromJSON UserRolePermissionGroup where
parseJSON
= withObject "UserRolePermissionGroup"
(\ o ->
UserRolePermissionGroup' <$>
(o .:? "kind") <*> (o .:? "name") <*> (o .:? "id"))
instance ToJSON UserRolePermissionGroup where
toJSON UserRolePermissionGroup'{..}
= object
(catMaybes
[("kind" .=) <$> _urpgKind,
("name" .=) <$> _urpgName, ("id" .=) <$> _urpgId])
-- | Tag Settings
--
-- /See:/ 'tagSetting' smart constructor.
data TagSetting =
TagSetting'
{ _tsKeywordOption :: !(Maybe TagSettingKeywordOption)
, _tsIncludeClickThroughURLs :: !(Maybe Bool)
, _tsIncludeClickTracking :: !(Maybe Bool)
, _tsAdditionalKeyValues :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TagSetting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tsKeywordOption'
--
-- * 'tsIncludeClickThroughURLs'
--
-- * 'tsIncludeClickTracking'
--
-- * 'tsAdditionalKeyValues'
tagSetting
:: TagSetting
tagSetting =
TagSetting'
{ _tsKeywordOption = Nothing
, _tsIncludeClickThroughURLs = Nothing
, _tsIncludeClickTracking = Nothing
, _tsAdditionalKeyValues = Nothing
}
-- | Option specifying how keywords are embedded in ad tags. This setting can
-- be used to specify whether keyword placeholders are inserted in
-- placement tags for this site. Publishers can then add keywords to those
-- placeholders.
tsKeywordOption :: Lens' TagSetting (Maybe TagSettingKeywordOption)
tsKeywordOption
= lens _tsKeywordOption
(\ s a -> s{_tsKeywordOption = a})
-- | Whether static landing page URLs should be included in the tags. This
-- setting applies only to placements.
tsIncludeClickThroughURLs :: Lens' TagSetting (Maybe Bool)
tsIncludeClickThroughURLs
= lens _tsIncludeClickThroughURLs
(\ s a -> s{_tsIncludeClickThroughURLs = a})
-- | Whether click-tracking string should be included in the tags.
tsIncludeClickTracking :: Lens' TagSetting (Maybe Bool)
tsIncludeClickTracking
= lens _tsIncludeClickTracking
(\ s a -> s{_tsIncludeClickTracking = a})
-- | Additional key-values to be included in tags. Each key-value pair must
-- be of the form key=value, and pairs must be separated by a semicolon
-- (;). Keys and values must not contain commas. For example,
-- id=2;color=red is a valid value for this field.
tsAdditionalKeyValues :: Lens' TagSetting (Maybe Text)
tsAdditionalKeyValues
= lens _tsAdditionalKeyValues
(\ s a -> s{_tsAdditionalKeyValues = a})
instance FromJSON TagSetting where
parseJSON
= withObject "TagSetting"
(\ o ->
TagSetting' <$>
(o .:? "keywordOption") <*>
(o .:? "includeClickThroughUrls")
<*> (o .:? "includeClickTracking")
<*> (o .:? "additionalKeyValues"))
instance ToJSON TagSetting where
toJSON TagSetting'{..}
= object
(catMaybes
[("keywordOption" .=) <$> _tsKeywordOption,
("includeClickThroughUrls" .=) <$>
_tsIncludeClickThroughURLs,
("includeClickTracking" .=) <$>
_tsIncludeClickTracking,
("additionalKeyValues" .=) <$>
_tsAdditionalKeyValues])
-- | The properties of the report.
--
-- /See:/ 'reportPathToConversionCriteriaReportProperties' smart constructor.
data ReportPathToConversionCriteriaReportProperties =
ReportPathToConversionCriteriaReportProperties'
{ _rptccrpMaximumInteractionGap :: !(Maybe (Textual Int32))
, _rptccrpMaximumClickInteractions :: !(Maybe (Textual Int32))
, _rptccrpPivotOnInteractionPath :: !(Maybe Bool)
, _rptccrpMaximumImpressionInteractions :: !(Maybe (Textual Int32))
, _rptccrpIncludeUnattributedIPConversions :: !(Maybe Bool)
, _rptccrpImpressionsLookbackWindow :: !(Maybe (Textual Int32))
, _rptccrpClicksLookbackWindow :: !(Maybe (Textual Int32))
, _rptccrpIncludeUnattributedCookieConversions :: !(Maybe Bool)
, _rptccrpIncludeAttributedIPConversions :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportPathToConversionCriteriaReportProperties' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rptccrpMaximumInteractionGap'
--
-- * 'rptccrpMaximumClickInteractions'
--
-- * 'rptccrpPivotOnInteractionPath'
--
-- * 'rptccrpMaximumImpressionInteractions'
--
-- * 'rptccrpIncludeUnattributedIPConversions'
--
-- * 'rptccrpImpressionsLookbackWindow'
--
-- * 'rptccrpClicksLookbackWindow'
--
-- * 'rptccrpIncludeUnattributedCookieConversions'
--
-- * 'rptccrpIncludeAttributedIPConversions'
reportPathToConversionCriteriaReportProperties
:: ReportPathToConversionCriteriaReportProperties
reportPathToConversionCriteriaReportProperties =
ReportPathToConversionCriteriaReportProperties'
{ _rptccrpMaximumInteractionGap = Nothing
, _rptccrpMaximumClickInteractions = Nothing
, _rptccrpPivotOnInteractionPath = Nothing
, _rptccrpMaximumImpressionInteractions = Nothing
, _rptccrpIncludeUnattributedIPConversions = Nothing
, _rptccrpImpressionsLookbackWindow = Nothing
, _rptccrpClicksLookbackWindow = Nothing
, _rptccrpIncludeUnattributedCookieConversions = Nothing
, _rptccrpIncludeAttributedIPConversions = Nothing
}
-- | The maximum amount of time that can take place between interactions
-- (clicks or impressions) by the same user. Valid values: 1-90.
rptccrpMaximumInteractionGap :: Lens' ReportPathToConversionCriteriaReportProperties (Maybe Int32)
rptccrpMaximumInteractionGap
= lens _rptccrpMaximumInteractionGap
(\ s a -> s{_rptccrpMaximumInteractionGap = a})
. mapping _Coerce
-- | The maximum number of click interactions to include in the report.
-- Advertisers currently paying for E2C reports get up to 200 (100 clicks,
-- 100 impressions). If another advertiser in your network is paying for
-- E2C, you can have up to 5 total exposures per report.
rptccrpMaximumClickInteractions :: Lens' ReportPathToConversionCriteriaReportProperties (Maybe Int32)
rptccrpMaximumClickInteractions
= lens _rptccrpMaximumClickInteractions
(\ s a -> s{_rptccrpMaximumClickInteractions = a})
. mapping _Coerce
-- | Enable pivoting on interaction path.
rptccrpPivotOnInteractionPath :: Lens' ReportPathToConversionCriteriaReportProperties (Maybe Bool)
rptccrpPivotOnInteractionPath
= lens _rptccrpPivotOnInteractionPath
(\ s a -> s{_rptccrpPivotOnInteractionPath = a})
-- | The maximum number of click interactions to include in the report.
-- Advertisers currently paying for E2C reports get up to 200 (100 clicks,
-- 100 impressions). If another advertiser in your network is paying for
-- E2C, you can have up to 5 total exposures per report.
rptccrpMaximumImpressionInteractions :: Lens' ReportPathToConversionCriteriaReportProperties (Maybe Int32)
rptccrpMaximumImpressionInteractions
= lens _rptccrpMaximumImpressionInteractions
(\ s a ->
s{_rptccrpMaximumImpressionInteractions = a})
. mapping _Coerce
-- | Include conversions that have no associated cookies and no exposures.
-- It’s therefore impossible to know how the user was exposed to your ads
-- during the lookback window prior to a conversion.
rptccrpIncludeUnattributedIPConversions :: Lens' ReportPathToConversionCriteriaReportProperties (Maybe Bool)
rptccrpIncludeUnattributedIPConversions
= lens _rptccrpIncludeUnattributedIPConversions
(\ s a ->
s{_rptccrpIncludeUnattributedIPConversions = a})
-- | CM360 checks to see if an impression interaction occurred within the
-- specified period of time before a conversion. By default the value is
-- pulled from Floodlight or you can manually enter a custom value. Valid
-- values: 1-90.
rptccrpImpressionsLookbackWindow :: Lens' ReportPathToConversionCriteriaReportProperties (Maybe Int32)
rptccrpImpressionsLookbackWindow
= lens _rptccrpImpressionsLookbackWindow
(\ s a -> s{_rptccrpImpressionsLookbackWindow = a})
. mapping _Coerce
-- | CM360 checks to see if a click interaction occurred within the specified
-- period of time before a conversion. By default the value is pulled from
-- Floodlight or you can manually enter a custom value. Valid values: 1-90.
rptccrpClicksLookbackWindow :: Lens' ReportPathToConversionCriteriaReportProperties (Maybe Int32)
rptccrpClicksLookbackWindow
= lens _rptccrpClicksLookbackWindow
(\ s a -> s{_rptccrpClicksLookbackWindow = a})
. mapping _Coerce
-- | Include conversions of users with a DoubleClick cookie but without an
-- exposure. That means the user did not click or see an ad from the
-- advertiser within the Floodlight group, or that the interaction happened
-- outside the lookback window.
rptccrpIncludeUnattributedCookieConversions :: Lens' ReportPathToConversionCriteriaReportProperties (Maybe Bool)
rptccrpIncludeUnattributedCookieConversions
= lens _rptccrpIncludeUnattributedCookieConversions
(\ s a ->
s{_rptccrpIncludeUnattributedCookieConversions = a})
-- | Deprecated: has no effect.
rptccrpIncludeAttributedIPConversions :: Lens' ReportPathToConversionCriteriaReportProperties (Maybe Bool)
rptccrpIncludeAttributedIPConversions
= lens _rptccrpIncludeAttributedIPConversions
(\ s a ->
s{_rptccrpIncludeAttributedIPConversions = a})
instance FromJSON
ReportPathToConversionCriteriaReportProperties
where
parseJSON
= withObject
"ReportPathToConversionCriteriaReportProperties"
(\ o ->
ReportPathToConversionCriteriaReportProperties' <$>
(o .:? "maximumInteractionGap") <*>
(o .:? "maximumClickInteractions")
<*> (o .:? "pivotOnInteractionPath")
<*> (o .:? "maximumImpressionInteractions")
<*> (o .:? "includeUnattributedIPConversions")
<*> (o .:? "impressionsLookbackWindow")
<*> (o .:? "clicksLookbackWindow")
<*> (o .:? "includeUnattributedCookieConversions")
<*> (o .:? "includeAttributedIPConversions"))
instance ToJSON
ReportPathToConversionCriteriaReportProperties
where
toJSON
ReportPathToConversionCriteriaReportProperties'{..}
= object
(catMaybes
[("maximumInteractionGap" .=) <$>
_rptccrpMaximumInteractionGap,
("maximumClickInteractions" .=) <$>
_rptccrpMaximumClickInteractions,
("pivotOnInteractionPath" .=) <$>
_rptccrpPivotOnInteractionPath,
("maximumImpressionInteractions" .=) <$>
_rptccrpMaximumImpressionInteractions,
("includeUnattributedIPConversions" .=) <$>
_rptccrpIncludeUnattributedIPConversions,
("impressionsLookbackWindow" .=) <$>
_rptccrpImpressionsLookbackWindow,
("clicksLookbackWindow" .=) <$>
_rptccrpClicksLookbackWindow,
("includeUnattributedCookieConversions" .=) <$>
_rptccrpIncludeUnattributedCookieConversions,
("includeAttributedIPConversions" .=) <$>
_rptccrpIncludeAttributedIPConversions])
-- | User Role Permission List Response
--
-- /See:/ 'userRolePermissionsListResponse' smart constructor.
data UserRolePermissionsListResponse =
UserRolePermissionsListResponse'
{ _urplrKind :: !(Maybe Text)
, _urplrUserRolePermissions :: !(Maybe [UserRolePermission])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UserRolePermissionsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'urplrKind'
--
-- * 'urplrUserRolePermissions'
userRolePermissionsListResponse
:: UserRolePermissionsListResponse
userRolePermissionsListResponse =
UserRolePermissionsListResponse'
{_urplrKind = Nothing, _urplrUserRolePermissions = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#userRolePermissionsListResponse\".
urplrKind :: Lens' UserRolePermissionsListResponse (Maybe Text)
urplrKind
= lens _urplrKind (\ s a -> s{_urplrKind = a})
-- | User role permission collection.
urplrUserRolePermissions :: Lens' UserRolePermissionsListResponse [UserRolePermission]
urplrUserRolePermissions
= lens _urplrUserRolePermissions
(\ s a -> s{_urplrUserRolePermissions = a})
. _Default
. _Coerce
instance FromJSON UserRolePermissionsListResponse
where
parseJSON
= withObject "UserRolePermissionsListResponse"
(\ o ->
UserRolePermissionsListResponse' <$>
(o .:? "kind") <*>
(o .:? "userRolePermissions" .!= mempty))
instance ToJSON UserRolePermissionsListResponse where
toJSON UserRolePermissionsListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _urplrKind,
("userRolePermissions" .=) <$>
_urplrUserRolePermissions])
-- | Placement Group List Response
--
-- /See:/ 'placementGroupsListResponse' smart constructor.
data PlacementGroupsListResponse =
PlacementGroupsListResponse'
{ _pglrNextPageToken :: !(Maybe Text)
, _pglrKind :: !(Maybe Text)
, _pglrPlacementGroups :: !(Maybe [PlacementGroup])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlacementGroupsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pglrNextPageToken'
--
-- * 'pglrKind'
--
-- * 'pglrPlacementGroups'
placementGroupsListResponse
:: PlacementGroupsListResponse
placementGroupsListResponse =
PlacementGroupsListResponse'
{ _pglrNextPageToken = Nothing
, _pglrKind = Nothing
, _pglrPlacementGroups = Nothing
}
-- | Pagination token to be used for the next list operation.
pglrNextPageToken :: Lens' PlacementGroupsListResponse (Maybe Text)
pglrNextPageToken
= lens _pglrNextPageToken
(\ s a -> s{_pglrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#placementGroupsListResponse\".
pglrKind :: Lens' PlacementGroupsListResponse (Maybe Text)
pglrKind = lens _pglrKind (\ s a -> s{_pglrKind = a})
-- | Placement group collection.
pglrPlacementGroups :: Lens' PlacementGroupsListResponse [PlacementGroup]
pglrPlacementGroups
= lens _pglrPlacementGroups
(\ s a -> s{_pglrPlacementGroups = a})
. _Default
. _Coerce
instance FromJSON PlacementGroupsListResponse where
parseJSON
= withObject "PlacementGroupsListResponse"
(\ o ->
PlacementGroupsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "placementGroups" .!= mempty))
instance ToJSON PlacementGroupsListResponse where
toJSON PlacementGroupsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _pglrNextPageToken,
("kind" .=) <$> _pglrKind,
("placementGroups" .=) <$> _pglrPlacementGroups])
-- | Contains information about a mobile carrier that can be targeted by ads.
--
-- /See:/ 'mobileCarrier' smart constructor.
data MobileCarrier =
MobileCarrier'
{ _mcKind :: !(Maybe Text)
, _mcName :: !(Maybe Text)
, _mcCountryCode :: !(Maybe Text)
, _mcId :: !(Maybe (Textual Int64))
, _mcCountryDartId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'MobileCarrier' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mcKind'
--
-- * 'mcName'
--
-- * 'mcCountryCode'
--
-- * 'mcId'
--
-- * 'mcCountryDartId'
mobileCarrier
:: MobileCarrier
mobileCarrier =
MobileCarrier'
{ _mcKind = Nothing
, _mcName = Nothing
, _mcCountryCode = Nothing
, _mcId = Nothing
, _mcCountryDartId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#mobileCarrier\".
mcKind :: Lens' MobileCarrier (Maybe Text)
mcKind = lens _mcKind (\ s a -> s{_mcKind = a})
-- | Name of this mobile carrier.
mcName :: Lens' MobileCarrier (Maybe Text)
mcName = lens _mcName (\ s a -> s{_mcName = a})
-- | Country code of the country to which this mobile carrier belongs.
mcCountryCode :: Lens' MobileCarrier (Maybe Text)
mcCountryCode
= lens _mcCountryCode
(\ s a -> s{_mcCountryCode = a})
-- | ID of this mobile carrier.
mcId :: Lens' MobileCarrier (Maybe Int64)
mcId
= lens _mcId (\ s a -> s{_mcId = a}) .
mapping _Coerce
-- | DART ID of the country to which this mobile carrier belongs.
mcCountryDartId :: Lens' MobileCarrier (Maybe Int64)
mcCountryDartId
= lens _mcCountryDartId
(\ s a -> s{_mcCountryDartId = a})
. mapping _Coerce
instance FromJSON MobileCarrier where
parseJSON
= withObject "MobileCarrier"
(\ o ->
MobileCarrier' <$>
(o .:? "kind") <*> (o .:? "name") <*>
(o .:? "countryCode")
<*> (o .:? "id")
<*> (o .:? "countryDartId"))
instance ToJSON MobileCarrier where
toJSON MobileCarrier'{..}
= object
(catMaybes
[("kind" .=) <$> _mcKind, ("name" .=) <$> _mcName,
("countryCode" .=) <$> _mcCountryCode,
("id" .=) <$> _mcId,
("countryDartId" .=) <$> _mcCountryDartId])
-- | Contains information about where a user\'s browser is taken after the
-- user clicks an ad.
--
-- /See:/ 'landingPage' smart constructor.
data LandingPage =
LandingPage'
{ _lpKind :: !(Maybe Text)
, _lpAdvertiserId :: !(Maybe (Textual Int64))
, _lpURL :: !(Maybe Text)
, _lpName :: !(Maybe Text)
, _lpDeepLinks :: !(Maybe [DeepLink])
, _lpId :: !(Maybe (Textual Int64))
, _lpArchived :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'LandingPage' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lpKind'
--
-- * 'lpAdvertiserId'
--
-- * 'lpURL'
--
-- * 'lpName'
--
-- * 'lpDeepLinks'
--
-- * 'lpId'
--
-- * 'lpArchived'
landingPage
:: LandingPage
landingPage =
LandingPage'
{ _lpKind = Nothing
, _lpAdvertiserId = Nothing
, _lpURL = Nothing
, _lpName = Nothing
, _lpDeepLinks = Nothing
, _lpId = Nothing
, _lpArchived = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#landingPage\".
lpKind :: Lens' LandingPage (Maybe Text)
lpKind = lens _lpKind (\ s a -> s{_lpKind = a})
-- | Advertiser ID of this landing page. This is a required field.
lpAdvertiserId :: Lens' LandingPage (Maybe Int64)
lpAdvertiserId
= lens _lpAdvertiserId
(\ s a -> s{_lpAdvertiserId = a})
. mapping _Coerce
-- | URL of this landing page. This is a required field.
lpURL :: Lens' LandingPage (Maybe Text)
lpURL = lens _lpURL (\ s a -> s{_lpURL = a})
-- | Name of this landing page. This is a required field. It must be less
-- than 256 characters long.
lpName :: Lens' LandingPage (Maybe Text)
lpName = lens _lpName (\ s a -> s{_lpName = a})
-- | Links that will direct the user to a mobile app, if installed.
lpDeepLinks :: Lens' LandingPage [DeepLink]
lpDeepLinks
= lens _lpDeepLinks (\ s a -> s{_lpDeepLinks = a}) .
_Default
. _Coerce
-- | ID of this landing page. This is a read-only, auto-generated field.
lpId :: Lens' LandingPage (Maybe Int64)
lpId
= lens _lpId (\ s a -> s{_lpId = a}) .
mapping _Coerce
-- | Whether this landing page has been archived.
lpArchived :: Lens' LandingPage (Maybe Bool)
lpArchived
= lens _lpArchived (\ s a -> s{_lpArchived = a})
instance FromJSON LandingPage where
parseJSON
= withObject "LandingPage"
(\ o ->
LandingPage' <$>
(o .:? "kind") <*> (o .:? "advertiserId") <*>
(o .:? "url")
<*> (o .:? "name")
<*> (o .:? "deepLinks" .!= mempty)
<*> (o .:? "id")
<*> (o .:? "archived"))
instance ToJSON LandingPage where
toJSON LandingPage'{..}
= object
(catMaybes
[("kind" .=) <$> _lpKind,
("advertiserId" .=) <$> _lpAdvertiserId,
("url" .=) <$> _lpURL, ("name" .=) <$> _lpName,
("deepLinks" .=) <$> _lpDeepLinks,
("id" .=) <$> _lpId,
("archived" .=) <$> _lpArchived])
-- | Connection Type List Response
--
-- /See:/ 'connectionTypesListResponse' smart constructor.
data ConnectionTypesListResponse =
ConnectionTypesListResponse'
{ _ctlrKind :: !(Maybe Text)
, _ctlrConnectionTypes :: !(Maybe [ConnectionType])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ConnectionTypesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ctlrKind'
--
-- * 'ctlrConnectionTypes'
connectionTypesListResponse
:: ConnectionTypesListResponse
connectionTypesListResponse =
ConnectionTypesListResponse'
{_ctlrKind = Nothing, _ctlrConnectionTypes = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#connectionTypesListResponse\".
ctlrKind :: Lens' ConnectionTypesListResponse (Maybe Text)
ctlrKind = lens _ctlrKind (\ s a -> s{_ctlrKind = a})
-- | Collection of connection types such as broadband and mobile.
ctlrConnectionTypes :: Lens' ConnectionTypesListResponse [ConnectionType]
ctlrConnectionTypes
= lens _ctlrConnectionTypes
(\ s a -> s{_ctlrConnectionTypes = a})
. _Default
. _Coerce
instance FromJSON ConnectionTypesListResponse where
parseJSON
= withObject "ConnectionTypesListResponse"
(\ o ->
ConnectionTypesListResponse' <$>
(o .:? "kind") <*>
(o .:? "connectionTypes" .!= mempty))
instance ToJSON ConnectionTypesListResponse where
toJSON ConnectionTypesListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _ctlrKind,
("connectionTypes" .=) <$> _ctlrConnectionTypes])
-- | Represents a DfaReporting event filter.
--
-- /See:/ 'eventFilter' smart constructor.
data EventFilter =
EventFilter'
{ _efKind :: !(Maybe Text)
, _efDimensionFilter :: !(Maybe PathReportDimensionValue)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'EventFilter' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'efKind'
--
-- * 'efDimensionFilter'
eventFilter
:: EventFilter
eventFilter = EventFilter' {_efKind = Nothing, _efDimensionFilter = Nothing}
-- | The kind of resource this is, in this case dfareporting#eventFilter.
efKind :: Lens' EventFilter (Maybe Text)
efKind = lens _efKind (\ s a -> s{_efKind = a})
-- | The dimension filter contained within this EventFilter.
efDimensionFilter :: Lens' EventFilter (Maybe PathReportDimensionValue)
efDimensionFilter
= lens _efDimensionFilter
(\ s a -> s{_efDimensionFilter = a})
instance FromJSON EventFilter where
parseJSON
= withObject "EventFilter"
(\ o ->
EventFilter' <$>
(o .:? "kind") <*> (o .:? "dimensionFilter"))
instance ToJSON EventFilter where
toJSON EventFilter'{..}
= object
(catMaybes
[("kind" .=) <$> _efKind,
("dimensionFilter" .=) <$> _efDimensionFilter])
-- | Order List Response
--
-- /See:/ 'ordersListResponse' smart constructor.
data OrdersListResponse =
OrdersListResponse'
{ _olrNextPageToken :: !(Maybe Text)
, _olrKind :: !(Maybe Text)
, _olrOrders :: !(Maybe [Order])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OrdersListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'olrNextPageToken'
--
-- * 'olrKind'
--
-- * 'olrOrders'
ordersListResponse
:: OrdersListResponse
ordersListResponse =
OrdersListResponse'
{_olrNextPageToken = Nothing, _olrKind = Nothing, _olrOrders = Nothing}
-- | Pagination token to be used for the next list operation.
olrNextPageToken :: Lens' OrdersListResponse (Maybe Text)
olrNextPageToken
= lens _olrNextPageToken
(\ s a -> s{_olrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#ordersListResponse\".
olrKind :: Lens' OrdersListResponse (Maybe Text)
olrKind = lens _olrKind (\ s a -> s{_olrKind = a})
-- | Order collection.
olrOrders :: Lens' OrdersListResponse [Order]
olrOrders
= lens _olrOrders (\ s a -> s{_olrOrders = a}) .
_Default
. _Coerce
instance FromJSON OrdersListResponse where
parseJSON
= withObject "OrdersListResponse"
(\ o ->
OrdersListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "orders" .!= mempty))
instance ToJSON OrdersListResponse where
toJSON OrdersListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _olrNextPageToken,
("kind" .=) <$> _olrKind,
("orders" .=) <$> _olrOrders])
-- | Represents the list of reports.
--
-- /See:/ 'reportList' smart constructor.
data ReportList =
ReportList'
{ _repEtag :: !(Maybe Text)
, _repNextPageToken :: !(Maybe Text)
, _repKind :: !(Maybe Text)
, _repItems :: !(Maybe [Report])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'repEtag'
--
-- * 'repNextPageToken'
--
-- * 'repKind'
--
-- * 'repItems'
reportList
:: ReportList
reportList =
ReportList'
{ _repEtag = Nothing
, _repNextPageToken = Nothing
, _repKind = Nothing
, _repItems = Nothing
}
-- | The eTag of this response for caching purposes.
repEtag :: Lens' ReportList (Maybe Text)
repEtag = lens _repEtag (\ s a -> s{_repEtag = a})
-- | Continuation token used to page through reports. To retrieve the next
-- page of results, set the next request\'s \"pageToken\" to the value of
-- this field. The page token is only valid for a limited amount of time
-- and should not be persisted.
repNextPageToken :: Lens' ReportList (Maybe Text)
repNextPageToken
= lens _repNextPageToken
(\ s a -> s{_repNextPageToken = a})
-- | The kind of list this is, in this case dfareporting#reportList.
repKind :: Lens' ReportList (Maybe Text)
repKind = lens _repKind (\ s a -> s{_repKind = a})
-- | The reports returned in this response.
repItems :: Lens' ReportList [Report]
repItems
= lens _repItems (\ s a -> s{_repItems = a}) .
_Default
. _Coerce
instance FromJSON ReportList where
parseJSON
= withObject "ReportList"
(\ o ->
ReportList' <$>
(o .:? "etag") <*> (o .:? "nextPageToken") <*>
(o .:? "kind")
<*> (o .:? "items" .!= mempty))
instance ToJSON ReportList where
toJSON ReportList'{..}
= object
(catMaybes
[("etag" .=) <$> _repEtag,
("nextPageToken" .=) <$> _repNextPageToken,
("kind" .=) <$> _repKind,
("items" .=) <$> _repItems])
-- | Contains properties of a creative group.
--
-- /See:/ 'creativeGroup' smart constructor.
data CreativeGroup =
CreativeGroup'
{ _cgKind :: !(Maybe Text)
, _cgAdvertiserId :: !(Maybe (Textual Int64))
, _cgAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _cgGroupNumber :: !(Maybe (Textual Int32))
, _cgAccountId :: !(Maybe (Textual Int64))
, _cgName :: !(Maybe Text)
, _cgId :: !(Maybe (Textual Int64))
, _cgSubAccountId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cgKind'
--
-- * 'cgAdvertiserId'
--
-- * 'cgAdvertiserIdDimensionValue'
--
-- * 'cgGroupNumber'
--
-- * 'cgAccountId'
--
-- * 'cgName'
--
-- * 'cgId'
--
-- * 'cgSubAccountId'
creativeGroup
:: CreativeGroup
creativeGroup =
CreativeGroup'
{ _cgKind = Nothing
, _cgAdvertiserId = Nothing
, _cgAdvertiserIdDimensionValue = Nothing
, _cgGroupNumber = Nothing
, _cgAccountId = Nothing
, _cgName = Nothing
, _cgId = Nothing
, _cgSubAccountId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#creativeGroup\".
cgKind :: Lens' CreativeGroup (Maybe Text)
cgKind = lens _cgKind (\ s a -> s{_cgKind = a})
-- | Advertiser ID of this creative group. This is a required field on
-- insertion.
cgAdvertiserId :: Lens' CreativeGroup (Maybe Int64)
cgAdvertiserId
= lens _cgAdvertiserId
(\ s a -> s{_cgAdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
cgAdvertiserIdDimensionValue :: Lens' CreativeGroup (Maybe DimensionValue)
cgAdvertiserIdDimensionValue
= lens _cgAdvertiserIdDimensionValue
(\ s a -> s{_cgAdvertiserIdDimensionValue = a})
-- | Subgroup of the creative group. Assign your creative groups to a
-- subgroup in order to filter or manage them more easily. This field is
-- required on insertion and is read-only after insertion. Acceptable
-- values are 1 to 2, inclusive.
cgGroupNumber :: Lens' CreativeGroup (Maybe Int32)
cgGroupNumber
= lens _cgGroupNumber
(\ s a -> s{_cgGroupNumber = a})
. mapping _Coerce
-- | Account ID of this creative group. This is a read-only field that can be
-- left blank.
cgAccountId :: Lens' CreativeGroup (Maybe Int64)
cgAccountId
= lens _cgAccountId (\ s a -> s{_cgAccountId = a}) .
mapping _Coerce
-- | Name of this creative group. This is a required field and must be less
-- than 256 characters long and unique among creative groups of the same
-- advertiser.
cgName :: Lens' CreativeGroup (Maybe Text)
cgName = lens _cgName (\ s a -> s{_cgName = a})
-- | ID of this creative group. This is a read-only, auto-generated field.
cgId :: Lens' CreativeGroup (Maybe Int64)
cgId
= lens _cgId (\ s a -> s{_cgId = a}) .
mapping _Coerce
-- | Subaccount ID of this creative group. This is a read-only field that can
-- be left blank.
cgSubAccountId :: Lens' CreativeGroup (Maybe Int64)
cgSubAccountId
= lens _cgSubAccountId
(\ s a -> s{_cgSubAccountId = a})
. mapping _Coerce
instance FromJSON CreativeGroup where
parseJSON
= withObject "CreativeGroup"
(\ o ->
CreativeGroup' <$>
(o .:? "kind") <*> (o .:? "advertiserId") <*>
(o .:? "advertiserIdDimensionValue")
<*> (o .:? "groupNumber")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "id")
<*> (o .:? "subaccountId"))
instance ToJSON CreativeGroup where
toJSON CreativeGroup'{..}
= object
(catMaybes
[("kind" .=) <$> _cgKind,
("advertiserId" .=) <$> _cgAdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_cgAdvertiserIdDimensionValue,
("groupNumber" .=) <$> _cgGroupNumber,
("accountId" .=) <$> _cgAccountId,
("name" .=) <$> _cgName, ("id" .=) <$> _cgId,
("subaccountId" .=) <$> _cgSubAccountId])
-- | Represents a DfaReporting channel grouping.
--
-- /See:/ 'channelGrouping' smart constructor.
data ChannelGrouping =
ChannelGrouping'
{ _chaRules :: !(Maybe [ChannelGroupingRule])
, _chaKind :: !(Maybe Text)
, _chaFallbackName :: !(Maybe Text)
, _chaName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ChannelGrouping' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'chaRules'
--
-- * 'chaKind'
--
-- * 'chaFallbackName'
--
-- * 'chaName'
channelGrouping
:: ChannelGrouping
channelGrouping =
ChannelGrouping'
{ _chaRules = Nothing
, _chaKind = Nothing
, _chaFallbackName = Nothing
, _chaName = Nothing
}
-- | The rules contained within this channel grouping.
chaRules :: Lens' ChannelGrouping [ChannelGroupingRule]
chaRules
= lens _chaRules (\ s a -> s{_chaRules = a}) .
_Default
. _Coerce
-- | The kind of resource this is, in this case dfareporting#channelGrouping.
chaKind :: Lens' ChannelGrouping (Maybe Text)
chaKind = lens _chaKind (\ s a -> s{_chaKind = a})
-- | ChannelGrouping fallback name.
chaFallbackName :: Lens' ChannelGrouping (Maybe Text)
chaFallbackName
= lens _chaFallbackName
(\ s a -> s{_chaFallbackName = a})
-- | ChannelGrouping name.
chaName :: Lens' ChannelGrouping (Maybe Text)
chaName = lens _chaName (\ s a -> s{_chaName = a})
instance FromJSON ChannelGrouping where
parseJSON
= withObject "ChannelGrouping"
(\ o ->
ChannelGrouping' <$>
(o .:? "rules" .!= mempty) <*> (o .:? "kind") <*>
(o .:? "fallbackName")
<*> (o .:? "name"))
instance ToJSON ChannelGrouping where
toJSON ChannelGrouping'{..}
= object
(catMaybes
[("rules" .=) <$> _chaRules,
("kind" .=) <$> _chaKind,
("fallbackName" .=) <$> _chaFallbackName,
("name" .=) <$> _chaName])
-- | Identifies a creative which has been associated with a given campaign.
--
-- /See:/ 'campaignCreativeAssociation' smart constructor.
data CampaignCreativeAssociation =
CampaignCreativeAssociation'
{ _ccaKind :: !(Maybe Text)
, _ccaCreativeId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CampaignCreativeAssociation' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ccaKind'
--
-- * 'ccaCreativeId'
campaignCreativeAssociation
:: CampaignCreativeAssociation
campaignCreativeAssociation =
CampaignCreativeAssociation' {_ccaKind = Nothing, _ccaCreativeId = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#campaignCreativeAssociation\".
ccaKind :: Lens' CampaignCreativeAssociation (Maybe Text)
ccaKind = lens _ccaKind (\ s a -> s{_ccaKind = a})
-- | ID of the creative associated with the campaign. This is a required
-- field.
ccaCreativeId :: Lens' CampaignCreativeAssociation (Maybe Int64)
ccaCreativeId
= lens _ccaCreativeId
(\ s a -> s{_ccaCreativeId = a})
. mapping _Coerce
instance FromJSON CampaignCreativeAssociation where
parseJSON
= withObject "CampaignCreativeAssociation"
(\ o ->
CampaignCreativeAssociation' <$>
(o .:? "kind") <*> (o .:? "creativeId"))
instance ToJSON CampaignCreativeAssociation where
toJSON CampaignCreativeAssociation'{..}
= object
(catMaybes
[("kind" .=) <$> _ccaKind,
("creativeId" .=) <$> _ccaCreativeId])
-- | The original conversion that was inserted or updated and whether there
-- were any errors.
--
-- /See:/ 'conversionStatus' smart constructor.
data ConversionStatus =
ConversionStatus'
{ _csKind :: !(Maybe Text)
, _csConversion :: !(Maybe Conversion)
, _csErrors :: !(Maybe [ConversionError])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ConversionStatus' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'csKind'
--
-- * 'csConversion'
--
-- * 'csErrors'
conversionStatus
:: ConversionStatus
conversionStatus =
ConversionStatus'
{_csKind = Nothing, _csConversion = Nothing, _csErrors = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#conversionStatus\".
csKind :: Lens' ConversionStatus (Maybe Text)
csKind = lens _csKind (\ s a -> s{_csKind = a})
-- | The original conversion that was inserted or updated.
csConversion :: Lens' ConversionStatus (Maybe Conversion)
csConversion
= lens _csConversion (\ s a -> s{_csConversion = a})
-- | A list of errors related to this conversion.
csErrors :: Lens' ConversionStatus [ConversionError]
csErrors
= lens _csErrors (\ s a -> s{_csErrors = a}) .
_Default
. _Coerce
instance FromJSON ConversionStatus where
parseJSON
= withObject "ConversionStatus"
(\ o ->
ConversionStatus' <$>
(o .:? "kind") <*> (o .:? "conversion") <*>
(o .:? "errors" .!= mempty))
instance ToJSON ConversionStatus where
toJSON ConversionStatus'{..}
= object
(catMaybes
[("kind" .=) <$> _csKind,
("conversion" .=) <$> _csConversion,
("errors" .=) <$> _csErrors])
-- | Lookback configuration settings.
--
-- /See:/ 'lookbackConfiguration' smart constructor.
data LookbackConfiguration =
LookbackConfiguration'
{ _lcClickDuration :: !(Maybe (Textual Int32))
, _lcPostImpressionActivitiesDuration :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'LookbackConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lcClickDuration'
--
-- * 'lcPostImpressionActivitiesDuration'
lookbackConfiguration
:: LookbackConfiguration
lookbackConfiguration =
LookbackConfiguration'
{_lcClickDuration = Nothing, _lcPostImpressionActivitiesDuration = Nothing}
-- | Lookback window, in days, from the last time a given user clicked on one
-- of your ads. If you enter 0, clicks will not be considered as triggering
-- events for floodlight tracking. If you leave this field blank, the
-- default value for your account will be used. Acceptable values are 0 to
-- 90, inclusive.
lcClickDuration :: Lens' LookbackConfiguration (Maybe Int32)
lcClickDuration
= lens _lcClickDuration
(\ s a -> s{_lcClickDuration = a})
. mapping _Coerce
-- | Lookback window, in days, from the last time a given user viewed one of
-- your ads. If you enter 0, impressions will not be considered as
-- triggering events for floodlight tracking. If you leave this field
-- blank, the default value for your account will be used. Acceptable
-- values are 0 to 90, inclusive.
lcPostImpressionActivitiesDuration :: Lens' LookbackConfiguration (Maybe Int32)
lcPostImpressionActivitiesDuration
= lens _lcPostImpressionActivitiesDuration
(\ s a -> s{_lcPostImpressionActivitiesDuration = a})
. mapping _Coerce
instance FromJSON LookbackConfiguration where
parseJSON
= withObject "LookbackConfiguration"
(\ o ->
LookbackConfiguration' <$>
(o .:? "clickDuration") <*>
(o .:? "postImpressionActivitiesDuration"))
instance ToJSON LookbackConfiguration where
toJSON LookbackConfiguration'{..}
= object
(catMaybes
[("clickDuration" .=) <$> _lcClickDuration,
("postImpressionActivitiesDuration" .=) <$>
_lcPostImpressionActivitiesDuration])
-- | Publisher Dynamic Tag
--
-- /See:/ 'floodlightActivityPublisherDynamicTag' smart constructor.
data FloodlightActivityPublisherDynamicTag =
FloodlightActivityPublisherDynamicTag'
{ _fapdtClickThrough :: !(Maybe Bool)
, _fapdtSiteIdDimensionValue :: !(Maybe DimensionValue)
, _fapdtDynamicTag :: !(Maybe FloodlightActivityDynamicTag)
, _fapdtDirectorySiteId :: !(Maybe (Textual Int64))
, _fapdtSiteId :: !(Maybe (Textual Int64))
, _fapdtViewThrough :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightActivityPublisherDynamicTag' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fapdtClickThrough'
--
-- * 'fapdtSiteIdDimensionValue'
--
-- * 'fapdtDynamicTag'
--
-- * 'fapdtDirectorySiteId'
--
-- * 'fapdtSiteId'
--
-- * 'fapdtViewThrough'
floodlightActivityPublisherDynamicTag
:: FloodlightActivityPublisherDynamicTag
floodlightActivityPublisherDynamicTag =
FloodlightActivityPublisherDynamicTag'
{ _fapdtClickThrough = Nothing
, _fapdtSiteIdDimensionValue = Nothing
, _fapdtDynamicTag = Nothing
, _fapdtDirectorySiteId = Nothing
, _fapdtSiteId = Nothing
, _fapdtViewThrough = Nothing
}
-- | Whether this tag is applicable only for click-throughs.
fapdtClickThrough :: Lens' FloodlightActivityPublisherDynamicTag (Maybe Bool)
fapdtClickThrough
= lens _fapdtClickThrough
(\ s a -> s{_fapdtClickThrough = a})
-- | Dimension value for the ID of the site. This is a read-only,
-- auto-generated field.
fapdtSiteIdDimensionValue :: Lens' FloodlightActivityPublisherDynamicTag (Maybe DimensionValue)
fapdtSiteIdDimensionValue
= lens _fapdtSiteIdDimensionValue
(\ s a -> s{_fapdtSiteIdDimensionValue = a})
-- | Dynamic floodlight tag.
fapdtDynamicTag :: Lens' FloodlightActivityPublisherDynamicTag (Maybe FloodlightActivityDynamicTag)
fapdtDynamicTag
= lens _fapdtDynamicTag
(\ s a -> s{_fapdtDynamicTag = a})
-- | Directory site ID of this dynamic tag. This is a write-only field that
-- can be used as an alternative to the siteId field. When this resource is
-- retrieved, only the siteId field will be populated.
fapdtDirectorySiteId :: Lens' FloodlightActivityPublisherDynamicTag (Maybe Int64)
fapdtDirectorySiteId
= lens _fapdtDirectorySiteId
(\ s a -> s{_fapdtDirectorySiteId = a})
. mapping _Coerce
-- | Site ID of this dynamic tag.
fapdtSiteId :: Lens' FloodlightActivityPublisherDynamicTag (Maybe Int64)
fapdtSiteId
= lens _fapdtSiteId (\ s a -> s{_fapdtSiteId = a}) .
mapping _Coerce
-- | Whether this tag is applicable only for view-throughs.
fapdtViewThrough :: Lens' FloodlightActivityPublisherDynamicTag (Maybe Bool)
fapdtViewThrough
= lens _fapdtViewThrough
(\ s a -> s{_fapdtViewThrough = a})
instance FromJSON
FloodlightActivityPublisherDynamicTag
where
parseJSON
= withObject "FloodlightActivityPublisherDynamicTag"
(\ o ->
FloodlightActivityPublisherDynamicTag' <$>
(o .:? "clickThrough") <*>
(o .:? "siteIdDimensionValue")
<*> (o .:? "dynamicTag")
<*> (o .:? "directorySiteId")
<*> (o .:? "siteId")
<*> (o .:? "viewThrough"))
instance ToJSON FloodlightActivityPublisherDynamicTag
where
toJSON FloodlightActivityPublisherDynamicTag'{..}
= object
(catMaybes
[("clickThrough" .=) <$> _fapdtClickThrough,
("siteIdDimensionValue" .=) <$>
_fapdtSiteIdDimensionValue,
("dynamicTag" .=) <$> _fapdtDynamicTag,
("directorySiteId" .=) <$> _fapdtDirectorySiteId,
("siteId" .=) <$> _fapdtSiteId,
("viewThrough" .=) <$> _fapdtViewThrough])
-- | Gets a summary of active ads in an account.
--
-- /See:/ 'accountActiveAdSummary' smart constructor.
data AccountActiveAdSummary =
AccountActiveAdSummary'
{ _aaasAvailableAds :: !(Maybe (Textual Int64))
, _aaasKind :: !(Maybe Text)
, _aaasAccountId :: !(Maybe (Textual Int64))
, _aaasActiveAds :: !(Maybe (Textual Int64))
, _aaasActiveAdsLimitTier :: !(Maybe AccountActiveAdSummaryActiveAdsLimitTier)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AccountActiveAdSummary' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aaasAvailableAds'
--
-- * 'aaasKind'
--
-- * 'aaasAccountId'
--
-- * 'aaasActiveAds'
--
-- * 'aaasActiveAdsLimitTier'
accountActiveAdSummary
:: AccountActiveAdSummary
accountActiveAdSummary =
AccountActiveAdSummary'
{ _aaasAvailableAds = Nothing
, _aaasKind = Nothing
, _aaasAccountId = Nothing
, _aaasActiveAds = Nothing
, _aaasActiveAdsLimitTier = Nothing
}
-- | Ads that can be activated for the account.
aaasAvailableAds :: Lens' AccountActiveAdSummary (Maybe Int64)
aaasAvailableAds
= lens _aaasAvailableAds
(\ s a -> s{_aaasAvailableAds = a})
. mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#accountActiveAdSummary\".
aaasKind :: Lens' AccountActiveAdSummary (Maybe Text)
aaasKind = lens _aaasKind (\ s a -> s{_aaasKind = a})
-- | ID of the account.
aaasAccountId :: Lens' AccountActiveAdSummary (Maybe Int64)
aaasAccountId
= lens _aaasAccountId
(\ s a -> s{_aaasAccountId = a})
. mapping _Coerce
-- | Ads that have been activated for the account
aaasActiveAds :: Lens' AccountActiveAdSummary (Maybe Int64)
aaasActiveAds
= lens _aaasActiveAds
(\ s a -> s{_aaasActiveAds = a})
. mapping _Coerce
-- | Maximum number of active ads allowed for the account.
aaasActiveAdsLimitTier :: Lens' AccountActiveAdSummary (Maybe AccountActiveAdSummaryActiveAdsLimitTier)
aaasActiveAdsLimitTier
= lens _aaasActiveAdsLimitTier
(\ s a -> s{_aaasActiveAdsLimitTier = a})
instance FromJSON AccountActiveAdSummary where
parseJSON
= withObject "AccountActiveAdSummary"
(\ o ->
AccountActiveAdSummary' <$>
(o .:? "availableAds") <*> (o .:? "kind") <*>
(o .:? "accountId")
<*> (o .:? "activeAds")
<*> (o .:? "activeAdsLimitTier"))
instance ToJSON AccountActiveAdSummary where
toJSON AccountActiveAdSummary'{..}
= object
(catMaybes
[("availableAds" .=) <$> _aaasAvailableAds,
("kind" .=) <$> _aaasKind,
("accountId" .=) <$> _aaasAccountId,
("activeAds" .=) <$> _aaasActiveAds,
("activeAdsLimitTier" .=) <$>
_aaasActiveAdsLimitTier])
-- | Offset Position.
--
-- /See:/ 'offSetPosition' smart constructor.
data OffSetPosition =
OffSetPosition'
{ _ospLeft :: !(Maybe (Textual Int32))
, _ospTop :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OffSetPosition' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ospLeft'
--
-- * 'ospTop'
offSetPosition
:: OffSetPosition
offSetPosition = OffSetPosition' {_ospLeft = Nothing, _ospTop = Nothing}
-- | Offset distance from left side of an asset or a window.
ospLeft :: Lens' OffSetPosition (Maybe Int32)
ospLeft
= lens _ospLeft (\ s a -> s{_ospLeft = a}) .
mapping _Coerce
-- | Offset distance from top side of an asset or a window.
ospTop :: Lens' OffSetPosition (Maybe Int32)
ospTop
= lens _ospTop (\ s a -> s{_ospTop = a}) .
mapping _Coerce
instance FromJSON OffSetPosition where
parseJSON
= withObject "OffSetPosition"
(\ o ->
OffSetPosition' <$> (o .:? "left") <*> (o .:? "top"))
instance ToJSON OffSetPosition where
toJSON OffSetPosition'{..}
= object
(catMaybes
[("left" .=) <$> _ospLeft, ("top" .=) <$> _ospTop])
-- | Represents a metric.
--
-- /See:/ 'metric' smart constructor.
data Metric =
Metric'
{ _mKind :: !(Maybe Text)
, _mName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Metric' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mKind'
--
-- * 'mName'
metric
:: Metric
metric = Metric' {_mKind = Nothing, _mName = Nothing}
-- | The kind of resource this is, in this case dfareporting#metric.
mKind :: Lens' Metric (Maybe Text)
mKind = lens _mKind (\ s a -> s{_mKind = a})
-- | The metric name, e.g. dfa:impressions
mName :: Lens' Metric (Maybe Text)
mName = lens _mName (\ s a -> s{_mName = a})
instance FromJSON Metric where
parseJSON
= withObject "Metric"
(\ o ->
Metric' <$> (o .:? "kind") <*> (o .:? "name"))
instance ToJSON Metric where
toJSON Metric'{..}
= object
(catMaybes
[("kind" .=) <$> _mKind, ("name" .=) <$> _mName])
-- | Contains properties of a remarketing list\'s sharing information.
-- Sharing allows other accounts or advertisers to target to your
-- remarketing lists. This resource can be used to manage remarketing list
-- sharing to other accounts and advertisers.
--
-- /See:/ 'remarketingListShare' smart constructor.
data RemarketingListShare =
RemarketingListShare'
{ _rlsSharedAdvertiserIds :: !(Maybe [Textual Int64])
, _rlsKind :: !(Maybe Text)
, _rlsRemarketingListId :: !(Maybe (Textual Int64))
, _rlsSharedAccountIds :: !(Maybe [Textual Int64])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'RemarketingListShare' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rlsSharedAdvertiserIds'
--
-- * 'rlsKind'
--
-- * 'rlsRemarketingListId'
--
-- * 'rlsSharedAccountIds'
remarketingListShare
:: RemarketingListShare
remarketingListShare =
RemarketingListShare'
{ _rlsSharedAdvertiserIds = Nothing
, _rlsKind = Nothing
, _rlsRemarketingListId = Nothing
, _rlsSharedAccountIds = Nothing
}
-- | Advertisers that the remarketing list is shared with.
rlsSharedAdvertiserIds :: Lens' RemarketingListShare [Int64]
rlsSharedAdvertiserIds
= lens _rlsSharedAdvertiserIds
(\ s a -> s{_rlsSharedAdvertiserIds = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#remarketingListShare\".
rlsKind :: Lens' RemarketingListShare (Maybe Text)
rlsKind = lens _rlsKind (\ s a -> s{_rlsKind = a})
-- | Remarketing list ID. This is a read-only, auto-generated field.
rlsRemarketingListId :: Lens' RemarketingListShare (Maybe Int64)
rlsRemarketingListId
= lens _rlsRemarketingListId
(\ s a -> s{_rlsRemarketingListId = a})
. mapping _Coerce
-- | Accounts that the remarketing list is shared with.
rlsSharedAccountIds :: Lens' RemarketingListShare [Int64]
rlsSharedAccountIds
= lens _rlsSharedAccountIds
(\ s a -> s{_rlsSharedAccountIds = a})
. _Default
. _Coerce
instance FromJSON RemarketingListShare where
parseJSON
= withObject "RemarketingListShare"
(\ o ->
RemarketingListShare' <$>
(o .:? "sharedAdvertiserIds" .!= mempty) <*>
(o .:? "kind")
<*> (o .:? "remarketingListId")
<*> (o .:? "sharedAccountIds" .!= mempty))
instance ToJSON RemarketingListShare where
toJSON RemarketingListShare'{..}
= object
(catMaybes
[("sharedAdvertiserIds" .=) <$>
_rlsSharedAdvertiserIds,
("kind" .=) <$> _rlsKind,
("remarketingListId" .=) <$> _rlsRemarketingListId,
("sharedAccountIds" .=) <$> _rlsSharedAccountIds])
-- | Event Tag List Response
--
-- /See:/ 'eventTagsListResponse' smart constructor.
data EventTagsListResponse =
EventTagsListResponse'
{ _etlrKind :: !(Maybe Text)
, _etlrEventTags :: !(Maybe [EventTag])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'EventTagsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'etlrKind'
--
-- * 'etlrEventTags'
eventTagsListResponse
:: EventTagsListResponse
eventTagsListResponse =
EventTagsListResponse' {_etlrKind = Nothing, _etlrEventTags = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#eventTagsListResponse\".
etlrKind :: Lens' EventTagsListResponse (Maybe Text)
etlrKind = lens _etlrKind (\ s a -> s{_etlrKind = a})
-- | Event tag collection.
etlrEventTags :: Lens' EventTagsListResponse [EventTag]
etlrEventTags
= lens _etlrEventTags
(\ s a -> s{_etlrEventTags = a})
. _Default
. _Coerce
instance FromJSON EventTagsListResponse where
parseJSON
= withObject "EventTagsListResponse"
(\ o ->
EventTagsListResponse' <$>
(o .:? "kind") <*> (o .:? "eventTags" .!= mempty))
instance ToJSON EventTagsListResponse where
toJSON EventTagsListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _etlrKind,
("eventTags" .=) <$> _etlrEventTags])
-- | User Role List Response
--
-- /See:/ 'userRolesListResponse' smart constructor.
data UserRolesListResponse =
UserRolesListResponse'
{ _urlrNextPageToken :: !(Maybe Text)
, _urlrKind :: !(Maybe Text)
, _urlrUserRoles :: !(Maybe [UserRole])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UserRolesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'urlrNextPageToken'
--
-- * 'urlrKind'
--
-- * 'urlrUserRoles'
userRolesListResponse
:: UserRolesListResponse
userRolesListResponse =
UserRolesListResponse'
{ _urlrNextPageToken = Nothing
, _urlrKind = Nothing
, _urlrUserRoles = Nothing
}
-- | Pagination token to be used for the next list operation.
urlrNextPageToken :: Lens' UserRolesListResponse (Maybe Text)
urlrNextPageToken
= lens _urlrNextPageToken
(\ s a -> s{_urlrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#userRolesListResponse\".
urlrKind :: Lens' UserRolesListResponse (Maybe Text)
urlrKind = lens _urlrKind (\ s a -> s{_urlrKind = a})
-- | User role collection.
urlrUserRoles :: Lens' UserRolesListResponse [UserRole]
urlrUserRoles
= lens _urlrUserRoles
(\ s a -> s{_urlrUserRoles = a})
. _Default
. _Coerce
instance FromJSON UserRolesListResponse where
parseJSON
= withObject "UserRolesListResponse"
(\ o ->
UserRolesListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "userRoles" .!= mempty))
instance ToJSON UserRolesListResponse where
toJSON UserRolesListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _urlrNextPageToken,
("kind" .=) <$> _urlrKind,
("userRoles" .=) <$> _urlrUserRoles])
-- | Represents a response to the queryCompatibleFields method.
--
-- /See:/ 'compatibleFields' smart constructor.
data CompatibleFields =
CompatibleFields'
{ _cfPathReportCompatibleFields :: !(Maybe PathReportCompatibleFields)
, _cfReachReportCompatibleFields :: !(Maybe ReachReportCompatibleFields)
, _cfCrossDimensionReachReportCompatibleFields :: !(Maybe CrossDimensionReachReportCompatibleFields)
, _cfPathAttributionReportCompatibleFields :: !(Maybe PathReportCompatibleFields)
, _cfKind :: !(Maybe Text)
, _cfFloodlightReportCompatibleFields :: !(Maybe FloodlightReportCompatibleFields)
, _cfReportCompatibleFields :: !(Maybe ReportCompatibleFields)
, _cfPathToConversionReportCompatibleFields :: !(Maybe PathToConversionReportCompatibleFields)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CompatibleFields' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cfPathReportCompatibleFields'
--
-- * 'cfReachReportCompatibleFields'
--
-- * 'cfCrossDimensionReachReportCompatibleFields'
--
-- * 'cfPathAttributionReportCompatibleFields'
--
-- * 'cfKind'
--
-- * 'cfFloodlightReportCompatibleFields'
--
-- * 'cfReportCompatibleFields'
--
-- * 'cfPathToConversionReportCompatibleFields'
compatibleFields
:: CompatibleFields
compatibleFields =
CompatibleFields'
{ _cfPathReportCompatibleFields = Nothing
, _cfReachReportCompatibleFields = Nothing
, _cfCrossDimensionReachReportCompatibleFields = Nothing
, _cfPathAttributionReportCompatibleFields = Nothing
, _cfKind = Nothing
, _cfFloodlightReportCompatibleFields = Nothing
, _cfReportCompatibleFields = Nothing
, _cfPathToConversionReportCompatibleFields = Nothing
}
-- | Contains items that are compatible to be selected for a report of type
-- \"PATH\".
cfPathReportCompatibleFields :: Lens' CompatibleFields (Maybe PathReportCompatibleFields)
cfPathReportCompatibleFields
= lens _cfPathReportCompatibleFields
(\ s a -> s{_cfPathReportCompatibleFields = a})
-- | Contains items that are compatible to be selected for a report of type
-- \"REACH\".
cfReachReportCompatibleFields :: Lens' CompatibleFields (Maybe ReachReportCompatibleFields)
cfReachReportCompatibleFields
= lens _cfReachReportCompatibleFields
(\ s a -> s{_cfReachReportCompatibleFields = a})
-- | Contains items that are compatible to be selected for a report of type
-- \"CROSS_DIMENSION_REACH\".
cfCrossDimensionReachReportCompatibleFields :: Lens' CompatibleFields (Maybe CrossDimensionReachReportCompatibleFields)
cfCrossDimensionReachReportCompatibleFields
= lens _cfCrossDimensionReachReportCompatibleFields
(\ s a ->
s{_cfCrossDimensionReachReportCompatibleFields = a})
-- | Contains items that are compatible to be selected for a report of type
-- \"PATH_ATTRIBUTION\".
cfPathAttributionReportCompatibleFields :: Lens' CompatibleFields (Maybe PathReportCompatibleFields)
cfPathAttributionReportCompatibleFields
= lens _cfPathAttributionReportCompatibleFields
(\ s a ->
s{_cfPathAttributionReportCompatibleFields = a})
-- | The kind of resource this is, in this case
-- dfareporting#compatibleFields.
cfKind :: Lens' CompatibleFields (Maybe Text)
cfKind = lens _cfKind (\ s a -> s{_cfKind = a})
-- | Contains items that are compatible to be selected for a report of type
-- \"FLOODLIGHT\".
cfFloodlightReportCompatibleFields :: Lens' CompatibleFields (Maybe FloodlightReportCompatibleFields)
cfFloodlightReportCompatibleFields
= lens _cfFloodlightReportCompatibleFields
(\ s a -> s{_cfFloodlightReportCompatibleFields = a})
-- | Contains items that are compatible to be selected for a report of type
-- \"STANDARD\".
cfReportCompatibleFields :: Lens' CompatibleFields (Maybe ReportCompatibleFields)
cfReportCompatibleFields
= lens _cfReportCompatibleFields
(\ s a -> s{_cfReportCompatibleFields = a})
-- | Contains items that are compatible to be selected for a report of type
-- \"PATH_TO_CONVERSION\".
cfPathToConversionReportCompatibleFields :: Lens' CompatibleFields (Maybe PathToConversionReportCompatibleFields)
cfPathToConversionReportCompatibleFields
= lens _cfPathToConversionReportCompatibleFields
(\ s a ->
s{_cfPathToConversionReportCompatibleFields = a})
instance FromJSON CompatibleFields where
parseJSON
= withObject "CompatibleFields"
(\ o ->
CompatibleFields' <$>
(o .:? "pathReportCompatibleFields") <*>
(o .:? "reachReportCompatibleFields")
<*>
(o .:? "crossDimensionReachReportCompatibleFields")
<*> (o .:? "pathAttributionReportCompatibleFields")
<*> (o .:? "kind")
<*> (o .:? "floodlightReportCompatibleFields")
<*> (o .:? "reportCompatibleFields")
<*> (o .:? "pathToConversionReportCompatibleFields"))
instance ToJSON CompatibleFields where
toJSON CompatibleFields'{..}
= object
(catMaybes
[("pathReportCompatibleFields" .=) <$>
_cfPathReportCompatibleFields,
("reachReportCompatibleFields" .=) <$>
_cfReachReportCompatibleFields,
("crossDimensionReachReportCompatibleFields" .=) <$>
_cfCrossDimensionReachReportCompatibleFields,
("pathAttributionReportCompatibleFields" .=) <$>
_cfPathAttributionReportCompatibleFields,
("kind" .=) <$> _cfKind,
("floodlightReportCompatibleFields" .=) <$>
_cfFloodlightReportCompatibleFields,
("reportCompatibleFields" .=) <$>
_cfReportCompatibleFields,
("pathToConversionReportCompatibleFields" .=) <$>
_cfPathToConversionReportCompatibleFields])
-- | Audience Segment.
--
-- /See:/ 'audienceSegment' smart constructor.
data AudienceSegment =
AudienceSegment'
{ _asName :: !(Maybe Text)
, _asId :: !(Maybe (Textual Int64))
, _asAllocation :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AudienceSegment' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'asName'
--
-- * 'asId'
--
-- * 'asAllocation'
audienceSegment
:: AudienceSegment
audienceSegment =
AudienceSegment' {_asName = Nothing, _asId = Nothing, _asAllocation = Nothing}
-- | Name of this audience segment. This is a required field and must be less
-- than 65 characters long.
asName :: Lens' AudienceSegment (Maybe Text)
asName = lens _asName (\ s a -> s{_asName = a})
-- | ID of this audience segment. This is a read-only, auto-generated field.
asId :: Lens' AudienceSegment (Maybe Int64)
asId
= lens _asId (\ s a -> s{_asId = a}) .
mapping _Coerce
-- | Weight allocated to this segment. The weight assigned will be understood
-- in proportion to the weights assigned to other segments in the same
-- segment group. Acceptable values are 1 to 1000, inclusive.
asAllocation :: Lens' AudienceSegment (Maybe Int32)
asAllocation
= lens _asAllocation (\ s a -> s{_asAllocation = a})
. mapping _Coerce
instance FromJSON AudienceSegment where
parseJSON
= withObject "AudienceSegment"
(\ o ->
AudienceSegment' <$>
(o .:? "name") <*> (o .:? "id") <*>
(o .:? "allocation"))
instance ToJSON AudienceSegment where
toJSON AudienceSegment'{..}
= object
(catMaybes
[("name" .=) <$> _asName, ("id" .=) <$> _asId,
("allocation" .=) <$> _asAllocation])
-- | Update Conversions Request.
--
-- /See:/ 'conversionsBatchUpdateRequest' smart constructor.
data ConversionsBatchUpdateRequest =
ConversionsBatchUpdateRequest'
{ _cburbKind :: !(Maybe Text)
, _cburbConversions :: !(Maybe [Conversion])
, _cburbEncryptionInfo :: !(Maybe EncryptionInfo)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ConversionsBatchUpdateRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cburbKind'
--
-- * 'cburbConversions'
--
-- * 'cburbEncryptionInfo'
conversionsBatchUpdateRequest
:: ConversionsBatchUpdateRequest
conversionsBatchUpdateRequest =
ConversionsBatchUpdateRequest'
{ _cburbKind = Nothing
, _cburbConversions = Nothing
, _cburbEncryptionInfo = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#conversionsBatchUpdateRequest\".
cburbKind :: Lens' ConversionsBatchUpdateRequest (Maybe Text)
cburbKind
= lens _cburbKind (\ s a -> s{_cburbKind = a})
-- | The set of conversions to update.
cburbConversions :: Lens' ConversionsBatchUpdateRequest [Conversion]
cburbConversions
= lens _cburbConversions
(\ s a -> s{_cburbConversions = a})
. _Default
. _Coerce
-- | Describes how encryptedUserId is encrypted. This is a required field if
-- encryptedUserId is used.
cburbEncryptionInfo :: Lens' ConversionsBatchUpdateRequest (Maybe EncryptionInfo)
cburbEncryptionInfo
= lens _cburbEncryptionInfo
(\ s a -> s{_cburbEncryptionInfo = a})
instance FromJSON ConversionsBatchUpdateRequest where
parseJSON
= withObject "ConversionsBatchUpdateRequest"
(\ o ->
ConversionsBatchUpdateRequest' <$>
(o .:? "kind") <*> (o .:? "conversions" .!= mempty)
<*> (o .:? "encryptionInfo"))
instance ToJSON ConversionsBatchUpdateRequest where
toJSON ConversionsBatchUpdateRequest'{..}
= object
(catMaybes
[("kind" .=) <$> _cburbKind,
("conversions" .=) <$> _cburbConversions,
("encryptionInfo" .=) <$> _cburbEncryptionInfo])
-- | Google Ad Manager Settings
--
-- /See:/ 'dfpSettings' smart constructor.
data DfpSettings =
DfpSettings'
{ _dsPubPaidPlacementAccepted :: !(Maybe Bool)
, _dsDfpNetworkName :: !(Maybe Text)
, _dsPublisherPortalOnly :: !(Maybe Bool)
, _dsProgrammaticPlacementAccepted :: !(Maybe Bool)
, _dsDfpNetworkCode :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DfpSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dsPubPaidPlacementAccepted'
--
-- * 'dsDfpNetworkName'
--
-- * 'dsPublisherPortalOnly'
--
-- * 'dsProgrammaticPlacementAccepted'
--
-- * 'dsDfpNetworkCode'
dfpSettings
:: DfpSettings
dfpSettings =
DfpSettings'
{ _dsPubPaidPlacementAccepted = Nothing
, _dsDfpNetworkName = Nothing
, _dsPublisherPortalOnly = Nothing
, _dsProgrammaticPlacementAccepted = Nothing
, _dsDfpNetworkCode = Nothing
}
-- | Whether this directory site accepts publisher-paid tags.
dsPubPaidPlacementAccepted :: Lens' DfpSettings (Maybe Bool)
dsPubPaidPlacementAccepted
= lens _dsPubPaidPlacementAccepted
(\ s a -> s{_dsPubPaidPlacementAccepted = a})
-- | Ad Manager network name for this directory site.
dsDfpNetworkName :: Lens' DfpSettings (Maybe Text)
dsDfpNetworkName
= lens _dsDfpNetworkName
(\ s a -> s{_dsDfpNetworkName = a})
-- | Whether this directory site is available only via Publisher Portal.
dsPublisherPortalOnly :: Lens' DfpSettings (Maybe Bool)
dsPublisherPortalOnly
= lens _dsPublisherPortalOnly
(\ s a -> s{_dsPublisherPortalOnly = a})
-- | Whether this directory site accepts programmatic placements.
dsProgrammaticPlacementAccepted :: Lens' DfpSettings (Maybe Bool)
dsProgrammaticPlacementAccepted
= lens _dsProgrammaticPlacementAccepted
(\ s a -> s{_dsProgrammaticPlacementAccepted = a})
-- | Ad Manager network code for this directory site.
dsDfpNetworkCode :: Lens' DfpSettings (Maybe Text)
dsDfpNetworkCode
= lens _dsDfpNetworkCode
(\ s a -> s{_dsDfpNetworkCode = a})
instance FromJSON DfpSettings where
parseJSON
= withObject "DfpSettings"
(\ o ->
DfpSettings' <$>
(o .:? "pubPaidPlacementAccepted") <*>
(o .:? "dfpNetworkName")
<*> (o .:? "publisherPortalOnly")
<*> (o .:? "programmaticPlacementAccepted")
<*> (o .:? "dfpNetworkCode"))
instance ToJSON DfpSettings where
toJSON DfpSettings'{..}
= object
(catMaybes
[("pubPaidPlacementAccepted" .=) <$>
_dsPubPaidPlacementAccepted,
("dfpNetworkName" .=) <$> _dsDfpNetworkName,
("publisherPortalOnly" .=) <$>
_dsPublisherPortalOnly,
("programmaticPlacementAccepted" .=) <$>
_dsProgrammaticPlacementAccepted,
("dfpNetworkCode" .=) <$> _dsDfpNetworkCode])
-- | Represents fields that are compatible to be selected for a report of
-- type \"PATH_TO_CONVERSION\".
--
-- /See:/ 'pathToConversionReportCompatibleFields' smart constructor.
data PathToConversionReportCompatibleFields =
PathToConversionReportCompatibleFields'
{ _ptcrcfMetrics :: !(Maybe [Metric])
, _ptcrcfKind :: !(Maybe Text)
, _ptcrcfConversionDimensions :: !(Maybe [Dimension])
, _ptcrcfCustomFloodlightVariables :: !(Maybe [Dimension])
, _ptcrcfPerInteractionDimensions :: !(Maybe [Dimension])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PathToConversionReportCompatibleFields' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ptcrcfMetrics'
--
-- * 'ptcrcfKind'
--
-- * 'ptcrcfConversionDimensions'
--
-- * 'ptcrcfCustomFloodlightVariables'
--
-- * 'ptcrcfPerInteractionDimensions'
pathToConversionReportCompatibleFields
:: PathToConversionReportCompatibleFields
pathToConversionReportCompatibleFields =
PathToConversionReportCompatibleFields'
{ _ptcrcfMetrics = Nothing
, _ptcrcfKind = Nothing
, _ptcrcfConversionDimensions = Nothing
, _ptcrcfCustomFloodlightVariables = Nothing
, _ptcrcfPerInteractionDimensions = Nothing
}
-- | Metrics which are compatible to be selected in the \"metricNames\"
-- section of the report.
ptcrcfMetrics :: Lens' PathToConversionReportCompatibleFields [Metric]
ptcrcfMetrics
= lens _ptcrcfMetrics
(\ s a -> s{_ptcrcfMetrics = a})
. _Default
. _Coerce
-- | The kind of resource this is, in this case
-- dfareporting#pathToConversionReportCompatibleFields.
ptcrcfKind :: Lens' PathToConversionReportCompatibleFields (Maybe Text)
ptcrcfKind
= lens _ptcrcfKind (\ s a -> s{_ptcrcfKind = a})
-- | Conversion dimensions which are compatible to be selected in the
-- \"conversionDimensions\" section of the report.
ptcrcfConversionDimensions :: Lens' PathToConversionReportCompatibleFields [Dimension]
ptcrcfConversionDimensions
= lens _ptcrcfConversionDimensions
(\ s a -> s{_ptcrcfConversionDimensions = a})
. _Default
. _Coerce
-- | Custom floodlight variables which are compatible to be selected in the
-- \"customFloodlightVariables\" section of the report.
ptcrcfCustomFloodlightVariables :: Lens' PathToConversionReportCompatibleFields [Dimension]
ptcrcfCustomFloodlightVariables
= lens _ptcrcfCustomFloodlightVariables
(\ s a -> s{_ptcrcfCustomFloodlightVariables = a})
. _Default
. _Coerce
-- | Per-interaction dimensions which are compatible to be selected in the
-- \"perInteractionDimensions\" section of the report.
ptcrcfPerInteractionDimensions :: Lens' PathToConversionReportCompatibleFields [Dimension]
ptcrcfPerInteractionDimensions
= lens _ptcrcfPerInteractionDimensions
(\ s a -> s{_ptcrcfPerInteractionDimensions = a})
. _Default
. _Coerce
instance FromJSON
PathToConversionReportCompatibleFields
where
parseJSON
= withObject "PathToConversionReportCompatibleFields"
(\ o ->
PathToConversionReportCompatibleFields' <$>
(o .:? "metrics" .!= mempty) <*> (o .:? "kind") <*>
(o .:? "conversionDimensions" .!= mempty)
<*> (o .:? "customFloodlightVariables" .!= mempty)
<*> (o .:? "perInteractionDimensions" .!= mempty))
instance ToJSON
PathToConversionReportCompatibleFields
where
toJSON PathToConversionReportCompatibleFields'{..}
= object
(catMaybes
[("metrics" .=) <$> _ptcrcfMetrics,
("kind" .=) <$> _ptcrcfKind,
("conversionDimensions" .=) <$>
_ptcrcfConversionDimensions,
("customFloodlightVariables" .=) <$>
_ptcrcfCustomFloodlightVariables,
("perInteractionDimensions" .=) <$>
_ptcrcfPerInteractionDimensions])
-- | Contains information about a city that can be targeted by ads.
--
-- /See:/ 'city' smart constructor.
data City =
City'
{ _ccMetroCode :: !(Maybe Text)
, _ccRegionCode :: !(Maybe Text)
, _ccKind :: !(Maybe Text)
, _ccRegionDartId :: !(Maybe (Textual Int64))
, _ccMetroDmaId :: !(Maybe (Textual Int64))
, _ccName :: !(Maybe Text)
, _ccCountryCode :: !(Maybe Text)
, _ccCountryDartId :: !(Maybe (Textual Int64))
, _ccDartId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'City' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ccMetroCode'
--
-- * 'ccRegionCode'
--
-- * 'ccKind'
--
-- * 'ccRegionDartId'
--
-- * 'ccMetroDmaId'
--
-- * 'ccName'
--
-- * 'ccCountryCode'
--
-- * 'ccCountryDartId'
--
-- * 'ccDartId'
city
:: City
city =
City'
{ _ccMetroCode = Nothing
, _ccRegionCode = Nothing
, _ccKind = Nothing
, _ccRegionDartId = Nothing
, _ccMetroDmaId = Nothing
, _ccName = Nothing
, _ccCountryCode = Nothing
, _ccCountryDartId = Nothing
, _ccDartId = Nothing
}
-- | Metro region code of the metro region (DMA) to which this city belongs.
ccMetroCode :: Lens' City (Maybe Text)
ccMetroCode
= lens _ccMetroCode (\ s a -> s{_ccMetroCode = a})
-- | Region code of the region to which this city belongs.
ccRegionCode :: Lens' City (Maybe Text)
ccRegionCode
= lens _ccRegionCode (\ s a -> s{_ccRegionCode = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#city\".
ccKind :: Lens' City (Maybe Text)
ccKind = lens _ccKind (\ s a -> s{_ccKind = a})
-- | DART ID of the region to which this city belongs.
ccRegionDartId :: Lens' City (Maybe Int64)
ccRegionDartId
= lens _ccRegionDartId
(\ s a -> s{_ccRegionDartId = a})
. mapping _Coerce
-- | ID of the metro region (DMA) to which this city belongs.
ccMetroDmaId :: Lens' City (Maybe Int64)
ccMetroDmaId
= lens _ccMetroDmaId (\ s a -> s{_ccMetroDmaId = a})
. mapping _Coerce
-- | Name of this city.
ccName :: Lens' City (Maybe Text)
ccName = lens _ccName (\ s a -> s{_ccName = a})
-- | Country code of the country to which this city belongs.
ccCountryCode :: Lens' City (Maybe Text)
ccCountryCode
= lens _ccCountryCode
(\ s a -> s{_ccCountryCode = a})
-- | DART ID of the country to which this city belongs.
ccCountryDartId :: Lens' City (Maybe Int64)
ccCountryDartId
= lens _ccCountryDartId
(\ s a -> s{_ccCountryDartId = a})
. mapping _Coerce
-- | DART ID of this city. This is the ID used for targeting and generating
-- reports.
ccDartId :: Lens' City (Maybe Int64)
ccDartId
= lens _ccDartId (\ s a -> s{_ccDartId = a}) .
mapping _Coerce
instance FromJSON City where
parseJSON
= withObject "City"
(\ o ->
City' <$>
(o .:? "metroCode") <*> (o .:? "regionCode") <*>
(o .:? "kind")
<*> (o .:? "regionDartId")
<*> (o .:? "metroDmaId")
<*> (o .:? "name")
<*> (o .:? "countryCode")
<*> (o .:? "countryDartId")
<*> (o .:? "dartId"))
instance ToJSON City where
toJSON City'{..}
= object
(catMaybes
[("metroCode" .=) <$> _ccMetroCode,
("regionCode" .=) <$> _ccRegionCode,
("kind" .=) <$> _ccKind,
("regionDartId" .=) <$> _ccRegionDartId,
("metroDmaId" .=) <$> _ccMetroDmaId,
("name" .=) <$> _ccName,
("countryCode" .=) <$> _ccCountryCode,
("countryDartId" .=) <$> _ccCountryDartId,
("dartId" .=) <$> _ccDartId])
-- | Contains information about a platform type that can be targeted by ads.
--
-- /See:/ 'platformType' smart constructor.
data PlatformType =
PlatformType'
{ _ptKind :: !(Maybe Text)
, _ptName :: !(Maybe Text)
, _ptId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlatformType' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ptKind'
--
-- * 'ptName'
--
-- * 'ptId'
platformType
:: PlatformType
platformType =
PlatformType' {_ptKind = Nothing, _ptName = Nothing, _ptId = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#platformType\".
ptKind :: Lens' PlatformType (Maybe Text)
ptKind = lens _ptKind (\ s a -> s{_ptKind = a})
-- | Name of this platform type.
ptName :: Lens' PlatformType (Maybe Text)
ptName = lens _ptName (\ s a -> s{_ptName = a})
-- | ID of this platform type.
ptId :: Lens' PlatformType (Maybe Int64)
ptId
= lens _ptId (\ s a -> s{_ptId = a}) .
mapping _Coerce
instance FromJSON PlatformType where
parseJSON
= withObject "PlatformType"
(\ o ->
PlatformType' <$>
(o .:? "kind") <*> (o .:? "name") <*> (o .:? "id"))
instance ToJSON PlatformType where
toJSON PlatformType'{..}
= object
(catMaybes
[("kind" .=) <$> _ptKind, ("name" .=) <$> _ptName,
("id" .=) <$> _ptId])
-- | Key Value Targeting Expression.
--
-- /See:/ 'keyValueTargetingExpression' smart constructor.
newtype KeyValueTargetingExpression =
KeyValueTargetingExpression'
{ _kvteExpression :: Maybe Text
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'KeyValueTargetingExpression' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'kvteExpression'
keyValueTargetingExpression
:: KeyValueTargetingExpression
keyValueTargetingExpression =
KeyValueTargetingExpression' {_kvteExpression = Nothing}
-- | Keyword expression being targeted by the ad.
kvteExpression :: Lens' KeyValueTargetingExpression (Maybe Text)
kvteExpression
= lens _kvteExpression
(\ s a -> s{_kvteExpression = a})
instance FromJSON KeyValueTargetingExpression where
parseJSON
= withObject "KeyValueTargetingExpression"
(\ o ->
KeyValueTargetingExpression' <$>
(o .:? "expression"))
instance ToJSON KeyValueTargetingExpression where
toJSON KeyValueTargetingExpression'{..}
= object
(catMaybes [("expression" .=) <$> _kvteExpression])
-- | Companion Click-through override.
--
-- /See:/ 'companionClickThroughOverride' smart constructor.
data CompanionClickThroughOverride =
CompanionClickThroughOverride'
{ _cctoCreativeId :: !(Maybe (Textual Int64))
, _cctoClickThroughURL :: !(Maybe ClickThroughURL)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CompanionClickThroughOverride' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cctoCreativeId'
--
-- * 'cctoClickThroughURL'
companionClickThroughOverride
:: CompanionClickThroughOverride
companionClickThroughOverride =
CompanionClickThroughOverride'
{_cctoCreativeId = Nothing, _cctoClickThroughURL = Nothing}
-- | ID of the creative for this companion click-through override.
cctoCreativeId :: Lens' CompanionClickThroughOverride (Maybe Int64)
cctoCreativeId
= lens _cctoCreativeId
(\ s a -> s{_cctoCreativeId = a})
. mapping _Coerce
-- | Click-through URL of this companion click-through override.
cctoClickThroughURL :: Lens' CompanionClickThroughOverride (Maybe ClickThroughURL)
cctoClickThroughURL
= lens _cctoClickThroughURL
(\ s a -> s{_cctoClickThroughURL = a})
instance FromJSON CompanionClickThroughOverride where
parseJSON
= withObject "CompanionClickThroughOverride"
(\ o ->
CompanionClickThroughOverride' <$>
(o .:? "creativeId") <*> (o .:? "clickThroughUrl"))
instance ToJSON CompanionClickThroughOverride where
toJSON CompanionClickThroughOverride'{..}
= object
(catMaybes
[("creativeId" .=) <$> _cctoCreativeId,
("clickThroughUrl" .=) <$> _cctoClickThroughURL])
-- | Advertiser List Response
--
-- /See:/ 'advertisersListResponse' smart constructor.
data AdvertisersListResponse =
AdvertisersListResponse'
{ _advNextPageToken :: !(Maybe Text)
, _advKind :: !(Maybe Text)
, _advAdvertisers :: !(Maybe [Advertiser])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AdvertisersListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'advNextPageToken'
--
-- * 'advKind'
--
-- * 'advAdvertisers'
advertisersListResponse
:: AdvertisersListResponse
advertisersListResponse =
AdvertisersListResponse'
{_advNextPageToken = Nothing, _advKind = Nothing, _advAdvertisers = Nothing}
-- | Pagination token to be used for the next list operation.
advNextPageToken :: Lens' AdvertisersListResponse (Maybe Text)
advNextPageToken
= lens _advNextPageToken
(\ s a -> s{_advNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#advertisersListResponse\".
advKind :: Lens' AdvertisersListResponse (Maybe Text)
advKind = lens _advKind (\ s a -> s{_advKind = a})
-- | Advertiser collection.
advAdvertisers :: Lens' AdvertisersListResponse [Advertiser]
advAdvertisers
= lens _advAdvertisers
(\ s a -> s{_advAdvertisers = a})
. _Default
. _Coerce
instance FromJSON AdvertisersListResponse where
parseJSON
= withObject "AdvertisersListResponse"
(\ o ->
AdvertisersListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "advertisers" .!= mempty))
instance ToJSON AdvertisersListResponse where
toJSON AdvertisersListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _advNextPageToken,
("kind" .=) <$> _advKind,
("advertisers" .=) <$> _advAdvertisers])
-- | Country List Response
--
-- /See:/ 'countriesListResponse' smart constructor.
data CountriesListResponse =
CountriesListResponse'
{ _couKind :: !(Maybe Text)
, _couCountries :: !(Maybe [Country])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CountriesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'couKind'
--
-- * 'couCountries'
countriesListResponse
:: CountriesListResponse
countriesListResponse =
CountriesListResponse' {_couKind = Nothing, _couCountries = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#countriesListResponse\".
couKind :: Lens' CountriesListResponse (Maybe Text)
couKind = lens _couKind (\ s a -> s{_couKind = a})
-- | Country collection.
couCountries :: Lens' CountriesListResponse [Country]
couCountries
= lens _couCountries (\ s a -> s{_couCountries = a})
. _Default
. _Coerce
instance FromJSON CountriesListResponse where
parseJSON
= withObject "CountriesListResponse"
(\ o ->
CountriesListResponse' <$>
(o .:? "kind") <*> (o .:? "countries" .!= mempty))
instance ToJSON CountriesListResponse where
toJSON CountriesListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _couKind,
("countries" .=) <$> _couCountries])
-- | Account Permission Group List Response
--
-- /See:/ 'accountPermissionGroupsListResponse' smart constructor.
data AccountPermissionGroupsListResponse =
AccountPermissionGroupsListResponse'
{ _apglrKind :: !(Maybe Text)
, _apglrAccountPermissionGroups :: !(Maybe [AccountPermissionGroup])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AccountPermissionGroupsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'apglrKind'
--
-- * 'apglrAccountPermissionGroups'
accountPermissionGroupsListResponse
:: AccountPermissionGroupsListResponse
accountPermissionGroupsListResponse =
AccountPermissionGroupsListResponse'
{_apglrKind = Nothing, _apglrAccountPermissionGroups = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#accountPermissionGroupsListResponse\".
apglrKind :: Lens' AccountPermissionGroupsListResponse (Maybe Text)
apglrKind
= lens _apglrKind (\ s a -> s{_apglrKind = a})
-- | Account permission group collection.
apglrAccountPermissionGroups :: Lens' AccountPermissionGroupsListResponse [AccountPermissionGroup]
apglrAccountPermissionGroups
= lens _apglrAccountPermissionGroups
(\ s a -> s{_apglrAccountPermissionGroups = a})
. _Default
. _Coerce
instance FromJSON AccountPermissionGroupsListResponse
where
parseJSON
= withObject "AccountPermissionGroupsListResponse"
(\ o ->
AccountPermissionGroupsListResponse' <$>
(o .:? "kind") <*>
(o .:? "accountPermissionGroups" .!= mempty))
instance ToJSON AccountPermissionGroupsListResponse
where
toJSON AccountPermissionGroupsListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _apglrKind,
("accountPermissionGroups" .=) <$>
_apglrAccountPermissionGroups])
-- | Popup Window Properties.
--
-- /See:/ 'popupWindowProperties' smart constructor.
data PopupWindowProperties =
PopupWindowProperties'
{ _pwpOffSet :: !(Maybe OffSetPosition)
, _pwpDimension :: !(Maybe Size)
, _pwpShowStatusBar :: !(Maybe Bool)
, _pwpShowMenuBar :: !(Maybe Bool)
, _pwpPositionType :: !(Maybe PopupWindowPropertiesPositionType)
, _pwpShowAddressBar :: !(Maybe Bool)
, _pwpShowScrollBar :: !(Maybe Bool)
, _pwpShowToolBar :: !(Maybe Bool)
, _pwpTitle :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PopupWindowProperties' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pwpOffSet'
--
-- * 'pwpDimension'
--
-- * 'pwpShowStatusBar'
--
-- * 'pwpShowMenuBar'
--
-- * 'pwpPositionType'
--
-- * 'pwpShowAddressBar'
--
-- * 'pwpShowScrollBar'
--
-- * 'pwpShowToolBar'
--
-- * 'pwpTitle'
popupWindowProperties
:: PopupWindowProperties
popupWindowProperties =
PopupWindowProperties'
{ _pwpOffSet = Nothing
, _pwpDimension = Nothing
, _pwpShowStatusBar = Nothing
, _pwpShowMenuBar = Nothing
, _pwpPositionType = Nothing
, _pwpShowAddressBar = Nothing
, _pwpShowScrollBar = Nothing
, _pwpShowToolBar = Nothing
, _pwpTitle = Nothing
}
-- | Upper-left corner coordinates of the popup window. Applicable if
-- positionType is COORDINATES.
pwpOffSet :: Lens' PopupWindowProperties (Maybe OffSetPosition)
pwpOffSet
= lens _pwpOffSet (\ s a -> s{_pwpOffSet = a})
-- | Popup dimension for a creative. This is a read-only field. Applicable to
-- the following creative types: all RICH_MEDIA and all VPAID
pwpDimension :: Lens' PopupWindowProperties (Maybe Size)
pwpDimension
= lens _pwpDimension (\ s a -> s{_pwpDimension = a})
-- | Whether to display the browser status bar.
pwpShowStatusBar :: Lens' PopupWindowProperties (Maybe Bool)
pwpShowStatusBar
= lens _pwpShowStatusBar
(\ s a -> s{_pwpShowStatusBar = a})
-- | Whether to display the browser menu bar.
pwpShowMenuBar :: Lens' PopupWindowProperties (Maybe Bool)
pwpShowMenuBar
= lens _pwpShowMenuBar
(\ s a -> s{_pwpShowMenuBar = a})
-- | Popup window position either centered or at specific coordinate.
pwpPositionType :: Lens' PopupWindowProperties (Maybe PopupWindowPropertiesPositionType)
pwpPositionType
= lens _pwpPositionType
(\ s a -> s{_pwpPositionType = a})
-- | Whether to display the browser address bar.
pwpShowAddressBar :: Lens' PopupWindowProperties (Maybe Bool)
pwpShowAddressBar
= lens _pwpShowAddressBar
(\ s a -> s{_pwpShowAddressBar = a})
-- | Whether to display the browser scroll bar.
pwpShowScrollBar :: Lens' PopupWindowProperties (Maybe Bool)
pwpShowScrollBar
= lens _pwpShowScrollBar
(\ s a -> s{_pwpShowScrollBar = a})
-- | Whether to display the browser tool bar.
pwpShowToolBar :: Lens' PopupWindowProperties (Maybe Bool)
pwpShowToolBar
= lens _pwpShowToolBar
(\ s a -> s{_pwpShowToolBar = a})
-- | Title of popup window.
pwpTitle :: Lens' PopupWindowProperties (Maybe Text)
pwpTitle = lens _pwpTitle (\ s a -> s{_pwpTitle = a})
instance FromJSON PopupWindowProperties where
parseJSON
= withObject "PopupWindowProperties"
(\ o ->
PopupWindowProperties' <$>
(o .:? "offset") <*> (o .:? "dimension") <*>
(o .:? "showStatusBar")
<*> (o .:? "showMenuBar")
<*> (o .:? "positionType")
<*> (o .:? "showAddressBar")
<*> (o .:? "showScrollBar")
<*> (o .:? "showToolBar")
<*> (o .:? "title"))
instance ToJSON PopupWindowProperties where
toJSON PopupWindowProperties'{..}
= object
(catMaybes
[("offset" .=) <$> _pwpOffSet,
("dimension" .=) <$> _pwpDimension,
("showStatusBar" .=) <$> _pwpShowStatusBar,
("showMenuBar" .=) <$> _pwpShowMenuBar,
("positionType" .=) <$> _pwpPositionType,
("showAddressBar" .=) <$> _pwpShowAddressBar,
("showScrollBar" .=) <$> _pwpShowScrollBar,
("showToolBar" .=) <$> _pwpShowToolBar,
("title" .=) <$> _pwpTitle])
-- | Event tag override information.
--
-- /See:/ 'eventTagOverride' smart constructor.
data EventTagOverride =
EventTagOverride'
{ _etoEnabled :: !(Maybe Bool)
, _etoId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'EventTagOverride' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'etoEnabled'
--
-- * 'etoId'
eventTagOverride
:: EventTagOverride
eventTagOverride = EventTagOverride' {_etoEnabled = Nothing, _etoId = Nothing}
-- | Whether this override is enabled.
etoEnabled :: Lens' EventTagOverride (Maybe Bool)
etoEnabled
= lens _etoEnabled (\ s a -> s{_etoEnabled = a})
-- | ID of this event tag override. This is a read-only, auto-generated
-- field.
etoId :: Lens' EventTagOverride (Maybe Int64)
etoId
= lens _etoId (\ s a -> s{_etoId = a}) .
mapping _Coerce
instance FromJSON EventTagOverride where
parseJSON
= withObject "EventTagOverride"
(\ o ->
EventTagOverride' <$>
(o .:? "enabled") <*> (o .:? "id"))
instance ToJSON EventTagOverride where
toJSON EventTagOverride'{..}
= object
(catMaybes
[("enabled" .=) <$> _etoEnabled,
("id" .=) <$> _etoId])
-- | Contains information about a particular version of an operating system
-- that can be targeted by ads.
--
-- /See:/ 'operatingSystemVersion' smart constructor.
data OperatingSystemVersion =
OperatingSystemVersion'
{ _osvMinorVersion :: !(Maybe Text)
, _osvKind :: !(Maybe Text)
, _osvOperatingSystem :: !(Maybe OperatingSystem)
, _osvMajorVersion :: !(Maybe Text)
, _osvName :: !(Maybe Text)
, _osvId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OperatingSystemVersion' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'osvMinorVersion'
--
-- * 'osvKind'
--
-- * 'osvOperatingSystem'
--
-- * 'osvMajorVersion'
--
-- * 'osvName'
--
-- * 'osvId'
operatingSystemVersion
:: OperatingSystemVersion
operatingSystemVersion =
OperatingSystemVersion'
{ _osvMinorVersion = Nothing
, _osvKind = Nothing
, _osvOperatingSystem = Nothing
, _osvMajorVersion = Nothing
, _osvName = Nothing
, _osvId = Nothing
}
-- | Minor version (number after the first dot) of this operating system
-- version.
osvMinorVersion :: Lens' OperatingSystemVersion (Maybe Text)
osvMinorVersion
= lens _osvMinorVersion
(\ s a -> s{_osvMinorVersion = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#operatingSystemVersion\".
osvKind :: Lens' OperatingSystemVersion (Maybe Text)
osvKind = lens _osvKind (\ s a -> s{_osvKind = a})
-- | Operating system of this operating system version.
osvOperatingSystem :: Lens' OperatingSystemVersion (Maybe OperatingSystem)
osvOperatingSystem
= lens _osvOperatingSystem
(\ s a -> s{_osvOperatingSystem = a})
-- | Major version (leftmost number) of this operating system version.
osvMajorVersion :: Lens' OperatingSystemVersion (Maybe Text)
osvMajorVersion
= lens _osvMajorVersion
(\ s a -> s{_osvMajorVersion = a})
-- | Name of this operating system version.
osvName :: Lens' OperatingSystemVersion (Maybe Text)
osvName = lens _osvName (\ s a -> s{_osvName = a})
-- | ID of this operating system version.
osvId :: Lens' OperatingSystemVersion (Maybe Int64)
osvId
= lens _osvId (\ s a -> s{_osvId = a}) .
mapping _Coerce
instance FromJSON OperatingSystemVersion where
parseJSON
= withObject "OperatingSystemVersion"
(\ o ->
OperatingSystemVersion' <$>
(o .:? "minorVersion") <*> (o .:? "kind") <*>
(o .:? "operatingSystem")
<*> (o .:? "majorVersion")
<*> (o .:? "name")
<*> (o .:? "id"))
instance ToJSON OperatingSystemVersion where
toJSON OperatingSystemVersion'{..}
= object
(catMaybes
[("minorVersion" .=) <$> _osvMinorVersion,
("kind" .=) <$> _osvKind,
("operatingSystem" .=) <$> _osvOperatingSystem,
("majorVersion" .=) <$> _osvMajorVersion,
("name" .=) <$> _osvName, ("id" .=) <$> _osvId])
-- | AccountPermissions contains information about a particular account
-- permission. Some features of Campaign Manager require an account
-- permission to be present in the account.
--
-- /See:/ 'accountPermission' smart constructor.
data AccountPermission =
AccountPermission'
{ _acccKind :: !(Maybe Text)
, _acccAccountProFiles :: !(Maybe [AccountPermissionAccountProFilesItem])
, _acccName :: !(Maybe Text)
, _acccId :: !(Maybe (Textual Int64))
, _acccLevel :: !(Maybe AccountPermissionLevel)
, _acccPermissionGroupId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AccountPermission' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'acccKind'
--
-- * 'acccAccountProFiles'
--
-- * 'acccName'
--
-- * 'acccId'
--
-- * 'acccLevel'
--
-- * 'acccPermissionGroupId'
accountPermission
:: AccountPermission
accountPermission =
AccountPermission'
{ _acccKind = Nothing
, _acccAccountProFiles = Nothing
, _acccName = Nothing
, _acccId = Nothing
, _acccLevel = Nothing
, _acccPermissionGroupId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#accountPermission\".
acccKind :: Lens' AccountPermission (Maybe Text)
acccKind = lens _acccKind (\ s a -> s{_acccKind = a})
-- | Account profiles associated with this account permission. Possible
-- values are: - \"ACCOUNT_PROFILE_BASIC\" - \"ACCOUNT_PROFILE_STANDARD\"
acccAccountProFiles :: Lens' AccountPermission [AccountPermissionAccountProFilesItem]
acccAccountProFiles
= lens _acccAccountProFiles
(\ s a -> s{_acccAccountProFiles = a})
. _Default
. _Coerce
-- | Name of this account permission.
acccName :: Lens' AccountPermission (Maybe Text)
acccName = lens _acccName (\ s a -> s{_acccName = a})
-- | ID of this account permission.
acccId :: Lens' AccountPermission (Maybe Int64)
acccId
= lens _acccId (\ s a -> s{_acccId = a}) .
mapping _Coerce
-- | Administrative level required to enable this account permission.
acccLevel :: Lens' AccountPermission (Maybe AccountPermissionLevel)
acccLevel
= lens _acccLevel (\ s a -> s{_acccLevel = a})
-- | Permission group of this account permission.
acccPermissionGroupId :: Lens' AccountPermission (Maybe Int64)
acccPermissionGroupId
= lens _acccPermissionGroupId
(\ s a -> s{_acccPermissionGroupId = a})
. mapping _Coerce
instance FromJSON AccountPermission where
parseJSON
= withObject "AccountPermission"
(\ o ->
AccountPermission' <$>
(o .:? "kind") <*>
(o .:? "accountProfiles" .!= mempty)
<*> (o .:? "name")
<*> (o .:? "id")
<*> (o .:? "level")
<*> (o .:? "permissionGroupId"))
instance ToJSON AccountPermission where
toJSON AccountPermission'{..}
= object
(catMaybes
[("kind" .=) <$> _acccKind,
("accountProfiles" .=) <$> _acccAccountProFiles,
("name" .=) <$> _acccName, ("id" .=) <$> _acccId,
("level" .=) <$> _acccLevel,
("permissionGroupId" .=) <$> _acccPermissionGroupId])
--
-- /See:/ 'measurementPartnerCampaignLink' smart constructor.
data MeasurementPartnerCampaignLink =
MeasurementPartnerCampaignLink'
{ _mpclLinkStatus :: !(Maybe MeasurementPartnerCampaignLinkLinkStatus)
, _mpclMeasurementPartner :: !(Maybe MeasurementPartnerCampaignLinkMeasurementPartner)
, _mpclPartnerCampaignId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'MeasurementPartnerCampaignLink' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mpclLinkStatus'
--
-- * 'mpclMeasurementPartner'
--
-- * 'mpclPartnerCampaignId'
measurementPartnerCampaignLink
:: MeasurementPartnerCampaignLink
measurementPartnerCampaignLink =
MeasurementPartnerCampaignLink'
{ _mpclLinkStatus = Nothing
, _mpclMeasurementPartner = Nothing
, _mpclPartnerCampaignId = Nothing
}
-- | .
mpclLinkStatus :: Lens' MeasurementPartnerCampaignLink (Maybe MeasurementPartnerCampaignLinkLinkStatus)
mpclLinkStatus
= lens _mpclLinkStatus
(\ s a -> s{_mpclLinkStatus = a})
-- | Measurement partner used for tag wrapping.
mpclMeasurementPartner :: Lens' MeasurementPartnerCampaignLink (Maybe MeasurementPartnerCampaignLinkMeasurementPartner)
mpclMeasurementPartner
= lens _mpclMeasurementPartner
(\ s a -> s{_mpclMeasurementPartner = a})
-- | Partner campaign ID needed for establishing linking with Measurement
-- partner.
mpclPartnerCampaignId :: Lens' MeasurementPartnerCampaignLink (Maybe Text)
mpclPartnerCampaignId
= lens _mpclPartnerCampaignId
(\ s a -> s{_mpclPartnerCampaignId = a})
instance FromJSON MeasurementPartnerCampaignLink
where
parseJSON
= withObject "MeasurementPartnerCampaignLink"
(\ o ->
MeasurementPartnerCampaignLink' <$>
(o .:? "linkStatus") <*> (o .:? "measurementPartner")
<*> (o .:? "partnerCampaignId"))
instance ToJSON MeasurementPartnerCampaignLink where
toJSON MeasurementPartnerCampaignLink'{..}
= object
(catMaybes
[("linkStatus" .=) <$> _mpclLinkStatus,
("measurementPartner" .=) <$>
_mpclMeasurementPartner,
("partnerCampaignId" .=) <$> _mpclPartnerCampaignId])
-- | A UserProfile resource lets you list all DFA user profiles that are
-- associated with a Google user account. The profile_id needs to be
-- specified in other API requests.
--
-- /See:/ 'userProFile' smart constructor.
data UserProFile =
UserProFile'
{ _upfEtag :: !(Maybe Text)
, _upfKind :: !(Maybe Text)
, _upfAccountName :: !(Maybe Text)
, _upfProFileId :: !(Maybe (Textual Int64))
, _upfUserName :: !(Maybe Text)
, _upfAccountId :: !(Maybe (Textual Int64))
, _upfSubAccountName :: !(Maybe Text)
, _upfSubAccountId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UserProFile' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'upfEtag'
--
-- * 'upfKind'
--
-- * 'upfAccountName'
--
-- * 'upfProFileId'
--
-- * 'upfUserName'
--
-- * 'upfAccountId'
--
-- * 'upfSubAccountName'
--
-- * 'upfSubAccountId'
userProFile
:: UserProFile
userProFile =
UserProFile'
{ _upfEtag = Nothing
, _upfKind = Nothing
, _upfAccountName = Nothing
, _upfProFileId = Nothing
, _upfUserName = Nothing
, _upfAccountId = Nothing
, _upfSubAccountName = Nothing
, _upfSubAccountId = Nothing
}
-- | Etag of this resource.
upfEtag :: Lens' UserProFile (Maybe Text)
upfEtag = lens _upfEtag (\ s a -> s{_upfEtag = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#userProfile\".
upfKind :: Lens' UserProFile (Maybe Text)
upfKind = lens _upfKind (\ s a -> s{_upfKind = a})
-- | The account name this profile belongs to.
upfAccountName :: Lens' UserProFile (Maybe Text)
upfAccountName
= lens _upfAccountName
(\ s a -> s{_upfAccountName = a})
-- | The unique ID of the user profile.
upfProFileId :: Lens' UserProFile (Maybe Int64)
upfProFileId
= lens _upfProFileId (\ s a -> s{_upfProFileId = a})
. mapping _Coerce
-- | The user name.
upfUserName :: Lens' UserProFile (Maybe Text)
upfUserName
= lens _upfUserName (\ s a -> s{_upfUserName = a})
-- | The account ID to which this profile belongs.
upfAccountId :: Lens' UserProFile (Maybe Int64)
upfAccountId
= lens _upfAccountId (\ s a -> s{_upfAccountId = a})
. mapping _Coerce
-- | The sub account name this profile belongs to if applicable.
upfSubAccountName :: Lens' UserProFile (Maybe Text)
upfSubAccountName
= lens _upfSubAccountName
(\ s a -> s{_upfSubAccountName = a})
-- | The sub account ID this profile belongs to if applicable.
upfSubAccountId :: Lens' UserProFile (Maybe Int64)
upfSubAccountId
= lens _upfSubAccountId
(\ s a -> s{_upfSubAccountId = a})
. mapping _Coerce
instance FromJSON UserProFile where
parseJSON
= withObject "UserProFile"
(\ o ->
UserProFile' <$>
(o .:? "etag") <*> (o .:? "kind") <*>
(o .:? "accountName")
<*> (o .:? "profileId")
<*> (o .:? "userName")
<*> (o .:? "accountId")
<*> (o .:? "subAccountName")
<*> (o .:? "subAccountId"))
instance ToJSON UserProFile where
toJSON UserProFile'{..}
= object
(catMaybes
[("etag" .=) <$> _upfEtag, ("kind" .=) <$> _upfKind,
("accountName" .=) <$> _upfAccountName,
("profileId" .=) <$> _upfProFileId,
("userName" .=) <$> _upfUserName,
("accountId" .=) <$> _upfAccountId,
("subAccountName" .=) <$> _upfSubAccountName,
("subAccountId" .=) <$> _upfSubAccountId])
-- | Operating System List Response
--
-- /See:/ 'operatingSystemsListResponse' smart constructor.
data OperatingSystemsListResponse =
OperatingSystemsListResponse'
{ _oslrKind :: !(Maybe Text)
, _oslrOperatingSystems :: !(Maybe [OperatingSystem])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OperatingSystemsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oslrKind'
--
-- * 'oslrOperatingSystems'
operatingSystemsListResponse
:: OperatingSystemsListResponse
operatingSystemsListResponse =
OperatingSystemsListResponse'
{_oslrKind = Nothing, _oslrOperatingSystems = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#operatingSystemsListResponse\".
oslrKind :: Lens' OperatingSystemsListResponse (Maybe Text)
oslrKind = lens _oslrKind (\ s a -> s{_oslrKind = a})
-- | Operating system collection.
oslrOperatingSystems :: Lens' OperatingSystemsListResponse [OperatingSystem]
oslrOperatingSystems
= lens _oslrOperatingSystems
(\ s a -> s{_oslrOperatingSystems = a})
. _Default
. _Coerce
instance FromJSON OperatingSystemsListResponse where
parseJSON
= withObject "OperatingSystemsListResponse"
(\ o ->
OperatingSystemsListResponse' <$>
(o .:? "kind") <*>
(o .:? "operatingSystems" .!= mempty))
instance ToJSON OperatingSystemsListResponse where
toJSON OperatingSystemsListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _oslrKind,
("operatingSystems" .=) <$> _oslrOperatingSystems])
-- | The report\'s email delivery settings.
--
-- /See:/ 'reportDelivery' smart constructor.
data ReportDelivery =
ReportDelivery'
{ _rdEmailOwner :: !(Maybe Bool)
, _rdRecipients :: !(Maybe [Recipient])
, _rdMessage :: !(Maybe Text)
, _rdEmailOwnerDeliveryType :: !(Maybe ReportDeliveryEmailOwnerDeliveryType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportDelivery' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rdEmailOwner'
--
-- * 'rdRecipients'
--
-- * 'rdMessage'
--
-- * 'rdEmailOwnerDeliveryType'
reportDelivery
:: ReportDelivery
reportDelivery =
ReportDelivery'
{ _rdEmailOwner = Nothing
, _rdRecipients = Nothing
, _rdMessage = Nothing
, _rdEmailOwnerDeliveryType = Nothing
}
-- | Whether the report should be emailed to the report owner.
rdEmailOwner :: Lens' ReportDelivery (Maybe Bool)
rdEmailOwner
= lens _rdEmailOwner (\ s a -> s{_rdEmailOwner = a})
-- | The list of recipients to which to email the report.
rdRecipients :: Lens' ReportDelivery [Recipient]
rdRecipients
= lens _rdRecipients (\ s a -> s{_rdRecipients = a})
. _Default
. _Coerce
-- | The message to be sent with each email.
rdMessage :: Lens' ReportDelivery (Maybe Text)
rdMessage
= lens _rdMessage (\ s a -> s{_rdMessage = a})
-- | The type of delivery for the owner to receive, if enabled.
rdEmailOwnerDeliveryType :: Lens' ReportDelivery (Maybe ReportDeliveryEmailOwnerDeliveryType)
rdEmailOwnerDeliveryType
= lens _rdEmailOwnerDeliveryType
(\ s a -> s{_rdEmailOwnerDeliveryType = a})
instance FromJSON ReportDelivery where
parseJSON
= withObject "ReportDelivery"
(\ o ->
ReportDelivery' <$>
(o .:? "emailOwner") <*>
(o .:? "recipients" .!= mempty)
<*> (o .:? "message")
<*> (o .:? "emailOwnerDeliveryType"))
instance ToJSON ReportDelivery where
toJSON ReportDelivery'{..}
= object
(catMaybes
[("emailOwner" .=) <$> _rdEmailOwner,
("recipients" .=) <$> _rdRecipients,
("message" .=) <$> _rdMessage,
("emailOwnerDeliveryType" .=) <$>
_rdEmailOwnerDeliveryType])
-- | Contains properties of a targetable remarketing list. Remarketing
-- enables you to create lists of users who have performed specific actions
-- on a site, then target ads to members of those lists. This resource is a
-- read-only view of a remarketing list to be used to faciliate targeting
-- ads to specific lists. Remarketing lists that are owned by your
-- advertisers and those that are shared to your advertisers or account are
-- accessible via this resource. To manage remarketing lists that are owned
-- by your advertisers, use the RemarketingLists resource.
--
-- /See:/ 'targetableRemarketingList' smart constructor.
data TargetableRemarketingList =
TargetableRemarketingList'
{ _trlListSize :: !(Maybe (Textual Int64))
, _trlLifeSpan :: !(Maybe (Textual Int64))
, _trlKind :: !(Maybe Text)
, _trlAdvertiserId :: !(Maybe (Textual Int64))
, _trlAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _trlActive :: !(Maybe Bool)
, _trlAccountId :: !(Maybe (Textual Int64))
, _trlName :: !(Maybe Text)
, _trlListSource :: !(Maybe TargetableRemarketingListListSource)
, _trlId :: !(Maybe (Textual Int64))
, _trlSubAccountId :: !(Maybe (Textual Int64))
, _trlDescription :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TargetableRemarketingList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'trlListSize'
--
-- * 'trlLifeSpan'
--
-- * 'trlKind'
--
-- * 'trlAdvertiserId'
--
-- * 'trlAdvertiserIdDimensionValue'
--
-- * 'trlActive'
--
-- * 'trlAccountId'
--
-- * 'trlName'
--
-- * 'trlListSource'
--
-- * 'trlId'
--
-- * 'trlSubAccountId'
--
-- * 'trlDescription'
targetableRemarketingList
:: TargetableRemarketingList
targetableRemarketingList =
TargetableRemarketingList'
{ _trlListSize = Nothing
, _trlLifeSpan = Nothing
, _trlKind = Nothing
, _trlAdvertiserId = Nothing
, _trlAdvertiserIdDimensionValue = Nothing
, _trlActive = Nothing
, _trlAccountId = Nothing
, _trlName = Nothing
, _trlListSource = Nothing
, _trlId = Nothing
, _trlSubAccountId = Nothing
, _trlDescription = Nothing
}
-- | Number of users currently in the list. This is a read-only field.
trlListSize :: Lens' TargetableRemarketingList (Maybe Int64)
trlListSize
= lens _trlListSize (\ s a -> s{_trlListSize = a}) .
mapping _Coerce
-- | Number of days that a user should remain in the targetable remarketing
-- list without an impression.
trlLifeSpan :: Lens' TargetableRemarketingList (Maybe Int64)
trlLifeSpan
= lens _trlLifeSpan (\ s a -> s{_trlLifeSpan = a}) .
mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#targetableRemarketingList\".
trlKind :: Lens' TargetableRemarketingList (Maybe Text)
trlKind = lens _trlKind (\ s a -> s{_trlKind = a})
-- | Dimension value for the advertiser ID that owns this targetable
-- remarketing list.
trlAdvertiserId :: Lens' TargetableRemarketingList (Maybe Int64)
trlAdvertiserId
= lens _trlAdvertiserId
(\ s a -> s{_trlAdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser.
trlAdvertiserIdDimensionValue :: Lens' TargetableRemarketingList (Maybe DimensionValue)
trlAdvertiserIdDimensionValue
= lens _trlAdvertiserIdDimensionValue
(\ s a -> s{_trlAdvertiserIdDimensionValue = a})
-- | Whether this targetable remarketing list is active.
trlActive :: Lens' TargetableRemarketingList (Maybe Bool)
trlActive
= lens _trlActive (\ s a -> s{_trlActive = a})
-- | Account ID of this remarketing list. This is a read-only, auto-generated
-- field that is only returned in GET requests.
trlAccountId :: Lens' TargetableRemarketingList (Maybe Int64)
trlAccountId
= lens _trlAccountId (\ s a -> s{_trlAccountId = a})
. mapping _Coerce
-- | Name of the targetable remarketing list. Is no greater than 128
-- characters long.
trlName :: Lens' TargetableRemarketingList (Maybe Text)
trlName = lens _trlName (\ s a -> s{_trlName = a})
-- | Product from which this targetable remarketing list was originated.
trlListSource :: Lens' TargetableRemarketingList (Maybe TargetableRemarketingListListSource)
trlListSource
= lens _trlListSource
(\ s a -> s{_trlListSource = a})
-- | Targetable remarketing list ID.
trlId :: Lens' TargetableRemarketingList (Maybe Int64)
trlId
= lens _trlId (\ s a -> s{_trlId = a}) .
mapping _Coerce
-- | Subaccount ID of this remarketing list. This is a read-only,
-- auto-generated field that is only returned in GET requests.
trlSubAccountId :: Lens' TargetableRemarketingList (Maybe Int64)
trlSubAccountId
= lens _trlSubAccountId
(\ s a -> s{_trlSubAccountId = a})
. mapping _Coerce
-- | Targetable remarketing list description.
trlDescription :: Lens' TargetableRemarketingList (Maybe Text)
trlDescription
= lens _trlDescription
(\ s a -> s{_trlDescription = a})
instance FromJSON TargetableRemarketingList where
parseJSON
= withObject "TargetableRemarketingList"
(\ o ->
TargetableRemarketingList' <$>
(o .:? "listSize") <*> (o .:? "lifeSpan") <*>
(o .:? "kind")
<*> (o .:? "advertiserId")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "active")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "listSource")
<*> (o .:? "id")
<*> (o .:? "subaccountId")
<*> (o .:? "description"))
instance ToJSON TargetableRemarketingList where
toJSON TargetableRemarketingList'{..}
= object
(catMaybes
[("listSize" .=) <$> _trlListSize,
("lifeSpan" .=) <$> _trlLifeSpan,
("kind" .=) <$> _trlKind,
("advertiserId" .=) <$> _trlAdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_trlAdvertiserIdDimensionValue,
("active" .=) <$> _trlActive,
("accountId" .=) <$> _trlAccountId,
("name" .=) <$> _trlName,
("listSource" .=) <$> _trlListSource,
("id" .=) <$> _trlId,
("subaccountId" .=) <$> _trlSubAccountId,
("description" .=) <$> _trlDescription])
-- | Postal Code List Response
--
-- /See:/ 'postalCodesListResponse' smart constructor.
data PostalCodesListResponse =
PostalCodesListResponse'
{ _pclrKind :: !(Maybe Text)
, _pclrPostalCodes :: !(Maybe [PostalCode])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PostalCodesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pclrKind'
--
-- * 'pclrPostalCodes'
postalCodesListResponse
:: PostalCodesListResponse
postalCodesListResponse =
PostalCodesListResponse' {_pclrKind = Nothing, _pclrPostalCodes = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#postalCodesListResponse\".
pclrKind :: Lens' PostalCodesListResponse (Maybe Text)
pclrKind = lens _pclrKind (\ s a -> s{_pclrKind = a})
-- | Postal code collection.
pclrPostalCodes :: Lens' PostalCodesListResponse [PostalCode]
pclrPostalCodes
= lens _pclrPostalCodes
(\ s a -> s{_pclrPostalCodes = a})
. _Default
. _Coerce
instance FromJSON PostalCodesListResponse where
parseJSON
= withObject "PostalCodesListResponse"
(\ o ->
PostalCodesListResponse' <$>
(o .:? "kind") <*> (o .:? "postalCodes" .!= mempty))
instance ToJSON PostalCodesListResponse where
toJSON PostalCodesListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _pclrKind,
("postalCodes" .=) <$> _pclrPostalCodes])
-- | Describes a change that a user has made to a resource.
--
-- /See:/ 'changeLog' smart constructor.
data ChangeLog =
ChangeLog'
{ _chahUserProFileId :: !(Maybe (Textual Int64))
, _chahObjectType :: !(Maybe Text)
, _chahUserProFileName :: !(Maybe Text)
, _chahKind :: !(Maybe Text)
, _chahObjectId :: !(Maybe (Textual Int64))
, _chahAction :: !(Maybe Text)
, _chahTransactionId :: !(Maybe (Textual Int64))
, _chahOldValue :: !(Maybe Text)
, _chahAccountId :: !(Maybe (Textual Int64))
, _chahNewValue :: !(Maybe Text)
, _chahFieldName :: !(Maybe Text)
, _chahId :: !(Maybe (Textual Int64))
, _chahSubAccountId :: !(Maybe (Textual Int64))
, _chahChangeTime :: !(Maybe DateTime')
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ChangeLog' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'chahUserProFileId'
--
-- * 'chahObjectType'
--
-- * 'chahUserProFileName'
--
-- * 'chahKind'
--
-- * 'chahObjectId'
--
-- * 'chahAction'
--
-- * 'chahTransactionId'
--
-- * 'chahOldValue'
--
-- * 'chahAccountId'
--
-- * 'chahNewValue'
--
-- * 'chahFieldName'
--
-- * 'chahId'
--
-- * 'chahSubAccountId'
--
-- * 'chahChangeTime'
changeLog
:: ChangeLog
changeLog =
ChangeLog'
{ _chahUserProFileId = Nothing
, _chahObjectType = Nothing
, _chahUserProFileName = Nothing
, _chahKind = Nothing
, _chahObjectId = Nothing
, _chahAction = Nothing
, _chahTransactionId = Nothing
, _chahOldValue = Nothing
, _chahAccountId = Nothing
, _chahNewValue = Nothing
, _chahFieldName = Nothing
, _chahId = Nothing
, _chahSubAccountId = Nothing
, _chahChangeTime = Nothing
}
-- | ID of the user who modified the object.
chahUserProFileId :: Lens' ChangeLog (Maybe Int64)
chahUserProFileId
= lens _chahUserProFileId
(\ s a -> s{_chahUserProFileId = a})
. mapping _Coerce
-- | Object type of the change log.
chahObjectType :: Lens' ChangeLog (Maybe Text)
chahObjectType
= lens _chahObjectType
(\ s a -> s{_chahObjectType = a})
-- | User profile name of the user who modified the object.
chahUserProFileName :: Lens' ChangeLog (Maybe Text)
chahUserProFileName
= lens _chahUserProFileName
(\ s a -> s{_chahUserProFileName = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#changeLog\".
chahKind :: Lens' ChangeLog (Maybe Text)
chahKind = lens _chahKind (\ s a -> s{_chahKind = a})
-- | ID of the object of this change log. The object could be a campaign,
-- placement, ad, or other type.
chahObjectId :: Lens' ChangeLog (Maybe Int64)
chahObjectId
= lens _chahObjectId (\ s a -> s{_chahObjectId = a})
. mapping _Coerce
-- | Action which caused the change.
chahAction :: Lens' ChangeLog (Maybe Text)
chahAction
= lens _chahAction (\ s a -> s{_chahAction = a})
-- | Transaction ID of this change log. When a single API call results in
-- many changes, each change will have a separate ID in the change log but
-- will share the same transactionId.
chahTransactionId :: Lens' ChangeLog (Maybe Int64)
chahTransactionId
= lens _chahTransactionId
(\ s a -> s{_chahTransactionId = a})
. mapping _Coerce
-- | Old value of the object field.
chahOldValue :: Lens' ChangeLog (Maybe Text)
chahOldValue
= lens _chahOldValue (\ s a -> s{_chahOldValue = a})
-- | Account ID of the modified object.
chahAccountId :: Lens' ChangeLog (Maybe Int64)
chahAccountId
= lens _chahAccountId
(\ s a -> s{_chahAccountId = a})
. mapping _Coerce
-- | New value of the object field.
chahNewValue :: Lens' ChangeLog (Maybe Text)
chahNewValue
= lens _chahNewValue (\ s a -> s{_chahNewValue = a})
-- | Field name of the object which changed.
chahFieldName :: Lens' ChangeLog (Maybe Text)
chahFieldName
= lens _chahFieldName
(\ s a -> s{_chahFieldName = a})
-- | ID of this change log.
chahId :: Lens' ChangeLog (Maybe Int64)
chahId
= lens _chahId (\ s a -> s{_chahId = a}) .
mapping _Coerce
-- | Subaccount ID of the modified object.
chahSubAccountId :: Lens' ChangeLog (Maybe Int64)
chahSubAccountId
= lens _chahSubAccountId
(\ s a -> s{_chahSubAccountId = a})
. mapping _Coerce
chahChangeTime :: Lens' ChangeLog (Maybe UTCTime)
chahChangeTime
= lens _chahChangeTime
(\ s a -> s{_chahChangeTime = a})
. mapping _DateTime
instance FromJSON ChangeLog where
parseJSON
= withObject "ChangeLog"
(\ o ->
ChangeLog' <$>
(o .:? "userProfileId") <*> (o .:? "objectType") <*>
(o .:? "userProfileName")
<*> (o .:? "kind")
<*> (o .:? "objectId")
<*> (o .:? "action")
<*> (o .:? "transactionId")
<*> (o .:? "oldValue")
<*> (o .:? "accountId")
<*> (o .:? "newValue")
<*> (o .:? "fieldName")
<*> (o .:? "id")
<*> (o .:? "subaccountId")
<*> (o .:? "changeTime"))
instance ToJSON ChangeLog where
toJSON ChangeLog'{..}
= object
(catMaybes
[("userProfileId" .=) <$> _chahUserProFileId,
("objectType" .=) <$> _chahObjectType,
("userProfileName" .=) <$> _chahUserProFileName,
("kind" .=) <$> _chahKind,
("objectId" .=) <$> _chahObjectId,
("action" .=) <$> _chahAction,
("transactionId" .=) <$> _chahTransactionId,
("oldValue" .=) <$> _chahOldValue,
("accountId" .=) <$> _chahAccountId,
("newValue" .=) <$> _chahNewValue,
("fieldName" .=) <$> _chahFieldName,
("id" .=) <$> _chahId,
("subaccountId" .=) <$> _chahSubAccountId,
("changeTime" .=) <$> _chahChangeTime])
-- | Contains information about a language that can be targeted by ads.
--
-- /See:/ 'language' smart constructor.
data Language =
Language'
{ _lLanguageCode :: !(Maybe Text)
, _lKind :: !(Maybe Text)
, _lName :: !(Maybe Text)
, _lId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Language' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lLanguageCode'
--
-- * 'lKind'
--
-- * 'lName'
--
-- * 'lId'
language
:: Language
language =
Language'
{ _lLanguageCode = Nothing
, _lKind = Nothing
, _lName = Nothing
, _lId = Nothing
}
-- | Format of language code is an ISO 639 two-letter language code
-- optionally followed by an underscore followed by an ISO 3166 code.
-- Examples are \"en\" for English or \"zh_CN\" for Simplified Chinese.
lLanguageCode :: Lens' Language (Maybe Text)
lLanguageCode
= lens _lLanguageCode
(\ s a -> s{_lLanguageCode = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#language\".
lKind :: Lens' Language (Maybe Text)
lKind = lens _lKind (\ s a -> s{_lKind = a})
-- | Name of this language.
lName :: Lens' Language (Maybe Text)
lName = lens _lName (\ s a -> s{_lName = a})
-- | Language ID of this language. This is the ID used for targeting and
-- generating reports.
lId :: Lens' Language (Maybe Int64)
lId
= lens _lId (\ s a -> s{_lId = a}) . mapping _Coerce
instance FromJSON Language where
parseJSON
= withObject "Language"
(\ o ->
Language' <$>
(o .:? "languageCode") <*> (o .:? "kind") <*>
(o .:? "name")
<*> (o .:? "id"))
instance ToJSON Language where
toJSON Language'{..}
= object
(catMaybes
[("languageCode" .=) <$> _lLanguageCode,
("kind" .=) <$> _lKind, ("name" .=) <$> _lName,
("id" .=) <$> _lId])
-- | Contains properties of a placement strategy.
--
-- /See:/ 'placementStrategy' smart constructor.
data PlacementStrategy =
PlacementStrategy'
{ _psKind :: !(Maybe Text)
, _psAccountId :: !(Maybe (Textual Int64))
, _psName :: !(Maybe Text)
, _psId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlacementStrategy' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'psKind'
--
-- * 'psAccountId'
--
-- * 'psName'
--
-- * 'psId'
placementStrategy
:: PlacementStrategy
placementStrategy =
PlacementStrategy'
{ _psKind = Nothing
, _psAccountId = Nothing
, _psName = Nothing
, _psId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#placementStrategy\".
psKind :: Lens' PlacementStrategy (Maybe Text)
psKind = lens _psKind (\ s a -> s{_psKind = a})
-- | Account ID of this placement strategy.This is a read-only field that can
-- be left blank.
psAccountId :: Lens' PlacementStrategy (Maybe Int64)
psAccountId
= lens _psAccountId (\ s a -> s{_psAccountId = a}) .
mapping _Coerce
-- | Name of this placement strategy. This is a required field. It must be
-- less than 256 characters long and unique among placement strategies of
-- the same account.
psName :: Lens' PlacementStrategy (Maybe Text)
psName = lens _psName (\ s a -> s{_psName = a})
-- | ID of this placement strategy. This is a read-only, auto-generated
-- field.
psId :: Lens' PlacementStrategy (Maybe Int64)
psId
= lens _psId (\ s a -> s{_psId = a}) .
mapping _Coerce
instance FromJSON PlacementStrategy where
parseJSON
= withObject "PlacementStrategy"
(\ o ->
PlacementStrategy' <$>
(o .:? "kind") <*> (o .:? "accountId") <*>
(o .:? "name")
<*> (o .:? "id"))
instance ToJSON PlacementStrategy where
toJSON PlacementStrategy'{..}
= object
(catMaybes
[("kind" .=) <$> _psKind,
("accountId" .=) <$> _psAccountId,
("name" .=) <$> _psName, ("id" .=) <$> _psId])
-- | Contains properties of a Floodlight activity.
--
-- /See:/ 'floodlightActivity' smart constructor.
data FloodlightActivity =
FloodlightActivity'
{ _faCountingMethod :: !(Maybe FloodlightActivityCountingMethod)
, _faAttributionEnabled :: !(Maybe Bool)
, _faStatus :: !(Maybe FloodlightActivityStatus)
, _faTagString :: !(Maybe Text)
, _faSecure :: !(Maybe Bool)
, _faExpectedURL :: !(Maybe Text)
, _faFloodlightActivityGroupTagString :: !(Maybe Text)
, _faFloodlightConfigurationId :: !(Maybe (Textual Int64))
, _faKind :: !(Maybe Text)
, _faAdvertiserId :: !(Maybe (Textual Int64))
, _faAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _faSSLCompliant :: !(Maybe Bool)
, _faIdDimensionValue :: !(Maybe DimensionValue)
, _faTagFormat :: !(Maybe FloodlightActivityTagFormat)
, _faCacheBustingType :: !(Maybe FloodlightActivityCacheBustingType)
, _faAccountId :: !(Maybe (Textual Int64))
, _faName :: !(Maybe Text)
, _faPublisherTags :: !(Maybe [FloodlightActivityPublisherDynamicTag])
, _faFloodlightActivityGroupId :: !(Maybe (Textual Int64))
, _faFloodlightActivityGroupType :: !(Maybe FloodlightActivityFloodlightActivityGroupType)
, _faDefaultTags :: !(Maybe [FloodlightActivityDynamicTag])
, _faFloodlightTagType :: !(Maybe FloodlightActivityFloodlightTagType)
, _faFloodlightActivityGroupName :: !(Maybe Text)
, _faId :: !(Maybe (Textual Int64))
, _faSSLRequired :: !(Maybe Bool)
, _faUserDefinedVariableTypes :: !(Maybe [FloodlightActivityUserDefinedVariableTypesItem])
, _faSubAccountId :: !(Maybe (Textual Int64))
, _faNotes :: !(Maybe Text)
, _faFloodlightConfigurationIdDimensionValue :: !(Maybe DimensionValue)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightActivity' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'faCountingMethod'
--
-- * 'faAttributionEnabled'
--
-- * 'faStatus'
--
-- * 'faTagString'
--
-- * 'faSecure'
--
-- * 'faExpectedURL'
--
-- * 'faFloodlightActivityGroupTagString'
--
-- * 'faFloodlightConfigurationId'
--
-- * 'faKind'
--
-- * 'faAdvertiserId'
--
-- * 'faAdvertiserIdDimensionValue'
--
-- * 'faSSLCompliant'
--
-- * 'faIdDimensionValue'
--
-- * 'faTagFormat'
--
-- * 'faCacheBustingType'
--
-- * 'faAccountId'
--
-- * 'faName'
--
-- * 'faPublisherTags'
--
-- * 'faFloodlightActivityGroupId'
--
-- * 'faFloodlightActivityGroupType'
--
-- * 'faDefaultTags'
--
-- * 'faFloodlightTagType'
--
-- * 'faFloodlightActivityGroupName'
--
-- * 'faId'
--
-- * 'faSSLRequired'
--
-- * 'faUserDefinedVariableTypes'
--
-- * 'faSubAccountId'
--
-- * 'faNotes'
--
-- * 'faFloodlightConfigurationIdDimensionValue'
floodlightActivity
:: FloodlightActivity
floodlightActivity =
FloodlightActivity'
{ _faCountingMethod = Nothing
, _faAttributionEnabled = Nothing
, _faStatus = Nothing
, _faTagString = Nothing
, _faSecure = Nothing
, _faExpectedURL = Nothing
, _faFloodlightActivityGroupTagString = Nothing
, _faFloodlightConfigurationId = Nothing
, _faKind = Nothing
, _faAdvertiserId = Nothing
, _faAdvertiserIdDimensionValue = Nothing
, _faSSLCompliant = Nothing
, _faIdDimensionValue = Nothing
, _faTagFormat = Nothing
, _faCacheBustingType = Nothing
, _faAccountId = Nothing
, _faName = Nothing
, _faPublisherTags = Nothing
, _faFloodlightActivityGroupId = Nothing
, _faFloodlightActivityGroupType = Nothing
, _faDefaultTags = Nothing
, _faFloodlightTagType = Nothing
, _faFloodlightActivityGroupName = Nothing
, _faId = Nothing
, _faSSLRequired = Nothing
, _faUserDefinedVariableTypes = Nothing
, _faSubAccountId = Nothing
, _faNotes = Nothing
, _faFloodlightConfigurationIdDimensionValue = Nothing
}
-- | Counting method for conversions for this floodlight activity. This is a
-- required field.
faCountingMethod :: Lens' FloodlightActivity (Maybe FloodlightActivityCountingMethod)
faCountingMethod
= lens _faCountingMethod
(\ s a -> s{_faCountingMethod = a})
-- | Whether the activity is enabled for attribution.
faAttributionEnabled :: Lens' FloodlightActivity (Maybe Bool)
faAttributionEnabled
= lens _faAttributionEnabled
(\ s a -> s{_faAttributionEnabled = a})
-- | The status of the activity. This can only be set to ACTIVE or
-- ARCHIVED_AND_DISABLED. The ARCHIVED status is no longer supported and
-- cannot be set for Floodlight activities. The DISABLED_POLICY status
-- indicates that a Floodlight activity is violating Google policy. Contact
-- your account manager for more information.
faStatus :: Lens' FloodlightActivity (Maybe FloodlightActivityStatus)
faStatus = lens _faStatus (\ s a -> s{_faStatus = a})
-- | Value of the cat= parameter in the floodlight tag, which the ad servers
-- use to identify the activity. This is optional: if empty, a new tag
-- string will be generated for you. This string must be 1 to 8 characters
-- long, with valid characters being a-z0-9[ _ ]. This tag string must also
-- be unique among activities of the same activity group. This field is
-- read-only after insertion.
faTagString :: Lens' FloodlightActivity (Maybe Text)
faTagString
= lens _faTagString (\ s a -> s{_faTagString = a})
-- | Whether this tag should use SSL.
faSecure :: Lens' FloodlightActivity (Maybe Bool)
faSecure = lens _faSecure (\ s a -> s{_faSecure = a})
-- | URL where this tag will be deployed. If specified, must be less than 256
-- characters long.
faExpectedURL :: Lens' FloodlightActivity (Maybe Text)
faExpectedURL
= lens _faExpectedURL
(\ s a -> s{_faExpectedURL = a})
-- | Tag string of the associated floodlight activity group. This is a
-- read-only field.
faFloodlightActivityGroupTagString :: Lens' FloodlightActivity (Maybe Text)
faFloodlightActivityGroupTagString
= lens _faFloodlightActivityGroupTagString
(\ s a -> s{_faFloodlightActivityGroupTagString = a})
-- | Floodlight configuration ID of this floodlight activity. If this field
-- is left blank, the value will be copied over either from the activity
-- group\'s floodlight configuration or from the existing activity\'s
-- floodlight configuration.
faFloodlightConfigurationId :: Lens' FloodlightActivity (Maybe Int64)
faFloodlightConfigurationId
= lens _faFloodlightConfigurationId
(\ s a -> s{_faFloodlightConfigurationId = a})
. mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#floodlightActivity\".
faKind :: Lens' FloodlightActivity (Maybe Text)
faKind = lens _faKind (\ s a -> s{_faKind = a})
-- | Advertiser ID of this floodlight activity. If this field is left blank,
-- the value will be copied over either from the activity group\'s
-- advertiser or the existing activity\'s advertiser.
faAdvertiserId :: Lens' FloodlightActivity (Maybe Int64)
faAdvertiserId
= lens _faAdvertiserId
(\ s a -> s{_faAdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
faAdvertiserIdDimensionValue :: Lens' FloodlightActivity (Maybe DimensionValue)
faAdvertiserIdDimensionValue
= lens _faAdvertiserIdDimensionValue
(\ s a -> s{_faAdvertiserIdDimensionValue = a})
-- | Whether the floodlight activity is SSL-compliant. This is a read-only
-- field, its value detected by the system from the floodlight tags.
faSSLCompliant :: Lens' FloodlightActivity (Maybe Bool)
faSSLCompliant
= lens _faSSLCompliant
(\ s a -> s{_faSSLCompliant = a})
-- | Dimension value for the ID of this floodlight activity. This is a
-- read-only, auto-generated field.
faIdDimensionValue :: Lens' FloodlightActivity (Maybe DimensionValue)
faIdDimensionValue
= lens _faIdDimensionValue
(\ s a -> s{_faIdDimensionValue = a})
-- | Tag format type for the floodlight activity. If left blank, the tag
-- format will default to HTML.
faTagFormat :: Lens' FloodlightActivity (Maybe FloodlightActivityTagFormat)
faTagFormat
= lens _faTagFormat (\ s a -> s{_faTagFormat = a})
-- | Code type used for cache busting in the generated tag. Applicable only
-- when floodlightActivityGroupType is COUNTER and countingMethod is
-- STANDARD_COUNTING or UNIQUE_COUNTING.
faCacheBustingType :: Lens' FloodlightActivity (Maybe FloodlightActivityCacheBustingType)
faCacheBustingType
= lens _faCacheBustingType
(\ s a -> s{_faCacheBustingType = a})
-- | Account ID of this floodlight activity. This is a read-only field that
-- can be left blank.
faAccountId :: Lens' FloodlightActivity (Maybe Int64)
faAccountId
= lens _faAccountId (\ s a -> s{_faAccountId = a}) .
mapping _Coerce
-- | Name of this floodlight activity. This is a required field. Must be less
-- than 129 characters long and cannot contain quotes.
faName :: Lens' FloodlightActivity (Maybe Text)
faName = lens _faName (\ s a -> s{_faName = a})
-- | Publisher dynamic floodlight tags.
faPublisherTags :: Lens' FloodlightActivity [FloodlightActivityPublisherDynamicTag]
faPublisherTags
= lens _faPublisherTags
(\ s a -> s{_faPublisherTags = a})
. _Default
. _Coerce
-- | Floodlight activity group ID of this floodlight activity. This is a
-- required field.
faFloodlightActivityGroupId :: Lens' FloodlightActivity (Maybe Int64)
faFloodlightActivityGroupId
= lens _faFloodlightActivityGroupId
(\ s a -> s{_faFloodlightActivityGroupId = a})
. mapping _Coerce
-- | Type of the associated floodlight activity group. This is a read-only
-- field.
faFloodlightActivityGroupType :: Lens' FloodlightActivity (Maybe FloodlightActivityFloodlightActivityGroupType)
faFloodlightActivityGroupType
= lens _faFloodlightActivityGroupType
(\ s a -> s{_faFloodlightActivityGroupType = a})
-- | Dynamic floodlight tags.
faDefaultTags :: Lens' FloodlightActivity [FloodlightActivityDynamicTag]
faDefaultTags
= lens _faDefaultTags
(\ s a -> s{_faDefaultTags = a})
. _Default
. _Coerce
-- | The type of Floodlight tag this activity will generate. This is a
-- required field.
faFloodlightTagType :: Lens' FloodlightActivity (Maybe FloodlightActivityFloodlightTagType)
faFloodlightTagType
= lens _faFloodlightTagType
(\ s a -> s{_faFloodlightTagType = a})
-- | Name of the associated floodlight activity group. This is a read-only
-- field.
faFloodlightActivityGroupName :: Lens' FloodlightActivity (Maybe Text)
faFloodlightActivityGroupName
= lens _faFloodlightActivityGroupName
(\ s a -> s{_faFloodlightActivityGroupName = a})
-- | ID of this floodlight activity. This is a read-only, auto-generated
-- field.
faId :: Lens' FloodlightActivity (Maybe Int64)
faId
= lens _faId (\ s a -> s{_faId = a}) .
mapping _Coerce
-- | Whether this floodlight activity must be SSL-compliant.
faSSLRequired :: Lens' FloodlightActivity (Maybe Bool)
faSSLRequired
= lens _faSSLRequired
(\ s a -> s{_faSSLRequired = a})
-- | List of the user-defined variables used by this conversion tag. These
-- map to the \"u[1-100]=\" in the tags. Each of these can have a user
-- defined type. Acceptable values are U1 to U100, inclusive.
faUserDefinedVariableTypes :: Lens' FloodlightActivity [FloodlightActivityUserDefinedVariableTypesItem]
faUserDefinedVariableTypes
= lens _faUserDefinedVariableTypes
(\ s a -> s{_faUserDefinedVariableTypes = a})
. _Default
. _Coerce
-- | Subaccount ID of this floodlight activity. This is a read-only field
-- that can be left blank.
faSubAccountId :: Lens' FloodlightActivity (Maybe Int64)
faSubAccountId
= lens _faSubAccountId
(\ s a -> s{_faSubAccountId = a})
. mapping _Coerce
-- | General notes or implementation instructions for the tag.
faNotes :: Lens' FloodlightActivity (Maybe Text)
faNotes = lens _faNotes (\ s a -> s{_faNotes = a})
-- | Dimension value for the ID of the floodlight configuration. This is a
-- read-only, auto-generated field.
faFloodlightConfigurationIdDimensionValue :: Lens' FloodlightActivity (Maybe DimensionValue)
faFloodlightConfigurationIdDimensionValue
= lens _faFloodlightConfigurationIdDimensionValue
(\ s a ->
s{_faFloodlightConfigurationIdDimensionValue = a})
instance FromJSON FloodlightActivity where
parseJSON
= withObject "FloodlightActivity"
(\ o ->
FloodlightActivity' <$>
(o .:? "countingMethod") <*>
(o .:? "attributionEnabled")
<*> (o .:? "status")
<*> (o .:? "tagString")
<*> (o .:? "secure")
<*> (o .:? "expectedUrl")
<*> (o .:? "floodlightActivityGroupTagString")
<*> (o .:? "floodlightConfigurationId")
<*> (o .:? "kind")
<*> (o .:? "advertiserId")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "sslCompliant")
<*> (o .:? "idDimensionValue")
<*> (o .:? "tagFormat")
<*> (o .:? "cacheBustingType")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "publisherTags" .!= mempty)
<*> (o .:? "floodlightActivityGroupId")
<*> (o .:? "floodlightActivityGroupType")
<*> (o .:? "defaultTags" .!= mempty)
<*> (o .:? "floodlightTagType")
<*> (o .:? "floodlightActivityGroupName")
<*> (o .:? "id")
<*> (o .:? "sslRequired")
<*> (o .:? "userDefinedVariableTypes" .!= mempty)
<*> (o .:? "subaccountId")
<*> (o .:? "notes")
<*>
(o .:? "floodlightConfigurationIdDimensionValue"))
instance ToJSON FloodlightActivity where
toJSON FloodlightActivity'{..}
= object
(catMaybes
[("countingMethod" .=) <$> _faCountingMethod,
("attributionEnabled" .=) <$> _faAttributionEnabled,
("status" .=) <$> _faStatus,
("tagString" .=) <$> _faTagString,
("secure" .=) <$> _faSecure,
("expectedUrl" .=) <$> _faExpectedURL,
("floodlightActivityGroupTagString" .=) <$>
_faFloodlightActivityGroupTagString,
("floodlightConfigurationId" .=) <$>
_faFloodlightConfigurationId,
("kind" .=) <$> _faKind,
("advertiserId" .=) <$> _faAdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_faAdvertiserIdDimensionValue,
("sslCompliant" .=) <$> _faSSLCompliant,
("idDimensionValue" .=) <$> _faIdDimensionValue,
("tagFormat" .=) <$> _faTagFormat,
("cacheBustingType" .=) <$> _faCacheBustingType,
("accountId" .=) <$> _faAccountId,
("name" .=) <$> _faName,
("publisherTags" .=) <$> _faPublisherTags,
("floodlightActivityGroupId" .=) <$>
_faFloodlightActivityGroupId,
("floodlightActivityGroupType" .=) <$>
_faFloodlightActivityGroupType,
("defaultTags" .=) <$> _faDefaultTags,
("floodlightTagType" .=) <$> _faFloodlightTagType,
("floodlightActivityGroupName" .=) <$>
_faFloodlightActivityGroupName,
("id" .=) <$> _faId,
("sslRequired" .=) <$> _faSSLRequired,
("userDefinedVariableTypes" .=) <$>
_faUserDefinedVariableTypes,
("subaccountId" .=) <$> _faSubAccountId,
("notes" .=) <$> _faNotes,
("floodlightConfigurationIdDimensionValue" .=) <$>
_faFloodlightConfigurationIdDimensionValue])
-- | A custom floodlight variable.
--
-- /See:/ 'customFloodlightVariable' smart constructor.
data CustomFloodlightVariable =
CustomFloodlightVariable'
{ _cusKind :: !(Maybe Text)
, _cusValue :: !(Maybe Text)
, _cusType :: !(Maybe CustomFloodlightVariableType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CustomFloodlightVariable' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cusKind'
--
-- * 'cusValue'
--
-- * 'cusType'
customFloodlightVariable
:: CustomFloodlightVariable
customFloodlightVariable =
CustomFloodlightVariable'
{_cusKind = Nothing, _cusValue = Nothing, _cusType = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#customFloodlightVariable\".
cusKind :: Lens' CustomFloodlightVariable (Maybe Text)
cusKind = lens _cusKind (\ s a -> s{_cusKind = a})
-- | The value of the custom floodlight variable. The length of string must
-- not exceed 100 characters.
cusValue :: Lens' CustomFloodlightVariable (Maybe Text)
cusValue = lens _cusValue (\ s a -> s{_cusValue = a})
-- | The type of custom floodlight variable to supply a value for. These map
-- to the \"u[1-20]=\" in the tags.
cusType :: Lens' CustomFloodlightVariable (Maybe CustomFloodlightVariableType)
cusType = lens _cusType (\ s a -> s{_cusType = a})
instance FromJSON CustomFloodlightVariable where
parseJSON
= withObject "CustomFloodlightVariable"
(\ o ->
CustomFloodlightVariable' <$>
(o .:? "kind") <*> (o .:? "value") <*>
(o .:? "type"))
instance ToJSON CustomFloodlightVariable where
toJSON CustomFloodlightVariable'{..}
= object
(catMaybes
[("kind" .=) <$> _cusKind,
("value" .=) <$> _cusValue,
("type" .=) <$> _cusType])
-- | Platform Type List Response
--
-- /See:/ 'platformTypesListResponse' smart constructor.
data PlatformTypesListResponse =
PlatformTypesListResponse'
{ _ptlrKind :: !(Maybe Text)
, _ptlrPlatformTypes :: !(Maybe [PlatformType])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlatformTypesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ptlrKind'
--
-- * 'ptlrPlatformTypes'
platformTypesListResponse
:: PlatformTypesListResponse
platformTypesListResponse =
PlatformTypesListResponse' {_ptlrKind = Nothing, _ptlrPlatformTypes = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#platformTypesListResponse\".
ptlrKind :: Lens' PlatformTypesListResponse (Maybe Text)
ptlrKind = lens _ptlrKind (\ s a -> s{_ptlrKind = a})
-- | Platform type collection.
ptlrPlatformTypes :: Lens' PlatformTypesListResponse [PlatformType]
ptlrPlatformTypes
= lens _ptlrPlatformTypes
(\ s a -> s{_ptlrPlatformTypes = a})
. _Default
. _Coerce
instance FromJSON PlatformTypesListResponse where
parseJSON
= withObject "PlatformTypesListResponse"
(\ o ->
PlatformTypesListResponse' <$>
(o .:? "kind") <*>
(o .:? "platformTypes" .!= mempty))
instance ToJSON PlatformTypesListResponse where
toJSON PlatformTypesListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _ptlrKind,
("platformTypes" .=) <$> _ptlrPlatformTypes])
-- | Modification timestamp.
--
-- /See:/ 'lastModifiedInfo' smart constructor.
newtype LastModifiedInfo =
LastModifiedInfo'
{ _lmiTime :: Maybe (Textual Int64)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'LastModifiedInfo' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lmiTime'
lastModifiedInfo
:: LastModifiedInfo
lastModifiedInfo = LastModifiedInfo' {_lmiTime = Nothing}
-- | Timestamp of the last change in milliseconds since epoch.
lmiTime :: Lens' LastModifiedInfo (Maybe Int64)
lmiTime
= lens _lmiTime (\ s a -> s{_lmiTime = a}) .
mapping _Coerce
instance FromJSON LastModifiedInfo where
parseJSON
= withObject "LastModifiedInfo"
(\ o -> LastModifiedInfo' <$> (o .:? "time"))
instance ToJSON LastModifiedInfo where
toJSON LastModifiedInfo'{..}
= object (catMaybes [("time" .=) <$> _lmiTime])
-- | Target Window.
--
-- /See:/ 'targetWindow' smart constructor.
data TargetWindow =
TargetWindow'
{ _twCustomHTML :: !(Maybe Text)
, _twTargetWindowOption :: !(Maybe TargetWindowTargetWindowOption)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TargetWindow' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'twCustomHTML'
--
-- * 'twTargetWindowOption'
targetWindow
:: TargetWindow
targetWindow =
TargetWindow' {_twCustomHTML = Nothing, _twTargetWindowOption = Nothing}
-- | User-entered value.
twCustomHTML :: Lens' TargetWindow (Maybe Text)
twCustomHTML
= lens _twCustomHTML (\ s a -> s{_twCustomHTML = a})
-- | Type of browser window for which the backup image of the flash creative
-- can be displayed.
twTargetWindowOption :: Lens' TargetWindow (Maybe TargetWindowTargetWindowOption)
twTargetWindowOption
= lens _twTargetWindowOption
(\ s a -> s{_twTargetWindowOption = a})
instance FromJSON TargetWindow where
parseJSON
= withObject "TargetWindow"
(\ o ->
TargetWindow' <$>
(o .:? "customHtml") <*>
(o .:? "targetWindowOption"))
instance ToJSON TargetWindow where
toJSON TargetWindow'{..}
= object
(catMaybes
[("customHtml" .=) <$> _twCustomHTML,
("targetWindowOption" .=) <$> _twTargetWindowOption])
-- | AccountPermissionGroups contains a mapping of permission group IDs to
-- names. A permission group is a grouping of account permissions.
--
-- /See:/ 'accountPermissionGroup' smart constructor.
data AccountPermissionGroup =
AccountPermissionGroup'
{ _apgpKind :: !(Maybe Text)
, _apgpName :: !(Maybe Text)
, _apgpId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AccountPermissionGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'apgpKind'
--
-- * 'apgpName'
--
-- * 'apgpId'
accountPermissionGroup
:: AccountPermissionGroup
accountPermissionGroup =
AccountPermissionGroup'
{_apgpKind = Nothing, _apgpName = Nothing, _apgpId = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#accountPermissionGroup\".
apgpKind :: Lens' AccountPermissionGroup (Maybe Text)
apgpKind = lens _apgpKind (\ s a -> s{_apgpKind = a})
-- | Name of this account permission group.
apgpName :: Lens' AccountPermissionGroup (Maybe Text)
apgpName = lens _apgpName (\ s a -> s{_apgpName = a})
-- | ID of this account permission group.
apgpId :: Lens' AccountPermissionGroup (Maybe Int64)
apgpId
= lens _apgpId (\ s a -> s{_apgpId = a}) .
mapping _Coerce
instance FromJSON AccountPermissionGroup where
parseJSON
= withObject "AccountPermissionGroup"
(\ o ->
AccountPermissionGroup' <$>
(o .:? "kind") <*> (o .:? "name") <*> (o .:? "id"))
instance ToJSON AccountPermissionGroup where
toJSON AccountPermissionGroup'{..}
= object
(catMaybes
[("kind" .=) <$> _apgpKind,
("name" .=) <$> _apgpName, ("id" .=) <$> _apgpId])
-- | Contains properties of a Campaign Manager advertiser.
--
-- /See:/ 'advertiser' smart constructor.
data Advertiser =
Advertiser'
{ _advdMeasurementPartnerLink :: !(Maybe MeasurementPartnerAdvertiserLink)
, _advdOriginalFloodlightConfigurationId :: !(Maybe (Textual Int64))
, _advdStatus :: !(Maybe AdvertiserStatus)
, _advdFloodlightConfigurationId :: !(Maybe (Textual Int64))
, _advdKind :: !(Maybe Text)
, _advdSuspended :: !(Maybe Bool)
, _advdIdDimensionValue :: !(Maybe DimensionValue)
, _advdAccountId :: !(Maybe (Textual Int64))
, _advdDefaultEmail :: !(Maybe Text)
, _advdName :: !(Maybe Text)
, _advdAdvertiserGroupId :: !(Maybe (Textual Int64))
, _advdDefaultClickThroughEventTagId :: !(Maybe (Textual Int64))
, _advdId :: !(Maybe (Textual Int64))
, _advdSubAccountId :: !(Maybe (Textual Int64))
, _advdFloodlightConfigurationIdDimensionValue :: !(Maybe DimensionValue)
, _advdClickThroughURLSuffix :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Advertiser' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'advdMeasurementPartnerLink'
--
-- * 'advdOriginalFloodlightConfigurationId'
--
-- * 'advdStatus'
--
-- * 'advdFloodlightConfigurationId'
--
-- * 'advdKind'
--
-- * 'advdSuspended'
--
-- * 'advdIdDimensionValue'
--
-- * 'advdAccountId'
--
-- * 'advdDefaultEmail'
--
-- * 'advdName'
--
-- * 'advdAdvertiserGroupId'
--
-- * 'advdDefaultClickThroughEventTagId'
--
-- * 'advdId'
--
-- * 'advdSubAccountId'
--
-- * 'advdFloodlightConfigurationIdDimensionValue'
--
-- * 'advdClickThroughURLSuffix'
advertiser
:: Advertiser
advertiser =
Advertiser'
{ _advdMeasurementPartnerLink = Nothing
, _advdOriginalFloodlightConfigurationId = Nothing
, _advdStatus = Nothing
, _advdFloodlightConfigurationId = Nothing
, _advdKind = Nothing
, _advdSuspended = Nothing
, _advdIdDimensionValue = Nothing
, _advdAccountId = Nothing
, _advdDefaultEmail = Nothing
, _advdName = Nothing
, _advdAdvertiserGroupId = Nothing
, _advdDefaultClickThroughEventTagId = Nothing
, _advdId = Nothing
, _advdSubAccountId = Nothing
, _advdFloodlightConfigurationIdDimensionValue = Nothing
, _advdClickThroughURLSuffix = Nothing
}
-- | Measurement partner advertiser link for tag wrapping.
advdMeasurementPartnerLink :: Lens' Advertiser (Maybe MeasurementPartnerAdvertiserLink)
advdMeasurementPartnerLink
= lens _advdMeasurementPartnerLink
(\ s a -> s{_advdMeasurementPartnerLink = a})
-- | Original floodlight configuration before any sharing occurred. Set the
-- floodlightConfigurationId of this advertiser to
-- originalFloodlightConfigurationId to unshare the advertiser\'s current
-- floodlight configuration. You cannot unshare an advertiser\'s floodlight
-- configuration if the shared configuration has activities associated with
-- any campaign or placement.
advdOriginalFloodlightConfigurationId :: Lens' Advertiser (Maybe Int64)
advdOriginalFloodlightConfigurationId
= lens _advdOriginalFloodlightConfigurationId
(\ s a ->
s{_advdOriginalFloodlightConfigurationId = a})
. mapping _Coerce
-- | Status of this advertiser.
advdStatus :: Lens' Advertiser (Maybe AdvertiserStatus)
advdStatus
= lens _advdStatus (\ s a -> s{_advdStatus = a})
-- | Floodlight configuration ID of this advertiser. The floodlight
-- configuration ID will be created automatically, so on insert this field
-- should be left blank. This field can be set to another advertiser\'s
-- floodlight configuration ID in order to share that advertiser\'s
-- floodlight configuration with this advertiser, so long as: - This
-- advertiser\'s original floodlight configuration is not already
-- associated with floodlight activities or floodlight activity groups. -
-- This advertiser\'s original floodlight configuration is not already
-- shared with another advertiser.
advdFloodlightConfigurationId :: Lens' Advertiser (Maybe Int64)
advdFloodlightConfigurationId
= lens _advdFloodlightConfigurationId
(\ s a -> s{_advdFloodlightConfigurationId = a})
. mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#advertiser\".
advdKind :: Lens' Advertiser (Maybe Text)
advdKind = lens _advdKind (\ s a -> s{_advdKind = a})
-- | Suspension status of this advertiser.
advdSuspended :: Lens' Advertiser (Maybe Bool)
advdSuspended
= lens _advdSuspended
(\ s a -> s{_advdSuspended = a})
-- | Dimension value for the ID of this advertiser. This is a read-only,
-- auto-generated field.
advdIdDimensionValue :: Lens' Advertiser (Maybe DimensionValue)
advdIdDimensionValue
= lens _advdIdDimensionValue
(\ s a -> s{_advdIdDimensionValue = a})
-- | Account ID of this advertiser.This is a read-only field that can be left
-- blank.
advdAccountId :: Lens' Advertiser (Maybe Int64)
advdAccountId
= lens _advdAccountId
(\ s a -> s{_advdAccountId = a})
. mapping _Coerce
-- | Default email address used in sender field for tag emails.
advdDefaultEmail :: Lens' Advertiser (Maybe Text)
advdDefaultEmail
= lens _advdDefaultEmail
(\ s a -> s{_advdDefaultEmail = a})
-- | Name of this advertiser. This is a required field and must be less than
-- 256 characters long and unique among advertisers of the same account.
advdName :: Lens' Advertiser (Maybe Text)
advdName = lens _advdName (\ s a -> s{_advdName = a})
-- | ID of the advertiser group this advertiser belongs to. You can group
-- advertisers for reporting purposes, allowing you to see aggregated
-- information for all advertisers in each group.
advdAdvertiserGroupId :: Lens' Advertiser (Maybe Int64)
advdAdvertiserGroupId
= lens _advdAdvertiserGroupId
(\ s a -> s{_advdAdvertiserGroupId = a})
. mapping _Coerce
-- | ID of the click-through event tag to apply by default to the landing
-- pages of this advertiser\'s campaigns.
advdDefaultClickThroughEventTagId :: Lens' Advertiser (Maybe Int64)
advdDefaultClickThroughEventTagId
= lens _advdDefaultClickThroughEventTagId
(\ s a -> s{_advdDefaultClickThroughEventTagId = a})
. mapping _Coerce
-- | ID of this advertiser. This is a read-only, auto-generated field.
advdId :: Lens' Advertiser (Maybe Int64)
advdId
= lens _advdId (\ s a -> s{_advdId = a}) .
mapping _Coerce
-- | Subaccount ID of this advertiser.This is a read-only field that can be
-- left blank.
advdSubAccountId :: Lens' Advertiser (Maybe Int64)
advdSubAccountId
= lens _advdSubAccountId
(\ s a -> s{_advdSubAccountId = a})
. mapping _Coerce
-- | Dimension value for the ID of the floodlight configuration. This is a
-- read-only, auto-generated field.
advdFloodlightConfigurationIdDimensionValue :: Lens' Advertiser (Maybe DimensionValue)
advdFloodlightConfigurationIdDimensionValue
= lens _advdFloodlightConfigurationIdDimensionValue
(\ s a ->
s{_advdFloodlightConfigurationIdDimensionValue = a})
-- | Suffix added to click-through URL of ad creative associations under this
-- advertiser. Must be less than 129 characters long.
advdClickThroughURLSuffix :: Lens' Advertiser (Maybe Text)
advdClickThroughURLSuffix
= lens _advdClickThroughURLSuffix
(\ s a -> s{_advdClickThroughURLSuffix = a})
instance FromJSON Advertiser where
parseJSON
= withObject "Advertiser"
(\ o ->
Advertiser' <$>
(o .:? "measurementPartnerLink") <*>
(o .:? "originalFloodlightConfigurationId")
<*> (o .:? "status")
<*> (o .:? "floodlightConfigurationId")
<*> (o .:? "kind")
<*> (o .:? "suspended")
<*> (o .:? "idDimensionValue")
<*> (o .:? "accountId")
<*> (o .:? "defaultEmail")
<*> (o .:? "name")
<*> (o .:? "advertiserGroupId")
<*> (o .:? "defaultClickThroughEventTagId")
<*> (o .:? "id")
<*> (o .:? "subaccountId")
<*> (o .:? "floodlightConfigurationIdDimensionValue")
<*> (o .:? "clickThroughUrlSuffix"))
instance ToJSON Advertiser where
toJSON Advertiser'{..}
= object
(catMaybes
[("measurementPartnerLink" .=) <$>
_advdMeasurementPartnerLink,
("originalFloodlightConfigurationId" .=) <$>
_advdOriginalFloodlightConfigurationId,
("status" .=) <$> _advdStatus,
("floodlightConfigurationId" .=) <$>
_advdFloodlightConfigurationId,
("kind" .=) <$> _advdKind,
("suspended" .=) <$> _advdSuspended,
("idDimensionValue" .=) <$> _advdIdDimensionValue,
("accountId" .=) <$> _advdAccountId,
("defaultEmail" .=) <$> _advdDefaultEmail,
("name" .=) <$> _advdName,
("advertiserGroupId" .=) <$> _advdAdvertiserGroupId,
("defaultClickThroughEventTagId" .=) <$>
_advdDefaultClickThroughEventTagId,
("id" .=) <$> _advdId,
("subaccountId" .=) <$> _advdSubAccountId,
("floodlightConfigurationIdDimensionValue" .=) <$>
_advdFloodlightConfigurationIdDimensionValue,
("clickThroughUrlSuffix" .=) <$>
_advdClickThroughURLSuffix])
-- | Contains properties of auser role, which is used to manage user access.
--
-- /See:/ 'userRole' smart constructor.
data UserRole =
UserRole'
{ _urParentUserRoleId :: !(Maybe (Textual Int64))
, _urKind :: !(Maybe Text)
, _urDefaultUserRole :: !(Maybe Bool)
, _urAccountId :: !(Maybe (Textual Int64))
, _urName :: !(Maybe Text)
, _urId :: !(Maybe (Textual Int64))
, _urPermissions :: !(Maybe [UserRolePermission])
, _urSubAccountId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UserRole' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'urParentUserRoleId'
--
-- * 'urKind'
--
-- * 'urDefaultUserRole'
--
-- * 'urAccountId'
--
-- * 'urName'
--
-- * 'urId'
--
-- * 'urPermissions'
--
-- * 'urSubAccountId'
userRole
:: UserRole
userRole =
UserRole'
{ _urParentUserRoleId = Nothing
, _urKind = Nothing
, _urDefaultUserRole = Nothing
, _urAccountId = Nothing
, _urName = Nothing
, _urId = Nothing
, _urPermissions = Nothing
, _urSubAccountId = Nothing
}
-- | ID of the user role that this user role is based on or copied from. This
-- is a required field.
urParentUserRoleId :: Lens' UserRole (Maybe Int64)
urParentUserRoleId
= lens _urParentUserRoleId
(\ s a -> s{_urParentUserRoleId = a})
. mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#userRole\".
urKind :: Lens' UserRole (Maybe Text)
urKind = lens _urKind (\ s a -> s{_urKind = a})
-- | Whether this is a default user role. Default user roles are created by
-- the system for the account\/subaccount and cannot be modified or
-- deleted. Each default user role comes with a basic set of preassigned
-- permissions.
urDefaultUserRole :: Lens' UserRole (Maybe Bool)
urDefaultUserRole
= lens _urDefaultUserRole
(\ s a -> s{_urDefaultUserRole = a})
-- | Account ID of this user role. This is a read-only field that can be left
-- blank.
urAccountId :: Lens' UserRole (Maybe Int64)
urAccountId
= lens _urAccountId (\ s a -> s{_urAccountId = a}) .
mapping _Coerce
-- | Name of this user role. This is a required field. Must be less than 256
-- characters long. If this user role is under a subaccount, the name must
-- be unique among sites of the same subaccount. Otherwise, this user role
-- is a top-level user role, and the name must be unique among top-level
-- user roles of the same account.
urName :: Lens' UserRole (Maybe Text)
urName = lens _urName (\ s a -> s{_urName = a})
-- | ID of this user role. This is a read-only, auto-generated field.
urId :: Lens' UserRole (Maybe Int64)
urId
= lens _urId (\ s a -> s{_urId = a}) .
mapping _Coerce
-- | List of permissions associated with this user role.
urPermissions :: Lens' UserRole [UserRolePermission]
urPermissions
= lens _urPermissions
(\ s a -> s{_urPermissions = a})
. _Default
. _Coerce
-- | Subaccount ID of this user role. This is a read-only field that can be
-- left blank.
urSubAccountId :: Lens' UserRole (Maybe Int64)
urSubAccountId
= lens _urSubAccountId
(\ s a -> s{_urSubAccountId = a})
. mapping _Coerce
instance FromJSON UserRole where
parseJSON
= withObject "UserRole"
(\ o ->
UserRole' <$>
(o .:? "parentUserRoleId") <*> (o .:? "kind") <*>
(o .:? "defaultUserRole")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "id")
<*> (o .:? "permissions" .!= mempty)
<*> (o .:? "subaccountId"))
instance ToJSON UserRole where
toJSON UserRole'{..}
= object
(catMaybes
[("parentUserRoleId" .=) <$> _urParentUserRoleId,
("kind" .=) <$> _urKind,
("defaultUserRole" .=) <$> _urDefaultUserRole,
("accountId" .=) <$> _urAccountId,
("name" .=) <$> _urName, ("id" .=) <$> _urId,
("permissions" .=) <$> _urPermissions,
("subaccountId" .=) <$> _urSubAccountId])
-- | Represents a DfaReporting path filter.
--
-- /See:/ 'pathFilter' smart constructor.
data PathFilter =
PathFilter'
{ _pfEventFilters :: !(Maybe [EventFilter])
, _pfKind :: !(Maybe Text)
, _pfPathMatchPosition :: !(Maybe PathFilterPathMatchPosition)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PathFilter' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pfEventFilters'
--
-- * 'pfKind'
--
-- * 'pfPathMatchPosition'
pathFilter
:: PathFilter
pathFilter =
PathFilter'
{ _pfEventFilters = Nothing
, _pfKind = Nothing
, _pfPathMatchPosition = Nothing
}
-- | Event filters in path report.
pfEventFilters :: Lens' PathFilter [EventFilter]
pfEventFilters
= lens _pfEventFilters
(\ s a -> s{_pfEventFilters = a})
. _Default
. _Coerce
-- | The kind of resource this is, in this case dfareporting#pathFilter.
pfKind :: Lens' PathFilter (Maybe Text)
pfKind = lens _pfKind (\ s a -> s{_pfKind = a})
-- | Determines how the \'value\' field is matched when filtering. If not
-- specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, \'*\' is
-- allowed as a placeholder for variable length character sequences, and it
-- can be escaped with a backslash. Note, only paid search dimensions
-- (\'dfa:paidSearch*\') allow a matchType other than EXACT.
pfPathMatchPosition :: Lens' PathFilter (Maybe PathFilterPathMatchPosition)
pfPathMatchPosition
= lens _pfPathMatchPosition
(\ s a -> s{_pfPathMatchPosition = a})
instance FromJSON PathFilter where
parseJSON
= withObject "PathFilter"
(\ o ->
PathFilter' <$>
(o .:? "eventFilters" .!= mempty) <*> (o .:? "kind")
<*> (o .:? "pathMatchPosition"))
instance ToJSON PathFilter where
toJSON PathFilter'{..}
= object
(catMaybes
[("eventFilters" .=) <$> _pfEventFilters,
("kind" .=) <$> _pfKind,
("pathMatchPosition" .=) <$> _pfPathMatchPosition])
-- | Video Format List Response
--
-- /See:/ 'videoFormatsListResponse' smart constructor.
data VideoFormatsListResponse =
VideoFormatsListResponse'
{ _vflrKind :: !(Maybe Text)
, _vflrVideoFormats :: !(Maybe [VideoFormat])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'VideoFormatsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vflrKind'
--
-- * 'vflrVideoFormats'
videoFormatsListResponse
:: VideoFormatsListResponse
videoFormatsListResponse =
VideoFormatsListResponse' {_vflrKind = Nothing, _vflrVideoFormats = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#videoFormatsListResponse\".
vflrKind :: Lens' VideoFormatsListResponse (Maybe Text)
vflrKind = lens _vflrKind (\ s a -> s{_vflrKind = a})
-- | Video format collection.
vflrVideoFormats :: Lens' VideoFormatsListResponse [VideoFormat]
vflrVideoFormats
= lens _vflrVideoFormats
(\ s a -> s{_vflrVideoFormats = a})
. _Default
. _Coerce
instance FromJSON VideoFormatsListResponse where
parseJSON
= withObject "VideoFormatsListResponse"
(\ o ->
VideoFormatsListResponse' <$>
(o .:? "kind") <*> (o .:? "videoFormats" .!= mempty))
instance ToJSON VideoFormatsListResponse where
toJSON VideoFormatsListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _vflrKind,
("videoFormats" .=) <$> _vflrVideoFormats])
-- | Directory Site List Response
--
-- /See:/ 'directorySitesListResponse' smart constructor.
data DirectorySitesListResponse =
DirectorySitesListResponse'
{ _dslrNextPageToken :: !(Maybe Text)
, _dslrKind :: !(Maybe Text)
, _dslrDirectorySites :: !(Maybe [DirectorySite])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DirectorySitesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dslrNextPageToken'
--
-- * 'dslrKind'
--
-- * 'dslrDirectorySites'
directorySitesListResponse
:: DirectorySitesListResponse
directorySitesListResponse =
DirectorySitesListResponse'
{ _dslrNextPageToken = Nothing
, _dslrKind = Nothing
, _dslrDirectorySites = Nothing
}
-- | Pagination token to be used for the next list operation.
dslrNextPageToken :: Lens' DirectorySitesListResponse (Maybe Text)
dslrNextPageToken
= lens _dslrNextPageToken
(\ s a -> s{_dslrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#directorySitesListResponse\".
dslrKind :: Lens' DirectorySitesListResponse (Maybe Text)
dslrKind = lens _dslrKind (\ s a -> s{_dslrKind = a})
-- | Directory site collection.
dslrDirectorySites :: Lens' DirectorySitesListResponse [DirectorySite]
dslrDirectorySites
= lens _dslrDirectorySites
(\ s a -> s{_dslrDirectorySites = a})
. _Default
. _Coerce
instance FromJSON DirectorySitesListResponse where
parseJSON
= withObject "DirectorySitesListResponse"
(\ o ->
DirectorySitesListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "directorySites" .!= mempty))
instance ToJSON DirectorySitesListResponse where
toJSON DirectorySitesListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _dslrNextPageToken,
("kind" .=) <$> _dslrKind,
("directorySites" .=) <$> _dslrDirectorySites])
-- | The error code and description for a conversion that failed to insert or
-- update.
--
-- /See:/ 'conversionError' smart constructor.
data ConversionError =
ConversionError'
{ _ceKind :: !(Maybe Text)
, _ceCode :: !(Maybe ConversionErrorCode)
, _ceMessage :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ConversionError' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ceKind'
--
-- * 'ceCode'
--
-- * 'ceMessage'
conversionError
:: ConversionError
conversionError =
ConversionError' {_ceKind = Nothing, _ceCode = Nothing, _ceMessage = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#conversionError\".
ceKind :: Lens' ConversionError (Maybe Text)
ceKind = lens _ceKind (\ s a -> s{_ceKind = a})
-- | The error code.
ceCode :: Lens' ConversionError (Maybe ConversionErrorCode)
ceCode = lens _ceCode (\ s a -> s{_ceCode = a})
-- | A description of the error.
ceMessage :: Lens' ConversionError (Maybe Text)
ceMessage
= lens _ceMessage (\ s a -> s{_ceMessage = a})
instance FromJSON ConversionError where
parseJSON
= withObject "ConversionError"
(\ o ->
ConversionError' <$>
(o .:? "kind") <*> (o .:? "code") <*>
(o .:? "message"))
instance ToJSON ConversionError where
toJSON ConversionError'{..}
= object
(catMaybes
[("kind" .=) <$> _ceKind, ("code" .=) <$> _ceCode,
("message" .=) <$> _ceMessage])
-- | Pricing Period
--
-- /See:/ 'pricingSchedulePricingPeriod' smart constructor.
data PricingSchedulePricingPeriod =
PricingSchedulePricingPeriod'
{ _psppEndDate :: !(Maybe Date')
, _psppRateOrCostNanos :: !(Maybe (Textual Int64))
, _psppStartDate :: !(Maybe Date')
, _psppUnits :: !(Maybe (Textual Int64))
, _psppPricingComment :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PricingSchedulePricingPeriod' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'psppEndDate'
--
-- * 'psppRateOrCostNanos'
--
-- * 'psppStartDate'
--
-- * 'psppUnits'
--
-- * 'psppPricingComment'
pricingSchedulePricingPeriod
:: PricingSchedulePricingPeriod
pricingSchedulePricingPeriod =
PricingSchedulePricingPeriod'
{ _psppEndDate = Nothing
, _psppRateOrCostNanos = Nothing
, _psppStartDate = Nothing
, _psppUnits = Nothing
, _psppPricingComment = Nothing
}
psppEndDate :: Lens' PricingSchedulePricingPeriod (Maybe Day)
psppEndDate
= lens _psppEndDate (\ s a -> s{_psppEndDate = a}) .
mapping _Date
-- | Rate or cost of this pricing period in nanos (i.e., multipled by
-- 1000000000). Acceptable values are 0 to 1000000000000000000, inclusive.
psppRateOrCostNanos :: Lens' PricingSchedulePricingPeriod (Maybe Int64)
psppRateOrCostNanos
= lens _psppRateOrCostNanos
(\ s a -> s{_psppRateOrCostNanos = a})
. mapping _Coerce
psppStartDate :: Lens' PricingSchedulePricingPeriod (Maybe Day)
psppStartDate
= lens _psppStartDate
(\ s a -> s{_psppStartDate = a})
. mapping _Date
-- | Units of this pricing period. Acceptable values are 0 to 10000000000,
-- inclusive.
psppUnits :: Lens' PricingSchedulePricingPeriod (Maybe Int64)
psppUnits
= lens _psppUnits (\ s a -> s{_psppUnits = a}) .
mapping _Coerce
-- | Comments for this pricing period.
psppPricingComment :: Lens' PricingSchedulePricingPeriod (Maybe Text)
psppPricingComment
= lens _psppPricingComment
(\ s a -> s{_psppPricingComment = a})
instance FromJSON PricingSchedulePricingPeriod where
parseJSON
= withObject "PricingSchedulePricingPeriod"
(\ o ->
PricingSchedulePricingPeriod' <$>
(o .:? "endDate") <*> (o .:? "rateOrCostNanos") <*>
(o .:? "startDate")
<*> (o .:? "units")
<*> (o .:? "pricingComment"))
instance ToJSON PricingSchedulePricingPeriod where
toJSON PricingSchedulePricingPeriod'{..}
= object
(catMaybes
[("endDate" .=) <$> _psppEndDate,
("rateOrCostNanos" .=) <$> _psppRateOrCostNanos,
("startDate" .=) <$> _psppStartDate,
("units" .=) <$> _psppUnits,
("pricingComment" .=) <$> _psppPricingComment])
-- | Contains information about a region that can be targeted by ads.
--
-- /See:/ 'region' smart constructor.
data Region =
Region'
{ _regRegionCode :: !(Maybe Text)
, _regKind :: !(Maybe Text)
, _regName :: !(Maybe Text)
, _regCountryCode :: !(Maybe Text)
, _regCountryDartId :: !(Maybe (Textual Int64))
, _regDartId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Region' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'regRegionCode'
--
-- * 'regKind'
--
-- * 'regName'
--
-- * 'regCountryCode'
--
-- * 'regCountryDartId'
--
-- * 'regDartId'
region
:: Region
region =
Region'
{ _regRegionCode = Nothing
, _regKind = Nothing
, _regName = Nothing
, _regCountryCode = Nothing
, _regCountryDartId = Nothing
, _regDartId = Nothing
}
-- | Region code.
regRegionCode :: Lens' Region (Maybe Text)
regRegionCode
= lens _regRegionCode
(\ s a -> s{_regRegionCode = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#region\".
regKind :: Lens' Region (Maybe Text)
regKind = lens _regKind (\ s a -> s{_regKind = a})
-- | Name of this region.
regName :: Lens' Region (Maybe Text)
regName = lens _regName (\ s a -> s{_regName = a})
-- | Country code of the country to which this region belongs.
regCountryCode :: Lens' Region (Maybe Text)
regCountryCode
= lens _regCountryCode
(\ s a -> s{_regCountryCode = a})
-- | DART ID of the country to which this region belongs.
regCountryDartId :: Lens' Region (Maybe Int64)
regCountryDartId
= lens _regCountryDartId
(\ s a -> s{_regCountryDartId = a})
. mapping _Coerce
-- | DART ID of this region.
regDartId :: Lens' Region (Maybe Int64)
regDartId
= lens _regDartId (\ s a -> s{_regDartId = a}) .
mapping _Coerce
instance FromJSON Region where
parseJSON
= withObject "Region"
(\ o ->
Region' <$>
(o .:? "regionCode") <*> (o .:? "kind") <*>
(o .:? "name")
<*> (o .:? "countryCode")
<*> (o .:? "countryDartId")
<*> (o .:? "dartId"))
instance ToJSON Region where
toJSON Region'{..}
= object
(catMaybes
[("regionCode" .=) <$> _regRegionCode,
("kind" .=) <$> _regKind, ("name" .=) <$> _regName,
("countryCode" .=) <$> _regCountryCode,
("countryDartId" .=) <$> _regCountryDartId,
("dartId" .=) <$> _regDartId])
-- | Advertiser Group List Response
--
-- /See:/ 'advertiserGroupsListResponse' smart constructor.
data AdvertiserGroupsListResponse =
AdvertiserGroupsListResponse'
{ _aglrNextPageToken :: !(Maybe Text)
, _aglrKind :: !(Maybe Text)
, _aglrAdvertiserGroups :: !(Maybe [AdvertiserGroup])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AdvertiserGroupsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aglrNextPageToken'
--
-- * 'aglrKind'
--
-- * 'aglrAdvertiserGroups'
advertiserGroupsListResponse
:: AdvertiserGroupsListResponse
advertiserGroupsListResponse =
AdvertiserGroupsListResponse'
{ _aglrNextPageToken = Nothing
, _aglrKind = Nothing
, _aglrAdvertiserGroups = Nothing
}
-- | Pagination token to be used for the next list operation.
aglrNextPageToken :: Lens' AdvertiserGroupsListResponse (Maybe Text)
aglrNextPageToken
= lens _aglrNextPageToken
(\ s a -> s{_aglrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#advertiserGroupsListResponse\".
aglrKind :: Lens' AdvertiserGroupsListResponse (Maybe Text)
aglrKind = lens _aglrKind (\ s a -> s{_aglrKind = a})
-- | Advertiser group collection.
aglrAdvertiserGroups :: Lens' AdvertiserGroupsListResponse [AdvertiserGroup]
aglrAdvertiserGroups
= lens _aglrAdvertiserGroups
(\ s a -> s{_aglrAdvertiserGroups = a})
. _Default
. _Coerce
instance FromJSON AdvertiserGroupsListResponse where
parseJSON
= withObject "AdvertiserGroupsListResponse"
(\ o ->
AdvertiserGroupsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "advertiserGroups" .!= mempty))
instance ToJSON AdvertiserGroupsListResponse where
toJSON AdvertiserGroupsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _aglrNextPageToken,
("kind" .=) <$> _aglrKind,
("advertiserGroups" .=) <$> _aglrAdvertiserGroups])
-- | Creative Assignment.
--
-- /See:/ 'creativeAssignment' smart constructor.
data CreativeAssignment =
CreativeAssignment'
{ _caCreativeGroupAssignments :: !(Maybe [CreativeGroupAssignment])
, _caStartTime :: !(Maybe DateTime')
, _caWeight :: !(Maybe (Textual Int32))
, _caRichMediaExitOverrides :: !(Maybe [RichMediaExitOverride])
, _caSSLCompliant :: !(Maybe Bool)
, _caCreativeId :: !(Maybe (Textual Int64))
, _caClickThroughURL :: !(Maybe ClickThroughURL)
, _caApplyEventTags :: !(Maybe Bool)
, _caActive :: !(Maybe Bool)
, _caSequence :: !(Maybe (Textual Int32))
, _caEndTime :: !(Maybe DateTime')
, _caCompanionCreativeOverrides :: !(Maybe [CompanionClickThroughOverride])
, _caCreativeIdDimensionValue :: !(Maybe DimensionValue)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeAssignment' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'caCreativeGroupAssignments'
--
-- * 'caStartTime'
--
-- * 'caWeight'
--
-- * 'caRichMediaExitOverrides'
--
-- * 'caSSLCompliant'
--
-- * 'caCreativeId'
--
-- * 'caClickThroughURL'
--
-- * 'caApplyEventTags'
--
-- * 'caActive'
--
-- * 'caSequence'
--
-- * 'caEndTime'
--
-- * 'caCompanionCreativeOverrides'
--
-- * 'caCreativeIdDimensionValue'
creativeAssignment
:: CreativeAssignment
creativeAssignment =
CreativeAssignment'
{ _caCreativeGroupAssignments = Nothing
, _caStartTime = Nothing
, _caWeight = Nothing
, _caRichMediaExitOverrides = Nothing
, _caSSLCompliant = Nothing
, _caCreativeId = Nothing
, _caClickThroughURL = Nothing
, _caApplyEventTags = Nothing
, _caActive = Nothing
, _caSequence = Nothing
, _caEndTime = Nothing
, _caCompanionCreativeOverrides = Nothing
, _caCreativeIdDimensionValue = Nothing
}
-- | Creative group assignments for this creative assignment. Only one
-- assignment per creative group number is allowed for a maximum of two
-- assignments.
caCreativeGroupAssignments :: Lens' CreativeAssignment [CreativeGroupAssignment]
caCreativeGroupAssignments
= lens _caCreativeGroupAssignments
(\ s a -> s{_caCreativeGroupAssignments = a})
. _Default
. _Coerce
caStartTime :: Lens' CreativeAssignment (Maybe UTCTime)
caStartTime
= lens _caStartTime (\ s a -> s{_caStartTime = a}) .
mapping _DateTime
-- | Weight of the creative assignment, applicable when the rotation type is
-- CREATIVE_ROTATION_TYPE_RANDOM. Value must be greater than or equal to 1.
caWeight :: Lens' CreativeAssignment (Maybe Int32)
caWeight
= lens _caWeight (\ s a -> s{_caWeight = a}) .
mapping _Coerce
-- | Rich media exit overrides for this creative assignment. Applicable when
-- the creative type is any of the following: - DISPLAY - RICH_MEDIA_INPAGE
-- - RICH_MEDIA_INPAGE_FLOATING - RICH_MEDIA_IM_EXPAND -
-- RICH_MEDIA_EXPANDING - RICH_MEDIA_INTERSTITIAL_FLOAT -
-- RICH_MEDIA_MOBILE_IN_APP - RICH_MEDIA_MULTI_FLOATING -
-- RICH_MEDIA_PEEL_DOWN - VPAID_LINEAR - VPAID_NON_LINEAR
caRichMediaExitOverrides :: Lens' CreativeAssignment [RichMediaExitOverride]
caRichMediaExitOverrides
= lens _caRichMediaExitOverrides
(\ s a -> s{_caRichMediaExitOverrides = a})
. _Default
. _Coerce
-- | Whether the creative to be assigned is SSL-compliant. This is a
-- read-only field that is auto-generated when the ad is inserted or
-- updated.
caSSLCompliant :: Lens' CreativeAssignment (Maybe Bool)
caSSLCompliant
= lens _caSSLCompliant
(\ s a -> s{_caSSLCompliant = a})
-- | ID of the creative to be assigned. This is a required field.
caCreativeId :: Lens' CreativeAssignment (Maybe Int64)
caCreativeId
= lens _caCreativeId (\ s a -> s{_caCreativeId = a})
. mapping _Coerce
-- | Click-through URL of the creative assignment.
caClickThroughURL :: Lens' CreativeAssignment (Maybe ClickThroughURL)
caClickThroughURL
= lens _caClickThroughURL
(\ s a -> s{_caClickThroughURL = a})
-- | Whether applicable event tags should fire when this creative assignment
-- is rendered. If this value is unset when the ad is inserted or updated,
-- it will default to true for all creative types EXCEPT for
-- INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO.
caApplyEventTags :: Lens' CreativeAssignment (Maybe Bool)
caApplyEventTags
= lens _caApplyEventTags
(\ s a -> s{_caApplyEventTags = a})
-- | Whether this creative assignment is active. When true, the creative will
-- be included in the ad\'s rotation.
caActive :: Lens' CreativeAssignment (Maybe Bool)
caActive = lens _caActive (\ s a -> s{_caActive = a})
-- | Sequence number of the creative assignment, applicable when the rotation
-- type is CREATIVE_ROTATION_TYPE_SEQUENTIAL. Acceptable values are 1 to
-- 65535, inclusive.
caSequence :: Lens' CreativeAssignment (Maybe Int32)
caSequence
= lens _caSequence (\ s a -> s{_caSequence = a}) .
mapping _Coerce
caEndTime :: Lens' CreativeAssignment (Maybe UTCTime)
caEndTime
= lens _caEndTime (\ s a -> s{_caEndTime = a}) .
mapping _DateTime
-- | Companion creative overrides for this creative assignment. Applicable to
-- video ads.
caCompanionCreativeOverrides :: Lens' CreativeAssignment [CompanionClickThroughOverride]
caCompanionCreativeOverrides
= lens _caCompanionCreativeOverrides
(\ s a -> s{_caCompanionCreativeOverrides = a})
. _Default
. _Coerce
-- | Dimension value for the ID of the creative. This is a read-only,
-- auto-generated field.
caCreativeIdDimensionValue :: Lens' CreativeAssignment (Maybe DimensionValue)
caCreativeIdDimensionValue
= lens _caCreativeIdDimensionValue
(\ s a -> s{_caCreativeIdDimensionValue = a})
instance FromJSON CreativeAssignment where
parseJSON
= withObject "CreativeAssignment"
(\ o ->
CreativeAssignment' <$>
(o .:? "creativeGroupAssignments" .!= mempty) <*>
(o .:? "startTime")
<*> (o .:? "weight")
<*> (o .:? "richMediaExitOverrides" .!= mempty)
<*> (o .:? "sslCompliant")
<*> (o .:? "creativeId")
<*> (o .:? "clickThroughUrl")
<*> (o .:? "applyEventTags")
<*> (o .:? "active")
<*> (o .:? "sequence")
<*> (o .:? "endTime")
<*> (o .:? "companionCreativeOverrides" .!= mempty)
<*> (o .:? "creativeIdDimensionValue"))
instance ToJSON CreativeAssignment where
toJSON CreativeAssignment'{..}
= object
(catMaybes
[("creativeGroupAssignments" .=) <$>
_caCreativeGroupAssignments,
("startTime" .=) <$> _caStartTime,
("weight" .=) <$> _caWeight,
("richMediaExitOverrides" .=) <$>
_caRichMediaExitOverrides,
("sslCompliant" .=) <$> _caSSLCompliant,
("creativeId" .=) <$> _caCreativeId,
("clickThroughUrl" .=) <$> _caClickThroughURL,
("applyEventTags" .=) <$> _caApplyEventTags,
("active" .=) <$> _caActive,
("sequence" .=) <$> _caSequence,
("endTime" .=) <$> _caEndTime,
("companionCreativeOverrides" .=) <$>
_caCompanionCreativeOverrides,
("creativeIdDimensionValue" .=) <$>
_caCreativeIdDimensionValue])
-- | Represents a dimension filter.
--
-- /See:/ 'dimensionFilter' smart constructor.
data DimensionFilter =
DimensionFilter'
{ _dfKind :: !(Maybe Text)
, _dfValue :: !(Maybe Text)
, _dfDimensionName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DimensionFilter' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dfKind'
--
-- * 'dfValue'
--
-- * 'dfDimensionName'
dimensionFilter
:: DimensionFilter
dimensionFilter =
DimensionFilter'
{_dfKind = Nothing, _dfValue = Nothing, _dfDimensionName = Nothing}
-- | The kind of resource this is, in this case dfareporting#dimensionFilter.
dfKind :: Lens' DimensionFilter (Maybe Text)
dfKind = lens _dfKind (\ s a -> s{_dfKind = a})
-- | The value of the dimension to filter.
dfValue :: Lens' DimensionFilter (Maybe Text)
dfValue = lens _dfValue (\ s a -> s{_dfValue = a})
-- | The name of the dimension to filter.
dfDimensionName :: Lens' DimensionFilter (Maybe Text)
dfDimensionName
= lens _dfDimensionName
(\ s a -> s{_dfDimensionName = a})
instance FromJSON DimensionFilter where
parseJSON
= withObject "DimensionFilter"
(\ o ->
DimensionFilter' <$>
(o .:? "kind") <*> (o .:? "value") <*>
(o .:? "dimensionName"))
instance ToJSON DimensionFilter where
toJSON DimensionFilter'{..}
= object
(catMaybes
[("kind" .=) <$> _dfKind, ("value" .=) <$> _dfValue,
("dimensionName" .=) <$> _dfDimensionName])
-- | Represents a PathReportDimensionValue resource.
--
-- /See:/ 'pathReportDimensionValue' smart constructor.
data PathReportDimensionValue =
PathReportDimensionValue'
{ _prdvKind :: !(Maybe Text)
, _prdvValues :: !(Maybe [Text])
, _prdvMatchType :: !(Maybe PathReportDimensionValueMatchType)
, _prdvIds :: !(Maybe [Text])
, _prdvDimensionName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PathReportDimensionValue' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'prdvKind'
--
-- * 'prdvValues'
--
-- * 'prdvMatchType'
--
-- * 'prdvIds'
--
-- * 'prdvDimensionName'
pathReportDimensionValue
:: PathReportDimensionValue
pathReportDimensionValue =
PathReportDimensionValue'
{ _prdvKind = Nothing
, _prdvValues = Nothing
, _prdvMatchType = Nothing
, _prdvIds = Nothing
, _prdvDimensionName = Nothing
}
-- | The kind of resource this is, in this case
-- dfareporting#pathReportDimensionValue.
prdvKind :: Lens' PathReportDimensionValue (Maybe Text)
prdvKind = lens _prdvKind (\ s a -> s{_prdvKind = a})
-- | The possible values of the dimension.
prdvValues :: Lens' PathReportDimensionValue [Text]
prdvValues
= lens _prdvValues (\ s a -> s{_prdvValues = a}) .
_Default
. _Coerce
-- | Determines how the \'value\' field is matched when filtering. If not
-- specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, \'*\' is
-- allowed as a placeholder for variable length character sequences, and it
-- can be escaped with a backslash. Note, only paid search dimensions
-- (\'dfa:paidSearch*\') allow a matchType other than EXACT.
prdvMatchType :: Lens' PathReportDimensionValue (Maybe PathReportDimensionValueMatchType)
prdvMatchType
= lens _prdvMatchType
(\ s a -> s{_prdvMatchType = a})
-- | The possible ID\'s associated with the value if available.
prdvIds :: Lens' PathReportDimensionValue [Text]
prdvIds
= lens _prdvIds (\ s a -> s{_prdvIds = a}) . _Default
. _Coerce
-- | The name of the dimension.
prdvDimensionName :: Lens' PathReportDimensionValue (Maybe Text)
prdvDimensionName
= lens _prdvDimensionName
(\ s a -> s{_prdvDimensionName = a})
instance FromJSON PathReportDimensionValue where
parseJSON
= withObject "PathReportDimensionValue"
(\ o ->
PathReportDimensionValue' <$>
(o .:? "kind") <*> (o .:? "values" .!= mempty) <*>
(o .:? "matchType")
<*> (o .:? "ids" .!= mempty)
<*> (o .:? "dimensionName"))
instance ToJSON PathReportDimensionValue where
toJSON PathReportDimensionValue'{..}
= object
(catMaybes
[("kind" .=) <$> _prdvKind,
("values" .=) <$> _prdvValues,
("matchType" .=) <$> _prdvMatchType,
("ids" .=) <$> _prdvIds,
("dimensionName" .=) <$> _prdvDimensionName])
-- | Represents the list of user profiles.
--
-- /See:/ 'userProFileList' smart constructor.
data UserProFileList =
UserProFileList'
{ _upflEtag :: !(Maybe Text)
, _upflKind :: !(Maybe Text)
, _upflItems :: !(Maybe [UserProFile])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UserProFileList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'upflEtag'
--
-- * 'upflKind'
--
-- * 'upflItems'
userProFileList
:: UserProFileList
userProFileList =
UserProFileList'
{_upflEtag = Nothing, _upflKind = Nothing, _upflItems = Nothing}
-- | Etag of this resource.
upflEtag :: Lens' UserProFileList (Maybe Text)
upflEtag = lens _upflEtag (\ s a -> s{_upflEtag = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#userProfileList\".
upflKind :: Lens' UserProFileList (Maybe Text)
upflKind = lens _upflKind (\ s a -> s{_upflKind = a})
-- | The user profiles returned in this response.
upflItems :: Lens' UserProFileList [UserProFile]
upflItems
= lens _upflItems (\ s a -> s{_upflItems = a}) .
_Default
. _Coerce
instance FromJSON UserProFileList where
parseJSON
= withObject "UserProFileList"
(\ o ->
UserProFileList' <$>
(o .:? "etag") <*> (o .:? "kind") <*>
(o .:? "items" .!= mempty))
instance ToJSON UserProFileList where
toJSON UserProFileList'{..}
= object
(catMaybes
[("etag" .=) <$> _upflEtag,
("kind" .=) <$> _upflKind,
("items" .=) <$> _upflItems])
-- | Contains properties of a Floodlight configuration.
--
-- /See:/ 'floodlightConfiguration' smart constructor.
data FloodlightConfiguration =
FloodlightConfiguration'
{ _fcTagSettings :: !(Maybe TagSettings)
, _fcExposureToConversionEnabled :: !(Maybe Bool)
, _fcInAppAttributionTrackingEnabled :: !(Maybe Bool)
, _fcThirdPartyAuthenticationTokens :: !(Maybe [ThirdPartyAuthenticationToken])
, _fcKind :: !(Maybe Text)
, _fcAdvertiserId :: !(Maybe (Textual Int64))
, _fcAnalyticsDataSharingEnabled :: !(Maybe Bool)
, _fcAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _fcIdDimensionValue :: !(Maybe DimensionValue)
, _fcLookbackConfiguration :: !(Maybe LookbackConfiguration)
, _fcAccountId :: !(Maybe (Textual Int64))
, _fcId :: !(Maybe (Textual Int64))
, _fcNATuralSearchConversionAttributionOption :: !(Maybe FloodlightConfigurationNATuralSearchConversionAttributionOption)
, _fcUserDefinedVariableConfigurations :: !(Maybe [UserDefinedVariableConfiguration])
, _fcSubAccountId :: !(Maybe (Textual Int64))
, _fcCustomViewabilityMetric :: !(Maybe CustomViewabilityMetric)
, _fcFirstDayOfWeek :: !(Maybe FloodlightConfigurationFirstDayOfWeek)
, _fcOmnitureSettings :: !(Maybe OmnitureSettings)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fcTagSettings'
--
-- * 'fcExposureToConversionEnabled'
--
-- * 'fcInAppAttributionTrackingEnabled'
--
-- * 'fcThirdPartyAuthenticationTokens'
--
-- * 'fcKind'
--
-- * 'fcAdvertiserId'
--
-- * 'fcAnalyticsDataSharingEnabled'
--
-- * 'fcAdvertiserIdDimensionValue'
--
-- * 'fcIdDimensionValue'
--
-- * 'fcLookbackConfiguration'
--
-- * 'fcAccountId'
--
-- * 'fcId'
--
-- * 'fcNATuralSearchConversionAttributionOption'
--
-- * 'fcUserDefinedVariableConfigurations'
--
-- * 'fcSubAccountId'
--
-- * 'fcCustomViewabilityMetric'
--
-- * 'fcFirstDayOfWeek'
--
-- * 'fcOmnitureSettings'
floodlightConfiguration
:: FloodlightConfiguration
floodlightConfiguration =
FloodlightConfiguration'
{ _fcTagSettings = Nothing
, _fcExposureToConversionEnabled = Nothing
, _fcInAppAttributionTrackingEnabled = Nothing
, _fcThirdPartyAuthenticationTokens = Nothing
, _fcKind = Nothing
, _fcAdvertiserId = Nothing
, _fcAnalyticsDataSharingEnabled = Nothing
, _fcAdvertiserIdDimensionValue = Nothing
, _fcIdDimensionValue = Nothing
, _fcLookbackConfiguration = Nothing
, _fcAccountId = Nothing
, _fcId = Nothing
, _fcNATuralSearchConversionAttributionOption = Nothing
, _fcUserDefinedVariableConfigurations = Nothing
, _fcSubAccountId = Nothing
, _fcCustomViewabilityMetric = Nothing
, _fcFirstDayOfWeek = Nothing
, _fcOmnitureSettings = Nothing
}
-- | Configuration settings for dynamic and image floodlight tags.
fcTagSettings :: Lens' FloodlightConfiguration (Maybe TagSettings)
fcTagSettings
= lens _fcTagSettings
(\ s a -> s{_fcTagSettings = a})
-- | Whether the exposure-to-conversion report is enabled. This report shows
-- detailed pathway information on up to 10 of the most recent ad exposures
-- seen by a user before converting.
fcExposureToConversionEnabled :: Lens' FloodlightConfiguration (Maybe Bool)
fcExposureToConversionEnabled
= lens _fcExposureToConversionEnabled
(\ s a -> s{_fcExposureToConversionEnabled = a})
-- | Whether in-app attribution tracking is enabled.
fcInAppAttributionTrackingEnabled :: Lens' FloodlightConfiguration (Maybe Bool)
fcInAppAttributionTrackingEnabled
= lens _fcInAppAttributionTrackingEnabled
(\ s a -> s{_fcInAppAttributionTrackingEnabled = a})
-- | List of third-party authentication tokens enabled for this
-- configuration.
fcThirdPartyAuthenticationTokens :: Lens' FloodlightConfiguration [ThirdPartyAuthenticationToken]
fcThirdPartyAuthenticationTokens
= lens _fcThirdPartyAuthenticationTokens
(\ s a -> s{_fcThirdPartyAuthenticationTokens = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#floodlightConfiguration\".
fcKind :: Lens' FloodlightConfiguration (Maybe Text)
fcKind = lens _fcKind (\ s a -> s{_fcKind = a})
-- | Advertiser ID of the parent advertiser of this floodlight configuration.
fcAdvertiserId :: Lens' FloodlightConfiguration (Maybe Int64)
fcAdvertiserId
= lens _fcAdvertiserId
(\ s a -> s{_fcAdvertiserId = a})
. mapping _Coerce
-- | Whether advertiser data is shared with Google Analytics.
fcAnalyticsDataSharingEnabled :: Lens' FloodlightConfiguration (Maybe Bool)
fcAnalyticsDataSharingEnabled
= lens _fcAnalyticsDataSharingEnabled
(\ s a -> s{_fcAnalyticsDataSharingEnabled = a})
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
fcAdvertiserIdDimensionValue :: Lens' FloodlightConfiguration (Maybe DimensionValue)
fcAdvertiserIdDimensionValue
= lens _fcAdvertiserIdDimensionValue
(\ s a -> s{_fcAdvertiserIdDimensionValue = a})
-- | Dimension value for the ID of this floodlight configuration. This is a
-- read-only, auto-generated field.
fcIdDimensionValue :: Lens' FloodlightConfiguration (Maybe DimensionValue)
fcIdDimensionValue
= lens _fcIdDimensionValue
(\ s a -> s{_fcIdDimensionValue = a})
-- | Lookback window settings for this floodlight configuration.
fcLookbackConfiguration :: Lens' FloodlightConfiguration (Maybe LookbackConfiguration)
fcLookbackConfiguration
= lens _fcLookbackConfiguration
(\ s a -> s{_fcLookbackConfiguration = a})
-- | Account ID of this floodlight configuration. This is a read-only field
-- that can be left blank.
fcAccountId :: Lens' FloodlightConfiguration (Maybe Int64)
fcAccountId
= lens _fcAccountId (\ s a -> s{_fcAccountId = a}) .
mapping _Coerce
-- | ID of this floodlight configuration. This is a read-only, auto-generated
-- field.
fcId :: Lens' FloodlightConfiguration (Maybe Int64)
fcId
= lens _fcId (\ s a -> s{_fcId = a}) .
mapping _Coerce
-- | Types of attribution options for natural search conversions.
fcNATuralSearchConversionAttributionOption :: Lens' FloodlightConfiguration (Maybe FloodlightConfigurationNATuralSearchConversionAttributionOption)
fcNATuralSearchConversionAttributionOption
= lens _fcNATuralSearchConversionAttributionOption
(\ s a ->
s{_fcNATuralSearchConversionAttributionOption = a})
-- | List of user defined variables enabled for this configuration.
fcUserDefinedVariableConfigurations :: Lens' FloodlightConfiguration [UserDefinedVariableConfiguration]
fcUserDefinedVariableConfigurations
= lens _fcUserDefinedVariableConfigurations
(\ s a ->
s{_fcUserDefinedVariableConfigurations = a})
. _Default
. _Coerce
-- | Subaccount ID of this floodlight configuration. This is a read-only
-- field that can be left blank.
fcSubAccountId :: Lens' FloodlightConfiguration (Maybe Int64)
fcSubAccountId
= lens _fcSubAccountId
(\ s a -> s{_fcSubAccountId = a})
. mapping _Coerce
-- | Custom Viewability metric for the floodlight configuration.
fcCustomViewabilityMetric :: Lens' FloodlightConfiguration (Maybe CustomViewabilityMetric)
fcCustomViewabilityMetric
= lens _fcCustomViewabilityMetric
(\ s a -> s{_fcCustomViewabilityMetric = a})
-- | Day that will be counted as the first day of the week in reports. This
-- is a required field.
fcFirstDayOfWeek :: Lens' FloodlightConfiguration (Maybe FloodlightConfigurationFirstDayOfWeek)
fcFirstDayOfWeek
= lens _fcFirstDayOfWeek
(\ s a -> s{_fcFirstDayOfWeek = a})
-- | Settings for Campaign Manager Omniture integration.
fcOmnitureSettings :: Lens' FloodlightConfiguration (Maybe OmnitureSettings)
fcOmnitureSettings
= lens _fcOmnitureSettings
(\ s a -> s{_fcOmnitureSettings = a})
instance FromJSON FloodlightConfiguration where
parseJSON
= withObject "FloodlightConfiguration"
(\ o ->
FloodlightConfiguration' <$>
(o .:? "tagSettings") <*>
(o .:? "exposureToConversionEnabled")
<*> (o .:? "inAppAttributionTrackingEnabled")
<*>
(o .:? "thirdPartyAuthenticationTokens" .!= mempty)
<*> (o .:? "kind")
<*> (o .:? "advertiserId")
<*> (o .:? "analyticsDataSharingEnabled")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "idDimensionValue")
<*> (o .:? "lookbackConfiguration")
<*> (o .:? "accountId")
<*> (o .:? "id")
<*>
(o .:? "naturalSearchConversionAttributionOption")
<*>
(o .:? "userDefinedVariableConfigurations" .!=
mempty)
<*> (o .:? "subaccountId")
<*> (o .:? "customViewabilityMetric")
<*> (o .:? "firstDayOfWeek")
<*> (o .:? "omnitureSettings"))
instance ToJSON FloodlightConfiguration where
toJSON FloodlightConfiguration'{..}
= object
(catMaybes
[("tagSettings" .=) <$> _fcTagSettings,
("exposureToConversionEnabled" .=) <$>
_fcExposureToConversionEnabled,
("inAppAttributionTrackingEnabled" .=) <$>
_fcInAppAttributionTrackingEnabled,
("thirdPartyAuthenticationTokens" .=) <$>
_fcThirdPartyAuthenticationTokens,
("kind" .=) <$> _fcKind,
("advertiserId" .=) <$> _fcAdvertiserId,
("analyticsDataSharingEnabled" .=) <$>
_fcAnalyticsDataSharingEnabled,
("advertiserIdDimensionValue" .=) <$>
_fcAdvertiserIdDimensionValue,
("idDimensionValue" .=) <$> _fcIdDimensionValue,
("lookbackConfiguration" .=) <$>
_fcLookbackConfiguration,
("accountId" .=) <$> _fcAccountId,
("id" .=) <$> _fcId,
("naturalSearchConversionAttributionOption" .=) <$>
_fcNATuralSearchConversionAttributionOption,
("userDefinedVariableConfigurations" .=) <$>
_fcUserDefinedVariableConfigurations,
("subaccountId" .=) <$> _fcSubAccountId,
("customViewabilityMetric" .=) <$>
_fcCustomViewabilityMetric,
("firstDayOfWeek" .=) <$> _fcFirstDayOfWeek,
("omnitureSettings" .=) <$> _fcOmnitureSettings])
-- | Companion Settings
--
-- /See:/ 'companionSetting' smart constructor.
data CompanionSetting =
CompanionSetting'
{ _comKind :: !(Maybe Text)
, _comImageOnly :: !(Maybe Bool)
, _comCompanionsDisabled :: !(Maybe Bool)
, _comEnabledSizes :: !(Maybe [Size])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CompanionSetting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'comKind'
--
-- * 'comImageOnly'
--
-- * 'comCompanionsDisabled'
--
-- * 'comEnabledSizes'
companionSetting
:: CompanionSetting
companionSetting =
CompanionSetting'
{ _comKind = Nothing
, _comImageOnly = Nothing
, _comCompanionsDisabled = Nothing
, _comEnabledSizes = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#companionSetting\".
comKind :: Lens' CompanionSetting (Maybe Text)
comKind = lens _comKind (\ s a -> s{_comKind = a})
-- | Whether to serve only static images as companions.
comImageOnly :: Lens' CompanionSetting (Maybe Bool)
comImageOnly
= lens _comImageOnly (\ s a -> s{_comImageOnly = a})
-- | Whether companions are disabled for this placement.
comCompanionsDisabled :: Lens' CompanionSetting (Maybe Bool)
comCompanionsDisabled
= lens _comCompanionsDisabled
(\ s a -> s{_comCompanionsDisabled = a})
-- | Allowlist of companion sizes to be served to this placement. Set this
-- list to null or empty to serve all companion sizes.
comEnabledSizes :: Lens' CompanionSetting [Size]
comEnabledSizes
= lens _comEnabledSizes
(\ s a -> s{_comEnabledSizes = a})
. _Default
. _Coerce
instance FromJSON CompanionSetting where
parseJSON
= withObject "CompanionSetting"
(\ o ->
CompanionSetting' <$>
(o .:? "kind") <*> (o .:? "imageOnly") <*>
(o .:? "companionsDisabled")
<*> (o .:? "enabledSizes" .!= mempty))
instance ToJSON CompanionSetting where
toJSON CompanionSetting'{..}
= object
(catMaybes
[("kind" .=) <$> _comKind,
("imageOnly" .=) <$> _comImageOnly,
("companionsDisabled" .=) <$> _comCompanionsDisabled,
("enabledSizes" .=) <$> _comEnabledSizes])
-- | Floodlight Activity Group List Response
--
-- /See:/ 'floodlightActivityGroupsListResponse' smart constructor.
data FloodlightActivityGroupsListResponse =
FloodlightActivityGroupsListResponse'
{ _faglrNextPageToken :: !(Maybe Text)
, _faglrKind :: !(Maybe Text)
, _faglrFloodlightActivityGroups :: !(Maybe [FloodlightActivityGroup])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightActivityGroupsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'faglrNextPageToken'
--
-- * 'faglrKind'
--
-- * 'faglrFloodlightActivityGroups'
floodlightActivityGroupsListResponse
:: FloodlightActivityGroupsListResponse
floodlightActivityGroupsListResponse =
FloodlightActivityGroupsListResponse'
{ _faglrNextPageToken = Nothing
, _faglrKind = Nothing
, _faglrFloodlightActivityGroups = Nothing
}
-- | Pagination token to be used for the next list operation.
faglrNextPageToken :: Lens' FloodlightActivityGroupsListResponse (Maybe Text)
faglrNextPageToken
= lens _faglrNextPageToken
(\ s a -> s{_faglrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#floodlightActivityGroupsListResponse\".
faglrKind :: Lens' FloodlightActivityGroupsListResponse (Maybe Text)
faglrKind
= lens _faglrKind (\ s a -> s{_faglrKind = a})
-- | Floodlight activity group collection.
faglrFloodlightActivityGroups :: Lens' FloodlightActivityGroupsListResponse [FloodlightActivityGroup]
faglrFloodlightActivityGroups
= lens _faglrFloodlightActivityGroups
(\ s a -> s{_faglrFloodlightActivityGroups = a})
. _Default
. _Coerce
instance FromJSON
FloodlightActivityGroupsListResponse
where
parseJSON
= withObject "FloodlightActivityGroupsListResponse"
(\ o ->
FloodlightActivityGroupsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "floodlightActivityGroups" .!= mempty))
instance ToJSON FloodlightActivityGroupsListResponse
where
toJSON FloodlightActivityGroupsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _faglrNextPageToken,
("kind" .=) <$> _faglrKind,
("floodlightActivityGroups" .=) <$>
_faglrFloodlightActivityGroups])
-- | A Conversion represents when a user successfully performs a desired
-- action after seeing an ad.
--
-- /See:/ 'conversion' smart constructor.
data Conversion =
Conversion'
{ _conoTreatmentForUnderage :: !(Maybe Bool)
, _conoEncryptedUserIdCandidates :: !(Maybe [Text])
, _conoTimestampMicros :: !(Maybe (Textual Int64))
, _conoLimitAdTracking :: !(Maybe Bool)
, _conoEncryptedUserId :: !(Maybe Text)
, _conoMobileDeviceId :: !(Maybe Text)
, _conoFloodlightConfigurationId :: !(Maybe (Textual Int64))
, _conoKind :: !(Maybe Text)
, _conoFloodlightActivityId :: !(Maybe (Textual Int64))
, _conoNonPersonalizedAd :: !(Maybe Bool)
, _conoQuantity :: !(Maybe (Textual Int64))
, _conoValue :: !(Maybe (Textual Double))
, _conoCustomVariables :: !(Maybe [CustomFloodlightVariable])
, _conoChildDirectedTreatment :: !(Maybe Bool)
, _conoGclid :: !(Maybe Text)
, _conoOrdinal :: !(Maybe Text)
, _conoDclid :: !(Maybe Text)
, _conoMatchId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Conversion' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'conoTreatmentForUnderage'
--
-- * 'conoEncryptedUserIdCandidates'
--
-- * 'conoTimestampMicros'
--
-- * 'conoLimitAdTracking'
--
-- * 'conoEncryptedUserId'
--
-- * 'conoMobileDeviceId'
--
-- * 'conoFloodlightConfigurationId'
--
-- * 'conoKind'
--
-- * 'conoFloodlightActivityId'
--
-- * 'conoNonPersonalizedAd'
--
-- * 'conoQuantity'
--
-- * 'conoValue'
--
-- * 'conoCustomVariables'
--
-- * 'conoChildDirectedTreatment'
--
-- * 'conoGclid'
--
-- * 'conoOrdinal'
--
-- * 'conoDclid'
--
-- * 'conoMatchId'
conversion
:: Conversion
conversion =
Conversion'
{ _conoTreatmentForUnderage = Nothing
, _conoEncryptedUserIdCandidates = Nothing
, _conoTimestampMicros = Nothing
, _conoLimitAdTracking = Nothing
, _conoEncryptedUserId = Nothing
, _conoMobileDeviceId = Nothing
, _conoFloodlightConfigurationId = Nothing
, _conoKind = Nothing
, _conoFloodlightActivityId = Nothing
, _conoNonPersonalizedAd = Nothing
, _conoQuantity = Nothing
, _conoValue = Nothing
, _conoCustomVariables = Nothing
, _conoChildDirectedTreatment = Nothing
, _conoGclid = Nothing
, _conoOrdinal = Nothing
, _conoDclid = Nothing
, _conoMatchId = Nothing
}
-- | Whether this particular request may come from a user under the age of 16
-- (may differ by country), under compliance with the European Union\'s
-- General Data Protection Regulation (GDPR).
conoTreatmentForUnderage :: Lens' Conversion (Maybe Bool)
conoTreatmentForUnderage
= lens _conoTreatmentForUnderage
(\ s a -> s{_conoTreatmentForUnderage = a})
-- | A list of the alphanumeric encrypted user IDs. Any user ID with exposure
-- prior to the conversion timestamp will be used in the inserted
-- conversion. If no such user ID is found then the conversion will be
-- rejected with INVALID_ARGUMENT error. When set, encryptionInfo should
-- also be specified. This field may only be used when calling batchinsert;
-- it is not supported by batchupdate. This field is mutually exclusive
-- with encryptedUserId, matchId, mobileDeviceId, gclid and dclid. This or
-- encryptedUserId or matchId or mobileDeviceId or gclid or dclid is a
-- required field.
conoEncryptedUserIdCandidates :: Lens' Conversion [Text]
conoEncryptedUserIdCandidates
= lens _conoEncryptedUserIdCandidates
(\ s a -> s{_conoEncryptedUserIdCandidates = a})
. _Default
. _Coerce
-- | The timestamp of conversion, in Unix epoch micros. This is a required
-- field.
conoTimestampMicros :: Lens' Conversion (Maybe Int64)
conoTimestampMicros
= lens _conoTimestampMicros
(\ s a -> s{_conoTimestampMicros = a})
. mapping _Coerce
-- | Whether Limit Ad Tracking is enabled. When set to true, the conversion
-- will be used for reporting but not targeting. This will prevent
-- remarketing.
conoLimitAdTracking :: Lens' Conversion (Maybe Bool)
conoLimitAdTracking
= lens _conoLimitAdTracking
(\ s a -> s{_conoLimitAdTracking = a})
-- | The alphanumeric encrypted user ID. When set, encryptionInfo should also
-- be specified. This field is mutually exclusive with
-- encryptedUserIdCandidates[], matchId, mobileDeviceId, gclid and dclid.
-- This or encryptedUserIdCandidates[] or matchId or mobileDeviceId or
-- gclid or dclid is a required field.
conoEncryptedUserId :: Lens' Conversion (Maybe Text)
conoEncryptedUserId
= lens _conoEncryptedUserId
(\ s a -> s{_conoEncryptedUserId = a})
-- | The mobile device ID. This field is mutually exclusive with
-- encryptedUserId, encryptedUserIdCandidates[], matchId, gclid and dclid.
-- This or encryptedUserId or encryptedUserIdCandidates[] or matchId or
-- gclid or dclid is a required field.
conoMobileDeviceId :: Lens' Conversion (Maybe Text)
conoMobileDeviceId
= lens _conoMobileDeviceId
(\ s a -> s{_conoMobileDeviceId = a})
-- | Floodlight Configuration ID of this conversion. This is a required
-- field.
conoFloodlightConfigurationId :: Lens' Conversion (Maybe Int64)
conoFloodlightConfigurationId
= lens _conoFloodlightConfigurationId
(\ s a -> s{_conoFloodlightConfigurationId = a})
. mapping _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#conversion\".
conoKind :: Lens' Conversion (Maybe Text)
conoKind = lens _conoKind (\ s a -> s{_conoKind = a})
-- | Floodlight Activity ID of this conversion. This is a required field.
conoFloodlightActivityId :: Lens' Conversion (Maybe Int64)
conoFloodlightActivityId
= lens _conoFloodlightActivityId
(\ s a -> s{_conoFloodlightActivityId = a})
. mapping _Coerce
-- | Whether the conversion was for a non personalized ad.
conoNonPersonalizedAd :: Lens' Conversion (Maybe Bool)
conoNonPersonalizedAd
= lens _conoNonPersonalizedAd
(\ s a -> s{_conoNonPersonalizedAd = a})
-- | The quantity of the conversion.
conoQuantity :: Lens' Conversion (Maybe Int64)
conoQuantity
= lens _conoQuantity (\ s a -> s{_conoQuantity = a})
. mapping _Coerce
-- | The value of the conversion.
conoValue :: Lens' Conversion (Maybe Double)
conoValue
= lens _conoValue (\ s a -> s{_conoValue = a}) .
mapping _Coerce
-- | Custom floodlight variables.
conoCustomVariables :: Lens' Conversion [CustomFloodlightVariable]
conoCustomVariables
= lens _conoCustomVariables
(\ s a -> s{_conoCustomVariables = a})
. _Default
. _Coerce
-- | Whether this particular request may come from a user under the age of
-- 13, under COPPA compliance.
conoChildDirectedTreatment :: Lens' Conversion (Maybe Bool)
conoChildDirectedTreatment
= lens _conoChildDirectedTreatment
(\ s a -> s{_conoChildDirectedTreatment = a})
-- | The Google click ID. This field is mutually exclusive with
-- encryptedUserId, encryptedUserIdCandidates[], matchId, mobileDeviceId
-- and dclid. This or encryptedUserId or encryptedUserIdCandidates[] or
-- matchId or mobileDeviceId or dclid is a required field.
conoGclid :: Lens' Conversion (Maybe Text)
conoGclid
= lens _conoGclid (\ s a -> s{_conoGclid = a})
-- | The ordinal of the conversion. Use this field to control how conversions
-- of the same user and day are de-duplicated. This is a required field.
conoOrdinal :: Lens' Conversion (Maybe Text)
conoOrdinal
= lens _conoOrdinal (\ s a -> s{_conoOrdinal = a})
-- | The display click ID. This field is mutually exclusive with
-- encryptedUserId, encryptedUserIdCandidates[], matchId, mobileDeviceId
-- and gclid. This or encryptedUserId or encryptedUserIdCandidates[] or
-- matchId or mobileDeviceId or gclid is a required field.
conoDclid :: Lens' Conversion (Maybe Text)
conoDclid
= lens _conoDclid (\ s a -> s{_conoDclid = a})
-- | The match ID field. A match ID is your own first-party identifier that
-- has been synced with Google using the match ID feature in Floodlight.
-- This field is mutually exclusive with encryptedUserId,
-- encryptedUserIdCandidates[],mobileDeviceId, gclid and dclid. This or
-- encryptedUserId or encryptedUserIdCandidates[] or mobileDeviceId or
-- gclid or dclid is a required field.
conoMatchId :: Lens' Conversion (Maybe Text)
conoMatchId
= lens _conoMatchId (\ s a -> s{_conoMatchId = a})
instance FromJSON Conversion where
parseJSON
= withObject "Conversion"
(\ o ->
Conversion' <$>
(o .:? "treatmentForUnderage") <*>
(o .:? "encryptedUserIdCandidates" .!= mempty)
<*> (o .:? "timestampMicros")
<*> (o .:? "limitAdTracking")
<*> (o .:? "encryptedUserId")
<*> (o .:? "mobileDeviceId")
<*> (o .:? "floodlightConfigurationId")
<*> (o .:? "kind")
<*> (o .:? "floodlightActivityId")
<*> (o .:? "nonPersonalizedAd")
<*> (o .:? "quantity")
<*> (o .:? "value")
<*> (o .:? "customVariables" .!= mempty)
<*> (o .:? "childDirectedTreatment")
<*> (o .:? "gclid")
<*> (o .:? "ordinal")
<*> (o .:? "dclid")
<*> (o .:? "matchId"))
instance ToJSON Conversion where
toJSON Conversion'{..}
= object
(catMaybes
[("treatmentForUnderage" .=) <$>
_conoTreatmentForUnderage,
("encryptedUserIdCandidates" .=) <$>
_conoEncryptedUserIdCandidates,
("timestampMicros" .=) <$> _conoTimestampMicros,
("limitAdTracking" .=) <$> _conoLimitAdTracking,
("encryptedUserId" .=) <$> _conoEncryptedUserId,
("mobileDeviceId" .=) <$> _conoMobileDeviceId,
("floodlightConfigurationId" .=) <$>
_conoFloodlightConfigurationId,
("kind" .=) <$> _conoKind,
("floodlightActivityId" .=) <$>
_conoFloodlightActivityId,
("nonPersonalizedAd" .=) <$> _conoNonPersonalizedAd,
("quantity" .=) <$> _conoQuantity,
("value" .=) <$> _conoValue,
("customVariables" .=) <$> _conoCustomVariables,
("childDirectedTreatment" .=) <$>
_conoChildDirectedTreatment,
("gclid" .=) <$> _conoGclid,
("ordinal" .=) <$> _conoOrdinal,
("dclid" .=) <$> _conoDclid,
("matchId" .=) <$> _conoMatchId])
-- | Creative Field Value List Response
--
-- /See:/ 'creativeFieldValuesListResponse' smart constructor.
data CreativeFieldValuesListResponse =
CreativeFieldValuesListResponse'
{ _cfvlrNextPageToken :: !(Maybe Text)
, _cfvlrKind :: !(Maybe Text)
, _cfvlrCreativeFieldValues :: !(Maybe [CreativeFieldValue])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeFieldValuesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cfvlrNextPageToken'
--
-- * 'cfvlrKind'
--
-- * 'cfvlrCreativeFieldValues'
creativeFieldValuesListResponse
:: CreativeFieldValuesListResponse
creativeFieldValuesListResponse =
CreativeFieldValuesListResponse'
{ _cfvlrNextPageToken = Nothing
, _cfvlrKind = Nothing
, _cfvlrCreativeFieldValues = Nothing
}
-- | Pagination token to be used for the next list operation.
cfvlrNextPageToken :: Lens' CreativeFieldValuesListResponse (Maybe Text)
cfvlrNextPageToken
= lens _cfvlrNextPageToken
(\ s a -> s{_cfvlrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#creativeFieldValuesListResponse\".
cfvlrKind :: Lens' CreativeFieldValuesListResponse (Maybe Text)
cfvlrKind
= lens _cfvlrKind (\ s a -> s{_cfvlrKind = a})
-- | Creative field value collection.
cfvlrCreativeFieldValues :: Lens' CreativeFieldValuesListResponse [CreativeFieldValue]
cfvlrCreativeFieldValues
= lens _cfvlrCreativeFieldValues
(\ s a -> s{_cfvlrCreativeFieldValues = a})
. _Default
. _Coerce
instance FromJSON CreativeFieldValuesListResponse
where
parseJSON
= withObject "CreativeFieldValuesListResponse"
(\ o ->
CreativeFieldValuesListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "creativeFieldValues" .!= mempty))
instance ToJSON CreativeFieldValuesListResponse where
toJSON CreativeFieldValuesListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _cfvlrNextPageToken,
("kind" .=) <$> _cfvlrKind,
("creativeFieldValues" .=) <$>
_cfvlrCreativeFieldValues])
-- | Placement tag wrapping
--
-- /See:/ 'measurementPartnerWrAppingData' smart constructor.
data MeasurementPartnerWrAppingData =
MeasurementPartnerWrAppingData'
{ _mpwadLinkStatus :: !(Maybe MeasurementPartnerWrAppingDataLinkStatus)
, _mpwadMeasurementPartner :: !(Maybe MeasurementPartnerWrAppingDataMeasurementPartner)
, _mpwadWrAppedTag :: !(Maybe Text)
, _mpwadTagWrAppingMode :: !(Maybe MeasurementPartnerWrAppingDataTagWrAppingMode)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'MeasurementPartnerWrAppingData' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mpwadLinkStatus'
--
-- * 'mpwadMeasurementPartner'
--
-- * 'mpwadWrAppedTag'
--
-- * 'mpwadTagWrAppingMode'
measurementPartnerWrAppingData
:: MeasurementPartnerWrAppingData
measurementPartnerWrAppingData =
MeasurementPartnerWrAppingData'
{ _mpwadLinkStatus = Nothing
, _mpwadMeasurementPartner = Nothing
, _mpwadWrAppedTag = Nothing
, _mpwadTagWrAppingMode = Nothing
}
-- | Placement wrapping status.
mpwadLinkStatus :: Lens' MeasurementPartnerWrAppingData (Maybe MeasurementPartnerWrAppingDataLinkStatus)
mpwadLinkStatus
= lens _mpwadLinkStatus
(\ s a -> s{_mpwadLinkStatus = a})
-- | Measurement partner used for wrapping the placement.
mpwadMeasurementPartner :: Lens' MeasurementPartnerWrAppingData (Maybe MeasurementPartnerWrAppingDataMeasurementPartner)
mpwadMeasurementPartner
= lens _mpwadMeasurementPartner
(\ s a -> s{_mpwadMeasurementPartner = a})
-- | Tag provided by the measurement partner during wrapping.
mpwadWrAppedTag :: Lens' MeasurementPartnerWrAppingData (Maybe Text)
mpwadWrAppedTag
= lens _mpwadWrAppedTag
(\ s a -> s{_mpwadWrAppedTag = a})
-- | Measurement mode for the wrapped placement.
mpwadTagWrAppingMode :: Lens' MeasurementPartnerWrAppingData (Maybe MeasurementPartnerWrAppingDataTagWrAppingMode)
mpwadTagWrAppingMode
= lens _mpwadTagWrAppingMode
(\ s a -> s{_mpwadTagWrAppingMode = a})
instance FromJSON MeasurementPartnerWrAppingData
where
parseJSON
= withObject "MeasurementPartnerWrAppingData"
(\ o ->
MeasurementPartnerWrAppingData' <$>
(o .:? "linkStatus") <*> (o .:? "measurementPartner")
<*> (o .:? "wrappedTag")
<*> (o .:? "tagWrappingMode"))
instance ToJSON MeasurementPartnerWrAppingData where
toJSON MeasurementPartnerWrAppingData'{..}
= object
(catMaybes
[("linkStatus" .=) <$> _mpwadLinkStatus,
("measurementPartner" .=) <$>
_mpwadMeasurementPartner,
("wrappedTag" .=) <$> _mpwadWrAppedTag,
("tagWrappingMode" .=) <$> _mpwadTagWrAppingMode])
-- | Rich Media Exit Override.
--
-- /See:/ 'richMediaExitOverride' smart constructor.
data RichMediaExitOverride =
RichMediaExitOverride'
{ _rmeoEnabled :: !(Maybe Bool)
, _rmeoClickThroughURL :: !(Maybe ClickThroughURL)
, _rmeoExitId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'RichMediaExitOverride' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rmeoEnabled'
--
-- * 'rmeoClickThroughURL'
--
-- * 'rmeoExitId'
richMediaExitOverride
:: RichMediaExitOverride
richMediaExitOverride =
RichMediaExitOverride'
{ _rmeoEnabled = Nothing
, _rmeoClickThroughURL = Nothing
, _rmeoExitId = Nothing
}
-- | Whether to use the clickThroughUrl. If false, the creative-level exit
-- will be used.
rmeoEnabled :: Lens' RichMediaExitOverride (Maybe Bool)
rmeoEnabled
= lens _rmeoEnabled (\ s a -> s{_rmeoEnabled = a})
-- | Click-through URL of this rich media exit override. Applicable if the
-- enabled field is set to true.
rmeoClickThroughURL :: Lens' RichMediaExitOverride (Maybe ClickThroughURL)
rmeoClickThroughURL
= lens _rmeoClickThroughURL
(\ s a -> s{_rmeoClickThroughURL = a})
-- | ID for the override to refer to a specific exit in the creative.
rmeoExitId :: Lens' RichMediaExitOverride (Maybe Int64)
rmeoExitId
= lens _rmeoExitId (\ s a -> s{_rmeoExitId = a}) .
mapping _Coerce
instance FromJSON RichMediaExitOverride where
parseJSON
= withObject "RichMediaExitOverride"
(\ o ->
RichMediaExitOverride' <$>
(o .:? "enabled") <*> (o .:? "clickThroughUrl") <*>
(o .:? "exitId"))
instance ToJSON RichMediaExitOverride where
toJSON RichMediaExitOverride'{..}
= object
(catMaybes
[("enabled" .=) <$> _rmeoEnabled,
("clickThroughUrl" .=) <$> _rmeoClickThroughURL,
("exitId" .=) <$> _rmeoExitId])
-- | Custom Viewability Metric
--
-- /See:/ 'customViewabilityMetric' smart constructor.
data CustomViewabilityMetric =
CustomViewabilityMetric'
{ _cvmName :: !(Maybe Text)
, _cvmId :: !(Maybe (Textual Int64))
, _cvmConfiguration :: !(Maybe CustomViewabilityMetricConfiguration)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CustomViewabilityMetric' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cvmName'
--
-- * 'cvmId'
--
-- * 'cvmConfiguration'
customViewabilityMetric
:: CustomViewabilityMetric
customViewabilityMetric =
CustomViewabilityMetric'
{_cvmName = Nothing, _cvmId = Nothing, _cvmConfiguration = Nothing}
-- | Name of the custom viewability metric.
cvmName :: Lens' CustomViewabilityMetric (Maybe Text)
cvmName = lens _cvmName (\ s a -> s{_cvmName = a})
-- | ID of the custom viewability metric.
cvmId :: Lens' CustomViewabilityMetric (Maybe Int64)
cvmId
= lens _cvmId (\ s a -> s{_cvmId = a}) .
mapping _Coerce
-- | Configuration of the custom viewability metric.
cvmConfiguration :: Lens' CustomViewabilityMetric (Maybe CustomViewabilityMetricConfiguration)
cvmConfiguration
= lens _cvmConfiguration
(\ s a -> s{_cvmConfiguration = a})
instance FromJSON CustomViewabilityMetric where
parseJSON
= withObject "CustomViewabilityMetric"
(\ o ->
CustomViewabilityMetric' <$>
(o .:? "name") <*> (o .:? "id") <*>
(o .:? "configuration"))
instance ToJSON CustomViewabilityMetric where
toJSON CustomViewabilityMetric'{..}
= object
(catMaybes
[("name" .=) <$> _cvmName, ("id" .=) <$> _cvmId,
("configuration" .=) <$> _cvmConfiguration])
-- | Landing Page List Response
--
-- /See:/ 'advertiserLandingPagesListResponse' smart constructor.
data AdvertiserLandingPagesListResponse =
AdvertiserLandingPagesListResponse'
{ _alplrLandingPages :: !(Maybe [LandingPage])
, _alplrNextPageToken :: !(Maybe Text)
, _alplrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AdvertiserLandingPagesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'alplrLandingPages'
--
-- * 'alplrNextPageToken'
--
-- * 'alplrKind'
advertiserLandingPagesListResponse
:: AdvertiserLandingPagesListResponse
advertiserLandingPagesListResponse =
AdvertiserLandingPagesListResponse'
{ _alplrLandingPages = Nothing
, _alplrNextPageToken = Nothing
, _alplrKind = Nothing
}
-- | Landing page collection
alplrLandingPages :: Lens' AdvertiserLandingPagesListResponse [LandingPage]
alplrLandingPages
= lens _alplrLandingPages
(\ s a -> s{_alplrLandingPages = a})
. _Default
. _Coerce
-- | Pagination token to be used for the next list operation.
alplrNextPageToken :: Lens' AdvertiserLandingPagesListResponse (Maybe Text)
alplrNextPageToken
= lens _alplrNextPageToken
(\ s a -> s{_alplrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#advertiserLandingPagesListResponse\".
alplrKind :: Lens' AdvertiserLandingPagesListResponse (Maybe Text)
alplrKind
= lens _alplrKind (\ s a -> s{_alplrKind = a})
instance FromJSON AdvertiserLandingPagesListResponse
where
parseJSON
= withObject "AdvertiserLandingPagesListResponse"
(\ o ->
AdvertiserLandingPagesListResponse' <$>
(o .:? "landingPages" .!= mempty) <*>
(o .:? "nextPageToken")
<*> (o .:? "kind"))
instance ToJSON AdvertiserLandingPagesListResponse
where
toJSON AdvertiserLandingPagesListResponse'{..}
= object
(catMaybes
[("landingPages" .=) <$> _alplrLandingPages,
("nextPageToken" .=) <$> _alplrNextPageToken,
("kind" .=) <$> _alplrKind])
-- | Mobile app List Response
--
-- /See:/ 'mobileAppsListResponse' smart constructor.
data MobileAppsListResponse =
MobileAppsListResponse'
{ _malrNextPageToken :: !(Maybe Text)
, _malrKind :: !(Maybe Text)
, _malrMobileApps :: !(Maybe [MobileApp])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'MobileAppsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'malrNextPageToken'
--
-- * 'malrKind'
--
-- * 'malrMobileApps'
mobileAppsListResponse
:: MobileAppsListResponse
mobileAppsListResponse =
MobileAppsListResponse'
{ _malrNextPageToken = Nothing
, _malrKind = Nothing
, _malrMobileApps = Nothing
}
-- | Pagination token to be used for the next list operation.
malrNextPageToken :: Lens' MobileAppsListResponse (Maybe Text)
malrNextPageToken
= lens _malrNextPageToken
(\ s a -> s{_malrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#mobileAppsListResponse\".
malrKind :: Lens' MobileAppsListResponse (Maybe Text)
malrKind = lens _malrKind (\ s a -> s{_malrKind = a})
-- | Mobile apps collection.
malrMobileApps :: Lens' MobileAppsListResponse [MobileApp]
malrMobileApps
= lens _malrMobileApps
(\ s a -> s{_malrMobileApps = a})
. _Default
. _Coerce
instance FromJSON MobileAppsListResponse where
parseJSON
= withObject "MobileAppsListResponse"
(\ o ->
MobileAppsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "mobileApps" .!= mempty))
instance ToJSON MobileAppsListResponse where
toJSON MobileAppsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _malrNextPageToken,
("kind" .=) <$> _malrKind,
("mobileApps" .=) <$> _malrMobileApps])
-- | Represents a sorted dimension.
--
-- /See:/ 'sortedDimension' smart constructor.
data SortedDimension =
SortedDimension'
{ _sdKind :: !(Maybe Text)
, _sdSortOrder :: !(Maybe SortedDimensionSortOrder)
, _sdName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SortedDimension' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sdKind'
--
-- * 'sdSortOrder'
--
-- * 'sdName'
sortedDimension
:: SortedDimension
sortedDimension =
SortedDimension'
{_sdKind = Nothing, _sdSortOrder = Nothing, _sdName = Nothing}
-- | The kind of resource this is, in this case dfareporting#sortedDimension.
sdKind :: Lens' SortedDimension (Maybe Text)
sdKind = lens _sdKind (\ s a -> s{_sdKind = a})
-- | An optional sort order for the dimension column.
sdSortOrder :: Lens' SortedDimension (Maybe SortedDimensionSortOrder)
sdSortOrder
= lens _sdSortOrder (\ s a -> s{_sdSortOrder = a})
-- | The name of the dimension.
sdName :: Lens' SortedDimension (Maybe Text)
sdName = lens _sdName (\ s a -> s{_sdName = a})
instance FromJSON SortedDimension where
parseJSON
= withObject "SortedDimension"
(\ o ->
SortedDimension' <$>
(o .:? "kind") <*> (o .:? "sortOrder") <*>
(o .:? "name"))
instance ToJSON SortedDimension where
toJSON SortedDimension'{..}
= object
(catMaybes
[("kind" .=) <$> _sdKind,
("sortOrder" .=) <$> _sdSortOrder,
("name" .=) <$> _sdName])
-- | Creative Field List Response
--
-- /See:/ 'creativeFieldsListResponse' smart constructor.
data CreativeFieldsListResponse =
CreativeFieldsListResponse'
{ _cflrNextPageToken :: !(Maybe Text)
, _cflrKind :: !(Maybe Text)
, _cflrCreativeFields :: !(Maybe [CreativeField])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeFieldsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cflrNextPageToken'
--
-- * 'cflrKind'
--
-- * 'cflrCreativeFields'
creativeFieldsListResponse
:: CreativeFieldsListResponse
creativeFieldsListResponse =
CreativeFieldsListResponse'
{ _cflrNextPageToken = Nothing
, _cflrKind = Nothing
, _cflrCreativeFields = Nothing
}
-- | Pagination token to be used for the next list operation.
cflrNextPageToken :: Lens' CreativeFieldsListResponse (Maybe Text)
cflrNextPageToken
= lens _cflrNextPageToken
(\ s a -> s{_cflrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#creativeFieldsListResponse\".
cflrKind :: Lens' CreativeFieldsListResponse (Maybe Text)
cflrKind = lens _cflrKind (\ s a -> s{_cflrKind = a})
-- | Creative field collection.
cflrCreativeFields :: Lens' CreativeFieldsListResponse [CreativeField]
cflrCreativeFields
= lens _cflrCreativeFields
(\ s a -> s{_cflrCreativeFields = a})
. _Default
. _Coerce
instance FromJSON CreativeFieldsListResponse where
parseJSON
= withObject "CreativeFieldsListResponse"
(\ o ->
CreativeFieldsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "creativeFields" .!= mempty))
instance ToJSON CreativeFieldsListResponse where
toJSON CreativeFieldsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _cflrNextPageToken,
("kind" .=) <$> _cflrKind,
("creativeFields" .=) <$> _cflrCreativeFields])
-- | Targeting Template List Response
--
-- /See:/ 'targetingTemplatesListResponse' smart constructor.
data TargetingTemplatesListResponse =
TargetingTemplatesListResponse'
{ _ttlrNextPageToken :: !(Maybe Text)
, _ttlrKind :: !(Maybe Text)
, _ttlrTargetingTemplates :: !(Maybe [TargetingTemplate])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TargetingTemplatesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ttlrNextPageToken'
--
-- * 'ttlrKind'
--
-- * 'ttlrTargetingTemplates'
targetingTemplatesListResponse
:: TargetingTemplatesListResponse
targetingTemplatesListResponse =
TargetingTemplatesListResponse'
{ _ttlrNextPageToken = Nothing
, _ttlrKind = Nothing
, _ttlrTargetingTemplates = Nothing
}
-- | Pagination token to be used for the next list operation.
ttlrNextPageToken :: Lens' TargetingTemplatesListResponse (Maybe Text)
ttlrNextPageToken
= lens _ttlrNextPageToken
(\ s a -> s{_ttlrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#targetingTemplatesListResponse\".
ttlrKind :: Lens' TargetingTemplatesListResponse (Maybe Text)
ttlrKind = lens _ttlrKind (\ s a -> s{_ttlrKind = a})
-- | Targeting template collection.
ttlrTargetingTemplates :: Lens' TargetingTemplatesListResponse [TargetingTemplate]
ttlrTargetingTemplates
= lens _ttlrTargetingTemplates
(\ s a -> s{_ttlrTargetingTemplates = a})
. _Default
. _Coerce
instance FromJSON TargetingTemplatesListResponse
where
parseJSON
= withObject "TargetingTemplatesListResponse"
(\ o ->
TargetingTemplatesListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "targetingTemplates" .!= mempty))
instance ToJSON TargetingTemplatesListResponse where
toJSON TargetingTemplatesListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _ttlrNextPageToken,
("kind" .=) <$> _ttlrKind,
("targetingTemplates" .=) <$>
_ttlrTargetingTemplates])
-- | Placement GenerateTags Response
--
-- /See:/ 'placementsGenerateTagsResponse' smart constructor.
data PlacementsGenerateTagsResponse =
PlacementsGenerateTagsResponse'
{ _pgtrKind :: !(Maybe Text)
, _pgtrPlacementTags :: !(Maybe [PlacementTag])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlacementsGenerateTagsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pgtrKind'
--
-- * 'pgtrPlacementTags'
placementsGenerateTagsResponse
:: PlacementsGenerateTagsResponse
placementsGenerateTagsResponse =
PlacementsGenerateTagsResponse'
{_pgtrKind = Nothing, _pgtrPlacementTags = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#placementsGenerateTagsResponse\".
pgtrKind :: Lens' PlacementsGenerateTagsResponse (Maybe Text)
pgtrKind = lens _pgtrKind (\ s a -> s{_pgtrKind = a})
-- | Set of generated tags for the specified placements.
pgtrPlacementTags :: Lens' PlacementsGenerateTagsResponse [PlacementTag]
pgtrPlacementTags
= lens _pgtrPlacementTags
(\ s a -> s{_pgtrPlacementTags = a})
. _Default
. _Coerce
instance FromJSON PlacementsGenerateTagsResponse
where
parseJSON
= withObject "PlacementsGenerateTagsResponse"
(\ o ->
PlacementsGenerateTagsResponse' <$>
(o .:? "kind") <*>
(o .:? "placementTags" .!= mempty))
instance ToJSON PlacementsGenerateTagsResponse where
toJSON PlacementsGenerateTagsResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _pgtrKind,
("placementTags" .=) <$> _pgtrPlacementTags])
-- | Creative Asset.
--
-- /See:/ 'creativeAsset' smart constructor.
data CreativeAsset =
CreativeAsset'
{ _caaZIndex :: !(Maybe (Textual Int32))
, _caaPushdown :: !(Maybe Bool)
, _caaFrameRate :: !(Maybe (Textual Double))
, _caaOriginalBackup :: !(Maybe Bool)
, _caaWindowMode :: !(Maybe CreativeAssetWindowMode)
, _caaFlashVersion :: !(Maybe (Textual Int32))
, _caaPushdownDuration :: !(Maybe (Textual Double))
, _caaSize :: !(Maybe Size)
, _caaVerticallyLocked :: !(Maybe Bool)
, _caaOffSet :: !(Maybe OffSetPosition)
, _caaStreamingServingURL :: !(Maybe Text)
, _caaZipFilesize :: !(Maybe Text)
, _caaTransparency :: !(Maybe Bool)
, _caaHideSelectionBoxes :: !(Maybe Bool)
, _caaSSLCompliant :: !(Maybe Bool)
, _caaFileSize :: !(Maybe (Textual Int64))
, _caaAssetIdentifier :: !(Maybe CreativeAssetId)
, _caaCompanionCreativeIds :: !(Maybe [Textual Int64])
, _caaDurationType :: !(Maybe CreativeAssetDurationType)
, _caaProgressiveServingURL :: !(Maybe Text)
, _caaIdDimensionValue :: !(Maybe DimensionValue)
, _caaActive :: !(Maybe Bool)
, _caaRole :: !(Maybe CreativeAssetRole)
, _caaMimeType :: !(Maybe Text)
, _caaPositionTopUnit :: !(Maybe CreativeAssetPositionTopUnit)
, _caaPositionLeftUnit :: !(Maybe CreativeAssetPositionLeftUnit)
, _caaAlignment :: !(Maybe CreativeAssetAlignment)
, _caaExpandedDimension :: !(Maybe Size)
, _caaAdditionalSizes :: !(Maybe [Size])
, _caaZipFilename :: !(Maybe Text)
, _caaMediaDuration :: !(Maybe (Textual Double))
, _caaActionScript3 :: !(Maybe Bool)
, _caaDisplayType :: !(Maybe CreativeAssetDisplayType)
, _caaChildAssetType :: !(Maybe CreativeAssetChildAssetType)
, _caaCollapsedSize :: !(Maybe Size)
, _caaAudioSampleRate :: !(Maybe (Textual Int32))
, _caaId :: !(Maybe (Textual Int64))
, _caaBitRate :: !(Maybe (Textual Int32))
, _caaPoliteLoad :: !(Maybe Bool)
, _caaCustomStartTimeValue :: !(Maybe (Textual Int32))
, _caaStartTimeType :: !(Maybe CreativeAssetStartTimeType)
, _caaAudioBitRate :: !(Maybe (Textual Int32))
, _caaDuration :: !(Maybe (Textual Int32))
, _caaOrientation :: !(Maybe CreativeAssetOrientation)
, _caaArtworkType :: !(Maybe CreativeAssetArtworkType)
, _caaHideFlashObjects :: !(Maybe Bool)
, _caaDetectedFeatures :: !(Maybe [CreativeAssetDetectedFeaturesItem])
, _caaBackupImageExit :: !(Maybe CreativeCustomEvent)
, _caaPosition :: !(Maybe OffSetPosition)
, _caaHorizontallyLocked :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeAsset' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'caaZIndex'
--
-- * 'caaPushdown'
--
-- * 'caaFrameRate'
--
-- * 'caaOriginalBackup'
--
-- * 'caaWindowMode'
--
-- * 'caaFlashVersion'
--
-- * 'caaPushdownDuration'
--
-- * 'caaSize'
--
-- * 'caaVerticallyLocked'
--
-- * 'caaOffSet'
--
-- * 'caaStreamingServingURL'
--
-- * 'caaZipFilesize'
--
-- * 'caaTransparency'
--
-- * 'caaHideSelectionBoxes'
--
-- * 'caaSSLCompliant'
--
-- * 'caaFileSize'
--
-- * 'caaAssetIdentifier'
--
-- * 'caaCompanionCreativeIds'
--
-- * 'caaDurationType'
--
-- * 'caaProgressiveServingURL'
--
-- * 'caaIdDimensionValue'
--
-- * 'caaActive'
--
-- * 'caaRole'
--
-- * 'caaMimeType'
--
-- * 'caaPositionTopUnit'
--
-- * 'caaPositionLeftUnit'
--
-- * 'caaAlignment'
--
-- * 'caaExpandedDimension'
--
-- * 'caaAdditionalSizes'
--
-- * 'caaZipFilename'
--
-- * 'caaMediaDuration'
--
-- * 'caaActionScript3'
--
-- * 'caaDisplayType'
--
-- * 'caaChildAssetType'
--
-- * 'caaCollapsedSize'
--
-- * 'caaAudioSampleRate'
--
-- * 'caaId'
--
-- * 'caaBitRate'
--
-- * 'caaPoliteLoad'
--
-- * 'caaCustomStartTimeValue'
--
-- * 'caaStartTimeType'
--
-- * 'caaAudioBitRate'
--
-- * 'caaDuration'
--
-- * 'caaOrientation'
--
-- * 'caaArtworkType'
--
-- * 'caaHideFlashObjects'
--
-- * 'caaDetectedFeatures'
--
-- * 'caaBackupImageExit'
--
-- * 'caaPosition'
--
-- * 'caaHorizontallyLocked'
creativeAsset
:: CreativeAsset
creativeAsset =
CreativeAsset'
{ _caaZIndex = Nothing
, _caaPushdown = Nothing
, _caaFrameRate = Nothing
, _caaOriginalBackup = Nothing
, _caaWindowMode = Nothing
, _caaFlashVersion = Nothing
, _caaPushdownDuration = Nothing
, _caaSize = Nothing
, _caaVerticallyLocked = Nothing
, _caaOffSet = Nothing
, _caaStreamingServingURL = Nothing
, _caaZipFilesize = Nothing
, _caaTransparency = Nothing
, _caaHideSelectionBoxes = Nothing
, _caaSSLCompliant = Nothing
, _caaFileSize = Nothing
, _caaAssetIdentifier = Nothing
, _caaCompanionCreativeIds = Nothing
, _caaDurationType = Nothing
, _caaProgressiveServingURL = Nothing
, _caaIdDimensionValue = Nothing
, _caaActive = Nothing
, _caaRole = Nothing
, _caaMimeType = Nothing
, _caaPositionTopUnit = Nothing
, _caaPositionLeftUnit = Nothing
, _caaAlignment = Nothing
, _caaExpandedDimension = Nothing
, _caaAdditionalSizes = Nothing
, _caaZipFilename = Nothing
, _caaMediaDuration = Nothing
, _caaActionScript3 = Nothing
, _caaDisplayType = Nothing
, _caaChildAssetType = Nothing
, _caaCollapsedSize = Nothing
, _caaAudioSampleRate = Nothing
, _caaId = Nothing
, _caaBitRate = Nothing
, _caaPoliteLoad = Nothing
, _caaCustomStartTimeValue = Nothing
, _caaStartTimeType = Nothing
, _caaAudioBitRate = Nothing
, _caaDuration = Nothing
, _caaOrientation = Nothing
, _caaArtworkType = Nothing
, _caaHideFlashObjects = Nothing
, _caaDetectedFeatures = Nothing
, _caaBackupImageExit = Nothing
, _caaPosition = Nothing
, _caaHorizontallyLocked = Nothing
}
-- | zIndex value of an asset. Applicable to the following creative types:
-- all RICH_MEDIA.Additionally, only applicable to assets whose displayType
-- is NOT one of the following types: ASSET_DISPLAY_TYPE_INPAGE or
-- ASSET_DISPLAY_TYPE_OVERLAY. Acceptable values are -999999999 to
-- 999999999, inclusive.
caaZIndex :: Lens' CreativeAsset (Maybe Int32)
caaZIndex
= lens _caaZIndex (\ s a -> s{_caaZIndex = a}) .
mapping _Coerce
-- | Whether the asset pushes down other content. Applicable to the following
-- creative types: all RICH_MEDIA. Additionally, only applicable when the
-- asset offsets are 0, the collapsedSize.width matches size.width, and the
-- collapsedSize.height is less than size.height.
caaPushdown :: Lens' CreativeAsset (Maybe Bool)
caaPushdown
= lens _caaPushdown (\ s a -> s{_caaPushdown = a})
-- | Video frame rate for video asset in frames per second. This is a
-- read-only field. Applicable to the following creative types:
-- INSTREAM_VIDEO and all VPAID.
caaFrameRate :: Lens' CreativeAsset (Maybe Double)
caaFrameRate
= lens _caaFrameRate (\ s a -> s{_caaFrameRate = a})
. mapping _Coerce
-- | Whether the backup asset is original or changed by the user in Campaign
-- Manager. Applicable to the following creative types: all RICH_MEDIA.
caaOriginalBackup :: Lens' CreativeAsset (Maybe Bool)
caaOriginalBackup
= lens _caaOriginalBackup
(\ s a -> s{_caaOriginalBackup = a})
-- | Window mode options for flash assets. Applicable to the following
-- creative types: FLASH_INPAGE, RICH_MEDIA_DISPLAY_EXPANDING,
-- RICH_MEDIA_IM_EXPAND, RICH_MEDIA_DISPLAY_BANNER, and
-- RICH_MEDIA_INPAGE_FLOATING.
caaWindowMode :: Lens' CreativeAsset (Maybe CreativeAssetWindowMode)
caaWindowMode
= lens _caaWindowMode
(\ s a -> s{_caaWindowMode = a})
-- | Flash version of the asset. This is a read-only field. Applicable to the
-- following creative types: FLASH_INPAGE, all RICH_MEDIA, and all VPAID.
-- Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
caaFlashVersion :: Lens' CreativeAsset (Maybe Int32)
caaFlashVersion
= lens _caaFlashVersion
(\ s a -> s{_caaFlashVersion = a})
. mapping _Coerce
-- | Pushdown duration in seconds for an asset. Applicable to the following
-- creative types: all RICH_MEDIA.Additionally, only applicable when the
-- asset pushdown field is true, the offsets are 0, the collapsedSize.width
-- matches size.width, and the collapsedSize.height is less than
-- size.height. Acceptable values are 0 to 9.99, inclusive.
caaPushdownDuration :: Lens' CreativeAsset (Maybe Double)
caaPushdownDuration
= lens _caaPushdownDuration
(\ s a -> s{_caaPushdownDuration = a})
. mapping _Coerce
-- | Size associated with this creative asset. This is a required field when
-- applicable; however for IMAGE and FLASH_INPAGE, creatives if left blank,
-- this field will be automatically set using the actual size of the
-- associated image asset. Applicable to the following creative types:
-- DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all
-- RICH_MEDIA. Applicable to DISPLAY when the primary asset type is not
-- HTML_IMAGE.
caaSize :: Lens' CreativeAsset (Maybe Size)
caaSize = lens _caaSize (\ s a -> s{_caaSize = a})
-- | Whether the asset is vertically locked. This is a read-only field.
-- Applicable to the following creative types: all RICH_MEDIA.
caaVerticallyLocked :: Lens' CreativeAsset (Maybe Bool)
caaVerticallyLocked
= lens _caaVerticallyLocked
(\ s a -> s{_caaVerticallyLocked = a})
-- | Offset position for an asset in collapsed mode. This is a read-only
-- field. Applicable to the following creative types: all RICH_MEDIA and
-- all VPAID. Additionally, only applicable to assets whose displayType is
-- ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN.
caaOffSet :: Lens' CreativeAsset (Maybe OffSetPosition)
caaOffSet
= lens _caaOffSet (\ s a -> s{_caaOffSet = a})
-- | Streaming URL for video asset. This is a read-only field. Applicable to
-- the following creative types: INSTREAM_VIDEO and all VPAID.
caaStreamingServingURL :: Lens' CreativeAsset (Maybe Text)
caaStreamingServingURL
= lens _caaStreamingServingURL
(\ s a -> s{_caaStreamingServingURL = a})
-- | Size of zip file. This is a read-only field. Applicable to the following
-- creative types: HTML5_BANNER.
caaZipFilesize :: Lens' CreativeAsset (Maybe Text)
caaZipFilesize
= lens _caaZipFilesize
(\ s a -> s{_caaZipFilesize = a})
-- | Whether the asset is transparent. Applicable to the following creative
-- types: all RICH_MEDIA. Additionally, only applicable to HTML5 assets.
caaTransparency :: Lens' CreativeAsset (Maybe Bool)
caaTransparency
= lens _caaTransparency
(\ s a -> s{_caaTransparency = a})
-- | Whether to hide selection boxes flag for an asset. Applicable to the
-- following creative types: all RICH_MEDIA.
caaHideSelectionBoxes :: Lens' CreativeAsset (Maybe Bool)
caaHideSelectionBoxes
= lens _caaHideSelectionBoxes
(\ s a -> s{_caaHideSelectionBoxes = a})
-- | Whether the asset is SSL-compliant. This is a read-only field.
-- Applicable to all but the following creative types: all REDIRECT and
-- TRACKING_TEXT.
caaSSLCompliant :: Lens' CreativeAsset (Maybe Bool)
caaSSLCompliant
= lens _caaSSLCompliant
(\ s a -> s{_caaSSLCompliant = a})
-- | File size associated with this creative asset. This is a read-only
-- field. Applicable to all but the following creative types: all REDIRECT
-- and TRACKING_TEXT.
caaFileSize :: Lens' CreativeAsset (Maybe Int64)
caaFileSize
= lens _caaFileSize (\ s a -> s{_caaFileSize = a}) .
mapping _Coerce
-- | Identifier of this asset. This is the same identifier returned during
-- creative asset insert operation. This is a required field. Applicable to
-- all but the following creative types: all REDIRECT and TRACKING_TEXT.
caaAssetIdentifier :: Lens' CreativeAsset (Maybe CreativeAssetId)
caaAssetIdentifier
= lens _caaAssetIdentifier
(\ s a -> s{_caaAssetIdentifier = a})
-- | List of companion creatives assigned to an in-stream video creative
-- asset. Acceptable values include IDs of existing flash and image
-- creatives. Applicable to INSTREAM_VIDEO creative type with
-- dynamicAssetSelection set to true.
caaCompanionCreativeIds :: Lens' CreativeAsset [Int64]
caaCompanionCreativeIds
= lens _caaCompanionCreativeIds
(\ s a -> s{_caaCompanionCreativeIds = a})
. _Default
. _Coerce
-- | Duration type for which an asset will be displayed. Applicable to the
-- following creative types: all RICH_MEDIA.
caaDurationType :: Lens' CreativeAsset (Maybe CreativeAssetDurationType)
caaDurationType
= lens _caaDurationType
(\ s a -> s{_caaDurationType = a})
-- | Progressive URL for video asset. This is a read-only field. Applicable
-- to the following creative types: INSTREAM_VIDEO and all VPAID.
caaProgressiveServingURL :: Lens' CreativeAsset (Maybe Text)
caaProgressiveServingURL
= lens _caaProgressiveServingURL
(\ s a -> s{_caaProgressiveServingURL = a})
-- | Dimension value for the ID of the asset. This is a read-only,
-- auto-generated field.
caaIdDimensionValue :: Lens' CreativeAsset (Maybe DimensionValue)
caaIdDimensionValue
= lens _caaIdDimensionValue
(\ s a -> s{_caaIdDimensionValue = a})
-- | Whether the video or audio asset is active. This is a read-only field
-- for VPAID_NON_LINEAR_VIDEO assets. Applicable to the following creative
-- types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID.
caaActive :: Lens' CreativeAsset (Maybe Bool)
caaActive
= lens _caaActive (\ s a -> s{_caaActive = a})
-- | Role of the asset in relation to creative. Applicable to all but the
-- following creative types: all REDIRECT and TRACKING_TEXT. This is a
-- required field. PRIMARY applies to DISPLAY, FLASH_INPAGE, HTML5_BANNER,
-- IMAGE, DISPLAY_IMAGE_GALLERY, all RICH_MEDIA (which may contain multiple
-- primary assets), and all VPAID creatives. BACKUP_IMAGE applies to
-- FLASH_INPAGE, HTML5_BANNER, all RICH_MEDIA, and all VPAID creatives.
-- Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
-- ADDITIONAL_IMAGE and ADDITIONAL_FLASH apply to FLASH_INPAGE creatives.
-- OTHER refers to assets from sources other than Campaign Manager, such as
-- Studio uploaded assets, applicable to all RICH_MEDIA and all VPAID
-- creatives. PARENT_VIDEO refers to videos uploaded by the user in
-- Campaign Manager and is applicable to INSTREAM_VIDEO and
-- VPAID_LINEAR_VIDEO creatives. TRANSCODED_VIDEO refers to videos
-- transcoded by Campaign Manager from PARENT_VIDEO assets and is
-- applicable to INSTREAM_VIDEO and VPAID_LINEAR_VIDEO creatives.
-- ALTERNATE_VIDEO refers to the Campaign Manager representation of child
-- asset videos from Studio, and is applicable to VPAID_LINEAR_VIDEO
-- creatives. These cannot be added or removed within Campaign Manager. For
-- VPAID_LINEAR_VIDEO creatives, PARENT_VIDEO, TRANSCODED_VIDEO and
-- ALTERNATE_VIDEO assets that are marked active serve as backup in case
-- the VPAID creative cannot be served. Only PARENT_VIDEO assets can be
-- added or removed for an INSTREAM_VIDEO or VPAID_LINEAR_VIDEO creative.
-- PARENT_AUDIO refers to audios uploaded by the user in Campaign Manager
-- and is applicable to INSTREAM_AUDIO creatives. TRANSCODED_AUDIO refers
-- to audios transcoded by Campaign Manager from PARENT_AUDIO assets and is
-- applicable to INSTREAM_AUDIO creatives.
caaRole :: Lens' CreativeAsset (Maybe CreativeAssetRole)
caaRole = lens _caaRole (\ s a -> s{_caaRole = a})
-- | Detected MIME type for audio or video asset. This is a read-only field.
-- Applicable to the following creative types: INSTREAM_AUDIO,
-- INSTREAM_VIDEO and all VPAID.
caaMimeType :: Lens' CreativeAsset (Maybe Text)
caaMimeType
= lens _caaMimeType (\ s a -> s{_caaMimeType = a})
-- | Offset top unit for an asset. This is a read-only field if the asset
-- displayType is ASSET_DISPLAY_TYPE_OVERLAY. Applicable to the following
-- creative types: all RICH_MEDIA.
caaPositionTopUnit :: Lens' CreativeAsset (Maybe CreativeAssetPositionTopUnit)
caaPositionTopUnit
= lens _caaPositionTopUnit
(\ s a -> s{_caaPositionTopUnit = a})
-- | Offset left unit for an asset. This is a read-only field. Applicable to
-- the following creative types: all RICH_MEDIA.
caaPositionLeftUnit :: Lens' CreativeAsset (Maybe CreativeAssetPositionLeftUnit)
caaPositionLeftUnit
= lens _caaPositionLeftUnit
(\ s a -> s{_caaPositionLeftUnit = a})
-- | Possible alignments for an asset. This is a read-only field. Applicable
-- to the following creative types:
-- RICH_MEDIA_DISPLAY_MULTI_FLOATING_INTERSTITIAL .
caaAlignment :: Lens' CreativeAsset (Maybe CreativeAssetAlignment)
caaAlignment
= lens _caaAlignment (\ s a -> s{_caaAlignment = a})
-- | Detected expanded dimension for video asset. This is a read-only field.
-- Applicable to the following creative types: INSTREAM_VIDEO and all
-- VPAID.
caaExpandedDimension :: Lens' CreativeAsset (Maybe Size)
caaExpandedDimension
= lens _caaExpandedDimension
(\ s a -> s{_caaExpandedDimension = a})
-- | Additional sizes associated with this creative asset. HTML5 asset
-- generated by compatible software such as GWD will be able to support
-- more sizes this creative asset can render.
caaAdditionalSizes :: Lens' CreativeAsset [Size]
caaAdditionalSizes
= lens _caaAdditionalSizes
(\ s a -> s{_caaAdditionalSizes = a})
. _Default
. _Coerce
-- | File name of zip file. This is a read-only field. Applicable to the
-- following creative types: HTML5_BANNER.
caaZipFilename :: Lens' CreativeAsset (Maybe Text)
caaZipFilename
= lens _caaZipFilename
(\ s a -> s{_caaZipFilename = a})
-- | Detected duration for audio or video asset. This is a read-only field.
-- Applicable to the following creative types: INSTREAM_AUDIO,
-- INSTREAM_VIDEO and all VPAID.
caaMediaDuration :: Lens' CreativeAsset (Maybe Double)
caaMediaDuration
= lens _caaMediaDuration
(\ s a -> s{_caaMediaDuration = a})
. mapping _Coerce
-- | Whether ActionScript3 is enabled for the flash asset. This is a
-- read-only field. Applicable to the following creative type:
-- FLASH_INPAGE. Applicable to DISPLAY when the primary asset type is not
-- HTML_IMAGE.
caaActionScript3 :: Lens' CreativeAsset (Maybe Bool)
caaActionScript3
= lens _caaActionScript3
(\ s a -> s{_caaActionScript3 = a})
-- | Type of rich media asset. This is a read-only field. Applicable to the
-- following creative types: all RICH_MEDIA.
caaDisplayType :: Lens' CreativeAsset (Maybe CreativeAssetDisplayType)
caaDisplayType
= lens _caaDisplayType
(\ s a -> s{_caaDisplayType = a})
-- | Rich media child asset type. This is a read-only field. Applicable to
-- the following creative types: all VPAID.
caaChildAssetType :: Lens' CreativeAsset (Maybe CreativeAssetChildAssetType)
caaChildAssetType
= lens _caaChildAssetType
(\ s a -> s{_caaChildAssetType = a})
-- | Size of an asset when collapsed. This is a read-only field. Applicable
-- to the following creative types: all RICH_MEDIA and all VPAID.
-- Additionally, applicable to assets whose displayType is
-- ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN.
caaCollapsedSize :: Lens' CreativeAsset (Maybe Size)
caaCollapsedSize
= lens _caaCollapsedSize
(\ s a -> s{_caaCollapsedSize = a})
-- | Audio sample bit rate in hertz. This is a read-only field. Applicable to
-- the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all
-- VPAID.
caaAudioSampleRate :: Lens' CreativeAsset (Maybe Int32)
caaAudioSampleRate
= lens _caaAudioSampleRate
(\ s a -> s{_caaAudioSampleRate = a})
. mapping _Coerce
-- | Numeric ID of this creative asset. This is a required field and should
-- not be modified. Applicable to all but the following creative types: all
-- REDIRECT and TRACKING_TEXT.
caaId :: Lens' CreativeAsset (Maybe Int64)
caaId
= lens _caaId (\ s a -> s{_caaId = a}) .
mapping _Coerce
-- | Detected bit-rate for audio or video asset. This is a read-only field.
-- Applicable to the following creative types: INSTREAM_AUDIO,
-- INSTREAM_VIDEO and all VPAID.
caaBitRate :: Lens' CreativeAsset (Maybe Int32)
caaBitRate
= lens _caaBitRate (\ s a -> s{_caaBitRate = a}) .
mapping _Coerce
-- | Whether this asset is used as a polite load asset.
caaPoliteLoad :: Lens' CreativeAsset (Maybe Bool)
caaPoliteLoad
= lens _caaPoliteLoad
(\ s a -> s{_caaPoliteLoad = a})
-- | Custom start time in seconds for making the asset visible. Applicable to
-- the following creative types: all RICH_MEDIA. Value must be greater than
-- or equal to 0.
caaCustomStartTimeValue :: Lens' CreativeAsset (Maybe Int32)
caaCustomStartTimeValue
= lens _caaCustomStartTimeValue
(\ s a -> s{_caaCustomStartTimeValue = a})
. mapping _Coerce
-- | Initial wait time type before making the asset visible. Applicable to
-- the following creative types: all RICH_MEDIA.
caaStartTimeType :: Lens' CreativeAsset (Maybe CreativeAssetStartTimeType)
caaStartTimeType
= lens _caaStartTimeType
(\ s a -> s{_caaStartTimeType = a})
-- | Audio stream bit rate in kbps. This is a read-only field. Applicable to
-- the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all
-- VPAID.
caaAudioBitRate :: Lens' CreativeAsset (Maybe Int32)
caaAudioBitRate
= lens _caaAudioBitRate
(\ s a -> s{_caaAudioBitRate = a})
. mapping _Coerce
-- | Duration in seconds for which an asset will be displayed. Applicable to
-- the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and
-- VPAID_LINEAR_VIDEO. Value must be greater than or equal to 1.
caaDuration :: Lens' CreativeAsset (Maybe Int32)
caaDuration
= lens _caaDuration (\ s a -> s{_caaDuration = a}) .
mapping _Coerce
-- | Orientation of video asset. This is a read-only, auto-generated field.
caaOrientation :: Lens' CreativeAsset (Maybe CreativeAssetOrientation)
caaOrientation
= lens _caaOrientation
(\ s a -> s{_caaOrientation = a})
-- | Artwork type of rich media creative. This is a read-only field.
-- Applicable to the following creative types: all RICH_MEDIA.
caaArtworkType :: Lens' CreativeAsset (Maybe CreativeAssetArtworkType)
caaArtworkType
= lens _caaArtworkType
(\ s a -> s{_caaArtworkType = a})
-- | Whether to hide Flash objects flag for an asset. Applicable to the
-- following creative types: all RICH_MEDIA.
caaHideFlashObjects :: Lens' CreativeAsset (Maybe Bool)
caaHideFlashObjects
= lens _caaHideFlashObjects
(\ s a -> s{_caaHideFlashObjects = a})
-- | List of feature dependencies for the creative asset that are detected by
-- Campaign Manager. Feature dependencies are features that a browser must
-- be able to support in order to render your HTML5 creative correctly.
-- This is a read-only, auto-generated field. Applicable to the following
-- creative types: HTML5_BANNER. Applicable to DISPLAY when the primary
-- asset type is not HTML_IMAGE.
caaDetectedFeatures :: Lens' CreativeAsset [CreativeAssetDetectedFeaturesItem]
caaDetectedFeatures
= lens _caaDetectedFeatures
(\ s a -> s{_caaDetectedFeatures = a})
. _Default
. _Coerce
-- | Exit event configured for the backup image. Applicable to the following
-- creative types: all RICH_MEDIA.
caaBackupImageExit :: Lens' CreativeAsset (Maybe CreativeCustomEvent)
caaBackupImageExit
= lens _caaBackupImageExit
(\ s a -> s{_caaBackupImageExit = a})
-- | Offset position for an asset. Applicable to the following creative
-- types: all RICH_MEDIA.
caaPosition :: Lens' CreativeAsset (Maybe OffSetPosition)
caaPosition
= lens _caaPosition (\ s a -> s{_caaPosition = a})
-- | Whether the asset is horizontally locked. This is a read-only field.
-- Applicable to the following creative types: all RICH_MEDIA.
caaHorizontallyLocked :: Lens' CreativeAsset (Maybe Bool)
caaHorizontallyLocked
= lens _caaHorizontallyLocked
(\ s a -> s{_caaHorizontallyLocked = a})
instance FromJSON CreativeAsset where
parseJSON
= withObject "CreativeAsset"
(\ o ->
CreativeAsset' <$>
(o .:? "zIndex") <*> (o .:? "pushdown") <*>
(o .:? "frameRate")
<*> (o .:? "originalBackup")
<*> (o .:? "windowMode")
<*> (o .:? "flashVersion")
<*> (o .:? "pushdownDuration")
<*> (o .:? "size")
<*> (o .:? "verticallyLocked")
<*> (o .:? "offset")
<*> (o .:? "streamingServingUrl")
<*> (o .:? "zipFilesize")
<*> (o .:? "transparency")
<*> (o .:? "hideSelectionBoxes")
<*> (o .:? "sslCompliant")
<*> (o .:? "fileSize")
<*> (o .:? "assetIdentifier")
<*> (o .:? "companionCreativeIds" .!= mempty)
<*> (o .:? "durationType")
<*> (o .:? "progressiveServingUrl")
<*> (o .:? "idDimensionValue")
<*> (o .:? "active")
<*> (o .:? "role")
<*> (o .:? "mimeType")
<*> (o .:? "positionTopUnit")
<*> (o .:? "positionLeftUnit")
<*> (o .:? "alignment")
<*> (o .:? "expandedDimension")
<*> (o .:? "additionalSizes" .!= mempty)
<*> (o .:? "zipFilename")
<*> (o .:? "mediaDuration")
<*> (o .:? "actionScript3")
<*> (o .:? "displayType")
<*> (o .:? "childAssetType")
<*> (o .:? "collapsedSize")
<*> (o .:? "audioSampleRate")
<*> (o .:? "id")
<*> (o .:? "bitRate")
<*> (o .:? "politeLoad")
<*> (o .:? "customStartTimeValue")
<*> (o .:? "startTimeType")
<*> (o .:? "audioBitRate")
<*> (o .:? "duration")
<*> (o .:? "orientation")
<*> (o .:? "artworkType")
<*> (o .:? "hideFlashObjects")
<*> (o .:? "detectedFeatures" .!= mempty)
<*> (o .:? "backupImageExit")
<*> (o .:? "position")
<*> (o .:? "horizontallyLocked"))
instance ToJSON CreativeAsset where
toJSON CreativeAsset'{..}
= object
(catMaybes
[("zIndex" .=) <$> _caaZIndex,
("pushdown" .=) <$> _caaPushdown,
("frameRate" .=) <$> _caaFrameRate,
("originalBackup" .=) <$> _caaOriginalBackup,
("windowMode" .=) <$> _caaWindowMode,
("flashVersion" .=) <$> _caaFlashVersion,
("pushdownDuration" .=) <$> _caaPushdownDuration,
("size" .=) <$> _caaSize,
("verticallyLocked" .=) <$> _caaVerticallyLocked,
("offset" .=) <$> _caaOffSet,
("streamingServingUrl" .=) <$>
_caaStreamingServingURL,
("zipFilesize" .=) <$> _caaZipFilesize,
("transparency" .=) <$> _caaTransparency,
("hideSelectionBoxes" .=) <$> _caaHideSelectionBoxes,
("sslCompliant" .=) <$> _caaSSLCompliant,
("fileSize" .=) <$> _caaFileSize,
("assetIdentifier" .=) <$> _caaAssetIdentifier,
("companionCreativeIds" .=) <$>
_caaCompanionCreativeIds,
("durationType" .=) <$> _caaDurationType,
("progressiveServingUrl" .=) <$>
_caaProgressiveServingURL,
("idDimensionValue" .=) <$> _caaIdDimensionValue,
("active" .=) <$> _caaActive,
("role" .=) <$> _caaRole,
("mimeType" .=) <$> _caaMimeType,
("positionTopUnit" .=) <$> _caaPositionTopUnit,
("positionLeftUnit" .=) <$> _caaPositionLeftUnit,
("alignment" .=) <$> _caaAlignment,
("expandedDimension" .=) <$> _caaExpandedDimension,
("additionalSizes" .=) <$> _caaAdditionalSizes,
("zipFilename" .=) <$> _caaZipFilename,
("mediaDuration" .=) <$> _caaMediaDuration,
("actionScript3" .=) <$> _caaActionScript3,
("displayType" .=) <$> _caaDisplayType,
("childAssetType" .=) <$> _caaChildAssetType,
("collapsedSize" .=) <$> _caaCollapsedSize,
("audioSampleRate" .=) <$> _caaAudioSampleRate,
("id" .=) <$> _caaId, ("bitRate" .=) <$> _caaBitRate,
("politeLoad" .=) <$> _caaPoliteLoad,
("customStartTimeValue" .=) <$>
_caaCustomStartTimeValue,
("startTimeType" .=) <$> _caaStartTimeType,
("audioBitRate" .=) <$> _caaAudioBitRate,
("duration" .=) <$> _caaDuration,
("orientation" .=) <$> _caaOrientation,
("artworkType" .=) <$> _caaArtworkType,
("hideFlashObjects" .=) <$> _caaHideFlashObjects,
("detectedFeatures" .=) <$> _caaDetectedFeatures,
("backupImageExit" .=) <$> _caaBackupImageExit,
("position" .=) <$> _caaPosition,
("horizontallyLocked" .=) <$>
_caaHorizontallyLocked])
-- | Language Targeting.
--
-- /See:/ 'languageTargeting' smart constructor.
newtype LanguageTargeting =
LanguageTargeting'
{ _ltLanguages :: Maybe [Language]
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'LanguageTargeting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ltLanguages'
languageTargeting
:: LanguageTargeting
languageTargeting = LanguageTargeting' {_ltLanguages = Nothing}
-- | Languages that this ad targets. For each language only languageId is
-- required. The other fields are populated automatically when the ad is
-- inserted or updated.
ltLanguages :: Lens' LanguageTargeting [Language]
ltLanguages
= lens _ltLanguages (\ s a -> s{_ltLanguages = a}) .
_Default
. _Coerce
instance FromJSON LanguageTargeting where
parseJSON
= withObject "LanguageTargeting"
(\ o ->
LanguageTargeting' <$>
(o .:? "languages" .!= mempty))
instance ToJSON LanguageTargeting where
toJSON LanguageTargeting'{..}
= object
(catMaybes [("languages" .=) <$> _ltLanguages])
-- | Encapsulates the list of rules for asset selection and a default asset
-- in case none of the rules match. Applicable to INSTREAM_VIDEO creatives.
--
-- /See:/ 'creativeAssetSelection' smart constructor.
data CreativeAssetSelection =
CreativeAssetSelection'
{ _casRules :: !(Maybe [Rule])
, _casDefaultAssetId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeAssetSelection' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'casRules'
--
-- * 'casDefaultAssetId'
creativeAssetSelection
:: CreativeAssetSelection
creativeAssetSelection =
CreativeAssetSelection' {_casRules = Nothing, _casDefaultAssetId = Nothing}
-- | Rules determine which asset will be served to a viewer. Rules will be
-- evaluated in the order in which they are stored in this list. This list
-- must contain at least one rule. Applicable to INSTREAM_VIDEO creatives.
casRules :: Lens' CreativeAssetSelection [Rule]
casRules
= lens _casRules (\ s a -> s{_casRules = a}) .
_Default
. _Coerce
-- | A creativeAssets[].id. This should refer to one of the parent assets in
-- this creative, and will be served if none of the rules match. This is a
-- required field.
casDefaultAssetId :: Lens' CreativeAssetSelection (Maybe Int64)
casDefaultAssetId
= lens _casDefaultAssetId
(\ s a -> s{_casDefaultAssetId = a})
. mapping _Coerce
instance FromJSON CreativeAssetSelection where
parseJSON
= withObject "CreativeAssetSelection"
(\ o ->
CreativeAssetSelection' <$>
(o .:? "rules" .!= mempty) <*>
(o .:? "defaultAssetId"))
instance ToJSON CreativeAssetSelection where
toJSON CreativeAssetSelection'{..}
= object
(catMaybes
[("rules" .=) <$> _casRules,
("defaultAssetId" .=) <$> _casDefaultAssetId])
-- | Placement List Response
--
-- /See:/ 'placementsListResponse' smart constructor.
data PlacementsListResponse =
PlacementsListResponse'
{ _plaNextPageToken :: !(Maybe Text)
, _plaKind :: !(Maybe Text)
, _plaPlacements :: !(Maybe [Placement])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlacementsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plaNextPageToken'
--
-- * 'plaKind'
--
-- * 'plaPlacements'
placementsListResponse
:: PlacementsListResponse
placementsListResponse =
PlacementsListResponse'
{_plaNextPageToken = Nothing, _plaKind = Nothing, _plaPlacements = Nothing}
-- | Pagination token to be used for the next list operation.
plaNextPageToken :: Lens' PlacementsListResponse (Maybe Text)
plaNextPageToken
= lens _plaNextPageToken
(\ s a -> s{_plaNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#placementsListResponse\".
plaKind :: Lens' PlacementsListResponse (Maybe Text)
plaKind = lens _plaKind (\ s a -> s{_plaKind = a})
-- | Placement collection.
plaPlacements :: Lens' PlacementsListResponse [Placement]
plaPlacements
= lens _plaPlacements
(\ s a -> s{_plaPlacements = a})
. _Default
. _Coerce
instance FromJSON PlacementsListResponse where
parseJSON
= withObject "PlacementsListResponse"
(\ o ->
PlacementsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "placements" .!= mempty))
instance ToJSON PlacementsListResponse where
toJSON PlacementsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _plaNextPageToken,
("kind" .=) <$> _plaKind,
("placements" .=) <$> _plaPlacements])
-- | The report\'s schedule. Can only be set if the report\'s \'dateRange\'
-- is a relative date range and the relative date range is not \"TODAY\".
--
-- /See:/ 'reportSchedule' smart constructor.
data ReportSchedule =
ReportSchedule'
{ _rsEvery :: !(Maybe (Textual Int32))
, _rsActive :: !(Maybe Bool)
, _rsRepeats :: !(Maybe Text)
, _rsStartDate :: !(Maybe Date')
, _rsExpirationDate :: !(Maybe Date')
, _rsRunsOnDayOfMonth :: !(Maybe ReportScheduleRunsOnDayOfMonth)
, _rsRepeatsOnWeekDays :: !(Maybe [ReportScheduleRepeatsOnWeekDaysItem])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportSchedule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rsEvery'
--
-- * 'rsActive'
--
-- * 'rsRepeats'
--
-- * 'rsStartDate'
--
-- * 'rsExpirationDate'
--
-- * 'rsRunsOnDayOfMonth'
--
-- * 'rsRepeatsOnWeekDays'
reportSchedule
:: ReportSchedule
reportSchedule =
ReportSchedule'
{ _rsEvery = Nothing
, _rsActive = Nothing
, _rsRepeats = Nothing
, _rsStartDate = Nothing
, _rsExpirationDate = Nothing
, _rsRunsOnDayOfMonth = Nothing
, _rsRepeatsOnWeekDays = Nothing
}
-- | Defines every how many days, weeks or months the report should be run.
-- Needs to be set when \"repeats\" is either \"DAILY\", \"WEEKLY\" or
-- \"MONTHLY\".
rsEvery :: Lens' ReportSchedule (Maybe Int32)
rsEvery
= lens _rsEvery (\ s a -> s{_rsEvery = a}) .
mapping _Coerce
-- | Whether the schedule is active or not. Must be set to either true or
-- false.
rsActive :: Lens' ReportSchedule (Maybe Bool)
rsActive = lens _rsActive (\ s a -> s{_rsActive = a})
-- | The interval for which the report is repeated. Note: - \"DAILY\" also
-- requires field \"every\" to be set. - \"WEEKLY\" also requires fields
-- \"every\" and \"repeatsOnWeekDays\" to be set. - \"MONTHLY\" also
-- requires fields \"every\" and \"runsOnDayOfMonth\" to be set.
rsRepeats :: Lens' ReportSchedule (Maybe Text)
rsRepeats
= lens _rsRepeats (\ s a -> s{_rsRepeats = a})
rsStartDate :: Lens' ReportSchedule (Maybe Day)
rsStartDate
= lens _rsStartDate (\ s a -> s{_rsStartDate = a}) .
mapping _Date
rsExpirationDate :: Lens' ReportSchedule (Maybe Day)
rsExpirationDate
= lens _rsExpirationDate
(\ s a -> s{_rsExpirationDate = a})
. mapping _Date
-- | Enum to define for \"MONTHLY\" scheduled reports whether reports should
-- be repeated on the same day of the month as \"startDate\" or the same
-- day of the week of the month. Example: If \'startDate\' is Monday, April
-- 2nd 2012 (2012-04-02), \"DAY_OF_MONTH\" would run subsequent reports on
-- the 2nd of every Month, and \"WEEK_OF_MONTH\" would run subsequent
-- reports on the first Monday of the month.
rsRunsOnDayOfMonth :: Lens' ReportSchedule (Maybe ReportScheduleRunsOnDayOfMonth)
rsRunsOnDayOfMonth
= lens _rsRunsOnDayOfMonth
(\ s a -> s{_rsRunsOnDayOfMonth = a})
-- | List of week days \"WEEKLY\" on which scheduled reports should run.
rsRepeatsOnWeekDays :: Lens' ReportSchedule [ReportScheduleRepeatsOnWeekDaysItem]
rsRepeatsOnWeekDays
= lens _rsRepeatsOnWeekDays
(\ s a -> s{_rsRepeatsOnWeekDays = a})
. _Default
. _Coerce
instance FromJSON ReportSchedule where
parseJSON
= withObject "ReportSchedule"
(\ o ->
ReportSchedule' <$>
(o .:? "every") <*> (o .:? "active") <*>
(o .:? "repeats")
<*> (o .:? "startDate")
<*> (o .:? "expirationDate")
<*> (o .:? "runsOnDayOfMonth")
<*> (o .:? "repeatsOnWeekDays" .!= mempty))
instance ToJSON ReportSchedule where
toJSON ReportSchedule'{..}
= object
(catMaybes
[("every" .=) <$> _rsEvery,
("active" .=) <$> _rsActive,
("repeats" .=) <$> _rsRepeats,
("startDate" .=) <$> _rsStartDate,
("expirationDate" .=) <$> _rsExpirationDate,
("runsOnDayOfMonth" .=) <$> _rsRunsOnDayOfMonth,
("repeatsOnWeekDays" .=) <$> _rsRepeatsOnWeekDays])
-- | The report criteria for a report of type \"PATH_TO_CONVERSION\".
--
-- /See:/ 'reportPathToConversionCriteria' smart constructor.
data ReportPathToConversionCriteria =
ReportPathToConversionCriteria'
{ _rptccReportProperties :: !(Maybe ReportPathToConversionCriteriaReportProperties)
, _rptccMetricNames :: !(Maybe [Text])
, _rptccCustomRichMediaEvents :: !(Maybe [DimensionValue])
, _rptccDateRange :: !(Maybe DateRange)
, _rptccConversionDimensions :: !(Maybe [SortedDimension])
, _rptccCustomFloodlightVariables :: !(Maybe [SortedDimension])
, _rptccFloodlightConfigId :: !(Maybe DimensionValue)
, _rptccActivityFilters :: !(Maybe [DimensionValue])
, _rptccPerInteractionDimensions :: !(Maybe [SortedDimension])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportPathToConversionCriteria' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rptccReportProperties'
--
-- * 'rptccMetricNames'
--
-- * 'rptccCustomRichMediaEvents'
--
-- * 'rptccDateRange'
--
-- * 'rptccConversionDimensions'
--
-- * 'rptccCustomFloodlightVariables'
--
-- * 'rptccFloodlightConfigId'
--
-- * 'rptccActivityFilters'
--
-- * 'rptccPerInteractionDimensions'
reportPathToConversionCriteria
:: ReportPathToConversionCriteria
reportPathToConversionCriteria =
ReportPathToConversionCriteria'
{ _rptccReportProperties = Nothing
, _rptccMetricNames = Nothing
, _rptccCustomRichMediaEvents = Nothing
, _rptccDateRange = Nothing
, _rptccConversionDimensions = Nothing
, _rptccCustomFloodlightVariables = Nothing
, _rptccFloodlightConfigId = Nothing
, _rptccActivityFilters = Nothing
, _rptccPerInteractionDimensions = Nothing
}
-- | The properties of the report.
rptccReportProperties :: Lens' ReportPathToConversionCriteria (Maybe ReportPathToConversionCriteriaReportProperties)
rptccReportProperties
= lens _rptccReportProperties
(\ s a -> s{_rptccReportProperties = a})
-- | The list of names of metrics the report should include.
rptccMetricNames :: Lens' ReportPathToConversionCriteria [Text]
rptccMetricNames
= lens _rptccMetricNames
(\ s a -> s{_rptccMetricNames = a})
. _Default
. _Coerce
-- | The list of custom rich media events to include.
rptccCustomRichMediaEvents :: Lens' ReportPathToConversionCriteria [DimensionValue]
rptccCustomRichMediaEvents
= lens _rptccCustomRichMediaEvents
(\ s a -> s{_rptccCustomRichMediaEvents = a})
. _Default
. _Coerce
-- | The date range this report should be run for.
rptccDateRange :: Lens' ReportPathToConversionCriteria (Maybe DateRange)
rptccDateRange
= lens _rptccDateRange
(\ s a -> s{_rptccDateRange = a})
-- | The list of conversion dimensions the report should include.
rptccConversionDimensions :: Lens' ReportPathToConversionCriteria [SortedDimension]
rptccConversionDimensions
= lens _rptccConversionDimensions
(\ s a -> s{_rptccConversionDimensions = a})
. _Default
. _Coerce
-- | The list of custom floodlight variables the report should include.
rptccCustomFloodlightVariables :: Lens' ReportPathToConversionCriteria [SortedDimension]
rptccCustomFloodlightVariables
= lens _rptccCustomFloodlightVariables
(\ s a -> s{_rptccCustomFloodlightVariables = a})
. _Default
. _Coerce
-- | The floodlight ID for which to show data in this report. All advertisers
-- associated with that ID will automatically be added. The dimension of
-- the value needs to be \'dfa:floodlightConfigId\'.
rptccFloodlightConfigId :: Lens' ReportPathToConversionCriteria (Maybe DimensionValue)
rptccFloodlightConfigId
= lens _rptccFloodlightConfigId
(\ s a -> s{_rptccFloodlightConfigId = a})
-- | The list of \'dfa:activity\' values to filter on.
rptccActivityFilters :: Lens' ReportPathToConversionCriteria [DimensionValue]
rptccActivityFilters
= lens _rptccActivityFilters
(\ s a -> s{_rptccActivityFilters = a})
. _Default
. _Coerce
-- | The list of per interaction dimensions the report should include.
rptccPerInteractionDimensions :: Lens' ReportPathToConversionCriteria [SortedDimension]
rptccPerInteractionDimensions
= lens _rptccPerInteractionDimensions
(\ s a -> s{_rptccPerInteractionDimensions = a})
. _Default
. _Coerce
instance FromJSON ReportPathToConversionCriteria
where
parseJSON
= withObject "ReportPathToConversionCriteria"
(\ o ->
ReportPathToConversionCriteria' <$>
(o .:? "reportProperties") <*>
(o .:? "metricNames" .!= mempty)
<*> (o .:? "customRichMediaEvents" .!= mempty)
<*> (o .:? "dateRange")
<*> (o .:? "conversionDimensions" .!= mempty)
<*> (o .:? "customFloodlightVariables" .!= mempty)
<*> (o .:? "floodlightConfigId")
<*> (o .:? "activityFilters" .!= mempty)
<*> (o .:? "perInteractionDimensions" .!= mempty))
instance ToJSON ReportPathToConversionCriteria where
toJSON ReportPathToConversionCriteria'{..}
= object
(catMaybes
[("reportProperties" .=) <$> _rptccReportProperties,
("metricNames" .=) <$> _rptccMetricNames,
("customRichMediaEvents" .=) <$>
_rptccCustomRichMediaEvents,
("dateRange" .=) <$> _rptccDateRange,
("conversionDimensions" .=) <$>
_rptccConversionDimensions,
("customFloodlightVariables" .=) <$>
_rptccCustomFloodlightVariables,
("floodlightConfigId" .=) <$>
_rptccFloodlightConfigId,
("activityFilters" .=) <$> _rptccActivityFilters,
("perInteractionDimensions" .=) <$>
_rptccPerInteractionDimensions])
-- | Metro List Response
--
-- /See:/ 'metrosListResponse' smart constructor.
data MetrosListResponse =
MetrosListResponse'
{ _mlrKind :: !(Maybe Text)
, _mlrMetros :: !(Maybe [Metro])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'MetrosListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mlrKind'
--
-- * 'mlrMetros'
metrosListResponse
:: MetrosListResponse
metrosListResponse =
MetrosListResponse' {_mlrKind = Nothing, _mlrMetros = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#metrosListResponse\".
mlrKind :: Lens' MetrosListResponse (Maybe Text)
mlrKind = lens _mlrKind (\ s a -> s{_mlrKind = a})
-- | Metro collection.
mlrMetros :: Lens' MetrosListResponse [Metro]
mlrMetros
= lens _mlrMetros (\ s a -> s{_mlrMetros = a}) .
_Default
. _Coerce
instance FromJSON MetrosListResponse where
parseJSON
= withObject "MetrosListResponse"
(\ o ->
MetrosListResponse' <$>
(o .:? "kind") <*> (o .:? "metros" .!= mempty))
instance ToJSON MetrosListResponse where
toJSON MetrosListResponse'{..}
= object
(catMaybes
[("kind" .=) <$> _mlrKind,
("metros" .=) <$> _mlrMetros])
-- | Insert Conversions Response.
--
-- /See:/ 'conversionsBatchInsertResponse' smart constructor.
data ConversionsBatchInsertResponse =
ConversionsBatchInsertResponse'
{ _cbirbStatus :: !(Maybe [ConversionStatus])
, _cbirbKind :: !(Maybe Text)
, _cbirbHasFailures :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ConversionsBatchInsertResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cbirbStatus'
--
-- * 'cbirbKind'
--
-- * 'cbirbHasFailures'
conversionsBatchInsertResponse
:: ConversionsBatchInsertResponse
conversionsBatchInsertResponse =
ConversionsBatchInsertResponse'
{_cbirbStatus = Nothing, _cbirbKind = Nothing, _cbirbHasFailures = Nothing}
-- | The insert status of each conversion. Statuses are returned in the same
-- order that conversions are inserted.
cbirbStatus :: Lens' ConversionsBatchInsertResponse [ConversionStatus]
cbirbStatus
= lens _cbirbStatus (\ s a -> s{_cbirbStatus = a}) .
_Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#conversionsBatchInsertResponse\".
cbirbKind :: Lens' ConversionsBatchInsertResponse (Maybe Text)
cbirbKind
= lens _cbirbKind (\ s a -> s{_cbirbKind = a})
-- | Indicates that some or all conversions failed to insert.
cbirbHasFailures :: Lens' ConversionsBatchInsertResponse (Maybe Bool)
cbirbHasFailures
= lens _cbirbHasFailures
(\ s a -> s{_cbirbHasFailures = a})
instance FromJSON ConversionsBatchInsertResponse
where
parseJSON
= withObject "ConversionsBatchInsertResponse"
(\ o ->
ConversionsBatchInsertResponse' <$>
(o .:? "status" .!= mempty) <*> (o .:? "kind") <*>
(o .:? "hasFailures"))
instance ToJSON ConversionsBatchInsertResponse where
toJSON ConversionsBatchInsertResponse'{..}
= object
(catMaybes
[("status" .=) <$> _cbirbStatus,
("kind" .=) <$> _cbirbKind,
("hasFailures" .=) <$> _cbirbHasFailures])
-- | Order document List Response
--
-- /See:/ 'orderDocumentsListResponse' smart constructor.
data OrderDocumentsListResponse =
OrderDocumentsListResponse'
{ _odlrNextPageToken :: !(Maybe Text)
, _odlrKind :: !(Maybe Text)
, _odlrOrderDocuments :: !(Maybe [OrderDocument])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OrderDocumentsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'odlrNextPageToken'
--
-- * 'odlrKind'
--
-- * 'odlrOrderDocuments'
orderDocumentsListResponse
:: OrderDocumentsListResponse
orderDocumentsListResponse =
OrderDocumentsListResponse'
{ _odlrNextPageToken = Nothing
, _odlrKind = Nothing
, _odlrOrderDocuments = Nothing
}
-- | Pagination token to be used for the next list operation.
odlrNextPageToken :: Lens' OrderDocumentsListResponse (Maybe Text)
odlrNextPageToken
= lens _odlrNextPageToken
(\ s a -> s{_odlrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#orderDocumentsListResponse\".
odlrKind :: Lens' OrderDocumentsListResponse (Maybe Text)
odlrKind = lens _odlrKind (\ s a -> s{_odlrKind = a})
-- | Order document collection
odlrOrderDocuments :: Lens' OrderDocumentsListResponse [OrderDocument]
odlrOrderDocuments
= lens _odlrOrderDocuments
(\ s a -> s{_odlrOrderDocuments = a})
. _Default
. _Coerce
instance FromJSON OrderDocumentsListResponse where
parseJSON
= withObject "OrderDocumentsListResponse"
(\ o ->
OrderDocumentsListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "orderDocuments" .!= mempty))
instance ToJSON OrderDocumentsListResponse where
toJSON OrderDocumentsListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _odlrNextPageToken,
("kind" .=) <$> _odlrKind,
("orderDocuments" .=) <$> _odlrOrderDocuments])
-- | Represents a recipient.
--
-- /See:/ 'recipient' smart constructor.
data Recipient =
Recipient'
{ _recEmail :: !(Maybe Text)
, _recKind :: !(Maybe Text)
, _recDeliveryType :: !(Maybe RecipientDeliveryType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Recipient' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'recEmail'
--
-- * 'recKind'
--
-- * 'recDeliveryType'
recipient
:: Recipient
recipient =
Recipient'
{_recEmail = Nothing, _recKind = Nothing, _recDeliveryType = Nothing}
-- | The email address of the recipient.
recEmail :: Lens' Recipient (Maybe Text)
recEmail = lens _recEmail (\ s a -> s{_recEmail = a})
-- | The kind of resource this is, in this case dfareporting#recipient.
recKind :: Lens' Recipient (Maybe Text)
recKind = lens _recKind (\ s a -> s{_recKind = a})
-- | The delivery type for the recipient.
recDeliveryType :: Lens' Recipient (Maybe RecipientDeliveryType)
recDeliveryType
= lens _recDeliveryType
(\ s a -> s{_recDeliveryType = a})
instance FromJSON Recipient where
parseJSON
= withObject "Recipient"
(\ o ->
Recipient' <$>
(o .:? "email") <*> (o .:? "kind") <*>
(o .:? "deliveryType"))
instance ToJSON Recipient where
toJSON Recipient'{..}
= object
(catMaybes
[("email" .=) <$> _recEmail,
("kind" .=) <$> _recKind,
("deliveryType" .=) <$> _recDeliveryType])
-- | Contains properties of a site.
--
-- /See:/ 'site' smart constructor.
data Site =
Site'
{ _sitiVideoSettings :: !(Maybe SiteVideoSettings)
, _sitiKind :: !(Maybe Text)
, _sitiKeyName :: !(Maybe Text)
, _sitiSiteContacts :: !(Maybe [SiteContact])
, _sitiSiteSettings :: !(Maybe SiteSettings)
, _sitiIdDimensionValue :: !(Maybe DimensionValue)
, _sitiDirectorySiteIdDimensionValue :: !(Maybe DimensionValue)
, _sitiAccountId :: !(Maybe (Textual Int64))
, _sitiName :: !(Maybe Text)
, _sitiDirectorySiteId :: !(Maybe (Textual Int64))
, _sitiId :: !(Maybe (Textual Int64))
, _sitiSubAccountId :: !(Maybe (Textual Int64))
, _sitiApproved :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Site' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sitiVideoSettings'
--
-- * 'sitiKind'
--
-- * 'sitiKeyName'
--
-- * 'sitiSiteContacts'
--
-- * 'sitiSiteSettings'
--
-- * 'sitiIdDimensionValue'
--
-- * 'sitiDirectorySiteIdDimensionValue'
--
-- * 'sitiAccountId'
--
-- * 'sitiName'
--
-- * 'sitiDirectorySiteId'
--
-- * 'sitiId'
--
-- * 'sitiSubAccountId'
--
-- * 'sitiApproved'
site
:: Site
site =
Site'
{ _sitiVideoSettings = Nothing
, _sitiKind = Nothing
, _sitiKeyName = Nothing
, _sitiSiteContacts = Nothing
, _sitiSiteSettings = Nothing
, _sitiIdDimensionValue = Nothing
, _sitiDirectorySiteIdDimensionValue = Nothing
, _sitiAccountId = Nothing
, _sitiName = Nothing
, _sitiDirectorySiteId = Nothing
, _sitiId = Nothing
, _sitiSubAccountId = Nothing
, _sitiApproved = Nothing
}
-- | Default video settings for new placements created under this site. This
-- value will be used to populate the placements.videoSettings field, when
-- no value is specified for the new placement.
sitiVideoSettings :: Lens' Site (Maybe SiteVideoSettings)
sitiVideoSettings
= lens _sitiVideoSettings
(\ s a -> s{_sitiVideoSettings = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#site\".
sitiKind :: Lens' Site (Maybe Text)
sitiKind = lens _sitiKind (\ s a -> s{_sitiKind = a})
-- | Key name of this site. This is a read-only, auto-generated field.
sitiKeyName :: Lens' Site (Maybe Text)
sitiKeyName
= lens _sitiKeyName (\ s a -> s{_sitiKeyName = a})
-- | Site contacts.
sitiSiteContacts :: Lens' Site [SiteContact]
sitiSiteContacts
= lens _sitiSiteContacts
(\ s a -> s{_sitiSiteContacts = a})
. _Default
. _Coerce
-- | Site-wide settings.
sitiSiteSettings :: Lens' Site (Maybe SiteSettings)
sitiSiteSettings
= lens _sitiSiteSettings
(\ s a -> s{_sitiSiteSettings = a})
-- | Dimension value for the ID of this site. This is a read-only,
-- auto-generated field.
sitiIdDimensionValue :: Lens' Site (Maybe DimensionValue)
sitiIdDimensionValue
= lens _sitiIdDimensionValue
(\ s a -> s{_sitiIdDimensionValue = a})
-- | Dimension value for the ID of the directory site. This is a read-only,
-- auto-generated field.
sitiDirectorySiteIdDimensionValue :: Lens' Site (Maybe DimensionValue)
sitiDirectorySiteIdDimensionValue
= lens _sitiDirectorySiteIdDimensionValue
(\ s a -> s{_sitiDirectorySiteIdDimensionValue = a})
-- | Account ID of this site. This is a read-only field that can be left
-- blank.
sitiAccountId :: Lens' Site (Maybe Int64)
sitiAccountId
= lens _sitiAccountId
(\ s a -> s{_sitiAccountId = a})
. mapping _Coerce
-- | Name of this site.This is a required field. Must be less than 128
-- characters long. If this site is under a subaccount, the name must be
-- unique among sites of the same subaccount. Otherwise, this site is a
-- top-level site, and the name must be unique among top-level sites of the
-- same account.
sitiName :: Lens' Site (Maybe Text)
sitiName = lens _sitiName (\ s a -> s{_sitiName = a})
-- | Directory site associated with this site. This is a required field that
-- is read-only after insertion.
sitiDirectorySiteId :: Lens' Site (Maybe Int64)
sitiDirectorySiteId
= lens _sitiDirectorySiteId
(\ s a -> s{_sitiDirectorySiteId = a})
. mapping _Coerce
-- | ID of this site. This is a read-only, auto-generated field.
sitiId :: Lens' Site (Maybe Int64)
sitiId
= lens _sitiId (\ s a -> s{_sitiId = a}) .
mapping _Coerce
-- | Subaccount ID of this site. This is a read-only field that can be left
-- blank.
sitiSubAccountId :: Lens' Site (Maybe Int64)
sitiSubAccountId
= lens _sitiSubAccountId
(\ s a -> s{_sitiSubAccountId = a})
. mapping _Coerce
-- | Whether this site is approved.
sitiApproved :: Lens' Site (Maybe Bool)
sitiApproved
= lens _sitiApproved (\ s a -> s{_sitiApproved = a})
instance FromJSON Site where
parseJSON
= withObject "Site"
(\ o ->
Site' <$>
(o .:? "videoSettings") <*> (o .:? "kind") <*>
(o .:? "keyName")
<*> (o .:? "siteContacts" .!= mempty)
<*> (o .:? "siteSettings")
<*> (o .:? "idDimensionValue")
<*> (o .:? "directorySiteIdDimensionValue")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "directorySiteId")
<*> (o .:? "id")
<*> (o .:? "subaccountId")
<*> (o .:? "approved"))
instance ToJSON Site where
toJSON Site'{..}
= object
(catMaybes
[("videoSettings" .=) <$> _sitiVideoSettings,
("kind" .=) <$> _sitiKind,
("keyName" .=) <$> _sitiKeyName,
("siteContacts" .=) <$> _sitiSiteContacts,
("siteSettings" .=) <$> _sitiSiteSettings,
("idDimensionValue" .=) <$> _sitiIdDimensionValue,
("directorySiteIdDimensionValue" .=) <$>
_sitiDirectorySiteIdDimensionValue,
("accountId" .=) <$> _sitiAccountId,
("name" .=) <$> _sitiName,
("directorySiteId" .=) <$> _sitiDirectorySiteId,
("id" .=) <$> _sitiId,
("subaccountId" .=) <$> _sitiSubAccountId,
("approved" .=) <$> _sitiApproved])
-- | User Defined Variable configuration.
--
-- /See:/ 'userDefinedVariableConfiguration' smart constructor.
data UserDefinedVariableConfiguration =
UserDefinedVariableConfiguration'
{ _udvcReportName :: !(Maybe Text)
, _udvcDataType :: !(Maybe UserDefinedVariableConfigurationDataType)
, _udvcVariableType :: !(Maybe UserDefinedVariableConfigurationVariableType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UserDefinedVariableConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'udvcReportName'
--
-- * 'udvcDataType'
--
-- * 'udvcVariableType'
userDefinedVariableConfiguration
:: UserDefinedVariableConfiguration
userDefinedVariableConfiguration =
UserDefinedVariableConfiguration'
{ _udvcReportName = Nothing
, _udvcDataType = Nothing
, _udvcVariableType = Nothing
}
-- | User-friendly name for the variable which will appear in reports. This
-- is a required field, must be less than 64 characters long, and cannot
-- contain the following characters: \"\"\<>\".
udvcReportName :: Lens' UserDefinedVariableConfiguration (Maybe Text)
udvcReportName
= lens _udvcReportName
(\ s a -> s{_udvcReportName = a})
-- | Data type for the variable. This is a required field.
udvcDataType :: Lens' UserDefinedVariableConfiguration (Maybe UserDefinedVariableConfigurationDataType)
udvcDataType
= lens _udvcDataType (\ s a -> s{_udvcDataType = a})
-- | Variable name in the tag. This is a required field.
udvcVariableType :: Lens' UserDefinedVariableConfiguration (Maybe UserDefinedVariableConfigurationVariableType)
udvcVariableType
= lens _udvcVariableType
(\ s a -> s{_udvcVariableType = a})
instance FromJSON UserDefinedVariableConfiguration
where
parseJSON
= withObject "UserDefinedVariableConfiguration"
(\ o ->
UserDefinedVariableConfiguration' <$>
(o .:? "reportName") <*> (o .:? "dataType") <*>
(o .:? "variableType"))
instance ToJSON UserDefinedVariableConfiguration
where
toJSON UserDefinedVariableConfiguration'{..}
= object
(catMaybes
[("reportName" .=) <$> _udvcReportName,
("dataType" .=) <$> _udvcDataType,
("variableType" .=) <$> _udvcVariableType])
-- | The report criteria for a report of type \"CROSS_DIMENSION_REACH\".
--
-- /See:/ 'reportCrossDimensionReachCriteria' smart constructor.
data ReportCrossDimensionReachCriteria =
ReportCrossDimensionReachCriteria'
{ _rcdrcPivoted :: !(Maybe Bool)
, _rcdrcBreakdown :: !(Maybe [SortedDimension])
, _rcdrcDimension :: !(Maybe ReportCrossDimensionReachCriteriaDimension)
, _rcdrcMetricNames :: !(Maybe [Text])
, _rcdrcDimensionFilters :: !(Maybe [DimensionValue])
, _rcdrcDateRange :: !(Maybe DateRange)
, _rcdrcOverlapMetricNames :: !(Maybe [Text])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ReportCrossDimensionReachCriteria' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rcdrcPivoted'
--
-- * 'rcdrcBreakdown'
--
-- * 'rcdrcDimension'
--
-- * 'rcdrcMetricNames'
--
-- * 'rcdrcDimensionFilters'
--
-- * 'rcdrcDateRange'
--
-- * 'rcdrcOverlapMetricNames'
reportCrossDimensionReachCriteria
:: ReportCrossDimensionReachCriteria
reportCrossDimensionReachCriteria =
ReportCrossDimensionReachCriteria'
{ _rcdrcPivoted = Nothing
, _rcdrcBreakdown = Nothing
, _rcdrcDimension = Nothing
, _rcdrcMetricNames = Nothing
, _rcdrcDimensionFilters = Nothing
, _rcdrcDateRange = Nothing
, _rcdrcOverlapMetricNames = Nothing
}
-- | Whether the report is pivoted or not. Defaults to true.
rcdrcPivoted :: Lens' ReportCrossDimensionReachCriteria (Maybe Bool)
rcdrcPivoted
= lens _rcdrcPivoted (\ s a -> s{_rcdrcPivoted = a})
-- | The list of dimensions the report should include.
rcdrcBreakdown :: Lens' ReportCrossDimensionReachCriteria [SortedDimension]
rcdrcBreakdown
= lens _rcdrcBreakdown
(\ s a -> s{_rcdrcBreakdown = a})
. _Default
. _Coerce
-- | The dimension option.
rcdrcDimension :: Lens' ReportCrossDimensionReachCriteria (Maybe ReportCrossDimensionReachCriteriaDimension)
rcdrcDimension
= lens _rcdrcDimension
(\ s a -> s{_rcdrcDimension = a})
-- | The list of names of metrics the report should include.
rcdrcMetricNames :: Lens' ReportCrossDimensionReachCriteria [Text]
rcdrcMetricNames
= lens _rcdrcMetricNames
(\ s a -> s{_rcdrcMetricNames = a})
. _Default
. _Coerce
-- | The list of filters on which dimensions are filtered.
rcdrcDimensionFilters :: Lens' ReportCrossDimensionReachCriteria [DimensionValue]
rcdrcDimensionFilters
= lens _rcdrcDimensionFilters
(\ s a -> s{_rcdrcDimensionFilters = a})
. _Default
. _Coerce
-- | The date range this report should be run for.
rcdrcDateRange :: Lens' ReportCrossDimensionReachCriteria (Maybe DateRange)
rcdrcDateRange
= lens _rcdrcDateRange
(\ s a -> s{_rcdrcDateRange = a})
-- | The list of names of overlap metrics the report should include.
rcdrcOverlapMetricNames :: Lens' ReportCrossDimensionReachCriteria [Text]
rcdrcOverlapMetricNames
= lens _rcdrcOverlapMetricNames
(\ s a -> s{_rcdrcOverlapMetricNames = a})
. _Default
. _Coerce
instance FromJSON ReportCrossDimensionReachCriteria
where
parseJSON
= withObject "ReportCrossDimensionReachCriteria"
(\ o ->
ReportCrossDimensionReachCriteria' <$>
(o .:? "pivoted") <*> (o .:? "breakdown" .!= mempty)
<*> (o .:? "dimension")
<*> (o .:? "metricNames" .!= mempty)
<*> (o .:? "dimensionFilters" .!= mempty)
<*> (o .:? "dateRange")
<*> (o .:? "overlapMetricNames" .!= mempty))
instance ToJSON ReportCrossDimensionReachCriteria
where
toJSON ReportCrossDimensionReachCriteria'{..}
= object
(catMaybes
[("pivoted" .=) <$> _rcdrcPivoted,
("breakdown" .=) <$> _rcdrcBreakdown,
("dimension" .=) <$> _rcdrcDimension,
("metricNames" .=) <$> _rcdrcMetricNames,
("dimensionFilters" .=) <$> _rcdrcDimensionFilters,
("dateRange" .=) <$> _rcdrcDateRange,
("overlapMetricNames" .=) <$>
_rcdrcOverlapMetricNames])
-- | The URLs where the completed report file can be downloaded.
--
-- /See:/ 'fileURLs' smart constructor.
data FileURLs =
FileURLs'
{ _fuBrowserURL :: !(Maybe Text)
, _fuAPIURL :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FileURLs' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fuBrowserURL'
--
-- * 'fuAPIURL'
fileURLs
:: FileURLs
fileURLs = FileURLs' {_fuBrowserURL = Nothing, _fuAPIURL = Nothing}
-- | The URL for downloading the report data through a browser.
fuBrowserURL :: Lens' FileURLs (Maybe Text)
fuBrowserURL
= lens _fuBrowserURL (\ s a -> s{_fuBrowserURL = a})
-- | The URL for downloading the report data through the API.
fuAPIURL :: Lens' FileURLs (Maybe Text)
fuAPIURL = lens _fuAPIURL (\ s a -> s{_fuAPIURL = a})
instance FromJSON FileURLs where
parseJSON
= withObject "FileURLs"
(\ o ->
FileURLs' <$>
(o .:? "browserUrl") <*> (o .:? "apiUrl"))
instance ToJSON FileURLs where
toJSON FileURLs'{..}
= object
(catMaybes
[("browserUrl" .=) <$> _fuBrowserURL,
("apiUrl" .=) <$> _fuAPIURL])
-- | Campaign Creative Association List Response
--
-- /See:/ 'campaignCreativeAssociationsListResponse' smart constructor.
data CampaignCreativeAssociationsListResponse =
CampaignCreativeAssociationsListResponse'
{ _ccalrCampaignCreativeAssociations :: !(Maybe [CampaignCreativeAssociation])
, _ccalrNextPageToken :: !(Maybe Text)
, _ccalrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CampaignCreativeAssociationsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ccalrCampaignCreativeAssociations'
--
-- * 'ccalrNextPageToken'
--
-- * 'ccalrKind'
campaignCreativeAssociationsListResponse
:: CampaignCreativeAssociationsListResponse
campaignCreativeAssociationsListResponse =
CampaignCreativeAssociationsListResponse'
{ _ccalrCampaignCreativeAssociations = Nothing
, _ccalrNextPageToken = Nothing
, _ccalrKind = Nothing
}
-- | Campaign creative association collection
ccalrCampaignCreativeAssociations :: Lens' CampaignCreativeAssociationsListResponse [CampaignCreativeAssociation]
ccalrCampaignCreativeAssociations
= lens _ccalrCampaignCreativeAssociations
(\ s a -> s{_ccalrCampaignCreativeAssociations = a})
. _Default
. _Coerce
-- | Pagination token to be used for the next list operation.
ccalrNextPageToken :: Lens' CampaignCreativeAssociationsListResponse (Maybe Text)
ccalrNextPageToken
= lens _ccalrNextPageToken
(\ s a -> s{_ccalrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#campaignCreativeAssociationsListResponse\".
ccalrKind :: Lens' CampaignCreativeAssociationsListResponse (Maybe Text)
ccalrKind
= lens _ccalrKind (\ s a -> s{_ccalrKind = a})
instance FromJSON
CampaignCreativeAssociationsListResponse
where
parseJSON
= withObject
"CampaignCreativeAssociationsListResponse"
(\ o ->
CampaignCreativeAssociationsListResponse' <$>
(o .:? "campaignCreativeAssociations" .!= mempty) <*>
(o .:? "nextPageToken")
<*> (o .:? "kind"))
instance ToJSON
CampaignCreativeAssociationsListResponse
where
toJSON CampaignCreativeAssociationsListResponse'{..}
= object
(catMaybes
[("campaignCreativeAssociations" .=) <$>
_ccalrCampaignCreativeAssociations,
("nextPageToken" .=) <$> _ccalrNextPageToken,
("kind" .=) <$> _ccalrKind])
-- | Describes properties of a Planning order.
--
-- /See:/ 'order' smart constructor.
data Order =
Order'
{ _oSellerOrderId :: !(Maybe Text)
, _oSellerOrganizationName :: !(Maybe Text)
, _oKind :: !(Maybe Text)
, _oAdvertiserId :: !(Maybe (Textual Int64))
, _oPlanningTermId :: !(Maybe (Textual Int64))
, _oAccountId :: !(Maybe (Textual Int64))
, _oName :: !(Maybe Text)
, _oSiteNames :: !(Maybe [Text])
, _oLastModifiedInfo :: !(Maybe LastModifiedInfo)
, _oBuyerOrganizationName :: !(Maybe Text)
, _oId :: !(Maybe (Textual Int64))
, _oBuyerInvoiceId :: !(Maybe Text)
, _oComments :: !(Maybe Text)
, _oProjectId :: !(Maybe (Textual Int64))
, _oSubAccountId :: !(Maybe (Textual Int64))
, _oNotes :: !(Maybe Text)
, _oContacts :: !(Maybe [OrderContact])
, _oSiteId :: !(Maybe [Textual Int64])
, _oTermsAndConditions :: !(Maybe Text)
, _oApproverUserProFileIds :: !(Maybe [Textual Int64])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Order' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oSellerOrderId'
--
-- * 'oSellerOrganizationName'
--
-- * 'oKind'
--
-- * 'oAdvertiserId'
--
-- * 'oPlanningTermId'
--
-- * 'oAccountId'
--
-- * 'oName'
--
-- * 'oSiteNames'
--
-- * 'oLastModifiedInfo'
--
-- * 'oBuyerOrganizationName'
--
-- * 'oId'
--
-- * 'oBuyerInvoiceId'
--
-- * 'oComments'
--
-- * 'oProjectId'
--
-- * 'oSubAccountId'
--
-- * 'oNotes'
--
-- * 'oContacts'
--
-- * 'oSiteId'
--
-- * 'oTermsAndConditions'
--
-- * 'oApproverUserProFileIds'
order
:: Order
order =
Order'
{ _oSellerOrderId = Nothing
, _oSellerOrganizationName = Nothing
, _oKind = Nothing
, _oAdvertiserId = Nothing
, _oPlanningTermId = Nothing
, _oAccountId = Nothing
, _oName = Nothing
, _oSiteNames = Nothing
, _oLastModifiedInfo = Nothing
, _oBuyerOrganizationName = Nothing
, _oId = Nothing
, _oBuyerInvoiceId = Nothing
, _oComments = Nothing
, _oProjectId = Nothing
, _oSubAccountId = Nothing
, _oNotes = Nothing
, _oContacts = Nothing
, _oSiteId = Nothing
, _oTermsAndConditions = Nothing
, _oApproverUserProFileIds = Nothing
}
-- | Seller order ID associated with this order.
oSellerOrderId :: Lens' Order (Maybe Text)
oSellerOrderId
= lens _oSellerOrderId
(\ s a -> s{_oSellerOrderId = a})
-- | Name of the seller organization.
oSellerOrganizationName :: Lens' Order (Maybe Text)
oSellerOrganizationName
= lens _oSellerOrganizationName
(\ s a -> s{_oSellerOrganizationName = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#order\".
oKind :: Lens' Order (Maybe Text)
oKind = lens _oKind (\ s a -> s{_oKind = a})
-- | Advertiser ID of this order.
oAdvertiserId :: Lens' Order (Maybe Int64)
oAdvertiserId
= lens _oAdvertiserId
(\ s a -> s{_oAdvertiserId = a})
. mapping _Coerce
-- | ID of the terms and conditions template used in this order.
oPlanningTermId :: Lens' Order (Maybe Int64)
oPlanningTermId
= lens _oPlanningTermId
(\ s a -> s{_oPlanningTermId = a})
. mapping _Coerce
-- | Account ID of this order.
oAccountId :: Lens' Order (Maybe Int64)
oAccountId
= lens _oAccountId (\ s a -> s{_oAccountId = a}) .
mapping _Coerce
-- | Name of this order.
oName :: Lens' Order (Maybe Text)
oName = lens _oName (\ s a -> s{_oName = a})
-- | Free-form site names this order is associated with.
oSiteNames :: Lens' Order [Text]
oSiteNames
= lens _oSiteNames (\ s a -> s{_oSiteNames = a}) .
_Default
. _Coerce
-- | Information about the most recent modification of this order.
oLastModifiedInfo :: Lens' Order (Maybe LastModifiedInfo)
oLastModifiedInfo
= lens _oLastModifiedInfo
(\ s a -> s{_oLastModifiedInfo = a})
-- | Name of the buyer organization.
oBuyerOrganizationName :: Lens' Order (Maybe Text)
oBuyerOrganizationName
= lens _oBuyerOrganizationName
(\ s a -> s{_oBuyerOrganizationName = a})
-- | ID of this order. This is a read-only, auto-generated field.
oId :: Lens' Order (Maybe Int64)
oId
= lens _oId (\ s a -> s{_oId = a}) . mapping _Coerce
-- | Buyer invoice ID associated with this order.
oBuyerInvoiceId :: Lens' Order (Maybe Text)
oBuyerInvoiceId
= lens _oBuyerInvoiceId
(\ s a -> s{_oBuyerInvoiceId = a})
-- | Comments in this order.
oComments :: Lens' Order (Maybe Text)
oComments
= lens _oComments (\ s a -> s{_oComments = a})
-- | Project ID of this order.
oProjectId :: Lens' Order (Maybe Int64)
oProjectId
= lens _oProjectId (\ s a -> s{_oProjectId = a}) .
mapping _Coerce
-- | Subaccount ID of this order.
oSubAccountId :: Lens' Order (Maybe Int64)
oSubAccountId
= lens _oSubAccountId
(\ s a -> s{_oSubAccountId = a})
. mapping _Coerce
-- | Notes of this order.
oNotes :: Lens' Order (Maybe Text)
oNotes = lens _oNotes (\ s a -> s{_oNotes = a})
-- | Contacts for this order.
oContacts :: Lens' Order [OrderContact]
oContacts
= lens _oContacts (\ s a -> s{_oContacts = a}) .
_Default
. _Coerce
-- | Site IDs this order is associated with.
oSiteId :: Lens' Order [Int64]
oSiteId
= lens _oSiteId (\ s a -> s{_oSiteId = a}) . _Default
. _Coerce
-- | Terms and conditions of this order.
oTermsAndConditions :: Lens' Order (Maybe Text)
oTermsAndConditions
= lens _oTermsAndConditions
(\ s a -> s{_oTermsAndConditions = a})
-- | IDs for users that have to approve documents created for this order.
oApproverUserProFileIds :: Lens' Order [Int64]
oApproverUserProFileIds
= lens _oApproverUserProFileIds
(\ s a -> s{_oApproverUserProFileIds = a})
. _Default
. _Coerce
instance FromJSON Order where
parseJSON
= withObject "Order"
(\ o ->
Order' <$>
(o .:? "sellerOrderId") <*>
(o .:? "sellerOrganizationName")
<*> (o .:? "kind")
<*> (o .:? "advertiserId")
<*> (o .:? "planningTermId")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "siteNames" .!= mempty)
<*> (o .:? "lastModifiedInfo")
<*> (o .:? "buyerOrganizationName")
<*> (o .:? "id")
<*> (o .:? "buyerInvoiceId")
<*> (o .:? "comments")
<*> (o .:? "projectId")
<*> (o .:? "subaccountId")
<*> (o .:? "notes")
<*> (o .:? "contacts" .!= mempty)
<*> (o .:? "siteId" .!= mempty)
<*> (o .:? "termsAndConditions")
<*> (o .:? "approverUserProfileIds" .!= mempty))
instance ToJSON Order where
toJSON Order'{..}
= object
(catMaybes
[("sellerOrderId" .=) <$> _oSellerOrderId,
("sellerOrganizationName" .=) <$>
_oSellerOrganizationName,
("kind" .=) <$> _oKind,
("advertiserId" .=) <$> _oAdvertiserId,
("planningTermId" .=) <$> _oPlanningTermId,
("accountId" .=) <$> _oAccountId,
("name" .=) <$> _oName,
("siteNames" .=) <$> _oSiteNames,
("lastModifiedInfo" .=) <$> _oLastModifiedInfo,
("buyerOrganizationName" .=) <$>
_oBuyerOrganizationName,
("id" .=) <$> _oId,
("buyerInvoiceId" .=) <$> _oBuyerInvoiceId,
("comments" .=) <$> _oComments,
("projectId" .=) <$> _oProjectId,
("subaccountId" .=) <$> _oSubAccountId,
("notes" .=) <$> _oNotes,
("contacts" .=) <$> _oContacts,
("siteId" .=) <$> _oSiteId,
("termsAndConditions" .=) <$> _oTermsAndConditions,
("approverUserProfileIds" .=) <$>
_oApproverUserProFileIds])
-- | Creative Asset ID.
--
-- /See:/ 'creativeAssetId' smart constructor.
data CreativeAssetId =
CreativeAssetId'
{ _caiName :: !(Maybe Text)
, _caiType :: !(Maybe CreativeAssetIdType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeAssetId' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'caiName'
--
-- * 'caiType'
creativeAssetId
:: CreativeAssetId
creativeAssetId = CreativeAssetId' {_caiName = Nothing, _caiType = Nothing}
-- | Name of the creative asset. This is a required field while inserting an
-- asset. After insertion, this assetIdentifier is used to identify the
-- uploaded asset. Characters in the name must be alphanumeric or one of
-- the following: \".-_ \". Spaces are allowed.
caiName :: Lens' CreativeAssetId (Maybe Text)
caiName = lens _caiName (\ s a -> s{_caiName = a})
-- | Type of asset to upload. This is a required field. FLASH and IMAGE are
-- no longer supported for new uploads. All image assets should use
-- HTML_IMAGE.
caiType :: Lens' CreativeAssetId (Maybe CreativeAssetIdType)
caiType = lens _caiType (\ s a -> s{_caiType = a})
instance FromJSON CreativeAssetId where
parseJSON
= withObject "CreativeAssetId"
(\ o ->
CreativeAssetId' <$>
(o .:? "name") <*> (o .:? "type"))
instance ToJSON CreativeAssetId where
toJSON CreativeAssetId'{..}
= object
(catMaybes
[("name" .=) <$> _caiName, ("type" .=) <$> _caiType])
-- | Frequency Cap.
--
-- /See:/ 'frequencyCap' smart constructor.
data FrequencyCap =
FrequencyCap'
{ _fcImpressions :: !(Maybe (Textual Int64))
, _fcDuration :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FrequencyCap' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fcImpressions'
--
-- * 'fcDuration'
frequencyCap
:: FrequencyCap
frequencyCap = FrequencyCap' {_fcImpressions = Nothing, _fcDuration = Nothing}
-- | Number of times an individual user can be served the ad within the
-- specified duration. Acceptable values are 1 to 15, inclusive.
fcImpressions :: Lens' FrequencyCap (Maybe Int64)
fcImpressions
= lens _fcImpressions
(\ s a -> s{_fcImpressions = a})
. mapping _Coerce
-- | Duration of time, in seconds, for this frequency cap. The maximum
-- duration is 90 days. Acceptable values are 1 to 7776000, inclusive.
fcDuration :: Lens' FrequencyCap (Maybe Int64)
fcDuration
= lens _fcDuration (\ s a -> s{_fcDuration = a}) .
mapping _Coerce
instance FromJSON FrequencyCap where
parseJSON
= withObject "FrequencyCap"
(\ o ->
FrequencyCap' <$>
(o .:? "impressions") <*> (o .:? "duration"))
instance ToJSON FrequencyCap where
toJSON FrequencyCap'{..}
= object
(catMaybes
[("impressions" .=) <$> _fcImpressions,
("duration" .=) <$> _fcDuration])
-- | Represents a File resource. A file contains the metadata for a report
-- run. It shows the status of the run and holds the URLs to the generated
-- report data if the run is finished and the status is
-- \"REPORT_AVAILABLE\".
--
-- /See:/ 'file' smart constructor.
data File =
File'
{ _filStatus :: !(Maybe FileStatus)
, _filEtag :: !(Maybe Text)
, _filKind :: !(Maybe Text)
, _filURLs :: !(Maybe FileURLs)
, _filReportId :: !(Maybe (Textual Int64))
, _filDateRange :: !(Maybe DateRange)
, _filFormat :: !(Maybe FileFormat)
, _filLastModifiedTime :: !(Maybe (Textual Int64))
, _filId :: !(Maybe (Textual Int64))
, _filFileName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'File' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'filStatus'
--
-- * 'filEtag'
--
-- * 'filKind'
--
-- * 'filURLs'
--
-- * 'filReportId'
--
-- * 'filDateRange'
--
-- * 'filFormat'
--
-- * 'filLastModifiedTime'
--
-- * 'filId'
--
-- * 'filFileName'
file
:: File
file =
File'
{ _filStatus = Nothing
, _filEtag = Nothing
, _filKind = Nothing
, _filURLs = Nothing
, _filReportId = Nothing
, _filDateRange = Nothing
, _filFormat = Nothing
, _filLastModifiedTime = Nothing
, _filId = Nothing
, _filFileName = Nothing
}
-- | The status of the report file.
filStatus :: Lens' File (Maybe FileStatus)
filStatus
= lens _filStatus (\ s a -> s{_filStatus = a})
-- | Etag of this resource.
filEtag :: Lens' File (Maybe Text)
filEtag = lens _filEtag (\ s a -> s{_filEtag = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#file\".
filKind :: Lens' File (Maybe Text)
filKind = lens _filKind (\ s a -> s{_filKind = a})
-- | The URLs where the completed report file can be downloaded.
filURLs :: Lens' File (Maybe FileURLs)
filURLs = lens _filURLs (\ s a -> s{_filURLs = a})
-- | The ID of the report this file was generated from.
filReportId :: Lens' File (Maybe Int64)
filReportId
= lens _filReportId (\ s a -> s{_filReportId = a}) .
mapping _Coerce
-- | The date range for which the file has report data. The date range will
-- always be the absolute date range for which the report is run.
filDateRange :: Lens' File (Maybe DateRange)
filDateRange
= lens _filDateRange (\ s a -> s{_filDateRange = a})
-- | The output format of the report. Only available once the file is
-- available.
filFormat :: Lens' File (Maybe FileFormat)
filFormat
= lens _filFormat (\ s a -> s{_filFormat = a})
-- | The timestamp in milliseconds since epoch when this file was last
-- modified.
filLastModifiedTime :: Lens' File (Maybe Int64)
filLastModifiedTime
= lens _filLastModifiedTime
(\ s a -> s{_filLastModifiedTime = a})
. mapping _Coerce
-- | The unique ID of this report file.
filId :: Lens' File (Maybe Int64)
filId
= lens _filId (\ s a -> s{_filId = a}) .
mapping _Coerce
-- | The filename of the file.
filFileName :: Lens' File (Maybe Text)
filFileName
= lens _filFileName (\ s a -> s{_filFileName = a})
instance FromJSON File where
parseJSON
= withObject "File"
(\ o ->
File' <$>
(o .:? "status") <*> (o .:? "etag") <*>
(o .:? "kind")
<*> (o .:? "urls")
<*> (o .:? "reportId")
<*> (o .:? "dateRange")
<*> (o .:? "format")
<*> (o .:? "lastModifiedTime")
<*> (o .:? "id")
<*> (o .:? "fileName"))
instance ToJSON File where
toJSON File'{..}
= object
(catMaybes
[("status" .=) <$> _filStatus,
("etag" .=) <$> _filEtag, ("kind" .=) <$> _filKind,
("urls" .=) <$> _filURLs,
("reportId" .=) <$> _filReportId,
("dateRange" .=) <$> _filDateRange,
("format" .=) <$> _filFormat,
("lastModifiedTime" .=) <$> _filLastModifiedTime,
("id" .=) <$> _filId,
("fileName" .=) <$> _filFileName])
-- | Creative Group List Response
--
-- /See:/ 'creativeGroupsListResponse' smart constructor.
data CreativeGroupsListResponse =
CreativeGroupsListResponse'
{ _cglrCreativeGroups :: !(Maybe [CreativeGroup])
, _cglrNextPageToken :: !(Maybe Text)
, _cglrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeGroupsListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cglrCreativeGroups'
--
-- * 'cglrNextPageToken'
--
-- * 'cglrKind'
creativeGroupsListResponse
:: CreativeGroupsListResponse
creativeGroupsListResponse =
CreativeGroupsListResponse'
{ _cglrCreativeGroups = Nothing
, _cglrNextPageToken = Nothing
, _cglrKind = Nothing
}
-- | Creative group collection.
cglrCreativeGroups :: Lens' CreativeGroupsListResponse [CreativeGroup]
cglrCreativeGroups
= lens _cglrCreativeGroups
(\ s a -> s{_cglrCreativeGroups = a})
. _Default
. _Coerce
-- | Pagination token to be used for the next list operation.
cglrNextPageToken :: Lens' CreativeGroupsListResponse (Maybe Text)
cglrNextPageToken
= lens _cglrNextPageToken
(\ s a -> s{_cglrNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#creativeGroupsListResponse\".
cglrKind :: Lens' CreativeGroupsListResponse (Maybe Text)
cglrKind = lens _cglrKind (\ s a -> s{_cglrKind = a})
instance FromJSON CreativeGroupsListResponse where
parseJSON
= withObject "CreativeGroupsListResponse"
(\ o ->
CreativeGroupsListResponse' <$>
(o .:? "creativeGroups" .!= mempty) <*>
(o .:? "nextPageToken")
<*> (o .:? "kind"))
instance ToJSON CreativeGroupsListResponse where
toJSON CreativeGroupsListResponse'{..}
= object
(catMaybes
[("creativeGroups" .=) <$> _cglrCreativeGroups,
("nextPageToken" .=) <$> _cglrNextPageToken,
("kind" .=) <$> _cglrKind])
-- | Mobile Carrier List Response
--
-- /See:/ 'mobileCarriersListResponse' smart constructor.
data MobileCarriersListResponse =
MobileCarriersListResponse'
{ _mclrMobileCarriers :: !(Maybe [MobileCarrier])
, _mclrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'MobileCarriersListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mclrMobileCarriers'
--
-- * 'mclrKind'
mobileCarriersListResponse
:: MobileCarriersListResponse
mobileCarriersListResponse =
MobileCarriersListResponse'
{_mclrMobileCarriers = Nothing, _mclrKind = Nothing}
-- | Mobile carrier collection.
mclrMobileCarriers :: Lens' MobileCarriersListResponse [MobileCarrier]
mclrMobileCarriers
= lens _mclrMobileCarriers
(\ s a -> s{_mclrMobileCarriers = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#mobileCarriersListResponse\".
mclrKind :: Lens' MobileCarriersListResponse (Maybe Text)
mclrKind = lens _mclrKind (\ s a -> s{_mclrKind = a})
instance FromJSON MobileCarriersListResponse where
parseJSON
= withObject "MobileCarriersListResponse"
(\ o ->
MobileCarriersListResponse' <$>
(o .:? "mobileCarriers" .!= mempty) <*>
(o .:? "kind"))
instance ToJSON MobileCarriersListResponse where
toJSON MobileCarriersListResponse'{..}
= object
(catMaybes
[("mobileCarriers" .=) <$> _mclrMobileCarriers,
("kind" .=) <$> _mclrKind])
-- | CreativeAssets contains properties of a creative asset file which will
-- be uploaded or has already been uploaded. Refer to the creative sample
-- code for how to upload assets and insert a creative.
--
-- /See:/ 'creativeAssetMetadata' smart constructor.
data CreativeAssetMetadata =
CreativeAssetMetadata'
{ _camaRichMedia :: !(Maybe Bool)
, _camaCounterCustomEvents :: !(Maybe [CreativeCustomEvent])
, _camaKind :: !(Maybe Text)
, _camaAssetIdentifier :: !(Maybe CreativeAssetId)
, _camaIdDimensionValue :: !(Maybe DimensionValue)
, _camaExitCustomEvents :: !(Maybe [CreativeCustomEvent])
, _camaClickTags :: !(Maybe [ClickTag])
, _camaWarnedValidationRules :: !(Maybe [CreativeAssetMetadataWarnedValidationRulesItem])
, _camaId :: !(Maybe (Textual Int64))
, _camaTimerCustomEvents :: !(Maybe [CreativeCustomEvent])
, _camaDetectedFeatures :: !(Maybe [CreativeAssetMetadataDetectedFeaturesItem])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeAssetMetadata' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'camaRichMedia'
--
-- * 'camaCounterCustomEvents'
--
-- * 'camaKind'
--
-- * 'camaAssetIdentifier'
--
-- * 'camaIdDimensionValue'
--
-- * 'camaExitCustomEvents'
--
-- * 'camaClickTags'
--
-- * 'camaWarnedValidationRules'
--
-- * 'camaId'
--
-- * 'camaTimerCustomEvents'
--
-- * 'camaDetectedFeatures'
creativeAssetMetadata
:: CreativeAssetMetadata
creativeAssetMetadata =
CreativeAssetMetadata'
{ _camaRichMedia = Nothing
, _camaCounterCustomEvents = Nothing
, _camaKind = Nothing
, _camaAssetIdentifier = Nothing
, _camaIdDimensionValue = Nothing
, _camaExitCustomEvents = Nothing
, _camaClickTags = Nothing
, _camaWarnedValidationRules = Nothing
, _camaId = Nothing
, _camaTimerCustomEvents = Nothing
, _camaDetectedFeatures = Nothing
}
-- | True if the uploaded asset is a rich media asset. This is a read-only,
-- auto-generated field.
camaRichMedia :: Lens' CreativeAssetMetadata (Maybe Bool)
camaRichMedia
= lens _camaRichMedia
(\ s a -> s{_camaRichMedia = a})
-- | List of counter events configured for the asset. This is a read-only,
-- auto-generated field and only applicable to a rich media asset.
camaCounterCustomEvents :: Lens' CreativeAssetMetadata [CreativeCustomEvent]
camaCounterCustomEvents
= lens _camaCounterCustomEvents
(\ s a -> s{_camaCounterCustomEvents = a})
. _Default
. _Coerce
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#creativeAssetMetadata\".
camaKind :: Lens' CreativeAssetMetadata (Maybe Text)
camaKind = lens _camaKind (\ s a -> s{_camaKind = a})
-- | ID of the creative asset. This is a required field.
camaAssetIdentifier :: Lens' CreativeAssetMetadata (Maybe CreativeAssetId)
camaAssetIdentifier
= lens _camaAssetIdentifier
(\ s a -> s{_camaAssetIdentifier = a})
-- | Dimension value for the numeric ID of the asset. This is a read-only,
-- auto-generated field.
camaIdDimensionValue :: Lens' CreativeAssetMetadata (Maybe DimensionValue)
camaIdDimensionValue
= lens _camaIdDimensionValue
(\ s a -> s{_camaIdDimensionValue = a})
-- | List of exit events configured for the asset. This is a read-only,
-- auto-generated field and only applicable to a rich media asset.
camaExitCustomEvents :: Lens' CreativeAssetMetadata [CreativeCustomEvent]
camaExitCustomEvents
= lens _camaExitCustomEvents
(\ s a -> s{_camaExitCustomEvents = a})
. _Default
. _Coerce
-- | List of detected click tags for assets. This is a read-only,
-- auto-generated field. This field is empty for a rich media asset.
camaClickTags :: Lens' CreativeAssetMetadata [ClickTag]
camaClickTags
= lens _camaClickTags
(\ s a -> s{_camaClickTags = a})
. _Default
. _Coerce
-- | Rules validated during code generation that generated a warning. This is
-- a read-only, auto-generated field. Possible values are: -
-- \"ADMOB_REFERENCED\" - \"ASSET_FORMAT_UNSUPPORTED_DCM\" -
-- \"ASSET_INVALID\" - \"CLICK_TAG_HARD_CODED\" - \"CLICK_TAG_INVALID\" -
-- \"CLICK_TAG_IN_GWD\" - \"CLICK_TAG_MISSING\" -
-- \"CLICK_TAG_MORE_THAN_ONE\" - \"CLICK_TAG_NON_TOP_LEVEL\" -
-- \"COMPONENT_UNSUPPORTED_DCM\" - \"ENABLER_UNSUPPORTED_METHOD_DCM\" -
-- \"EXTERNAL_FILE_REFERENCED\" - \"FILE_DETAIL_EMPTY\" -
-- \"FILE_TYPE_INVALID\" - \"GWD_PROPERTIES_INVALID\" -
-- \"HTML5_FEATURE_UNSUPPORTED\" - \"LINKED_FILE_NOT_FOUND\" -
-- \"MAX_FLASH_VERSION_11\" - \"MRAID_REFERENCED\" - \"NOT_SSL_COMPLIANT\"
-- - \"ORPHANED_ASSET\" - \"PRIMARY_HTML_MISSING\" - \"SVG_INVALID\" -
-- \"ZIP_INVALID\"
camaWarnedValidationRules :: Lens' CreativeAssetMetadata [CreativeAssetMetadataWarnedValidationRulesItem]
camaWarnedValidationRules
= lens _camaWarnedValidationRules
(\ s a -> s{_camaWarnedValidationRules = a})
. _Default
. _Coerce
-- | Numeric ID of the asset. This is a read-only, auto-generated field.
camaId :: Lens' CreativeAssetMetadata (Maybe Int64)
camaId
= lens _camaId (\ s a -> s{_camaId = a}) .
mapping _Coerce
-- | List of timer events configured for the asset. This is a read-only,
-- auto-generated field and only applicable to a rich media asset.
camaTimerCustomEvents :: Lens' CreativeAssetMetadata [CreativeCustomEvent]
camaTimerCustomEvents
= lens _camaTimerCustomEvents
(\ s a -> s{_camaTimerCustomEvents = a})
. _Default
. _Coerce
-- | List of feature dependencies for the creative asset that are detected by
-- Campaign Manager. Feature dependencies are features that a browser must
-- be able to support in order to render your HTML5 creative correctly.
-- This is a read-only, auto-generated field.
camaDetectedFeatures :: Lens' CreativeAssetMetadata [CreativeAssetMetadataDetectedFeaturesItem]
camaDetectedFeatures
= lens _camaDetectedFeatures
(\ s a -> s{_camaDetectedFeatures = a})
. _Default
. _Coerce
instance FromJSON CreativeAssetMetadata where
parseJSON
= withObject "CreativeAssetMetadata"
(\ o ->
CreativeAssetMetadata' <$>
(o .:? "richMedia") <*>
(o .:? "counterCustomEvents" .!= mempty)
<*> (o .:? "kind")
<*> (o .:? "assetIdentifier")
<*> (o .:? "idDimensionValue")
<*> (o .:? "exitCustomEvents" .!= mempty)
<*> (o .:? "clickTags" .!= mempty)
<*> (o .:? "warnedValidationRules" .!= mempty)
<*> (o .:? "id")
<*> (o .:? "timerCustomEvents" .!= mempty)
<*> (o .:? "detectedFeatures" .!= mempty))
instance ToJSON CreativeAssetMetadata where
toJSON CreativeAssetMetadata'{..}
= object
(catMaybes
[("richMedia" .=) <$> _camaRichMedia,
("counterCustomEvents" .=) <$>
_camaCounterCustomEvents,
("kind" .=) <$> _camaKind,
("assetIdentifier" .=) <$> _camaAssetIdentifier,
("idDimensionValue" .=) <$> _camaIdDimensionValue,
("exitCustomEvents" .=) <$> _camaExitCustomEvents,
("clickTags" .=) <$> _camaClickTags,
("warnedValidationRules" .=) <$>
_camaWarnedValidationRules,
("id" .=) <$> _camaId,
("timerCustomEvents" .=) <$> _camaTimerCustomEvents,
("detectedFeatures" .=) <$> _camaDetectedFeatures])
-- | Omniture Integration Settings.
--
-- /See:/ 'omnitureSettings' smart constructor.
data OmnitureSettings =
OmnitureSettings'
{ _osOmnitureCostDataEnabled :: !(Maybe Bool)
, _osOmnitureIntegrationEnabled :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OmnitureSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'osOmnitureCostDataEnabled'
--
-- * 'osOmnitureIntegrationEnabled'
omnitureSettings
:: OmnitureSettings
omnitureSettings =
OmnitureSettings'
{ _osOmnitureCostDataEnabled = Nothing
, _osOmnitureIntegrationEnabled = Nothing
}
-- | Whether placement cost data will be sent to Omniture. This property can
-- be enabled only if omnitureIntegrationEnabled is true.
osOmnitureCostDataEnabled :: Lens' OmnitureSettings (Maybe Bool)
osOmnitureCostDataEnabled
= lens _osOmnitureCostDataEnabled
(\ s a -> s{_osOmnitureCostDataEnabled = a})
-- | Whether Omniture integration is enabled. This property can be enabled
-- only when the \"Advanced Ad Serving\" account setting is enabled.
osOmnitureIntegrationEnabled :: Lens' OmnitureSettings (Maybe Bool)
osOmnitureIntegrationEnabled
= lens _osOmnitureIntegrationEnabled
(\ s a -> s{_osOmnitureIntegrationEnabled = a})
instance FromJSON OmnitureSettings where
parseJSON
= withObject "OmnitureSettings"
(\ o ->
OmnitureSettings' <$>
(o .:? "omnitureCostDataEnabled") <*>
(o .:? "omnitureIntegrationEnabled"))
instance ToJSON OmnitureSettings where
toJSON OmnitureSettings'{..}
= object
(catMaybes
[("omnitureCostDataEnabled" .=) <$>
_osOmnitureCostDataEnabled,
("omnitureIntegrationEnabled" .=) <$>
_osOmnitureIntegrationEnabled])
-- | Contains information about an internet connection type that can be
-- targeted by ads. Clients can use the connection type to target mobile
-- vs. broadband users.
--
-- /See:/ 'connectionType' smart constructor.
data ConnectionType =
ConnectionType'
{ _cttKind :: !(Maybe Text)
, _cttName :: !(Maybe Text)
, _cttId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ConnectionType' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cttKind'
--
-- * 'cttName'
--
-- * 'cttId'
connectionType
:: ConnectionType
connectionType =
ConnectionType' {_cttKind = Nothing, _cttName = Nothing, _cttId = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#connectionType\".
cttKind :: Lens' ConnectionType (Maybe Text)
cttKind = lens _cttKind (\ s a -> s{_cttKind = a})
-- | Name of this connection type.
cttName :: Lens' ConnectionType (Maybe Text)
cttName = lens _cttName (\ s a -> s{_cttName = a})
-- | ID of this connection type.
cttId :: Lens' ConnectionType (Maybe Int64)
cttId
= lens _cttId (\ s a -> s{_cttId = a}) .
mapping _Coerce
instance FromJSON ConnectionType where
parseJSON
= withObject "ConnectionType"
(\ o ->
ConnectionType' <$>
(o .:? "kind") <*> (o .:? "name") <*> (o .:? "id"))
instance ToJSON ConnectionType where
toJSON ConnectionType'{..}
= object
(catMaybes
[("kind" .=) <$> _cttKind, ("name" .=) <$> _cttName,
("id" .=) <$> _cttId])
-- | Contains properties of a package or roadblock.
--
-- /See:/ 'placementGroup' smart constructor.
data PlacementGroup =
PlacementGroup'
{ _plalPlacementStrategyId :: !(Maybe (Textual Int64))
, _plalSiteIdDimensionValue :: !(Maybe DimensionValue)
, _plalPricingSchedule :: !(Maybe PricingSchedule)
, _plalKind :: !(Maybe Text)
, _plalCampaignIdDimensionValue :: !(Maybe DimensionValue)
, _plalAdvertiserId :: !(Maybe (Textual Int64))
, _plalAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _plalCampaignId :: !(Maybe (Textual Int64))
, _plalIdDimensionValue :: !(Maybe DimensionValue)
, _plalPlacementGroupType :: !(Maybe PlacementGroupPlacementGroupType)
, _plalContentCategoryId :: !(Maybe (Textual Int64))
, _plalDirectorySiteIdDimensionValue :: !(Maybe DimensionValue)
, _plalAccountId :: !(Maybe (Textual Int64))
, _plalName :: !(Maybe Text)
, _plalDirectorySiteId :: !(Maybe (Textual Int64))
, _plalCreateInfo :: !(Maybe LastModifiedInfo)
, _plalChildPlacementIds :: !(Maybe [Textual Int64])
, _plalLastModifiedInfo :: !(Maybe LastModifiedInfo)
, _plalId :: !(Maybe (Textual Int64))
, _plalPrimaryPlacementId :: !(Maybe (Textual Int64))
, _plalSubAccountId :: !(Maybe (Textual Int64))
, _plalExternalId :: !(Maybe Text)
, _plalComment :: !(Maybe Text)
, _plalPrimaryPlacementIdDimensionValue :: !(Maybe DimensionValue)
, _plalSiteId :: !(Maybe (Textual Int64))
, _plalArchived :: !(Maybe Bool)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'PlacementGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plalPlacementStrategyId'
--
-- * 'plalSiteIdDimensionValue'
--
-- * 'plalPricingSchedule'
--
-- * 'plalKind'
--
-- * 'plalCampaignIdDimensionValue'
--
-- * 'plalAdvertiserId'
--
-- * 'plalAdvertiserIdDimensionValue'
--
-- * 'plalCampaignId'
--
-- * 'plalIdDimensionValue'
--
-- * 'plalPlacementGroupType'
--
-- * 'plalContentCategoryId'
--
-- * 'plalDirectorySiteIdDimensionValue'
--
-- * 'plalAccountId'
--
-- * 'plalName'
--
-- * 'plalDirectorySiteId'
--
-- * 'plalCreateInfo'
--
-- * 'plalChildPlacementIds'
--
-- * 'plalLastModifiedInfo'
--
-- * 'plalId'
--
-- * 'plalPrimaryPlacementId'
--
-- * 'plalSubAccountId'
--
-- * 'plalExternalId'
--
-- * 'plalComment'
--
-- * 'plalPrimaryPlacementIdDimensionValue'
--
-- * 'plalSiteId'
--
-- * 'plalArchived'
placementGroup
:: PlacementGroup
placementGroup =
PlacementGroup'
{ _plalPlacementStrategyId = Nothing
, _plalSiteIdDimensionValue = Nothing
, _plalPricingSchedule = Nothing
, _plalKind = Nothing
, _plalCampaignIdDimensionValue = Nothing
, _plalAdvertiserId = Nothing
, _plalAdvertiserIdDimensionValue = Nothing
, _plalCampaignId = Nothing
, _plalIdDimensionValue = Nothing
, _plalPlacementGroupType = Nothing
, _plalContentCategoryId = Nothing
, _plalDirectorySiteIdDimensionValue = Nothing
, _plalAccountId = Nothing
, _plalName = Nothing
, _plalDirectorySiteId = Nothing
, _plalCreateInfo = Nothing
, _plalChildPlacementIds = Nothing
, _plalLastModifiedInfo = Nothing
, _plalId = Nothing
, _plalPrimaryPlacementId = Nothing
, _plalSubAccountId = Nothing
, _plalExternalId = Nothing
, _plalComment = Nothing
, _plalPrimaryPlacementIdDimensionValue = Nothing
, _plalSiteId = Nothing
, _plalArchived = Nothing
}
-- | ID of the placement strategy assigned to this placement group.
plalPlacementStrategyId :: Lens' PlacementGroup (Maybe Int64)
plalPlacementStrategyId
= lens _plalPlacementStrategyId
(\ s a -> s{_plalPlacementStrategyId = a})
. mapping _Coerce
-- | Dimension value for the ID of the site. This is a read-only,
-- auto-generated field.
plalSiteIdDimensionValue :: Lens' PlacementGroup (Maybe DimensionValue)
plalSiteIdDimensionValue
= lens _plalSiteIdDimensionValue
(\ s a -> s{_plalSiteIdDimensionValue = a})
-- | Pricing schedule of this placement group. This field is required on
-- insertion.
plalPricingSchedule :: Lens' PlacementGroup (Maybe PricingSchedule)
plalPricingSchedule
= lens _plalPricingSchedule
(\ s a -> s{_plalPricingSchedule = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#placementGroup\".
plalKind :: Lens' PlacementGroup (Maybe Text)
plalKind = lens _plalKind (\ s a -> s{_plalKind = a})
-- | Dimension value for the ID of the campaign. This is a read-only,
-- auto-generated field.
plalCampaignIdDimensionValue :: Lens' PlacementGroup (Maybe DimensionValue)
plalCampaignIdDimensionValue
= lens _plalCampaignIdDimensionValue
(\ s a -> s{_plalCampaignIdDimensionValue = a})
-- | Advertiser ID of this placement group. This is a required field on
-- insertion.
plalAdvertiserId :: Lens' PlacementGroup (Maybe Int64)
plalAdvertiserId
= lens _plalAdvertiserId
(\ s a -> s{_plalAdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
plalAdvertiserIdDimensionValue :: Lens' PlacementGroup (Maybe DimensionValue)
plalAdvertiserIdDimensionValue
= lens _plalAdvertiserIdDimensionValue
(\ s a -> s{_plalAdvertiserIdDimensionValue = a})
-- | Campaign ID of this placement group. This field is required on
-- insertion.
plalCampaignId :: Lens' PlacementGroup (Maybe Int64)
plalCampaignId
= lens _plalCampaignId
(\ s a -> s{_plalCampaignId = a})
. mapping _Coerce
-- | Dimension value for the ID of this placement group. This is a read-only,
-- auto-generated field.
plalIdDimensionValue :: Lens' PlacementGroup (Maybe DimensionValue)
plalIdDimensionValue
= lens _plalIdDimensionValue
(\ s a -> s{_plalIdDimensionValue = a})
-- | Type of this placement group. A package is a simple group of placements
-- that acts as a single pricing point for a group of tags. A roadblock is
-- a group of placements that not only acts as a single pricing point, but
-- also assumes that all the tags in it will be served at the same time. A
-- roadblock requires one of its assigned placements to be marked as
-- primary for reporting. This field is required on insertion.
plalPlacementGroupType :: Lens' PlacementGroup (Maybe PlacementGroupPlacementGroupType)
plalPlacementGroupType
= lens _plalPlacementGroupType
(\ s a -> s{_plalPlacementGroupType = a})
-- | ID of the content category assigned to this placement group.
plalContentCategoryId :: Lens' PlacementGroup (Maybe Int64)
plalContentCategoryId
= lens _plalContentCategoryId
(\ s a -> s{_plalContentCategoryId = a})
. mapping _Coerce
-- | Dimension value for the ID of the directory site. This is a read-only,
-- auto-generated field.
plalDirectorySiteIdDimensionValue :: Lens' PlacementGroup (Maybe DimensionValue)
plalDirectorySiteIdDimensionValue
= lens _plalDirectorySiteIdDimensionValue
(\ s a -> s{_plalDirectorySiteIdDimensionValue = a})
-- | Account ID of this placement group. This is a read-only field that can
-- be left blank.
plalAccountId :: Lens' PlacementGroup (Maybe Int64)
plalAccountId
= lens _plalAccountId
(\ s a -> s{_plalAccountId = a})
. mapping _Coerce
-- | Name of this placement group. This is a required field and must be less
-- than 256 characters long.
plalName :: Lens' PlacementGroup (Maybe Text)
plalName = lens _plalName (\ s a -> s{_plalName = a})
-- | Directory site ID associated with this placement group. On insert, you
-- must set either this field or the site_id field to specify the site
-- associated with this placement group. This is a required field that is
-- read-only after insertion.
plalDirectorySiteId :: Lens' PlacementGroup (Maybe Int64)
plalDirectorySiteId
= lens _plalDirectorySiteId
(\ s a -> s{_plalDirectorySiteId = a})
. mapping _Coerce
-- | Information about the creation of this placement group. This is a
-- read-only field.
plalCreateInfo :: Lens' PlacementGroup (Maybe LastModifiedInfo)
plalCreateInfo
= lens _plalCreateInfo
(\ s a -> s{_plalCreateInfo = a})
-- | IDs of placements which are assigned to this placement group. This is a
-- read-only, auto-generated field.
plalChildPlacementIds :: Lens' PlacementGroup [Int64]
plalChildPlacementIds
= lens _plalChildPlacementIds
(\ s a -> s{_plalChildPlacementIds = a})
. _Default
. _Coerce
-- | Information about the most recent modification of this placement group.
-- This is a read-only field.
plalLastModifiedInfo :: Lens' PlacementGroup (Maybe LastModifiedInfo)
plalLastModifiedInfo
= lens _plalLastModifiedInfo
(\ s a -> s{_plalLastModifiedInfo = a})
-- | ID of this placement group. This is a read-only, auto-generated field.
plalId :: Lens' PlacementGroup (Maybe Int64)
plalId
= lens _plalId (\ s a -> s{_plalId = a}) .
mapping _Coerce
-- | ID of the primary placement, used to calculate the media cost of a
-- roadblock (placement group). Modifying this field will automatically
-- modify the primary field on all affected roadblock child placements.
plalPrimaryPlacementId :: Lens' PlacementGroup (Maybe Int64)
plalPrimaryPlacementId
= lens _plalPrimaryPlacementId
(\ s a -> s{_plalPrimaryPlacementId = a})
. mapping _Coerce
-- | Subaccount ID of this placement group. This is a read-only field that
-- can be left blank.
plalSubAccountId :: Lens' PlacementGroup (Maybe Int64)
plalSubAccountId
= lens _plalSubAccountId
(\ s a -> s{_plalSubAccountId = a})
. mapping _Coerce
-- | External ID for this placement.
plalExternalId :: Lens' PlacementGroup (Maybe Text)
plalExternalId
= lens _plalExternalId
(\ s a -> s{_plalExternalId = a})
-- | Comments for this placement group.
plalComment :: Lens' PlacementGroup (Maybe Text)
plalComment
= lens _plalComment (\ s a -> s{_plalComment = a})
-- | Dimension value for the ID of the primary placement. This is a
-- read-only, auto-generated field.
plalPrimaryPlacementIdDimensionValue :: Lens' PlacementGroup (Maybe DimensionValue)
plalPrimaryPlacementIdDimensionValue
= lens _plalPrimaryPlacementIdDimensionValue
(\ s a ->
s{_plalPrimaryPlacementIdDimensionValue = a})
-- | Site ID associated with this placement group. On insert, you must set
-- either this field or the directorySiteId field to specify the site
-- associated with this placement group. This is a required field that is
-- read-only after insertion.
plalSiteId :: Lens' PlacementGroup (Maybe Int64)
plalSiteId
= lens _plalSiteId (\ s a -> s{_plalSiteId = a}) .
mapping _Coerce
-- | Whether this placement group is archived.
plalArchived :: Lens' PlacementGroup (Maybe Bool)
plalArchived
= lens _plalArchived (\ s a -> s{_plalArchived = a})
instance FromJSON PlacementGroup where
parseJSON
= withObject "PlacementGroup"
(\ o ->
PlacementGroup' <$>
(o .:? "placementStrategyId") <*>
(o .:? "siteIdDimensionValue")
<*> (o .:? "pricingSchedule")
<*> (o .:? "kind")
<*> (o .:? "campaignIdDimensionValue")
<*> (o .:? "advertiserId")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "campaignId")
<*> (o .:? "idDimensionValue")
<*> (o .:? "placementGroupType")
<*> (o .:? "contentCategoryId")
<*> (o .:? "directorySiteIdDimensionValue")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "directorySiteId")
<*> (o .:? "createInfo")
<*> (o .:? "childPlacementIds" .!= mempty)
<*> (o .:? "lastModifiedInfo")
<*> (o .:? "id")
<*> (o .:? "primaryPlacementId")
<*> (o .:? "subaccountId")
<*> (o .:? "externalId")
<*> (o .:? "comment")
<*> (o .:? "primaryPlacementIdDimensionValue")
<*> (o .:? "siteId")
<*> (o .:? "archived"))
instance ToJSON PlacementGroup where
toJSON PlacementGroup'{..}
= object
(catMaybes
[("placementStrategyId" .=) <$>
_plalPlacementStrategyId,
("siteIdDimensionValue" .=) <$>
_plalSiteIdDimensionValue,
("pricingSchedule" .=) <$> _plalPricingSchedule,
("kind" .=) <$> _plalKind,
("campaignIdDimensionValue" .=) <$>
_plalCampaignIdDimensionValue,
("advertiserId" .=) <$> _plalAdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_plalAdvertiserIdDimensionValue,
("campaignId" .=) <$> _plalCampaignId,
("idDimensionValue" .=) <$> _plalIdDimensionValue,
("placementGroupType" .=) <$>
_plalPlacementGroupType,
("contentCategoryId" .=) <$> _plalContentCategoryId,
("directorySiteIdDimensionValue" .=) <$>
_plalDirectorySiteIdDimensionValue,
("accountId" .=) <$> _plalAccountId,
("name" .=) <$> _plalName,
("directorySiteId" .=) <$> _plalDirectorySiteId,
("createInfo" .=) <$> _plalCreateInfo,
("childPlacementIds" .=) <$> _plalChildPlacementIds,
("lastModifiedInfo" .=) <$> _plalLastModifiedInfo,
("id" .=) <$> _plalId,
("primaryPlacementId" .=) <$>
_plalPrimaryPlacementId,
("subaccountId" .=) <$> _plalSubAccountId,
("externalId" .=) <$> _plalExternalId,
("comment" .=) <$> _plalComment,
("primaryPlacementIdDimensionValue" .=) <$>
_plalPrimaryPlacementIdDimensionValue,
("siteId" .=) <$> _plalSiteId,
("archived" .=) <$> _plalArchived])
-- | Contains properties of an event tag.
--
-- /See:/ 'eventTag' smart constructor.
data EventTag =
EventTag'
{ _etStatus :: !(Maybe EventTagStatus)
, _etExcludeFromAdxRequests :: !(Maybe Bool)
, _etEnabledByDefault :: !(Maybe Bool)
, _etKind :: !(Maybe Text)
, _etCampaignIdDimensionValue :: !(Maybe DimensionValue)
, _etAdvertiserId :: !(Maybe (Textual Int64))
, _etURL :: !(Maybe Text)
, _etAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _etSSLCompliant :: !(Maybe Bool)
, _etCampaignId :: !(Maybe (Textual Int64))
, _etAccountId :: !(Maybe (Textual Int64))
, _etName :: !(Maybe Text)
, _etURLEscapeLevels :: !(Maybe (Textual Int32))
, _etSiteIds :: !(Maybe [Textual Int64])
, _etId :: !(Maybe (Textual Int64))
, _etSubAccountId :: !(Maybe (Textual Int64))
, _etType :: !(Maybe EventTagType)
, _etSiteFilterType :: !(Maybe EventTagSiteFilterType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'EventTag' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'etStatus'
--
-- * 'etExcludeFromAdxRequests'
--
-- * 'etEnabledByDefault'
--
-- * 'etKind'
--
-- * 'etCampaignIdDimensionValue'
--
-- * 'etAdvertiserId'
--
-- * 'etURL'
--
-- * 'etAdvertiserIdDimensionValue'
--
-- * 'etSSLCompliant'
--
-- * 'etCampaignId'
--
-- * 'etAccountId'
--
-- * 'etName'
--
-- * 'etURLEscapeLevels'
--
-- * 'etSiteIds'
--
-- * 'etId'
--
-- * 'etSubAccountId'
--
-- * 'etType'
--
-- * 'etSiteFilterType'
eventTag
:: EventTag
eventTag =
EventTag'
{ _etStatus = Nothing
, _etExcludeFromAdxRequests = Nothing
, _etEnabledByDefault = Nothing
, _etKind = Nothing
, _etCampaignIdDimensionValue = Nothing
, _etAdvertiserId = Nothing
, _etURL = Nothing
, _etAdvertiserIdDimensionValue = Nothing
, _etSSLCompliant = Nothing
, _etCampaignId = Nothing
, _etAccountId = Nothing
, _etName = Nothing
, _etURLEscapeLevels = Nothing
, _etSiteIds = Nothing
, _etId = Nothing
, _etSubAccountId = Nothing
, _etType = Nothing
, _etSiteFilterType = Nothing
}
-- | Status of this event tag. Must be ENABLED for this event tag to fire.
-- This is a required field.
etStatus :: Lens' EventTag (Maybe EventTagStatus)
etStatus = lens _etStatus (\ s a -> s{_etStatus = a})
-- | Whether to remove this event tag from ads that are trafficked through
-- Display & Video 360 to Ad Exchange. This may be useful if the event tag
-- uses a pixel that is unapproved for Ad Exchange bids on one or more
-- networks, such as the Google Display Network.
etExcludeFromAdxRequests :: Lens' EventTag (Maybe Bool)
etExcludeFromAdxRequests
= lens _etExcludeFromAdxRequests
(\ s a -> s{_etExcludeFromAdxRequests = a})
-- | Whether this event tag should be automatically enabled for all of the
-- advertiser\'s campaigns and ads.
etEnabledByDefault :: Lens' EventTag (Maybe Bool)
etEnabledByDefault
= lens _etEnabledByDefault
(\ s a -> s{_etEnabledByDefault = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#eventTag\".
etKind :: Lens' EventTag (Maybe Text)
etKind = lens _etKind (\ s a -> s{_etKind = a})
-- | Dimension value for the ID of the campaign. This is a read-only,
-- auto-generated field.
etCampaignIdDimensionValue :: Lens' EventTag (Maybe DimensionValue)
etCampaignIdDimensionValue
= lens _etCampaignIdDimensionValue
(\ s a -> s{_etCampaignIdDimensionValue = a})
-- | Advertiser ID of this event tag. This field or the campaignId field is
-- required on insertion.
etAdvertiserId :: Lens' EventTag (Maybe Int64)
etAdvertiserId
= lens _etAdvertiserId
(\ s a -> s{_etAdvertiserId = a})
. mapping _Coerce
-- | Payload URL for this event tag. The URL on a click-through event tag
-- should have a landing page URL appended to the end of it. This field is
-- required on insertion.
etURL :: Lens' EventTag (Maybe Text)
etURL = lens _etURL (\ s a -> s{_etURL = a})
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
etAdvertiserIdDimensionValue :: Lens' EventTag (Maybe DimensionValue)
etAdvertiserIdDimensionValue
= lens _etAdvertiserIdDimensionValue
(\ s a -> s{_etAdvertiserIdDimensionValue = a})
-- | Whether this tag is SSL-compliant or not. This is a read-only field.
etSSLCompliant :: Lens' EventTag (Maybe Bool)
etSSLCompliant
= lens _etSSLCompliant
(\ s a -> s{_etSSLCompliant = a})
-- | Campaign ID of this event tag. This field or the advertiserId field is
-- required on insertion.
etCampaignId :: Lens' EventTag (Maybe Int64)
etCampaignId
= lens _etCampaignId (\ s a -> s{_etCampaignId = a})
. mapping _Coerce
-- | Account ID of this event tag. This is a read-only field that can be left
-- blank.
etAccountId :: Lens' EventTag (Maybe Int64)
etAccountId
= lens _etAccountId (\ s a -> s{_etAccountId = a}) .
mapping _Coerce
-- | Name of this event tag. This is a required field and must be less than
-- 256 characters long.
etName :: Lens' EventTag (Maybe Text)
etName = lens _etName (\ s a -> s{_etName = a})
-- | Number of times the landing page URL should be URL-escaped before being
-- appended to the click-through event tag URL. Only applies to
-- click-through event tags as specified by the event tag type.
etURLEscapeLevels :: Lens' EventTag (Maybe Int32)
etURLEscapeLevels
= lens _etURLEscapeLevels
(\ s a -> s{_etURLEscapeLevels = a})
. mapping _Coerce
-- | Filter list of site IDs associated with this event tag. The
-- siteFilterType determines whether this is a allowlist or blocklist
-- filter.
etSiteIds :: Lens' EventTag [Int64]
etSiteIds
= lens _etSiteIds (\ s a -> s{_etSiteIds = a}) .
_Default
. _Coerce
-- | ID of this event tag. This is a read-only, auto-generated field.
etId :: Lens' EventTag (Maybe Int64)
etId
= lens _etId (\ s a -> s{_etId = a}) .
mapping _Coerce
-- | Subaccount ID of this event tag. This is a read-only field that can be
-- left blank.
etSubAccountId :: Lens' EventTag (Maybe Int64)
etSubAccountId
= lens _etSubAccountId
(\ s a -> s{_etSubAccountId = a})
. mapping _Coerce
-- | Event tag type. Can be used to specify whether to use a third-party
-- pixel, a third-party JavaScript URL, or a third-party click-through URL
-- for either impression or click tracking. This is a required field.
etType :: Lens' EventTag (Maybe EventTagType)
etType = lens _etType (\ s a -> s{_etType = a})
-- | Site filter type for this event tag. If no type is specified then the
-- event tag will be applied to all sites.
etSiteFilterType :: Lens' EventTag (Maybe EventTagSiteFilterType)
etSiteFilterType
= lens _etSiteFilterType
(\ s a -> s{_etSiteFilterType = a})
instance FromJSON EventTag where
parseJSON
= withObject "EventTag"
(\ o ->
EventTag' <$>
(o .:? "status") <*> (o .:? "excludeFromAdxRequests")
<*> (o .:? "enabledByDefault")
<*> (o .:? "kind")
<*> (o .:? "campaignIdDimensionValue")
<*> (o .:? "advertiserId")
<*> (o .:? "url")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "sslCompliant")
<*> (o .:? "campaignId")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "urlEscapeLevels")
<*> (o .:? "siteIds" .!= mempty)
<*> (o .:? "id")
<*> (o .:? "subaccountId")
<*> (o .:? "type")
<*> (o .:? "siteFilterType"))
instance ToJSON EventTag where
toJSON EventTag'{..}
= object
(catMaybes
[("status" .=) <$> _etStatus,
("excludeFromAdxRequests" .=) <$>
_etExcludeFromAdxRequests,
("enabledByDefault" .=) <$> _etEnabledByDefault,
("kind" .=) <$> _etKind,
("campaignIdDimensionValue" .=) <$>
_etCampaignIdDimensionValue,
("advertiserId" .=) <$> _etAdvertiserId,
("url" .=) <$> _etURL,
("advertiserIdDimensionValue" .=) <$>
_etAdvertiserIdDimensionValue,
("sslCompliant" .=) <$> _etSSLCompliant,
("campaignId" .=) <$> _etCampaignId,
("accountId" .=) <$> _etAccountId,
("name" .=) <$> _etName,
("urlEscapeLevels" .=) <$> _etURLEscapeLevels,
("siteIds" .=) <$> _etSiteIds, ("id" .=) <$> _etId,
("subaccountId" .=) <$> _etSubAccountId,
("type" .=) <$> _etType,
("siteFilterType" .=) <$> _etSiteFilterType])
-- | Contains properties of a user role permission.
--
-- /See:/ 'userRolePermission' smart constructor.
data UserRolePermission =
UserRolePermission'
{ _useKind :: !(Maybe Text)
, _useAvailability :: !(Maybe UserRolePermissionAvailability)
, _useName :: !(Maybe Text)
, _useId :: !(Maybe (Textual Int64))
, _usePermissionGroupId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'UserRolePermission' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'useKind'
--
-- * 'useAvailability'
--
-- * 'useName'
--
-- * 'useId'
--
-- * 'usePermissionGroupId'
userRolePermission
:: UserRolePermission
userRolePermission =
UserRolePermission'
{ _useKind = Nothing
, _useAvailability = Nothing
, _useName = Nothing
, _useId = Nothing
, _usePermissionGroupId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#userRolePermission\".
useKind :: Lens' UserRolePermission (Maybe Text)
useKind = lens _useKind (\ s a -> s{_useKind = a})
-- | Levels of availability for a user role permission.
useAvailability :: Lens' UserRolePermission (Maybe UserRolePermissionAvailability)
useAvailability
= lens _useAvailability
(\ s a -> s{_useAvailability = a})
-- | Name of this user role permission.
useName :: Lens' UserRolePermission (Maybe Text)
useName = lens _useName (\ s a -> s{_useName = a})
-- | ID of this user role permission.
useId :: Lens' UserRolePermission (Maybe Int64)
useId
= lens _useId (\ s a -> s{_useId = a}) .
mapping _Coerce
-- | ID of the permission group that this user role permission belongs to.
usePermissionGroupId :: Lens' UserRolePermission (Maybe Int64)
usePermissionGroupId
= lens _usePermissionGroupId
(\ s a -> s{_usePermissionGroupId = a})
. mapping _Coerce
instance FromJSON UserRolePermission where
parseJSON
= withObject "UserRolePermission"
(\ o ->
UserRolePermission' <$>
(o .:? "kind") <*> (o .:? "availability") <*>
(o .:? "name")
<*> (o .:? "id")
<*> (o .:? "permissionGroupId"))
instance ToJSON UserRolePermission where
toJSON UserRolePermission'{..}
= object
(catMaybes
[("kind" .=) <$> _useKind,
("availability" .=) <$> _useAvailability,
("name" .=) <$> _useName, ("id" .=) <$> _useId,
("permissionGroupId" .=) <$> _usePermissionGroupId])
-- | Contact of an order.
--
-- /See:/ 'orderContact' smart constructor.
data OrderContact =
OrderContact'
{ _ocSignatureUserProFileId :: !(Maybe (Textual Int64))
, _ocContactName :: !(Maybe Text)
, _ocContactTitle :: !(Maybe Text)
, _ocContactType :: !(Maybe OrderContactContactType)
, _ocContactInfo :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OrderContact' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ocSignatureUserProFileId'
--
-- * 'ocContactName'
--
-- * 'ocContactTitle'
--
-- * 'ocContactType'
--
-- * 'ocContactInfo'
orderContact
:: OrderContact
orderContact =
OrderContact'
{ _ocSignatureUserProFileId = Nothing
, _ocContactName = Nothing
, _ocContactTitle = Nothing
, _ocContactType = Nothing
, _ocContactInfo = Nothing
}
-- | ID of the user profile containing the signature that will be embedded
-- into order documents.
ocSignatureUserProFileId :: Lens' OrderContact (Maybe Int64)
ocSignatureUserProFileId
= lens _ocSignatureUserProFileId
(\ s a -> s{_ocSignatureUserProFileId = a})
. mapping _Coerce
-- | Name of this contact.
ocContactName :: Lens' OrderContact (Maybe Text)
ocContactName
= lens _ocContactName
(\ s a -> s{_ocContactName = a})
-- | Title of this contact.
ocContactTitle :: Lens' OrderContact (Maybe Text)
ocContactTitle
= lens _ocContactTitle
(\ s a -> s{_ocContactTitle = a})
-- | Type of this contact.
ocContactType :: Lens' OrderContact (Maybe OrderContactContactType)
ocContactType
= lens _ocContactType
(\ s a -> s{_ocContactType = a})
-- | Free-form information about this contact. It could be any information
-- related to this contact in addition to type, title, name, and signature
-- user profile ID.
ocContactInfo :: Lens' OrderContact (Maybe Text)
ocContactInfo
= lens _ocContactInfo
(\ s a -> s{_ocContactInfo = a})
instance FromJSON OrderContact where
parseJSON
= withObject "OrderContact"
(\ o ->
OrderContact' <$>
(o .:? "signatureUserProfileId") <*>
(o .:? "contactName")
<*> (o .:? "contactTitle")
<*> (o .:? "contactType")
<*> (o .:? "contactInfo"))
instance ToJSON OrderContact where
toJSON OrderContact'{..}
= object
(catMaybes
[("signatureUserProfileId" .=) <$>
_ocSignatureUserProFileId,
("contactName" .=) <$> _ocContactName,
("contactTitle" .=) <$> _ocContactTitle,
("contactType" .=) <$> _ocContactType,
("contactInfo" .=) <$> _ocContactInfo])
-- | Transcode Settings
--
-- /See:/ 'transcodeSetting' smart constructor.
data TranscodeSetting =
TranscodeSetting'
{ _tsKind :: !(Maybe Text)
, _tsEnabledVideoFormats :: !(Maybe [Textual Int32])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TranscodeSetting' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tsKind'
--
-- * 'tsEnabledVideoFormats'
transcodeSetting
:: TranscodeSetting
transcodeSetting =
TranscodeSetting' {_tsKind = Nothing, _tsEnabledVideoFormats = Nothing}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#transcodeSetting\".
tsKind :: Lens' TranscodeSetting (Maybe Text)
tsKind = lens _tsKind (\ s a -> s{_tsKind = a})
-- | Allowlist of video formats to be served to this placement. Set this list
-- to null or empty to serve all video formats.
tsEnabledVideoFormats :: Lens' TranscodeSetting [Int32]
tsEnabledVideoFormats
= lens _tsEnabledVideoFormats
(\ s a -> s{_tsEnabledVideoFormats = a})
. _Default
. _Coerce
instance FromJSON TranscodeSetting where
parseJSON
= withObject "TranscodeSetting"
(\ o ->
TranscodeSetting' <$>
(o .:? "kind") <*>
(o .:? "enabledVideoFormats" .!= mempty))
instance ToJSON TranscodeSetting where
toJSON TranscodeSetting'{..}
= object
(catMaybes
[("kind" .=) <$> _tsKind,
("enabledVideoFormats" .=) <$>
_tsEnabledVideoFormats])
-- | Floodlight Activity GenerateTag Response
--
-- /See:/ 'floodlightActivitiesGenerateTagResponse' smart constructor.
data FloodlightActivitiesGenerateTagResponse =
FloodlightActivitiesGenerateTagResponse'
{ _fagtrGlobalSiteTagGlobalSnippet :: !(Maybe Text)
, _fagtrFloodlightActivityTag :: !(Maybe Text)
, _fagtrKind :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'FloodlightActivitiesGenerateTagResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fagtrGlobalSiteTagGlobalSnippet'
--
-- * 'fagtrFloodlightActivityTag'
--
-- * 'fagtrKind'
floodlightActivitiesGenerateTagResponse
:: FloodlightActivitiesGenerateTagResponse
floodlightActivitiesGenerateTagResponse =
FloodlightActivitiesGenerateTagResponse'
{ _fagtrGlobalSiteTagGlobalSnippet = Nothing
, _fagtrFloodlightActivityTag = Nothing
, _fagtrKind = Nothing
}
-- | The global snippet section of a global site tag. The global site tag
-- sets new cookies on your domain, which will store a unique identifier
-- for a user or the ad click that brought the user to your site. Learn
-- more.
fagtrGlobalSiteTagGlobalSnippet :: Lens' FloodlightActivitiesGenerateTagResponse (Maybe Text)
fagtrGlobalSiteTagGlobalSnippet
= lens _fagtrGlobalSiteTagGlobalSnippet
(\ s a -> s{_fagtrGlobalSiteTagGlobalSnippet = a})
-- | Generated tag for this Floodlight activity. For global site tags, this
-- is the event snippet.
fagtrFloodlightActivityTag :: Lens' FloodlightActivitiesGenerateTagResponse (Maybe Text)
fagtrFloodlightActivityTag
= lens _fagtrFloodlightActivityTag
(\ s a -> s{_fagtrFloodlightActivityTag = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#floodlightActivitiesGenerateTagResponse\".
fagtrKind :: Lens' FloodlightActivitiesGenerateTagResponse (Maybe Text)
fagtrKind
= lens _fagtrKind (\ s a -> s{_fagtrKind = a})
instance FromJSON
FloodlightActivitiesGenerateTagResponse
where
parseJSON
= withObject
"FloodlightActivitiesGenerateTagResponse"
(\ o ->
FloodlightActivitiesGenerateTagResponse' <$>
(o .:? "globalSiteTagGlobalSnippet") <*>
(o .:? "floodlightActivityTag")
<*> (o .:? "kind"))
instance ToJSON
FloodlightActivitiesGenerateTagResponse
where
toJSON FloodlightActivitiesGenerateTagResponse'{..}
= object
(catMaybes
[("globalSiteTagGlobalSnippet" .=) <$>
_fagtrGlobalSiteTagGlobalSnippet,
("floodlightActivityTag" .=) <$>
_fagtrFloodlightActivityTag,
("kind" .=) <$> _fagtrKind])
-- | Ad Slot
--
-- /See:/ 'adSlot' smart constructor.
data AdSlot =
AdSlot'
{ _assHeight :: !(Maybe (Textual Int64))
, _assPaymentSourceType :: !(Maybe AdSlotPaymentSourceType)
, _assLinkedPlacementId :: !(Maybe (Textual Int64))
, _assWidth :: !(Maybe (Textual Int64))
, _assPrimary :: !(Maybe Bool)
, _assName :: !(Maybe Text)
, _assComment :: !(Maybe Text)
, _assCompatibility :: !(Maybe AdSlotCompatibility)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'AdSlot' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'assHeight'
--
-- * 'assPaymentSourceType'
--
-- * 'assLinkedPlacementId'
--
-- * 'assWidth'
--
-- * 'assPrimary'
--
-- * 'assName'
--
-- * 'assComment'
--
-- * 'assCompatibility'
adSlot
:: AdSlot
adSlot =
AdSlot'
{ _assHeight = Nothing
, _assPaymentSourceType = Nothing
, _assLinkedPlacementId = Nothing
, _assWidth = Nothing
, _assPrimary = Nothing
, _assName = Nothing
, _assComment = Nothing
, _assCompatibility = Nothing
}
-- | Height of this ad slot.
assHeight :: Lens' AdSlot (Maybe Int64)
assHeight
= lens _assHeight (\ s a -> s{_assHeight = a}) .
mapping _Coerce
-- | Payment source type of this ad slot.
assPaymentSourceType :: Lens' AdSlot (Maybe AdSlotPaymentSourceType)
assPaymentSourceType
= lens _assPaymentSourceType
(\ s a -> s{_assPaymentSourceType = a})
-- | ID of the placement from an external platform that is linked to this ad
-- slot.
assLinkedPlacementId :: Lens' AdSlot (Maybe Int64)
assLinkedPlacementId
= lens _assLinkedPlacementId
(\ s a -> s{_assLinkedPlacementId = a})
. mapping _Coerce
-- | Width of this ad slot.
assWidth :: Lens' AdSlot (Maybe Int64)
assWidth
= lens _assWidth (\ s a -> s{_assWidth = a}) .
mapping _Coerce
-- | Primary ad slot of a roadblock inventory item.
assPrimary :: Lens' AdSlot (Maybe Bool)
assPrimary
= lens _assPrimary (\ s a -> s{_assPrimary = a})
-- | Name of this ad slot.
assName :: Lens' AdSlot (Maybe Text)
assName = lens _assName (\ s a -> s{_assName = a})
-- | Comment for this ad slot.
assComment :: Lens' AdSlot (Maybe Text)
assComment
= lens _assComment (\ s a -> s{_assComment = a})
-- | Ad slot compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to
-- rendering either on desktop, mobile devices or in mobile apps for
-- regular or interstitial ads respectively. APP and APP_INTERSTITIAL are
-- for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in
-- in-stream video ads developed with the VAST standard.
assCompatibility :: Lens' AdSlot (Maybe AdSlotCompatibility)
assCompatibility
= lens _assCompatibility
(\ s a -> s{_assCompatibility = a})
instance FromJSON AdSlot where
parseJSON
= withObject "AdSlot"
(\ o ->
AdSlot' <$>
(o .:? "height") <*> (o .:? "paymentSourceType") <*>
(o .:? "linkedPlacementId")
<*> (o .:? "width")
<*> (o .:? "primary")
<*> (o .:? "name")
<*> (o .:? "comment")
<*> (o .:? "compatibility"))
instance ToJSON AdSlot where
toJSON AdSlot'{..}
= object
(catMaybes
[("height" .=) <$> _assHeight,
("paymentSourceType" .=) <$> _assPaymentSourceType,
("linkedPlacementId" .=) <$> _assLinkedPlacementId,
("width" .=) <$> _assWidth,
("primary" .=) <$> _assPrimary,
("name" .=) <$> _assName,
("comment" .=) <$> _assComment,
("compatibility" .=) <$> _assCompatibility])
--
-- /See:/ 'measurementPartnerAdvertiserLink' smart constructor.
data MeasurementPartnerAdvertiserLink =
MeasurementPartnerAdvertiserLink'
{ _mpalLinkStatus :: !(Maybe MeasurementPartnerAdvertiserLinkLinkStatus)
, _mpalMeasurementPartner :: !(Maybe MeasurementPartnerAdvertiserLinkMeasurementPartner)
, _mpalPartnerAdvertiserId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'MeasurementPartnerAdvertiserLink' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mpalLinkStatus'
--
-- * 'mpalMeasurementPartner'
--
-- * 'mpalPartnerAdvertiserId'
measurementPartnerAdvertiserLink
:: MeasurementPartnerAdvertiserLink
measurementPartnerAdvertiserLink =
MeasurementPartnerAdvertiserLink'
{ _mpalLinkStatus = Nothing
, _mpalMeasurementPartner = Nothing
, _mpalPartnerAdvertiserId = Nothing
}
-- | .
mpalLinkStatus :: Lens' MeasurementPartnerAdvertiserLink (Maybe MeasurementPartnerAdvertiserLinkLinkStatus)
mpalLinkStatus
= lens _mpalLinkStatus
(\ s a -> s{_mpalLinkStatus = a})
-- | Measurement partner used for tag wrapping.
mpalMeasurementPartner :: Lens' MeasurementPartnerAdvertiserLink (Maybe MeasurementPartnerAdvertiserLinkMeasurementPartner)
mpalMeasurementPartner
= lens _mpalMeasurementPartner
(\ s a -> s{_mpalMeasurementPartner = a})
-- | .
mpalPartnerAdvertiserId :: Lens' MeasurementPartnerAdvertiserLink (Maybe Text)
mpalPartnerAdvertiserId
= lens _mpalPartnerAdvertiserId
(\ s a -> s{_mpalPartnerAdvertiserId = a})
instance FromJSON MeasurementPartnerAdvertiserLink
where
parseJSON
= withObject "MeasurementPartnerAdvertiserLink"
(\ o ->
MeasurementPartnerAdvertiserLink' <$>
(o .:? "linkStatus") <*> (o .:? "measurementPartner")
<*> (o .:? "partnerAdvertiserId"))
instance ToJSON MeasurementPartnerAdvertiserLink
where
toJSON MeasurementPartnerAdvertiserLink'{..}
= object
(catMaybes
[("linkStatus" .=) <$> _mpalLinkStatus,
("measurementPartner" .=) <$>
_mpalMeasurementPartner,
("partnerAdvertiserId" .=) <$>
_mpalPartnerAdvertiserId])
-- | Third-party Tracking URL.
--
-- /See:/ 'thirdPartyTrackingURL' smart constructor.
data ThirdPartyTrackingURL =
ThirdPartyTrackingURL'
{ _tptuURL :: !(Maybe Text)
, _tptuThirdPartyURLType :: !(Maybe ThirdPartyTrackingURLThirdPartyURLType)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ThirdPartyTrackingURL' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tptuURL'
--
-- * 'tptuThirdPartyURLType'
thirdPartyTrackingURL
:: ThirdPartyTrackingURL
thirdPartyTrackingURL =
ThirdPartyTrackingURL' {_tptuURL = Nothing, _tptuThirdPartyURLType = Nothing}
-- | URL for the specified third-party URL type.
tptuURL :: Lens' ThirdPartyTrackingURL (Maybe Text)
tptuURL = lens _tptuURL (\ s a -> s{_tptuURL = a})
-- | Third-party URL type for in-stream video and in-stream audio creatives.
tptuThirdPartyURLType :: Lens' ThirdPartyTrackingURL (Maybe ThirdPartyTrackingURLThirdPartyURLType)
tptuThirdPartyURLType
= lens _tptuThirdPartyURLType
(\ s a -> s{_tptuThirdPartyURLType = a})
instance FromJSON ThirdPartyTrackingURL where
parseJSON
= withObject "ThirdPartyTrackingURL"
(\ o ->
ThirdPartyTrackingURL' <$>
(o .:? "url") <*> (o .:? "thirdPartyUrlType"))
instance ToJSON ThirdPartyTrackingURL where
toJSON ThirdPartyTrackingURL'{..}
= object
(catMaybes
[("url" .=) <$> _tptuURL,
("thirdPartyUrlType" .=) <$> _tptuThirdPartyURLType])
-- | Contains properties of a Planning order document.
--
-- /See:/ 'orderDocument' smart constructor.
data OrderDocument =
OrderDocument'
{ _odSigned :: !(Maybe Bool)
, _odKind :: !(Maybe Text)
, _odAdvertiserId :: !(Maybe (Textual Int64))
, _odLastSentTime :: !(Maybe DateTime')
, _odAmendedOrderDocumentId :: !(Maybe (Textual Int64))
, _odLastSentRecipients :: !(Maybe [Text])
, _odEffectiveDate :: !(Maybe Date')
, _odApprovedByUserProFileIds :: !(Maybe [Textual Int64])
, _odAccountId :: !(Maybe (Textual Int64))
, _odId :: !(Maybe (Textual Int64))
, _odProjectId :: !(Maybe (Textual Int64))
, _odTitle :: !(Maybe Text)
, _odSubAccountId :: !(Maybe (Textual Int64))
, _odType :: !(Maybe OrderDocumentType)
, _odOrderId :: !(Maybe (Textual Int64))
, _odCancelled :: !(Maybe Bool)
, _odCreatedInfo :: !(Maybe LastModifiedInfo)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'OrderDocument' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'odSigned'
--
-- * 'odKind'
--
-- * 'odAdvertiserId'
--
-- * 'odLastSentTime'
--
-- * 'odAmendedOrderDocumentId'
--
-- * 'odLastSentRecipients'
--
-- * 'odEffectiveDate'
--
-- * 'odApprovedByUserProFileIds'
--
-- * 'odAccountId'
--
-- * 'odId'
--
-- * 'odProjectId'
--
-- * 'odTitle'
--
-- * 'odSubAccountId'
--
-- * 'odType'
--
-- * 'odOrderId'
--
-- * 'odCancelled'
--
-- * 'odCreatedInfo'
orderDocument
:: OrderDocument
orderDocument =
OrderDocument'
{ _odSigned = Nothing
, _odKind = Nothing
, _odAdvertiserId = Nothing
, _odLastSentTime = Nothing
, _odAmendedOrderDocumentId = Nothing
, _odLastSentRecipients = Nothing
, _odEffectiveDate = Nothing
, _odApprovedByUserProFileIds = Nothing
, _odAccountId = Nothing
, _odId = Nothing
, _odProjectId = Nothing
, _odTitle = Nothing
, _odSubAccountId = Nothing
, _odType = Nothing
, _odOrderId = Nothing
, _odCancelled = Nothing
, _odCreatedInfo = Nothing
}
-- | Whether this order document has been signed.
odSigned :: Lens' OrderDocument (Maybe Bool)
odSigned = lens _odSigned (\ s a -> s{_odSigned = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#orderDocument\".
odKind :: Lens' OrderDocument (Maybe Text)
odKind = lens _odKind (\ s a -> s{_odKind = a})
-- | Advertiser ID of this order document.
odAdvertiserId :: Lens' OrderDocument (Maybe Int64)
odAdvertiserId
= lens _odAdvertiserId
(\ s a -> s{_odAdvertiserId = a})
. mapping _Coerce
odLastSentTime :: Lens' OrderDocument (Maybe UTCTime)
odLastSentTime
= lens _odLastSentTime
(\ s a -> s{_odLastSentTime = a})
. mapping _DateTime
-- | The amended order document ID of this order document. An order document
-- can be created by optionally amending another order document so that the
-- change history can be preserved.
odAmendedOrderDocumentId :: Lens' OrderDocument (Maybe Int64)
odAmendedOrderDocumentId
= lens _odAmendedOrderDocumentId
(\ s a -> s{_odAmendedOrderDocumentId = a})
. mapping _Coerce
-- | List of email addresses that received the last sent document.
odLastSentRecipients :: Lens' OrderDocument [Text]
odLastSentRecipients
= lens _odLastSentRecipients
(\ s a -> s{_odLastSentRecipients = a})
. _Default
. _Coerce
odEffectiveDate :: Lens' OrderDocument (Maybe Day)
odEffectiveDate
= lens _odEffectiveDate
(\ s a -> s{_odEffectiveDate = a})
. mapping _Date
-- | IDs of users who have approved this order document.
odApprovedByUserProFileIds :: Lens' OrderDocument [Int64]
odApprovedByUserProFileIds
= lens _odApprovedByUserProFileIds
(\ s a -> s{_odApprovedByUserProFileIds = a})
. _Default
. _Coerce
-- | Account ID of this order document.
odAccountId :: Lens' OrderDocument (Maybe Int64)
odAccountId
= lens _odAccountId (\ s a -> s{_odAccountId = a}) .
mapping _Coerce
-- | ID of this order document.
odId :: Lens' OrderDocument (Maybe Int64)
odId
= lens _odId (\ s a -> s{_odId = a}) .
mapping _Coerce
-- | Project ID of this order document.
odProjectId :: Lens' OrderDocument (Maybe Int64)
odProjectId
= lens _odProjectId (\ s a -> s{_odProjectId = a}) .
mapping _Coerce
-- | Title of this order document.
odTitle :: Lens' OrderDocument (Maybe Text)
odTitle = lens _odTitle (\ s a -> s{_odTitle = a})
-- | Subaccount ID of this order document.
odSubAccountId :: Lens' OrderDocument (Maybe Int64)
odSubAccountId
= lens _odSubAccountId
(\ s a -> s{_odSubAccountId = a})
. mapping _Coerce
-- | Type of this order document
odType :: Lens' OrderDocument (Maybe OrderDocumentType)
odType = lens _odType (\ s a -> s{_odType = a})
-- | ID of the order from which this order document is created.
odOrderId :: Lens' OrderDocument (Maybe Int64)
odOrderId
= lens _odOrderId (\ s a -> s{_odOrderId = a}) .
mapping _Coerce
-- | Whether this order document is cancelled.
odCancelled :: Lens' OrderDocument (Maybe Bool)
odCancelled
= lens _odCancelled (\ s a -> s{_odCancelled = a})
-- | Information about the creation of this order document.
odCreatedInfo :: Lens' OrderDocument (Maybe LastModifiedInfo)
odCreatedInfo
= lens _odCreatedInfo
(\ s a -> s{_odCreatedInfo = a})
instance FromJSON OrderDocument where
parseJSON
= withObject "OrderDocument"
(\ o ->
OrderDocument' <$>
(o .:? "signed") <*> (o .:? "kind") <*>
(o .:? "advertiserId")
<*> (o .:? "lastSentTime")
<*> (o .:? "amendedOrderDocumentId")
<*> (o .:? "lastSentRecipients" .!= mempty)
<*> (o .:? "effectiveDate")
<*> (o .:? "approvedByUserProfileIds" .!= mempty)
<*> (o .:? "accountId")
<*> (o .:? "id")
<*> (o .:? "projectId")
<*> (o .:? "title")
<*> (o .:? "subaccountId")
<*> (o .:? "type")
<*> (o .:? "orderId")
<*> (o .:? "cancelled")
<*> (o .:? "createdInfo"))
instance ToJSON OrderDocument where
toJSON OrderDocument'{..}
= object
(catMaybes
[("signed" .=) <$> _odSigned,
("kind" .=) <$> _odKind,
("advertiserId" .=) <$> _odAdvertiserId,
("lastSentTime" .=) <$> _odLastSentTime,
("amendedOrderDocumentId" .=) <$>
_odAmendedOrderDocumentId,
("lastSentRecipients" .=) <$> _odLastSentRecipients,
("effectiveDate" .=) <$> _odEffectiveDate,
("approvedByUserProfileIds" .=) <$>
_odApprovedByUserProFileIds,
("accountId" .=) <$> _odAccountId,
("id" .=) <$> _odId,
("projectId" .=) <$> _odProjectId,
("title" .=) <$> _odTitle,
("subaccountId" .=) <$> _odSubAccountId,
("type" .=) <$> _odType,
("orderId" .=) <$> _odOrderId,
("cancelled" .=) <$> _odCancelled,
("createdInfo" .=) <$> _odCreatedInfo])
-- | Contains information about a metro region that can be targeted by ads.
--
-- /See:/ 'metro' smart constructor.
data Metro =
Metro'
{ _metMetroCode :: !(Maybe Text)
, _metKind :: !(Maybe Text)
, _metName :: !(Maybe Text)
, _metCountryCode :: !(Maybe Text)
, _metDmaId :: !(Maybe (Textual Int64))
, _metCountryDartId :: !(Maybe (Textual Int64))
, _metDartId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Metro' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'metMetroCode'
--
-- * 'metKind'
--
-- * 'metName'
--
-- * 'metCountryCode'
--
-- * 'metDmaId'
--
-- * 'metCountryDartId'
--
-- * 'metDartId'
metro
:: Metro
metro =
Metro'
{ _metMetroCode = Nothing
, _metKind = Nothing
, _metName = Nothing
, _metCountryCode = Nothing
, _metDmaId = Nothing
, _metCountryDartId = Nothing
, _metDartId = Nothing
}
-- | Metro code of this metro region. This is equivalent to dma_id.
metMetroCode :: Lens' Metro (Maybe Text)
metMetroCode
= lens _metMetroCode (\ s a -> s{_metMetroCode = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#metro\".
metKind :: Lens' Metro (Maybe Text)
metKind = lens _metKind (\ s a -> s{_metKind = a})
-- | Name of this metro region.
metName :: Lens' Metro (Maybe Text)
metName = lens _metName (\ s a -> s{_metName = a})
-- | Country code of the country to which this metro region belongs.
metCountryCode :: Lens' Metro (Maybe Text)
metCountryCode
= lens _metCountryCode
(\ s a -> s{_metCountryCode = a})
-- | DMA ID of this metro region. This is the ID used for targeting and
-- generating reports, and is equivalent to metro_code.
metDmaId :: Lens' Metro (Maybe Int64)
metDmaId
= lens _metDmaId (\ s a -> s{_metDmaId = a}) .
mapping _Coerce
-- | DART ID of the country to which this metro region belongs.
metCountryDartId :: Lens' Metro (Maybe Int64)
metCountryDartId
= lens _metCountryDartId
(\ s a -> s{_metCountryDartId = a})
. mapping _Coerce
-- | DART ID of this metro region.
metDartId :: Lens' Metro (Maybe Int64)
metDartId
= lens _metDartId (\ s a -> s{_metDartId = a}) .
mapping _Coerce
instance FromJSON Metro where
parseJSON
= withObject "Metro"
(\ o ->
Metro' <$>
(o .:? "metroCode") <*> (o .:? "kind") <*>
(o .:? "name")
<*> (o .:? "countryCode")
<*> (o .:? "dmaId")
<*> (o .:? "countryDartId")
<*> (o .:? "dartId"))
instance ToJSON Metro where
toJSON Metro'{..}
= object
(catMaybes
[("metroCode" .=) <$> _metMetroCode,
("kind" .=) <$> _metKind, ("name" .=) <$> _metName,
("countryCode" .=) <$> _metCountryCode,
("dmaId" .=) <$> _metDmaId,
("countryDartId" .=) <$> _metCountryDartId,
("dartId" .=) <$> _metDartId])
-- | Contains information about a mobile app. Used as a landing page deep
-- link.
--
-- /See:/ 'mobileApp' smart constructor.
data MobileApp =
MobileApp'
{ _maKind :: !(Maybe Text)
, _maId :: !(Maybe Text)
, _maTitle :: !(Maybe Text)
, _maPublisherName :: !(Maybe Text)
, _maDirectory :: !(Maybe MobileAppDirectory)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'MobileApp' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'maKind'
--
-- * 'maId'
--
-- * 'maTitle'
--
-- * 'maPublisherName'
--
-- * 'maDirectory'
mobileApp
:: MobileApp
mobileApp =
MobileApp'
{ _maKind = Nothing
, _maId = Nothing
, _maTitle = Nothing
, _maPublisherName = Nothing
, _maDirectory = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#mobileApp\".
maKind :: Lens' MobileApp (Maybe Text)
maKind = lens _maKind (\ s a -> s{_maKind = a})
-- | ID of this mobile app.
maId :: Lens' MobileApp (Maybe Text)
maId = lens _maId (\ s a -> s{_maId = a})
-- | Title of this mobile app.
maTitle :: Lens' MobileApp (Maybe Text)
maTitle = lens _maTitle (\ s a -> s{_maTitle = a})
-- | Publisher name.
maPublisherName :: Lens' MobileApp (Maybe Text)
maPublisherName
= lens _maPublisherName
(\ s a -> s{_maPublisherName = a})
-- | Mobile app directory.
maDirectory :: Lens' MobileApp (Maybe MobileAppDirectory)
maDirectory
= lens _maDirectory (\ s a -> s{_maDirectory = a})
instance FromJSON MobileApp where
parseJSON
= withObject "MobileApp"
(\ o ->
MobileApp' <$>
(o .:? "kind") <*> (o .:? "id") <*> (o .:? "title")
<*> (o .:? "publisherName")
<*> (o .:? "directory"))
instance ToJSON MobileApp where
toJSON MobileApp'{..}
= object
(catMaybes
[("kind" .=) <$> _maKind, ("id" .=) <$> _maId,
("title" .=) <$> _maTitle,
("publisherName" .=) <$> _maPublisherName,
("directory" .=) <$> _maDirectory])
-- | Contains properties of a placement.
--
-- /See:/ 'placement' smart constructor.
data Placement =
Placement'
{ _p1Status :: !(Maybe PlacementStatus)
, _p1VideoSettings :: !(Maybe VideoSettings)
, _p1PlacementStrategyId :: !(Maybe (Textual Int64))
, _p1PartnerWrAppingData :: !(Maybe MeasurementPartnerWrAppingData)
, _p1TagFormats :: !(Maybe [PlacementTagFormatsItem])
, _p1SiteIdDimensionValue :: !(Maybe DimensionValue)
, _p1PricingSchedule :: !(Maybe PricingSchedule)
, _p1Size :: !(Maybe Size)
, _p1Kind :: !(Maybe Text)
, _p1KeyName :: !(Maybe Text)
, _p1CampaignIdDimensionValue :: !(Maybe DimensionValue)
, _p1AdvertiserId :: !(Maybe (Textual Int64))
, _p1AdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _p1CampaignId :: !(Maybe (Textual Int64))
, _p1IdDimensionValue :: !(Maybe DimensionValue)
, _p1VpaidAdapterChoice :: !(Maybe PlacementVpaidAdapterChoice)
, _p1AdBlockingOptOut :: !(Maybe Bool)
, _p1WrAppingOptOut :: !(Maybe Bool)
, _p1Primary :: !(Maybe Bool)
, _p1LookbackConfiguration :: !(Maybe LookbackConfiguration)
, _p1TagSetting :: !(Maybe TagSetting)
, _p1ContentCategoryId :: !(Maybe (Textual Int64))
, _p1DirectorySiteIdDimensionValue :: !(Maybe DimensionValue)
, _p1AccountId :: !(Maybe (Textual Int64))
, _p1PaymentSource :: !(Maybe PlacementPaymentSource)
, _p1Name :: !(Maybe Text)
, _p1AdditionalSizes :: !(Maybe [Size])
, _p1DirectorySiteId :: !(Maybe (Textual Int64))
, _p1CreateInfo :: !(Maybe LastModifiedInfo)
, _p1VideoActiveViewOptOut :: !(Maybe Bool)
, _p1LastModifiedInfo :: !(Maybe LastModifiedInfo)
, _p1Id :: !(Maybe (Textual Int64))
, _p1SSLRequired :: !(Maybe Bool)
, _p1SubAccountId :: !(Maybe (Textual Int64))
, _p1PlacementGroupIdDimensionValue :: !(Maybe DimensionValue)
, _p1ExternalId :: !(Maybe Text)
, _p1PlacementGroupId :: !(Maybe (Textual Int64))
, _p1Comment :: !(Maybe Text)
, _p1SiteId :: !(Maybe (Textual Int64))
, _p1Compatibility :: !(Maybe PlacementCompatibility)
, _p1Archived :: !(Maybe Bool)
, _p1PaymentApproved :: !(Maybe Bool)
, _p1PublisherUpdateInfo :: !(Maybe LastModifiedInfo)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'Placement' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'p1Status'
--
-- * 'p1VideoSettings'
--
-- * 'p1PlacementStrategyId'
--
-- * 'p1PartnerWrAppingData'
--
-- * 'p1TagFormats'
--
-- * 'p1SiteIdDimensionValue'
--
-- * 'p1PricingSchedule'
--
-- * 'p1Size'
--
-- * 'p1Kind'
--
-- * 'p1KeyName'
--
-- * 'p1CampaignIdDimensionValue'
--
-- * 'p1AdvertiserId'
--
-- * 'p1AdvertiserIdDimensionValue'
--
-- * 'p1CampaignId'
--
-- * 'p1IdDimensionValue'
--
-- * 'p1VpaidAdapterChoice'
--
-- * 'p1AdBlockingOptOut'
--
-- * 'p1WrAppingOptOut'
--
-- * 'p1Primary'
--
-- * 'p1LookbackConfiguration'
--
-- * 'p1TagSetting'
--
-- * 'p1ContentCategoryId'
--
-- * 'p1DirectorySiteIdDimensionValue'
--
-- * 'p1AccountId'
--
-- * 'p1PaymentSource'
--
-- * 'p1Name'
--
-- * 'p1AdditionalSizes'
--
-- * 'p1DirectorySiteId'
--
-- * 'p1CreateInfo'
--
-- * 'p1VideoActiveViewOptOut'
--
-- * 'p1LastModifiedInfo'
--
-- * 'p1Id'
--
-- * 'p1SSLRequired'
--
-- * 'p1SubAccountId'
--
-- * 'p1PlacementGroupIdDimensionValue'
--
-- * 'p1ExternalId'
--
-- * 'p1PlacementGroupId'
--
-- * 'p1Comment'
--
-- * 'p1SiteId'
--
-- * 'p1Compatibility'
--
-- * 'p1Archived'
--
-- * 'p1PaymentApproved'
--
-- * 'p1PublisherUpdateInfo'
placement
:: Placement
placement =
Placement'
{ _p1Status = Nothing
, _p1VideoSettings = Nothing
, _p1PlacementStrategyId = Nothing
, _p1PartnerWrAppingData = Nothing
, _p1TagFormats = Nothing
, _p1SiteIdDimensionValue = Nothing
, _p1PricingSchedule = Nothing
, _p1Size = Nothing
, _p1Kind = Nothing
, _p1KeyName = Nothing
, _p1CampaignIdDimensionValue = Nothing
, _p1AdvertiserId = Nothing
, _p1AdvertiserIdDimensionValue = Nothing
, _p1CampaignId = Nothing
, _p1IdDimensionValue = Nothing
, _p1VpaidAdapterChoice = Nothing
, _p1AdBlockingOptOut = Nothing
, _p1WrAppingOptOut = Nothing
, _p1Primary = Nothing
, _p1LookbackConfiguration = Nothing
, _p1TagSetting = Nothing
, _p1ContentCategoryId = Nothing
, _p1DirectorySiteIdDimensionValue = Nothing
, _p1AccountId = Nothing
, _p1PaymentSource = Nothing
, _p1Name = Nothing
, _p1AdditionalSizes = Nothing
, _p1DirectorySiteId = Nothing
, _p1CreateInfo = Nothing
, _p1VideoActiveViewOptOut = Nothing
, _p1LastModifiedInfo = Nothing
, _p1Id = Nothing
, _p1SSLRequired = Nothing
, _p1SubAccountId = Nothing
, _p1PlacementGroupIdDimensionValue = Nothing
, _p1ExternalId = Nothing
, _p1PlacementGroupId = Nothing
, _p1Comment = Nothing
, _p1SiteId = Nothing
, _p1Compatibility = Nothing
, _p1Archived = Nothing
, _p1PaymentApproved = Nothing
, _p1PublisherUpdateInfo = Nothing
}
-- | Third-party placement status.
p1Status :: Lens' Placement (Maybe PlacementStatus)
p1Status = lens _p1Status (\ s a -> s{_p1Status = a})
-- | A collection of settings which affect video creatives served through
-- this placement. Applicable to placements with IN_STREAM_VIDEO
-- compatibility.
p1VideoSettings :: Lens' Placement (Maybe VideoSettings)
p1VideoSettings
= lens _p1VideoSettings
(\ s a -> s{_p1VideoSettings = a})
-- | ID of the placement strategy assigned to this placement.
p1PlacementStrategyId :: Lens' Placement (Maybe Int64)
p1PlacementStrategyId
= lens _p1PlacementStrategyId
(\ s a -> s{_p1PlacementStrategyId = a})
. mapping _Coerce
-- | Measurement partner provided settings for a wrapped placement.
p1PartnerWrAppingData :: Lens' Placement (Maybe MeasurementPartnerWrAppingData)
p1PartnerWrAppingData
= lens _p1PartnerWrAppingData
(\ s a -> s{_p1PartnerWrAppingData = a})
-- | Tag formats to generate for this placement. This field is required on
-- insertion. Acceptable values are: - \"PLACEMENT_TAG_STANDARD\" -
-- \"PLACEMENT_TAG_IFRAME_JAVASCRIPT\" - \"PLACEMENT_TAG_IFRAME_ILAYER\" -
-- \"PLACEMENT_TAG_INTERNAL_REDIRECT\" - \"PLACEMENT_TAG_JAVASCRIPT\" -
-- \"PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT\" -
-- \"PLACEMENT_TAG_INTERSTITIAL_INTERNAL_REDIRECT\" -
-- \"PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT\" -
-- \"PLACEMENT_TAG_CLICK_COMMANDS\" -
-- \"PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH\" -
-- \"PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH_VAST_3\" -
-- \"PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH_VAST_4\" -
-- \"PLACEMENT_TAG_TRACKING\" - \"PLACEMENT_TAG_TRACKING_IFRAME\" -
-- \"PLACEMENT_TAG_TRACKING_JAVASCRIPT\"
p1TagFormats :: Lens' Placement [PlacementTagFormatsItem]
p1TagFormats
= lens _p1TagFormats (\ s a -> s{_p1TagFormats = a})
. _Default
. _Coerce
-- | Dimension value for the ID of the site. This is a read-only,
-- auto-generated field.
p1SiteIdDimensionValue :: Lens' Placement (Maybe DimensionValue)
p1SiteIdDimensionValue
= lens _p1SiteIdDimensionValue
(\ s a -> s{_p1SiteIdDimensionValue = a})
-- | Pricing schedule of this placement. This field is required on insertion,
-- specifically subfields startDate, endDate and pricingType.
p1PricingSchedule :: Lens' Placement (Maybe PricingSchedule)
p1PricingSchedule
= lens _p1PricingSchedule
(\ s a -> s{_p1PricingSchedule = a})
-- | Size associated with this placement. When inserting or updating a
-- placement, only the size ID field is used. This field is required on
-- insertion.
p1Size :: Lens' Placement (Maybe Size)
p1Size = lens _p1Size (\ s a -> s{_p1Size = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#placement\".
p1Kind :: Lens' Placement (Maybe Text)
p1Kind = lens _p1Kind (\ s a -> s{_p1Kind = a})
-- | Key name of this placement. This is a read-only, auto-generated field.
p1KeyName :: Lens' Placement (Maybe Text)
p1KeyName
= lens _p1KeyName (\ s a -> s{_p1KeyName = a})
-- | Dimension value for the ID of the campaign. This is a read-only,
-- auto-generated field.
p1CampaignIdDimensionValue :: Lens' Placement (Maybe DimensionValue)
p1CampaignIdDimensionValue
= lens _p1CampaignIdDimensionValue
(\ s a -> s{_p1CampaignIdDimensionValue = a})
-- | Advertiser ID of this placement. This field can be left blank.
p1AdvertiserId :: Lens' Placement (Maybe Int64)
p1AdvertiserId
= lens _p1AdvertiserId
(\ s a -> s{_p1AdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
p1AdvertiserIdDimensionValue :: Lens' Placement (Maybe DimensionValue)
p1AdvertiserIdDimensionValue
= lens _p1AdvertiserIdDimensionValue
(\ s a -> s{_p1AdvertiserIdDimensionValue = a})
-- | Campaign ID of this placement. This field is a required field on
-- insertion.
p1CampaignId :: Lens' Placement (Maybe Int64)
p1CampaignId
= lens _p1CampaignId (\ s a -> s{_p1CampaignId = a})
. mapping _Coerce
-- | Dimension value for the ID of this placement. This is a read-only,
-- auto-generated field.
p1IdDimensionValue :: Lens' Placement (Maybe DimensionValue)
p1IdDimensionValue
= lens _p1IdDimensionValue
(\ s a -> s{_p1IdDimensionValue = a})
-- | VPAID adapter setting for this placement. Controls which VPAID format
-- the measurement adapter will use for in-stream video creatives assigned
-- to this placement. *Note:* Flash is no longer supported. This field now
-- defaults to HTML5 when the following values are provided: FLASH, BOTH.
p1VpaidAdapterChoice :: Lens' Placement (Maybe PlacementVpaidAdapterChoice)
p1VpaidAdapterChoice
= lens _p1VpaidAdapterChoice
(\ s a -> s{_p1VpaidAdapterChoice = a})
-- | Whether this placement opts out of ad blocking. When true, ad blocking
-- is disabled for this placement. When false, the campaign and site
-- settings take effect.
p1AdBlockingOptOut :: Lens' Placement (Maybe Bool)
p1AdBlockingOptOut
= lens _p1AdBlockingOptOut
(\ s a -> s{_p1AdBlockingOptOut = a})
-- | Whether this placement opts out of tag wrapping.
p1WrAppingOptOut :: Lens' Placement (Maybe Bool)
p1WrAppingOptOut
= lens _p1WrAppingOptOut
(\ s a -> s{_p1WrAppingOptOut = a})
-- | Whether this placement is the primary placement of a roadblock
-- (placement group). You cannot change this field from true to false.
-- Setting this field to true will automatically set the primary field on
-- the original primary placement of the roadblock to false, and it will
-- automatically set the roadblock\'s primaryPlacementId field to the ID of
-- this placement.
p1Primary :: Lens' Placement (Maybe Bool)
p1Primary
= lens _p1Primary (\ s a -> s{_p1Primary = a})
-- | Lookback window settings for this placement.
p1LookbackConfiguration :: Lens' Placement (Maybe LookbackConfiguration)
p1LookbackConfiguration
= lens _p1LookbackConfiguration
(\ s a -> s{_p1LookbackConfiguration = a})
-- | Tag settings for this placement.
p1TagSetting :: Lens' Placement (Maybe TagSetting)
p1TagSetting
= lens _p1TagSetting (\ s a -> s{_p1TagSetting = a})
-- | ID of the content category assigned to this placement.
p1ContentCategoryId :: Lens' Placement (Maybe Int64)
p1ContentCategoryId
= lens _p1ContentCategoryId
(\ s a -> s{_p1ContentCategoryId = a})
. mapping _Coerce
-- | Dimension value for the ID of the directory site. This is a read-only,
-- auto-generated field.
p1DirectorySiteIdDimensionValue :: Lens' Placement (Maybe DimensionValue)
p1DirectorySiteIdDimensionValue
= lens _p1DirectorySiteIdDimensionValue
(\ s a -> s{_p1DirectorySiteIdDimensionValue = a})
-- | Account ID of this placement. This field can be left blank.
p1AccountId :: Lens' Placement (Maybe Int64)
p1AccountId
= lens _p1AccountId (\ s a -> s{_p1AccountId = a}) .
mapping _Coerce
-- | Payment source for this placement. This is a required field that is
-- read-only after insertion.
p1PaymentSource :: Lens' Placement (Maybe PlacementPaymentSource)
p1PaymentSource
= lens _p1PaymentSource
(\ s a -> s{_p1PaymentSource = a})
-- | Name of this placement.This is a required field and must be less than or
-- equal to 256 characters long.
p1Name :: Lens' Placement (Maybe Text)
p1Name = lens _p1Name (\ s a -> s{_p1Name = a})
-- | Additional sizes associated with this placement. When inserting or
-- updating a placement, only the size ID field is used.
p1AdditionalSizes :: Lens' Placement [Size]
p1AdditionalSizes
= lens _p1AdditionalSizes
(\ s a -> s{_p1AdditionalSizes = a})
. _Default
. _Coerce
-- | Directory site ID of this placement. On insert, you must set either this
-- field or the siteId field to specify the site associated with this
-- placement. This is a required field that is read-only after insertion.
p1DirectorySiteId :: Lens' Placement (Maybe Int64)
p1DirectorySiteId
= lens _p1DirectorySiteId
(\ s a -> s{_p1DirectorySiteId = a})
. mapping _Coerce
-- | Information about the creation of this placement. This is a read-only
-- field.
p1CreateInfo :: Lens' Placement (Maybe LastModifiedInfo)
p1CreateInfo
= lens _p1CreateInfo (\ s a -> s{_p1CreateInfo = a})
-- | Whether Verification and ActiveView are disabled for in-stream video
-- creatives for this placement. The same setting videoActiveViewOptOut
-- exists on the site level -- the opt out occurs if either of these
-- settings are true. These settings are distinct from
-- DirectorySites.settings.activeViewOptOut or
-- Sites.siteSettings.activeViewOptOut which only apply to display ads.
-- However, Accounts.activeViewOptOut opts out both video traffic, as well
-- as display ads, from Verification and ActiveView.
p1VideoActiveViewOptOut :: Lens' Placement (Maybe Bool)
p1VideoActiveViewOptOut
= lens _p1VideoActiveViewOptOut
(\ s a -> s{_p1VideoActiveViewOptOut = a})
-- | Information about the most recent modification of this placement. This
-- is a read-only field.
p1LastModifiedInfo :: Lens' Placement (Maybe LastModifiedInfo)
p1LastModifiedInfo
= lens _p1LastModifiedInfo
(\ s a -> s{_p1LastModifiedInfo = a})
-- | ID of this placement. This is a read-only, auto-generated field.
p1Id :: Lens' Placement (Maybe Int64)
p1Id
= lens _p1Id (\ s a -> s{_p1Id = a}) .
mapping _Coerce
-- | Whether creatives assigned to this placement must be SSL-compliant.
p1SSLRequired :: Lens' Placement (Maybe Bool)
p1SSLRequired
= lens _p1SSLRequired
(\ s a -> s{_p1SSLRequired = a})
-- | Subaccount ID of this placement. This field can be left blank.
p1SubAccountId :: Lens' Placement (Maybe Int64)
p1SubAccountId
= lens _p1SubAccountId
(\ s a -> s{_p1SubAccountId = a})
. mapping _Coerce
-- | Dimension value for the ID of the placement group. This is a read-only,
-- auto-generated field.
p1PlacementGroupIdDimensionValue :: Lens' Placement (Maybe DimensionValue)
p1PlacementGroupIdDimensionValue
= lens _p1PlacementGroupIdDimensionValue
(\ s a -> s{_p1PlacementGroupIdDimensionValue = a})
-- | External ID for this placement.
p1ExternalId :: Lens' Placement (Maybe Text)
p1ExternalId
= lens _p1ExternalId (\ s a -> s{_p1ExternalId = a})
-- | ID of this placement\'s group, if applicable.
p1PlacementGroupId :: Lens' Placement (Maybe Int64)
p1PlacementGroupId
= lens _p1PlacementGroupId
(\ s a -> s{_p1PlacementGroupId = a})
. mapping _Coerce
-- | Comments for this placement.
p1Comment :: Lens' Placement (Maybe Text)
p1Comment
= lens _p1Comment (\ s a -> s{_p1Comment = a})
-- | Site ID associated with this placement. On insert, you must set either
-- this field or the directorySiteId field to specify the site associated
-- with this placement. This is a required field that is read-only after
-- insertion.
p1SiteId :: Lens' Placement (Maybe Int64)
p1SiteId
= lens _p1SiteId (\ s a -> s{_p1SiteId = a}) .
mapping _Coerce
-- | Placement compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to
-- rendering on desktop, on mobile devices or in mobile apps for regular or
-- interstitial ads respectively. APP and APP_INTERSTITIAL are no longer
-- allowed for new placement insertions. Instead, use DISPLAY or
-- DISPLAY_INTERSTITIAL. IN_STREAM_VIDEO refers to rendering in in-stream
-- video ads developed with the VAST standard. This field is required on
-- insertion.
p1Compatibility :: Lens' Placement (Maybe PlacementCompatibility)
p1Compatibility
= lens _p1Compatibility
(\ s a -> s{_p1Compatibility = a})
-- | Whether this placement is archived.
p1Archived :: Lens' Placement (Maybe Bool)
p1Archived
= lens _p1Archived (\ s a -> s{_p1Archived = a})
-- | Whether payment was approved for this placement. This is a read-only
-- field relevant only to publisher-paid placements.
p1PaymentApproved :: Lens' Placement (Maybe Bool)
p1PaymentApproved
= lens _p1PaymentApproved
(\ s a -> s{_p1PaymentApproved = a})
-- | Information about the last publisher update. This is a read-only field.
p1PublisherUpdateInfo :: Lens' Placement (Maybe LastModifiedInfo)
p1PublisherUpdateInfo
= lens _p1PublisherUpdateInfo
(\ s a -> s{_p1PublisherUpdateInfo = a})
instance FromJSON Placement where
parseJSON
= withObject "Placement"
(\ o ->
Placement' <$>
(o .:? "status") <*> (o .:? "videoSettings") <*>
(o .:? "placementStrategyId")
<*> (o .:? "partnerWrappingData")
<*> (o .:? "tagFormats" .!= mempty)
<*> (o .:? "siteIdDimensionValue")
<*> (o .:? "pricingSchedule")
<*> (o .:? "size")
<*> (o .:? "kind")
<*> (o .:? "keyName")
<*> (o .:? "campaignIdDimensionValue")
<*> (o .:? "advertiserId")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "campaignId")
<*> (o .:? "idDimensionValue")
<*> (o .:? "vpaidAdapterChoice")
<*> (o .:? "adBlockingOptOut")
<*> (o .:? "wrappingOptOut")
<*> (o .:? "primary")
<*> (o .:? "lookbackConfiguration")
<*> (o .:? "tagSetting")
<*> (o .:? "contentCategoryId")
<*> (o .:? "directorySiteIdDimensionValue")
<*> (o .:? "accountId")
<*> (o .:? "paymentSource")
<*> (o .:? "name")
<*> (o .:? "additionalSizes" .!= mempty)
<*> (o .:? "directorySiteId")
<*> (o .:? "createInfo")
<*> (o .:? "videoActiveViewOptOut")
<*> (o .:? "lastModifiedInfo")
<*> (o .:? "id")
<*> (o .:? "sslRequired")
<*> (o .:? "subaccountId")
<*> (o .:? "placementGroupIdDimensionValue")
<*> (o .:? "externalId")
<*> (o .:? "placementGroupId")
<*> (o .:? "comment")
<*> (o .:? "siteId")
<*> (o .:? "compatibility")
<*> (o .:? "archived")
<*> (o .:? "paymentApproved")
<*> (o .:? "publisherUpdateInfo"))
instance ToJSON Placement where
toJSON Placement'{..}
= object
(catMaybes
[("status" .=) <$> _p1Status,
("videoSettings" .=) <$> _p1VideoSettings,
("placementStrategyId" .=) <$>
_p1PlacementStrategyId,
("partnerWrappingData" .=) <$>
_p1PartnerWrAppingData,
("tagFormats" .=) <$> _p1TagFormats,
("siteIdDimensionValue" .=) <$>
_p1SiteIdDimensionValue,
("pricingSchedule" .=) <$> _p1PricingSchedule,
("size" .=) <$> _p1Size, ("kind" .=) <$> _p1Kind,
("keyName" .=) <$> _p1KeyName,
("campaignIdDimensionValue" .=) <$>
_p1CampaignIdDimensionValue,
("advertiserId" .=) <$> _p1AdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_p1AdvertiserIdDimensionValue,
("campaignId" .=) <$> _p1CampaignId,
("idDimensionValue" .=) <$> _p1IdDimensionValue,
("vpaidAdapterChoice" .=) <$> _p1VpaidAdapterChoice,
("adBlockingOptOut" .=) <$> _p1AdBlockingOptOut,
("wrappingOptOut" .=) <$> _p1WrAppingOptOut,
("primary" .=) <$> _p1Primary,
("lookbackConfiguration" .=) <$>
_p1LookbackConfiguration,
("tagSetting" .=) <$> _p1TagSetting,
("contentCategoryId" .=) <$> _p1ContentCategoryId,
("directorySiteIdDimensionValue" .=) <$>
_p1DirectorySiteIdDimensionValue,
("accountId" .=) <$> _p1AccountId,
("paymentSource" .=) <$> _p1PaymentSource,
("name" .=) <$> _p1Name,
("additionalSizes" .=) <$> _p1AdditionalSizes,
("directorySiteId" .=) <$> _p1DirectorySiteId,
("createInfo" .=) <$> _p1CreateInfo,
("videoActiveViewOptOut" .=) <$>
_p1VideoActiveViewOptOut,
("lastModifiedInfo" .=) <$> _p1LastModifiedInfo,
("id" .=) <$> _p1Id,
("sslRequired" .=) <$> _p1SSLRequired,
("subaccountId" .=) <$> _p1SubAccountId,
("placementGroupIdDimensionValue" .=) <$>
_p1PlacementGroupIdDimensionValue,
("externalId" .=) <$> _p1ExternalId,
("placementGroupId" .=) <$> _p1PlacementGroupId,
("comment" .=) <$> _p1Comment,
("siteId" .=) <$> _p1SiteId,
("compatibility" .=) <$> _p1Compatibility,
("archived" .=) <$> _p1Archived,
("paymentApproved" .=) <$> _p1PaymentApproved,
("publisherUpdateInfo" .=) <$>
_p1PublisherUpdateInfo])
-- | A description of how user IDs are encrypted.
--
-- /See:/ 'encryptionInfo' smart constructor.
data EncryptionInfo =
EncryptionInfo'
{ _eiEncryptionSource :: !(Maybe EncryptionInfoEncryptionSource)
, _eiKind :: !(Maybe Text)
, _eiEncryptionEntityType :: !(Maybe EncryptionInfoEncryptionEntityType)
, _eiEncryptionEntityId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'EncryptionInfo' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'eiEncryptionSource'
--
-- * 'eiKind'
--
-- * 'eiEncryptionEntityType'
--
-- * 'eiEncryptionEntityId'
encryptionInfo
:: EncryptionInfo
encryptionInfo =
EncryptionInfo'
{ _eiEncryptionSource = Nothing
, _eiKind = Nothing
, _eiEncryptionEntityType = Nothing
, _eiEncryptionEntityId = Nothing
}
-- | Describes whether the encrypted cookie was received from ad serving (the
-- %m macro) or from Data Transfer.
eiEncryptionSource :: Lens' EncryptionInfo (Maybe EncryptionInfoEncryptionSource)
eiEncryptionSource
= lens _eiEncryptionSource
(\ s a -> s{_eiEncryptionSource = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#encryptionInfo\".
eiKind :: Lens' EncryptionInfo (Maybe Text)
eiKind = lens _eiKind (\ s a -> s{_eiKind = a})
-- | The encryption entity type. This should match the encryption
-- configuration for ad serving or Data Transfer.
eiEncryptionEntityType :: Lens' EncryptionInfo (Maybe EncryptionInfoEncryptionEntityType)
eiEncryptionEntityType
= lens _eiEncryptionEntityType
(\ s a -> s{_eiEncryptionEntityType = a})
-- | The encryption entity ID. This should match the encryption configuration
-- for ad serving or Data Transfer.
eiEncryptionEntityId :: Lens' EncryptionInfo (Maybe Int64)
eiEncryptionEntityId
= lens _eiEncryptionEntityId
(\ s a -> s{_eiEncryptionEntityId = a})
. mapping _Coerce
instance FromJSON EncryptionInfo where
parseJSON
= withObject "EncryptionInfo"
(\ o ->
EncryptionInfo' <$>
(o .:? "encryptionSource") <*> (o .:? "kind") <*>
(o .:? "encryptionEntityType")
<*> (o .:? "encryptionEntityId"))
instance ToJSON EncryptionInfo where
toJSON EncryptionInfo'{..}
= object
(catMaybes
[("encryptionSource" .=) <$> _eiEncryptionSource,
("kind" .=) <$> _eiKind,
("encryptionEntityType" .=) <$>
_eiEncryptionEntityType,
("encryptionEntityId" .=) <$> _eiEncryptionEntityId])
-- | Site List Response
--
-- /See:/ 'sitesListResponse' smart constructor.
data SitesListResponse =
SitesListResponse'
{ _sitNextPageToken :: !(Maybe Text)
, _sitKind :: !(Maybe Text)
, _sitSites :: !(Maybe [Site])
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'SitesListResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sitNextPageToken'
--
-- * 'sitKind'
--
-- * 'sitSites'
sitesListResponse
:: SitesListResponse
sitesListResponse =
SitesListResponse'
{_sitNextPageToken = Nothing, _sitKind = Nothing, _sitSites = Nothing}
-- | Pagination token to be used for the next list operation.
sitNextPageToken :: Lens' SitesListResponse (Maybe Text)
sitNextPageToken
= lens _sitNextPageToken
(\ s a -> s{_sitNextPageToken = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#sitesListResponse\".
sitKind :: Lens' SitesListResponse (Maybe Text)
sitKind = lens _sitKind (\ s a -> s{_sitKind = a})
-- | Site collection.
sitSites :: Lens' SitesListResponse [Site]
sitSites
= lens _sitSites (\ s a -> s{_sitSites = a}) .
_Default
. _Coerce
instance FromJSON SitesListResponse where
parseJSON
= withObject "SitesListResponse"
(\ o ->
SitesListResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "kind") <*>
(o .:? "sites" .!= mempty))
instance ToJSON SitesListResponse where
toJSON SitesListResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _sitNextPageToken,
("kind" .=) <$> _sitKind,
("sites" .=) <$> _sitSites])
-- | Contains properties of a targeting template. A targeting template
-- encapsulates targeting information which can be reused across multiple
-- ads.
--
-- /See:/ 'targetingTemplate' smart constructor.
data TargetingTemplate =
TargetingTemplate'
{ _ttGeoTargeting :: !(Maybe GeoTargeting)
, _ttTechnologyTargeting :: !(Maybe TechnologyTargeting)
, _ttDayPartTargeting :: !(Maybe DayPartTargeting)
, _ttKind :: !(Maybe Text)
, _ttAdvertiserId :: !(Maybe (Textual Int64))
, _ttAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _ttAccountId :: !(Maybe (Textual Int64))
, _ttName :: !(Maybe Text)
, _ttKeyValueTargetingExpression :: !(Maybe KeyValueTargetingExpression)
, _ttId :: !(Maybe (Textual Int64))
, _ttSubAccountId :: !(Maybe (Textual Int64))
, _ttLanguageTargeting :: !(Maybe LanguageTargeting)
, _ttListTargetingExpression :: !(Maybe ListTargetingExpression)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'TargetingTemplate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ttGeoTargeting'
--
-- * 'ttTechnologyTargeting'
--
-- * 'ttDayPartTargeting'
--
-- * 'ttKind'
--
-- * 'ttAdvertiserId'
--
-- * 'ttAdvertiserIdDimensionValue'
--
-- * 'ttAccountId'
--
-- * 'ttName'
--
-- * 'ttKeyValueTargetingExpression'
--
-- * 'ttId'
--
-- * 'ttSubAccountId'
--
-- * 'ttLanguageTargeting'
--
-- * 'ttListTargetingExpression'
targetingTemplate
:: TargetingTemplate
targetingTemplate =
TargetingTemplate'
{ _ttGeoTargeting = Nothing
, _ttTechnologyTargeting = Nothing
, _ttDayPartTargeting = Nothing
, _ttKind = Nothing
, _ttAdvertiserId = Nothing
, _ttAdvertiserIdDimensionValue = Nothing
, _ttAccountId = Nothing
, _ttName = Nothing
, _ttKeyValueTargetingExpression = Nothing
, _ttId = Nothing
, _ttSubAccountId = Nothing
, _ttLanguageTargeting = Nothing
, _ttListTargetingExpression = Nothing
}
-- | Geographical targeting criteria.
ttGeoTargeting :: Lens' TargetingTemplate (Maybe GeoTargeting)
ttGeoTargeting
= lens _ttGeoTargeting
(\ s a -> s{_ttGeoTargeting = a})
-- | Technology platform targeting criteria.
ttTechnologyTargeting :: Lens' TargetingTemplate (Maybe TechnologyTargeting)
ttTechnologyTargeting
= lens _ttTechnologyTargeting
(\ s a -> s{_ttTechnologyTargeting = a})
-- | Time and day targeting criteria.
ttDayPartTargeting :: Lens' TargetingTemplate (Maybe DayPartTargeting)
ttDayPartTargeting
= lens _ttDayPartTargeting
(\ s a -> s{_ttDayPartTargeting = a})
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#targetingTemplate\".
ttKind :: Lens' TargetingTemplate (Maybe Text)
ttKind = lens _ttKind (\ s a -> s{_ttKind = a})
-- | Advertiser ID of this targeting template. This is a required field on
-- insert and is read-only after insert.
ttAdvertiserId :: Lens' TargetingTemplate (Maybe Int64)
ttAdvertiserId
= lens _ttAdvertiserId
(\ s a -> s{_ttAdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
ttAdvertiserIdDimensionValue :: Lens' TargetingTemplate (Maybe DimensionValue)
ttAdvertiserIdDimensionValue
= lens _ttAdvertiserIdDimensionValue
(\ s a -> s{_ttAdvertiserIdDimensionValue = a})
-- | Account ID of this targeting template. This field, if left unset, will
-- be auto-generated on insert and is read-only after insert.
ttAccountId :: Lens' TargetingTemplate (Maybe Int64)
ttAccountId
= lens _ttAccountId (\ s a -> s{_ttAccountId = a}) .
mapping _Coerce
-- | Name of this targeting template. This field is required. It must be less
-- than 256 characters long and unique within an advertiser.
ttName :: Lens' TargetingTemplate (Maybe Text)
ttName = lens _ttName (\ s a -> s{_ttName = a})
-- | Key-value targeting criteria.
ttKeyValueTargetingExpression :: Lens' TargetingTemplate (Maybe KeyValueTargetingExpression)
ttKeyValueTargetingExpression
= lens _ttKeyValueTargetingExpression
(\ s a -> s{_ttKeyValueTargetingExpression = a})
-- | ID of this targeting template. This is a read-only, auto-generated
-- field.
ttId :: Lens' TargetingTemplate (Maybe Int64)
ttId
= lens _ttId (\ s a -> s{_ttId = a}) .
mapping _Coerce
-- | Subaccount ID of this targeting template. This field, if left unset,
-- will be auto-generated on insert and is read-only after insert.
ttSubAccountId :: Lens' TargetingTemplate (Maybe Int64)
ttSubAccountId
= lens _ttSubAccountId
(\ s a -> s{_ttSubAccountId = a})
. mapping _Coerce
-- | Language targeting criteria.
ttLanguageTargeting :: Lens' TargetingTemplate (Maybe LanguageTargeting)
ttLanguageTargeting
= lens _ttLanguageTargeting
(\ s a -> s{_ttLanguageTargeting = a})
-- | Remarketing list targeting criteria.
ttListTargetingExpression :: Lens' TargetingTemplate (Maybe ListTargetingExpression)
ttListTargetingExpression
= lens _ttListTargetingExpression
(\ s a -> s{_ttListTargetingExpression = a})
instance FromJSON TargetingTemplate where
parseJSON
= withObject "TargetingTemplate"
(\ o ->
TargetingTemplate' <$>
(o .:? "geoTargeting") <*>
(o .:? "technologyTargeting")
<*> (o .:? "dayPartTargeting")
<*> (o .:? "kind")
<*> (o .:? "advertiserId")
<*> (o .:? "advertiserIdDimensionValue")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "keyValueTargetingExpression")
<*> (o .:? "id")
<*> (o .:? "subaccountId")
<*> (o .:? "languageTargeting")
<*> (o .:? "listTargetingExpression"))
instance ToJSON TargetingTemplate where
toJSON TargetingTemplate'{..}
= object
(catMaybes
[("geoTargeting" .=) <$> _ttGeoTargeting,
("technologyTargeting" .=) <$>
_ttTechnologyTargeting,
("dayPartTargeting" .=) <$> _ttDayPartTargeting,
("kind" .=) <$> _ttKind,
("advertiserId" .=) <$> _ttAdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_ttAdvertiserIdDimensionValue,
("accountId" .=) <$> _ttAccountId,
("name" .=) <$> _ttName,
("keyValueTargetingExpression" .=) <$>
_ttKeyValueTargetingExpression,
("id" .=) <$> _ttId,
("subaccountId" .=) <$> _ttSubAccountId,
("languageTargeting" .=) <$> _ttLanguageTargeting,
("listTargetingExpression" .=) <$>
_ttListTargetingExpression])
-- | Contains properties of a creative field.
--
-- /See:/ 'creativeField' smart constructor.
data CreativeField =
CreativeField'
{ _cffKind :: !(Maybe Text)
, _cffAdvertiserId :: !(Maybe (Textual Int64))
, _cffAdvertiserIdDimensionValue :: !(Maybe DimensionValue)
, _cffAccountId :: !(Maybe (Textual Int64))
, _cffName :: !(Maybe Text)
, _cffId :: !(Maybe (Textual Int64))
, _cffSubAccountId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'CreativeField' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cffKind'
--
-- * 'cffAdvertiserId'
--
-- * 'cffAdvertiserIdDimensionValue'
--
-- * 'cffAccountId'
--
-- * 'cffName'
--
-- * 'cffId'
--
-- * 'cffSubAccountId'
creativeField
:: CreativeField
creativeField =
CreativeField'
{ _cffKind = Nothing
, _cffAdvertiserId = Nothing
, _cffAdvertiserIdDimensionValue = Nothing
, _cffAccountId = Nothing
, _cffName = Nothing
, _cffId = Nothing
, _cffSubAccountId = Nothing
}
-- | Identifies what kind of resource this is. Value: the fixed string
-- \"dfareporting#creativeField\".
cffKind :: Lens' CreativeField (Maybe Text)
cffKind = lens _cffKind (\ s a -> s{_cffKind = a})
-- | Advertiser ID of this creative field. This is a required field on
-- insertion.
cffAdvertiserId :: Lens' CreativeField (Maybe Int64)
cffAdvertiserId
= lens _cffAdvertiserId
(\ s a -> s{_cffAdvertiserId = a})
. mapping _Coerce
-- | Dimension value for the ID of the advertiser. This is a read-only,
-- auto-generated field.
cffAdvertiserIdDimensionValue :: Lens' CreativeField (Maybe DimensionValue)
cffAdvertiserIdDimensionValue
= lens _cffAdvertiserIdDimensionValue
(\ s a -> s{_cffAdvertiserIdDimensionValue = a})
-- | Account ID of this creative field. This is a read-only field that can be
-- left blank.
cffAccountId :: Lens' CreativeField (Maybe Int64)
cffAccountId
= lens _cffAccountId (\ s a -> s{_cffAccountId = a})
. mapping _Coerce
-- | Name of this creative field. This is a required field and must be less
-- than 256 characters long and unique among creative fields of the same
-- advertiser.
cffName :: Lens' CreativeField (Maybe Text)
cffName = lens _cffName (\ s a -> s{_cffName = a})
-- | ID of this creative field. This is a read-only, auto-generated field.
cffId :: Lens' CreativeField (Maybe Int64)
cffId
= lens _cffId (\ s a -> s{_cffId = a}) .
mapping _Coerce
-- | Subaccount ID of this creative field. This is a read-only field that can
-- be left blank.
cffSubAccountId :: Lens' CreativeField (Maybe Int64)
cffSubAccountId
= lens _cffSubAccountId
(\ s a -> s{_cffSubAccountId = a})
. mapping _Coerce
instance FromJSON CreativeField where
parseJSON
= withObject "CreativeField"
(\ o ->
CreativeField' <$>
(o .:? "kind") <*> (o .:? "advertiserId") <*>
(o .:? "advertiserIdDimensionValue")
<*> (o .:? "accountId")
<*> (o .:? "name")
<*> (o .:? "id")
<*> (o .:? "subaccountId"))
instance ToJSON CreativeField where
toJSON CreativeField'{..}
= object
(catMaybes
[("kind" .=) <$> _cffKind,
("advertiserId" .=) <$> _cffAdvertiserId,
("advertiserIdDimensionValue" .=) <$>
_cffAdvertiserIdDimensionValue,
("accountId" .=) <$> _cffAccountId,
("name" .=) <$> _cffName, ("id" .=) <$> _cffId,
("subaccountId" .=) <$> _cffSubAccountId])
-- | Properties of inheriting and overriding the default click-through event
-- tag. A campaign may override the event tag defined at the advertiser
-- level, and an ad may also override the campaign\'s setting further.
--
-- /See:/ 'defaultClickThroughEventTagProperties' smart constructor.
data DefaultClickThroughEventTagProperties =
DefaultClickThroughEventTagProperties'
{ _dctetpOverrideInheritedEventTag :: !(Maybe Bool)
, _dctetpDefaultClickThroughEventTagId :: !(Maybe (Textual Int64))
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'DefaultClickThroughEventTagProperties' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dctetpOverrideInheritedEventTag'
--
-- * 'dctetpDefaultClickThroughEventTagId'
defaultClickThroughEventTagProperties
:: DefaultClickThroughEventTagProperties
defaultClickThroughEventTagProperties =
DefaultClickThroughEventTagProperties'
{ _dctetpOverrideInheritedEventTag = Nothing
, _dctetpDefaultClickThroughEventTagId = Nothing
}
-- | Whether this entity should override the inherited default click-through
-- event tag with its own defined value.
dctetpOverrideInheritedEventTag :: Lens' DefaultClickThroughEventTagProperties (Maybe Bool)
dctetpOverrideInheritedEventTag
= lens _dctetpOverrideInheritedEventTag
(\ s a -> s{_dctetpOverrideInheritedEventTag = a})
-- | ID of the click-through event tag to apply to all ads in this entity\'s
-- scope.
dctetpDefaultClickThroughEventTagId :: Lens' DefaultClickThroughEventTagProperties (Maybe Int64)
dctetpDefaultClickThroughEventTagId
= lens _dctetpDefaultClickThroughEventTagId
(\ s a ->
s{_dctetpDefaultClickThroughEventTagId = a})
. mapping _Coerce
instance FromJSON
DefaultClickThroughEventTagProperties
where
parseJSON
= withObject "DefaultClickThroughEventTagProperties"
(\ o ->
DefaultClickThroughEventTagProperties' <$>
(o .:? "overrideInheritedEventTag") <*>
(o .:? "defaultClickThroughEventTagId"))
instance ToJSON DefaultClickThroughEventTagProperties
where
toJSON DefaultClickThroughEventTagProperties'{..}
= object
(catMaybes
[("overrideInheritedEventTag" .=) <$>
_dctetpOverrideInheritedEventTag,
("defaultClickThroughEventTagId" .=) <$>
_dctetpDefaultClickThroughEventTagId])
-- | Remarketing List Targeting Expression.
--
-- /See:/ 'listTargetingExpression' smart constructor.
newtype ListTargetingExpression =
ListTargetingExpression'
{ _lteExpression :: Maybe Text
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ListTargetingExpression' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lteExpression'
listTargetingExpression
:: ListTargetingExpression
listTargetingExpression = ListTargetingExpression' {_lteExpression = Nothing}
-- | Expression describing which lists are being targeted by the ad.
lteExpression :: Lens' ListTargetingExpression (Maybe Text)
lteExpression
= lens _lteExpression
(\ s a -> s{_lteExpression = a})
instance FromJSON ListTargetingExpression where
parseJSON
= withObject "ListTargetingExpression"
(\ o ->
ListTargetingExpression' <$> (o .:? "expression"))
instance ToJSON ListTargetingExpression where
toJSON ListTargetingExpression'{..}
= object
(catMaybes [("expression" .=) <$> _lteExpression])
|
brendanhay/gogol
|
gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs
|
mpl-2.0
| 852,224
| 0
| 75
| 205,679
| 157,411
| 90,579
| 66,832
| 17,661
| 1
|
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- |
-- Module : Network.Google.Resource.Monitoring.Projects.NotificationChannelDescriptors.Get
-- Copyright : (c) 2015-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets a single channel descriptor. The descriptor indicates which fields
-- are expected \/ permitted for a notification channel of the given type.
--
-- /See:/ <https://cloud.google.com/monitoring/api/ Cloud Monitoring API Reference> for @monitoring.projects.notificationChannelDescriptors.get@.
module Network.Google.Resource.Monitoring.Projects.NotificationChannelDescriptors.Get
(
-- * REST Resource
ProjectsNotificationChannelDescriptorsGetResource
-- * Creating a Request
, projectsNotificationChannelDescriptorsGet
, ProjectsNotificationChannelDescriptorsGet
-- * Request Lenses
, pncdgXgafv
, pncdgUploadProtocol
, pncdgAccessToken
, pncdgUploadType
, pncdgName
, pncdgCallback
) where
import Network.Google.Monitoring.Types
import Network.Google.Prelude
-- | A resource alias for @monitoring.projects.notificationChannelDescriptors.get@ method which the
-- 'ProjectsNotificationChannelDescriptorsGet' request conforms to.
type ProjectsNotificationChannelDescriptorsGetResource
=
"v3" :>
Capture "name" Text :>
QueryParam "$.xgafv" Xgafv :>
QueryParam "upload_protocol" Text :>
QueryParam "access_token" Text :>
QueryParam "uploadType" Text :>
QueryParam "callback" Text :>
QueryParam "alt" AltJSON :>
Get '[JSON] NotificationChannelDescriptor
-- | Gets a single channel descriptor. The descriptor indicates which fields
-- are expected \/ permitted for a notification channel of the given type.
--
-- /See:/ 'projectsNotificationChannelDescriptorsGet' smart constructor.
data ProjectsNotificationChannelDescriptorsGet =
ProjectsNotificationChannelDescriptorsGet'
{ _pncdgXgafv :: !(Maybe Xgafv)
, _pncdgUploadProtocol :: !(Maybe Text)
, _pncdgAccessToken :: !(Maybe Text)
, _pncdgUploadType :: !(Maybe Text)
, _pncdgName :: !Text
, _pncdgCallback :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
-- | Creates a value of 'ProjectsNotificationChannelDescriptorsGet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pncdgXgafv'
--
-- * 'pncdgUploadProtocol'
--
-- * 'pncdgAccessToken'
--
-- * 'pncdgUploadType'
--
-- * 'pncdgName'
--
-- * 'pncdgCallback'
projectsNotificationChannelDescriptorsGet
:: Text -- ^ 'pncdgName'
-> ProjectsNotificationChannelDescriptorsGet
projectsNotificationChannelDescriptorsGet pPncdgName_ =
ProjectsNotificationChannelDescriptorsGet'
{ _pncdgXgafv = Nothing
, _pncdgUploadProtocol = Nothing
, _pncdgAccessToken = Nothing
, _pncdgUploadType = Nothing
, _pncdgName = pPncdgName_
, _pncdgCallback = Nothing
}
-- | V1 error format.
pncdgXgafv :: Lens' ProjectsNotificationChannelDescriptorsGet (Maybe Xgafv)
pncdgXgafv
= lens _pncdgXgafv (\ s a -> s{_pncdgXgafv = a})
-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pncdgUploadProtocol :: Lens' ProjectsNotificationChannelDescriptorsGet (Maybe Text)
pncdgUploadProtocol
= lens _pncdgUploadProtocol
(\ s a -> s{_pncdgUploadProtocol = a})
-- | OAuth access token.
pncdgAccessToken :: Lens' ProjectsNotificationChannelDescriptorsGet (Maybe Text)
pncdgAccessToken
= lens _pncdgAccessToken
(\ s a -> s{_pncdgAccessToken = a})
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
pncdgUploadType :: Lens' ProjectsNotificationChannelDescriptorsGet (Maybe Text)
pncdgUploadType
= lens _pncdgUploadType
(\ s a -> s{_pncdgUploadType = a})
-- | Required. The channel type for which to execute the request. The format
-- is:
-- projects\/[PROJECT_ID_OR_NUMBER]\/notificationChannelDescriptors\/[CHANNEL_TYPE]
pncdgName :: Lens' ProjectsNotificationChannelDescriptorsGet Text
pncdgName
= lens _pncdgName (\ s a -> s{_pncdgName = a})
-- | JSONP
pncdgCallback :: Lens' ProjectsNotificationChannelDescriptorsGet (Maybe Text)
pncdgCallback
= lens _pncdgCallback
(\ s a -> s{_pncdgCallback = a})
instance GoogleRequest
ProjectsNotificationChannelDescriptorsGet
where
type Rs ProjectsNotificationChannelDescriptorsGet =
NotificationChannelDescriptor
type Scopes ProjectsNotificationChannelDescriptorsGet
=
'["https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/monitoring",
"https://www.googleapis.com/auth/monitoring.read"]
requestClient
ProjectsNotificationChannelDescriptorsGet'{..}
= go _pncdgName _pncdgXgafv _pncdgUploadProtocol
_pncdgAccessToken
_pncdgUploadType
_pncdgCallback
(Just AltJSON)
monitoringService
where go
= buildClient
(Proxy ::
Proxy
ProjectsNotificationChannelDescriptorsGetResource)
mempty
|
brendanhay/gogol
|
gogol-monitoring/gen/Network/Google/Resource/Monitoring/Projects/NotificationChannelDescriptors/Get.hs
|
mpl-2.0
| 5,872
| 0
| 15
| 1,244
| 705
| 414
| 291
| 111
| 1
|
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
module X where
import Parser (IniAsNestedMap,
parseIniToNestedMap)
import Tortellini
------------------------------------------------------------------------------
import Control.Monad.Trans.Except
import Data.Bifunctor
import Data.List.NonEmpty
import Data.Text (Text)
import qualified Data.Text as T
import GHC.Generics
------------------------------------------------------------------------------
parseIniToNestedMap' :: Text -> Either (NonEmpty TortError) IniAsNestedMap
parseIniToNestedMap' s = first (pure . ErrorInParsing . T.pack) $ parseIniToNestedMap s
iniAsNestedMapToRep
:: ReadDocumentSections (Rep record)
=> IniAsNestedMap -> Either (NonEmpty TortError) (Rep record x)
iniAsNestedMapToRep = runExcept . readDocumentSections
iniRepToRecord :: Generic a => Rep a x -> a
iniRepToRecord = to
parseIni'
:: ReadDocumentSections (Rep record)
=> Text
-> Rep record x
parseIni' s =
case parseIniToNestedMap s of
Left e -> error e
Right m -> case runExcept $ readDocumentSections m of
Left _ -> error "X"
Right r -> r
|
haroldcarr/learn-haskell-coq-ml-etc
|
haskell/topic/generics/ghc-generics/2017-12-justin-woo-two-tortellini/src/X.hs
|
unlicense
| 1,309
| 0
| 11
| 342
| 285
| 149
| 136
| 30
| 3
|
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Cloud.Haskzure.Resources.Networking where
import qualified Data.ByteString.Char8 as BS
import GHC.Generics (Generic)
import Cloud.Haskzure.Core.Utils ()
import Cloud.Haskzure.Gen.Instances (mkJSONInsts)
data AddressSpace = AddressSpace {
addressSpaceAddressPrefixes :: [BS.ByteString]
} deriving (Generic, Show, Eq)
mkJSONInsts ''AddressSpace
data DhcpOptions = DhcpOptions {
dhcpOptionsDnsServers :: [BS.ByteString]
} deriving (Generic, Show, Eq)
mkJSONInsts ''DhcpOptions
data Subnet = Subnet {
subnetName :: BS.ByteString,
subnetAddressPrefix :: BS.ByteString
-- subnetIpConfigurations :: [IPConfiguration] staging issue...
} deriving (Generic, Show, Eq)
mkJSONInsts ''Subnet
data IPConfiguration = IPConfiguration {
ipConfigurationPrivateIPAddress :: BS.ByteString,
-- TODO: Enum:
ipConfigurationPrivateIPAllocationMethod :: BS.ByteString,
ipConfigurationSubnet :: Subnet
} deriving (Generic, Show, Eq)
mkJSONInsts ''IPConfiguration
data PublicIPAddress = PublicIPAddress {
-- TODO: Enum:
publicIPAddressPublicIPAllocationMethod :: BS.ByteString,
publicIPIpConfiguration :: IPConfiguration
} deriving (Generic, Show, Eq)
mkJSONInsts ''PublicIPAddress
data VN = VN {
vnAddressSpace :: AddressSpace,
vnDhcpOptions :: DhcpOptions,
vnSubnets :: [Subnet]
} deriving (Generic, Show, Eq)
mkJSONInsts ''VN
|
aznashwan/haskzure
|
Cloud/Haskzure/Resources/Networking.hs
|
apache-2.0
| 1,686
| 0
| 10
| 427
| 342
| 197
| 145
| 38
| 0
|
import Sprockell
import Data.Char
{-|
This program demonstrates the character IO system.
We ask the users name.
And print a custom greeting.
-}
prog :: [Instruction]
prog =
writeString "What is your name? " ++
[ Load (ImmValue $ ord '\n') regE -- ASCII code newline in regE for later reference
-- "beginInputLoop": 39
, ReadInstr charIO -- Request a character from stdin
, Receive regA -- Save it in regA (as ASCII code)
, Branch regA (Rel 2)
, Jump (Rel (-3)) -- got 0, no input available, try again
-- got input char
, Compute Equal regA regE regC -- check if it's a newline (remember: in regE)
, Branch regC (Rel 4) -- then jump to "inputDone"
, Store regA (IndAddr regB) -- else store character in local memory
, Compute Incr regB regB regB
, Jump (Rel (-8)) -- "beginInputLoop"
]
-- "inputDone"
++ writeString "Hello "
++
-- "beginLoopOutput"
[ Load (IndAddr regD) regA
, WriteInstr regA charIO
, Compute Incr regD regD regD
, Compute NEq regB regD regC
, Branch regC (Rel (-4)) -- target "loopOutput"
]
++ writeString "!\n"
++ [EndProg]
-- | Generate code to print a (Haskell) String
writeString :: String -> [Instruction]
writeString str = concat $ map writeChar str
-- | Generate code to print a single character
writeChar :: Char -> [Instruction]
writeChar c =
[ Load (ImmValue $ ord c) regA
, WriteInstr regA charIO
]
-- =====================================================================
-- examples for running with/without debug information
-- =====================================================================
-- main: run without debugger
main = run [prog]
-- main_0: no debug information
main_0 = runWithDebugger noDebugger [prog]
-- main_1: shows all intermediate local states
main_1 = runWithDebugger (debuggerSimplePrint showLocalMem) [prog]
showLocalMem :: DbgInput -> String
showLocalMem ( _ , systemState ) = show $ localMem $ head $ sprStates systemState
-- main_2: shows local state only in case the sprockell writes to it
main_2 = runWithDebugger (debuggerPrintCondWaitCond showLocalMem doesLocalMemWrite never) [prog]
doesLocalMemWrite :: DbgInput -> Bool
doesLocalMemWrite (instrs,st) = any isStoreInstr instrs
where
isStoreInstr (Store _ _) = True
isStoreInstr _ = False
|
wouwouwou/2017_module_8
|
src/haskell/PP-project-2017/lib/sprockell-2017/src/DemoCharIO.hs
|
apache-2.0
| 2,495
| 0
| 15
| 637
| 505
| 272
| 233
| 40
| 2
|
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
import Graphics.GL.Pal
import Graphics.GL.Freetype
import Graphics.GL.TextBuffer
import Graphics.VR.Pal
import SDL hiding (get)
import Control.Monad.State
import Control.Monad.Reader
import Control.Lens.Extra
import System.Random
import Halive.Utils
data Uniforms = Uniforms
{ uMVP :: UniformLocation (M44 GLfloat)
, uColor :: UniformLocation (V4 GLfloat)
} deriving Data
-------------------------------------------------------------
-- A test of scaling text to fit a container
-------------------------------------------------------------
frameChars = unlines
[ "X"
, "$MALL"
, "Hello"
, "What's"
--, "Up"
--, "Doc"
--, "Who's~~~~~~~~~~~"
--, "The"
--, "Best"
--, "Around"
]
main :: IO ()
main = do
VRPal{vrpWindow=window} <- reacquire 0 $ initVRPal "Text GL"
glyphProg <- createShaderProgram "test/glyph.vert" "test/glyph.frag"
font <- createFont "test/SourceCodePro-Regular.ttf" 100 glyphProg
shader <- createShaderProgram "test/geo.vert" "test/geo.frag"
planeGeo <- planeGeometry 1 (V3 0 0 1) (V3 0 1 0) 5
planeShape <- makeShape planeGeo shader
glClearColor 0 0.1 0.1 1
-- glEnable GL_DEPTH_TEST
glEnable GL_BLEND
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
--glGetErrors
textRenderer <- createTextRenderer font (textBufferFromString frameChars)
void . flip runStateT textRenderer . whileWindow window $ \events ->
mainLoop window events font planeShape
mainLoop :: (MonadIO m, MonadState TextRenderer m) => Window -> [Event] -> Font -> Shape Uniforms -> m ()
mainLoop win events font planeShape = do
--glGetErrors
-- Get mouse/keyboard/OS events from GLFW
es <- gatherEvents events
forM_ es $ closeOnEscape win
-- Update the viewport and projection
(x,y,w,h) <- getWindowViewport win
glViewport x y w h
projection44 <- getWindowProjection win 45 0.01 1000
-- Clear the framebuffer
glClear (GL_COLOR_BUFFER_BIT .|. GL_DEPTH_BUFFER_BIT)
-- Create our model view projection matrix
let textPos = V3 0 0 (-1)
model44 = mkTransformation 1 textPos
view44 = lookAt (V3 0 0 0) textPos (V3 0 1 0)
projView44 = projection44 !*! view44
mvp = projection44 !*! view44 !*! model44
mvpX = projection44 !*! view44 !*! model44 !*! scaleMatrix (V3 1 0.002 1)
mvpY = projection44 !*! view44 !*! model44 !*! scaleMatrix (V3 0.002 1 1)
glEnable GL_STENCIL_TEST
glClear GL_STENCIL_BUFFER_BIT -- Clear stencil buffer (0 by default)
glStencilOp GL_KEEP GL_KEEP GL_REPLACE -- sfail dpfail dppfail
-- Draw background
glStencilFunc GL_ALWAYS 1 0xFF -- Set any stencil to 1
glStencilMask 0xFF -- Write to stencil buffer
withShape planeShape $ do
Uniforms{..} <- asks sUniforms
uniformV4 uColor (V4 0.2 0.5 0.2 1)
uniformM44 uMVP mvp
drawShape
uniformV4 uColor (V4 0.2 0.0 0.2 1)
uniformM44 uMVP mvpX
drawShape
uniformM44 uMVP mvpY
drawShape
-- Leaving this here so we can test updating chars later
--txrTextBuffer .= textBufferFromString frameChars
--put =<< updateMetrics =<< get
-- Draw clipped thing
glStencilFunc GL_EQUAL 1 0xFF -- Pass test if stencil value is 1
glStencilMask 0x00 -- Don't write anything to stencil buffer
textRenderer <- use id
let numLines = 10
scrollLines = -2
scrollColumns = 3
charWidthGL = gmAdvanceX (glyMetrics (fntGlyphForChar font $ '_')) / (fntPointSize font)
scrollM44 = translateMatrix (V3 (scrollColumns * charWidthGL) scrollLines 0)
renderText textRenderer projView44 (model44 !*! scaleMatrix (recip numLines) !*! scrollM44)
glDisable GL_STENCIL_TEST
glSwapWindow win
|
lukexi/text-gl
|
test/TestScroll.hs
|
bsd-2-clause
| 4,050
| 0
| 16
| 1,009
| 942
| 467
| 475
| 78
| 1
|
module QACG.CircGen.Mult.SimpleMult
( simpleMult
,mkSimpleMult
) where
import QACG.CircUtils.Circuit
import QACG.CircUtils.CircuitState
import Control.Monad.State
import QACG.CircGen.Add.SimpleRipple
import QACG.CircGen.Bit.Toffoli
import Control.Exception(assert)
-- | Generates a simple addition based multiplication circuit
mkSimpleMult :: [String] -> [String] -> Circuit
mkSimpleMult aLns bLns = circ
where (_,(_,_,circ)) = runState go ([], ['c':show x|x<-[0..3*(length aLns + 1)]],Circuit (LineInfo [] [] [] []) [] [])
go = do a <- initLines aLns
b <- initLines bLns
mOut <- simpleMult a b
setOutputs $ a ++ b ++ mOut
simpleMult :: [String] -> [String] -> CircuitState [String]
simpleMult a b = do
out <- getConst $ 2 * length a
start (head a) b out
applyAdders (tail a) b (tail out)
return out
where start x (y:[]) (c:_) = tof x y c
start x (y:ys) (c:cs) = do tof x y c
start x ys cs
start _ _ _ = assert False $ return () --Should never happen!
applyAdders [] _ _ = return ()
applyAdders (x:xs) ys out = do _ <- simpleCtrlRipple x ys (take (length ys) out) $ out !! length ys
applyAdders xs ys (tail out)
|
aparent/qacg
|
src/QACG/CircGen/Mult/SimpleMult.hs
|
bsd-3-clause
| 1,362
| 0
| 16
| 434
| 545
| 279
| 266
| 29
| 4
|
{-# LANGUAGE PatternGuards, ViewPatterns, NamedFieldPuns #-}
module Converter
( convert
) where
import Parse
import Smart (TaskChan, restart, interp)
import Result (hasError)
import Html
import Lang
import Args
import Hash
import qualified Language.Haskell.Exts.Pretty as HPty
import qualified Language.Haskell.Exts.Syntax as HSyn
import Text.XHtml.Strict hiding (lang)
import Text.Pandoc
import System.Process (readProcessWithExitCode)
import System.Cmd
import System.FilePath
import System.Exit
import System.Directory (getTemporaryDirectory, getModificationTime, doesFileExist, getTemporaryDirectory, createDirectoryIfMissing)
--import Data.Time (diffUTCTime)
import Control.Monad
import Data.List
import Data.Char
----------------------------------
convert :: TaskChan -> Args -> String -> IO ()
convert ghci args@(Args {magicname, sourcedir, gendir, recompilecmd, verbose}) what = do
whenOutOfDate () output input $ do
whenOutOfDate () object input $ do
when (verbose > 0) $ putStrLn $ object ++ " is out of date, regenerating"
-- x <- system $ recompilecmd ++ " " ++ input
let (ghc:args) = words recompilecmd -- !!!
(x, out, err) <- readProcessWithExitCode ghc (args ++ [input]) ""
if x == ExitSuccess
then do
restart ghci
return ()
else fail $ unlines [unwords [recompilecmd, input], show x, out, err]
when (verbose > 0) $ putStrLn $ output ++ " is out of date, regenerating"
mainParse HaskellMode input >>= extract HaskellMode (verbose > 0) ghci args what
where
input = sourcedir </> what <.> "lhs"
output = gendir </> what <.> "xml"
object = sourcedir </> what <.> "o"
extract :: ParseMode -> Bool -> TaskChan -> Args -> Language -> Doc -> IO ()
extract mode verbose ghci (Args {lang, templatedir, sourcedir, exercisedir, gendir, magicname}) what (Doc meta modu ss) = do
writeEx (what <.> ext) [showEnv mode $ importsHiding []]
ss' <- zipWithM processBlock [1..] $ preprocessForSlides ss
ht <- readFile' $ templatedir </> lang' ++ ".template"
writeFile' (gendir </> what <.> "xml") $ flip writeHtmlString (Pandoc meta $ concat ss')
$ def
{ writerStandalone = True
, writerTableOfContents = True
, writerSectionDivs = True
, writerTemplate = ht
}
where
ext = case mode of
HaskellMode -> "hs"
lang' = case span (/= '_') . reverse $ what of
(l, "") -> lang
(l, _) | length l > 2 -> lang
(x, _) -> reverse x
writeEx f l =
writeFile' (exercisedir </> f) $ intercalate delim l
writeFile' f s = do
when verbose $ putStrLn $ f ++ " is written."
createDirectoryIfMissing True (dropFileName f)
writeFile f s
readFile' f = do
when verbose $ putStrLn $ f ++ " is to read..."
readFile f
system' s = do
when verbose $ putStrLn $ "executing " ++ s
system s
importsHiding funnames = case modu of
HaskellModule (HSyn.Module loc (HSyn.ModuleName modname) directives _ _ imps _) ->
HPty.prettyPrint $
HSyn.Module loc (HSyn.ModuleName "Main") directives Nothing Nothing
([mkImport modname funnames, mkImport_ ('X':magicname) modname] ++ imps) []
-- _ -> error "error in Converter.extract"
mkCodeBlock l =
[ CodeBlock ("", ["haskell"], []) $ intercalate "\n" l | not $ null l ]
----------------------------
processBlock :: Int -> BBlock -> IO [Block]
processBlock _ (Exercise visihidden _ _ funnames is)
| null funnames || null is
= return $ mkCodeBlock $ visihidden
processBlock _ (Exercise _ visi hidden funnames is) = do
let i = show $ mkHash $ unlines funnames
j = "_j" ++ i
fn = what ++ "_" ++ i <.> ext
(static_, inForm, rows) = if null hidden
then ([], visi, length visi)
else (visi, [], 2 + length hidden)
writeEx fn [ showEnv mode $ importsHiding funnames ++ "\n" ++ unlines static_
, unlines $ hidden, show $ map parseQuickCheck is, j, i
, show funnames ]
return
$ mkCodeBlock static_
++ showBlockSimple lang' fn i rows (intercalate "\n" inForm)
processBlock ii (OneLineExercise 'H' erroneous exp)
= return []
processBlock ii (OneLineExercise p erroneous exp) = do
let m5 = mkHash $ show ii ++ exp
i = show m5
fn = what ++ (if p == 'R' then "_" ++ i else "") <.> ext
act = getOne "eval" fn i i
when (p == 'R') $ writeEx fn [showEnv mode $ importsHiding [], "\n" ++ magicname ++ " = " ++ exp]
(b, exp') <- if p == 'F' && all (==' ') exp
then return (True, [])
else do
when verbose $ putStrLn $ "interpreting " ++ exp
r <- interp False m5 lang' ghci (exercisedir </> fn) exp $ \a -> return $ return []
return $ (not $ hasError r, take 1 r)
when (erroneous /= b)
$ error $ translate lang' "Erroneous evaluation" ++ ": " ++ exp ++ " ; " ++ showHtmlFragment (renderResults_ exp')
return [rawHtml $ showHtmlFragment $ showInterpreter lang' 60 act i p exp exp']
processBlock _ (Text (CodeBlock ("",[t],[]) l))
| t `elem` ["dot","neato","twopi","circo","fdp","dfdp","latex"] = do
tmpdir <- getTemporaryDirectory
let i = show $ mkHash $ t ++ l
fn = what ++ i
imgname = takeFileName fn <.> "png"
outfile = gendir </> fn <.> "png"
tmpfile = tmpdir </> takeFileName fn <.> if t=="latex" then "tex" else t
writeFile' tmpfile $ unlines $ case t of
"latex" ->
[ "\\documentclass{article}"
, "\\usepackage{ucs}"
, "\\usepackage[utf8x]{inputenc}"
, "\\usepackage{amsmath}"
, "\\pagestyle{empty}"
-- , "\\newcommand{\\cfrac}[2]{\\displaystyle\\frac{#1}{#2}}"
, "\\begin{document}"
, "$$", l, "$$"
, "\\end{document}" ]
_ ->
["digraph G {", l, "}"]
createDirectoryIfMissing True (dropFileName outfile)
x <- system' $ unwords $ case t of
"latex" -> [ "(", "cd", dropFileName tmpfile, "&&"
, "latex -halt-on-error", takeFileName tmpfile, "2>&1 >/dev/null", ")"
, "&&", "(", "dvipng -D 150 -T tight", "-o", outfile
, replaceExtension tmpfile "dvi", "2>&1 >/dev/null",")"]
_ -> [ t, "-Tpng", "-o", outfile, tmpfile, "2>&1 >/dev/null" ]
if x == ExitSuccess
then return [Para [Image [Str imgname] (imgname, "")]]
else fail $ "processDot " ++ tmpfile ++ "; " ++ show x
processBlock _ (Text l)
= return [l]
---------------------------------
preprocessForSlides :: [BBlock] -> [BBlock]
preprocessForSlides x = case span (not . isLim) x of
(a, []) -> a
(a, b) -> a ++ case span (not . isHeader) b of
(c, d) -> [Text $ rawHtml "<div class=\"handout\">"] ++ c
++ [Text $ rawHtml "</div>"] ++ preprocessForSlides d
where
isLim (Text HorizontalRule) = True
isLim _ = False
isHeader (Text (Header {})) = True
isHeader _ = False
------------------------------------
rawHtml :: String -> Block
rawHtml x = RawBlock "html" x
showBlockSimple :: Language -> String -> String -> Int -> String -> [Block]
showBlockSimple lang fn i rows_ cont = (:[]) $ rawHtml $ showHtmlFragment $ indent $
[ form
! [ theclass $ if null cont then "interpreter" else "resetinterpreter"
, action $ getOne "check" fn i i
]
<<[ textarea
! [ cols "80"
, rows $ show rows_
, identifier $ "tarea" ++ i
]
<< cont
, br
, input ! [thetype "submit", value $ translate lang "Check"]
]
, thediv ! [theclass "answer", identifier $ "res" ++ i] << ""
]
-----------------
showEnv :: ParseMode -> String -> String
showEnv HaskellMode prelude
= "{-# LINE 1 \"testenv\" #-}\n"
++ prelude
++ "\n{-# LINE 1 \"input\" #-}\n"
mkImport :: String -> [Name] -> HSyn.ImportDecl
mkImport m d
= HSyn.ImportDecl
{ HSyn.importLoc = undefined
, HSyn.importModule = HSyn.ModuleName m
, HSyn.importQualified = False
, HSyn.importSrc = False
, HSyn.importPkg = Nothing
, HSyn.importAs = Nothing
, HSyn.importSpecs = Just (True, map (HSyn.IVar . mkName) d)
}
mkName :: String -> HSyn.Name
mkName n@(c:_)
| isSymbol c = HSyn.Symbol n
mkName n = HSyn.Ident n
mkImport_ :: String -> String -> HSyn.ImportDecl
mkImport_ magic m
= (mkImport m []) { HSyn.importQualified = True, HSyn.importAs = Just $ HSyn.ModuleName magic }
------------------
whenOutOfDate :: b -> FilePath -> FilePath -> IO b -> IO b
whenOutOfDate def x src m = do
a <- modTime x
b <- modTime src
case (a, b) of
(Nothing, Just _) -> m
(Just t1, Just t2) | t1 < t2 -> m
_ -> return def
where
modTime f = do
a <- doesFileExist f
if a then fmap Just $ getModificationTime f else return Nothing
--------------------
|
divipp/ActiveHs
|
Converter.hs
|
bsd-3-clause
| 9,683
| 0
| 18
| 3,116
| 3,070
| 1,598
| 1,472
| 199
| 15
|
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
module Stack.Dot (dot
,listDependencies
,DotOpts(..)
,resolveDependencies
,printGraph
,pruneGraph
) where
import Control.Applicative
import Control.Arrow ((&&&))
import Control.Monad (liftM, void)
import Control.Monad.Catch (MonadCatch,MonadMask)
import Control.Monad.IO.Class
import Control.Monad.Logger (MonadLogger)
import Control.Monad.Reader (MonadReader)
import Control.Monad.Trans.Unlift (MonadBaseUnlift)
import qualified Data.Foldable as F
import qualified Data.HashSet as HashSet
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Monoid ((<>))
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Text (Text)
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import qualified Data.Traversable as T
import Network.HTTP.Client.Conduit (HasHttpManager)
import Prelude -- Fix redundant import warnings
import Stack.Build (withLoadPackage)
import Stack.Build.Installed (getInstalled, GetInstalledOpts(..))
import Stack.Build.Source
import Stack.Build.Target
import Stack.Constants
import Stack.Package
import Stack.Types
import Stack.Types.Internal (HasLogLevel)
-- | Options record for @stack dot@
data DotOpts = DotOpts
{ dotIncludeExternal :: Bool
-- ^ Include external dependencies
, dotIncludeBase :: Bool
-- ^ Include dependencies on base
, dotDependencyDepth :: Maybe Int
-- ^ Limit the depth of dependency resolution to (Just n) or continue until fixpoint
, dotPrune :: Set String
-- ^ Package names to prune from the graph
}
-- | Visualize the project's dependencies as a graphviz graph
dot :: (HasEnvConfig env
,HasHttpManager env
,HasLogLevel env
,MonadBaseUnlift IO m
,MonadCatch m
,MonadLogger m
,MonadIO m
,MonadMask m
,MonadReader env m
)
=> DotOpts
-> m ()
dot dotOpts = do
localNames <- liftM Map.keysSet getLocalPackageViews
resultGraph <- createDependencyGraph dotOpts
let pkgsToPrune = if dotIncludeBase dotOpts
then dotPrune dotOpts
else Set.insert "base" (dotPrune dotOpts)
prunedGraph = pruneGraph localNames pkgsToPrune resultGraph
printGraph dotOpts localNames prunedGraph
-- | Create the dependency graph, the result is a map from a package
-- name to a tuple of dependencies and a version if available. This
-- function mainly gathers the required arguments for
-- @resolveDependencies@.
createDependencyGraph :: (HasEnvConfig env
,HasHttpManager env
,HasLogLevel env
,MonadLogger m
,MonadBaseUnlift IO m
,MonadCatch m
,MonadIO m
,MonadMask m
,MonadReader env m)
=> DotOpts
-> m (Map PackageName (Set PackageName, Maybe Version))
createDependencyGraph dotOpts = do
(_,_,locals,_,sourceMap) <- loadSourceMap NeedTargets defaultBuildOptsCLI
let graph = Map.fromList (localDependencies dotOpts locals)
menv <- getMinimalEnvOverride
installedMap <- fmap snd . fst4 <$> getInstalled menv
(GetInstalledOpts False False)
sourceMap
withLoadPackage menv (\loader -> do
let depLoader =
createDepLoader sourceMap
installedMap
(fmap4 (packageAllDeps &&& (Just . packageVersion)) loader)
liftIO $ resolveDependencies (dotDependencyDepth dotOpts) graph depLoader)
where -- fmap a function over the result of a function with 3 arguments
fmap4 :: Functor f => (r -> r') -> (a -> b -> c -> d -> f r) -> a -> b -> c -> d -> f r'
fmap4 f g a b c d = f <$> g a b c d
fst4 :: (a,b,c,d) -> a
fst4 (x,_,_,_) = x
listDependencies :: (HasEnvConfig env
,HasHttpManager env
,HasLogLevel env
,MonadBaseUnlift IO m
,MonadCatch m
,MonadLogger m
,MonadMask m
,MonadIO m
,MonadReader env m
)
=> Text
-> m ()
listDependencies sep = do
let dotOpts = DotOpts True True Nothing Set.empty
resultGraph <- createDependencyGraph dotOpts
void (Map.traverseWithKey go (snd <$> resultGraph))
where go name v = liftIO (Text.putStrLn $
Text.pack (packageNameString name) <>
sep <>
maybe "<unknown>" (Text.pack . show) v)
-- | @pruneGraph dontPrune toPrune graph@ prunes all packages in
-- @graph@ with a name in @toPrune@ and removes resulting orphans
-- unless they are in @dontPrune@
pruneGraph :: (F.Foldable f, F.Foldable g, Eq a)
=> f PackageName
-> g String
-> Map PackageName (Set PackageName, a)
-> Map PackageName (Set PackageName, a)
pruneGraph dontPrune names =
pruneUnreachable dontPrune . Map.mapMaybeWithKey (\pkg (pkgDeps,x) ->
if show pkg `F.elem` names
then Nothing
else let filtered = Set.filter (\n -> show n `F.notElem` names) pkgDeps
in if Set.null filtered && not (Set.null pkgDeps)
then Nothing
else Just (filtered,x))
-- | Make sure that all unreachable nodes (orphans) are pruned
pruneUnreachable :: (Eq a, F.Foldable f)
=> f PackageName
-> Map PackageName (Set PackageName, a)
-> Map PackageName (Set PackageName, a)
pruneUnreachable dontPrune = fixpoint prune
where fixpoint :: Eq a => (a -> a) -> a -> a
fixpoint f v = if f v == v then v else fixpoint f (f v)
prune graph' = Map.filterWithKey (\k _ -> reachable k) graph'
where reachable k = k `F.elem` dontPrune || k `Set.member` reachables
reachables = F.fold (fst <$> graph')
-- | Resolve the dependency graph up to (Just depth) or until fixpoint is reached
resolveDependencies :: (Applicative m, Monad m)
=> Maybe Int
-> Map PackageName (Set PackageName,Maybe Version)
-> (PackageName -> m (Set PackageName, Maybe Version))
-> m (Map PackageName (Set PackageName,Maybe Version))
resolveDependencies (Just 0) graph _ = return graph
resolveDependencies limit graph loadPackageDeps = do
let values = Set.unions (fst <$> Map.elems graph)
keys = Map.keysSet graph
next = Set.difference values keys
if Set.null next
then return graph
else do
x <- T.traverse (\name -> (name,) <$> loadPackageDeps name) (F.toList next)
resolveDependencies (subtract 1 <$> limit)
(Map.unionWith unifier graph (Map.fromList x))
loadPackageDeps
where unifier (pkgs1,v1) (pkgs2,_) = (Set.union pkgs1 pkgs2, v1)
-- | Given a SourceMap and a dependency loader, load the set of dependencies for a package
createDepLoader :: Applicative m
=> Map PackageName PackageSource
-> Map PackageName Installed
-> (PackageName -> Version -> Map FlagName Bool -> [Text] -> m (Set PackageName,Maybe Version))
-> PackageName
-> m (Set PackageName, Maybe Version)
createDepLoader sourceMap installed loadPackageDeps pkgName =
case Map.lookup pkgName sourceMap of
Just (PSLocal lp) -> pure ((packageAllDeps &&& (Just . packageVersion)) (lpPackage lp))
Just (PSUpstream version _ flags ghcOptions _) -> loadPackageDeps pkgName version flags ghcOptions
Nothing -> pure (Set.empty, fmap installedVersion (Map.lookup pkgName installed))
-- | Resolve the direct (depth 0) external dependencies of the given local packages
localDependencies :: DotOpts -> [LocalPackage] -> [(PackageName,(Set PackageName,Maybe Version))]
localDependencies dotOpts locals =
map (\lp -> (packageName (lpPackage lp), (deps lp,Just (lpVersion lp)))) locals
where deps lp = if dotIncludeExternal dotOpts
then Set.delete (lpName lp) (packageAllDeps (lpPackage lp))
else Set.intersection localNames (packageAllDeps (lpPackage lp))
lpName lp = packageName (lpPackage lp)
localNames = Set.fromList $ map (packageName . lpPackage) locals
lpVersion lp = packageVersion (lpPackage lp)
-- | Print a graphviz graph of the edges in the Map and highlight the given local packages
printGraph :: (Applicative m, MonadIO m)
=> DotOpts
-> Set PackageName -- ^ all locals
-> Map PackageName (Set PackageName, Maybe Version)
-> m ()
printGraph dotOpts locals graph = do
liftIO $ Text.putStrLn "strict digraph deps {"
printLocalNodes dotOpts filteredLocals
printLeaves graph
void (Map.traverseWithKey printEdges (fst <$> graph))
liftIO $ Text.putStrLn "}"
where filteredLocals = Set.filter (\local ->
packageNameString local `Set.notMember` dotPrune dotOpts) locals
-- | Print the local nodes with a different style depending on options
printLocalNodes :: (F.Foldable t, MonadIO m)
=> DotOpts
-> t PackageName
-> m ()
printLocalNodes dotOpts locals = liftIO $ Text.putStrLn (Text.intercalate "\n" lpNodes)
where applyStyle :: Text -> Text
applyStyle n = if dotIncludeExternal dotOpts
then n <> " [style=dashed];"
else n <> " [style=solid];"
lpNodes :: [Text]
lpNodes = map (applyStyle . nodeName) (F.toList locals)
-- | Print nodes without dependencies
printLeaves :: (Applicative m, MonadIO m)
=> Map PackageName (Set PackageName,Maybe Version)
-> m ()
printLeaves = F.traverse_ printLeaf . Map.keysSet . Map.filter Set.null . fmap fst
-- | @printDedges p ps@ prints an edge from p to every ps
printEdges :: (Applicative m, MonadIO m) => PackageName -> Set PackageName -> m ()
printEdges package deps = F.for_ deps (printEdge package)
-- | Print an edge between the two package names
printEdge :: MonadIO m => PackageName -> PackageName -> m ()
printEdge from to = liftIO $ Text.putStrLn (Text.concat [ nodeName from, " -> ", nodeName to, ";"])
-- | Convert a package name to a graph node name.
nodeName :: PackageName -> Text
nodeName name = "\"" <> Text.pack (packageNameString name) <> "\""
-- | Print a node with no dependencies
printLeaf :: MonadIO m => PackageName -> m ()
printLeaf package = liftIO . Text.putStrLn . Text.concat $
if isWiredIn package
then ["{rank=max; ", nodeName package, " [shape=box]; };"]
else ["{rank=max; ", nodeName package, "; };"]
-- | Check if the package is wired in (shipped with) ghc
isWiredIn :: PackageName -> Bool
isWiredIn = (`HashSet.member` wiredInPackages)
|
phadej/stack
|
src/Stack/Dot.hs
|
bsd-3-clause
| 11,387
| 0
| 21
| 3,410
| 2,959
| 1,550
| 1,409
| 211
| 3
|
import Prelude hiding (return)
import Data.Char
type Parser a = String -> [(a, String)]
-- This parser consumes the first char and returns a sigleton list
item :: Parser Char
item = \input -> case input of
[] -> []
(x:xs) -> [(x, xs)]
-- This parser always fails
failure :: Parser a
failure = \input -> []
-- This parser always succeedsa
return :: a -> Parser a
return v = \input -> [(v, input)]
parse :: Parser a -> String -> [(a, String)]
parse p input = p input
-- Parsing a character that satisfies a predicate
--satisfies :: (Char -> Bool) -> Parser Char
--satisfies p = do x <- item
-- if p x then return x else failure
|
guhemama/moocs
|
FP101x.DelftX.edX/Week4/Parser.hs
|
bsd-3-clause
| 685
| 2
| 10
| 182
| 201
| 111
| 90
| 13
| 2
|
{-# LANGUAGE GeneralizedNewtypeDeriving, TupleSections #-}
module MatchEval (match) where
import Data.Accessor
import Data.Accessor.Basic
import qualified Data.Map as M
import Control.Applicative
import Control.Monad
import Control.Monad.Error
import Control.Monad.Reader
import Syscall
import Match
import MatchFunctions
conclude :: Value -> Matcher Bool
conclude (B True) = return True
conclude (B False) = return False
conclude x = throwError $ "Type mismatch, BoolAtom was expected instead of: " ++ show x
--------------------------------------------------------------------------------
-- Special functions that evaluate their arguments in non-uniform way:
--------------------------------------------------------------------------------
land :: [Matcher Value] -> Matcher Value
land [] = return $ B True
land (m:ms) = do
v <- m >>= unB
if v then land ms else return (B False)
lor :: [Matcher Value] -> Matcher Value
lor [] = return $ B False
lor (m:ms) = do
v <- m >>= unB
if v then return (B True) else lor ms
lif :: [Matcher Value] -> Matcher Value
lif [c, t, f] = do
v <- c >>= unpack
if v then t else f
lif _ = throwError "'if' requires three arguments"
cond :: [Value] -> Matcher Value
cond (L [c, s] : cs) = do
c' <- eval c >>= unB
if c' then eval s else cond cs
cond [] = throwError "'cond' non exhaustive"
cond _ = throwError "'cond' requires list of pairs (condition statement)"
quote :: [Value] -> Matcher Value
quote [x] = return x
quote _ = throwError "'quote' needs exactly one argument"
bindMap :: [Value] -> Matcher Bindings
bindMap bs = M.fromList <$> mapM getBind bs
where
getBind (L [A k, v]) = (k,) <$> eval v
getBind _ = throwError "'let' binding pair have atom as its first part"
blet :: [Value] -> Matcher Value
blet [L bs, b] = do
bm <- bindMap bs
local (\m -> M.union bm m) $ eval b
blet _ = throwError "'let' requires list of binding pairs and body expression"
var :: String -> Matcher Value
var n = do
v <- M.lookup n <$> ask
maybe (throwError $ "Unbound variable: " ++ n) return v
eval :: Value -> Matcher Value
eval (L (x:xs)) = apply x xs
eval (A n) = var n
eval x = return x
apply :: Value -> [Value] -> Matcher Value
apply (A "rem") _ = return $ B False
apply (A "and") args = land $ map eval args
apply (A "or") args = lor $ map eval args
apply (A "if") args = lif $ map eval args
apply (A "cond") args = cond args
apply (A "quote") args = quote args
apply (A "let") args = blet args
apply (A fn) args = function fn >>= (=<< mapM eval args)
apply a _ = throwError $ "Cannot apply non-function: " ++ show a
match :: Int -> Syscall -> Value -> Bindings -> (Either String Bool, Bindings)
match t s e b = runMatcher (eval e >>= conclude) t s b
|
ratatosk/traceblade
|
MatchEval.hs
|
bsd-3-clause
| 2,736
| 0
| 12
| 545
| 1,075
| 539
| 536
| 69
| 2
|
---------------------------------------------------------------------------------
-- |
-- Module : Data.SBV.Bridge.Z3
-- Copyright : (c) Levent Erkok
-- License : BSD3
-- Maintainer : erkokl@gmail.com
-- Stability : experimental
--
-- Interface to the Z3 SMT solver. Import this module if you want to use the
-- Z3 SMT prover as your backend solver. Also see:
--
-- - "Data.SBV.Bridge.Boolector"
--
-- - "Data.SBV.Bridge.CVC4"
--
-- - "Data.SBV.Bridge.Yices"
---------------------------------------------------------------------------------
module Data.SBV.Bridge.Z3 (
-- * Z3 specific interface
sbvCurrentSolver
-- ** Proving and checking satisfiability
, prove, sat, allSat, isVacuous, isTheorem, isSatisfiable
-- ** Optimization routines
, optimize, minimize, maximize
-- * Non-Z3 specific SBV interface
-- $moduleExportIntro
, module Data.SBV
) where
import Data.SBV hiding (prove, sat, allSat, isVacuous, isTheorem, isSatisfiable, optimize, minimize, maximize, sbvCurrentSolver)
-- | Current solver instance, pointing to z3.
sbvCurrentSolver :: SMTConfig
sbvCurrentSolver = z3
-- | Prove theorems, using the Z3 SMT solver
prove :: Provable a
=> a -- ^ Property to check
-> IO ThmResult -- ^ Response from the SMT solver, containing the counter-example if found
prove = proveWith sbvCurrentSolver
-- | Find satisfying solutions, using the Z3 SMT solver
sat :: Provable a
=> a -- ^ Property to check
-> IO SatResult -- ^ Response of the SMT Solver, containing the model if found
sat = satWith sbvCurrentSolver
-- | Find all satisfying solutions, using the Z3 SMT solver
allSat :: Provable a
=> a -- ^ Property to check
-> IO AllSatResult -- ^ List of all satisfying models
allSat = allSatWith sbvCurrentSolver
-- | Check vacuity of the explicit constraints introduced by calls to the 'constrain' function, using the Z3 SMT solver
isVacuous :: Provable a
=> a -- ^ Property to check
-> IO Bool -- ^ True if the constraints are unsatisifiable
isVacuous = isVacuousWith sbvCurrentSolver
-- | Check if the statement is a theorem, with an optional time-out in seconds, using the Z3 SMT solver
isTheorem :: Provable a
=> Maybe Int -- ^ Optional time-out, specify in seconds
-> a -- ^ Property to check
-> IO (Maybe Bool) -- ^ Returns Nothing if time-out expires
isTheorem = isTheoremWith sbvCurrentSolver
-- | Check if the statement is satisfiable, with an optional time-out in seconds, using the Z3 SMT solver
isSatisfiable :: Provable a
=> Maybe Int -- ^ Optional time-out, specify in seconds
-> a -- ^ Property to check
-> IO (Maybe Bool) -- ^ Returns Nothing if time-out expiers
isSatisfiable = isSatisfiableWith sbvCurrentSolver
-- | Optimize cost functions, using the Z3 SMT solver
optimize :: (SatModel a, SymWord a, Show a, SymWord c, Show c)
=> OptimizeOpts -- ^ Parameters to optimization (Iterative, Quantified, etc.)
-> (SBV c -> SBV c -> SBool) -- ^ Betterness check: This is the comparison predicate for optimization
-> ([SBV a] -> SBV c) -- ^ Cost function
-> Int -- ^ Number of inputs
-> ([SBV a] -> SBool) -- ^ Validity function
-> IO (Maybe [a]) -- ^ Returns Nothing if there is no valid solution, otherwise an optimal solution
optimize = optimizeWith sbvCurrentSolver
-- | Minimize cost functions, using the Z3 SMT solver
minimize :: (SatModel a, SymWord a, Show a, SymWord c, Show c)
=> OptimizeOpts -- ^ Parameters to optimization (Iterative, Quantified, etc.)
-> ([SBV a] -> SBV c) -- ^ Cost function to minimize
-> Int -- ^ Number of inputs
-> ([SBV a] -> SBool) -- ^ Validity function
-> IO (Maybe [a]) -- ^ Returns Nothing if there is no valid solution, otherwise an optimal solution
minimize = minimizeWith sbvCurrentSolver
-- | Maximize cost functions, using the Z3 SMT solver
maximize :: (SatModel a, SymWord a, Show a, SymWord c, Show c)
=> OptimizeOpts -- ^ Parameters to optimization (Iterative, Quantified, etc.)
-> ([SBV a] -> SBV c) -- ^ Cost function to maximize
-> Int -- ^ Number of inputs
-> ([SBV a] -> SBool) -- ^ Validity function
-> IO (Maybe [a]) -- ^ Returns Nothing if there is no valid solution, otherwise an optimal solution
maximize = maximizeWith sbvCurrentSolver
{- $moduleExportIntro
The remainder of the SBV library that is common to all back-end SMT solvers, directly coming from the "Data.SBV" module.
-}
|
dylanmc/cryptol
|
sbv/Data/SBV/Bridge/Z3.hs
|
bsd-3-clause
| 4,925
| 0
| 14
| 1,362
| 675
| 384
| 291
| 56
| 1
|
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE RecordWildCards #-}
module Write.TypeConverter
( TypeConverter
, TypeEnv
, TypeInfo(..)
, cTypeToHsTypeString
, cTypeToHsType
, cTypeDependencyNames
, cTypeInfo
, buildTypeEnvFromSpec
, buildTypeEnvFromSpecGraph
, getTypeInfo
, MemberInfo(..)
, calculateMemberPacking
, simpleCon
, pattern TypeDef
) where
-- This file is gross TODO: clean
import Control.Arrow (second, (&&&))
import Control.Monad.State
import Data.List (foldl1')
import Data.Maybe (fromMaybe, catMaybes)
import Language.C.Types as C
import Language.Haskell.Exts.Pretty (prettyPrint)
import Language.Haskell.Exts.Syntax as HS hiding (ModuleName)
import Spec.Spec
import Spec.Graph
(SpecGraph, getGraphCTypes, getGraphEnumTypes, getGraphStructTypes,
getGraphUnionTypes, getGraphConstants)
import Spec.Constant
import Spec.Type
import Spec.TypeEnv
import Write.WriteMonad
import Write.Utils
import qualified Data.HashMap.Lazy as Map
type TypeConverter = CType -> String
pattern TypeDef t = TypeSpecifier (Specifiers [TYPEDEF] [] []) t
platformType :: String -> Write (Maybe HS.Type)
platformType s =
case s of
"void" -> Just <$> pure (TyCon (Special UnitCon))
"char" -> Just <$> conFromModule "Foreign.C.Types" "CChar"
"float" -> Just <$> conFromModule "Foreign.C.Types" "CFloat"
"uint8_t" -> Just <$> conFromModule "Data.Word" "Word8"
"uint32_t" -> Just <$> conFromModule "Data.Word" "Word32"
"uint64_t" -> Just <$> conFromModule "Data.Word" "Word64"
"int32_t" -> Just <$> conFromModule "Data.Int" "Int32"
"size_t" -> Just <$> conFromModule "Foreign.C.Types" "CSize"
_ -> pure Nothing
cTypeToHsTypeString :: CType -> Write String
cTypeToHsTypeString cType = prettyPrint <$> cTypeToHsType cType
conFromModule :: String -> String -> Write HS.Type
conFromModule moduleName constructor = do
tellRequiredName (ExternalName (ModuleName moduleName) constructor)
pure (simpleCon constructor)
cTypeToHsType :: CType -> Write HS.Type
cTypeToHsType cType = hsType
where
hsType = case cType of
TypeSpecifier _ Void
-> pure $ TyCon (Special UnitCon)
TypeSpecifier _ (C.Char Nothing)
-> conFromModule "Foreign.C.Types" "CChar"
TypeSpecifier _ (C.Char (Just Signed))
-> conFromModule "Foreign.C.Types" "CChar"
TypeSpecifier _ (C.Char (Just Unsigned))
-> conFromModule "Foreign.C.Types" "CUChar"
TypeSpecifier _ Float
-> conFromModule "Foreign.C.Types" "CFloat"
TypeSpecifier _ (TypeName t)
-> cIdToHsType t
TypeDef (TypeName t)
-> cIdToHsType t
TypeDef (Struct t)
-> cIdToHsType t
Ptr _ (TypeSpecifier _ Void)
-> do ptrCon <- conFromModule "Foreign.Ptr" "Ptr"
voidCon <- conFromModule "Data.Void" "Void"
pure $ ptrCon `TyApp` voidCon
Ptr _ (Proto ret parameters)
-> do funPtrCon <- conFromModule "Foreign.Ptr" "FunPtr"
functionType <- makeFunctionType ret parameters
pure $ funPtrCon `TyApp` functionType
Ptr _ t
-> do ptrCon <- conFromModule "Foreign.Ptr" "Ptr"
t <- cTypeToHsType t
pure $ ptrCon `TyApp` t
Array s t
-> do vecCon <- conFromModule "Data.Vector.Fixed.Storable"
"Vec"
sizeType <- sizeToPeano s
t <- cTypeToHsType t
pure $ vecCon `TyApp` sizeType `TyApp` t
_ -> error ("Failed to convert C type:\n" ++ show cType)
cIdToHsType :: CIdentifier -> Write HS.Type
cIdToHsType i = do
let s = unCIdentifier i
platformTypeMay <- platformType s
case platformTypeMay of
Just pt -> pure pt
Nothing -> pure $ simpleCon s
simpleCon :: String -> HS.Type
simpleCon = TyCon . UnQual . Ident
sizeToPeano :: ArrayType CIdentifier -> Write HS.Type
sizeToPeano s = case s of
VariablySized -> error "Variably sized arrays not handled"
Unsized -> error "Unsized arrays not handled"
SizedByInteger i -> do
tellExtension "DataKinds"
toPeanoType <- conFromModule "Data.Vector.Fixed.Cont"
"ToPeano"
pure $ toPeanoType `TyApp` TyPromoted (PromotedInteger i)
SizedByIdentifier i -> do
tellExtension "DataKinds"
toPeanoType <- conFromModule "Data.Vector.Fixed.Cont"
"ToPeano"
let typeName = Ident (unCIdentifier i)
typeNat = PromotedCon False (UnQual typeName)
pure $ toPeanoType `TyApp` TyPromoted typeNat
makeFunctionType :: CType -> [ParameterDeclaration CIdentifier]
-> Write HS.Type
makeFunctionType ret [ParameterDeclaration _ (TypeSpecifier _ Void)] = makeFunctionType ret []
makeFunctionType ret parameters =
foldr TyFun <$>
((simpleCon "IO" `TyApp`) <$> cTypeToHsType ret) <*>
(traverse (cTypeToHsType . parameterDeclarationType) parameters)
type TypeConvert = State TypeConvertState
data TypeConvertState = TypeConvertState{ nextVariable :: String
}
initialTypeConvertState = TypeConvertState{ nextVariable = "a"
}
getTypeVariable :: TypeConvert String
getTypeVariable = gets nextVariable <* modify incrementNextVariable
succLexicographic :: (Enum a, Ord a) => a -> a -> [a] -> [a]
succLexicographic lower _ [] = [lower]
succLexicographic lower upper (x:ys) =
if x >= upper
then lower : succLexicographic lower upper ys
else succ x : ys
incrementNextVariable :: TypeConvertState -> TypeConvertState
incrementNextVariable (TypeConvertState n) =
TypeConvertState (succLexicographic 'a' 'z' n)
-- | cTypeNames returns the names of the C types this type depends on
cTypeDependencyNames :: CType -> [String]
cTypeDependencyNames cType =
case cType of
TypeSpecifier _ Void
-> ["void"]
TypeSpecifier _ (C.Char Nothing)
-> ["char"]
TypeSpecifier _ Float
-> ["float"]
TypeSpecifier _ (TypeName t)
-> [unCIdentifier t]
TypeDef (Struct t)
-> [unCIdentifier t]
Ptr _ t
-> cTypeDependencyNames t
Array _ t
-> cTypeDependencyNames t
Proto ret ps
-> cTypeDependencyNames ret ++ concatMap parameterTypeNames ps
_ -> error ("Failed to get depended on names for C type:\n" ++ show cType)
parameterTypeNames :: ParameterDeclaration CIdentifier -> [String]
parameterTypeNames (ParameterDeclaration _ t) = cTypeDependencyNames t
getTypeInfo :: TypeEnv -> String -> TypeInfo
getTypeInfo env s =
case Map.lookup s (teTypeInfo env) of
Nothing -> error ("Type missing from environment: " ++ s)
Just ti -> ti
-- TODO: Remove
buildTypeEnvFromSpec :: Spec -> TypeEnv
buildTypeEnvFromSpec spec =
let constants = sConstants spec
nameAndTypes = catMaybes . fmap getNameAndType $ sTypes spec
getNameAndType typeDecl =
do name <- typeDeclTypeName typeDecl
cType <- typeDeclCType typeDecl
pure (name, cType)
unions = catMaybes . fmap typeDeclToUnionType $ sTypes spec
structs = catMaybes . fmap typeDeclToStructType $ sTypes spec
enums = catMaybes . fmap typeDeclToEnumType $ sTypes spec
in buildTypeEnv constants enums unions structs nameAndTypes
buildTypeEnvFromSpecGraph :: SpecGraph -> TypeEnv
buildTypeEnvFromSpecGraph graph =
let constants = getGraphConstants graph
nameAndTypes = getGraphCTypes graph
unions = getGraphUnionTypes graph
structs = getGraphStructTypes graph
enums = getGraphEnumTypes graph
in buildTypeEnv constants enums unions structs nameAndTypes
buildTypeEnv :: [Constant] -> [EnumType] -> [UnionType] -> [StructType]
-> [(String, CType)]
-> TypeEnv
buildTypeEnv constants enums unions structs typeDecls = env
where -- Notice the recursive definition of env
env = TypeEnv{..}
teIntegralConstants = Map.fromList . catMaybes . fmap getIntConstant $ constants
teTypeInfo = Map.fromList ((second (cTypeInfo env) <$> typeDecls) ++
structTypeInfos ++ unionTypeInfos ++
enumTypeInfos)
structTypeInfos = (stName &&& getStructTypeInfo env) <$> structs
unionTypeInfos = (utName &&& getUnionTypeInfo env) <$> unions
enumTypeInfos = zip (etName <$> enums) (repeat TypeInfo{ tiSize = 4
, tiAlignment = 4
})
arrayTypeToSize :: Map.HashMap String Integer -> ArrayType CIdentifier -> Integer
arrayTypeToSize cs at =
case at of
VariablySized -> error "Trying to get size of variably sized array"
Unsized -> error "Trying to get size of unsized array"
SizedByInteger i -> i
SizedByIdentifier n ->
let string = unCIdentifier n
value = Map.lookup string cs
in case value of
Nothing -> error ("Unknown identifier: " ++ string)
Just v -> v
getIntConstant :: Constant -> Maybe (String, Integer)
getIntConstant c
| IntegralValue i <- cValue c
= Just (cName c, i)
| otherwise
= Nothing
cTypeInfo :: TypeEnv -> CType -> TypeInfo
cTypeInfo env t =
case t of
TypeSpecifier _ Void
-> error "Void doesn't have a size or alignment"
TypeSpecifier _ (C.Char Nothing) -> TypeInfo{ tiSize = 1
, tiAlignment = 1
}
TypeSpecifier _ Float -> TypeInfo{ tiSize = 4
, tiAlignment = 4
}
TypeSpecifier _ (TypeName tn) ->
case unCIdentifier tn of
"uint8_t" -> TypeInfo{ tiSize = 1
, tiAlignment = 1
}
"uint32_t" -> TypeInfo{ tiSize = 4
, tiAlignment = 4
}
"uint64_t" -> TypeInfo{ tiSize = 8
, tiAlignment = 8
}
"int32_t" -> TypeInfo{ tiSize = 4
, tiAlignment = 4
}
"size_t" -> TypeInfo{ tiSize = 8 -- TODO: 32 bit support
, tiAlignment = 8
}
name ->
case Map.lookup name (teTypeInfo env) of
Nothing -> error ("type name not found in environment: " ++ name)
Just ti -> ti
Ptr _ _
-> TypeInfo{ tiSize = 8, tiAlignment = 8 } -- TODO: 32 bit support
Array arrayType elementType
-> let length = arrayTypeToSize (teIntegralConstants env) arrayType
typeInfo = cTypeInfo env elementType
elementSize = tiSize typeInfo
elementAlignment = tiAlignment typeInfo
in TypeInfo{ tiSize = fromIntegral length * elementSize
, tiAlignment = elementAlignment
}
_ -> error ("Failed to get typeinfo for C type:\n" ++ show t)
--------------------------------------------------------------------------------
-- Calculating member packing
--------------------------------------------------------------------------------
data MemberInfo = MemberInfo { miMember :: !StructMember
, miSize :: !Int
, miAlignment :: !Int
, miOffset :: !Int
}
getStructTypeInfo :: TypeEnv -> StructType -> TypeInfo
getStructTypeInfo env st = TypeInfo{..}
where memberPacking = calculateMemberPacking env (stMembers st)
lastMemberPacking = last memberPacking
tiAlignment = foldl1' lcm -- You know, just in case!
(miAlignment <$> memberPacking)
unalignedSize = miOffset lastMemberPacking +
miSize lastMemberPacking
tiSize = alignTo tiAlignment unalignedSize
getUnionTypeInfo :: TypeEnv -> UnionType -> TypeInfo
getUnionTypeInfo env ut = TypeInfo{..}
where memberPacking = calculateMemberPacking env (utMembers ut)
tiAlignment = foldl1' lcm -- You know, just in case!
(miAlignment <$> memberPacking)
unalignedSize = maximum (miSize <$> memberPacking)
tiSize = alignTo tiAlignment unalignedSize
-- | Takes a list of members and calculates their packing
calculateMemberPacking :: TypeEnv -> [StructMember] -> [MemberInfo]
calculateMemberPacking env = comb go 0
where go offset m = let cType = smCType m
TypeInfo size alignment = cTypeInfo env cType
alignedOffset = alignTo alignment offset
in (alignedOffset + size,
MemberInfo m size alignment alignedOffset)
comb :: (s -> a -> (s, b)) -> s -> [a] -> [b]
comb f initialState = go initialState []
where go _ bs [] = reverse bs
go s bs (a:as) = let (s', b) = f s a
in go s' (b:bs) as
alignTo :: Int -> Int -> Int
alignTo alignment offset = ((offset + alignment - 1) `div` alignment) *
alignment
|
oldmanmike/vulkan
|
generate/src/Write/TypeConverter.hs
|
bsd-3-clause
| 13,839
| 0
| 16
| 4,512
| 3,376
| 1,716
| 1,660
| 295
| 13
|
module Weapons (Weapon(..), genWeapon, getWeapon, weaponsIn) where
import GameModes
import RpsElements
import System.Random
data Weapon = Rock
| Paper
| Scissors
| Fire
| Sponge
| Air
| Water
| Human
| Gun
| Lizard
| Spock
deriving (Eq, Show, Enum, Bounded)
instance Ord Weapon where
Rock `compare` Scissors = GT
Rock `compare` Fire = GT
Rock `compare` Sponge = GT
Rock `compare` Lizard = GT
Rock `compare` Human = GT
Paper `compare` Air = GT
Paper `compare` Water = GT
Paper `compare` Spock = GT
Paper `compare` Gun = GT
Scissors `compare` Sponge = GT
Scissors `compare` Air = GT
Scissors `compare` Lizard = GT
Scissors `compare` Human = GT
Scissors `compare` Rock = LT
Fire `compare` Sponge = GT
Fire `compare` Human = GT
Fire `compare` Rock = LT
Sponge `compare` Air = GT
Sponge `compare` Water = GT
Sponge `compare` Gun = GT
Sponge `compare` Rock = LT
Sponge `compare` Fire = LT
Sponge `compare` Scissors = LT
Air `compare` Water = GT
Air `compare` Gun = GT
Air `compare` Scissors = LT
Air `compare` Sponge = LT
Air `compare` Paper = LT
Water `compare` Gun = GT
Water `compare` Sponge = LT
Water `compare` Paper = LT
Water `compare` Air = LT
Human `compare` Rock = LT
Human `compare` Fire = LT
Human `compare` Scissors = LT
Gun `compare` Sponge = LT
Gun `compare` Paper = LT
Gun `compare` Air = LT
Gun `compare` Water = LT
Lizard `compare` Spock = GT
Lizard `compare` Rock = LT
Lizard `compare` Scissors = LT
Spock `compare` Paper = LT
Spock `compare` Lizard = LT
x `compare` y = fromEnum x `compare` fromEnum y
instance Random Weapon where
random g = let min = fromEnum (minBound :: Weapon)
max = fromEnum (maxBound :: Weapon)
(r, g') = randomR (min, max) g
in (toEnum r, g')
randomR (min,max) g = let (r, g') = randomR (fromEnum min, fromEnum max) g
in (toEnum r, g')
instance RpsElement Weapon
genWeapon :: GameMode -> IO Weapon
genWeapon gameMode = do
let max = subtract 1 . numWeapons $ gameMode
wps = weaponsIn gameMode
gen = (wps !!) . fst . randomR (0, max)
newStdGen >> gen <$> getStdGen
getWeapon :: GameMode -> String -> Either String Weapon
getWeapon gameMode input = case makeFrom (weaponsIn gameMode) input of
Just wpn -> Right wpn
Nothing -> Left "Invalid weapon!"
weaponsIn :: GameMode -> [Weapon]
weaponsIn RPSLS = take 3 allElems ++ (reverse . take 2 . reverse $ allElems)
weaponsIn gameMode = take (numWeapons gameMode) allElems
numWeapons :: GameMode -> Int
numWeapons RPS = 3
numWeapons RPSLS = 5
numWeapons RPS_7 = 7
numWeapons RPS_9 = 9
|
joelchelliah/rock-paper-scissors-hs
|
src/Weapons.hs
|
bsd-3-clause
| 2,945
| 0
| 12
| 923
| 1,099
| 586
| 513
| 88
| 2
|
{-# LANGUAGE TemplateHaskell, TypeFamilies, FlexibleInstances, CPP #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
#ifdef VACUUM
import System.Vacuum.Cairo
#endif
import UnboxedPair
$(definePair [t| Pair Int Int |])
-- unfortunately doesn't unpack, due to <http://hackage.haskell.org/trac/ghc/ticket/3990>
-- $(definePair [t| Pair (Pair Int Int) Int |])
simplePair :: Pair Int Int
simplePair = pair 0 1
--nestedPair :: Pair (Pair Int Int) Int
--nestedPair = pair (pair 0 1) 2
#ifdef VACUUM
main =
do viewFile "unboxpair.svg" (foo, bar, bam, (0,1))
putStrLn "Data-structure diagram written to unboxpair.svg"
#else
main = putStrLn "Test compiled (and ran) successfully!"
#endif
|
reinerp/th-unboxing
|
examples/Main.hs
|
bsd-3-clause
| 688
| 1
| 9
| 105
| 95
| 55
| 40
| 7
| 1
|
{-# LANGUAGE RecordWildCards, ScopedTypeVariables, BangPatterns, CPP #-}
--
-- | Interacting with the interpreter, whether it is running on an
-- external process or in the current process.
--
module GHCi
( -- * High-level interface to the interpreter
evalStmt, EvalStatus_(..), EvalStatus, EvalResult(..), EvalExpr(..)
, resumeStmt
, abandonStmt
, evalIO
, evalString
, evalStringToIOString
, mallocData
, createBCOs
, mkCostCentres
, costCentreStackInfo
, newBreakArray
, enableBreakpoint
, breakpointStatus
, getBreakpointVar
-- * The object-code linker
, initObjLinker
, lookupSymbol
, lookupClosure
, loadDLL
, loadArchive
, loadObj
, unloadObj
, addLibrarySearchPath
, removeLibrarySearchPath
, resolveObjs
, findSystemLibrary
-- * Lower-level API using messages
, iservCmd, Message(..), withIServ, stopIServ
, iservCall, readIServ, writeIServ
, purgeLookupSymbolCache
, freeHValueRefs
, mkFinalizedHValue
, wormhole, wormholeRef
, mkEvalOpts
, fromEvalResult
) where
import GHCi.Message
import GHCi.Run
import GHCi.RemoteTypes
import GHCi.ResolvedBCO
import GHCi.BreakArray (BreakArray)
import HscTypes
import UniqFM
import Panic
import DynFlags
import ErrUtils
import Outputable
import Exception
import BasicTypes
import FastString
import Util
import Hooks
import Control.Concurrent
import Control.Monad
import Control.Monad.IO.Class
import Data.Binary
import Data.Binary.Put
import Data.ByteString (ByteString)
import qualified Data.ByteString.Lazy as LB
import Data.IORef
import Foreign hiding (void)
import GHC.Stack.CCS (CostCentre,CostCentreStack)
import System.Exit
import Data.Maybe
import GHC.IO.Handle.Types (Handle)
#ifdef mingw32_HOST_OS
import Foreign.C
import GHC.IO.Handle.FD (fdToHandle)
#else
import System.Posix as Posix
#endif
import System.Directory
import System.Process
import GHC.Conc (getNumProcessors, pseq, par)
{- Note [Remote GHCi]
When the flag -fexternal-interpreter is given to GHC, interpreted code
is run in a separate process called iserv, and we communicate with the
external process over a pipe using Binary-encoded messages.
Motivation
~~~~~~~~~~
When the interpreted code is running in a separate process, it can
use a different "way", e.g. profiled or dynamic. This means
- compiling Template Haskell code with -prof does not require
building the code without -prof first
- when GHC itself is profiled, it can interpret unprofiled code,
and the same applies to dynamic linking.
- An unprofiled GHCi can load and run profiled code, which means it
can use the stack-trace functionality provided by profiling without
taking the performance hit on the compiler that profiling would
entail.
For other reasons see RemoteGHCi on the wiki.
Implementation Overview
~~~~~~~~~~~~~~~~~~~~~~~
The main pieces are:
- libraries/ghci, containing:
- types for talking about remote values (GHCi.RemoteTypes)
- the message protocol (GHCi.Message),
- implementation of the messages (GHCi.Run)
- implementation of Template Haskell (GHCi.TH)
- a few other things needed to run interpreted code
- top-level iserv directory, containing the codefor the external
server. This is a fairly simple wrapper, most of the functionality
is provided by modules in libraries/ghci.
- This module (GHCi) which provides the interface to the server used
by the rest of GHC.
GHC works with and without -fexternal-interpreter. With the flag, all
interpreted code is run by the iserv binary. Without the flag,
interpreted code is run in the same process as GHC.
Things that do not work with -fexternal-interpreter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dynCompileExpr cannot work, because we have no way to run code of an
unknown type in the remote process. This API fails with an error
message if it is used with -fexternal-interpreter.
Other Notes on Remote GHCi
~~~~~~~~~~~~~~~~~~~~~~~~~~
* This wiki page has an implementation overview:
https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/ExternalInterpreter
* Note [External GHCi pointers] in compiler/ghci/GHCi.hs
* Note [Remote Template Haskell] in libraries/ghci/GHCi/TH.hs
-}
-- | Run a command in the interpreter's context. With
-- @-fexternal-interpreter@, the command is serialized and sent to an
-- external iserv process, and the response is deserialized (hence the
-- @Binary@ constraint). With @-fno-external-interpreter@ we execute
-- the command directly here.
iservCmd :: Binary a => HscEnv -> Message a -> IO a
iservCmd hsc_env@HscEnv{..} msg
| gopt Opt_ExternalInterpreter hsc_dflags =
withIServ hsc_env $ \iserv ->
uninterruptibleMask_ $ do -- Note [uninterruptibleMask_]
iservCall iserv msg
| otherwise = -- Just run it directly
run msg
-- Note [uninterruptibleMask_ and iservCmd]
--
-- If we receive an async exception, such as ^C, while communicating
-- with the iserv process then we will be out-of-sync and not be able
-- to recoever. Thus we use uninterruptibleMask_ during
-- communication. A ^C will be delivered to the iserv process (because
-- signals get sent to the whole process group) which will interrupt
-- the running computation and return an EvalException result.
-- | Grab a lock on the 'IServ' and do something with it.
-- Overloaded because this is used from TcM as well as IO.
withIServ
:: (MonadIO m, ExceptionMonad m)
=> HscEnv -> (IServ -> m a) -> m a
withIServ HscEnv{..} action =
gmask $ \restore -> do
m <- liftIO $ takeMVar hsc_iserv
-- start the iserv process if we haven't done so yet
iserv <- maybe (liftIO $ startIServ hsc_dflags) return m
`gonException` (liftIO $ putMVar hsc_iserv Nothing)
-- free any ForeignHValues that have been garbage collected.
let iserv' = iserv{ iservPendingFrees = [] }
a <- (do
liftIO $ when (not (null (iservPendingFrees iserv))) $
iservCall iserv (FreeHValueRefs (iservPendingFrees iserv))
-- run the inner action
restore $ action iserv)
`gonException` (liftIO $ putMVar hsc_iserv (Just iserv'))
liftIO $ putMVar hsc_iserv (Just iserv')
return a
-- -----------------------------------------------------------------------------
-- Wrappers around messages
-- | Execute an action of type @IO [a]@, returning 'ForeignHValue's for
-- each of the results.
evalStmt
:: HscEnv -> Bool -> EvalExpr ForeignHValue
-> IO (EvalStatus_ [ForeignHValue] [HValueRef])
evalStmt hsc_env step foreign_expr = do
let dflags = hsc_dflags hsc_env
status <- withExpr foreign_expr $ \expr ->
iservCmd hsc_env (EvalStmt (mkEvalOpts dflags step) expr)
handleEvalStatus hsc_env status
where
withExpr :: EvalExpr ForeignHValue -> (EvalExpr HValueRef -> IO a) -> IO a
withExpr (EvalThis fhv) cont =
withForeignRef fhv $ \hvref -> cont (EvalThis hvref)
withExpr (EvalApp fl fr) cont =
withExpr fl $ \fl' ->
withExpr fr $ \fr' ->
cont (EvalApp fl' fr')
resumeStmt
:: HscEnv -> Bool -> ForeignRef (ResumeContext [HValueRef])
-> IO (EvalStatus_ [ForeignHValue] [HValueRef])
resumeStmt hsc_env step resume_ctxt = do
let dflags = hsc_dflags hsc_env
status <- withForeignRef resume_ctxt $ \rhv ->
iservCmd hsc_env (ResumeStmt (mkEvalOpts dflags step) rhv)
handleEvalStatus hsc_env status
abandonStmt :: HscEnv -> ForeignRef (ResumeContext [HValueRef]) -> IO ()
abandonStmt hsc_env resume_ctxt = do
withForeignRef resume_ctxt $ \rhv ->
iservCmd hsc_env (AbandonStmt rhv)
handleEvalStatus
:: HscEnv -> EvalStatus [HValueRef]
-> IO (EvalStatus_ [ForeignHValue] [HValueRef])
handleEvalStatus hsc_env status =
case status of
EvalBreak a b c d e f -> return (EvalBreak a b c d e f)
EvalComplete alloc res ->
EvalComplete alloc <$> addFinalizer res
where
addFinalizer (EvalException e) = return (EvalException e)
addFinalizer (EvalSuccess rs) = do
EvalSuccess <$> mapM (mkFinalizedHValue hsc_env) rs
-- | Execute an action of type @IO ()@
evalIO :: HscEnv -> ForeignHValue -> IO ()
evalIO hsc_env fhv = do
liftIO $ withForeignRef fhv $ \fhv ->
iservCmd hsc_env (EvalIO fhv) >>= fromEvalResult
-- | Execute an action of type @IO String@
evalString :: HscEnv -> ForeignHValue -> IO String
evalString hsc_env fhv = do
liftIO $ withForeignRef fhv $ \fhv ->
iservCmd hsc_env (EvalString fhv) >>= fromEvalResult
-- | Execute an action of type @String -> IO String@
evalStringToIOString :: HscEnv -> ForeignHValue -> String -> IO String
evalStringToIOString hsc_env fhv str = do
liftIO $ withForeignRef fhv $ \fhv ->
iservCmd hsc_env (EvalStringToString fhv str) >>= fromEvalResult
-- | Allocate and store the given bytes in memory, returning a pointer
-- to the memory in the remote process.
mallocData :: HscEnv -> ByteString -> IO (RemotePtr ())
mallocData hsc_env bs = iservCmd hsc_env (MallocData bs)
mkCostCentres
:: HscEnv -> String -> [(String,String)] -> IO [RemotePtr CostCentre]
mkCostCentres hsc_env mod ccs =
iservCmd hsc_env (MkCostCentres mod ccs)
-- | Create a set of BCOs that may be mutually recursive.
createBCOs :: HscEnv -> [ResolvedBCO] -> IO [HValueRef]
createBCOs hsc_env rbcos = do
n_jobs <- case parMakeCount (hsc_dflags hsc_env) of
Nothing -> liftIO getNumProcessors
Just n -> return n
-- Serializing ResolvedBCO is expensive, so if we're in parallel mode
-- (-j<n>) parallelise the serialization.
if (n_jobs == 1)
then
iservCmd hsc_env (CreateBCOs [runPut (put rbcos)])
else do
old_caps <- getNumCapabilities
if old_caps == n_jobs
then void $ evaluate puts
else bracket_ (setNumCapabilities n_jobs)
(setNumCapabilities old_caps)
(void $ evaluate puts)
iservCmd hsc_env (CreateBCOs puts)
where
puts = parMap doChunk (chunkList 100 rbcos)
-- make sure we force the whole lazy ByteString
doChunk c = pseq (LB.length bs) bs
where bs = runPut (put c)
-- We don't have the parallel package, so roll our own simple parMap
parMap _ [] = []
parMap f (x:xs) = fx `par` (fxs `pseq` (fx : fxs))
where fx = f x; fxs = parMap f xs
costCentreStackInfo :: HscEnv -> RemotePtr CostCentreStack -> IO [String]
costCentreStackInfo hsc_env ccs =
iservCmd hsc_env (CostCentreStackInfo ccs)
newBreakArray :: HscEnv -> Int -> IO (ForeignRef BreakArray)
newBreakArray hsc_env size = do
breakArray <- iservCmd hsc_env (NewBreakArray size)
mkFinalizedHValue hsc_env breakArray
enableBreakpoint :: HscEnv -> ForeignRef BreakArray -> Int -> Bool -> IO ()
enableBreakpoint hsc_env ref ix b = do
withForeignRef ref $ \breakarray ->
iservCmd hsc_env (EnableBreakpoint breakarray ix b)
breakpointStatus :: HscEnv -> ForeignRef BreakArray -> Int -> IO Bool
breakpointStatus hsc_env ref ix = do
withForeignRef ref $ \breakarray ->
iservCmd hsc_env (BreakpointStatus breakarray ix)
getBreakpointVar :: HscEnv -> ForeignHValue -> Int -> IO (Maybe ForeignHValue)
getBreakpointVar hsc_env ref ix =
withForeignRef ref $ \apStack -> do
mb <- iservCmd hsc_env (GetBreakpointVar apStack ix)
mapM (mkFinalizedHValue hsc_env) mb
-- -----------------------------------------------------------------------------
-- Interface to the object-code linker
initObjLinker :: HscEnv -> IO ()
initObjLinker hsc_env = iservCmd hsc_env InitLinker
lookupSymbol :: HscEnv -> FastString -> IO (Maybe (Ptr ()))
lookupSymbol hsc_env@HscEnv{..} str
| gopt Opt_ExternalInterpreter hsc_dflags =
-- Profiling of GHCi showed a lot of time and allocation spent
-- making cross-process LookupSymbol calls, so I added a GHC-side
-- cache which sped things up quite a lot. We have to be careful
-- to purge this cache when unloading code though.
withIServ hsc_env $ \iserv@IServ{..} -> do
cache <- readIORef iservLookupSymbolCache
case lookupUFM cache str of
Just p -> return (Just p)
Nothing -> do
m <- uninterruptibleMask_ $
iservCall iserv (LookupSymbol (unpackFS str))
case m of
Nothing -> return Nothing
Just r -> do
let p = fromRemotePtr r
writeIORef iservLookupSymbolCache $! addToUFM cache str p
return (Just p)
| otherwise =
fmap fromRemotePtr <$> run (LookupSymbol (unpackFS str))
lookupClosure :: HscEnv -> String -> IO (Maybe HValueRef)
lookupClosure hsc_env str =
iservCmd hsc_env (LookupClosure str)
purgeLookupSymbolCache :: HscEnv -> IO ()
purgeLookupSymbolCache hsc_env@HscEnv{..} =
when (gopt Opt_ExternalInterpreter hsc_dflags) $
withIServ hsc_env $ \IServ{..} ->
writeIORef iservLookupSymbolCache emptyUFM
-- | loadDLL loads a dynamic library using the OS's native linker
-- (i.e. dlopen() on Unix, LoadLibrary() on Windows). It takes either
-- an absolute pathname to the file, or a relative filename
-- (e.g. "libfoo.so" or "foo.dll"). In the latter case, loadDLL
-- searches the standard locations for the appropriate library.
--
-- Returns:
--
-- Nothing => success
-- Just err_msg => failure
loadDLL :: HscEnv -> String -> IO (Maybe String)
loadDLL hsc_env str = iservCmd hsc_env (LoadDLL str)
loadArchive :: HscEnv -> String -> IO ()
loadArchive hsc_env path = do
path' <- canonicalizePath path -- Note [loadObj and relative paths]
iservCmd hsc_env (LoadArchive path')
loadObj :: HscEnv -> String -> IO ()
loadObj hsc_env path = do
path' <- canonicalizePath path -- Note [loadObj and relative paths]
iservCmd hsc_env (LoadObj path')
unloadObj :: HscEnv -> String -> IO ()
unloadObj hsc_env path = do
path' <- canonicalizePath path -- Note [loadObj and relative paths]
iservCmd hsc_env (UnloadObj path')
-- Note [loadObj and relative paths]
-- the iserv process might have a different current directory from the
-- GHC process, so we must make paths absolute before sending them
-- over.
addLibrarySearchPath :: HscEnv -> String -> IO (Ptr ())
addLibrarySearchPath hsc_env str =
fromRemotePtr <$> iservCmd hsc_env (AddLibrarySearchPath str)
removeLibrarySearchPath :: HscEnv -> Ptr () -> IO Bool
removeLibrarySearchPath hsc_env p =
iservCmd hsc_env (RemoveLibrarySearchPath (toRemotePtr p))
resolveObjs :: HscEnv -> IO SuccessFlag
resolveObjs hsc_env = successIf <$> iservCmd hsc_env ResolveObjs
findSystemLibrary :: HscEnv -> String -> IO (Maybe String)
findSystemLibrary hsc_env str = iservCmd hsc_env (FindSystemLibrary str)
-- -----------------------------------------------------------------------------
-- Raw calls and messages
-- | Send a 'Message' and receive the response from the iserv process
iservCall :: Binary a => IServ -> Message a -> IO a
iservCall iserv@IServ{..} msg =
remoteCall iservPipe msg
`catch` \(e :: SomeException) -> handleIServFailure iserv e
-- | Read a value from the iserv process
readIServ :: IServ -> Get a -> IO a
readIServ iserv@IServ{..} get =
readPipe iservPipe get
`catch` \(e :: SomeException) -> handleIServFailure iserv e
-- | Send a value to the iserv process
writeIServ :: IServ -> Put -> IO ()
writeIServ iserv@IServ{..} put =
writePipe iservPipe put
`catch` \(e :: SomeException) -> handleIServFailure iserv e
handleIServFailure :: IServ -> SomeException -> IO a
handleIServFailure IServ{..} e = do
ex <- getProcessExitCode iservProcess
case ex of
Just (ExitFailure n) ->
throw (InstallationError ("ghc-iserv terminated (" ++ show n ++ ")"))
_ -> do
terminateProcess iservProcess
_ <- waitForProcess iservProcess
throw e
-- -----------------------------------------------------------------------------
-- Starting and stopping the iserv process
startIServ :: DynFlags -> IO IServ
startIServ dflags = do
let flavour
| WayProf `elem` ways dflags = "-prof"
| WayDyn `elem` ways dflags = "-dyn"
| otherwise = ""
prog = pgm_i dflags ++ flavour
opts = getOpts dflags opt_i
debugTraceMsg dflags 3 $ text "Starting " <> text prog
let createProc = lookupHook createIservProcessHook
(\cp -> do { (_,_,_,ph) <- createProcess cp
; return ph })
dflags
(ph, rh, wh) <- runWithPipes createProc prog opts
lo_ref <- newIORef Nothing
cache_ref <- newIORef emptyUFM
return $ IServ
{ iservPipe = Pipe { pipeRead = rh
, pipeWrite = wh
, pipeLeftovers = lo_ref }
, iservProcess = ph
, iservLookupSymbolCache = cache_ref
, iservPendingFrees = []
}
stopIServ :: HscEnv -> IO ()
stopIServ HscEnv{..} =
gmask $ \_restore -> do
m <- takeMVar hsc_iserv
maybe (return ()) stop m
putMVar hsc_iserv Nothing
where
stop iserv = do
ex <- getProcessExitCode (iservProcess iserv)
if isJust ex
then return ()
else iservCall iserv Shutdown
runWithPipes :: (CreateProcess -> IO ProcessHandle)
-> FilePath -> [String] -> IO (ProcessHandle, Handle, Handle)
#ifdef mingw32_HOST_OS
foreign import ccall "io.h _close"
c__close :: CInt -> IO CInt
foreign import ccall unsafe "io.h _get_osfhandle"
_get_osfhandle :: CInt -> IO CInt
runWithPipes createProc prog opts = do
(rfd1, wfd1) <- createPipeFd -- we read on rfd1
(rfd2, wfd2) <- createPipeFd -- we write on wfd2
wh_client <- _get_osfhandle wfd1
rh_client <- _get_osfhandle rfd2
let args = show wh_client : show rh_client : opts
ph <- createProc (proc prog args)
rh <- mkHandle rfd1
wh <- mkHandle wfd2
return (ph, rh, wh)
where mkHandle :: CInt -> IO Handle
mkHandle fd = (fdToHandle fd) `onException` (c__close fd)
#else
runWithPipes createProc prog opts = do
(rfd1, wfd1) <- Posix.createPipe -- we read on rfd1
(rfd2, wfd2) <- Posix.createPipe -- we write on wfd2
setFdOption rfd1 CloseOnExec True
setFdOption wfd2 CloseOnExec True
let args = show wfd1 : show rfd2 : opts
ph <- createProc (proc prog args)
closeFd wfd1
closeFd rfd2
rh <- fdToHandle rfd1
wh <- fdToHandle wfd2
return (ph, rh, wh)
#endif
-- -----------------------------------------------------------------------------
{- Note [External GHCi pointers]
We have the following ways to reference things in GHCi:
HValue
------
HValue is a direct reference to an value in the local heap. Obviously
we cannot use this to refer to things in the external process.
RemoteRef
---------
RemoteRef is a StablePtr to a heap-resident value. When
-fexternal-interpreter is used, this value resides in the external
process's heap. RemoteRefs are mostly used to send pointers in
messages between GHC and iserv.
A RemoteRef must be explicitly freed when no longer required, using
freeHValueRefs, or by attaching a finalizer with mkForeignHValue.
To get from a RemoteRef to an HValue you can use 'wormholeRef', which
fails with an error message if -fexternal-interpreter is in use.
ForeignRef
----------
A ForeignRef is a RemoteRef with a finalizer that will free the
'RemoteRef' when it is gargabe collected. We mostly use ForeignHValue
on the GHC side.
The finalizer adds the RemoteRef to the iservPendingFrees list in the
IServ record. The next call to iservCmd will free any RemoteRefs in
the list. It was done this way rather than calling iservCmd directly,
because I didn't want to have arbitrary threads calling iservCmd. In
principle it would probably be ok, but it seems less hairy this way.
-}
-- | Creates a 'ForeignRef' that will automatically release the
-- 'RemoteRef' when it is no longer referenced.
mkFinalizedHValue :: HscEnv -> RemoteRef a -> IO (ForeignRef a)
mkFinalizedHValue HscEnv{..} rref = mkForeignRef rref free
where
!external = gopt Opt_ExternalInterpreter hsc_dflags
hvref = toHValueRef rref
free :: IO ()
free
| not external = freeRemoteRef hvref
| otherwise =
modifyMVar_ hsc_iserv $ \mb_iserv ->
case mb_iserv of
Nothing -> return Nothing -- already shut down
Just iserv@IServ{..} ->
return (Just iserv{iservPendingFrees = hvref : iservPendingFrees})
freeHValueRefs :: HscEnv -> [HValueRef] -> IO ()
freeHValueRefs _ [] = return ()
freeHValueRefs hsc_env refs = iservCmd hsc_env (FreeHValueRefs refs)
-- | Convert a 'ForeignRef' to the value it references directly. This
-- only works when the interpreter is running in the same process as
-- the compiler, so it fails when @-fexternal-interpreter@ is on.
wormhole :: DynFlags -> ForeignRef a -> IO a
wormhole dflags r = wormholeRef dflags (unsafeForeignRefToRemoteRef r)
-- | Convert an 'RemoteRef' to the value it references directly. This
-- only works when the interpreter is running in the same process as
-- the compiler, so it fails when @-fexternal-interpreter@ is on.
wormholeRef :: DynFlags -> RemoteRef a -> IO a
wormholeRef dflags r
| gopt Opt_ExternalInterpreter dflags
= throwIO (InstallationError
"this operation requires -fno-external-interpreter")
| otherwise
= localRef r
-- -----------------------------------------------------------------------------
-- Misc utils
mkEvalOpts :: DynFlags -> Bool -> EvalOpts
mkEvalOpts dflags step =
EvalOpts
{ useSandboxThread = gopt Opt_GhciSandbox dflags
, singleStep = step
, breakOnException = gopt Opt_BreakOnException dflags
, breakOnError = gopt Opt_BreakOnError dflags }
fromEvalResult :: EvalResult a -> IO a
fromEvalResult (EvalException e) = throwIO (fromSerializableException e)
fromEvalResult (EvalSuccess a) = return a
|
mettekou/ghc
|
compiler/ghci/GHCi.hs
|
bsd-3-clause
| 21,638
| 0
| 23
| 4,373
| 4,486
| 2,284
| 2,202
| 347
| 5
|
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Happstack.StaticRouting.Test where
import Happstack.Server
( FilterMonad, Response, ServerPartT, nullConf, simpleHTTP
)
import qualified Data.ListTrie.Map as Trie
import qualified Happstack.Server as H
import Happstack.StaticRouting.Internal
main :: IO ()
main = simpleHTTP nullConf (fst (compile rs1))
hGet :: Path m m h a => h -> Route (m a)
hGet = path H.GET id
ok :: (Path m m (m a) a, FilterMonad Response m) => a -> Route (m a)
ok s = hGet $ H.ok s
rs1,rs2 :: Route (ServerPartT IO [Char])
rs1 = choice
[ dir "p1" $ ok "p1"
, dir "p2" $ ok "p2"
, dir "p2" $ dir "a" $ ok "p2/a"
, dir "p3" $ remainingPath H.GET $ H.ok "p3/**"
, dir "p3" $ dir "a" $ ok "p3/a"
, dir "p4" $ param "P1" $ ok "p4/P1"
, dir "p4" $ param "P2" $ ok "p4/P2"
, dir "p5" $ dir "a" $ ok "p5.a"
, dir "p5" $ dir "b" $ ok "p5/b"
, dir "p6" $ choice [ ok "p6"
, dir "b" $ ok "p6/b"
, dir "a" $ ok "p6/a"
, dir "a" $ dir "b" $ ok "p6/a/b"
, dir "a" $ hGet $ \p ->
H.ok ("p6:"++p)
, dir "a" $ hGet $ \p q ->
H.ok ("p6:"++p++":"++q)
]
]
rs2 = choice
[ dir "p1" $ remainingPath H.GET $ H.ok "remainingPath"
, dir "p1" $ dir "path1" $ ok "path1"
, dir "p2" $ hGet $ \p q r -> H.ok (p++q++r::String)
, dir "p2" $ dir "p3" $ remainingPath H.GET $ H.ok "remainingPath"
, dir "p3" $ hGet $ \p -> H.ok (p::String)
, dir "p3" $ dir "p4" $ ok "p4"
, dir "p4" $ dir "p5" $ ok "p5"
, dir "p4" $ dir "p5" $ ok "p5"
]
instance Show (ServerPartT IO a) where
show _ = "IO"
test :: IO ()
test = do let t = routeTree rs1
putStrLn $ Trie.showTrie (unR t) ""
putStrLn $ unlines $ map show $ flattenTree t
putStrLn $ unlines $ concatMap showPath $ flattenTree t
putStrLn "Overlaps in rs1"
putStrLn $ showOverlaps $ overlaps True t
putStrLn "Overlaps in rs2"
putStrLn $ showOverlaps $ overlaps True (routeTree rs2)
|
scrive/happstack-static-routing
|
src/Happstack/StaticRouting/Test.hs
|
bsd-3-clause
| 2,281
| 0
| 16
| 778
| 908
| 444
| 464
| 54
| 1
|
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
module Duckling.Temperature.FR.Tests
( tests ) where
import Prelude
import Data.String
import Test.Tasty
import Duckling.Dimensions.Types
import Duckling.Temperature.FR.Corpus
import Duckling.Testing.Asserts
tests :: TestTree
tests = testGroup "FR Tests"
[ makeCorpusTest [This Temperature] corpus
]
|
rfranek/duckling
|
tests/Duckling/Temperature/FR/Tests.hs
|
bsd-3-clause
| 612
| 0
| 9
| 96
| 80
| 51
| 29
| 11
| 1
|
{-# LANGUAGE FlexibleContexts #-}
-- | Type unification.
module Compiler.TypeChecking.Unify
(
-- * Unification
unify
)
where
import Control.Monad.Except
import qualified Data.Set as Set
import Compiler.AST
import Compiler.TypeChecking.Error
import Compiler.TypeChecking.Free
import Compiler.TypeChecking.Subst
-- | Attempt to unify two types. If this operation is successful, the
-- resulting substitution is returned. Otherwise an error is produced.
--
-- >>> unify (Var "a") (TyArr (Var "b") (Var "b"))
-- Right (Map.fromList [("a", TyArr (Var "b") (Var "b"))])
--
-- >>> unify (TyData "Int") (TyData "Char")
-- Left (TyConMismatch (TyData "Int") (TyData "Char"))
unify :: (MonadError UnificationError m) => Type -> Type -> m Subst
unify (TyData d) (TyData e)
| d == e = return emptyS
unify (TyVar v) (TyVar w)
| v == w = return emptyS
unify (TyVar v) u
| Set.notMember v (free u) = return $ addS v u emptyS
| otherwise = throwError $ OccursCheck v u
unify t (TyVar w) = unify (TyVar w) t
unify (TyApp t1 t2) (TyApp u1 u2) = unifyT t1 u1 t2 u2
unify (TyArr t1 t2) (TyArr u1 u2) = unifyT t1 u1 t2 u2
unify t u = throwError $ TyConMismatch t u
-- | Unification of 'TyApp' and 'TyArr'.
unifyT :: (MonadError UnificationError m)
=> Type -> Type -> Type -> Type -> m Subst
unifyT t1 u1 t2 u2 = do
s1 <- unify t1 u1
s2 <- unify (apply s1 t2) (apply s1 u2)
return $ s2 @@ s1
|
vituscze/norri
|
src/Compiler/TypeChecking/Unify.hs
|
bsd-3-clause
| 1,469
| 0
| 10
| 342
| 438
| 224
| 214
| 28
| 1
|
{-# LANGUAGE QuasiQuotes #-}
module Main where
import Control.Monad.Cont
import System.Environment (getArgs)
import Atomo
import Atomo.Core
import Atomo.Load
import Atomo.Parser
import Atomo.PrettyVM
import Atomo.Run
import qualified Atomo.Kernel as Kernel
main :: IO ()
main = do
args <- getArgs
case args of
[] -> exec repl
["-x"] -> noPrelude primRepl
("-x":fn:_) -> noPrelude (parseFile fn >>= liftIO . mapM_ print >> liftIO (putStrLn "result:") >> loadFile fn)
("-e":expr:_) -> exec $ do
ast <- parseInput expr
r <- evalAll ast
d <- prettyVM r
liftIO (putStrLn d)
return (particle "ok")
("-s":expr:_) -> exec $ do
ast <- parseInput expr
evalAll ast
repl
("-l":fn:_) -> exec $ do
loadFile fn
repl
(fn:_) | head fn /= '-' ->
exec (loadFile fn)
_ -> putStrLn . unlines $
[ "usage:"
, "\tatomo\t\tstart the REPL"
, "\tatomo -e EXPR\tevaluate EXPR and output the result"
, "\tatomo -s EXPR\tevaluate EXPR and start the REPL"
, "\tatomo -l FILE\tload FILENAME and start the REPL"
, "\tatomo FILE\texecute FILE"
]
noPrelude :: VM Value -> IO ()
noPrelude x = do
runWith (initCore >> Kernel.load >> x) startEnv
return ()
repl :: VM Value
repl = eval [$e|Lobby clone repl|]
primRepl :: VM Value
primRepl = do
liftIO (putStrLn "next:")
expr <- liftIO getLine
ast <- parseInput expr
r <- evalAll ast
d <- prettyVM r
liftIO (putStrLn d)
primRepl
|
Mathnerd314/atomo
|
src/Main.hs
|
bsd-3-clause
| 1,677
| 7
| 17
| 562
| 527
| 263
| 264
| 55
| 8
|
module Main where
import System.Environment
import Bomcheck.Bomcheck( bomcheck )
-- Todo loop this if requested
main :: IO ()
main = do
args <- getArgs
putStrLn bomcheck
-- Tell bomcheck lib the location we want as well as what we want
-- Go though args here, let the lib just return the data
-- Pretty print and not pretty print
|
ShadowCreator/bomcheck
|
src/Main.hs
|
bsd-3-clause
| 344
| 0
| 7
| 74
| 51
| 29
| 22
| 7
| 1
|
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.Rendering.OpenGL.Raw.SGIX.Framezoom
-- Copyright : (c) Sven Panne 2015
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
-- Portability : portable
--
-- The <https://www.opengl.org/registry/specs/SGIX/framezoom.txt SGIX_framezoom> extension.
--
--------------------------------------------------------------------------------
module Graphics.Rendering.OpenGL.Raw.SGIX.Framezoom (
-- * Enums
gl_FRAMEZOOM_FACTOR_SGIX,
gl_FRAMEZOOM_SGIX,
gl_MAX_FRAMEZOOM_FACTOR_SGIX,
-- * Functions
glFrameZoomSGIX
) where
import Graphics.Rendering.OpenGL.Raw.Tokens
import Graphics.Rendering.OpenGL.Raw.Functions
|
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/SGIX/Framezoom.hs
|
bsd-3-clause
| 779
| 0
| 4
| 94
| 55
| 44
| 11
| 7
| 0
|
--
-- Unshipping Docker
--
-- Copyright © 2014 Operational Dynamics Consulting, Pty Ltd and Others
--
-- The code in this file, and the program it is a part of, is
-- made available to you by its authors as open source software:
-- you can redistribute it and/or modify it under the terms of
-- the 3-clause BSD licence.
--
--
-- |
--
module Linux.Containers
(
)
where
import Linux.Docker.Remote
|
afcowie/detour
|
lib/Linux/Containers.hs
|
bsd-3-clause
| 400
| 0
| 4
| 76
| 28
| 23
| 5
| 3
| 0
|
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
{-# LANGUAGE FlexibleContexts #-} --for swapFront
module Data.Shapely.Category
where
-- ========================================================================
-- private module, copy-pasted from Edward A. Kmett's "categories" package,
-- version 1.0.5, licensed BSD3.
-- ========================================================================
import Prelude hiding (id, (.))
import Control.Category
-- from Control.Categorical.Bifunctor ----------------------------------------
class (Category r, Category t) => PFunctor p r t | p r -> t, p t -> r where
first :: r a b -> t (p a c) (p b c)
class (Category s, Category t) => QFunctor q s t | q s -> t, q t -> s where
second :: s a b -> t (q c a) (q c b)
class (PFunctor p r t, QFunctor p s t) => Bifunctor p r s t | p r -> s t, p s -> r t, p t -> r s where
bimap :: r a b -> s c d -> t (p a c) (p b d)
instance PFunctor (,) (->) (->) where
first f = bimap f id
instance QFunctor (,) (->) (->) where
second = bimap id
instance Bifunctor (,) (->) (->) (->) where
bimap f g (a,b)= (f a, g b)
instance PFunctor Either (->) (->) where
first f = bimap f id
instance QFunctor Either (->) (->) where
second = bimap id
instance Bifunctor Either (->) (->) (->) where
bimap f _ (Left a) = Left (f a)
bimap _ g (Right a) = Right (g a)
instance QFunctor (->) (->) (->) where
second = (.)
-- from Control.Category.Associative ---------------------------------------
class Bifunctor p k k k => Associative k p where
associate :: k (p (p a b) c) (p a (p b c))
disassociate :: k (p a (p b c)) (p (p a b) c)
instance Associative (->) (,) where
associate ((a,b),c) = (a,(b,c))
disassociate (a,(b,c)) = ((a,b),c)
instance Associative (->) Either where
associate (Left (Left a)) = Left a
associate (Left (Right b)) = Right (Left b)
associate (Right c) = Right (Right c)
disassociate (Left a) = Left (Left a)
disassociate (Right (Left b)) = Left (Right b)
disassociate (Right (Right c)) = Right c
swapFront :: Symmetric (->) p => p b (p a c) -> p a (p b c)
swapFront = associate . first swap . disassociate
-- To make work with Either x y we need a class with something like:
-- swapFront :: (a ~ Head (Tail (p b cs)), b ~ Head bcs)=> p b cs -> p a bcs
-- from Control.Category.Braided -------------------------------------------
class Associative k p => Braided k p where
braid :: k (p a b) (p b a)
instance Braided (->) Either where
braid (Left a) = Right a
braid (Right b) = Left b
instance Braided (->) (,) where
braid ~(a,b) = (b,a)
class Braided k p => Symmetric k p
swap :: Symmetric k p => k (p a b) (p b a)
swap = braid
instance Symmetric (->) Either
instance Symmetric (->) (,)
|
jberryman/shapely-data
|
src/Data/Shapely/Category.hs
|
bsd-3-clause
| 2,809
| 0
| 11
| 624
| 1,204
| 641
| 563
| -1
| -1
|
module Lc.Arbitrary where
import qualified Data.Map as Map
import qualified Data.Set as Set
import Language.Lc
import Test.QuickCheck
--------------------------------------------------------------
-- QuickCheck - Arbitratry
--------------------------------------------------------------
-- use some globals otherwise a single Var wouldn't work
globals :: Set.Set String
globals = Set.fromList ["x", "y", "someglobals"]
initialVars :: Map.Map String Integer
initialVars = Map.fromList $ zip (Set.toList globals) [0 ..]
instance Arbitrary Lc where
arbitrary = sized $ arbitraryLc globals
arbitraryLc :: Set.Set String -> Int -> Gen Lc
arbitraryLc vars 0 = LcVar <$> elements (Set.toList vars)
arbitraryLc vars size = oneof [arbitraryAbs, arbitraryApp]
where
arbitraryAbs = do
arg <- string
body <- arbitraryLc (Set.insert arg vars) (size - 1)
return $ LcAbs arg body
arbitraryApp = do
size' <- choose (0, size - 1)
lhs <- arbitraryLc vars size'
rhs <- arbitraryLc vars (size - 1 - size')
return $ LcApp lhs rhs
string :: Gen String
string = listOf1 char
char :: Gen Char
char = elements ['a' .. 'z']
|
d-dorazio/lc
|
test/Lc/Arbitrary.hs
|
bsd-3-clause
| 1,157
| 0
| 13
| 219
| 355
| 185
| 170
| 27
| 1
|
{-# LANGUAGE CPP, DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : Language.Haskell.Exts.Fixity
-- Copyright : (c) Niklas Broberg 2009
-- License : BSD-style (see the file LICENSE.txt)
--
-- Maintainer : Niklas Broberg, d00nibro@chalmers.se
-- Stability : stable
-- Portability : portable
--
-- Fixity information to give the parser so that infix operators can
-- be parsed properly.
--
-----------------------------------------------------------------------------
module Language.Haskell.Exts.Fixity
(
-- * Fixity representation
Fixity(..)
-- | The following three functions all create lists of
-- fixities from textual representations of operators.
-- The intended usage is e.g.
--
-- > fixs = infixr_ 0 ["$","$!","`seq`"]
--
-- Note that the operators are expected as you would
-- write them infix, i.e. with ` characters surrounding
-- /varid/ operators, and /varsym/ operators written as is.
, infix_, infixl_, infixr_
-- ** Collections of fixities
, preludeFixities, baseFixities, prefixMinusFixity
-- * Applying fixities to an AST
, AppFixity(..)
) where
import Language.Haskell.Exts.Syntax
import Data.Char (isUpper)
import Control.Monad (when, (<=<), liftM, liftM2, liftM3, liftM4)
import Data.Traversable (mapM)
import Prelude hiding (mapM)
#ifdef __GLASGOW_HASKELL__
#ifdef BASE4
import Data.Data hiding (Fixity)
#else
import Data.Generics (Data(..),Typeable(..))
#endif
#endif
-- | Operator fixities are represented by their associativity
-- (left, right or none) and their precedence (0-9).
data Fixity = Fixity Assoc Int QName
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
-- | All AST elements that may include expressions which in turn may
-- need fixity tweaking will be instances of this class.
class AppFixity ast where
-- | Tweak any expressions in the element to account for the
-- fixities given. Assumes that all operator expressions are
-- fully left associative chains to begin with.
applyFixities :: Monad m => [Fixity] -- ^ The fixities to account for.
-> ast -- ^ The element to tweak.
-> m ast -- ^ The same element, but with operator expressions updated, or a failure.
instance AppFixity Exp where
applyFixities fixs = infFix fixs <=< leafFix fixs
where -- This is the real meat case. We can assume a left-associative list to begin with.
infFix fixs (InfixApp a op2 z) = do
e <- infFix fixs a
let fixup (a1,p1) (a2,p2) y pre = do
when (p1 == p2 && (a1 /= a2 || a1 == AssocNone)) -- Ambiguous infix expression!
$ fail "Ambiguous infix expression"
if (p1 > p2 || p1 == p2 && (a1 == AssocLeft || a2 == AssocNone)) -- Already right order
then return $ InfixApp e op2 z
else liftM pre (infFix fixs $ InfixApp y op2 z)
case e of
InfixApp x op1 y -> fixup (askFixity fixs op1) (askFixity fixs op2) y (InfixApp x op1)
NegApp y -> fixup prefixMinusFixity (askFixity fixs op2) y NegApp
_ -> return $ InfixApp e op2 z
infFix _ e = return e
instance AppFixity Pat where
applyFixities fixs = infFix fixs <=< leafFixP fixs
where -- Same for patterns
infFix fixs (PInfixApp a op2 z) = do
p <- infFix fixs a
let fixup (a1,p1) (a2,p2) y pre = do
when (p1 == p2 && (a1 /= a2 || a1 == AssocNone )) -- Ambiguous infix expression!
$ fail "Ambiguous infix expression"
if (p1 > p2 || p1 == p2 && (a1 == AssocLeft || a2 == AssocNone)) -- Already right order
then return $ PInfixApp p op2 z
else liftM pre (infFix fixs $ PInfixApp y op2 z)
case p of
PInfixApp x op1 y -> fixup (askFixityP fixs op1) (askFixityP fixs op2) y (PInfixApp x op1)
PNeg y -> fixup prefixMinusFixity (askFixityP fixs op2) y PNeg
_ -> return $ PInfixApp p op2 z
infFix _ p = return p
-- Internal: lookup associativity and precedence of an operator
askFixity :: [Fixity] -> QOp -> (Assoc, Int)
askFixity xs k = askFix xs (f k) -- undefined -- \k -> askFixityP xs (f k) -- lookupWithDefault (AssocLeft, 9) (f k) mp
where
f (QVarOp x) = g x
f (QConOp x) = g x
g (Special Cons) = UnQual (Symbol ":")
g x = x
-- Same using patterns
askFixityP :: [Fixity] -> QName -> (Assoc, Int)
askFixityP xs qn = askFix xs (g qn)
where
g (Special Cons) = UnQual (Symbol ":")
g x = x
askFix :: [Fixity] -> QName -> (Assoc, Int)
askFix xs = \k -> lookupWithDefault (AssocLeft, 9) k mp
where
lookupWithDefault def k mp = case lookup k mp of
Nothing -> def
Just x -> x
mp = [(x,(a,p)) | Fixity a p x <- xs]
-- | Built-in fixity for prefix minus
prefixMinusFixity :: (Assoc, Int)
prefixMinusFixity = (AssocLeft, 6)
-- | All fixities defined in the Prelude.
preludeFixities :: [Fixity]
preludeFixities = concat
[infixr_ 9 ["."]
,infixl_ 9 ["!!"]
,infixr_ 8 ["^","^^","**"]
,infixl_ 7 ["*","/","`quot`","`rem`","`div`","`mod`",":%","%"]
,infixl_ 6 ["+","-"]
,infixr_ 5 [":","++"]
,infix_ 4 ["==","/=","<","<=",">=",">","`elem`","`notElem`"]
,infixr_ 3 ["&&"]
,infixr_ 2 ["||"]
,infixl_ 1 [">>",">>="]
,infixr_ 1 ["=<<"]
,infixr_ 0 ["$","$!","`seq`"]
]
-- | All fixities defined in the base package.
--
-- Note that the @+++@ operator appears in both Control.Arrows and
-- Text.ParserCombinators.ReadP. The listed precedence for @+++@ in
-- this list is that of Control.Arrows.
baseFixities :: [Fixity]
baseFixities = preludeFixities ++ concat
[infixl_ 9 ["!","//","!:"]
,infixl_ 8 ["`shift`","`rotate`","`shiftL`","`shiftR`","`rotateL`","`rotateR`"]
,infixl_ 7 [".&."]
,infixl_ 6 ["`xor`"]
,infix_ 6 [":+"]
,infixl_ 5 [".|."]
,infixr_ 5 ["+:+","<++","<+>"] -- fixity conflict for +++ between ReadP and Arrow
,infix_ 5 ["\\\\"]
,infixl_ 4 ["<$>","<$","<*>","<*","*>","<**>"]
,infix_ 4 ["`elemP`","`notElemP`"]
,infixl_ 3 ["<|>"]
,infixr_ 3 ["&&&","***"]
,infixr_ 2 ["+++","|||"]
,infixr_ 1 ["<=<",">=>",">>>","<<<","^<<","<<^","^>>",">>^"]
,infixl_ 0 ["`on`"]
,infixr_ 0 ["`par`","`pseq`"]
]
infixr_, infixl_, infix_ :: Int -> [String] -> [Fixity]
infixr_ = fixity AssocRight
infixl_ = fixity AssocLeft
infix_ = fixity AssocNone
-- Internal: help function for the above definitions.
fixity :: Assoc -> Int -> [String] -> [Fixity]
fixity a p = map (Fixity a p . op)
where
op ('`':xs) = UnQual $ Ident $ init xs
op xs = UnQual $ Symbol xs
-------------------------------------------------------------------
-- Boilerplate - yuck!! Everything below here is internal stuff
instance AppFixity Module where
applyFixities fixs (Module loc n prs mwt ext imp decls) =
liftM (Module loc n prs mwt ext imp) $ appFixDecls fixs decls
instance AppFixity Decl where
applyFixities fixs decl = case decl of
ClassDecl loc ctxt n vars deps cdecls -> liftM (ClassDecl loc ctxt n vars deps) $ mapM fix cdecls
InstDecl loc ctxt n ts idecls -> liftM (InstDecl loc ctxt n ts) $ mapM fix idecls
SpliceDecl loc spl -> liftM (SpliceDecl loc) $ fix spl
FunBind matches -> liftM FunBind $ mapM fix matches
PatBind loc p mt rhs bs -> liftM3 (flip (PatBind loc) mt) (fix p) (fix rhs) (fix bs)
AnnPragma loc ann -> liftM (AnnPragma loc) $ fix ann
_ -> return decl
where fix x = applyFixities fixs x
appFixDecls :: Monad m => [Fixity] -> [Decl] -> m [Decl]
appFixDecls fixs decls =
let extraFixs = getFixities decls
in mapM (applyFixities (fixs++extraFixs)) decls
where getFixities = concatMap getFixity
getFixity (InfixDecl _ a p ops) = map (Fixity a p . g) ops
getFixity _ = []
g (VarOp x) = UnQual x
g (ConOp x) = UnQual x
instance AppFixity Annotation where
applyFixities fixs ann = case ann of
Ann n e -> liftM (Ann n) $ fix e
TypeAnn n e -> liftM (TypeAnn n) $ fix e
ModuleAnn e -> liftM ModuleAnn $ fix e
where fix x = applyFixities fixs x
instance AppFixity ClassDecl where
applyFixities fixs (ClsDecl decl) = liftM ClsDecl $ applyFixities fixs decl
applyFixities _ cdecl = return cdecl
instance AppFixity InstDecl where
applyFixities fixs (InsDecl decl) = liftM InsDecl $ applyFixities fixs decl
applyFixities _ idecl = return idecl
instance AppFixity Match where
applyFixities fixs (Match loc n ps mt rhs bs) = liftM3 (flip (Match loc n) mt) (mapM fix ps) (fix rhs) (fix bs)
where fix x = applyFixities fixs x
instance AppFixity Rhs where
applyFixities fixs rhs = case rhs of
UnGuardedRhs e -> liftM UnGuardedRhs $ fix e
GuardedRhss grhss -> liftM GuardedRhss $ mapM fix grhss
where fix x = applyFixities fixs x
instance AppFixity GuardedRhs where
applyFixities fixs (GuardedRhs loc stmts e) = liftM2 (GuardedRhs loc) (mapM fix stmts) $ fix e
where fix x = applyFixities fixs x
instance AppFixity PatField where
applyFixities fixs (PFieldPat n p) = liftM (PFieldPat n) $ applyFixities fixs p
applyFixities _ pf = return pf
instance AppFixity RPat where
applyFixities fixs rp = case rp of
RPOp rp op -> liftM (flip RPOp op) (fix rp)
RPEither a b -> liftM2 RPEither (fix a) (fix b)
RPSeq rps -> liftM RPSeq $ mapM fix rps
RPGuard p stmts -> liftM2 RPGuard (fix p) $ mapM fix stmts
RPCAs n rp -> liftM (RPCAs n) $ fix rp
RPAs n rp -> liftM (RPAs n) $ fix rp
RPParen rp -> liftM RPParen $ fix rp
RPPat p -> liftM RPPat $ fix p
where fix x = applyFixities fixs x
instance AppFixity PXAttr where
applyFixities fixs (PXAttr n p) = liftM (PXAttr n) $ applyFixities fixs p
instance AppFixity Stmt where
applyFixities fixs stmt = case stmt of
Generator loc p e -> liftM2 (Generator loc) (fix p) (fix e)
Qualifier e -> liftM Qualifier $ fix e
LetStmt bs -> liftM LetStmt $ fix bs -- special behavior
RecStmt stmts -> liftM RecStmt $ mapM fix stmts
where fix x = applyFixities fixs x
instance AppFixity Binds where
applyFixities fixs bs = case bs of
BDecls decls -> liftM BDecls $ appFixDecls fixs decls -- special behavior
IPBinds ips -> liftM IPBinds $ mapM fix ips
where fix x = applyFixities fixs x
instance AppFixity IPBind where
applyFixities fixs (IPBind loc n e) = liftM (IPBind loc n) $ applyFixities fixs e
instance AppFixity FieldUpdate where
applyFixities fixs (FieldUpdate n e) = liftM (FieldUpdate n) $ applyFixities fixs e
applyFixities _ fup = return fup
instance AppFixity Alt where
applyFixities fixs (Alt loc p galts bs) = liftM3 (Alt loc) (fix p) (fix galts) (fix bs)
where fix x = applyFixities fixs x
instance AppFixity GuardedAlts where
applyFixities fixs galts = case galts of
UnGuardedAlt e -> liftM UnGuardedAlt $ fix e
GuardedAlts galts -> liftM GuardedAlts $ mapM fix galts
where fix x = applyFixities fixs x
instance AppFixity GuardedAlt where
applyFixities fixs (GuardedAlt loc stmts e) = liftM2 (GuardedAlt loc) (mapM fix stmts) (fix e)
where fix x = applyFixities fixs x
instance AppFixity QualStmt where
applyFixities fixs qstmt = case qstmt of
QualStmt s -> liftM QualStmt $ fix s
ThenTrans e -> liftM ThenTrans $ fix e
ThenBy e1 e2 -> liftM2 ThenBy (fix e1) (fix e2)
GroupBy e -> liftM GroupBy (fix e)
GroupUsing e -> liftM GroupUsing (fix e)
GroupByUsing e1 e2 -> liftM2 GroupByUsing (fix e1) (fix e2)
where fix x = applyFixities fixs x
instance AppFixity Bracket where
applyFixities fixs br = case br of
ExpBracket e -> liftM ExpBracket $ fix e
PatBracket p -> liftM PatBracket $ fix p
DeclBracket ds -> liftM DeclBracket $ mapM fix ds
_ -> return br
where fix x = applyFixities fixs x
instance AppFixity Splice where
applyFixities fixs (ParenSplice e) = liftM ParenSplice $ applyFixities fixs e
applyFixities _ s = return s
instance AppFixity XAttr where
applyFixities fixs (XAttr n e) = liftM (XAttr n) $ applyFixities fixs e
-- the boring boilerplate stuff for expressions too
-- Recursively fixes the "leaves" of the infix chains,
-- without yet touching the chain itself. We assume all chains are
-- left-associate to begin with.
leafFix fixs e = case e of
InfixApp e1 op e2 -> liftM2 (flip InfixApp op) (leafFix fixs e1) (fix e2)
App e1 e2 -> liftM2 App (fix e1) (fix e2)
NegApp e -> liftM NegApp $ fix e
Lambda loc pats e -> liftM2 (Lambda loc) (mapM fix pats) $ fix e
Let bs e -> liftM2 Let (fix bs) $ fix e
If e a b -> liftM3 If (fix e) (fix a) (fix b)
Case e alts -> liftM2 Case (fix e) $ mapM fix alts
Do stmts -> liftM Do $ mapM fix stmts
MDo stmts -> liftM MDo $ mapM fix stmts
Tuple bx exps -> liftM (Tuple bx) $ mapM fix exps
List exps -> liftM List $ mapM fix exps
Paren e -> liftM Paren $ fix e
LeftSection e op -> liftM (flip LeftSection op) (fix e)
RightSection op e -> liftM (RightSection op) $ fix e
RecConstr n fups -> liftM (RecConstr n) $ mapM fix fups
RecUpdate e fups -> liftM2 RecUpdate (fix e) $ mapM fix fups
EnumFrom e -> liftM EnumFrom $ fix e
EnumFromTo e1 e2 -> liftM2 EnumFromTo (fix e1) (fix e2)
EnumFromThen e1 e2 -> liftM2 EnumFromThen (fix e1) (fix e2)
EnumFromThenTo e1 e2 e3 -> liftM3 EnumFromThenTo (fix e1) (fix e2) (fix e3)
ListComp e quals -> liftM2 ListComp (fix e) $ mapM fix quals
ParComp e qualss -> liftM2 ParComp (fix e) $ mapM (mapM fix) qualss
ExpTypeSig loc e t -> liftM (flip (ExpTypeSig loc) t) (fix e)
BracketExp b -> liftM BracketExp $ fix b
SpliceExp s -> liftM SpliceExp $ fix s
XTag loc n ats mexp cs -> liftM3 (XTag loc n) (mapM fix ats) (mapM fix mexp) (mapM fix cs)
XETag loc n ats mexp -> liftM2 (XETag loc n) (mapM fix ats) (mapM fix mexp)
XExpTag e -> liftM XExpTag $ fix e
XChildTag loc cs -> liftM (XChildTag loc) $ mapM fix cs
Proc loc p e -> liftM2 (Proc loc) (fix p) (fix e)
LeftArrApp e1 e2 -> liftM2 LeftArrApp (fix e1) (fix e2)
RightArrApp e1 e2 -> liftM2 RightArrApp (fix e1) (fix e2)
LeftArrHighApp e1 e2 -> liftM2 LeftArrHighApp (fix e1) (fix e2)
RightArrHighApp e1 e2 -> liftM2 RightArrHighApp (fix e1) (fix e2)
CorePragma s e -> liftM (CorePragma s) (fix e)
SCCPragma s e -> liftM (SCCPragma s) (fix e)
GenPragma s ab cd e -> liftM (GenPragma s ab cd) (fix e)
_ -> return e
where
fix x = applyFixities fixs x
leafFixP fixs p = case p of
PInfixApp p1 op p2 -> liftM2 (flip PInfixApp op) (leafFixP fixs p1) (fix p2)
PNeg p -> liftM PNeg $ fix p
PApp n ps -> liftM (PApp n) $ mapM fix ps
PTuple bx ps -> liftM (PTuple bx) $ mapM fix ps
PList ps -> liftM PList $ mapM fix ps
PParen p -> liftM PParen $ fix p
PRec n pfs -> liftM (PRec n) $ mapM fix pfs
PAsPat n p -> liftM (PAsPat n) $ fix p
PIrrPat p -> liftM PIrrPat $ fix p
PatTypeSig loc p t -> liftM (flip (PatTypeSig loc) t) (fix p)
PViewPat e p -> liftM2 PViewPat (fix e) (fix p)
PRPat rps -> liftM PRPat $ mapM fix rps
PXTag loc n ats mp ps -> liftM3 (PXTag loc n) (mapM fix ats) (mapM fix mp) (mapM fix ps)
PXETag loc n ats mp -> liftM2 (PXETag loc n) (mapM fix ats) (mapM fix mp)
PXPatTag p -> liftM PXPatTag $ fix p
PXRPats rps -> liftM PXRPats $ mapM fix rps
PBangPat p -> liftM PBangPat $ fix p
_ -> return p
where fix x = applyFixities fixs x
|
rodrigogribeiro/mptc
|
src/Language/Haskell/Exts/Fixity.hs
|
bsd-3-clause
| 16,996
| 0
| 22
| 5,176
| 5,724
| 2,814
| 2,910
| 276
| 38
|
-- Countdown example from chapter 11 of Programming in Haskell,
-- Graham Hutton, Cambridge University Press, 2007.
module Countdown where
import System.CPUTime
import Numeric
import System.IO
-- Expressions
-----------
data Op = Add | Sub | Mul | Div
valid :: Op -> Int -> Int -> Bool
valid Add _ _ = True
valid Sub x y = x > y
valid Mul _ _ = True
valid Div x y = x `mod` y == 0
apply :: Op -> Int -> Int -> Int
apply Add x y = x + y
apply Sub x y = x - y
apply Mul x y = x * y
apply Div x y = x `div` y
data Expr = Val Int | App Op Expr Expr
values :: Expr -> [Int]
values (Val n) = [n]
values (App _ l r) = values l ++ values r
eval :: Expr -> [Int]
eval (Val n) = [n | n > 0]
eval (App o l r) = [apply o x y | x <- eval l
, y <- eval r
, valid o x y]
-- Combinatorial functions
-----------------------
{- Subsets Ordered Lists that comprise the input List
Test with:
subs [0] ==> [[],[0]]
subs [1,2] ==> [[],[2],[1],[1,2]]
subs [1,2,3] ==> [[],[3],[2],[2,3],[1],[1,3],[1,2],[1,2,3]]
subs [1,2,3,4] ==> [[],[4],[3],[3,4],[2],[2,4],[2,3],[2,3,4],[1],[1,4],[1,3],[1,3,4],[1,2],[1,2,4],[1,2,3],[1,2,3,4]]
-}
subs :: [a] -> [[a]]
subs [] = [[]]
subs (x:xs) = yss ++ map (x:) yss
where yss = subs xs
interleave :: a -> [a] -> [[a]]
interleave x [] = [[x]]
interleave x (y:ys) = (x:y:ys) : map (y:) (interleave x ys)
{- Permutations of a List (different ways the existing List can be ordered, including its original Order)
Test with:
perms [1,2] ==> [[1,2],[2,1]]
perms [1,2,3] ==> [[1,2,3],[2,1,3],[2,3,1],[1,3,2],[3,1,2],[3,2,1]]
-}
perms :: [a] -> [[a]]
perms [] = [[]]
perms (x:xs) = concat (map (interleave x) (perms xs))
{- Ex. 0
Choose a possible definition of the function choices :: [a] -> [[a]],
that returns all choices from a list, which are given by all possible
ways of selecting zero or more elements in any order.
Note: the definition of "subs" and "perms" can be found in the given template,
make sure that you play around with these functions in GHCi to understand
how they work before you attempt to compose them together to implement "choices"
-}
{- WRONG Test with:
choices [] ==> [[]]
choices [1] ==> [[1],[1,1]]
choices [1,2] ==> [[1,2],[2,1],[2,1,2],[2,2,1],[1,1,2],[1,2,1],[1,2,1,2],[1,2,2,1]]
choices :: [a] -> [[a]]
choices xs = [ys ++ zs | ys <- subs xs, zs <- perms xs]
-}
{- WRONG - incorrect type
choices :: [a] -> [[a]]
choices xs = concat [zs | ys <- subs xs, zs <- perms ys]
-}
{- RIGHT Test with:
choices [] ==> [[]]
choices [1] ==> [[],[1]]
choices [1,2] ==> [[],[2],[1],[1,2],[2,1]]
-}
choices :: [a] -> [[a]]
choices xs = [zs | ys <- subs xs, zs <- perms ys]
{--}
{- WRONG Test with:
choices [] ==> [[]]
choices [1] ==> [[],[1]]
choices [1,2] ==> [[],[2],[1],[1,2],[],[1],[2],[2,1]]
choices :: [a] -> [[a]]
choices xs = [zs | ys <- perms xs, zs <- subs ys]
-}
-- Formalising the problem
-----------------------
solution :: Expr -> [Int] -> Int -> Bool
solution e ns n = elem (values e) (choices ns) && eval e == [n]
-- Brute force solution
--------------------
{- Ex. 3
Choose a correct implementation of the function
split :: [a] -> [([a],[a])]
seen in the lecture, that returns all possible ways of
splitting a list into two non-empty lists that append to
give the original list.
For additional understanding, try to test this function using quickcheck.
-}
{-
split :: [a] -> [([a], [a])]
split [] = []
split [x] = [x]
split (x : xs) = [([x] : (ls ++ rs)) | (ls, rs) <- split xs]
split :: [a] -> [([a], [a])]
split [] = []
split (x : xs) = ([x], xs) : (split xs)
split :: [a] -> [([a], [a])]
split [] = []
split (x : xs) = [(x : ls, rs) | (ls, rs) <- split xs]
-}
{- RIGHT
Test with:
split [1,3,7,10,25,50] ==>
[([1],[3,7,10,25,50]),([1,3],[7,10,25,50]),([1,3,7],[10,25,50]),([1,3,7,10],[25,50]),([1,3,7,10,25],[50])]
-}
split :: [a] -> [([a], [a])]
split [] = []
split [_] = []
split (x : xs) = ([x], xs) : [(x : ls, rs) | (ls, rs) <- split xs]
exprs :: [Int] -> [Expr]
exprs [] = []
exprs [n] = [Val n]
exprs ns = [e | (ls,rs) <- split ns
, l <- exprs ls
, r <- exprs rs
, e <- combine l r]
combine :: Expr -> Expr -> [Expr]
combine l r = [App o l r | o <- ops]
ops :: [Op]
ops = [Add,Sub,Mul,Div]
solutions :: [Int] -> Int -> [Expr]
solutions ns n = [e | ns' <- choices ns
, e <- exprs ns'
, eval e == [n]]
-- Combining generation and evaluation
-----------------------------------
type Result = (Expr,Int)
results :: [Int] -> [Result]
results [] = []
results [n] = [(Val n,n) | n > 0]
results ns = [res | (ls,rs) <- split ns
, lx <- results ls
, ry <- results rs
, res <- combine' lx ry]
combine' :: Result -> Result -> [Result]
combine' (l,x) (r,y) = [(App o l r, apply o x y) | o <- ops
, valid o x y]
solutions' :: [Int] -> Int -> [Expr]
solutions' ns n = [e | ns' <- choices ns
, (e,m) <- results ns'
, m == n]
-- Exploiting numeric properties
-----------------------------
valid' :: Op -> Int -> Int -> Bool
valid' Add x y = x <= y
valid' Sub x y = x > y
valid' Mul x y = x /= 1 && y /= 1 && x <= y
valid' Div x y = y /= 1 && x `mod` y == 0
results' :: [Int] -> [Result]
results' [] = []
results' [n] = [(Val n,n) | n > 0]
results' ns = [res | (ls,rs) <- split ns
, lx <- results' ls
, ry <- results' rs
, res <- combine'' lx ry]
combine'' :: Result -> Result -> [Result]
combine'' (l,x) (r,y) = [(App o l r, apply o x y) | o <- ops
, valid' o x y]
solutions'' :: [Int] -> Int -> [Expr]
solutions'' ns n = [e | ns' <- choices ns
, (e,m) <- results' ns'
, m == n]
-- Interactive version for testing
-------------------------------
instance Show Op where
show Add = "+"
show Sub = "-"
show Mul = "*"
show Div = "/"
instance Show Expr where
show (Val n) = show n
show (App o l r) = bracket l ++ show o ++ bracket r
where
bracket (Val n) = show n
bracket e = "(" ++ show e ++ ")"
showtime :: Integer -> String
showtime t = showFFloat (Just 3)
(fromIntegral t / (10^12)) " seconds"
display :: [Expr] -> IO ()
display es = do t0 <- getCPUTime
if null es then
do t1 <- getCPUTime
putStr "\nThere are no solutions, verified in "
putStr (showtime (t1 - t0))
else
do t1 <- getCPUTime
putStr "\nOne possible solution is "
putStr (show (head es))
putStr ", found in "
putStr (showtime (t1 - t0))
putStr "\n\nPress return to continue searching..."
getLine
putStr "\n"
t2 <- getCPUTime
if null (tail es) then
putStr "There are no more solutions"
else
do sequence [print e | e <- tail es]
putStr "\nThere were "
putStr (show (length es))
putStr " solutions in total, found in "
t3 <- getCPUTime
putStr (showtime ((t1 - t0) + (t3 - t2)))
putStr ".\n\n"
main :: IO ()
main = do hSetBuffering stdout NoBuffering
putStrLn "\nCOUNTDOWN NUMBERS GAME SOLVER"
putStrLn "-----------------------------\n"
putStr "Enter the given numbers : "
ns <- readLn
putStr "Enter the target number : "
n <- readLn
display (solutions'' ns n)
{- Ex. 1
Choose the correct implementation of a function
removeone :: Eq a => a -> [a] -> [a]
that removes the first occurence of a given element from a list.
-}
{- WRONG - y not in scope
removeone :: Eq a => a -> [a] -> [a]
removeone x [] = [x]
removeone x ys
| x == head ys = ys
| otherwise = y : removeone x ys
-}
{- WRONG
Tested with:
removeone 2 [1,2,3,4,5]
[2,1,2,3,4]
Incorrectly remove last element and added given element at start
removeone :: Eq a => a -> [a] -> [a]
removeone x [] = []
removeone x (y : ys)
| x == y = ys
| otherwise = x : removeone y ys
-}
{- WRONG
removeone :: Eq a => a -> [a] -> [a]
removeone x [] = []
removeone x ys
| x == head ys = ys
| otherwise = removeone x ys
-}
{- RIGHT
Test with:
removeone 3 [2,3,5,1,5,3]
[2,5,1,5,3]
-}
removeone :: Eq a => a -> [a] -> [a]
removeone x [] = []
removeone x (y : ys)
| x == y = ys
| otherwise = y : removeone x ys
{- Ex. 2
Choose a correct implementation of the function
isChoice :: Eq a => [a] -> [a] -> Bool
that decides whether one list is chosen from another.
In other words, "isChoice xs ys" checks whether all elements
in "xs" are present in "ys".
-}
{- RIGHT
isChoice :: Eq a => [a] -> [a] -> Bool
isChoice [] _ = True
isChoice (x : xs) [] = False
isChoice (x : xs) ys = elem x ys && isChoice xs (removeone x ys)
-}
{- WRONG
isChoice :: Eq a => [a] -> [a] -> Bool
isChoice [] _ = False
isChoice (x : xs) [] = True
isChoice (x : xs) (y : ys)
= elem y xs && isChoice xs (removeone x ys)
-}
{- WRONG
isChoice :: Eq a => [a] -> [a] -> Bool
isChoice [] _ = True
isChoice xs [] = True
isChoice xs ys
= elem (head xs) ys && isChoice xs (removeone (head y) ys)
-}
{- WRONG
Test with:
isChoice [1..2] [] ==> False
isChoice [1, 2, 3] [3, 2, 1] ==> True
isChoice :: Eq a => [a] -> [a] -> Bool
isChoice [] _ = True
isChoice (x : xs) [] = False
isChoice (x : xs) ys
= elem x ys && isChoice (removeone x xs) ys
-}
|
ltfschoen/HelloHaskell
|
src/Chapter2/Section2/Countdown.hs
|
mit
| 13,214
| 0
| 19
| 6,336
| 2,388
| 1,243
| 1,145
| 142
| 3
|
--
--
--
-----------------
-- Exercise 6.30.
-----------------
--
--
--
module E'6'30 where
import B'C'6
(
Position
, Image
)
changePosition :: Image -> Position -> Image
changePosition ( picture , ( oldX , oldY ) ) ( newX , newY )
= ( picture , ( newX , newY ) )
|
pascal-knodel/haskell-craft
|
_/links/E'6'30.hs
|
mit
| 288
| 0
| 7
| 77
| 77
| 51
| 26
| 8
| 1
|
--
--
--
----------------
-- Exercise 9.1.
----------------
--
--
--
module E'9''1 where
import Prelude hiding ( or )
fac :: Integer -> Integer
fac n
| n == 0 = 1
| otherwise = n * fac ( n - 1 )
-- 4 > 2 || ( fac ( -1 ) == 17 )
-- ~> True || ( fac ( -1 ) == 17 )
-- ~> True
-- Note: Haskell is a lazy language.
-- The definition of a boolean or function could look like this:
or :: Bool -> Bool -> Bool
or True _ = True
or _ _ = False
-- GHCi> True `or` ( fac ( -1 ) == 17 )
-- True
-- 4 > 2 && ( fac ( -1 ) == 17 )
-- ~> True && ( fac ( -1 ) == 17 )
-- exception: No termination.
-- Note: I wrote 'No termination' to indicate infinite recursion.
-- In practice, on a computer this results in consuming the
-- memory that the system provides the program with. Sooner
-- or later it causes a memory exception.
-- GHCi> fac ( -1 )
-- <interactive>: out of memory
|
pascal-knodel/haskell-craft
|
_/links/E'9''1.hs
|
mit
| 954
| 0
| 9
| 294
| 121
| 75
| 46
| 9
| 1
|
module Simple where
main = 2 + 4
|
roberth/uu-helium
|
docs/wiki-material/Simple1.hs
|
gpl-3.0
| 35
| 0
| 5
| 10
| 13
| 8
| 5
| 2
| 1
|
{-# LANGUAGE OverloadedStrings #-}
import Network.HTTP
import Data.Aeson
import Control.Applicative
import Data.ByteString.Lazy (pack)
import Data.ByteString.Internal
import Data.Map.Strict (Map, fromList, (!), adjust)
data Light = Light
{ state :: LightState
} deriving Show
instance FromJSON Light where
parseJSON (Object v) = Light <$>
v .: "state"
parseJSON _ = error "Can't decode into Light - not Object."
data LightState = LightState
{ on :: Bool
, bri :: Int
, hue :: Int
, sat :: Int
, xy :: [Double]
, alert :: String
, effect :: String
} deriving Show
instance FromJSON LightState where
parseJSON (Object v) = LightState <$>
v .: "on" <*>
v .: "bri" <*>
v .: "hue" <*>
v .: "sat" <*>
v .: "xy" <*>
v .: "alert" <*>
v .: "effect"
-- A non-Object value is of the wrong type, so fail.
parseJSON _ = error "Can't decode into LightState - not Object."
cs = Data.ByteString.Lazy.pack . map c2w
lights = simpleHTTP (getRequest $ apiBaseUrl ++ "lights") >>= getResponseBody >>= return . cs
apiBaseUrl = "http://192.168.2.13/api/1167c7272c58f39f20e271172bbe1f8f/"
extractMap :: Ord k => Maybe (Map k a) -> Map k a
extractMap (Just a) = a
extractMap Nothing = fromList []
currStatus = fmap (extractMap . decode) lights :: IO (Map String Light)
--This is how you would get the status for light #1:
m = do
x <- currStatus
return (x ! "1")
-- or
m' = currStatus >>= return . (flip (!) "1")
|
3amice/PhueControl
|
phue.hs
|
bsd-3-clause
| 1,714
| 0
| 19
| 565
| 454
| 248
| 206
| 44
| 1
|
{-# LANGUAGE NoImplicitPrelude #-}
-- safe inferred, with no pkg trust reqs
module Check08_A where
a :: a -> a
a n = n
|
sdiehl/ghc
|
testsuite/tests/safeHaskell/check/Check08_A.hs
|
bsd-3-clause
| 122
| 0
| 5
| 27
| 23
| 14
| 9
| 4
| 1
|
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Haskus.System.Linux.Graphics.Entities
( -- * IDs
EntityID (..)
, FrameSourceID
, ControllerID
, ConnectorID
, EncoderID
, PlaneID
-- * Connector
, Connector (..)
, Connection (..)
, ConnectedDevice (..)
-- * Encoder
, Encoder (..)
, EncoderType (..)
-- * Controller
, Controller (..)
, Frame (..)
-- * Plane
, Plane (..)
, DestRect (..)
, SrcRect (..)
-- * Frame source
, FrameSource (..)
, PixelSource (..)
)
where
import Haskus.Format.Binary.Word
import Haskus.Format.Binary.Storable
import Haskus.Format.Binary.FixedPoint
import Haskus.System.Linux.Internals.Graphics
import Haskus.System.Linux.Handle
import Haskus.System.Linux.Graphics.Mode
import Haskus.System.Linux.Graphics.Property
import Haskus.System.Linux.Graphics.PixelFormat
-------------------------------------------------------------------------------
-- IDs
-------------------------------------------------------------------------------
-- | Entity identifier
newtype EntityID a = EntityID
{ unEntityID :: Word32
} deriving (Show,Eq,Storable,Ord)
type FrameSourceID = EntityID FrameSource
type ConnectorID = EntityID Connector
type ControllerID = EntityID Controller
type EncoderID = EntityID Encoder
type PlaneID = EntityID Plane
-------------------------------------------------------------------------------
-- Connector
-------------------------------------------------------------------------------
-- | A connector on the graphic card
data Connector = Connector
{ connectorID :: ConnectorID -- ^ Connector identifier
, connectorType :: ConnectorType -- ^ Type of connector
, connectorByTypeIndex :: Word32 -- ^ Identifier within connectors of the same type
, connectorState :: Connection -- ^ Connection state
, connectorPossibleEncoderIDs :: [EncoderID] -- ^ IDs of the encoders that can work with this connector
, connectorEncoderID :: Maybe EncoderID -- ^ Currently used encoder
, connectorHandle :: Handle -- ^ Graphic card
} deriving (Show)
-- | Indicate if a cable is plugged in the connector
data Connection
= Connected ConnectedDevice -- ^ The connector is connected to a displaying device
| Disconnected -- ^ The connector is disconnected
| ConnectionUnknown -- ^ The connection state cannot be determined
deriving (Show)
-- | Information about the connected device
data ConnectedDevice = ConnectedDevice
{ connectedDeviceModes :: [Mode] -- ^ Supported modes
, connectedDeviceWidth :: Word32 -- ^ Width (in millimeters)
, connectedDeviceHeight :: Word32 -- ^ Height (in millimeters)
, connectedDeviceSubPixel :: SubPixel -- ^ Sub-pixel structure
, connectedDeviceProperties :: [Property] -- ^ Properties of the connector
} deriving (Show)
-------------------------------------------------------------------------------
-- Encoder
-------------------------------------------------------------------------------
-- | An encoder
--
-- An encoder converts data obtained from the controller (i.e. from the frame
-- buffer associated with the controller) into suitable data for the connector
-- (i.e. for the device connected to the connector). Hence it only supports a
-- set of connectors. In addition, it may not work with all controllers.
data Encoder = Encoder
{ encoderID :: EncoderID -- ^ Encoder identifier
, encoderType :: EncoderType -- ^ Type of the encoder
, encoderControllerID :: Maybe ControllerID -- ^ Associated controller
, encoderPossibleControllers :: [ControllerID] -- ^ Valid controllers
, encoderPossibleClones :: [EncoderID] -- ^ Valid clone encoders
, encoderHandle :: Handle -- ^ Graphic card
} deriving (Show)
-------------------------------------------------------------------------------
-- Controller
-------------------------------------------------------------------------------
-- | Scanout controller
--
-- A controller is used to configure what is displayed on the screen
-- Controllers are called CRTC in original terminology
data Controller = Controller
{ controllerID :: ControllerID -- ^ Controller identifier
, controllerMode :: Maybe Mode
, controllerFrame :: Maybe Frame -- ^ Associated frame source and its position (x,y)
, controllerGammaTableSize :: Word32
, controllerHandle :: Handle
} deriving (Show)
data Frame = Frame
{ frameBufferPosID :: FrameSourceID -- ^ Framebuffer identifier
, frameBufferPosX :: Word32
, frameBufferPosY :: Word32
} deriving (Show)
-------------------------------------------------------------------------------
-- Plane
-------------------------------------------------------------------------------
-- | A plane
data Plane = Plane
{ planeID :: PlaneID -- ^ Plane identifier
, planeControllerId :: Maybe ControllerID -- ^ Connected controller
, planeFrameSourceId :: Maybe FrameSourceID -- ^ Connected frame source
, planePossibleControllers :: [ControllerID] -- ^ Potential controllers
, planeGammaSize :: Word32 -- ^ Size of the gamma table
, planeFormats :: [PixelFormat] -- ^ Supported pixel formats
}
deriving (Show)
type FP16 = FixedPoint Word32 16 16
-- | Destination rectangle
data DestRect = DestRect
{ destX :: Int32
, destY :: Int32
, destWidth :: Word32
, destHeight :: Word32
}
deriving (Show,Eq)
-- | Source rectangle
data SrcRect = SrcRect
{ srcX :: FP16
, srcY :: FP16
, srcWidth :: FP16
, srcHeight :: FP16
}
deriving (Show,Eq)
-------------------------------------------------------------------------------
-- Frame source
-------------------------------------------------------------------------------
-- | Abstract frame source
data FrameSource = FrameSource
{ frameID :: FrameSourceID -- ^ Frame buffer identifier
, frameWidth :: Word32 -- ^ Frame buffer width
, frameHeight :: Word32 -- ^ Frame buffer height
, framePixelFormat :: PixelFormat -- ^ Pixel format
, frameFlags :: FrameBufferFlags -- ^ Flags
, frameSources :: [PixelSource] -- ^ Data sources (up to four)
} deriving (Show)
-- | Pixel source
data PixelSource = PixelSource
{ surfaceHandle :: Word32 -- ^ Handle of the surface
, surfacePitch :: Word32 -- ^ Pitch of the surface
, surfaceOffset :: Word32 -- ^ Offset of the surface
, surfaceModifiers :: Word64 -- ^ Modifiers for the surface
} deriving (Show)
|
hsyl20/ViperVM
|
haskus-system/src/lib/Haskus/System/Linux/Graphics/Entities.hs
|
bsd-3-clause
| 6,944
| 0
| 9
| 1,624
| 885
| 593
| 292
| 114
| 0
|
module Cabal2Nix.Name ( toNixName, toNixName', libNixName, buildToolNixName ) where
import Data.Char
-- | Map Cabal names to Nix attribute names.
toNixName :: String -> String
toNixName = id
-- | The old mapping function. This may be useful to generate a compatibility layer.
toNixName' :: String -> String
toNixName' [] = error "toNixName: empty string is not a valid argument"
toNixName' name = f name
where
f [] = []
f ('-':c:cs) | c `notElem` "-" = toUpper c : f cs
f ('-':_) = error ("unexpected package name " ++ show name)
f (c:cs) = c : f cs
-- | Map libraries to Nix packages.
-- TODO: This should probably be configurable. We also need to consider the
-- possibility of name clashes with Haskell libraries. I have included
-- identity mappings to incicate that I have verified their correctness.
libNixName :: String -> [String]
libNixName "adns" = return "adns"
libNixName "alsa" = return "alsaLib"
libNixName "alut" = return "freealut"
libNixName "appindicator-0.1" = return "appindicator"
libNixName "appindicator3-0.1" = return "appindicator"
libNixName "asound" = return "alsaLib"
libNixName "awesomium-1.6.5" = return "awesomium"
libNixName "bz2" = return "bzip2"
libNixName "cairo-pdf" = return "cairo"
libNixName "cairo-ps" = return "cairo"
libNixName "cairo" = return "cairo"
libNixName "cairo-svg" = return "cairo"
libNixName "CEGUIBase-0.7.7" = return "CEGUIBase"
libNixName "CEGUIOgreRenderer-0.7.7" = return "CEGUIOgreRenderer"
libNixName "clutter-1.0" = return "clutter"
libNixName "crypto" = return "openssl"
libNixName "crypt" = [] -- provided by glibc
libNixName "curses" = return "ncurses"
libNixName "c++" = [] -- What is that?
libNixName "dl" = [] -- provided by glibc
libNixName "fftw3f" = return "fftwFloat"
libNixName "fftw3" = return "fftw"
libNixName "gconf-2.0" = return "GConf"
libNixName "gconf" = return "GConf"
libNixName "gdk-2.0" = return "gtk"
libNixName "gdk-pixbuf-2.0" = return "gdk_pixbuf"
libNixName "gdk-x11-2.0" = return "gdk_x11"
libNixName "gio-2.0" = return "glib"
libNixName "glib-2.0" = return "glib"
libNixName "GL" = return "mesa"
libNixName "GLU" = ["freeglut","mesa"]
libNixName "glut" = ["freeglut","mesa"]
libNixName "gmime-2.4" = return "gmime"
libNixName "gnome-keyring-1" = return "gnome_keyring"
libNixName "gnome-keyring" = return "gnome_keyring"
libNixName "gnome-vfs-2.0" = return "gnome_vfs"
libNixName "gnome-vfs-module-2.0" = return "gnome_vfs_module"
libNixName "gobject-2.0" = return "glib"
libNixName "gstreamer-0.10" = return "gstreamer"
libNixName "gstreamer-audio-0.10" = return "gst_plugins_base"
libNixName "gstreamer-base-0.10" = return "gst_plugins_base"
libNixName "gstreamer-controller-0.10" = return "gstreamer"
libNixName "gstreamer-dataprotocol-0.10" = return "gstreamer"
libNixName "gstreamer-net-0.10" = return "gst_plugins_base"
libNixName "gstreamer-plugins-base-0.10" = return "gst_plugins_base"
libNixName "gthread-2.0" = return "glib"
libNixName "gtk+-2.0" = return "gtk"
libNixName "gtk+-3.0" = return "gtk3"
libNixName "gtkglext-1.0" = return "gtkglext"
libNixName "gtksourceview-2.0" = return "gtksourceview"
libNixName "gtksourceview-3.0" = return "gtksourceview"
libNixName "gtk-x11-2.0" = return "gtk_x11"
libNixName "icudata" = return "icu"
libNixName "icui18n" = return "icu"
libNixName "icuuc" = return "icu"
libNixName "idn" = return "libidn"
libNixName "IL" = return "libdevil"
libNixName "Imlib2" = return "imlib2"
libNixName "iw" = return "wirelesstools"
libNixName "jack" = return "jack2"
libNixName "jpeg" = return "libjpeg"
libNixName "ldap" = return "openldap"
libNixName "libavutil" = return "ffmpeg"
libNixName "libglade-2.0" = return "libglade"
libNixName "libgsasl" = return "gsasl"
libNixName "librsvg-2.0" = return "librsvg"
libNixName "libsoup-gnome-2.4" = return "libsoup"
libNixName "libsystemd" = return "systemd"
libNixName "libusb-1.0" = return "libusb"
libNixName "libxml-2.0" = return "libxml2"
libNixName "libzip" = return "libzip"
libNixName "libzmq" = return "zeromq"
libNixName "m" = [] -- in stdenv
libNixName "mono-2.0" = return "mono"
libNixName "mpi" = return "openmpi"
libNixName "ncursesw" = return "ncurses"
libNixName "netsnmp" = return "net_snmp"
libNixName "notify" = return "libnotify"
libNixName "odbc" = return "unixODBC"
libNixName "panelw" = return "ncurses"
libNixName "pangocairo" = return "pango"
libNixName "pcap" = return "libpcap"
libNixName "pcre" = return "pcre"
libNixName "pfs-1.2" = return "pfstools"
libNixName "png" = return "libpng"
libNixName "poppler-glib" = return "poppler"
libNixName "portaudio-2.0" = return "portaudio"
libNixName "pq" = return "postgresql"
libNixName "pthread" = []
libNixName "pulse-simple" = return "libpulseaudio"
libNixName "python-3.3" = return "python3"
libNixName "Qt5Core" = return "qt5"
libNixName "Qt5Gui" = return "qt5"
libNixName "Qt5Qml" = return "qt5"
libNixName "Qt5Quick" = return "qt5"
libNixName "Qt5Widgets" = return "qt5"
libNixName "rtlsdr" = return "rtl-sdr"
libNixName "rt" = return [] -- in glibc
libNixName "ruby1.8" = return "ruby"
libNixName "sane-backends" = return "saneBackends"
libNixName "SDL2-2.0" = return "SDL2"
libNixName "sdl2" = return "SDL2"
libNixName "sndfile" = return "libsndfile"
libNixName "sqlite3" = return "sqlite"
libNixName "ssl" = return "openssl"
libNixName "stdc++.dll" = [] -- What is that?
libNixName "stdc++" = [] -- What is that?
libNixName "systemd-journal" = return "systemd"
libNixName "tag_c" = return "taglib"
libNixName "taglib_c" = return "taglib"
libNixName "udev" = return "systemd";
libNixName "uuid" = return "libossp_uuid";
libNixName "vte-2.90" = return "vte"
libNixName "webkit-1.0" = return "webkit"
libNixName "webkitgtk-3.0" = return "webkit"
libNixName "webkitgtk" = return "webkit"
libNixName "X11" = return "libX11"
libNixName "xau" = return "libXau"
libNixName "Xcursor" = return "libXcursor"
libNixName "xerces-c" = return "xercesc"
libNixName "Xext" = return "libXext"
libNixName "xft" = return "libXft"
libNixName "Xinerama" = return "libXinerama"
libNixName "Xi" = return "libXi"
libNixName "xkbcommon" = return "libxkbcommon"
libNixName "xml2" = return "libxml2"
libNixName "Xpm" = return "libXpm"
libNixName "Xrandr" = return "libXrandr"
libNixName "Xss" = return "libXScrnSaver"
libNixName "Xtst" = return "libXtst"
libNixName "Xxf86vm" = return "libXxf86vm"
libNixName "zmq" = return "zeromq"
libNixName "z" = return "zlib"
libNixName x = return x
-- | Map build tool names to Nix attribute names.
buildToolNixName :: String -> [String]
buildToolNixName "cabal" = return "cabal-install"
buildToolNixName "gtk2hsC2hs" = return "gtk2hs-buildtools"
buildToolNixName "gtk2hsHookGenerator" = return "gtk2hs-buildtools"
buildToolNixName "gtk2hsTypeGen" = return "gtk2hs-buildtools"
buildToolNixName x = return (toNixName x)
|
jb55/cabal2nix
|
src/Cabal2Nix/Name.hs
|
bsd-3-clause
| 10,443
| 0
| 10
| 4,533
| 1,753
| 827
| 926
| 152
| 4
|
-- Copyright 2013 Thomas Szczarkowski
{-# LANGUAGE ScopedTypeVariables #-}
module OpenSSL.Random(cryptoRandomBytes) where
import qualified Data.ByteString as ByteString
import Foreign
import Foreign.C.Types
import Foreign.C.String
import Foreign.Marshal.Alloc
import Control.Monad
import Control.Exception
import OpenSSL.Error
check cond err = if cond then return () else throw $ userError err
cryptoRandomBytes n =
allocaBytes n $ \(buf :: Ptr CChar) ->
do ret <- c_RAND_bytes buf (fromIntegral n)
assertSSL ret "Error using OpenSSL RNG:"
peekByteArray n buf
where peekByteArray count = liftM (ByteString.pack . map fromIntegral) . (peekArray count)
foreign import ccall unsafe "RAND_bytes" c_RAND_bytes ::
Ptr CChar -> CInt -> IO CInt
|
tom-szczarkowski/matasano-crypto-puzzles-solutions
|
set6/OpenSSL/Random.hs
|
mit
| 799
| 0
| 12
| 160
| 214
| 113
| 101
| 19
| 2
|
{- |
Module : $Header$
Description : resolve type constraints
Copyright : (c) Christian Maeder and Uni Bremen 2003-2005
License : GPLv2 or higher, see LICENSE.txt
Maintainer : Christian.Maeder@dfki.de
Stability : experimental
Portability : portable
constraint resolution
-}
module HasCASL.Constrain
( Constraints
, Constrain (..)
, noC
, substC
, joinC
, insertC
, partitionC
, toListC
, shapeRelAndSimplify
, fromTypeMap
) where
import HasCASL.Unify
import HasCASL.As
import HasCASL.FoldType
import HasCASL.AsUtils
import HasCASL.Le
import HasCASL.PrintLe ()
import HasCASL.TypeAna
import HasCASL.ClassAna
import HasCASL.VarDecl
import qualified Data.Set as Set
import qualified Data.Map as Map
import qualified Common.Lib.Rel as Rel
import Common.Lib.State
import Common.Doc
import Common.DocUtils
import Common.Id
import Common.Result
import Common.Utils
import Control.Exception (assert)
import Control.Monad
import Data.List
import Data.Maybe
instance Pretty Constrain where
pretty c = case c of
Kinding ty k -> pretty $ KindedType ty (Set.singleton k) nullRange
Subtyping t1 t2 -> fsep [pretty t1, less <+> pretty t2]
instance GetRange Constrain where
getRange c = case c of
Kinding ty _ -> getRange ty
Subtyping t1 t2 -> getRange t1 `appRange` getRange t2
type Constraints = Set.Set Constrain
noC :: Constraints
noC = Set.empty
joinC :: Constraints -> Constraints -> Constraints
joinC = Set.union
noVars :: Constrain -> Bool
noVars c = case c of
Kinding ty _ -> null $ freeTVars ty
Subtyping t1 t2 -> null (freeTVars t1) && null (freeTVars t2)
partitionVarC :: Constraints -> (Constraints, Constraints)
partitionVarC = Set.partition noVars
insertC :: Constrain -> Constraints -> Constraints
insertC c = case c of
Subtyping t1 t2 -> if t1 == t2 then id else Set.insert c
Kinding _ k -> if k == universe then id else Set.insert c
substC :: Subst -> Constraints -> Constraints
substC s = Set.fold (insertC . ( \ c -> case c of
Kinding ty k -> Kinding (subst s ty) k
Subtyping t1 t2 -> Subtyping (subst s t1) $ subst s t2)) noC
simplify :: Env -> Constraints -> ([Diagnosis], Constraints)
simplify te rs =
if Set.null rs then ([], noC)
else let (r, rt) = Set.deleteFindMin rs
Result ds m = entail te r
(es, cs) = simplify te rt
in (ds ++ es, case m of
Just _ -> cs
Nothing -> insertC r cs)
entail :: Monad m => Env -> Constrain -> m ()
entail te c = let cm = classMap te in case c of
Kinding ty k -> if k == universe then
assert (rawKindOfType ty == ClassKind ())
$ return () else
let Result _ds mk = inferKinds Nothing ty te in
case mk of
Nothing -> fail $ "constrain '" ++
showDoc c "' is unprovable"
Just ((_, ks), _) -> when (newKind cm k ks)
$ fail $ "constrain '" ++
showDoc c "' is unprovable" ++
if Set.null ks then "" else
"\n known kinds are: " ++ showDoc ks ""
Subtyping t1 t2 -> unless (lesserType te t1 t2)
$ fail ("unable to prove: " ++ showDoc t1 " < "
++ showDoc t2 "")
freshLeaves :: Type -> State Int Type
freshLeaves ty = case ty of
TypeName i k _ -> do
(var, c) <- freshVar i
return $ TypeName var k c
TypeAppl tl@(TypeName l _ _) t | l == lazyTypeId -> do
nt <- freshLeaves t
return $ TypeAppl tl nt
TypeAppl f a -> case redStep ty of
Just r -> freshLeaves r
Nothing -> do
nf <- freshLeaves f
na <- freshLeaves a
return $ TypeAppl nf na
KindedType t k p -> do
nt <- freshLeaves t
return $ KindedType nt k p
ExpandedType _ t | noAbs t -> freshLeaves t
ExpandedType e t -> do
ne <- freshLeaves e
nt <- freshLeaves t
return $ ExpandedType ne nt
TypeAbs {} -> return ty
_ -> error "freshLeaves"
substPairList :: Subst -> [(Type, Type)] -> [(Type, Type)]
substPairList s = map ( \ (a, b) -> (subst s a, subst s b))
isAtomic :: (Type, Type) -> Bool
isAtomic p = case p of
(TypeName {}, TypeName {}) -> True
_ -> False
partEqShapes :: [(Type, Type)] -> [(Type, Type)]
partEqShapes = filter ( \ p -> case p of
(TypeName _ _ n1, TypeName _ _ n2) -> n1 /= n2
_ -> True)
-- pre: shapeMatchPairList succeeds
shapeMgu :: [(Type, Type)] -> [(Type, Type)] -> State Int (Result Subst)
shapeMgu knownAtoms cs = let (atoms, sts) = span isAtomic cs in
case sts of
[] -> return $ return eps
p@(t1, t2) : tl -> let
newKnowns = knownAtoms ++ partEqShapes atoms
rest = newKnowns ++ tl
in case p of
(ExpandedType _ t, _) | noAbs t -> shapeMgu newKnowns $ (t, t2) : tl
(_, ExpandedType _ t) | noAbs t -> shapeMgu newKnowns $ (t1, t) : tl
(KindedType t _ _, _) -> shapeMgu newKnowns $ (t, t2) : tl
(_, KindedType t _ _) -> shapeMgu newKnowns $ (t1, t) : tl
(TypeAppl (TypeName l1 _ _) a1, TypeAppl (TypeName l2 _ _) a2)
| l1 == lazyTypeId && l2 == lazyTypeId ->
shapeMgu newKnowns $ (a1, a2) : tl
(TypeAppl (TypeName l _ _) t, TypeName {}) | l == lazyTypeId ->
shapeMgu newKnowns $ (t, t2) : tl
(TypeName {}, TypeAppl (TypeName l _ _) t) | l == lazyTypeId ->
shapeMgu newKnowns $ (t1, t) : tl
(TypeName _ _ v1, _) | v1 > 0 -> do
vt <- freshLeaves t2
let s = Map.singleton v1 vt
Result ds mr <- shapeMgu [] $ (vt, t2) : substPairList s rest
case mr of
Just r -> return $ return $ compSubst s r
Nothing -> return $ Result ds Nothing
(_, TypeName _ _ v2) | v2 > 0 -> do
vt <- freshLeaves t1
let s = Map.singleton v2 vt
Result ds mr <- shapeMgu [] $ (t1, vt) : substPairList s rest
case mr of
Just r -> return $ return $ compSubst s r
Nothing -> return $ Result ds Nothing
(TypeAppl f1 a1, TypeAppl f2 a2) -> case (f1, f2) of
(_, TypeName l _ _) | l == lazyTypeId ->
shapeMgu newKnowns $ (t1, a2) : tl
(TypeName l _ _, _) | l == lazyTypeId ->
shapeMgu newKnowns $ (a1, t2) : tl
_ -> case redStep t1 of
Just r1 -> shapeMgu newKnowns $ (r1, t2) : tl
Nothing -> case redStep t2 of
Just r2 -> shapeMgu newKnowns $ (t1, r2) : tl
Nothing -> shapeMgu newKnowns $ (f1, f2) :
case (rawKindOfType f1, rawKindOfType f2) of
(FunKind CoVar _ _ _,
FunKind CoVar _ _ _) -> (a1, a2) : tl
(FunKind ContraVar _ _ _,
FunKind ContraVar _ _ _) -> (a2, a1) : tl
_ -> (a1, a2) : (a2, a1) : tl
_ -> shapeMgu newKnowns tl -- ignore non-matching pairs
inclusions :: [(Type, Type)] -> [(Type, Type)]
inclusions cs = let (atoms, sts) = partition isAtomic cs in
case sts of
[] -> atoms
p@(t1, t2) : tl -> atoms ++ case p of
(ExpandedType _ t, _) | noAbs t -> inclusions $ (t, t2) : tl
(_, ExpandedType _ t) | noAbs t -> inclusions $ (t1, t) : tl
(KindedType t _ _, _) -> inclusions $ (t, t2) : tl
(_, KindedType t _ _) -> inclusions $ (t1, t) : tl
(TypeAppl (TypeName l1 _ _) a1, TypeAppl (TypeName l2 _ _) a2)
| l1 == lazyTypeId && l2 == lazyTypeId ->
inclusions $ (a1, a2) : tl
(TypeAppl (TypeName l _ _) t, TypeName {}) | l == lazyTypeId ->
inclusions $ (t, t2) : tl
(TypeName {}, TypeAppl (TypeName l _ _) t) | l == lazyTypeId ->
inclusions $ (t1, t) : tl
_ -> case redStep t1 of
Nothing -> case redStep t2 of
Nothing -> case p of
(TypeAppl f1 a1, TypeAppl f2 a2) -> case (f1, f2) of
(_, TypeName l _ _)
| l == lazyTypeId ->
inclusions $ (t1, a2) : tl
(TypeName l _ _, _)
| l == lazyTypeId ->
inclusions $ (a1, t2) : tl
_ -> inclusions $
(f1, f2) : case (rawKindOfType f1, rawKindOfType f2) of
(FunKind CoVar _ _ _,
FunKind CoVar _ _ _) -> (a1, a2) : tl
(FunKind ContraVar _ _ _,
FunKind ContraVar _ _ _) -> (a2, a1) : tl
_ -> (a1, a2) : (a2, a1) : tl
_ -> p : inclusions tl
Just r2 -> inclusions $ (t1, r2) : tl
Just r1 -> inclusions $ (r1, t2) : tl
shapeUnify :: [(Type, Type)] -> State Int (Result (Subst, [(Type, Type)]))
shapeUnify l = do
Result ds ms <- shapeMgu [] l
case ms of
Just s -> return $ Result ds $ Just (s, inclusions $ substPairList s l)
Nothing -> return $ Result ds Nothing
-- input an atomized constraint list
collapser :: Rel.Rel Type -> Result Subst
collapser r =
let t = Rel.sccOfClosure r
ks = map (Set.partition ( \ e -> case e of
TypeName _ _ n -> n == 0
_ -> error "collapser")) t
ws = filter (hasMany . fst) ks
in if null ws then
return $ foldr ( \ (cs, vs) s -> extendSubst s $
if Set.null cs then Set.deleteFindMin vs
else (Set.findMin cs, vs)) eps ks
else Result
(map ( \ (cs, _) ->
let (c1, rs) = Set.deleteFindMin cs
c2 = Set.findMin rs
in Diag Hint ("contradicting type inclusions for '"
++ showDoc c1 "' and '"
++ showDoc c2 "'") nullRange) ws) Nothing
extendSubst :: Subst -> (Type, Set.Set Type) -> Subst
extendSubst s (t, vs) = Set.fold ( \ ~(TypeName _ _ n) ->
Map.insert n t) s vs
-- | partition into qualification and subtyping constraints
partitionC :: Constraints -> (Constraints, Constraints)
partitionC = Set.partition ( \ c -> case c of
Kinding _ _ -> True
Subtyping _ _ -> False)
-- | convert subtypings constrains to a pair list
toListC :: Constraints -> [(Type, Type)]
toListC l = [ (t1, t2) | Subtyping t1 t2 <- Set.toList l ]
shapeMatchPairList :: TypeMap -> [(Type, Type)] -> Result Subst
shapeMatchPairList tm l = case l of
[] -> return eps
(t1, t2) : rt -> do
s1 <- shapeMatch tm t1 t2
s2 <- shapeMatchPairList tm $ substPairList s1 rt
return $ compSubst s1 s2
shapeRel :: Env -> [(Type, Type)] -> State Int (Result (Subst, Rel.Rel Type))
shapeRel te subL =
case shapeMatchPairList (typeMap te) subL of
Result ds Nothing -> return $ Result ds Nothing
_ -> do
Result rs msa <- shapeUnify subL
case msa of
Just (s1, atoms0) ->
let atoms = filter isAtomic atoms0
r = Rel.transClosure $ Rel.fromList atoms
es = Map.foldWithKey ( \ t1 st l1 ->
case t1 of
TypeName _ _ 0 -> Set.fold ( \ t2 l2 ->
case t2 of
TypeName _ _ 0 -> if lesserType te t1 t2
then l2 else (t1, t2) : l2
_ -> l2) l1 st
_ -> l1) [] $ Rel.toMap r
in return $ if null es then
case collapser r of
Result ds Nothing -> Result ds Nothing
Result _ (Just s2) ->
return (compSubst s1 s2,
Rel.fromList $ substPairList s2 atoms0)
else Result (map ( \ (t1, t2) ->
mkDiag Hint "rejected" $
Subtyping t1 t2) es) Nothing
Nothing -> return $ Result rs Nothing
-- | compute monotonicity of a type variable
monotonic :: Int -> Type -> (Bool, Bool)
monotonic v = foldType FoldTypeRec
{ foldTypeName = \ _ _ _ i -> (True, i /= v)
, foldTypeAppl = \ ~t@(TypeAppl tf _) ~(f1, f2) (a1, a2) ->
-- avoid evaluation of (f1, f2) if it is not needed by "~"
case redStep t of
Just r -> monotonic v r
Nothing -> case rawKindOfType tf of
FunKind CoVar _ _ _ -> (f1 && a1, f2 && a2)
FunKind ContraVar _ _ _ -> (f1 && a2, f2 && a1)
_ -> (f1 && a1 && a2, f2 && a1 && a2)
, foldExpandedType = \ _ _ p -> p
, foldTypeAbs = \ _ _ _ _ -> (False, False)
, foldKindedType = \ _ p _ _ -> p
, foldTypeToken = \ _ _ -> error "monotonic.foldTypeToken"
, foldBracketType = \ _ _ _ _ -> error "monotonic.foldBracketType"
, foldMixfixType = \ _ -> error "monotonic.foldMixfixType" }
-- | find monotonicity based instantiation
monoSubst :: Rel.Rel Type -> Type -> Subst
monoSubst r t =
let varSet = Set.fromList . freeTVars
vs = Set.toList $ Set.union (varSet t) $ Set.unions $ map varSet
$ Set.toList $ Rel.nodes r
monos = filter ( \ (i, (n, rk)) -> case monotonic i t of
(True, _) -> isSingleton
(Rel.predecessors r $
TypeName n rk i)
_ -> False) vs
antis = filter ( \ (i, (n, rk)) -> case monotonic i t of
(_, True) -> isSingleton
(Rel.succs r $
TypeName n rk i)
_ -> False) vs
resta = filter ( \ (i, (n, rk)) -> case monotonic i t of
(True, True) -> hasMany $
Rel.succs r $ TypeName n rk i
_ -> False) vs
restb = filter ( \ (i, (n, rk)) -> case monotonic i t of
(True, True) -> hasMany $
Rel.predecessors r $ TypeName n rk i
_ -> False) vs
in if null antis then
if null monos then
if null resta then
if null restb then eps else
let (i, (n, rk)) = head restb
tn = TypeName n rk i
s = Rel.predecessors r tn
sl = Set.delete tn $ foldl1 Set.intersection
$ map (Rel.succs r)
$ Set.toList s
in Map.singleton i $ Set.findMin
$ if Set.null sl then s else sl
else let
(i, (n, rk)) = head resta
tn = TypeName n rk i
s = Rel.succs r tn
sl = Set.delete tn $ foldl1 Set.intersection
$ map (Rel.predecessors r)
$ Set.toList s
in Map.singleton i $ Set.findMin
$ if Set.null sl then s else sl
else Map.fromDistinctAscList $ map ( \ (i, (n, rk)) ->
(i, Set.findMin $ Rel.predecessors r $
TypeName n rk i)) monos
else Map.fromDistinctAscList $ map ( \ (i, (n, rk)) ->
(i, Set.findMin $ Rel.succs r $
TypeName n rk i)) antis
monoSubsts :: Rel.Rel Type -> Type -> Subst
monoSubsts r t =
let s = monoSubst (Rel.transReduce $ Rel.irreflex r) t in
if Map.null s then s else compSubst s
$ monoSubsts (Rel.transClosure $ Rel.map (subst s) r) $ subst s t
shapeRelAndMono :: Env -> [(Type, Type)] -> Maybe Type
-> State Int (Result (Subst, Rel.Rel Type))
shapeRelAndMono te subL mTy = do
res@(Result ds mc) <- shapeRel te
$ if isJust mTy then fromTypeVars (localTypeVars te) ++ subL else subL
return $ case mc of
Nothing -> Result ds Nothing
Just (s, trel) -> case mTy of
Nothing -> res
Just ty -> let
ms = monoSubsts
(Rel.transClosure $ Rel.union (fromTypeMap $ typeMap te)
trel) (subst s ty)
in Result ds
$ Just (compSubst s ms, Rel.map (subst ms) trel)
shapeRelAndSimplify :: Bool -> Env -> Constraints -> Maybe Type
-> State Int (Result (Subst, Constraints))
shapeRelAndSimplify doFail te cs mTy = do
let (qs, subS) = partitionC cs
subL = toListC subS
Result ds mc <- shapeRelAndMono te subL mTy
return $ case mc of
Nothing -> Result ds Nothing
Just (s, trel) ->
let (noVarCs, varCs) = partitionVarC
$ foldr (insertC . uncurry Subtyping)
(substC s qs) $ Rel.toList trel
(es, newCs) = simplify te noVarCs
fs = map ( \ d -> d {diagKind = Hint}) es
in Result (ds ++ fs)
$ if null fs || not doFail then
Just (s, joinC varCs newCs) else Nothing
-- | Downsets of type variables made monomorphic need to be considered
fromTypeVars :: LocalTypeVars -> [(Type, Type)]
fromTypeVars = Map.foldWithKey
(\ t (TypeVarDefn _ vk rk _) c -> case vk of
Downset ty -> (TypeName t rk 0, monoType ty) : c
_ -> c) []
-- | the type relation of declared types
fromTypeMap :: TypeMap -> Rel.Rel Type
fromTypeMap = Map.foldWithKey (\ t ti r -> let k = typeKind ti in
Set.fold ( \ j -> Rel.insertPair (TypeName t k 0)
$ TypeName j k 0) r
$ superTypes ti) Rel.empty
|
keithodulaigh/Hets
|
HasCASL/Constrain.hs
|
gpl-2.0
| 17,895
| 242
| 22
| 6,852
| 6,091
| 3,228
| 2,863
| 387
| 20
|
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
module Domen where
import GHC.Generics
import Data.Aeson (FromJSON, ToJSON)
data PhotoStruct = PhotoStruct {
userName :: String,
image_src :: String,
date :: String,
description :: String
} deriving (Show, Generic)
data UserInfo = UserInfo {
userN :: String,
realName :: String,
email :: String
} deriving (Show, Generic)
instance ToJSON PhotoStruct
instance FromJSON PhotoStruct
instance ToJSON UserInfo
instance FromJSON UserInfo
|
OurPrInstH/InstH
|
src/Domen.hs
|
bsd-3-clause
| 694
| 8
| 8
| 264
| 142
| 82
| 60
| 20
| 0
|
{-# LANGUAGE CPP #-}
-- | Fortune.hs, quote the fortune file
module Plugin.Quote.Fortune where
import Config
import Lambdabot.Util (stdGetRandItem, split)
import qualified Lambdabot.Util hiding (stdGetRandItem)
import Data.List
import Control.Monad
import System.Directory
import qualified Control.OldException as C (catch)
#ifndef mingw32_HOST_OS
--
-- No good for win32
--
import System.Posix (isRegularFile, getFileStatus)
#endif
-- | The 'filelist' function returns a List of fortune files from the
-- configured 'fortunePath' directory.
filelist :: IO [String]
filelist = do
filelist'<- C.catch (getDirectoryContents $ fortunePath config)
(\_ -> return [])
let files = filter (not . isSuffixOf ".dat") filelist'
join (return (filterM isFile (map (fortunePath config ++) files)))
-- | Select a random fortune file
fileRandom :: IO FilePath
fileRandom = filelist >>= stdGetRandItem
-- | Parse a file of fortunes into a list of the fortunes in the file.
fortunesParse :: FilePath -> IO [String]
fortunesParse filename = do
rawfs <- C.catch (readFile filename)
(\_ -> return "Couldn't find fortune file")
return $ split "%\n" rawfs
-- | Given a FilePath of a fortune file, select and return a random fortune from
-- it.
fortuneRandom :: FilePath -> IO String
fortuneRandom = (stdGetRandItem =<<) . fortunesParse
-- | Given an optional fortune section, return a random fortune. If Nothing,
-- then a random fortune from all fortune files is returned. If Just section,
-- then a random fortune from the given section is returned.
randFortune :: (Maybe FilePath) -> IO String
randFortune section = case section of
Nothing -> fortuneRandom =<< fileRandom
Just fname -> fortuneRandom =<< (return (fortunePath config ++ fname))
-- | 'isFile' is a predicate wheter or not a given FilePath is a file.
#ifdef mingw32_HOST_OS
isFile :: FilePath -> IO Bool
isFile = doesFileExist
#else
isFile :: FilePath -> IO Bool
isFile = (isRegularFile `fmap`) . getFileStatus
#endif
|
dmalikov/lambdabot
|
Plugin/Quote/Fortune.hs
|
mit
| 2,055
| 0
| 15
| 392
| 402
| 222
| 180
| 31
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.