{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-matches #-}
module Instances where
import AgentPushKit.Model
import AgentPushKit.Core
import qualified Data.Aeson as A
import qualified Data.ByteString.Lazy as BL
import qualified Data.HashMap.Strict as HM
import qualified Data.Set as Set
import qualified Data.Text as T
import qualified Data.Time as TI
import qualified Data.Vector as V
import Data.String (fromString)
import Control.Monad
import Data.Char (isSpace)
import Data.List (sort)
import Test.QuickCheck
import ApproxEq
instance Arbitrary T.Text where
arbitrary = T.pack <$> arbitrary
instance Arbitrary TI.Day where
arbitrary = TI.ModifiedJulianDay . (2000 +) <$> arbitrary
shrink = (TI.ModifiedJulianDay <$>) . shrink . TI.toModifiedJulianDay
instance Arbitrary TI.UTCTime where
arbitrary =
TI.UTCTime <$> arbitrary <*> (TI.secondsToDiffTime <$> choose (0, 86401))
instance Arbitrary BL.ByteString where
arbitrary = BL.pack <$> arbitrary
shrink xs = BL.pack <$> shrink (BL.unpack xs)
instance Arbitrary ByteArray where
arbitrary = ByteArray <$> arbitrary
shrink (ByteArray xs) = ByteArray <$> shrink xs
instance Arbitrary Binary where
arbitrary = Binary <$> arbitrary
shrink (Binary xs) = Binary <$> shrink xs
instance Arbitrary DateTime where
arbitrary = DateTime <$> arbitrary
shrink (DateTime xs) = DateTime <$> shrink xs
instance Arbitrary Date where
arbitrary = Date <$> arbitrary
shrink (Date xs) = Date <$> shrink xs
#if MIN_VERSION_aeson(2,0,0)
#else
-- | A naive Arbitrary instance for A.Value:
instance Arbitrary A.Value where
arbitrary = arbitraryValue
#endif
arbitraryValue :: Gen A.Value
arbitraryValue =
frequency [(3, simpleTypes), (1, arrayTypes), (1, objectTypes)]
where
simpleTypes :: Gen A.Value
simpleTypes =
frequency
[ (1, return A.Null)
, (2, liftM A.Bool (arbitrary :: Gen Bool))
, (2, liftM (A.Number . fromIntegral) (arbitrary :: Gen Int))
, (2, liftM (A.String . T.pack) (arbitrary :: Gen String))
]
mapF (k, v) = (fromString k, v)
simpleAndArrays = frequency [(1, sized sizedArray), (4, simpleTypes)]
arrayTypes = sized sizedArray
objectTypes = sized sizedObject
sizedArray n = liftM (A.Array . V.fromList) $ replicateM n simpleTypes
sizedObject n =
liftM (A.object . map mapF) $
replicateM n $ (,) <$> (arbitrary :: Gen String) <*> simpleAndArrays
-- | Checks if a given list has no duplicates in _O(n log n)_.
hasNoDups
:: (Ord a)
=> [a] -> Bool
hasNoDups = go Set.empty
where
go _ [] = True
go s (x:xs)
| s' <- Set.insert x s
, Set.size s' > Set.size s = go s' xs
| otherwise = False
instance ApproxEq TI.Day where
(=~) = (==)
arbitraryReduced :: Arbitrary a => Int -> Gen a
arbitraryReduced n = resize (n `div` 2) arbitrary
arbitraryReducedMaybe :: Arbitrary a => Int -> Gen (Maybe a)
arbitraryReducedMaybe 0 = elements [Nothing]
arbitraryReducedMaybe n = arbitraryReduced n
arbitraryReducedMaybeValue :: Int -> Gen (Maybe A.Value)
arbitraryReducedMaybeValue 0 = elements [Nothing]
arbitraryReducedMaybeValue n = do
generated <- arbitraryReduced n
if generated == Just A.Null
then return Nothing
else return generated
-- * Models
instance Arbitrary AcceptedResponse where
arbitrary = sized genAcceptedResponse
genAcceptedResponse :: Int -> Gen AcceptedResponse
genAcceptedResponse n =
AcceptedResponse
<$> arbitrary -- acceptedResponseAccepted :: Bool
instance Arbitrary AddMemberInput where
arbitrary = sized genAddMemberInput
genAddMemberInput :: Int -> Gen AddMemberInput
genAddMemberInput n =
AddMemberInput
<$> arbitrary -- addMemberInputEmail :: Text
instance Arbitrary AgentToken where
arbitrary = sized genAgentToken
genAgentToken :: Int -> Gen AgentToken
genAgentToken n =
AgentToken
<$> arbitrary -- agentTokenId :: Text
<*> arbitrary -- agentTokenName :: Text
<*> arbitrary -- agentTokenKeyPrefix :: Text
<*> arbitrary -- agentTokenLastFour :: Text
<*> arbitraryReduced n -- agentTokenCreatedAt :: DateTime
<*> arbitraryReducedMaybe n -- agentTokenLastUsedAt :: Maybe DateTime
<*> arbitraryReducedMaybe n -- agentTokenRevokedAt :: Maybe DateTime
instance Arbitrary AgentTokenCreated where
arbitrary = sized genAgentTokenCreated
genAgentTokenCreated :: Int -> Gen AgentTokenCreated
genAgentTokenCreated n =
AgentTokenCreated
<$> arbitrary -- agentTokenCreatedId :: Text
<*> arbitrary -- agentTokenCreatedName :: Text
<*> arbitrary -- agentTokenCreatedKeyPrefix :: Text
<*> arbitrary -- agentTokenCreatedLastFour :: Text
<*> arbitraryReduced n -- agentTokenCreatedCreatedAt :: DateTime
<*> arbitraryReducedMaybe n -- agentTokenCreatedLastUsedAt :: Maybe DateTime
<*> arbitraryReducedMaybe n -- agentTokenCreatedRevokedAt :: Maybe DateTime
<*> arbitrary -- agentTokenCreatedToken :: Text
instance Arbitrary ApiKeySummary where
arbitrary = sized genApiKeySummary
genApiKeySummary :: Int -> Gen ApiKeySummary
genApiKeySummary n =
ApiKeySummary
<$> arbitraryReducedMaybe n -- apiKeySummaryKeyPrefix :: Maybe Text
<*> arbitraryReducedMaybe n -- apiKeySummaryLastFour :: Maybe Text
<*> arbitraryReducedMaybe n -- apiKeySummaryUpdatedAt :: Maybe DateTime
instance Arbitrary AuthResponse where
arbitrary = sized genAuthResponse
genAuthResponse :: Int -> Gen AuthResponse
genAuthResponse n =
AuthResponse
<$> arbitrary -- authResponseAccessToken :: Text
<*> arbitraryReduced n -- authResponseUser :: User
<*> arbitraryReduced n -- authResponseOrganizations :: [Organization]
<*> arbitraryReducedMaybe n -- authResponseBootstrapApiKey :: Maybe Text
instance Arbitrary CreateAgentTokenInput where
arbitrary = sized genCreateAgentTokenInput
genCreateAgentTokenInput :: Int -> Gen CreateAgentTokenInput
genCreateAgentTokenInput n =
CreateAgentTokenInput
<$> arbitrary -- createAgentTokenInputName :: Text
instance Arbitrary CreateOrganizationInput where
arbitrary = sized genCreateOrganizationInput
genCreateOrganizationInput :: Int -> Gen CreateOrganizationInput
genCreateOrganizationInput n =
CreateOrganizationInput
<$> arbitrary -- createOrganizationInputName :: Text
instance Arbitrary CurrentAccount where
arbitrary = sized genCurrentAccount
genCurrentAccount :: Int -> Gen CurrentAccount
genCurrentAccount n =
CurrentAccount
<$> arbitraryReduced n -- currentAccountUser :: User
<*> arbitraryReduced n -- currentAccountOrganizations :: [Organization]
instance Arbitrary DeletedResponse where
arbitrary = sized genDeletedResponse
genDeletedResponse :: Int -> Gen DeletedResponse
genDeletedResponse n =
DeletedResponse
<$> arbitrary -- deletedResponseDeleted :: Bool
instance Arbitrary DeliverySummary where
arbitrary = sized genDeliverySummary
genDeliverySummary :: Int -> Gen DeliverySummary
genDeliverySummary n =
DeliverySummary
<$> arbitrary -- deliverySummarySent :: Int
<*> arbitrary -- deliverySummaryFailed :: Int
<*> arbitrary -- deliverySummarySuppressedUsers :: Int
<*> arbitrary -- deliverySummaryEligibleDevices :: Int
instance Arbitrary Device where
arbitrary = sized genDevice
genDevice :: Int -> Gen Device
genDevice n =
Device
<$> arbitrary -- deviceId :: Text
<*> arbitrary -- deviceInstallationId :: Text
<*> arbitrary -- deviceEnvironment :: E'Environment
<*> arbitraryReducedMaybe n -- deviceAppVersion :: Maybe Text
<*> arbitrary -- deviceEnabled :: Bool
<*> arbitraryReduced n -- deviceLastSeenAt :: DateTime
instance Arbitrary DisabledResponse where
arbitrary = sized genDisabledResponse
genDisabledResponse :: Int -> Gen DisabledResponse
genDisabledResponse n =
DisabledResponse
<$> arbitrary -- disabledResponseDisabled :: Bool
instance Arbitrary ErrorResponse where
arbitrary = sized genErrorResponse
genErrorResponse :: Int -> Gen ErrorResponse
genErrorResponse n =
ErrorResponse
<$> arbitrary -- errorResponseStatusCode :: Int
<*> arbitrary -- errorResponseMessage :: Text
<*> arbitraryReducedMaybe n -- errorResponseError :: Maybe Text
instance Arbitrary EventDetail where
arbitrary = sized genEventDetail
genEventDetail :: Int -> Gen EventDetail
genEventDetail n =
EventDetail
<$> arbitrary -- eventDetailId :: Text
<*> arbitrary -- eventDetailType :: Text
<*> arbitrary -- eventDetailTitle :: Text
<*> arbitrary -- eventDetailBody :: Text
<*> arbitraryReducedMaybe n -- eventDetailExternalId :: Maybe Text
<*> arbitraryReducedMaybe n -- eventDetailActionUrl :: Maybe Text
<*> arbitraryReduced n -- eventDetailCreatedAt :: DateTime
<*> arbitraryReduced n -- eventDetailService :: ServiceSummary
<*> arbitrary -- eventDetailServiceId :: Text
<*> arbitraryReducedMaybe n -- eventDetailMetadata :: Maybe (Map.Map String AnyType)
instance Arbitrary EventFilter where
arbitrary = sized genEventFilter
genEventFilter :: Int -> Gen EventFilter
genEventFilter n =
EventFilter
<$> arbitrary -- eventFilterOperator :: E'Operator
<*> arbitraryReduced n -- eventFilterChildren :: [EventFilter]
<*> arbitraryReduced n -- eventFilterChild :: EventFilter
<*> arbitrary -- eventFilterField :: E'Field
<*> arbitrary -- eventFilterComparison :: E'Comparison
<*> arbitraryReduced n -- eventFilterValue :: DateTime
instance Arbitrary EventPage where
arbitrary = sized genEventPage
genEventPage :: Int -> Gen EventPage
genEventPage n =
EventPage
<$> arbitraryReduced n -- eventPageEvents :: [EventSummary]
<*> arbitraryReducedMaybe n -- eventPageNextCursor :: Maybe Text
instance Arbitrary EventSummary where
arbitrary = sized genEventSummary
genEventSummary :: Int -> Gen EventSummary
genEventSummary n =
EventSummary
<$> arbitrary -- eventSummaryId :: Text
<*> arbitrary -- eventSummaryType :: Text
<*> arbitrary -- eventSummaryTitle :: Text
<*> arbitrary -- eventSummaryBody :: Text
<*> arbitraryReducedMaybe n -- eventSummaryExternalId :: Maybe Text
<*> arbitraryReducedMaybe n -- eventSummaryActionUrl :: Maybe Text
<*> arbitraryReduced n -- eventSummaryCreatedAt :: DateTime
<*> arbitraryReduced n -- eventSummaryService :: ServiceSummary
instance Arbitrary FilterGroup where
arbitrary = sized genFilterGroup
genFilterGroup :: Int -> Gen FilterGroup
genFilterGroup n =
FilterGroup
<$> arbitrary -- filterGroupOperator :: E'Operator2
<*> arbitraryReduced n -- filterGroupChildren :: [EventFilter]
instance Arbitrary FilterNot where
arbitrary = sized genFilterNot
genFilterNot :: Int -> Gen FilterNot
genFilterNot n =
FilterNot
<$> arbitrary -- filterNotOperator :: E'Operator
<*> arbitraryReduced n -- filterNotChild :: EventFilter
instance Arbitrary HealthResponse where
arbitrary = sized genHealthResponse
genHealthResponse :: Int -> Gen HealthResponse
genHealthResponse n =
HealthResponse
<$> arbitrary -- healthResponseStatus :: E'Status
<*> arbitrary -- healthResponseService :: E'Service
instance Arbitrary IngestionResult where
arbitrary = sized genIngestionResult
genIngestionResult :: Int -> Gen IngestionResult
genIngestionResult n =
IngestionResult
<$> arbitraryReduced n -- ingestionResultEvent :: EventDetail
<*> arbitrary -- ingestionResultDuplicate :: Bool
<*> arbitraryReduced n -- ingestionResultDelivery :: DeliverySummary
instance Arbitrary InheritedResponse where
arbitrary = sized genInheritedResponse
genInheritedResponse :: Int -> Gen InheritedResponse
genInheritedResponse n =
InheritedResponse
<$> arbitrary -- inheritedResponseInherited :: Bool
instance Arbitrary Membership where
arbitrary = sized genMembership
genMembership :: Int -> Gen Membership
genMembership n =
Membership
<$> arbitrary -- membershipId :: Text
<*> arbitrary -- membershipRole :: E'Role
<*> arbitraryReduced n -- membershipCreatedAt :: DateTime
<*> arbitraryReduced n -- membershipUser :: MembershipUser
instance Arbitrary MembershipUser where
arbitrary = sized genMembershipUser
genMembershipUser :: Int -> Gen MembershipUser
genMembershipUser n =
MembershipUser
<$> arbitrary -- membershipUserId :: Text
<*> arbitrary -- membershipUserEmail :: Text
<*> arbitraryReducedMaybe n -- membershipUserDisplayName :: Maybe Text
instance Arbitrary Organization where
arbitrary = sized genOrganization
genOrganization :: Int -> Gen Organization
genOrganization n =
Organization
<$> arbitrary -- organizationId :: Text
<*> arbitrary -- organizationName :: Text
<*> arbitrary -- organizationRole :: E'Role
<*> arbitraryReduced n -- organizationCreatedAt :: DateTime
<*> arbitraryReduced n -- organizationUpdatedAt :: DateTime
<*> arbitraryReduced n -- organizationJoinedAt :: DateTime
<*> arbitraryReducedMaybe n -- organizationApiKey :: Maybe ApiKeySummary
<*> arbitraryReducedMaybe n -- organizationCount :: Maybe OrganizationCount
instance Arbitrary OrganizationApiKeyCreated where
arbitrary = sized genOrganizationApiKeyCreated
genOrganizationApiKeyCreated :: Int -> Gen OrganizationApiKeyCreated
genOrganizationApiKeyCreated n =
OrganizationApiKeyCreated
<$> arbitrary -- organizationApiKeyCreatedKeyPrefix :: Text
<*> arbitrary -- organizationApiKeyCreatedLastFour :: Text
<*> arbitraryReduced n -- organizationApiKeyCreatedUpdatedAt :: DateTime
<*> arbitrary -- organizationApiKeyCreatedApiKey :: Text
instance Arbitrary OrganizationCount where
arbitrary = sized genOrganizationCount
genOrganizationCount :: Int -> Gen OrganizationCount
genOrganizationCount n =
OrganizationCount
<$> arbitraryReducedMaybe n -- organizationCountMemberships :: Maybe Int
<*> arbitraryReducedMaybe n -- organizationCountServices :: Maybe Int
instance Arbitrary OrganizationCreated where
arbitrary = sized genOrganizationCreated
genOrganizationCreated :: Int -> Gen OrganizationCreated
genOrganizationCreated n =
OrganizationCreated
<$> arbitraryReduced n -- organizationCreatedOrganization :: OrganizationRecord
<*> arbitrary -- organizationCreatedApiKey :: Text
instance Arbitrary OrganizationRecord where
arbitrary = sized genOrganizationRecord
genOrganizationRecord :: Int -> Gen OrganizationRecord
genOrganizationRecord n =
OrganizationRecord
<$> arbitrary -- organizationRecordId :: Text
<*> arbitrary -- organizationRecordName :: Text
<*> arbitraryReduced n -- organizationRecordCreatedAt :: DateTime
<*> arbitraryReduced n -- organizationRecordUpdatedAt :: DateTime
instance Arbitrary PasswordLoginInput where
arbitrary = sized genPasswordLoginInput
genPasswordLoginInput :: Int -> Gen PasswordLoginInput
genPasswordLoginInput n =
PasswordLoginInput
<$> arbitrary -- passwordLoginInputEmail :: Text
<*> arbitrary -- passwordLoginInputPassword :: Text
instance Arbitrary PasswordResetCompleteInput where
arbitrary = sized genPasswordResetCompleteInput
genPasswordResetCompleteInput :: Int -> Gen PasswordResetCompleteInput
genPasswordResetCompleteInput n =
PasswordResetCompleteInput
<$> arbitrary -- passwordResetCompleteInputToken :: Text
<*> arbitrary -- passwordResetCompleteInputPassword :: Text
instance Arbitrary PasswordResetRequestInput where
arbitrary = sized genPasswordResetRequestInput
genPasswordResetRequestInput :: Int -> Gen PasswordResetRequestInput
genPasswordResetRequestInput n =
PasswordResetRequestInput
<$> arbitrary -- passwordResetRequestInputEmail :: Text
instance Arbitrary PreferenceRecord where
arbitrary = sized genPreferenceRecord
genPreferenceRecord :: Int -> Gen PreferenceRecord
genPreferenceRecord n =
PreferenceRecord
<$> arbitrary -- preferenceRecordServiceId :: Text
<*> arbitrary -- preferenceRecordTypeKey :: Text
<*> arbitrary -- preferenceRecordEnabled :: Bool
<*> arbitraryReduced n -- preferenceRecordUpdatedAt :: DateTime
instance Arbitrary ProviderLoginInput where
arbitrary = sized genProviderLoginInput
genProviderLoginInput :: Int -> Gen ProviderLoginInput
genProviderLoginInput n =
ProviderLoginInput
<$> arbitrary -- providerLoginInputIdToken :: Text
<*> arbitraryReducedMaybe n -- providerLoginInputDisplayName :: Maybe Text
instance Arbitrary RegisterDeviceInput where
arbitrary = sized genRegisterDeviceInput
genRegisterDeviceInput :: Int -> Gen RegisterDeviceInput
genRegisterDeviceInput n =
RegisterDeviceInput
<$> arbitrary -- registerDeviceInputDeviceToken :: Text
<*> arbitrary -- registerDeviceInputInstallationId :: Text
<*> arbitrary -- registerDeviceInputEnvironment :: E'Environment
<*> arbitraryReducedMaybe n -- registerDeviceInputAppVersion :: Maybe Text
instance Arbitrary RegisterInput where
arbitrary = sized genRegisterInput
genRegisterInput :: Int -> Gen RegisterInput
genRegisterInput n =
RegisterInput
<$> arbitrary -- registerInputEmail :: Text
<*> arbitrary -- registerInputPassword :: Text
<*> arbitraryReducedMaybe n -- registerInputDisplayName :: Maybe Text
instance Arbitrary RegisterWebPushSubscriptionInput where
arbitrary = sized genRegisterWebPushSubscriptionInput
genRegisterWebPushSubscriptionInput :: Int -> Gen RegisterWebPushSubscriptionInput
genRegisterWebPushSubscriptionInput n =
RegisterWebPushSubscriptionInput
<$> arbitrary -- registerWebPushSubscriptionInputEndpoint :: Text
<*> arbitraryReduced n -- registerWebPushSubscriptionInputKeys :: RegisterWebPushSubscriptionInputKeys
instance Arbitrary RegisterWebPushSubscriptionInputKeys where
arbitrary = sized genRegisterWebPushSubscriptionInputKeys
genRegisterWebPushSubscriptionInputKeys :: Int -> Gen RegisterWebPushSubscriptionInputKeys
genRegisterWebPushSubscriptionInputKeys n =
RegisterWebPushSubscriptionInputKeys
<$> arbitrary -- registerWebPushSubscriptionInputKeysP256dh :: Text
<*> arbitrary -- registerWebPushSubscriptionInputKeysAuth :: Text
instance Arbitrary RevokedResponse where
arbitrary = sized genRevokedResponse
genRevokedResponse :: Int -> Gen RevokedResponse
genRevokedResponse n =
RevokedResponse
<$> arbitrary -- revokedResponseRevoked :: Bool
instance Arbitrary SearchEventsInput where
arbitrary = sized genSearchEventsInput
genSearchEventsInput :: Int -> Gen SearchEventsInput
genSearchEventsInput n =
SearchEventsInput
<$> arbitraryReduced n -- searchEventsInputFilter :: EventFilter
<*> arbitraryReducedMaybe n -- searchEventsInputCursor :: Maybe Text
<*> arbitraryReducedMaybe n -- searchEventsInputLimit :: Maybe Int
instance Arbitrary SendEventInput where
arbitrary = sized genSendEventInput
genSendEventInput :: Int -> Gen SendEventInput
genSendEventInput n =
SendEventInput
<$> arbitrary -- sendEventInputService :: Text
<*> arbitraryReducedMaybe n -- sendEventInputServiceDisplayName :: Maybe Text
<*> arbitrary -- sendEventInputType :: Text
<*> arbitrary -- sendEventInputTitle :: Text
<*> arbitrary -- sendEventInputBody :: Text
<*> arbitraryReducedMaybe n -- sendEventInputMetadata :: Maybe (Map.Map String AnyType)
<*> arbitraryReducedMaybe n -- sendEventInputExternalId :: Maybe Text
<*> arbitraryReducedMaybe n -- sendEventInputActionUrl :: Maybe Text
instance Arbitrary Service where
arbitrary = sized genService
genService :: Int -> Gen Service
genService n =
Service
<$> arbitrary -- serviceId :: Text
<*> arbitrary -- serviceName :: Text
<*> arbitrary -- serviceDisplayName :: Text
<*> arbitraryReduced n -- serviceCreatedAt :: DateTime
<*> arbitraryReduced n -- serviceCount :: ServiceAllOfCount
instance Arbitrary ServiceAllOfCount where
arbitrary = sized genServiceAllOfCount
genServiceAllOfCount :: Int -> Gen ServiceAllOfCount
genServiceAllOfCount n =
ServiceAllOfCount
<$> arbitrary -- serviceAllOfCountEvents :: Int
instance Arbitrary ServicePreference where
arbitrary = sized genServicePreference
genServicePreference :: Int -> Gen ServicePreference
genServicePreference n =
ServicePreference
<$> arbitrary -- servicePreferenceId :: Text
<*> arbitrary -- servicePreferenceName :: Text
<*> arbitrary -- servicePreferenceDisplayName :: Text
<*> arbitrary -- servicePreferenceEnabled :: Bool
<*> arbitraryReduced n -- servicePreferenceTypeOverrides :: [TypeOverride]
instance Arbitrary ServiceSummary where
arbitrary = sized genServiceSummary
genServiceSummary :: Int -> Gen ServiceSummary
genServiceSummary n =
ServiceSummary
<$> arbitrary -- serviceSummaryId :: Text
<*> arbitrary -- serviceSummaryName :: Text
<*> arbitrary -- serviceSummaryDisplayName :: Text
instance Arbitrary SetEnabledInput where
arbitrary = sized genSetEnabledInput
genSetEnabledInput :: Int -> Gen SetEnabledInput
genSetEnabledInput n =
SetEnabledInput
<$> arbitrary -- setEnabledInputEnabled :: Bool
instance Arbitrary TextFilterCondition where
arbitrary = sized genTextFilterCondition
genTextFilterCondition :: Int -> Gen TextFilterCondition
genTextFilterCondition n =
TextFilterCondition
<$> arbitrary -- textFilterConditionField :: E'Field2
<*> arbitrary -- textFilterConditionComparison :: E'Comparison2
<*> arbitrary -- textFilterConditionValue :: Text
instance Arbitrary TimeFilterCondition where
arbitrary = sized genTimeFilterCondition
genTimeFilterCondition :: Int -> Gen TimeFilterCondition
genTimeFilterCondition n =
TimeFilterCondition
<$> arbitrary -- timeFilterConditionField :: E'Field
<*> arbitrary -- timeFilterConditionComparison :: E'Comparison
<*> arbitraryReduced n -- timeFilterConditionValue :: DateTime
instance Arbitrary TypeOverride where
arbitrary = sized genTypeOverride
genTypeOverride :: Int -> Gen TypeOverride
genTypeOverride n =
TypeOverride
<$> arbitrary -- typeOverrideType :: Text
<*> arbitrary -- typeOverrideEnabled :: Bool
<*> arbitraryReduced n -- typeOverrideUpdatedAt :: DateTime
instance Arbitrary User where
arbitrary = sized genUser
genUser :: Int -> Gen User
genUser n =
User
<$> arbitrary -- userId :: Text
<*> arbitrary -- userEmail :: Text
<*> arbitraryReducedMaybe n -- userDisplayName :: Maybe Text
<*> arbitrary -- userHasPassword :: Bool
<*> arbitrary -- userHasGoogle :: Bool
<*> arbitrary -- userHasApple :: Bool
instance Arbitrary WebPushConfiguration where
arbitrary = sized genWebPushConfiguration
genWebPushConfiguration :: Int -> Gen WebPushConfiguration
genWebPushConfiguration n =
WebPushConfiguration
<$> arbitrary -- webPushConfigurationEnabled :: Bool
<*> arbitraryReducedMaybe n -- webPushConfigurationPublicKey :: Maybe Text
instance Arbitrary WebPushSubscription where
arbitrary = sized genWebPushSubscription
genWebPushSubscription :: Int -> Gen WebPushSubscription
genWebPushSubscription n =
WebPushSubscription
<$> arbitrary -- webPushSubscriptionId :: Text
<*> arbitrary -- webPushSubscriptionEnabled :: Bool
<*> arbitraryReduced n -- webPushSubscriptionLastSeenAt :: DateTime
instance Arbitrary E'Comparison where
arbitrary = arbitraryBoundedEnum
instance Arbitrary E'Comparison2 where
arbitrary = arbitraryBoundedEnum
instance Arbitrary E'Environment where
arbitrary = arbitraryBoundedEnum
instance Arbitrary E'Field where
arbitrary = arbitraryBoundedEnum
instance Arbitrary E'Field2 where
arbitrary = arbitraryBoundedEnum
instance Arbitrary E'Operator where
arbitrary = arbitraryBoundedEnum
instance Arbitrary E'Operator2 where
arbitrary = arbitraryBoundedEnum
instance Arbitrary E'Role where
arbitrary = arbitraryBoundedEnum
instance Arbitrary E'Service where
arbitrary = arbitraryBoundedEnum
instance Arbitrary E'Status where
arbitrary = arbitraryBoundedEnum