1 | <?php |
||
8 | class Usage extends Resource |
||
9 | { |
||
10 | /** |
||
11 | * The end date in Y-m-d format |
||
12 | * |
||
13 | * @param string |
||
14 | */ |
||
15 | private $endDate; |
||
16 | |||
17 | /** |
||
18 | * Whether sub accounts should be included in the request or not |
||
19 | * |
||
20 | * @param boolean |
||
21 | */ |
||
22 | private $includeSubAccounts; |
||
23 | |||
24 | /** |
||
25 | * The product type which will be called by this resource |
||
26 | * |
||
27 | * @param string |
||
28 | */ |
||
29 | private $productType; |
||
30 | |||
31 | /** |
||
32 | * The product types that can be used with this resource |
||
33 | * |
||
34 | * @param array |
||
35 | */ |
||
36 | private $productTypes = ['apm', 'browser', 'mobile']; |
||
37 | |||
38 | /** |
||
39 | * The start date in Y-m-d format |
||
40 | * |
||
41 | * @param string |
||
42 | */ |
||
43 | private $startDate; |
||
44 | |||
45 | /** |
||
46 | * Create a new usage resource and set the start and end to today |
||
47 | * |
||
48 | * @param string $apiKey |
||
49 | * @param Logger $logger |
||
50 | */ |
||
51 | public function __construct($apiKey, Logger $logger = null) |
||
59 | |||
60 | /** |
||
61 | * Set the date to get data to |
||
62 | * |
||
63 | * @param mixed $date |
||
64 | * @return Usage |
||
65 | */ |
||
66 | public function endDate($date) |
||
70 | |||
71 | /** |
||
72 | * Perform API request |
||
73 | * |
||
74 | * @param string $type |
||
75 | * @return GuzzleHttp\Psr7\Stream The guzzle response body |
||
76 | */ |
||
77 | public function get($type = null) |
||
99 | |||
100 | /** |
||
101 | * Toggle include sub accounts |
||
102 | * |
||
103 | * @param boolean $include |
||
104 | * @return Usage |
||
105 | */ |
||
106 | public function includeSubAccounts($include) |
||
113 | |||
114 | /** |
||
115 | * Set the product type |
||
116 | * |
||
117 | * @param string $type |
||
118 | * @return Usage |
||
119 | */ |
||
120 | public function productType($type) |
||
137 | |||
138 | /** |
||
139 | * Set a date to something |
||
140 | * |
||
141 | * @param string $type |
||
142 | * @param mixed $date |
||
143 | * @return Usage |
||
144 | */ |
||
145 | private function setDate($type, $date) |
||
154 | |||
155 | /** |
||
156 | * Set the date to get data from |
||
157 | * |
||
158 | * @param mixed $date |
||
159 | * @return Usage |
||
160 | */ |
||
161 | public function startDate($date) |
||
165 | } |
||
166 |