import { BaseAPI, route } from '../base'; import { Item } from './items'; import { Details, OutType, Results } from './types'; export type LocationCreate = Details; export type Location = LocationCreate & OutType & { groupId: string; items: Item[]; itemCount: number; }; export type LocationUpdate = LocationCreate; export class LocationsApi extends BaseAPI { async getAll() { return this.http.get>({ url: route('/locations') }); } async create(body: LocationCreate) { return this.http.post({ url: route('/locations'), body }); } async get(id: string) { return this.http.get({ url: route(`/locations/${id}`) }); } async delete(id: string) { return this.http.delete({ url: route(`/locations/${id}`) }); } async update(id: string, body: LocationUpdate) { return this.http.put({ url: route(`/locations/${id}`), body }); } }