forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rsmq.d.ts
94 lines (78 loc) · 2.48 KB
/
rsmq.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Type definitions for rsmq 0.3.16
// Project: http://smrchy.github.io/rsmq/
// Definitions by: Qubo <https://github.com/MugeSo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path='../redis/redis.d.ts'/>
declare namespace RedisSMQ {
interface CallbackT<R> {
(e?:Error, res?:R): void;
}
interface Client {
createQueue(options:QueueOptions, cb:CallbackT<number>): void;
changeMessageVisibility(options:VisibilityOptions, cb:CallbackT<number>): void;
deleteMessage(options:MessageIdentifier, cb:CallbackT<number>): void;
deleteQueue(options:QueueIdentifier, cb:CallbackT<number>): void;
getQueueAttributes(options:QueueIdentifier, cb:CallbackT<QueueAttributes>): void;
listQueues(cb:CallbackT<string[]>): void;
receiveMessage(options:ReceiveOptions, cb:CallbackT<Message>): void;
sendMessage(options:NewMessage, cb:CallbackT<string>): void;
setQueueAttributes(options:QueueOptions, cb:CallbackT<QueueAttributes>): void;
quit(): void;
}
interface QueueIdentifier {
qname: string;
}
interface QueueOptions extends QueueIdentifier {
vt?: number;
delay?: number;
maxsize?: number;
}
interface MessageIdentifier extends QueueIdentifier {
id: string;
}
interface VisibilityOptions extends MessageIdentifier {
vt: number;
}
export interface QueueAttributes extends QueueIdentifier {
vt: number;
delay: number;
maxsize: number;
totalrecv: number;
totalsent: number;
created: number;
modified: number;
msgs: number;
hiddenmsgs: number;
}
interface ReceiveOptions extends QueueIdentifier {
vt?: number;
}
export interface Message extends MessageIdentifier {
message: string;
sent: number;
fr: number;
rc: number;
}
interface NewMessage extends QueueIdentifier {
message: string;
delay?: number;
}
}
declare module 'rsmq' {
import redis = require('redis');
interface RedisSMQStatic {
new (options:ClientOptions): Client;
}
interface Client extends RedisSMQ.Client{
redis: redis.RedisClient;
}
interface ClientOptions {
host?: string;
port?: number;
options?: redis.ClientOpts;
client?: redis.RedisClient;
ns?: string;
}
var rsmq: RedisSMQStatic;
export = rsmq;
}