mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
add: getArchivedThreads
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
import { rest } from "../../../rest/rest.ts";
|
||||||
|
import { ListPublicArchivedThreads } from "../../../types/channels/threads/list_public_archived_threads.ts";
|
||||||
|
import { endpoints } from "../../../util/constants.ts";
|
||||||
|
import { camelKeysToSnakeCase } from "../../../util/utils.ts";
|
||||||
|
|
||||||
|
export async function getArchivedThreads(
|
||||||
|
channelId: string,
|
||||||
|
options?: ListPublicArchivedThreads & {
|
||||||
|
type?: "public" | "private" | "privateJoinedThreads";
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
// TODO(threads): perm check
|
||||||
|
// TODO(threads): check if this works
|
||||||
|
|
||||||
|
return await rest.runMethod(
|
||||||
|
"get",
|
||||||
|
options?.type === "privateJoinedThreads"
|
||||||
|
? endpoints.THREAD_ARCHIVED_PRIVATE_JOINED(channelId)
|
||||||
|
: options?.type === "private"
|
||||||
|
? endpoints.THREAD_ARCHIVED_PRIVATE(channelId)
|
||||||
|
: endpoints.THREAD_ARCHIVED_PUBLIC(channelId),
|
||||||
|
camelKeysToSnakeCase(options ?? {}),
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user