Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions examples/Application/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@
);

// Create an application and get its details
$createdApp = $application->create(
'Application name',
'Application description'
$details = $application->create(
name: 'Test app',
description: 'A test app'
);

// Dump application details
var_dump($createdApp);
// Display application details
echo 'Id: ' . $details->id . PHP_EOL;
echo 'Name: ' . $details->name . PHP_EOL;
echo 'Description: ' . $details->description . PHP_EOL;
echo 'Token: ' . $details->token . PHP_EOL;

} catch (EndpointException | GotifyException $err) {
echo $err->getMessage();
Expand Down
8 changes: 6 additions & 2 deletions examples/Application/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@

$apps = $application->getAll();

foreach ($apps->apps as $app) {
var_dump($app);
foreach ($apps->apps as $details) {
echo 'Id: ' . $details->id . PHP_EOL;
echo 'Name: ' . $details->name . PHP_EOL;
echo 'Description: ' . $details->description . PHP_EOL;
echo 'Token: ' . $details->token . PHP_EOL;
echo PHP_EOL;
}

} catch (EndpointException | GotifyException $err) {
Expand Down
8 changes: 5 additions & 3 deletions examples/Client/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
);

// Create a client and get its details
$createdClient = $client->create('Example client name');
$details = $client->create('Example client name');

// Dump client details
var_dump($createdClient);
// Display client details
echo 'Id: ' . $details->id . PHP_EOL;
echo 'Name: ' . $details->name . PHP_EOL;
echo 'Token: ' . $details->token . PHP_EOL;

} catch (EndpointException | GotifyException $err) {
echo $err->getMessage();
Expand Down
7 changes: 5 additions & 2 deletions examples/Client/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@

$clients = $client->getAll();

foreach ($clients->clients as $c) {
var_dump($c);
foreach ($clients->clients as $details) {
echo 'Id: ' . $details->id . PHP_EOL;
echo 'Name: ' . $details->name . PHP_EOL;
echo 'Token: ' . $details->token . PHP_EOL;
echo PHP_EOL;
}

} catch (EndpointException | GotifyException $err) {
Expand Down
14 changes: 11 additions & 3 deletions examples/Message/create-with-extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,24 @@
)
);

// Send a message
// Send message and get details
$sentMessage = $message->create(
title: 'hello?',
message: 'Hello World',
priority: 8,
extras: $extras
);

// Dump sent message details
var_dump($sentMessage);
// Display sent message details
echo 'Id: ' . $details->id . PHP_EOL;
echo 'Date: ' . $details->date . PHP_EOL;
echo 'Title: ' . $details->title . PHP_EOL;
echo 'Message: ' . $details->message . PHP_EOL;
echo 'Priority: ' . $details->priority . PHP_EOL;
echo 'App Id: ' . $details->appid . PHP_EOL;

echo 'Extras: ' . PHP_EOL;
var_dump($details->extras);

} catch (EndpointException | GotifyException $err) {
echo $err->getMessage();
Expand Down
13 changes: 9 additions & 4 deletions examples/Message/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@
$auth->get()
);

// Send a message
$sentMessage = $message->create(
// Send message and get details
$details = $message->create(
title: 'hello?',
message: 'Hello World',
priority: 8,
);

// Dump sent message details
var_dump($sentMessage);
// Dsiplay sent message details
echo 'Id: ' . $details->id . PHP_EOL;
echo 'Date: ' . $details->date . PHP_EOL;
echo 'Title: ' . $details->title . PHP_EOL;
echo 'Message: ' . $details->message . PHP_EOL;
echo 'Priority: ' . $details->priority . PHP_EOL;
echo 'App Id: ' . $details->appid . PHP_EOL;

} catch (EndpointException | GotifyException $err) {
echo $err->getMessage();
Expand Down
10 changes: 8 additions & 2 deletions examples/Message/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@

$messages = $message->getAll();

foreach ($messages->messages as $m) {
var_dump($m);
foreach ($messages->messages as $details) {
echo 'Id: ' . $details->id . PHP_EOL;
echo 'Date: ' . $details->date . PHP_EOL;
echo 'Title: ' . $details->title . PHP_EOL;
echo 'Message: ' . $details->message . PHP_EOL;
echo 'Priority: ' . $details->priority . PHP_EOL;
echo 'App Id: ' . $details->appid . PHP_EOL;
echo PHP_EOL;
}

} catch (EndpointException | GotifyException $err) {
Expand Down
8 changes: 5 additions & 3 deletions examples/User/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
);

// Create a user and get its details
$createduser = $user->create(
$details = $user->create(
name: 'Bob',
password: 'BobPassword1',
admin: false,
);

// Dump user details
var_dump($createduser);
// Dsiplay user details
echo 'Id: ' . $details->name . PHP_EOL;
echo 'Username: ' . $details->name . PHP_EOL;
echo 'Is admin: ' . $details->admin . PHP_EOL;

} catch (EndpointException | GotifyException $err) {
echo $err->getMessage();
Expand Down
6 changes: 5 additions & 1 deletion examples/Version/get.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
);

// Get version details
var_dump($version->get());
$details = $version->get();

echo 'Version: ' . $details->version . PHP_EOL;
echo 'Commit: ' . $details->commit . PHP_EOL;
echo 'Build date: ' . $details->buildDate . PHP_EOL;

} catch (EndpointException | GotifyException $err) {
echo $err->getMessage();
Expand Down