1 | <?php |
||
6 | class Content extends Base |
||
7 | { |
||
8 | /** |
||
9 | * Private constructor so only the client can create this |
||
10 | * @param Client $client |
||
11 | */ |
||
12 | 11 | public function __construct(Client $client) |
|
13 | { |
||
14 | 11 | parent::__construct($client); |
|
15 | 11 | $this->SetUrl("/project/" . $this->GetClient()->GetProjectId() . "/content"); |
|
16 | 11 | } |
|
17 | |||
18 | /** |
||
19 | * Get one or multiple contents |
||
20 | * @param string content id, leave null for list of boxes |
||
21 | * @param object Containing query arguments |
||
22 | * @return object Result of the request |
||
23 | */ |
||
24 | public function Get($contentId = null, $args = array("limit" => 50, 'type' => 'item')) |
||
25 | { |
||
26 | if (is_null($contentId)) { |
||
27 | return $this->GetClient()->Get($this->GetUrl(), $args); |
||
28 | } |
||
29 | return $this->GetClient()->Get($this->GetUrl()."/".$contentId, $args); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Create new content |
||
34 | * @param object Containing all the information of a content |
||
35 | * @return object Result of the request |
||
36 | */ |
||
37 | public function Create($content) |
||
41 | |||
42 | /** |
||
43 | * Create new content |
||
44 | * @param object Containing all the information of a content |
||
45 | * @throws \Exception When contentid, source, type or itemtype is not present |
||
46 | * @return object Result of the request |
||
47 | */ |
||
48 | public function Update($content) |
||
66 | |||
67 | /** |
||
68 | * Delete a content object by content id |
||
69 | * @param string Id of the content |
||
70 | * @return object Result of the request |
||
71 | */ |
||
72 | public function Delete($contentId, $args = array('type' => 'item', 'itemtype' => 'product')) |
||
89 | |||
90 | /** |
||
91 | * Updates a maximum of 50 content items at a time. |
||
92 | * @param array Containing content items with a maximum of 50 |
||
93 | * @throws \Exception When more that 50 content items are provided |
||
94 | * @return object Result of the request |
||
95 | */ |
||
96 | public function Bulk($items) |
||
104 | } |
||
105 |