on develop help sign in
Disambiguating media upload and download wrappers
commit4681e8981ad4a00ef3267e86ab3183a9766a6536 authorBrendan Hay <brendan.g.hay@gmail.com> dateFri 23 Oct 2015, 18:27 (11 years ago) parent3cfef0e
4 files changed+12−13
core/src/Network/Google/Types.hs+2−2 gen/src/Gen/Syntax.hs+4−4 gen/src/Gen/Text.hs−1 gogol/src/Network/Google.hs+6−6
core/src/Network/Google/Types.hs+2−2
@@ -81,9 +81,9 @@ instance FromJSON OAuthToken where
8181instance ToJSON OAuthToken where
8282 toJSON = toJSON . Text.decodeUtf8 . tokenToBS
8383
84−newtype Download a = Download a
84+newtype MediaDownload a = MediaDownload a
8585
86−data Upload a = Upload a RequestBody
86+data MediaUpload a = MediaUpload a RequestBody
8787
8888_Coerce :: (Coercible a b, Coercible b a) => Iso' a b
8989_Coerce = iso coerce coerce
gen/src/Gen/Syntax.hs+4−4
@@ -217,13 +217,13 @@ downloadDecl :: Global
217217downloadDecl n p api url fs m =
218218 googleRequestDecl n ty rs [alt] p api url fs m pat prec
219219 where
220− ty = TyApp (TyCon "Download") (tycon n)
220+ ty = TyApp (TyCon "MediaDownload") (tycon n)
221221 rs = InsType noLoc (TyApp (TyCon "Rs") ty) (TyCon "Stream")
222222
223223 alt = app (var "Just") (var "AltMedia")
224224 pat = downloadPat m
225225
226− prec = PApp (UnQual "Download")
226+ prec = PApp (UnQual "MediaDownload")
227227 [ PRec (UnQual (dname n)) [PFieldWildcard | not (null fs)]
228228 ]
229229
@@ -237,7 +237,7 @@ uploadDecl :: Global
237237uploadDecl n p api url fs m =
238238 googleRequestDecl n ty rs extras p api url fs m pat prec
239239 where
240− ty = TyApp (TyCon "Upload") (tycon n)
240+ ty = TyApp (TyCon "MediaUpload") (tycon n)
241241 rs = InsType noLoc (TyApp (TyCon "Rs") ty) $
242242 maybe unit_tycon (tycon . ref) (_mResponse m)
243243
@@ -251,7 +251,7 @@ uploadDecl n p api url fs m =
251251
252252 pat = uploadPat m
253253
254− prec = PApp (UnQual "Upload")
254+ prec = PApp (UnQual "MediaUpload")
255255 [ PRec (UnQual (dname n)) [PFieldWildcard | not (null fs)]
256256 , PVar media
257257 ]
gen/src/Gen/Text.hs−1
@@ -135,7 +135,6 @@ renameReserved x
135135 , "Data"
136136 , "TimeOfDay"
137137 , "LocalTime"
138− , "Download"
139138 ] ++ map Text.pack (reservedNames haskellDef)
140139
141140camelAcronym :: Text -> Text
gogol/src/Network/Google.hs+6−6
@@ -191,19 +191,19 @@ send x = liftGoogle $ do
191191-- to retrieve the streaming media.
192192--
193193-- Throws 'Error'.
194−download :: (MonadGoogle m, GoogleRequest (Download a))
194+download :: (MonadGoogle m, GoogleRequest (MediaDownload a))
195195 => a
196− -> m (Rs (Download a))
197−download = send . Download
196+ -> m (Rs (MediaDownload a))
197+download = send . MediaDownload
198198
199199-- | Send a request with an attached multipart/related media upload.
200200--
201201-- Throws 'Error'.
202−upload :: (MonadGoogle m, GoogleRequest (Upload a))
202+upload :: (MonadGoogle m, GoogleRequest (MediaUpload a))
203203 => a
204204 -> RequestBody
205− -> m (Rs (Upload a))
206−upload x = send . Upload x
205+ -> m (Rs (MediaUpload a))
206+upload x = send . MediaUpload x
207207
208208hoistError :: MonadThrow m => Either Error a -> m a
209209hoistError = either (throwingM _Error) return