Skip to content

nim.user.NIMUser

Zvicii edited this page Feb 10, 2023 · 6 revisions

Class: NIMUser

nim/user.NIMUser

Hierarchy

Table of contents

Methods

Properties

Constructors

Methods

eventNames

eventNames(): keyof NIMUserEvents[]

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

Returns

keyof NIMUserEvents[]

Inherited from

EventEmitter.eventNames

Defined in

node_modules/eventemitter3/index.d.ts:15


listeners

listeners<T>(event): (...args: ArgumentMap<NIMUserEvents>[Extract<T, keyof NIMUserEvents>]) => void[]

Return the listeners registered for a given event.

Type parameters

Name Type
T extends keyof NIMUserEvents

Parameters

Name Type
event T

Returns

(...args: ArgumentMap<NIMUserEvents>[Extract<T, keyof NIMUserEvents>]) => 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 keyof NIMUserEvents

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 keyof NIMUserEvents

Parameters

Name Type
event T
...args ArgumentMap<NIMUserEvents>[Extract<T, keyof NIMUserEvents>]

Returns

boolean

Inherited from

EventEmitter.emit

Defined in

node_modules/eventemitter3/index.d.ts:32


on

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

Add a listener for a given event.

Type parameters

Name Type
T extends keyof NIMUserEvents

Parameters

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

Returns

NIMUser

Inherited from

EventEmitter.on

Defined in

node_modules/eventemitter3/index.d.ts:40


addListener

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

Type parameters

Name Type
T extends keyof NIMUserEvents

Parameters

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

Returns

NIMUser

Inherited from

EventEmitter.addListener

Defined in

node_modules/eventemitter3/index.d.ts:45


once

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

Add a one-time listener for a given event.

Type parameters

Name Type
T extends keyof NIMUserEvents

Parameters

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

Returns

NIMUser

Inherited from

EventEmitter.once

Defined in

node_modules/eventemitter3/index.d.ts:54


removeListener

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

Remove the listeners of a given event.

Type parameters

Name Type
T extends keyof NIMUserEvents

Parameters

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

Returns

NIMUser

Inherited from

EventEmitter.removeListener

Defined in

node_modules/eventemitter3/index.d.ts:63


off

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

Type parameters

Name Type
T extends keyof NIMUserEvents

Parameters

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

Returns

NIMUser

Inherited from

EventEmitter.off

Defined in

node_modules/eventemitter3/index.d.ts:69


removeAllListeners

removeAllListeners(event?): NIMUser

Remove all listeners, or those of the specified event.

Parameters

Name Type
event? keyof NIMUserEvents

Returns

NIMUser

Inherited from

EventEmitter.removeAllListeners

Defined in

node_modules/eventemitter3/index.d.ts:79


initEventHandlers

initEventHandlers(): void

注册全局回调

Returns

void

Defined in

ts/nim/user.ts:31


setBlack

setBlack(accid, setBlack, cb, jsonExtension): Promise<null | [NIMResCode, string, boolean]>

设置、取消设置黑名单

Note

200:成功
419:黑名单数量超过上限

Parameters

Name Type Description
accid string 好友id
setBlack boolean -
cb null | SetRelationCallback
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<null | [NIMResCode, string, boolean]>

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

Defined in

ts/nim/user.ts:47


setMute

setMute(accid, set_mute, cb, jsonExtension): Promise<null | [NIMResCode, string, boolean]>

设置、取消设置静音名单

Note

200:成功
419:静音列表数量超过上限

Parameters

Name Type Description
accid string 好友id
set_mute boolean 取消或设置
cb null | SetRelationCallback
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<null | [NIMResCode, string, boolean]>

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

Defined in

ts/nim/user.ts:79


getMutelist

getMutelist(cb, jsonExtension): Promise<[NIMResCode, BlackMuteListInfo[]]>

获得静音名单列表

Note

200:成功

Parameters

Name Type Description
cb null | GetSpecialListCallback
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<[NIMResCode, BlackMuteListInfo[]]>

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

Defined in

ts/nim/user.ts:108


getBlacklist

getBlacklist(cb, jsonExtension): Promise<[NIMResCode, BlackMuteListInfo[]]>

获得黑名单名单

Parameters

Name Type Description
cb null | GetSpecialListCallback
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<[NIMResCode, BlackMuteListInfo[]]>

void 无返回值

Defined in

ts/nim/user.ts:124


getUserNameCard

getUserNameCard(accids, cb, jsonExtension): Promise<null | [UserNameCard[]]>

获取本地的指定帐号的用户名片

Note

200:成功
414:参数错误
20000:还未初始化或初始化未正常完成
20001:还未登陆或登录未完成

Parameters

Name Type Description
accids string[]
cb null | GetUserNameCardCallback 操作结果回调
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<null | [UserNameCard[]]>

void 无返回值

Defined in

ts/nim/user.ts:148


getUserNameCardOnline

getUserNameCardOnline(accids, cb, jsonExtension): Promise<null | [UserNameCard[]]>

在线查询指定帐号的用户名片

Note

200:成功
414:参数错误
20000:还未初始化或初始化未正常完成
20001:还未登陆或登录未完成

Parameters

Name Type Description
accids string[]
cb null | GetUserNameCardCallback 操作结果回调
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<null | [UserNameCard[]]>

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

Defined in

ts/nim/user.ts:180


updateMyUserNameCard

updateMyUserNameCard(nameCard, cb, jsonExtension): Promise<null | [NIMResCode]>

更新自己的用户名片

Note

200:成功
400:非法参数

Parameters

Name Type Description
nameCard UserNameCard -
cb null | UpdateMyUserNameCardCallback 操作结果回调
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<null | [NIMResCode]>

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

Defined in

ts/nim/user.ts:210


queryUserListByKeyword

queryUserListByKeyword(keyword, cb, jsonExtension): Promise<null | [UserNameCard[]]>

获取本地的指定帐号的用户名片

Parameters

Name Type Description
keyword string 要查询的关键字
cb null | GetUserNameCardCallback 操作结果回调
jsonExtension string json扩展参数(备用,目前不需要)

Returns

Promise<null | [UserNameCard[]]>

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

Defined in

ts/nim/user.ts:235


updatePushToken

updatePushToken(cerName, token, type): void

更新推送证书

Parameters

Name Type Description
cerName string -
token string 设备token
type NINPushType 1: pushkit (仅iOS) 其他 apns 默认填0

Returns

void

void 无返回值

Defined in

ts/nim/user.ts:260

Properties

user

user: NIMUserAPI

Defined in

ts/nim/user.ts:24

Constructors

constructor

new NIMUser()

Overrides

EventEmitter<NIMUserEvents&gt;.constructor

Defined in

ts/nim/user.ts:25

Clone this wiki locally