mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-17 14:18:43 +00:00
75c633dcb5
* dummy commit * cleanup workflows * setup and run eslint * add linter to CI * use eslint for formatting * reorder rules * drop editor config
37 lines
884 B
TypeScript
37 lines
884 B
TypeScript
import { BaseAPI, route } from "../base";
|
|
import { Item } from "./items";
|
|
import { Details, OutType, Results } from "./types";
|
|
|
|
export type LabelCreate = Details & {
|
|
color: string;
|
|
};
|
|
|
|
export type LabelUpdate = LabelCreate;
|
|
|
|
export type Label = LabelCreate &
|
|
OutType & {
|
|
groupId: string;
|
|
items: Item[];
|
|
};
|
|
|
|
export class LabelsApi extends BaseAPI {
|
|
getAll() {
|
|
return this.http.get<Results<Label>>({ url: route("/labels") });
|
|
}
|
|
|
|
create(body: LabelCreate) {
|
|
return this.http.post<LabelCreate, Label>({ url: route("/labels"), body });
|
|
}
|
|
|
|
get(id: string) {
|
|
return this.http.get<Label>({ url: route(`/labels/${id}`) });
|
|
}
|
|
|
|
delete(id: string) {
|
|
return this.http.delete<void>({ url: route(`/labels/${id}`) });
|
|
}
|
|
|
|
update(id: string, body: LabelUpdate) {
|
|
return this.http.put<LabelUpdate, Label>({ url: route(`/labels/${id}`), body });
|
|
}
|
|
}
|