From 39b9d44793b860fc96365cefcaa7d141e3e429ae Mon Sep 17 00:00:00 2001 From: Koen Date: Mon, 17 Sep 2018 22:38:21 +0200 Subject: [PATCH 1/2] Add support for prefix and delimiter for listFiles() --- src/Client.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Client.php b/src/Client.php index 15e1281..0caa108 100755 --- a/src/Client.php +++ b/src/Client.php @@ -280,6 +280,10 @@ public function listFiles(array $options) $nextFileName = null; $maxFileCount = 1000; + + $prefix = isset($options["Prefix"]) ? $options["Prefix"] : ""; + $delimiter = isset($options["Delimiter"]) ? $options["Delimiter"] : null; + $files = []; if (!isset($options['BucketId']) && isset($options['BucketName'])) { @@ -301,6 +305,8 @@ public function listFiles(array $options) 'bucketId' => $options['BucketId'], 'startFileName' => $nextFileName, 'maxFileCount' => $maxFileCount, + 'prefix' => $prefix, + 'delimiter' => $delimiter ], ]); From a2c84cb8a0b9ddd0512a10a6d29351e9a7f7916a Mon Sep 17 00:00:00 2001 From: Koen Date: Sun, 13 Jan 2019 16:16:24 +0100 Subject: [PATCH 2/2] Fix styling according to StyleCI --- src/Client.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Client.php b/src/Client.php index 0caa108..f0ee431 100755 --- a/src/Client.php +++ b/src/Client.php @@ -281,8 +281,8 @@ public function listFiles(array $options) $nextFileName = null; $maxFileCount = 1000; - $prefix = isset($options["Prefix"]) ? $options["Prefix"] : ""; - $delimiter = isset($options["Delimiter"]) ? $options["Delimiter"] : null; + $prefix = isset($options['Prefix']) ? $options['Prefix'] : ''; + $delimiter = isset($options['Delimiter']) ? $options['Delimiter'] : null; $files = []; @@ -295,7 +295,7 @@ public function listFiles(array $options) $maxFileCount = 1; } - // B2 returns, at most, 1000 files per "page". Loop through the pages and compile an array of File objects. + // B2 returns, at most, 1000 files per 'page'. Loop through the pages and compile an array of File objects. while (true) { $response = $this->client->request('POST', $this->apiUrl.'/b2_list_file_names', [ 'headers' => [ @@ -306,7 +306,7 @@ public function listFiles(array $options) 'startFileName' => $nextFileName, 'maxFileCount' => $maxFileCount, 'prefix' => $prefix, - 'delimiter' => $delimiter + 'delimiter' => $delimiter, ], ]);