{-# 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.Reseller.Subscriptions.Insert
(
SubscriptionsInsertResource
, subscriptionsInsert
, SubscriptionsInsert
, siPayload
, siCustomerId
, siCustomerAuthToken
) where
import Network.Google.AppsReseller.Types
import Network.Google.Prelude
type SubscriptionsInsertResource =
"apps" :>
"reseller" :>
"v1" :>
"customers" :>
Capture "customerId" Text :>
"subscriptions" :>
QueryParam "customerAuthToken" Text :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] Subscription :>
Post '[JSON] Subscription
-- | Creates\/Transfers a subscription for the customer.
--
-- /See:/ 'subscriptionsInsert' smart constructor.
data SubscriptionsInsert = SubscriptionsInsert'
{ _siPayload :: !Subscription
, _siCustomerId :: !Text
, _siCustomerAuthToken :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
-- | Creates a value of 'SubscriptionsInsert' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'siPayload'
--
-- * 'siCustomerId'
--
-- * 'siCustomerAuthToken'
subscriptionsInsert
:: Subscription -- ^ 'siPayload'
-> Text -- ^ 'siCustomerId'
-> SubscriptionsInsert
subscriptionsInsert pSiPayload_ pSiCustomerId_ =
SubscriptionsInsert'
{ _siPayload = pSiPayload_
, _siCustomerId = pSiCustomerId_
, _siCustomerAuthToken = Nothing
}
-- | Multipart request metadata.
siPayload :: Lens' SubscriptionsInsert Subscription
siPayload
= lens _siPayload (\ s a -> s{_siPayload = a})
-- | Id of the Customer
siCustomerId :: Lens' SubscriptionsInsert Text
siCustomerId
= lens _siCustomerId (\ s a -> s{_siCustomerId = a})
-- | An auth token needed for transferring a subscription. Can be generated
-- at https:\/\/www.google.com\/a\/cpanel\/customer-domain\/TransferToken.
-- Optional.
siCustomerAuthToken :: Lens' SubscriptionsInsert (Maybe Text)
siCustomerAuthToken
= lens _siCustomerAuthToken
(\ s a -> s{_siCustomerAuthToken = a})
instance GoogleRequest SubscriptionsInsert where
type Rs SubscriptionsInsert = Subscription
type Scopes SubscriptionsInsert =
'["https://www.googleapis.com/auth/apps.order"]
requestClient SubscriptionsInsert'{..}
= go _siCustomerId _siCustomerAuthToken
(Just AltJSON)
_siPayload
appsResellerService
where go
= buildClient
(Proxy :: Proxy SubscriptionsInsertResource)
mempty