add blue sky fetcher
This commit is contained in:
parent
e8234e41e8
commit
ef8144ba26
5 changed files with 178 additions and 7 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue