]> _ Git - fluidbook_toolboxapiclient.git/commitdiff
#7454
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 8 Apr 2025 08:42:32 +0000 (10:42 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 8 Apr 2025 08:42:32 +0000 (10:42 +0200)
src/Client.php

index ffec3748d43c575bd255eb4d2c3d26c3e9ed4814..0ea92853d6ebfd2937e1f3791e298e6d1d67f72d 100644 (file)
@@ -51,9 +51,9 @@ class Client
         return $response->getBody()->getContents();
     }
 
-    public function createFluidbook(\SplFileInfo $file, $base, $title, $installServer, $installPath, $attributes = []): string
+    public function createFluidbook(\SplFileInfo $file, $base, $title, $installServer, $installPath, $attributes = []): \stdClass
     {
-        $data = array_merge($attributes, ['base' => $base, 'title' => $title, 'export[server]' => $installServer, 'export[path]' => $installPath]);
+        $data = array_merge(['base' => $base, 'title' => $title, 'export[server]' => $installServer, 'export[path]' => $installPath, 'attributes' => json_encode($attributes)]);
         $multipart = [];
         foreach ($data as $k => $v) {
             $multipart[] = ['name' => $k, 'contents' => $v];
@@ -75,7 +75,7 @@ class Client
 
     protected function _request($method, $uri, $options = [])
     {
-        return self::getResponseContents($this->getClient()->request($method, $uri, $options));
+        return json_decode(self::getResponseContents($this->getClient()->request($method, $uri, $options)));
     }