public function request($method, $uri, array $headers = [], $body = null)
{
try {
$response = $this->client->send($method, self::API_URL . $uri, array_merge(['Content-Type' => 'application/json'], $headers), $body);
return json_decode($response->getBody(), true);
} catch (\Throwable $t) {
throw new OneSignalException($t->getMessage());
} catch (\Exception $e) {
throw new OneSignalException($e->getMessage());
}
}
/** * Export all information about devices in a CSV format for your application. * * Application auth key must be set. * * @return array */ public function csvExport() { return $this->api->request('POST', '/players/csv_export', ['headers' => ['Authorization' => 'Basic ' . $this->api->getConfig()->getApplicationAuthKey()], 'json' => ['app_id' => $this->api->getConfig()->getApplicationId()]]); }