add blue sky fetcher

This commit is contained in:
Travis Shears 2024-06-24 18:53:06 +02:00
parent e8234e41e8
commit ef8144ba26
5 changed files with 178 additions and 7 deletions

View file

@ -64,15 +64,15 @@ export class MicroBlogBackend {
}
}
public async getLatestPostId(
public async getLatestPostBySource(
postSource: MicroBlogPostSource
): Promise<string | undefined> {
): Promise<MicroBlogPost | undefined> {
await this.checkLogin();
try {
const post = await this.pb
.collection<MicroBlogPost>("micro_blog_posts")
.getFirstListItem(`source = '${postSource}'`, { sort: "-posted" });
return post.id;
return post;
} catch (error: any) {
if (error.status === 404) {
return undefined;
@ -81,6 +81,11 @@ export class MicroBlogBackend {
}
}
public async getLatestPostRemoteIDBySource(postSource: MicroBlogPostSource) {
const post = await this.getLatestPostBySource(postSource);
return post?.remoteId;
}
async getTag(tag: string): Promise<MicroBlogPostTag | undefined> {
await this.checkLogin();
try {