Skip to content

Commit 3c729b6

Browse files
committed
refactor: get accountName from .env
1 parent 4b85c1f commit 3c729b6

7 files changed

Lines changed: 7 additions & 20 deletions

examples/account_addevent.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
require_once('common.php');
33

44
try {
5-
$accountName = ''; //account name
65
$eventName = ''; // eventname
76
$data = ''; // pass as query string x=y&hello=world
87

examples/account_notification.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
require_once('common.php');
33

44
try {
5-
$accountName = ''; //account name
6-
75
// all data are required //
86
$jsonData = json_encode([
97
"notificationType" => "",

examples/account_notification_get.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
require_once('common.php');
33

44
try {
5-
$accountName = ''; //account name
6-
75
$jsonData = json_encode([
86
"notificationType" => "",
97
"status" => "",

examples/account_picture.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
require_once 'common.php';
44

55
try {
6-
$accountName = 'xxx';
7-
$filename = base64_encode(file_get_contents('/image/path'));
6+
$data = base64_encode(file_get_contents(__DIR__ . '/picture.png'));
87

9-
$res = $client->setAccountPicture($accountName, $filename);
8+
$res = $client->setAccountPicture($accountName, $data);
109
print_r($res);
1110
} catch (Exception $e) {
1211
echo 'Exception '.$e->getMessage()."\n";

examples/account_property.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
require_once('common.php');
44

55
try {
6-
$accountName = 'Maruti';
7-
$propertyName = 'suv';
8-
$propertyValue = 'x cross';
6+
$propertyName = 'test';
7+
$propertyValue = 'example';
98

109
$users = $client->setAccountProperty($accountName, $propertyName, $propertyValue);
1110
print_r($users);

examples/common.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
Envoi::init($envFilename, $envMetaFile);
1414

1515
$url = getenv('USERBASE_CLIENT_URL');
16-
//$username = getenv('USERBASE_CLIENT_USERNAME');
17-
//$password = getenv('USERBASE_CLIENT_PASSWORD');
16+
$accountName = getenv('USERBASE_ACCOUNT');
1817

19-
if (!$url) {
18+
if ((!$url) || (!$accountName)) {
2019
echo "Environment variables not yet properly configured\n";
2120
exit();
2221
}

examples/user_get.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22

33
require_once ('common.php');
44

5-
if (count($argv)!=2) {
6-
echo "Please pass 1 parameter: username\n";
7-
exit();
8-
}
95
try {
10-
$username = $argv[1];
11-
$user = $client->getUserByUsername($username);
6+
$user = $client->getUserByUsername($accountName);
127
echo "Username: " . $user->getName() . "\n";
138
echo "DisplayName: " . $user->getDisplayName() . "\n";
149
echo "Email: " . $user->getEmail() . "\n";

0 commit comments

Comments
 (0)