homebox/frontend/lib/api/classes/locations.ts
Hayden 30014a77ca
feat: expanded search for items (#46)
* expanded search for items

* range domain from email to example

* implement pagination for items
2022-10-12 21:13:07 -08:00

27 lines
850 B
TypeScript

import { BaseAPI, route } from "../base";
import { LocationOutCount, LocationCreate, LocationOut } from "../types/data-contracts";
import { Results } from "../types/non-generated";
export type LocationUpdate = LocationCreate;
export class LocationsApi extends BaseAPI {
getAll() {
return this.http.get<Results<LocationOutCount>>({ url: route("/locations") });
}
create(body: LocationCreate) {
return this.http.post<LocationCreate, LocationOut>({ url: route("/locations"), body });
}
get(id: string) {
return this.http.get<LocationOut>({ url: route(`/locations/${id}`) });
}
delete(id: string) {
return this.http.delete<void>({ url: route(`/locations/${id}`) });
}
update(id: string, body: LocationUpdate) {
return this.http.put<LocationUpdate, LocationOut>({ url: route(`/locations/${id}`), body });
}
}