This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/src/api/Providers.ts

41 lines
1 KiB
TypeScript
Raw Normal View History

2021-02-09 16:04:55 +00:00
import { BaseInheritanceModel, DefaultClient, AKResponse, QueryArguments } from "./Client";
2021-02-10 19:11:54 +00:00
export interface TypeCreate {
name: string;
description: string;
link: string;
}
2021-02-08 09:15:59 +00:00
export class Provider implements BaseInheritanceModel {
pk: number;
name: string;
authorization_flow: string;
2021-02-06 16:55:41 +00:00
object_type: string;
2021-02-04 08:54:00 +00:00
assigned_application_slug?: string;
assigned_application_name?: string;
verbose_name: string;
verbose_name_plural: string;
constructor() {
throw Error();
}
2021-02-04 08:54:00 +00:00
static get(id: number): Promise<Provider> {
return DefaultClient.fetch<Provider>(["providers", "all", id.toString()]);
}
2021-02-09 16:04:55 +00:00
static list(filter?: QueryArguments): Promise<AKResponse<Provider>> {
return DefaultClient.fetch<AKResponse<Provider>>(["providers", "all"], filter);
}
2021-02-04 08:54:00 +00:00
2021-02-10 19:11:54 +00:00
static getTypes(): Promise<TypeCreate[]> {
return DefaultClient.fetch<TypeCreate[]>(["providers", "all", "types"]);
}
2021-02-04 08:54:00 +00:00
static adminUrl(rest: string): string {
return `/administration/providers/${rest}`;
}
}