/** @packageDocumentation * @module RpcInterface */ /// import { Readable, Writable } from "stream"; import { RpcConfiguration } from "../core/RpcConfiguration"; import { RpcContentType, RpcRequestStatus } from "../core/RpcConstants"; import { RpcOperation } from "../core/RpcOperation"; import { RpcProtocol } from "../core/RpcProtocol"; import { OpenAPIInfo, OpenAPIParameter, RpcOpenAPIDescription } from "./OpenAPI"; import { WebAppRpcRequest } from "./WebAppRpcRequest"; /** An HTTP server request object. * @public */ export interface HttpServerRequest extends Readable { httpVersion: string; httpVersionMajor: number; httpVersionMinor: number; connection: any; headers: { [header: string]: string | string[] | undefined; }; rawHeaders: string[]; trailers: { [key: string]: string | undefined; }; rawTrailers: string[]; setTimeout(msecs: number, callback: () => void): this; url?: string; statusCode?: number; statusMessage?: string; socket: any; destroy(error?: Error): void; body: string | Buffer; path: string; method: string; ip?: string; header: (field: string) => string | undefined; } /** An HTTP server response object. * @public */ export interface HttpServerResponse extends Writable { send(body?: any): HttpServerResponse; status(code: number): HttpServerResponse; set(field: string, value: string): void; } /** The HTTP application protocol. * @public */ export declare abstract class WebAppRpcProtocol extends RpcProtocol { preserveStreams: boolean; private _initialized; /** @internal */ allowedHeaders: Set; /** @internal */ initialize(): Promise; /** Convenience handler for an RPC operation get request for an HTTP server. */ handleOperationGetRequest(req: HttpServerRequest, res: HttpServerResponse): Promise; /** Convenience handler for an RPC operation post request for an HTTP server. */ handleOperationPostRequest(req: HttpServerRequest, res: HttpServerResponse): Promise; /** Convenience handler for an OpenAPI description request for an HTTP server. */ handleOpenApiDescriptionRequest(_req: HttpServerRequest, res: HttpServerResponse): void; /** Converts an HTTP content type value to an RPC content type value. */ static computeContentType(httpType: string | null | undefined): RpcContentType; /** The OpenAPI-compatible info object for this protocol. */ abstract info: OpenAPIInfo; /** An optional prefix for RPC operation URI paths. */ pathPrefix: string; /** The RPC request class for this protocol. */ readonly requestType: typeof WebAppRpcRequest; /** Supplies the status corresponding to a protocol-specific code value. */ getStatus(code: number): RpcRequestStatus; /** Supplies the protocol-specific code corresponding to a status value. */ getCode(status: RpcRequestStatus): number; /** Whether an HTTP status code indicates a request timeout. */ isTimeout(code: number): boolean; /** An OpenAPI-compatible description of this protocol. * @internal */ get openAPIDescription(): RpcOpenAPIDescription; /** Returns the OpenAPI-compatible URI path parameters for an RPC operation. * @internal */ abstract supplyPathParametersForOperation(_operation: RpcOperation): OpenAPIParameter[]; /** Constructs an HTTP protocol. */ constructor(configuration: RpcConfiguration); } //# sourceMappingURL=WebAppRpcProtocol.d.ts.map