mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
// Type definitions for thrift 0.10
|
|
// Project: https://www.npmjs.com/package/thrift
|
|
// Definitions by: Kamek <https://github.com/kamek-pf>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
export as namespace Thrift;
|
|
|
|
export class TException {}
|
|
|
|
/**
|
|
* Protocols and Transports
|
|
*/
|
|
export class TBufferedTransport {}
|
|
export class TXHRTransport {}
|
|
export class TJSONProtocol {}
|
|
export class TBinaryProtocol {}
|
|
|
|
/**
|
|
* Server side
|
|
*/
|
|
export interface ThriftServer {
|
|
listen(port: number): any;
|
|
}
|
|
|
|
export function createServer(generatedService: any, serviceMethods: any): ThriftServer;
|
|
|
|
/**
|
|
* Client side
|
|
*/
|
|
export type ConnexionEvent = 'open' | 'message' | 'close' | 'error';
|
|
|
|
export interface ClientConnectionParams {
|
|
transport: TJSONProtocol | TBinaryProtocol;
|
|
protocol: TBufferedTransport | TXHRTransport;
|
|
}
|
|
|
|
export interface ClientConnection {
|
|
on(event: ConnexionEvent, callback: (...args: any[]) => void): void;
|
|
}
|
|
|
|
export function createConnection(host: string, port: number, params: ClientConnectionParams): ClientConnection;
|
|
export function createClient(generatedService: any, connection: {}): any;
|