// List objects matching optional prefix in a specified bucket. public static void Run(MinioClient minio, string bucketName = "my-bucket-name", string prefix = null, bool recursive = true) { try { Console.WriteLine("Running example for API: ListObjectsAsync"); ListObjectsArgs listArgs = new ListObjectsArgs() .WithBucket(bucketName) .WithPrefix(prefix) .WithRecursive(recursive); IObservable <Item> observable = minio.ListObjectsAsync(listArgs); IDisposable subscription = observable.Subscribe( item => Console.WriteLine($"Object: {item.Key}"), ex => Console.WriteLine($"OnError: {ex}"), () => Console.WriteLine($"Listed all objects in bucket {bucketName}\n")); listArgs.WithVersions(true); IObservable <VersionItem> observableVer = minio.ListObjectVersionsAsync(listArgs); IDisposable subscriptionVer = observableVer.Subscribe( item => Console.WriteLine($"Object: {item.Key} Version: {item.VersionId}"), ex => Console.WriteLine($"OnError: {ex}"), () => Console.WriteLine($"Listed all objects in bucket {bucketName}\n")); // subscription.Dispose(); } catch (Exception e) { Console.WriteLine($"[Bucket] Exception: {e}"); } }