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];
|
||||
}
|
||||
|
||||
public function getNote(int $nid): ?Note
|
||||
{
|
||||
return Note::fromAnki($this->getNoteInfo($nid));
|
||||
}
|
||||
|
||||
public function getLatestNote(): ?Note
|
||||
{
|
||||
// NoteIDs are just timestamps in milliseconds, so the latest is just
|
||||
// the biggest numerically
|
||||
$latestId = max($this->getAllNoteIds());
|
||||
$noteInfo = $this->getNoteInfo($latestId);
|
||||
|
||||
return Note::fromAnki($noteInfo);
|
||||
return $this->getNote($latestId);
|
||||
}
|
||||
|
||||
public function updateNote(Note $note)
|
||||
|
|
Loading…
Reference in New Issue