public function deleteNote(Note $note)
{
if (null === $note->guid) {
return false;
}
// we have the credentials
if (null !== $note->noteStore && null !== $note->authToken) {
$note->noteStore->deleteNote($note->authToken, $note->guid);
return true;
}
try {
// We try to delete it with the personal credentials
$this->getUserNotestore()->deleteNote($this->token, $note->guid);
return true;
} catch (EDAMNotFoundException $e) {
// The note's not in a personal notebook. We'll need to find it
$note = $this->getNote($note->guid, self::LINKED_SCOPE);
if (null !== $note) {
return $this->deleteNote($note);
}
return false;
} catch (EDAMUserException $e) {
// You don't have permission to delete this note.
return false;
}
}