web: PBResponse -> AKResponse

This commit is contained in:
Jens Langhammer
2021-02-09 17:04:55 +01:00
parent 45f1d95bf9
commit f8bcdb26b3
29 changed files with 78 additions and 74 deletions

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client";
import { DefaultClient, AKResponse, QueryArguments } from "./Client";
import { Provider } from "./Providers";
export class Application {
@ -22,8 +22,8 @@ export class Application {
return DefaultClient.fetch<Application>(["core", "applications", slug]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Application>> {
return DefaultClient.fetch<PBResponse<Application>>(["core", "applications"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Application>> {
return DefaultClient.fetch<AKResponse<Application>>(["core", "applications"], filter);
}
static adminUrl(rest: string): string {

View File

@ -94,7 +94,7 @@ export interface PBPagination {
end_index: number;
}
export interface PBResponse<T> {
export interface AKResponse<T> {
pagination: PBPagination;
results: Array<T>;

View File

@ -1,4 +1,4 @@
import { DefaultClient, QueryArguments, PBResponse } from "./Client";
import { DefaultClient, QueryArguments, AKResponse } from "./Client";
import { Event } from "./Events";
export class Notification {
@ -17,8 +17,8 @@ export class Notification {
return DefaultClient.fetch<Notification>(["events", "notifications", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Notification>> {
return DefaultClient.fetch<PBResponse<Notification>>(["events", "notifications"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Notification>> {
return DefaultClient.fetch<AKResponse<Notification>>(["events", "notifications"], filter);
}
static markSeen(pk: string): Promise<{seen: boolean}> {

View File

@ -1,4 +1,4 @@
import { DefaultClient, QueryArguments, PBResponse } from "./Client";
import { DefaultClient, QueryArguments, AKResponse } from "./Client";
import { Group } from "./Groups";
export class Rule {
@ -16,8 +16,8 @@ export class Rule {
return DefaultClient.fetch<Rule>(["events", "rules", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Rule>> {
return DefaultClient.fetch<PBResponse<Rule>>(["events", "rules"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Rule>> {
return DefaultClient.fetch<AKResponse<Rule>>(["events", "rules"], filter);
}
static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, QueryArguments, PBResponse } from "./Client";
import { DefaultClient, QueryArguments, AKResponse } from "./Client";
export class Transport {
pk: string;
@ -15,8 +15,8 @@ export class Transport {
return DefaultClient.fetch<Transport>(["events", "transports", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Transport>> {
return DefaultClient.fetch<PBResponse<Transport>>(["events", "transports"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Transport>> {
return DefaultClient.fetch<AKResponse<Transport>>(["events", "transports"], filter);
}
static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client";
import { DefaultClient, AKResponse, QueryArguments } from "./Client";
export interface EventUser {
pk: number;
@ -28,8 +28,8 @@ export class Event {
return DefaultClient.fetch<Event>(["events", "events", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Event>> {
return DefaultClient.fetch<PBResponse<Event>>(["events", "events"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Event>> {
return DefaultClient.fetch<AKResponse<Event>>(["events", "events"], filter);
}
// events/events/top_per_user/?filter_action=authorize_application

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client";
import { DefaultClient, AKResponse, QueryArguments } from "./Client";
export enum FlowDesignation {
Authentication = "authentication",
@ -34,12 +34,12 @@ export class Flow {
return DefaultClient.fetch<{ diagram: string }>(["flows", "instances", slug, "diagram"]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Flow>> {
return DefaultClient.fetch<PBResponse<Flow>>(["flows", "instances"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Flow>> {
return DefaultClient.fetch<AKResponse<Flow>>(["flows", "instances"], filter);
}
static cached(): Promise<number> {
return DefaultClient.fetch<PBResponse<Flow>>(["flows", "cached"]).then(r => {
return DefaultClient.fetch<AKResponse<Flow>>(["flows", "cached"]).then(r => {
return r.pagination.count;
});
}
@ -76,8 +76,8 @@ export class FlowStageBinding {
return DefaultClient.fetch<FlowStageBinding>(["flows", "bindings", slug]);
}
static list(filter?: QueryArguments): Promise<PBResponse<FlowStageBinding>> {
return DefaultClient.fetch<PBResponse<FlowStageBinding>>(["flows", "bindings"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<FlowStageBinding>> {
return DefaultClient.fetch<AKResponse<FlowStageBinding>>(["flows", "bindings"], filter);
}
static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client";
import { DefaultClient, AKResponse, QueryArguments } from "./Client";
import { Provider } from "./Providers";
export interface OutpostHealth {
@ -26,8 +26,8 @@ export class Outpost {
return DefaultClient.fetch<Outpost>(["outposts", "outposts", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Outpost>> {
return DefaultClient.fetch<PBResponse<Outpost>>(["outposts", "outposts"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Outpost>> {
return DefaultClient.fetch<AKResponse<Outpost>>(["outposts", "outposts"], filter);
}
static health(pk: string): Promise<OutpostHealth[]> {

View File

@ -1,4 +1,4 @@
import { DefaultClient, BaseInheritanceModel, PBResponse, QueryArguments } from "./Client";
import { DefaultClient, BaseInheritanceModel, AKResponse, QueryArguments } from "./Client";
export class Policy implements BaseInheritanceModel {
pk: string;
@ -15,12 +15,12 @@ export class Policy implements BaseInheritanceModel {
return DefaultClient.fetch<Policy>(["policies", "all", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Policy>> {
return DefaultClient.fetch<PBResponse<Policy>>(["policies", "all"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Policy>> {
return DefaultClient.fetch<AKResponse<Policy>>(["policies", "all"], filter);
}
static cached(): Promise<number> {
return DefaultClient.fetch<PBResponse<Policy>>(["policies", "cached"]).then(r => {
return DefaultClient.fetch<AKResponse<Policy>>(["policies", "cached"]).then(r => {
return r.pagination.count;
});
}

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client";
import { DefaultClient, AKResponse, QueryArguments } from "./Client";
import { Policy } from "./Policies";
export class PolicyBinding {
@ -18,8 +18,8 @@ export class PolicyBinding {
return DefaultClient.fetch<PolicyBinding>(["policies", "bindings", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<PolicyBinding>> {
return DefaultClient.fetch<PBResponse<PolicyBinding>>(["policies", "bindings"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<PolicyBinding>> {
return DefaultClient.fetch<AKResponse<PolicyBinding>>(["policies", "bindings"], filter);
}
static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse, QueryArguments } from "./Client";
import { DefaultClient, AKResponse, QueryArguments } from "./Client";
export class PropertyMapping {
pk: string;
@ -16,8 +16,8 @@ export class PropertyMapping {
return DefaultClient.fetch<PropertyMapping>(["propertymappings", "all", pk]);
}
static list(filter?: QueryArguments): Promise<PBResponse<PropertyMapping>> {
return DefaultClient.fetch<PBResponse<PropertyMapping>>(["propertymappings", "all"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<PropertyMapping>> {
return DefaultClient.fetch<AKResponse<PropertyMapping>>(["propertymappings", "all"], filter);
}
static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { BaseInheritanceModel, DefaultClient, PBResponse, QueryArguments } from "./Client";
import { BaseInheritanceModel, DefaultClient, AKResponse, QueryArguments } from "./Client";
export class Provider implements BaseInheritanceModel {
pk: number;
@ -20,8 +20,8 @@ export class Provider implements BaseInheritanceModel {
return DefaultClient.fetch<Provider>(["providers", "all", id.toString()]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Provider>> {
return DefaultClient.fetch<PBResponse<Provider>>(["providers", "all"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Provider>> {
return DefaultClient.fetch<AKResponse<Provider>>(["providers", "all"], filter);
}
static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { BaseInheritanceModel, DefaultClient, PBResponse, QueryArguments } from "./Client";
import { BaseInheritanceModel, DefaultClient, AKResponse, QueryArguments } from "./Client";
export class Source implements BaseInheritanceModel {
pk: string;
@ -19,8 +19,8 @@ export class Source implements BaseInheritanceModel {
return DefaultClient.fetch<Source>(["sources", "all", slug]);
}
static list(filter?: QueryArguments): Promise<PBResponse<Source>> {
return DefaultClient.fetch<PBResponse<Source>>(["sources", "all"], filter);
static list(filter?: QueryArguments): Promise<AKResponse<Source>> {
return DefaultClient.fetch<AKResponse<Source>>(["sources", "all"], filter);
}
static adminUrl(rest: string): string {

View File

@ -1,4 +1,4 @@
import { DefaultClient, PBResponse } from "./Client";
import { DefaultClient, AKResponse } from "./Client";
let _globalMePromise: Promise<User>;
@ -22,7 +22,7 @@ export class User {
}
static count(): Promise<number> {
return DefaultClient.fetch<PBResponse<User>>(["core", "users"], {
return DefaultClient.fetch<AKResponse<User>>(["core", "users"], {
"page_size": 1
}).then(r => {
return r.pagination.count;