1/*
2* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. 
3* Licensed under the Apache License, Version 2.0 (the "License"); 
4* you may not use this file except in compliance with the License. 
5* You may obtain a copy of the License at 
6*
7* http://www.apache.org/licenses/LICENSE-2.0 
8*
9* Unless required by applicable law or agreed to in writing, software 
10* distributed under the License is distributed on an "AS IS" BASIS, 
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
12* See the License for the specific language governing permissions and 
13* limitations under the License. 
14*/
15import { AsyncCallback, Callback } from './basic';
16declare namespace napitest {
17
18// 测试普通方法
19function funcTest(v: boolean): string;
20
21// 测试注册回调与调用回调
22export class NodeISayHello
23{
24    // 注册object回调
25    addSayHelloListener(listener: NodeISayHelloListener);
26    // 注销object回调
27    removeSayHelloListener(listener: NodeISayHelloListener);
28
29    // register注册回调
30    registerCallbackfunc(cb : (wid: number) => string);
31    // unRegister注销回调
32    unRegisterCallbackfunc(cb : (wid: number) => string);
33
34    // 调用注册的object回调
35    sayHello(from: string, to: string, sayType: SayType);
36    // 调用register注册的回调
37    sayHi(from: string, to: string, sayType: SayType);
38
39    // promise回调
40    sayHelloWithResponse(from: string, to: string, sayType: SayType): Promise<{result: number, errMsg: string, response: string}>;
41    
42}
43
44export class NodeISayHelloListener
45{
46    onSayHelloStart(info: SayInfo);
47    onSayHelloEnd(info: SayInfo);
48}
49
50export enum SayType
51{
52    /** 0  主动说话 */
53    kInitiative,
54    /** 1  回应对方 */
55    kResponse,
56}
57
58export type SayInfo = 
59{
60    from: string;
61    fromId?: number;
62    to: string;
63    toId?: number;
64    content: string;
65    saidTime: string;
66    isEnd: boolean;
67}
68 
69}
70
71export default napitest;
72