//
$auth_method = '';
// Override above parameters into you own file:
include __DIR__ . '/../../secrets.php';
//
// ===================================================
$osmApi = new OSM_Api(array('url' => OSM_Api::URL_DEV_UK, 'url4Write' => OSM_Api::URL_DEV_UK));
if ($auth_method == 'Basic') {
    _wl(' using Basic auth with user="******"');
    $osmApi->setCredentials(new OSM_Auth_Basic($auth_basic_user, $auth_basic_password));
} else {
    if ($auth_method == 'OAuth') {
        _wl(' using OAuth auth with consumerKey="' . $auth_oauth_consumer_key . '"');
        $oauth = new OSM_Auth_OAuth($auth_oauth_consumer_key, $auth_oauth_consumer_secret);
        $oauth->setToken($auth_oauth_token, $auth_oauth_secret);
        $osmApi->setCredentials($oauth);
    }
}
// http://api06.dev.openstreetmap.org/api/0.6/relation/500
// http://api06.dev.openstreetmap.org/api/0.6/way/8184
// http://api06.dev.openstreetmap.org/api/0.6/node/611571
// get a node
$userPreferences = $osmApi->getUserPreferences();
//echo print_r($userPreferences,true)."\n";
$expectedValue = time();
$osmApi->setUserPreference('test', $expectedValue);
$userPreferences = $osmApi->getUserPreferences();
_assert(isset($userPreferences['test']));
_assert($userPreferences['test'] == $expectedValue);
$time_end = microtime(true);
_wl('Test well done in ' . number_format($time_end - $time_start, 3) . ' second(s).');