{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.AcceleratedMobilePageURL.Types.Sum where
import Network.Google.Prelude hiding (Bytes)
data AmpURLErrorErrorCode
= ErrorCodeUnspecified
| InputURLNotFound
| NoAmpURL
| ApplicationError
| URLIsValidAmp
| URLIsInvalidAmp
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable AmpURLErrorErrorCode
instance FromHttpApiData AmpURLErrorErrorCode where
parseQueryParam = \case
"ERROR_CODE_UNSPECIFIED" -> Right ErrorCodeUnspecified
"INPUT_URL_NOT_FOUND" -> Right InputURLNotFound
"NO_AMP_URL" -> Right NoAmpURL
"APPLICATION_ERROR" -> Right ApplicationError
"URL_IS_VALID_AMP" -> Right URLIsValidAmp
"URL_IS_INVALID_AMP" -> Right URLIsInvalidAmp
x -> Left ("Unable to parse AmpURLErrorErrorCode from: " <> x)
instance ToHttpApiData AmpURLErrorErrorCode where
toQueryParam = \case
ErrorCodeUnspecified -> "ERROR_CODE_UNSPECIFIED"
InputURLNotFound -> "INPUT_URL_NOT_FOUND"
NoAmpURL -> "NO_AMP_URL"
ApplicationError -> "APPLICATION_ERROR"
URLIsValidAmp -> "URL_IS_VALID_AMP"
URLIsInvalidAmp -> "URL_IS_INVALID_AMP"
instance FromJSON AmpURLErrorErrorCode where
parseJSON = parseJSONText "AmpURLErrorErrorCode"
instance ToJSON AmpURLErrorErrorCode where
toJSON = toJSONText
data Xgafv
= X1
| X2
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable Xgafv
instance FromHttpApiData Xgafv where
parseQueryParam = \case
"1" -> Right X1
"2" -> Right X2
x -> Left ("Unable to parse Xgafv from: " <> x)
instance ToHttpApiData Xgafv where
toQueryParam = \case
X1 -> "1"
X2 -> "2"
instance FromJSON Xgafv where
parseJSON = parseJSONText "Xgafv"
instance ToJSON Xgafv where
toJSON = toJSONText
data BatchGetAmpURLsRequestLookupStrategy
= FetchLiveDoc
| InIndexDoc
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable BatchGetAmpURLsRequestLookupStrategy
instance FromHttpApiData BatchGetAmpURLsRequestLookupStrategy where
parseQueryParam = \case
"FETCH_LIVE_DOC" -> Right FetchLiveDoc
"IN_INDEX_DOC" -> Right InIndexDoc
x -> Left ("Unable to parse BatchGetAmpURLsRequestLookupStrategy from: " <> x)
instance ToHttpApiData BatchGetAmpURLsRequestLookupStrategy where
toQueryParam = \case
FetchLiveDoc -> "FETCH_LIVE_DOC"
InIndexDoc -> "IN_INDEX_DOC"
instance FromJSON BatchGetAmpURLsRequestLookupStrategy where
parseJSON = parseJSONText "BatchGetAmpURLsRequestLookupStrategy"
instance ToJSON BatchGetAmpURLsRequestLookupStrategy where
toJSON = toJSONText