-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_canister_rs.did
83 lines (68 loc) · 1.69 KB
/
test_canister_rs.did
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
type ClientPrincipal = principal;
type GatewayPrincipal = principal;
type ClientKey = record {
client_principal : ClientPrincipal;
client_nonce : nat64;
};
type WebsocketMessage = record {
client_key : ClientKey;
sequence_num : nat64;
timestamp : nat64;
is_service_message : bool;
content : blob;
};
type CanisterOutputMessage = record {
client_key : ClientKey;
key : text;
content : blob;
};
type CanisterOutputCertifiedMessages = record {
messages : vec CanisterOutputMessage;
cert : blob;
tree : blob;
is_end_of_queue : bool;
};
type CanisterWsOpenArguments = record {
client_nonce : nat64;
gateway_principal : GatewayPrincipal;
};
type CanisterWsOpenResult = variant {
Ok : null;
Err : text;
};
type CanisterWsCloseArguments = record {
client_key : ClientKey;
};
type CanisterWsCloseResult = variant {
Ok : null;
Err : text;
};
type CanisterWsMessageArguments = record {
msg : WebsocketMessage;
};
type CanisterWsMessageResult = variant {
Ok : null;
Err : text;
};
type CanisterWsGetMessagesArguments = record {
nonce : nat64;
};
type CanisterWsGetMessagesResult = variant {
Ok : CanisterOutputCertifiedMessages;
Err : text;
};
type AppMessage = record {
text : text;
timestamp : nat64;
};
type CanisterSendResult = variant {
Ok : null;
Err : text;
};
service : {
"ws_open" : (CanisterWsOpenArguments) -> (CanisterWsOpenResult);
"ws_close" : (CanisterWsCloseArguments) -> (CanisterWsCloseResult);
"ws_message" : (CanisterWsMessageArguments, opt AppMessage) -> (CanisterWsMessageResult);
"ws_get_messages" : (CanisterWsGetMessagesArguments) -> (CanisterWsGetMessagesResult) query;
"send" : (ClientPrincipal, blob) -> (CanisterSendResult);
};