fix(guild): import all template channel types, fetch on desktop (#3473)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-14 18:39:09 +02:00
1 parent 00249f9b4d
commit 99be186fa1
50 files changed
+2008 -111

No files matched your search

@@ -0,0 +1,38 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
export const DESKTOP_OTHER_PLATFORM_TEMPLATE_CHANNELS = Object.freeze({
fetch: 'desktop-other-platform-template:fetch',
} as const);
const OTHER_PLATFORM_TEMPLATE_CODE_PATTERN = /^[A-Za-z0-9]{1,64}$/;
export function isOtherPlatformTemplateCode(value: unknown): value is string {
return typeof value === 'string' && OTHER_PLATFORM_TEMPLATE_CODE_PATTERN.test(value);
}
export const OtherPlatformTemplateFetchFailure = Object.freeze({
INVALID_CODE: 'invalid_code',
NOT_FOUND: 'not_found',
RATE_LIMITED: 'rate_limited',
NETWORK: 'network',
INVALID_RESPONSE: 'invalid_response',
} as const);
export type OtherPlatformTemplateFetchFailure =
(typeof OtherPlatformTemplateFetchFailure)[keyof typeof OtherPlatformTemplateFetchFailure];
export interface OtherPlatformTemplateFetchSuccess {
readonly ok: true;
readonly template: Readonly<Record<string, unknown>>;
}
export interface OtherPlatformTemplateFetchError {
readonly ok: false;
readonly failure: OtherPlatformTemplateFetchFailure;
}
export type OtherPlatformTemplateFetchResult = OtherPlatformTemplateFetchSuccess | OtherPlatformTemplateFetchError;
export interface OtherPlatformTemplateAPI {
fetch: (code: string) => Promise<OtherPlatformTemplateFetchResult>;
}