feat: Add method to AnkiService to get arbitrary notes from NIDs
This commit is contained in:
parent
e5f893a43d
commit
2353c1fd1a
|
@ -58,14 +58,17 @@ class AnkiService
|
||||||
return $this->getNotesInfo([$noteId])[0];
|
return $this->getNotesInfo([$noteId])[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNote(int $nid): ?Note
|
||||||
|
{
|
||||||
|
return Note::fromAnki($this->getNoteInfo($nid));
|
||||||
|
}
|
||||||
|
|
||||||
public function getLatestNote(): ?Note
|
public function getLatestNote(): ?Note
|
||||||
{
|
{
|
||||||
// NoteIDs are just timestamps in milliseconds, so the latest is just
|
// NoteIDs are just timestamps in milliseconds, so the latest is just
|
||||||
// the biggest numerically
|
// the biggest numerically
|
||||||
$latestId = max($this->getAllNoteIds());
|
$latestId = max($this->getAllNoteIds());
|
||||||
$noteInfo = $this->getNoteInfo($latestId);
|
return $this->getNote($latestId);
|
||||||
|
|
||||||
return Note::fromAnki($noteInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateNote(Note $note)
|
public function updateNote(Note $note)
|
||||||
|
|
Loading…
Reference in New Issue