// Type definitions for amqplib 0.5 // Project: https://github.com/squaremo/amqp.node // Definitions by: Michael Nahkies , Ab Reitsma , Nicolás Fantone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// import * as Promise from 'bluebird'; import * as events from 'events'; import { Replies, Options, Message } from './properties'; export * from './properties'; export interface Connection extends events.EventEmitter { close(): Promise; createChannel(): Promise; createConfirmChannel(): Promise; } export interface Channel extends events.EventEmitter { close(): Promise; assertQueue(queue: string, options?: Options.AssertQueue): Promise; checkQueue(queue: string): Promise; deleteQueue(queue: string, options?: Options.DeleteQueue): Promise; purgeQueue(queue: string): Promise; bindQueue(queue: string, source: string, pattern: string, args?: any): Promise; unbindQueue(queue: string, source: string, pattern: string, args?: any): Promise; assertExchange(exchange: string, type: string, options?: Options.AssertExchange): Promise; checkExchange(exchange: string): Promise; deleteExchange(exchange: string, options?: Options.DeleteExchange): Promise; bindExchange(destination: string, source: string, pattern: string, args?: any): Promise; unbindExchange(destination: string, source: string, pattern: string, args?: any): Promise; publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): Promise; cancel(consumerTag: string): Promise; get(queue: string, options?: Options.Get): Promise; ack(message: Message, allUpTo?: boolean): void; ackAll(): void; nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; nackAll(requeue?: boolean): void; reject(message: Message, requeue?: boolean): void; prefetch(count: number, global?: boolean): Promise; recover(): Promise; } export interface ConfirmChannel extends Channel { publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; waitForConfirms(): Promise; } export function connect(url: string, socketOptions?: any): Promise;