mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-04 08:40:28 +00:00
new API callers
This commit is contained in:
parent
37b7031264
commit
95a0bf0367
1 changed files with 13 additions and 0 deletions
|
@ -21,6 +21,7 @@ export type ItemsQuery = {
|
|||
locations?: string[];
|
||||
labels?: string[];
|
||||
q?: string;
|
||||
fields?: string[];
|
||||
};
|
||||
|
||||
export class AttachmentsAPI extends BaseAPI {
|
||||
|
@ -48,6 +49,16 @@ export class AttachmentsAPI extends BaseAPI {
|
|||
}
|
||||
}
|
||||
|
||||
export class FieldsAPI extends BaseAPI {
|
||||
getAll() {
|
||||
return this.http.get<string[]>({ url: route("/items/fields") });
|
||||
}
|
||||
|
||||
getAllValues(field: string) {
|
||||
return this.http.get<string[]>({ url: route(`/items/fields/values`, { field }) });
|
||||
}
|
||||
}
|
||||
|
||||
export class MaintenanceAPI extends BaseAPI {
|
||||
getLog(itemId: string) {
|
||||
return this.http.get<MaintenanceLog>({ url: route(`/items/${itemId}/maintenance`) });
|
||||
|
@ -75,9 +86,11 @@ export class MaintenanceAPI extends BaseAPI {
|
|||
export class ItemsApi extends BaseAPI {
|
||||
attachments: AttachmentsAPI;
|
||||
maintenance: MaintenanceAPI;
|
||||
fields: FieldsAPI;
|
||||
|
||||
constructor(http: Requests, token: string) {
|
||||
super(http, token);
|
||||
this.fields = new FieldsAPI(http);
|
||||
this.attachments = new AttachmentsAPI(http);
|
||||
this.maintenance = new MaintenanceAPI(http);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue