{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.YouTubeAnalytics.Types.Sum where
import Network.Google.Prelude hiding (Bytes)
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 ErrorProtoLocationType
= Path
| Other
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable ErrorProtoLocationType
instance FromHttpApiData ErrorProtoLocationType where
parseQueryParam = \case
"PATH" -> Right Path
"OTHER" -> Right Other
x -> Left ("Unable to parse ErrorProtoLocationType from: " <> x)
instance ToHttpApiData ErrorProtoLocationType where
toQueryParam = \case
Path -> "PATH"
Other -> "OTHER"
instance FromJSON ErrorProtoLocationType where
parseJSON = parseJSONText "ErrorProtoLocationType"
instance ToJSON ErrorProtoLocationType where
toJSON = toJSONText
data ErrorsCode
= BadRequest
| ForBidden
| NotFound
| Conflict
| Gone
| PreconditionFailed
| InternalError
| ServiceUnavailable
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable ErrorsCode
instance FromHttpApiData ErrorsCode where
parseQueryParam = \case
"BAD_REQUEST" -> Right BadRequest
"FORBIDDEN" -> Right ForBidden
"NOT_FOUND" -> Right NotFound
"CONFLICT" -> Right Conflict
"GONE" -> Right Gone
"PRECONDITION_FAILED" -> Right PreconditionFailed
"INTERNAL_ERROR" -> Right InternalError
"SERVICE_UNAVAILABLE" -> Right ServiceUnavailable
x -> Left ("Unable to parse ErrorsCode from: " <> x)
instance ToHttpApiData ErrorsCode where
toQueryParam = \case
BadRequest -> "BAD_REQUEST"
ForBidden -> "FORBIDDEN"
NotFound -> "NOT_FOUND"
Conflict -> "CONFLICT"
Gone -> "GONE"
PreconditionFailed -> "PRECONDITION_FAILED"
InternalError -> "INTERNAL_ERROR"
ServiceUnavailable -> "SERVICE_UNAVAILABLE"
instance FromJSON ErrorsCode where
parseJSON = parseJSONText "ErrorsCode"
instance ToJSON ErrorsCode where
toJSON = toJSONText