{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.Resource.AdSenseHost.AssociationSessions.Start
(
AssociationSessionsStartResource
, associationSessionsStart
, AssociationSessionsStart
, assWebsiteLocale
, assUserLocale
, assWebsiteURL
, assProductCode
) where
import Network.Google.AdSenseHost.Types
import Network.Google.Prelude
type AssociationSessionsStartResource =
"adsensehost" :>
"v4.1" :>
"associationsessions" :>
"start" :>
QueryParams "productCode"
AssociationSessionsStartProductCode
:>
QueryParam "websiteUrl" Text :>
QueryParam "websiteLocale" Text :>
QueryParam "userLocale" Text :>
QueryParam "alt" AltJSON :>
Get '[JSON] AssociationSession
-- | Create an association session for initiating an association with an
-- AdSense user.
--
-- /See:/ 'associationSessionsStart' smart constructor.
data AssociationSessionsStart = AssociationSessionsStart'
{ _assWebsiteLocale :: !(Maybe Text)
, _assUserLocale :: !(Maybe Text)
, _assWebsiteURL :: !Text
, _assProductCode :: ![AssociationSessionsStartProductCode]
} deriving (Eq,Show,Data,Typeable,Generic)
-- | Creates a value of 'AssociationSessionsStart' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'assWebsiteLocale'
--
-- * 'assUserLocale'
--
-- * 'assWebsiteURL'
--
-- * 'assProductCode'
associationSessionsStart
:: Text -- ^ 'assWebsiteURL'
-> [AssociationSessionsStartProductCode] -- ^ 'assProductCode'
-> AssociationSessionsStart
associationSessionsStart pAssWebsiteURL_ pAssProductCode_ =
AssociationSessionsStart'
{ _assWebsiteLocale = Nothing
, _assUserLocale = Nothing
, _assWebsiteURL = pAssWebsiteURL_
, _assProductCode = _Coerce # pAssProductCode_
}
-- | The locale of the user\'s hosted website.
assWebsiteLocale :: Lens' AssociationSessionsStart (Maybe Text)
assWebsiteLocale
= lens _assWebsiteLocale
(\ s a -> s{_assWebsiteLocale = a})
-- | The preferred locale of the user.
assUserLocale :: Lens' AssociationSessionsStart (Maybe Text)
assUserLocale
= lens _assUserLocale
(\ s a -> s{_assUserLocale = a})
-- | The URL of the user\'s hosted website.
assWebsiteURL :: Lens' AssociationSessionsStart Text
assWebsiteURL
= lens _assWebsiteURL
(\ s a -> s{_assWebsiteURL = a})
-- | Products to associate with the user.
assProductCode :: Lens' AssociationSessionsStart [AssociationSessionsStartProductCode]
assProductCode
= lens _assProductCode
(\ s a -> s{_assProductCode = a})
. _Coerce
instance GoogleRequest AssociationSessionsStart where
type Rs AssociationSessionsStart = AssociationSession
type Scopes AssociationSessionsStart =
'["https://www.googleapis.com/auth/adsensehost"]
requestClient AssociationSessionsStart'{..}
= go _assProductCode (Just _assWebsiteURL)
_assWebsiteLocale
_assUserLocale
(Just AltJSON)
adSenseHostService
where go
= buildClient
(Proxy :: Proxy AssociationSessionsStartResource)
mempty