api-core
Version:
Model-based dynamic multi-level APIs for any provider, plus multiple consumption channels
34 lines (33 loc) • 2.11 kB
TypeScript
import { ApiEdgeQueryContext } from "./ApiEdgeQueryContext";
import { ApiEdgeQueryResponse } from "./ApiEdgeQueryResponse";
import { ApiEdge, ApiEdgeDefinition } from "./ApiEdgeDefinition";
import { ApiQueryScope } from "../query/ApiQuery";
import { Api } from "../Api";
export declare abstract class ExternalApiProvider {
protected metadata: any;
protected api: Api;
protected constructor(metadata: any, api: Api);
abstract getEntry: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>;
abstract listEntries: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>;
abstract createEntry: (context: ApiEdgeQueryContext, entryFields: any) => Promise<ApiEdgeQueryResponse>;
abstract updateEntry: (context: ApiEdgeQueryContext, entryFields: any) => Promise<ApiEdgeQueryResponse>;
abstract patchEntry: (context: ApiEdgeQueryContext, entryFields: any) => Promise<ApiEdgeQueryResponse>;
abstract removeEntry: (context: ApiEdgeQueryContext, entryFields: any) => Promise<ApiEdgeQueryResponse>;
abstract exists: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>;
abstract callMethod: (scope: ApiQueryScope) => Promise<ApiEdgeQueryResponse>;
protected abstract prepare(): Promise<void>;
edge(): Promise<ApiEdgeDefinition>;
}
export declare class ExternalApiEdge extends ApiEdge {
constructor(metadata: any, api: Api, provider?: ExternalApiProvider);
url: string;
provider: ExternalApiProvider;
api: Api;
getEntry: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>;
listEntries: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>;
createEntry: (context: ApiEdgeQueryContext, body: any) => Promise<ApiEdgeQueryResponse>;
updateEntry: (context: ApiEdgeQueryContext, body: any) => Promise<ApiEdgeQueryResponse>;
patchEntry: (context: ApiEdgeQueryContext, body: any) => Promise<ApiEdgeQueryResponse>;
removeEntry: (context: ApiEdgeQueryContext, body: any) => Promise<ApiEdgeQueryResponse>;
exists: (context: ApiEdgeQueryContext) => Promise<ApiEdgeQueryResponse>;
}