{-# 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.Content.Orderreturns.Get
-- Copyright   : (c) 2015-2016 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves an order return from your Merchant Center account.
--
-- /See:/ <https://developers.google.com/shopping-content Content API for Shopping Reference> for @content.orderreturns.get@.
module Network.Google.Resource.Content.Orderreturns.Get
    (
    -- * REST Resource
      OrderreturnsGetResource

    -- * Creating a Request
    , orderreturnsGet
    , OrderreturnsGet

    -- * Request Lenses
    , oggMerchantId
    , oggReturnId
    ) where

import           Network.Google.Prelude
import           Network.Google.ShoppingContent.Types

-- | A resource alias for @content.orderreturns.get@ method which the
-- 'OrderreturnsGet' request conforms to.
type OrderreturnsGetResource =
     "content" :>
       "v2.1" :>
         Capture "merchantId" (Textual Word64) :>
           "orderreturns" :>
             Capture "returnId" Text :>
               QueryParam "alt" AltJSON :>
                 Get '[JSON] MerchantOrderReturn

-- | Retrieves an order return from your Merchant Center account.
--
-- /See:/ 'orderreturnsGet' smart constructor.
data OrderreturnsGet = OrderreturnsGet'
    { _oggMerchantId :: !(Textual Word64)
    , _oggReturnId   :: !Text
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'OrderreturnsGet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oggMerchantId'
--
-- * 'oggReturnId'
orderreturnsGet
    :: Word64 -- ^ 'oggMerchantId'
    -> Text -- ^ 'oggReturnId'
    -> OrderreturnsGet
orderreturnsGet pOggMerchantId_ pOggReturnId_ =
    OrderreturnsGet'
    { _oggMerchantId = _Coerce # pOggMerchantId_
    , _oggReturnId = pOggReturnId_
    }

-- | The ID of the account that manages the order. This cannot be a
-- multi-client account.
oggMerchantId :: Lens' OrderreturnsGet Word64
oggMerchantId
  = lens _oggMerchantId
      (\ s a -> s{_oggMerchantId = a})
      . _Coerce

-- | Merchant order return ID generated by Google.
oggReturnId :: Lens' OrderreturnsGet Text
oggReturnId
  = lens _oggReturnId (\ s a -> s{_oggReturnId = a})

instance GoogleRequest OrderreturnsGet where
        type Rs OrderreturnsGet = MerchantOrderReturn
        type Scopes OrderreturnsGet =
             '["https://www.googleapis.com/auth/content"]
        requestClient OrderreturnsGet'{..}
          = go _oggMerchantId _oggReturnId (Just AltJSON)
              shoppingContentService
          where go
                  = buildClient
                      (Proxy :: Proxy OrderreturnsGetResource)
                      mempty