{-# 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.Drive.Files.Export
(
FilesExportResource
, filesExport
, FilesExport
, feMimeType
, feFileId
) where
import Network.Google.Drive.Types
import Network.Google.Prelude
type FilesExportResource =
"drive" :>
"v3" :>
"files" :>
Capture "fileId" Text :>
"export" :>
QueryParam "mimeType" Text :>
QueryParam "alt" AltJSON :> Get '[JSON] ()
:<|>
"drive" :>
"v3" :>
"files" :>
Capture "fileId" Text :>
"export" :>
QueryParam "mimeType" Text :>
QueryParam "alt" AltMedia :>
Get '[OctetStream] Stream
-- | Exports a Google Doc to the requested MIME type and returns the exported
-- content.
--
-- /See:/ 'filesExport' smart constructor.
data FilesExport = FilesExport'
{ _feMimeType :: !Text
, _feFileId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
-- | Creates a value of 'FilesExport' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'feMimeType'
--
-- * 'feFileId'
filesExport
:: Text -- ^ 'feMimeType'
-> Text -- ^ 'feFileId'
-> FilesExport
filesExport pFeMimeType_ pFeFileId_ =
FilesExport'
{ _feMimeType = pFeMimeType_
, _feFileId = pFeFileId_
}
-- | The MIME type of the format requested for this export.
feMimeType :: Lens' FilesExport Text
feMimeType
= lens _feMimeType (\ s a -> s{_feMimeType = a})
-- | The ID of the file.
feFileId :: Lens' FilesExport Text
feFileId = lens _feFileId (\ s a -> s{_feFileId = a})
instance GoogleRequest FilesExport where
type Rs FilesExport = ()
type Scopes FilesExport =
'["https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive.readonly"]
requestClient FilesExport'{..}
= go _feFileId (Just _feMimeType) (Just AltJSON)
driveService
where go :<|> _
= buildClient (Proxy :: Proxy FilesExportResource)
mempty
instance GoogleRequest (MediaDownload FilesExport)
where
type Rs (MediaDownload FilesExport) = Stream
type Scopes (MediaDownload FilesExport) =
Scopes FilesExport
requestClient (MediaDownload FilesExport'{..})
= go _feFileId (Just _feMimeType) (Just AltMedia)
driveService
where _ :<|> go
= buildClient (Proxy :: Proxy FilesExportResource)
mempty