forked from mataluis2k/shipwire-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebhook.php
More file actions
79 lines (71 loc) · 1.85 KB
/
Copy pathWebhook.php
File metadata and controls
79 lines (71 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace mataluis2k\shipwire;
use mataluis2k\shipwire\base\ShipwireComponent;
/**
* Class Order
* @package mataluis2k\shipwire
* @author Sebastian Thierer <sebas@mataluis2k.com>
*/
class Webhook extends ShipwireComponent
{
/**
* Lists all webhooks depending on your parameters.
* @param array $params
* @param int $page
* @param int $limit
* @return array
*/
public function listing($params = [], $page = 0, $limit = 50)
{
return $this->get('webhooks', $params, $page, $limit);
}
/**
* Gets order details
* @param $orderId
* @param bool $expand
* @return array
*/
public function details($webhookId, $expand = false)
{
$params = [];
if ($expand) {
$params['expand'] = 'all';
}
return $this->get($this->getRoute('webhooks/{id}', $webhookId), $params);
}
/**
* Creates an order.
* @param $orderData
* @param array $params
* @return array|bool
*/
public function create($data, $params = [])
{
return $this->post('webhooks', $params, json_encode($data));
}
/**
* Modify order details.
* @param $orderData
* @param array $params
* @return array|bool
*/
public function update($webhookId, $data, $params = [])
{
return $this->put($this->getRoute('webhooks/{id}', $webhookId), $params, json_encode($data));
}
/**
* Modify order details.
* @param $orderData
* @param array $params
* @return array|bool
*/
public function unsubscribe($webhookId, $params = [])
{
return $this->delete('webhooks/'.$webhookId, $params);
}
/**
* Errors related to validation errors
* @var array
*/
public $errors=[];
}