@@ -185,7 +185,6 @@ main :: IO ()
185185main = do
186186 res <- runMinio minioPlayCI $ do
187187 makeBucket bucketName (Just "us-east-1")
188−
189188 case res of
190189 Left err -> putStrLn $ "Failed to make bucket: " ++ (show res)
191190 Right _ -> putStrLn $ "makeBucket successful."
@@ -225,7 +224,7 @@ main = do
225224
226225
227226<a name="listObjects"></a>
228−### listObjects :: Bucket -> Maybe Text -> Bool -> C.Producer Minio ObjectInfo
227+### listObjects :: Bucket -> Maybe Text -> Bool -> C.ConduitM () ObjectInfo Minio ()
229228
230229List objects in the given bucket, implements version 2 of AWS S3 API.
231230
@@ -244,7 +243,7 @@ __Return Value__
244243
245244|Return type |Description |
246245|:---|:---|
247−| _C.Producer Minio ObjectInfo_ | A Conduit Producer of `ObjectInfo` values corresponding to each object. |
246+| _C.ConduitM () ObjectInfo Minio ()_ | A Conduit Producer of `ObjectInfo` values corresponding to each object. |
248247
249248__ObjectInfo record type__
250249
@@ -258,10 +257,19 @@ __ObjectInfo record type__
258257__Example__
259258
260259``` haskell
261−{-# Language OverloadedStrings #-}
260+{-# LANGUAGE OverloadedStrings #-}
261+import Network.Minio
262+
263+import Conduit
264+import Prelude
262265
263−import Data.Conduit (($$))
264−import Conduit.Combinators (sinkList)
266+
267+-- | The following example uses minio's play server at
268+-- https://play.minio.io:9000. The endpoint and associated
269+-- credentials are provided via the libary constant,
270+--
271+-- > minioPlayCI :: ConnectInfo
272+--
265273
266274main :: IO ()
267275main = do
@@ -270,14 +278,13 @@ main = do
270278
271279 -- Performs a recursive listing of all objects under bucket "test"
272280 -- on play.minio.io.
273− res <- runMinio minioPlayCI $ do
274− listObjects bucket Nothing True $$ sinkList
281+ res <- runMinio minioPlayCI $
282+ runConduit $ listObjects bucket Nothing True .| mapM_C (\v -> (liftIO $ print v))
275283 print res
276−
277284```
278285
279286<a name="listObjectsV1"></a>
280−### listObjectsV1 :: Bucket -> Maybe Text -> Bool -> C.Producer Minio ObjectInfo
287+### listObjectsV1 :: Bucket -> Maybe Text -> Bool -> C.ConduitM () ObjectInfo Minio ()
281288
282289List objects in the given bucket, implements version 1 of AWS S3 API. This API
283290is provided for legacy S3 compatible object storage endpoints.
@@ -297,7 +304,7 @@ __Return Value__
297304
298305|Return type |Description |
299306|:---|:---|
300−| _C.Producer Minio ObjectInfo_ | A Conduit Producer of `ObjectInfo` values corresponding to each object. |
307+| _C.ConduitM () ObjectInfo Minio ()_ | A Conduit Producer of `ObjectInfo` values corresponding to each object. |
301308
302309__ObjectInfo record type__
303310
@@ -311,10 +318,19 @@ __ObjectInfo record type__
311318__Example__
312319
313320``` haskell
314−{-# Language OverloadedStrings #-}
321+{-# LANGUAGE OverloadedStrings #-}
322+import Network.Minio
323+
324+import Conduit
325+import Prelude
326+
315327
316−import Data.Conduit (($$))
317−import Conduit.Combinators (sinkList)
328+-- | The following example uses minio's play server at
329+-- https://play.minio.io:9000. The endpoint and associated
330+-- credentials are provided via the libary constant,
331+--
332+-- > minioPlayCI :: ConnectInfo
333+--
318334
319335main :: IO ()
320336main = do
@@ -323,10 +339,9 @@ main = do
323339
324340 -- Performs a recursive listing of all objects under bucket "test"
325341 -- on play.minio.io.
326− res <- runMinio minioPlayCI $ do
327− listObjectsV1 bucket Nothing True $$ sinkList
342+ res <- runMinio minioPlayCI $
343+ runConduit $ listObjectsV1 bucket Nothing True .| mapM_C (\v -> (liftIO $ print v))
328344 print res
329−
330345```
331346
332347<a name="listIncompleteUploads"></a>
@@ -349,7 +364,7 @@ __Return Value__
349364
350365|Return type |Description |
351366|:---|:---|
352−| _C.Producer Minio UploadInfo_ | A Conduit Producer of `UploadInfo` values corresponding to each incomplete multipart upload |
367+| _C.ConduitM () UploadInfo Minio ()_ | A Conduit Producer of `UploadInfo` values corresponding to each incomplete multipart upload |
353368
354369__UploadInfo record type__
355370
@@ -362,20 +377,28 @@ __UploadInfo record type__
362377__Example__
363378
364379```haskell
365−{-# Language OverloadedStrings #-}
380+{-# LANGUAGE OverloadedStrings #-}
381+import Network.Minio
366382
367−import Data.Conduit (($$))
368−import Conduit.Combinators (sinkList)
383+import Conduit
384+import Prelude
385+
386+-- | The following example uses minio's play server at
387+-- https://play.minio.io:9000. The endpoint and associated
388+-- credentials are provided via the libary constant,
389+--
390+-- > minioPlayCI :: ConnectInfo
391+--
369392
370393main :: IO ()
371394main = do
372395 let
373396 bucket = "test"
374397
375− -- Performs a recursive listing of all incompletely uploaded objects
376− -- under bucket "test" on play.minio.io.
377− res <- runMinio minioPlayCI $ do
378− listIncompleteUploads bucket Nothing True $$ sinkList
398+ -- Performs a recursive listing of incomplete uploads under bucket "test"
399+ -- on a local minio server.
400+ res <- runMinio minioPlayCI $
401+ runConduit $ listIncompleteUploads bucket Nothing True .| mapM_C (\v -> (liftIO $ print v))
379402 print res
380403
381404```
@@ -383,19 +406,30 @@ main = do
383406## 3. Object operations
384407
385408<a name="getObject"></a>
386−### getObject :: Bucket -> Object -> Minio (C.ResumableSource Minio ByteString)
409+### getObject :: Bucket -> Object -> GetObjectOptions -> Minio (C.ConduitM () ByteString Minio ())
387410
388−Get an object from the service.
411+Get an object from the S3 service, optionally object ranges can be provided as well.
389412
390413__Parameters__
391414
392−In the expression `getObject bucketName objectName` the parameters
415+In the expression `getObject bucketName objectName opts` the parameters
393416are:
394417
395418|Param |Type |Description |
396419|:---|:---| :---|
397420| `bucketName` | _Bucket_ (alias for `Text`) | Name of the bucket |
398421| `objectName` | _Object_ (alias for `Text`) | Name of the object |
422+| `opts` | _GetObjectOptions_ | Options for GET requests specifying additional options like If-Match, Range |
423+
424+__GetObjectOptions record type__
425+
426+|Field |Type |Description |
427+|:---|:---| :---|
428+| `gooRange` | `Maybe ByteRanges` | Represents the byte range of object. E.g ByteRangeFromTo 0 9 represents first ten bytes of the object|
429+| `gooIfMatch` | `Maybe ETag` (alias for `Text`) | (Optional) ETag of object should match |
430+| `gooIfNoneMatch` | `Maybe ETag` (alias for `Text`) | (Optional) ETag of object shouldn't match |
431+| `gooIfUnmodifiedSince` | `Maybe UTCTime` | (Optional) Time since object wasn't modified |
432+| `gooIfModifiedSince` | `Maybe UTCTime` | (Optional) Time since object was modified |
399433
400434__Return Value__
401435
@@ -403,41 +437,45 @@ The return value can be incrementally read to process the contents of
403437the object.
404438|Return type |Description |
405439|:---|:---|
406−| _C.ResumableSource Minio ByteString_ | A Conduit ResumableSource of `ByteString` values. |
440+| _Minio (C.ConduitM () ByteString Minio ())_ | A Conduit source of `ByteString` values. |
407441
408442__Example__
409443
410444```haskell
411−{-# Language OverloadedStrings #-}
445+{-# LANGUAGE OverloadedStrings #-}
446+import Network.Minio
412447
413−import Network.Minio
414−import Data.Conduit (($$+-))
415−import Data.Conduit.Binary (sinkLbs)
416−import qualified Data.ByteString.Lazy as LB
448+import qualified Data.Conduit as C
449+import qualified Data.Conduit.Binary as CB
450+
451+import Prelude
452+
453+-- | The following example uses minio's play server at
454+-- https://play.minio.io:9000. The endpoint and associated
455+-- credentials are provided via the libary constant,
456+--
457+-- > minioPlayCI :: ConnectInfo
458+--
417459
418460main :: IO ()
419461main = do
420462 let
421− bucket = "mybucket"
422− object = "myobject"
423−
424− -- Lists the parts in an incompletely uploaded object identified by
425− -- bucket, object and upload ID.
463+ bucket = "my-bucket"
464+ object = "my-object"
426465 res <- runMinio minioPlayCI $ do
427− source <- getObject bucket object
428− source $$+- sinkLbs
466+ src <- getObject bucket object def
467+ C.connect src $ CB.sinkFileCautious "/tmp/my-object"
429468
430− -- the following the prints the contents of the object.
431− putStrLn $ either
432− (("Failed to getObject: " ++) . show)
433− (("Read an object of length: " ++) . show . LB.length)
434− res
469+ case res of
470+ Left e -> putStrLn $ "getObject failed." ++ (show e)
471+ Right _ -> putStrLn "getObject succeeded."
435472```
436473
437474<a name="putObject"></a>
438−### putObject :: Bucket -> Object -> C.Producer Minio ByteString -> Maybe Int64 -> Minio ()
475+### putObject :: Bucket -> Object -> C.ConduitM () ByteString Minio () -> Maybe Int64 -> PutObjectOptions -> Minio ()
439476Uploads an object to a bucket in the service, from the given input
440−byte stream of optionally supplied length
477+byte stream of optionally supplied length. Optionally you can also specify
478+additional metadata for the object.
441479
442480__Parameters__
443481
@@ -448,28 +486,42 @@ are:
448486|:---|:---| :---|
449487| `bucketName` | _Bucket_ (alias for `Text`) | Name of the bucket |
450488| `objectName` | _Object_ (alias for `Text`) | Name of the object |
451−| `inputSrc` | _C.Producer Minio ByteString_ | A Conduit Producer of `ByteString` values |
489+| `inputSrc` | _C.ConduitM () ByteString Minio ()_ | A Conduit producer of `ByteString` values |
490+| `size` | _Int64_ | Provide stream size (optional) |
491+| `opts` | _PutObjectOptions_ | Optional parameters to provide additional metadata for the object |
452492
453493__Example__
454494
455495```haskell
456−{-# Language OverloadedStrings #-}
457−import Network.Minio
496+{-# LANGUAGE OverloadedStrings #-}
497+import Network.Minio
498+
458499import qualified Data.Conduit.Combinators as CC
459500
501+import Prelude
502+
503+-- | The following example uses minio's play server at
504+-- https://play.minio.io:9000. The endpoint and associated
505+-- credentials are provided via the libary constant,
506+--
507+-- > minioPlayCI :: ConnectInfo
508+--
509+
460510main :: IO ()
461511main = do
462512 let
463− bucket = "mybucket"
464− object = "myobject"
465− kb15 = 15 * 1024
466−
467− res <- runMinio minioPlayCI $ do
468− putObject bucket object (CC.repeat "a") (Just kb15)
513+ bucket = "test"
514+ object = "obj"
515+ localFile = "/etc/lsb-release"
516+ kb15 = 15 * 1024
469517
518+ -- Eg 1. Upload a stream of repeating "a" using putObject with default options.
519+ res <- runMinio minioPlayCI $
520+ putObject bucket object (CC.repeat "a") (Just kb15) def
470521 case res of
471− Left e -> putStrLn $ "Failed to putObject " ++ show bucket ++ "/" ++ show object
472− Right _ -> putStrLn "PutObject was successful"
522+ Left e -> putStrLn $ "putObject failed." ++ show e
523+ Right () -> putStrLn "putObject succeeded."
524+
473525```
474526
475527<a name="fGetObject"></a>