public function getAll(LibraryType $library, string $dir = '/')
    {
        $clippedBaseUri = $this->clipUri($this->client->getConfig('base_uri'));

        $response = $this->client->request(
            'GET',
            $clippedBaseUri . '/repos/' . $library->id . '/dir/',
            [
                'query' => ['p' => $dir],
            ]
        );

        $json = json_decode((string)$response->getBody());

        $dirItemCollection = [];

        foreach ($json as $dirItemJson) {
            $dirItem = (new DirectoryItem)->fromJson($dirItemJson);

            // if dirItem has no value for "dir", set it here
            if ($dirItem->dir === '/') {
                $dirItem = $dirItem->fromArray(['dir' => $dir]);
            }

            $dirItemCollection[] = $dirItem;
        }

        return $dirItemCollection;
    }
public function getAll(LibraryType $library, string $dir = '/')
    {
        $clippedBaseUri = $this->clipUri($this->client->getConfig('base_uri'));

        $response = $this->client->request(
            'GET',
            $clippedBaseUri . '/repos/' . $library->id . '/dir/',
            [
                'query' => ['p' => $dir],
            ]
        );

        $json = json_decode((string)$response->getBody());

        $dirItemCollection = [];

        foreach ($json as $dirItemJson) {
            $dirItem = (new DirectoryItem)->fromJson($dirItemJson);

            // if dirItem has no value for "dir", set it here
            if ($dirItem->dir === '/') {
                $dirItem = $dirItem->fromArray(['dir' => $dir]);
            }

            $dirItemCollection[] = $dirItem;
        }

        return $dirItemCollection;
    }
public function getAll ( LibraryType $ library , string $ dir = '/' ) { $ clippedBaseUri = $ this -> clipUri ( $ this -> client -> getConfig ( 'base_uri' ) ) ; $ response = $ this -> client -> request ( 'GET' , $ clippedBaseUri . '/repos/' . $ library -> id . '/dir/' , [ 'query' => [ 'p' => $ dir ] , ] ) ; $ json = json_decode ( ( string ) $ response -> getBody ( ) ) ; $ dirItemCollection = [ ] ; foreach ( $ json as $ dirItemJson ) { $ dirItem = ( new DirectoryItem ) -> fromJson ( $ dirItemJson ) ; // if dirItem has no value for "dir", set it here if ( $ dirItem -> dir === '/' ) { $ dirItem = $ dirItem -> fromArray ( [ 'dir' => $ dir ] ) ; } $ dirItemCollection [ ] = $ dirItem ; } return $ dirItemCollection ; }
Get all items of a directory in a library

@param LibraryType $library Library type
@param string      $dir     Directory path

@return DirectoryItem[]
@throws \Exception
@throws \GuzzleHttp\Exception\GuzzleException
Get all items of a directory in a library