packages feed

atlassian-connect-descriptor 0.4.14.0 → 0.4.15.0

raw patch · 6 files changed

+46/−48 lines, 6 files

Files

atlassian-connect-descriptor.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           atlassian-connect-descriptor-version:        0.4.14.0+version:        0.4.15.0 synopsis:       Code that helps you create a valid Atlassian Connect Descriptor. description:    Allows you to generate an Atlassian Connect Descriptor in a typesafe manner and easily convert it                 it into JSON using the fantastic Aeson library.
src/Data/Connect/BaseTypes.hs view
@@ -19,8 +19,8 @@    )    where -import           Data.Aeson-import           Data.Aeson.Types+import qualified Data.Aeson                   as DA+import qualified Data.Aeson.Types             as DAT import           Data.Connect.AesonHelpers import           Data.Connect.OrphanInstances () import           Data.Text@@ -34,7 +34,7 @@ -- | This data type represents an Atlassian Connect Add-on key. data PluginKey = PluginKey Text deriving (Show, Eq, Generic) -instance ToJSON PluginKey+instance DA.ToJSON PluginKey  -- | Represents a timeout in seconds. newtype Timeout = Timeout DTU.Second deriving (Show, Eq, Enum, Num, Ord, Real, Integral)@@ -76,9 +76,9 @@    , dI18n  :: Maybe Text -- ^ The potential i18n key that will be used when we eventually have I18n support: <http://goo.gl/9vJEsW>    } deriving (Show, Generic) -instance ToJSON I18nText where-   toJSON = genericToJSON baseOptions-      { fieldLabelModifier = stripFieldNamePrefix "d"+instance DA.ToJSON I18nText where+   toJSON = DAT.genericToJSON baseOptions+      { DA.fieldLabelModifier = stripFieldNamePrefix "d"       }  -- | Since there is currently no I18n support (<http://goo.gl/9vJEsW>) we have this helper method to quickly create an 'I18nText' from a standard@@ -91,34 +91,34 @@    { ubUrl :: Text -- ^ The raw URL.    } deriving (Show, Generic) -instance ToJSON URLBean where-   toJSON = genericToJSON baseOptions-         { fieldLabelModifier = stripFieldNamePrefix "ub"+instance DA.ToJSON URLBean where+   toJSON = DAT.genericToJSON baseOptions+         { DA.fieldLabelModifier = stripFieldNamePrefix "ub"          }  -- | Wrap a regular 'Text' based URL inside a URLBean. toUrl :: Text -> URLBean toUrl = URLBean -instance ToJSON (Name PluginKey)-instance ToJSON (Name Vendor)+instance DA.ToJSON (Name PluginKey)+instance DA.ToJSON (Name Vendor) -instance ToJSON IconDetails where-   toJSON = genericToJSON baseOptions-      { fieldLabelModifier = stripFieldNamePrefix "icon"+instance DA.ToJSON IconDetails where+   toJSON = DAT.genericToJSON baseOptions+      { DA.fieldLabelModifier = stripFieldNamePrefix "icon"       } -instance ToJSON Vendor where-   toJSON = genericToJSON baseOptions-      { fieldLabelModifier = stripFieldNamePrefix "vendor"+instance DA.ToJSON Vendor where+   toJSON = DAT.genericToJSON baseOptions+      { DA.fieldLabelModifier = stripFieldNamePrefix "vendor"       } -instance ToJSON Authentication where-   toJSON = genericToJSON baseOptions-      { fieldLabelModifier = stripFieldNamePrefix "auth"+instance DA.ToJSON Authentication where+   toJSON = DAT.genericToJSON baseOptions+      { DA.fieldLabelModifier = stripFieldNamePrefix "auth"       } -instance ToJSON AuthType where+instance DA.ToJSON AuthType where    toJSON Jwt  = "jwt"    toJSON None  = "none" @@ -128,6 +128,6 @@    | Percentage Integer -- ^ Specify a length as a percentage in the range [0-100].    deriving (Show, Generic) -instance ToJSON Length where-   toJSON (Pixels x) = String . pack $ (show x ++ "px")-   toJSON (Percentage x) = String . pack $ (show x ++ "%")+instance DA.ToJSON Length where+   toJSON (Pixels x) = DAT.String . pack $ (show x ++ "px")+   toJSON (Percentage x) = DAT.String . pack $ (show x ++ "%")
src/Data/Connect/Conditions.hs view
@@ -13,10 +13,10 @@     ) where  import           Data.Aeson+import qualified Data.Aeson.Types   as DAT import           Data.Connect.AesonHelpers import           Data.Connect.OrphanInstances () import           GHC.Generics-import qualified Data.Text           as T import qualified Data.HashMap.Strict as HM  -- | A 'Condition' can be placed on an Atlassian Connect Module to cause it to display or not based on the result it@@ -70,7 +70,7 @@       ]    toJSON cc@(CompositeCondition {}) = object [ compositionConditionKey cc .= subConditions cc] -compositionConditionKey :: Condition -> T.Text+compositionConditionKey :: Condition -> DAT.Key compositionConditionKey (CompositeCondition _ AndCondition) = "and" compositionConditionKey (CompositeCondition _ OrCondition) = "or" compositionConditionKey _ = error "This method should not have been passed a non-composite condition"
src/Data/Connect/Descriptor.hs view
@@ -169,8 +169,7 @@    , ProductScope(..)    ) where -import           Data.Aeson-import           Data.Aeson.Types+import qualified Data.Aeson as DA import           Data.Connect.AesonHelpers import           Data.Connect.BaseTypes import           Data.Connect.Conditions@@ -218,11 +217,11 @@    , apiMigrations     :: Maybe ApiMigrations -- ^ The Migrations that this app has opted into.    } deriving (Show, Generic) -instance ToJSON (Name Plugin)+instance DA.ToJSON (Name Plugin) -instance ToJSON Plugin where-   toJSON = genericToJSON baseOptions-      { fieldLabelModifier = stripFieldNamePrefix "plugin"+instance DA.ToJSON Plugin where+   toJSON = DA.genericToJSON baseOptions+      { DA.fieldLabelModifier = stripFieldNamePrefix "plugin"       }  data ApiMigrations = ApiMigrations@@ -230,10 +229,10 @@    , migrationSignedInstall :: Bool    } deriving (Show, Generic) -instance ToJSON ApiMigrations where-   toJSON am = object-      [ "gdpr" .= migrationGdpr am-      , "signed-install" .= migrationSignedInstall am+instance DA.ToJSON ApiMigrations where+   toJSON am = DA.object+      [ ("gdpr" :: DA.Key) DA..= migrationGdpr am+      , ("signed-install" :: DA.Key) DA..= migrationSignedInstall am       ]  -- | A helper method to generate a bare-bones Atlassian Connect add-on by providing only the absolutely required fields.
src/Data/Connect/Modules.hs view
@@ -74,12 +74,12 @@ -}  import           Data.Aeson-import           Data.Aeson.Types+import qualified Data.Aeson.Types          as DAT+import qualified Data.Aeson.KeyMap         as DAK import           Data.Connect.AesonHelpers import           Data.Connect.BaseTypes import           Data.Connect.Conditions import           Data.Connect.Webhooks-import qualified Data.HashMap.Strict       as HM import qualified Data.Text                 as T import           GHC.Generics @@ -101,7 +101,7 @@  instance ToJSON Modules where    toJSON modules = case (jm, cm) of-      (Object jiraObject, Object confluenceObject) -> Object $ HM.union jiraObject confluenceObject+      (Object jiraObject, Object confluenceObject) -> Object $ DAK.union jiraObject confluenceObject       _ -> Null       where          jm = toJSON . jiraModules $ modules@@ -184,11 +184,11 @@ type Weight = Integer  -- | The standard representation for module parameters.-type ModuleParams = HM.HashMap T.Text T.Text+type ModuleParams = DAK.KeyMap T.Text  -- | No parameters. A useful helper when you don't want to pass any parameters to a module. noParams :: ModuleParams-noParams = HM.empty+noParams = DAK.empty  -- | A 'JIRAWebSection' represents a location in the host application that you can add 'WebItem's to. In this way you -- can give your add-on sections to inject content into.@@ -297,14 +297,14 @@ tp = T.pack  instance ToJSON Target where-   toJSON (TargetPage) = object [tp "type" .= tp "page"]-   toJSON (TargetDialog potentialOptions) = object $ tp "type" .= tp "dialog" :+   toJSON (TargetPage) = object [("type" :: DAT.Key) .= tp "page"]+   toJSON (TargetDialog potentialOptions) = object $ ("type" :: DAT.Key) .= tp "dialog" :       case potentialOptions of-         Just options -> [tp "options" .= toJSON options]+         Just options -> [("options" :: DAT.Key) .= toJSON options]          Nothing -> []-   toJSON (TargetInlineDialog potentialOptions) = object $ tp "type" .= tp "inlinedialog" :+   toJSON (TargetInlineDialog potentialOptions) = object $ ("type" :: DAT.Key) .= tp "inlinedialog" :       case potentialOptions of-               Just options -> [tp "options" .= toJSON options]+               Just options -> [("options" :: DAT.Key) .= toJSON options]                Nothing -> []  -- | Options for a dialog that a link may be opened into.
src/Data/Connect/Webhooks.hs view
@@ -6,7 +6,6 @@    ) where  import           Data.Aeson-import           Data.Aeson.Types import           Data.Connect.AesonHelpers import           Data.Connect.OrphanInstances () import qualified Data.Text                    as T