{-# 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.URLShortener.URL.Insert
(
URLInsertResource
, urlInsert
, URLInsert
, uiPayload
) where
import Network.Google.Prelude
import Network.Google.URLShortener.Types
type URLInsertResource =
"urlshortener" :>
"v1" :>
"url" :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] URL :> Post '[JSON] URL
-- | Creates a new short URL.
--
-- /See:/ 'urlInsert' smart constructor.
newtype URLInsert = URLInsert'
{ _uiPayload :: URL
} deriving (Eq,Show,Data,Typeable,Generic)
-- | Creates a value of 'URLInsert' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'uiPayload'
urlInsert
:: URL -- ^ 'uiPayload'
-> URLInsert
urlInsert pUiPayload_ =
URLInsert'
{ _uiPayload = pUiPayload_
}
-- | Multipart request metadata.
uiPayload :: Lens' URLInsert URL
uiPayload
= lens _uiPayload (\ s a -> s{_uiPayload = a})
instance GoogleRequest URLInsert where
type Rs URLInsert = URL
type Scopes URLInsert =
'["https://www.googleapis.com/auth/urlshortener"]
requestClient URLInsert'{..}
= go (Just AltJSON) _uiPayload uRLShortenerService
where go
= buildClient (Proxy :: Proxy URLInsertResource)
mempty