Skip to content

nim.friend.NIMFriend

Zvicii edited this page Feb 10, 2023 · 6 revisions

Class: NIMFriend

nim/friend.NIMFriend

Hierarchy

Table of contents

Methods

Properties

Constructors

Methods

eventNames

eventNames(): "change"[]

Return an array listing the events for which the emitter has registered listeners.

Returns

"change"[]

Inherited from

EventEmitter.eventNames

Defined in

node_modules/eventemitter3/index.d.ts:15


listeners

listeners<T>(event): (...args: ArgumentMap<NIMFriendEvents>[Extract<T, "change">]) => void[]

Return the listeners registered for a given event.

Type parameters

Name Type
T extends "change"

Parameters

Name Type
event T

Returns

(...args: ArgumentMap<NIMFriendEvents>[Extract<T, "change">]) => void[]

Inherited from

EventEmitter.listeners

Defined in

node_modules/eventemitter3/index.d.ts:20


listenerCount

listenerCount(event): number

Return the number of listeners listening to a given event.

Parameters

Name Type
event "change"

Returns

number

Inherited from

EventEmitter.listenerCount

Defined in

node_modules/eventemitter3/index.d.ts:27


emit

emit<T>(event, ...args): boolean

Calls each of the listeners registered for a given event.

Type parameters

Name Type
T extends "change"

Parameters

Name Type
event T
...args ArgumentMap<NIMFriendEvents>[Extract<T, "change">]

Returns

boolean

Inherited from

EventEmitter.emit

Defined in

node_modules/eventemitter3/index.d.ts:32


on

on<T>(event, fn, context?): NIMFriend

Add a listener for a given event.

Type parameters

Name Type
T extends "change"

Parameters

Name Type
event T
fn (...args: ArgumentMap<NIMFriendEvents>[Extract<T, "change">]) => void
context? any

Returns

NIMFriend

Inherited from

EventEmitter.on

Defined in

node_modules/eventemitter3/index.d.ts:40


addListener

addListener<T>(event, fn, context?): NIMFriend

Type parameters

Name Type
T extends "change"

Parameters

Name Type
event T
fn (...args: ArgumentMap<NIMFriendEvents>[Extract<T, "change">]) => void
context? any

Returns

NIMFriend

Inherited from

EventEmitter.addListener

Defined in

node_modules/eventemitter3/index.d.ts:45


once

once<T>(event, fn, context?): NIMFriend

Add a one-time listener for a given event.

Type parameters

Name Type
T extends "change"

Parameters

Name Type
event T
fn (...args: ArgumentMap<NIMFriendEvents>[Extract<T, "change">]) => void
context? any

Returns

NIMFriend

Inherited from

EventEmitter.once

Defined in

node_modules/eventemitter3/index.d.ts:54


removeListener

removeListener<T>(event, fn?, context?, once?): NIMFriend

Remove the listeners of a given event.

Type parameters

Name Type
T extends "change"

Parameters

Name Type
event T
fn? (...args: ArgumentMap<NIMFriendEvents>[Extract<T, "change">]) => void
context? any
once? boolean

Returns

NIMFriend

Inherited from

EventEmitter.removeListener

Defined in

node_modules/eventemitter3/index.d.ts:63


off

off<T>(event, fn?, context?, once?): NIMFriend

Type parameters

Name Type
T extends "change"

Parameters

Name Type
event T
fn? (...args: ArgumentMap<NIMFriendEvents>[Extract<T, "change">]) => void
context? any
once? boolean

Returns

NIMFriend

Inherited from

EventEmitter.off

Defined in

node_modules/eventemitter3/index.d.ts:69


removeAllListeners

removeAllListeners(event?): NIMFriend

Remove all listeners, or those of the specified event.

Parameters

Name Type
event? "change"

Returns

NIMFriend

Inherited from

EventEmitter.removeAllListeners

Defined in

node_modules/eventemitter3/index.d.ts:79


initEventHandlers

initEventHandlers(): void

注册全局回调

Returns

void

Defined in

ts/nim/friend.ts:28


request

request(accid, verify_type, msg, cb, jsonExtension): Promise<null | [NIMResCode]>

添加、验证好友

Note

200:成功
404:用户不存在
500:未知错误

Parameters

Name Type Description
accid string 对方帐号
verify_type NIMVerifyType 好友验证类型
msg string 接口扩展字段
cb null | FriendOptCallback 好友请求回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<null | [NIMResCode]>

boolean 检查参数如果不符合要求则返回失败

Defined in

ts/nim/friend.ts:46


delete

delete(accid, option, cb): Promise<null | [NIMResCode]>

删除好友

Note

200:成功
404:用户不存在
500:未知错误

Parameters

Name Type Description
accid string 对方帐号
option DeleteFriendOption 删除好友选项,目前仅有是否删除备注信息选项
cb null | FriendOptCallback 删除好友回调函数

Returns

Promise<null | [NIMResCode]>

boolean 检查参数如果不符合要求则返回失败

Defined in

ts/nim/friend.ts:79


update

update(profile, cb, jsonExtension): Promise<null | [NIMResCode]>

更新好友资料

Note

200:成功
404:用户不存在
500:未知错误

Parameters

Name Type Description
profile FriendProfile 好友资料
cb null | FriendOptCallback 更新好友资料回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<null | [NIMResCode]>

boolean 检查参数如果不符合要求则返回失败

Defined in

ts/nim/friend.ts:106


getList

getList(cb, jsonExtension): Promise<[NIMResCode, FriendProfile[]]>

增量获取好友列表

Note

200:成功

Parameters

Name Type Description
cb null | GetFriendsListCallback 获取好友列表回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<[NIMResCode, FriendProfile[]]>

void 无返回值

Defined in

ts/nim/friend.ts:134


getFriendProfile

getFriendProfile(accid, cb, jsonExtension): Promise<[string, FriendProfile]>

获取好友信息

Parameters

Name Type Description
accid string 对方帐号
cb null | GetFriendProfileCallback 获取好友信息回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<[string, FriendProfile]>

void 无返回值

Defined in

ts/nim/friend.ts:151


queryFriendListByKeyword

queryFriendListByKeyword(keyword, cb, jsonExtension): Promise<null | [NIMResCode, FriendProfile[]]>

增量获取好友列表

Note

200:成功

Parameters

Name Type Description
keyword string 要查询的关键字
cb null | GetFriendsListCallback 获取好友列表回调函数
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<null | [NIMResCode, FriendProfile[]]>

boolean 返回 true 表示发送查询请求成功,返回 false 表示关键字为空

Defined in

ts/nim/friend.ts:176

Properties

friend

friend: NIMFriendAPI

Defined in

ts/nim/friend.ts:21

Constructors

constructor

new NIMFriend()

Overrides

EventEmitter<NIMFriendEvents&gt;.constructor

Defined in

ts/nim/friend.ts:22

Clone this wiki locally