| Copyright | (c) 2021 Rory Tyler Hayford |
|---|---|
| License | BSD-3-Clause |
| Maintainer | rory.hayford@protonmail.com |
| Stability | experimental |
| Portability | GHC |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.Reddit.Types.Widget
Contents
Description
Synopsis
- data SubredditWidgets = SubredditWidgets {}
- data Widget
- newtype WidgetID = WidgetID Text
- data WidgetSection
- data ShortName
- mkShortName :: MonadThrow m => Text -> m ShortName
- data WidgetList
- data WidgetStyles = WidgetStyles {}
- data ButtonWidget = ButtonWidget {}
- data Button
- data ButtonImage = ButtonImage {}
- data ButtonText = ButtonText {}
- data ButtonHover
- data ImageHover = ImageHover {}
- data TextHover = TextHover {}
- data CalendarWidget = CalendarWidget {}
- data CalendarConfig = CalendarConfig {}
- defaultCalendarConfig :: CalendarConfig
- data CommunityListWidget = CommunityListWidget {}
- data CommunityInfo = CommunityInfo {
- name :: SubredditName
- subscribers :: Maybe Integer
- primaryColor :: Maybe RGBText
- iconURL :: Maybe URL
- communityIcon :: Maybe URL
- isSubscribed :: Maybe Bool
- isNSFW :: Maybe Bool
- mkCommunityInfo :: SubredditName -> CommunityInfo
- data CustomWidget = CustomWidget {}
- data ImageData = ImageData {}
- data IDCardWidget = IDCardWidget {}
- data ImageWidget = ImageWidget {}
- data Image = Image {}
- data MenuWidget = MenuWidget {}
- data MenuChild
- data MenuLink = MenuLink {}
- data Submenu = Submenu {}
- data ModeratorsWidget = ModeratorsWidget {}
- data ModInfo = ModInfo {}
- data PostFlairWidget = PostFlairWidget {}
- mkPostFlairWidget :: ShortName -> Seq FlairID -> PostFlairWidget
- data PostFlairInfo = PostFlairInfo {}
- data PostFlairWidgetDisplay
- data RulesWidget = RulesWidget {}
- data RulesDisplay
- data TextAreaWidget = TextAreaWidget {}
- mkTextAreaWidget :: ShortName -> Body -> TextAreaWidget
Documentation
data SubredditWidgets Source #
An organized collection of a subreddit's widgets
Constructors
| SubredditWidgets | |
Fields
| |
Instances
Represents one of various kinds of widgets
Constructors
Instances
A widget ID. These are usually prefixed with the type of widget it corresponds
to, e.g. rules-2qh1i for a RulesWidget
Instances
| Eq WidgetID Source # | |
| Show WidgetID Source # | |
| Generic WidgetID Source # | |
| ToJSON WidgetID Source # | |
Defined in Network.Reddit.Types.Widget | |
| FromJSON WidgetID Source # | |
| ToHttpApiData WidgetID Source # | |
Defined in Network.Reddit.Types.Widget Methods toUrlPiece :: WidgetID -> Text # toEncodedUrlPiece :: WidgetID -> Builder # toHeader :: WidgetID -> ByteString # toQueryParam :: WidgetID -> Text # | |
| type Rep WidgetID Source # | |
Defined in Network.Reddit.Types.Widget | |
data WidgetSection Source #
The section in which certain Widgets appear
Instances
| Eq WidgetSection Source # | |
Defined in Network.Reddit.Types.Widget Methods (==) :: WidgetSection -> WidgetSection -> Bool # (/=) :: WidgetSection -> WidgetSection -> Bool # | |
| Show WidgetSection Source # | |
Defined in Network.Reddit.Types.Widget Methods showsPrec :: Int -> WidgetSection -> ShowS # show :: WidgetSection -> String # showList :: [WidgetSection] -> ShowS # | |
| Generic WidgetSection Source # | |
Defined in Network.Reddit.Types.Widget Associated Types type Rep WidgetSection :: Type -> Type # | |
| ToHttpApiData WidgetSection Source # | |
Defined in Network.Reddit.Types.Widget Methods toUrlPiece :: WidgetSection -> Text # toEncodedUrlPiece :: WidgetSection -> Builder # toHeader :: WidgetSection -> ByteString # toQueryParam :: WidgetSection -> Text # | |
| type Rep WidgetSection Source # | |
A "short name" for any widget. This name must be less than 30 characters long
mkShortName :: MonadThrow m => Text -> m ShortName Source #
Smart constructor for ShortNames, which must be <= 30 characters long
data WidgetList Source #
Wrapper to parse a HashMap WidgetID Widget, discarding the ID keys
Instances
| Show WidgetList Source # | |
Defined in Network.Reddit.Types.Widget Methods showsPrec :: Int -> WidgetList -> ShowS # show :: WidgetList -> String # showList :: [WidgetList] -> ShowS # | |
| Generic WidgetList Source # | |
Defined in Network.Reddit.Types.Widget Associated Types type Rep WidgetList :: Type -> Type # | |
| FromJSON WidgetList Source # | |
Defined in Network.Reddit.Types.Widget | |
| type Rep WidgetList Source # | |
Defined in Network.Reddit.Types.Widget type Rep WidgetList = D1 ('MetaData "WidgetList" "Network.Reddit.Types.Widget" "heddit-0.0.1-76ROQ5tOAm3CpLSaFw8ccb" 'True) (C1 ('MetaCons "WidgetList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Seq Widget)))) | |
data WidgetStyles Source #
Style options for an individual widget
Constructors
| WidgetStyles | |
Fields | |
Instances
Individual widget types
All of the widget types in this module have a widgetID field
with the type Maybe WidgetID. This field should be present
when fetching existing widgets, but should be left as Nothing
if creating a new widget
data ButtonWidget Source #
A widget containing buttons
Constructors
| ButtonWidget | |
Instances
An individual button in a ButtonWidget
Constructors
| ImageButton ButtonImage | |
| TextButton ButtonText |
Instances
| Eq Button Source # | |
| Show Button Source # | |
| Generic Button Source # | |
| ToJSON Button Source # | |
Defined in Network.Reddit.Types.Widget | |
| FromJSON Button Source # | |
| type Rep Button Source # | |
Defined in Network.Reddit.Types.Widget type Rep Button = D1 ('MetaData "Button" "Network.Reddit.Types.Widget" "heddit-0.0.1-76ROQ5tOAm3CpLSaFw8ccb" 'False) (C1 ('MetaCons "ImageButton" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ButtonImage)) :+: C1 ('MetaCons "TextButton" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ButtonText))) | |
data ButtonImage Source #
Data for an ImageButton
Constructors
| ButtonImage | |
Instances
data ButtonText Source #
Data for a TextButton
Constructors
| ButtonText | |
Instances
data ButtonHover Source #
The state of the Button when hovering over it
Constructors
| ImageButtonHover ImageHover | |
| TextButtonHover TextHover |
Instances
data ImageHover Source #
The state of an ImageButton when hovering over it
Instances
The state of a TextButton when hovering over it
Constructors
| TextHover | |
Instances
| Eq TextHover Source # | |
| Show TextHover Source # | |
| Generic TextHover Source # | |
| ToJSON TextHover Source # | |
Defined in Network.Reddit.Types.Widget | |
| FromJSON TextHover Source # | |
| type Rep TextHover Source # | |
Defined in Network.Reddit.Types.Widget type Rep TextHover = D1 ('MetaData "TextHover" "Network.Reddit.Types.Widget" "heddit-0.0.1-76ROQ5tOAm3CpLSaFw8ccb" 'False) (C1 ('MetaCons "TextHover" 'PrefixI 'True) ((S1 ('MetaSel ('Just "text") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ShortName) :*: S1 ('MetaSel ('Just "color") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe RGBText))) :*: (S1 ('MetaSel ('Just "fillColor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe RGBText)) :*: S1 ('MetaSel ('Just "textColor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe RGBText))))) | |
data CalendarWidget Source #
A widget representing a calendar
Constructors
| CalendarWidget | |
Fields | |
Instances
data CalendarConfig Source #
Configuration options for a CalendarWidget
Constructors
| CalendarConfig | |
Instances
defaultCalendarConfig :: CalendarConfig Source #
A calendar config with default values
data CommunityListWidget Source #
A widget listing related subreddits
Constructors
| CommunityListWidget | |
Fields | |
Instances
data CommunityInfo Source #
Information about a single subreddit in a CommunityListWidget. When
creating a new widget, only the name field will be serialized
Constructors
| CommunityInfo | |
Fields
| |
Instances
mkCommunityInfo :: SubredditName -> CommunityInfo Source #
Convenience function for creating a new CommunityInfo, where
all but one of the fields should be Nothing
data CustomWidget Source #
A custom widget
Constructors
| CustomWidget | |
Instances
Image data that belongs to a CustomWidget
Constructors
| ImageData | |
Instances
| Eq ImageData Source # | |
| Show ImageData Source # | |
| Generic ImageData Source # | |
| ToJSON ImageData Source # | |
Defined in Network.Reddit.Types.Widget | |
| FromJSON ImageData Source # | |
| type Rep ImageData Source # | |
Defined in Network.Reddit.Types.Widget type Rep ImageData = D1 ('MetaData "ImageData" "Network.Reddit.Types.Widget" "heddit-0.0.1-76ROQ5tOAm3CpLSaFw8ccb" 'False) (C1 ('MetaCons "ImageData" 'PrefixI 'True) ((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Name) :*: S1 ('MetaSel ('Just "height") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "width") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "url") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UploadURL)))) | |
data IDCardWidget Source #
An ID card displaying information about the subreddit
Constructors
| IDCardWidget | |
Fields | |
Instances
data ImageWidget Source #
A widget composed of various Images
Constructors
| ImageWidget | |
Instances
An individual image in an ImageWidget
Constructors
| Image | |
Instances
| Eq Image Source # | |
| Show Image Source # | |
| Generic Image Source # | |
| ToJSON Image Source # | |
Defined in Network.Reddit.Types.Widget | |
| FromJSON Image Source # | |
| type Rep Image Source # | |
Defined in Network.Reddit.Types.Widget type Rep Image = D1 ('MetaData "Image" "Network.Reddit.Types.Widget" "heddit-0.0.1-76ROQ5tOAm3CpLSaFw8ccb" 'False) (C1 ('MetaCons "Image" 'PrefixI 'True) ((S1 ('MetaSel ('Just "width") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer) :*: S1 ('MetaSel ('Just "height") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Integer)) :*: (S1 ('MetaSel ('Just "url") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UploadURL) :*: S1 ('MetaSel ('Just "linkURL") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe URL))))) | |
data MenuWidget Source #
A widget representing a menu
Instances
A child widget in a MenuWidget
Constructors
| SubmenuChild Submenu | |
| MenuLinkChild MenuLink |
Instances
| Eq MenuChild Source # | |
| Show MenuChild Source # | |
| Generic MenuChild Source # | |
| ToJSON MenuChild Source # | |
Defined in Network.Reddit.Types.Widget | |
| FromJSON MenuChild Source # | |
| type Rep MenuChild Source # | |
Defined in Network.Reddit.Types.Widget type Rep MenuChild = D1 ('MetaData "MenuChild" "Network.Reddit.Types.Widget" "heddit-0.0.1-76ROQ5tOAm3CpLSaFw8ccb" 'False) (C1 ('MetaCons "SubmenuChild" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Submenu)) :+: C1 ('MetaCons "MenuLinkChild" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 MenuLink))) | |
A link in a MenuWidget or Submenu
Instances
| Eq MenuLink Source # | |
| Show MenuLink Source # | |
| Generic MenuLink Source # | |
| ToJSON MenuLink Source # | |
Defined in Network.Reddit.Types.Widget | |
| FromJSON MenuLink Source # | |
| type Rep MenuLink Source # | |
Defined in Network.Reddit.Types.Widget type Rep MenuLink = D1 ('MetaData "MenuLink" "Network.Reddit.Types.Widget" "heddit-0.0.1-76ROQ5tOAm3CpLSaFw8ccb" 'False) (C1 ('MetaCons "MenuLink" 'PrefixI 'True) (S1 ('MetaSel ('Just "text") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "url") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 URL))) | |
A submenu child in a MenuWidget which contains MenuLinks
Instances
data ModeratorsWidget Source #
A widget listing the moderators of the subreddit. This widget cannot be
created. It can be updated by modifying the styles field only
Constructors
| ModeratorsWidget | |
Instances
Information about a moderator as displayed in a ModeratorsWidget
Constructors
| ModInfo | |
Fields | |
Instances
| Eq ModInfo Source # | |
| Show ModInfo Source # | |
| Generic ModInfo Source # | |
| ToJSON ModInfo Source # | |
Defined in Network.Reddit.Types.Widget | |
| FromJSON ModInfo Source # | |
| type Rep ModInfo Source # | |
Defined in Network.Reddit.Types.Widget type Rep ModInfo = D1 ('MetaData "ModInfo" "Network.Reddit.Types.Widget" "heddit-0.0.1-76ROQ5tOAm3CpLSaFw8ccb" 'False) (C1 ('MetaCons "ModInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Username) :*: S1 ('MetaSel ('Just "flairText") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe FlairText))) :*: (S1 ('MetaSel ('Just "flairTextColor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ForegroundColor)) :*: S1 ('MetaSel ('Just "flairBackgroundColor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe RGBText))))) | |
data PostFlairWidget Source #
A widget listing flair choices for submissions. When creating a new widget,
the FlairIDs in the order field must be valid template IDs for the given
subreddit. Existing flair templates can be obtained with
getSubmissionFlairTemplates, which can
then be mapped over to obtain the IDs. Once the flair IDs have been obtained,
mkPostFlairWidget can be used to construct a widget with default values for
most fields
Constructors
| PostFlairWidget | |
Fields
| |
Instances
mkPostFlairWidget :: ShortName -> Seq FlairID -> PostFlairWidget Source #
Make a new PostFlairWidget with default values for most fields
data PostFlairInfo Source #
Information about submission flair templates in a PostFlairWidget
Constructors
| PostFlairInfo | |
Fields
| |
Instances
data PostFlairWidgetDisplay Source #
The display orientation for PostFlairWidgets
Constructors
| CloudDisplay | |
| ListDisplay |
Instances
data RulesWidget Source #
A widget listing subreddit SubredditRules. The rules field cannot be
updated through widget endpoints, and are excluded during serialization
Constructors
| RulesWidget | |
Fields
| |
Instances
data RulesDisplay Source #
Display style for a RulesWidget
Constructors
| FullDisplay | |
| CompactDisplay |
Instances
| Eq RulesDisplay Source # | |
Defined in Network.Reddit.Types.Widget | |
| Show RulesDisplay Source # | |
Defined in Network.Reddit.Types.Widget Methods showsPrec :: Int -> RulesDisplay -> ShowS # show :: RulesDisplay -> String # showList :: [RulesDisplay] -> ShowS # | |
| Generic RulesDisplay Source # | |
Defined in Network.Reddit.Types.Widget Associated Types type Rep RulesDisplay :: Type -> Type # | |
| ToJSON RulesDisplay Source # | |
Defined in Network.Reddit.Types.Widget Methods toJSON :: RulesDisplay -> Value # toEncoding :: RulesDisplay -> Encoding # toJSONList :: [RulesDisplay] -> Value # toEncodingList :: [RulesDisplay] -> Encoding # | |
| FromJSON RulesDisplay Source # | |
Defined in Network.Reddit.Types.Widget | |
| type Rep RulesDisplay Source # | |
Defined in Network.Reddit.Types.Widget | |
data TextAreaWidget Source #
A widget composed of text. See mkTextAreaWidget for constructing a new
widget
Constructors
| TextAreaWidget | |
Instances
mkTextAreaWidget :: ShortName -> Body -> TextAreaWidget Source #
Create a new TextAreaWidget, with default values for most fields