1 | <?php |
||
22 | class ExternalEvents extends AbstractApi |
||
23 | { |
||
24 | /** |
||
25 | * @param $eventId |
||
26 | * |
||
27 | * @return ResponseInterface |
||
28 | */ |
||
29 | public function create($eventId) |
||
33 | |||
34 | /** |
||
35 | * @param $eventId |
||
36 | * |
||
37 | * @return Promise |
||
38 | */ |
||
39 | public function asyncCreate($eventId) |
||
43 | |||
44 | /** |
||
45 | * @param int $eventId |
||
46 | * @param array $data |
||
47 | * |
||
48 | * @return ResponseInterface |
||
49 | */ |
||
50 | public function trigger($eventId, $data = array()) |
||
51 | { |
||
52 | return $this->sendRequest($this->createTriggerRequest($eventId, $data)); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @param int $eventId |
||
57 | * @param array $data |
||
58 | * |
||
59 | * @return Promise |
||
60 | */ |
||
61 | public function asyncTrigger($eventId, $data = array()) |
||
62 | { |
||
63 | return $this->sendAsyncRequest($this->createTriggerRequest($eventId, $data)); |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @param int $eventId |
||
68 | * @param array $data |
||
69 | * |
||
70 | * @return \Psr\Http\Message\RequestInterface |
||
71 | */ |
||
72 | private function createCreateRequest($eventId, $data = array()) |
||
73 | { |
||
74 | return $this->createRequest('POST', "/event/$eventId/trigger", $data); |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @param int $eventId |
||
79 | * @param array $data |
||
80 | * |
||
81 | * @return \Psr\Http\Message\RequestInterface |
||
82 | */ |
||
83 | private function createTriggerRequest($eventId, $data = array()) |
||
87 | } |
||
88 |