{-# 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.PlusDomains.Media.Insert
(
MediaInsertResource
, mediaInsert
, MediaInsert
, miCollection
, miPayload
, miUserId
) where
import Network.Google.PlusDomains.Types
import Network.Google.Prelude
type MediaInsertResource =
"plusDomains" :>
"v1" :>
"people" :>
Capture "userId" Text :>
"media" :>
Capture "collection" MediaInsertCollection :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] Media :> Post '[JSON] Media
:<|>
"upload" :>
"plusDomains" :>
"v1" :>
"people" :>
Capture "userId" Text :>
"media" :>
Capture "collection" MediaInsertCollection :>
QueryParam "alt" AltJSON :>
QueryParam "uploadType" Multipart :>
MultipartRelated '[JSON] Media :> Post '[JSON] Media
data MediaInsert = MediaInsert'
{ _miCollection :: !MediaInsertCollection
, _miPayload :: !Media
, _miUserId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
mediaInsert
:: MediaInsertCollection
-> Media
-> Text
-> MediaInsert
mediaInsert pMiCollection_ pMiPayload_ pMiUserId_ =
MediaInsert'
{ _miCollection = pMiCollection_
, _miPayload = pMiPayload_
, _miUserId = pMiUserId_
}
miCollection :: Lens' MediaInsert MediaInsertCollection
miCollection
= lens _miCollection (\ s a -> s{_miCollection = a})
miPayload :: Lens' MediaInsert Media
miPayload
= lens _miPayload (\ s a -> s{_miPayload = a})
miUserId :: Lens' MediaInsert Text
miUserId = lens _miUserId (\ s a -> s{_miUserId = a})
instance GoogleRequest MediaInsert where
type Rs MediaInsert = Media
type Scopes MediaInsert =
'["https://www.googleapis.com/auth/plus.login",
"https://www.googleapis.com/auth/plus.me",
"https://www.googleapis.com/auth/plus.media.upload"]
requestClient MediaInsert'{..}
= go _miUserId _miCollection (Just AltJSON)
_miPayload
plusDomainsService
where go :<|> _
= buildClient (Proxy :: Proxy MediaInsertResource)
mempty
instance GoogleRequest (MediaUpload MediaInsert)
where
type Rs (MediaUpload MediaInsert) = Media
type Scopes (MediaUpload MediaInsert) =
Scopes MediaInsert
requestClient (MediaUpload MediaInsert'{..} body)
= go _miUserId _miCollection (Just AltJSON)
(Just Multipart)
_miPayload
body
plusDomainsService
where _ :<|> go
= buildClient (Proxy :: Proxy MediaInsertResource)
mempty