{-# 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.AndroidPublisher.Purchases.Subscriptions.Get
(
PurchasesSubscriptionsGetResource
, purchasesSubscriptionsGet
, PurchasesSubscriptionsGet
, psgPackageName
, psgToken
, psgSubscriptionId
) where
import Network.Google.AndroidPublisher.Types
import Network.Google.Prelude
type PurchasesSubscriptionsGetResource =
"androidpublisher" :>
"v2" :>
"applications" :>
Capture "packageName" Text :>
"purchases" :>
"subscriptions" :>
Capture "subscriptionId" Text :>
"tokens" :>
Capture "token" Text :>
QueryParam "alt" AltJSON :>
Get '[JSON] SubscriptionPurchase
-- | Checks whether a user\'s subscription purchase is valid and returns its
-- expiry time.
--
-- /See:/ 'purchasesSubscriptionsGet' smart constructor.
data PurchasesSubscriptionsGet = PurchasesSubscriptionsGet'
{ _psgPackageName :: !Text
, _psgToken :: !Text
, _psgSubscriptionId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
-- | Creates a value of 'PurchasesSubscriptionsGet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'psgPackageName'
--
-- * 'psgToken'
--
-- * 'psgSubscriptionId'
purchasesSubscriptionsGet
:: Text -- ^ 'psgPackageName'
-> Text -- ^ 'psgToken'
-> Text -- ^ 'psgSubscriptionId'
-> PurchasesSubscriptionsGet
purchasesSubscriptionsGet pPsgPackageName_ pPsgToken_ pPsgSubscriptionId_ =
PurchasesSubscriptionsGet'
{ _psgPackageName = pPsgPackageName_
, _psgToken = pPsgToken_
, _psgSubscriptionId = pPsgSubscriptionId_
}
-- | The package name of the application for which this subscription was
-- purchased (for example, \'com.some.thing\').
psgPackageName :: Lens' PurchasesSubscriptionsGet Text
psgPackageName
= lens _psgPackageName
(\ s a -> s{_psgPackageName = a})
-- | The token provided to the user\'s device when the subscription was
-- purchased.
psgToken :: Lens' PurchasesSubscriptionsGet Text
psgToken = lens _psgToken (\ s a -> s{_psgToken = a})
-- | The purchased subscription ID (for example, \'monthly001\').
psgSubscriptionId :: Lens' PurchasesSubscriptionsGet Text
psgSubscriptionId
= lens _psgSubscriptionId
(\ s a -> s{_psgSubscriptionId = a})
instance GoogleRequest PurchasesSubscriptionsGet
where
type Rs PurchasesSubscriptionsGet =
SubscriptionPurchase
type Scopes PurchasesSubscriptionsGet =
'["https://www.googleapis.com/auth/androidpublisher"]
requestClient PurchasesSubscriptionsGet'{..}
= go _psgPackageName _psgSubscriptionId _psgToken
(Just AltJSON)
androidPublisherService
where go
= buildClient
(Proxy :: Proxy PurchasesSubscriptionsGetResource)
mempty