You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.0 KiB
53 lines
1.0 KiB
3 years ago
|
<?php
|
||
|
|
||
|
namespace Pirectus;
|
||
|
|
||
|
use Pirectus\QueryBuilder\ItemsQueryBuilder;
|
||
|
|
||
|
/**
|
||
|
* Client for Directus Api 9
|
||
|
*
|
||
|
* @author Björn Hase, Tentakelfabrik
|
||
|
* @license http://opensource.org/licenses/MIT The MIT License
|
||
|
* @link https://gitea.tentakelfabrik.de/tentakelfabrik/pirectus
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
class Pirectus
|
||
|
{
|
||
|
/** url of api */
|
||
|
private $url;
|
||
|
|
||
|
/** options for client */
|
||
|
private $options;
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*
|
||
|
* @param string $url
|
||
|
* @param Array $options
|
||
|
*
|
||
|
*/
|
||
|
public function __construct(string $url, array $options = [])
|
||
|
{
|
||
|
$this->url = $url;
|
||
|
$this->options = $options;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* set name for items-collection and create ItemsQueryBuilder
|
||
|
*
|
||
|
* @param string $name
|
||
|
* @return \Pirectus\ItemsQueryBuilder
|
||
|
*
|
||
|
*/
|
||
|
public function items(string $name)
|
||
|
{
|
||
|
$query = [
|
||
|
'endpoint' => '/items/'.$name,
|
||
|
'parameters' => []
|
||
|
];
|
||
|
|
||
|
return new ItemsQueryBuilder($query, $this->url, $this->options);
|
||
|
}
|
||
|
}
|