import { raindropBookmarks } from "https://esm.town/v/ramkarthik/raindropBookmarks";
export const raindropBookmarksSinceLastRun = async (
lastRunAt: String,
raindropToken: String,
) => {
let bookmarks = [], reachedLastItem = false, page = 0;
while (!reachedLastItem) {
let data = await raindropBookmarks(
page,
raindropToken,
);
if (data.result && data.items.length > 0) {
data.items.every((item, index) => {
if (item.created >= lastRunAt) {
bookmarks.push(item);
return true;
}
else {
reachedLastItem = true;
return false;
}
});
}
else {
reachedLastItem = true;
}
page += 1;
}
return bookmarks;
};