mirror of
https://github.com/hay-kot/homebox.git
synced 2025-05-23 13:52:26 +00:00
conform casing and documentation
This commit is contained in:
parent
572f0f6689
commit
a9f271d8c1
9 changed files with 58 additions and 50 deletions
|
@ -1,4 +1,4 @@
|
|||
import { BaseAPI, UrlBuilder } from '../base';
|
||||
import { BaseAPI, route } from '../base';
|
||||
import { Label } from './labels';
|
||||
import { Location } from './locations';
|
||||
import { Results } from './types';
|
||||
|
@ -33,22 +33,22 @@ export interface Item {
|
|||
|
||||
export class ItemsApi extends BaseAPI {
|
||||
async getAll() {
|
||||
return this.http.get<Results<Item>>(UrlBuilder('/items'));
|
||||
return this.http.get<Results<Item>>(route('/items'));
|
||||
}
|
||||
|
||||
async create(item: ItemCreate) {
|
||||
return this.http.post<ItemCreate, Item>(UrlBuilder('/items'), item);
|
||||
return this.http.post<ItemCreate, Item>(route('/items'), item);
|
||||
}
|
||||
|
||||
async get(id: string) {
|
||||
return this.http.get<Item>(UrlBuilder(`/items/${id}`));
|
||||
return this.http.get<Item>(route(`/items/${id}`));
|
||||
}
|
||||
|
||||
async delete(id: string) {
|
||||
return this.http.delete<void>(UrlBuilder(`/items/${id}`));
|
||||
return this.http.delete<void>(route(`/items/${id}`));
|
||||
}
|
||||
|
||||
async update(id: string, item: ItemCreate) {
|
||||
return this.http.put<ItemCreate, Item>(UrlBuilder(`/items/${id}`), item);
|
||||
return this.http.put<ItemCreate, Item>(route(`/items/${id}`), item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BaseAPI, UrlBuilder } from '../base';
|
||||
import { BaseAPI, route } from '../base';
|
||||
import { Details, OutType, Results } from './types';
|
||||
|
||||
export type LabelCreate = Details & {
|
||||
|
@ -14,22 +14,22 @@ export type Label = LabelCreate &
|
|||
|
||||
export class LabelsApi extends BaseAPI {
|
||||
async getAll() {
|
||||
return this.http.get<Results<Label>>(UrlBuilder('/labels'));
|
||||
return this.http.get<Results<Label>>(route('/labels'));
|
||||
}
|
||||
|
||||
async create(label: LabelCreate) {
|
||||
return this.http.post<LabelCreate, Label>(UrlBuilder('/labels'), label);
|
||||
return this.http.post<LabelCreate, Label>(route('/labels'), label);
|
||||
}
|
||||
|
||||
async get(id: string) {
|
||||
return this.http.get<Label>(UrlBuilder(`/labels/${id}`));
|
||||
return this.http.get<Label>(route(`/labels/${id}`));
|
||||
}
|
||||
|
||||
async delete(id: string) {
|
||||
return this.http.delete<void>(UrlBuilder(`/labels/${id}`));
|
||||
return this.http.delete<void>(route(`/labels/${id}`));
|
||||
}
|
||||
|
||||
async update(id: string, label: LabelUpdate) {
|
||||
return this.http.put<LabelUpdate, Label>(UrlBuilder(`/labels/${id}`), label);
|
||||
return this.http.put<LabelUpdate, Label>(route(`/labels/${id}`), label);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BaseAPI, UrlBuilder } from '../base';
|
||||
import { BaseAPI, route } from '../base';
|
||||
import { Item } from './items';
|
||||
import { Details, OutType, Results } from './types';
|
||||
|
||||
|
@ -15,21 +15,21 @@ export type LocationUpdate = LocationCreate;
|
|||
|
||||
export class LocationsApi extends BaseAPI {
|
||||
async getAll() {
|
||||
return this.http.get<Results<Location>>(UrlBuilder('/locations'));
|
||||
return this.http.get<Results<Location>>(route('/locations'));
|
||||
}
|
||||
|
||||
async create(location: LocationCreate) {
|
||||
return this.http.post<LocationCreate, Location>(UrlBuilder('/locations'), location);
|
||||
return this.http.post<LocationCreate, Location>(route('/locations'), location);
|
||||
}
|
||||
|
||||
async get(id: string) {
|
||||
return this.http.get<Location>(UrlBuilder(`/locations/${id}`));
|
||||
return this.http.get<Location>(route(`/locations/${id}`));
|
||||
}
|
||||
async delete(id: string) {
|
||||
return this.http.delete<void>(UrlBuilder(`/locations/${id}`));
|
||||
return this.http.delete<void>(route(`/locations/${id}`));
|
||||
}
|
||||
|
||||
async update(id: string, location: LocationUpdate) {
|
||||
return this.http.put<LocationUpdate, Location>(UrlBuilder(`/locations/${id}`), location);
|
||||
return this.http.put<LocationUpdate, Location>(route(`/locations/${id}`), location);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue