on develop help sign in
Rename `Body` for gogol-docs
commited8e7bf2b3360b92303d4336187591122d447f05 authorKoray Al <admin@koray.al> dateWed 20 Feb 2019, 01:49 (8 years ago) parentf13ac82
2 files changed+17−17
core/src/Network/Google/Types.hs+16−16 gen/src/Gen/Types.hs+1−1
core/src/Network/Google/Types.hs+16−16
@@ -167,7 +167,7 @@ instance Show GSecret where
167167
168168newtype MediaDownload a = MediaDownload a
169169
170−data MediaUpload a = MediaUpload a Body
170+data MediaUpload a = MediaUpload a GBody
171171
172172_Coerce :: (Coercible a b, Coercible b a) => Iso' a b
173173_Coerce = iso coerce coerce
@@ -290,21 +290,21 @@ serviceTimeout = lens _svcTimeout (\s a -> s { _svcTimeout = a })
290290-- | A single part of a (potentially multipart) request body.
291291--
292292-- /Note:/ The 'IsString' instance defaults to a @text/plain@ MIME type.
293−data Body = Body !MediaType !RequestBody
293+data GBody = GBody !MediaType !RequestBody
294294
295−instance IsString Body where
296− fromString = Body ("text" // "plain") . fromString
295+instance IsString GBody where
296+ fromString = GBody ("text" // "plain") . fromString
297297
298298-- | A lens into the 'MediaType' of a request 'Body'.
299−bodyContentType :: Lens' Body MediaType
300−bodyContentType = lens (\(Body m _) -> m) (\(Body _ b) m -> Body m b)
299+bodyContentType :: Lens' GBody MediaType
300+bodyContentType = lens (\(GBody m _) -> m) (\(GBody _ b) m -> GBody m b)
301301
302302-- | An intermediary request builder.
303303data Request = Request
304304 { _rqPath :: !Builder
305305 , _rqQuery :: !(DList (ByteString, Maybe ByteString))
306306 , _rqHeaders :: !(DList (HeaderName, ByteString))
307− , _rqBody :: ![Body]
307+ , _rqBody :: ![GBody]
308308 }
309309
310310instance Monoid Request where
@@ -335,7 +335,7 @@ appendHeader rq k (Just v) = rq
335335 { _rqHeaders = DList.snoc (_rqHeaders rq) (k, Text.encodeUtf8 v)
336336 }
337337
338−setBody :: Request -> [Body] -> Request
338+setBody :: Request -> [GBody] -> Request
339339setBody rq bs = rq { _rqBody = bs }
340340
341341-- | A materialised 'http-client' request and associated response parser.
@@ -384,22 +384,22 @@ gClient f cs m statuses rq s = GClient
384384 }
385385
386386class Accept c => ToBody c a where
387− toBody :: Proxy c -> a -> Body
387+ toBody :: Proxy c -> a -> GBody
388388
389389instance ToBody OctetStream ByteString where
390− toBody p = Body (contentType p) . RequestBodyBS
390+ toBody p = GBody (contentType p) . RequestBodyBS
391391
392392instance ToBody OctetStream LBS.ByteString where
393− toBody p = Body (contentType p) . RequestBodyLBS
393+ toBody p = GBody (contentType p) . RequestBodyLBS
394394
395395instance ToBody PlainText ByteString where
396− toBody p = Body (contentType p) . RequestBodyBS
396+ toBody p = GBody (contentType p) . RequestBodyBS
397397
398398instance ToBody PlainText LBS.ByteString where
399− toBody p = Body (contentType p) . RequestBodyLBS
399+ toBody p = GBody (contentType p) . RequestBodyLBS
400400
401401instance ToJSON a => ToBody JSON a where
402− toBody p = Body (contentType p) . RequestBodyLBS . encode
402+ toBody p = GBody (contentType p) . RequestBodyLBS . encode
403403
404404class Accept c => FromStream c a where
405405 fromStream :: Proxy c
@@ -441,14 +441,14 @@ data MultipartRelated (cs :: [*]) m
441441instance ( ToBody c m
442442 , GoogleClient fn
443443 ) => GoogleClient (MultipartRelated (c ': cs) m :> fn) where
444− type Fn (MultipartRelated (c ': cs) m :> fn) = m -> Body -> Fn fn
444+ type Fn (MultipartRelated (c ': cs) m :> fn) = m -> GBody -> Fn fn
445445
446446 buildClient Proxy rq m b =
447447 buildClient (Proxy :: Proxy fn) $
448448 setBody rq [toBody (Proxy :: Proxy c) m, b]
449449
450450instance GoogleClient fn => GoogleClient (AltMedia :> fn) where
451− type Fn (AltMedia :> fn) = Body -> Fn fn
451+ type Fn (AltMedia :> fn) = GBody -> Fn fn
452452
453453 buildClient Proxy rq b =
454454 buildClient (Proxy :: Proxy fn) $
gen/src/Gen/Types.hs+1−1
@@ -346,7 +346,7 @@ initial s = Memo s mempty mempty res core mempty mempty mempty
346346 $ Map.elems (s ^. dSchemas)
347347 -- Types available in Network.Google.Prelude.
348348 core = Map.fromList
349− [ ("Body", SLit requiredInfo RqBody)
349+ [ ("GBody", SLit requiredInfo RqBody)
350350 , ("Stream", SLit requiredInfo RsBody)
351351 , ("JSONValue", SLit requiredInfo JSONValue)
352352 ]