Skip to content

Commit 36859ff

Browse files
committed
Move app_id to request query string from request body
Don't allow to set limit for devices and notifications below 1
1 parent e37ecbc commit 36859ff

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

src/Devices.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ public function getOne($id)
5252
* Application auth key must be set.
5353
*
5454
* @param int $limit Results offset (results are sorted by ID)
55-
* @param int $offset How many devices to return (max 50)
55+
* @param int $offset How many devices to return (max 300)
5656
*
5757
* @return array
5858
*/
5959
public function getAll($limit = self::DEVICES_LIMIT, $offset = 0)
6060
{
61-
return $this->api->request('GET', '/players?' . http_build_query([
62-
'limit' => max(0, min(self::DEVICES_LIMIT, filter_var($limit, FILTER_VALIDATE_INT))),
61+
$query = [
62+
'limit' => max(1, min(self::DEVICES_LIMIT, filter_var($limit, FILTER_VALIDATE_INT))),
6363
'offset' => max(0, min(self::DEVICES_LIMIT, filter_var($offset, FILTER_VALIDATE_INT))),
64-
]), [
64+
'app_id' => $this->api->getConfig()->getApplicationId(),
65+
];
66+
67+
return $this->api->request('GET', '/players?' . http_build_query($query), [
6568
'headers' => [
6669
'Authorization' => 'Basic ' . $this->api->getConfig()->getApplicationAuthKey(),
6770
],
68-
'json' => [
69-
'app_id' => $this->api->getConfig()->getApplicationId(),
70-
],
7171
]);
7272
}
7373

@@ -224,13 +224,12 @@ public function onFocus($id, array $data)
224224
*/
225225
public function csvExport()
226226
{
227-
return $this->api->request('POST', '/players/csv_export', [
227+
$url = '/players/csv-export?app_id=' . $this->api->getConfig()->getApplicationId();
228+
229+
return $this->api->request('POST', $url, [
228230
'headers' => [
229231
'Authorization' => 'Basic ' . $this->api->getConfig()->getApplicationAuthKey(),
230232
],
231-
'json' => [
232-
'app_id' => $this->api->getConfig()->getApplicationId(),
233-
],
234233
]);
235234
}
236235

src/Notifications.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ public function getOne($id)
5656
*/
5757
public function getAll($limit = self::NOTIFICATIONS_LIMIT, $offset = 0)
5858
{
59-
return $this->api->request('GET', '/notifications?' . http_build_query([
60-
'limit' => max(0, min(self::NOTIFICATIONS_LIMIT, filter_var($limit, FILTER_VALIDATE_INT))),
61-
'offset' => max(0, min(self::NOTIFICATIONS_LIMIT, filter_var($offset, FILTER_VALIDATE_INT))),
62-
]), [
59+
$query = [
60+
'limit' => max(1, min(self::NOTIFICATIONS_LIMIT, filter_var($limit, FILTER_VALIDATE_INT))),
61+
'offset' => max(0, min(self::NOTIFICATIONS_LIMIT, filter_var($offset, FILTER_VALIDATE_INT))),
62+
'app_id' => $this->api->getConfig()->getApplicationId(),
63+
];
64+
65+
return $this->api->request('GET', '/notifications?' . http_build_query($query), [
6366
'headers' => [
6467
'Authorization' => 'Basic ' . $this->api->getConfig()->getApplicationAuthKey(),
6568
],
66-
'json' => [
67-
'app_id' => $this->api->getConfig()->getApplicationId(),
68-
],
6969
]);
7070
}
7171

0 commit comments

Comments
 (0)