-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlider.hs
36 lines (29 loc) · 1.06 KB
/
Slider.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
module Aitu.Bot.Forms.Content.Slider
( Slider(..)
, SliderItem(..)
)
where
import Data.Aeson hiding ( Options )
import Data.Text
import Aitu.Bot.Forms.Options ( Options )
import Aitu.Bot.Forms.Content.FileMetadata
( FileMetadata )
import qualified Aitu.Bot.Forms.Content.Content
as Content
data Slider = Slider {
contentId :: Content.ContentID
, items :: [SliderItem]
} deriving (Show)
instance ToJSON Slider where
toJSON Slider {..} =
object ["id" .= contentId, "type" .= Content.Slider, "items" .= items]
data SliderItem = SliderItem {
contentId :: Content.ContentID
, fileMetadata :: FileMetadata
} deriving (Show)
instance ToJSON SliderItem where
toJSON SliderItem {..} =
object ["id" .= contentId, "file_metadata" .= fileMetadata]