api-core
Version:
Model-based dynamic multi-level APIs for any provider, plus multiple consumption channels
35 lines (34 loc) • 1.55 kB
TypeScript
import { ApiQueryScope } from "../query/ApiQuery";
import { ApiRequestType } from "../request/ApiRequest";
import { ApiEdgeQueryResponse } from "./ApiEdgeQueryResponse";
export declare enum ApiEdgeMethodScope {
Edge = 1,
Entry = 2,
Collection = 3
}
export declare enum ApiEdgeMethodOutput {
Entry = 1,
List = 2
}
export type ApiEdgeMethodOptions = {
name: string;
requiresData?: boolean;
acceptedTypes?: ApiRequestType;
scope?: ApiEdgeMethodScope;
output?: ApiEdgeMethodOutput;
execute: (scope: ApiQueryScope) => Promise<ApiEdgeQueryResponse>;
parameters?: string[];
};
export declare class ApiEdgeMethod {
name: string;
requiresData: boolean;
acceptedTypes: ApiRequestType;
scope: ApiEdgeMethodScope;
output: ApiEdgeMethodOutput;
execute: (scope: ApiQueryScope) => Promise<ApiEdgeQueryResponse>;
parameters: string[];
constructor(name: string, execute: (scope: ApiQueryScope) => Promise<ApiEdgeQueryResponse>, scope?: ApiEdgeMethodScope, acceptedTypes?: ApiRequestType, requiresData?: boolean);
constructor(name: string, execute: (scope: ApiQueryScope) => Promise<ApiEdgeQueryResponse>, scope?: ApiEdgeMethodScope, acceptedTypes?: ApiRequestType, parameters?: string[], requiresData?: boolean);
constructor(name: string, execute: (scope: ApiQueryScope) => Promise<ApiEdgeQueryResponse>, scope: ApiEdgeMethodScope, acceptedTypes: ApiRequestType, parametersOrData: string[] | boolean, requiresData: boolean);
constructor(options: ApiEdgeMethodOptions);
}