import { UserPreferencesDTO } from 'app/types'; import { backendSrv } from './backend_srv'; export class PreferencesService { constructor(private resourceUri: string) {} /** * Overrides all preferences */ update(preferences: UserPreferencesDTO): Promise { return backendSrv.put(`/api/${this.resourceUri}/preferences`, preferences); } /** * Updates only provided preferences */ patch(preferences: Partial): Promise { return backendSrv.patch(`/api/${this.resourceUri}/preferences`, preferences); } load(): Promise { return backendSrv.get(`/api/${this.resourceUri}/preferences`); } }