stage2: add piefed client

This commit is contained in:
James Xylight committed 2025-09-03 20:30:16 -07:00
1 parent 64026143ff
commit f03bcca1df
137 files changed
+6698 -530

No files matched your search

+19 -9
View File
@@ -1,8 +1,9 @@
import { LemmyHttp } from 'lemmy-js-client'
import type { BaseClient } from '../base'
import { fromGetPosts, toListingType } from './rewrite'
export class LemmyClient implements BaseClient {
static type = 'lemmy'
static type = { name: 'lemmy', baseUrl: '/api/v3' }
#client: LemmyHttp
@@ -47,9 +48,12 @@ export class LemmyClient implements BaseClient {
return await this.#client.getModlog(...params)
}
async search(
...params: Parameters<BaseClient['search']>
params: Parameters<BaseClient['search']>[0],
): ReturnType<BaseClient['search']> {
return await this.#client.search(...params)
return await this.#client.search({
...params,
listing_type: toListingType(params.listing_type),
})
}
async resolveObject(
...params: Parameters<BaseClient['resolveObject']>
@@ -72,9 +76,12 @@ export class LemmyClient implements BaseClient {
return await this.#client.editCommunity(...params)
}
async listCommunities(
...params: Parameters<BaseClient['listCommunities']>
params: Parameters<BaseClient['listCommunities']>[0],
): ReturnType<BaseClient['listCommunities']> {
return await this.#client.listCommunities(...params)
return await this.#client.listCommunities({
...params,
type_: toListingType(params.type_),
})
}
async followCommunity(
...params: Parameters<BaseClient['followCommunity']>
@@ -157,9 +164,9 @@ export class LemmyClient implements BaseClient {
return await this.#client.featurePost(...params)
}
async getPosts(
...params: Parameters<BaseClient['getPosts']>
params: Parameters<BaseClient['getPosts']>[0],
): ReturnType<BaseClient['getPosts']> {
return await this.#client.getPosts(...params)
return await this.#client.getPosts(fromGetPosts(params))
}
async likePost(
...params: Parameters<BaseClient['likePost']>
@@ -242,9 +249,12 @@ export class LemmyClient implements BaseClient {
return await this.#client.distinguishComment(...params)
}
async getComments(
...params: Parameters<BaseClient['getComments']>
params: Parameters<BaseClient['getComments']>[0],
): ReturnType<BaseClient['getComments']> {
return await this.#client.getComments(...params)
return await this.#client.getComments({
...params,
type_: toListingType(params.type_),
})
}
async getComment(
...params: Parameters<BaseClient['getComment']>