core: add providers/types endpoint

This commit is contained in:
Jens Langhammer
2021-02-10 20:11:54 +01:00
parent e6712a50d2
commit 2b7a22a29a
5 changed files with 129 additions and 42 deletions

View File

@ -1,5 +1,11 @@
import { BaseInheritanceModel, DefaultClient, AKResponse, QueryArguments } from "./Client";
export interface TypeCreate {
name: string;
description: string;
link: string;
}
export class Provider implements BaseInheritanceModel {
pk: number;
name: string;
@ -24,6 +30,10 @@ export class Provider implements BaseInheritanceModel {
return DefaultClient.fetch<AKResponse<Provider>>(["providers", "all"], filter);
}
static getTypes(): Promise<TypeCreate[]> {
return DefaultClient.fetch<TypeCreate[]>(["providers", "all", "types"]);
}
static adminUrl(rest: string): string {
return `/administration/providers/${rest}`;
}