From 6544bad6fe568db0b9106b1f4c401cc0a512aac1 Mon Sep 17 00:00:00 2001 From: mrvnklm <24477241+mrvnklm@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:08:06 +0200 Subject: [PATCH] add voucher id to file upload method to add the possibility to upload files to exisiting vouchers by just adding the voucher id `file()->upload(string $filepath, string $type, ?string $voucherId = null)` --- src/File/Client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/File/Client.php b/src/File/Client.php index f3505f5..099cc5d 100644 --- a/src/File/Client.php +++ b/src/File/Client.php @@ -23,7 +23,7 @@ class Client extends BaseClient * @throws LexOfficeApiException * @throws CacheException */ - public function upload(string $filepath, string $type) + public function upload(string $filepath, string $type, ?string $voucherId = null) { $regex = '/.(' . implode('|', $this->supportedExtension) . ')/'; $matchResult = preg_match($regex, $filepath, $matches); @@ -45,7 +45,7 @@ public function upload(string $filepath, string $type) 'type' => $type ]); - $api = $this->api->newRequest('POST', $this->resource, [ + $api = $this->api->newRequest('POST', $voucherId ? "vouchers/{$voucherId}/{$this->resource}" : $this->resource, [ 'Content-Type' => 'multipart/form-data; boundary=' . $body->getBoundary() ]);