MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / FetchPreferencesAdapter

Class FetchPreferencesAdapter

src/services/preferences/fetch.ts:4–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import type { PreferencesAdapter, Preferences, UiConfig } from './types'
3
4export class FetchPreferencesAdapter implements PreferencesAdapter {
5 getPreferences(): Promise<Preferences> {
6 return get<Preferences>('/preferences')
7 }
8
9 savePreferences(partial: Partial<Preferences>): Promise<{ success: boolean; error?: string }> {
10 return patch<{ success: boolean; error?: string }>('/preferences', partial)
11 }
12
13 getUiConfig(): Promise<UiConfig> {
14 return get<UiConfig>('/preferences/ui-config')
15 }
16
17 saveUiConfig(partial: Partial<UiConfig>): Promise<{ success: boolean; error?: string }> {
18 return patch<{ success: boolean; error?: string }>('/preferences/ui-config', partial)
19 }
20
21 async getLocale(): Promise<string> {
22 const result = await get<{ lang: string }>('/preferences/locale')
23 return result.lang
24 }
25
26 saveLocale(lang: string): Promise<{ success: boolean; error?: string }> {
27 return patch<{ success: boolean; error?: string }>('/preferences/locale', { lang })
28 }
29}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected