public class ContactApi extends Object
构造器和说明 |
---|
ContactApi(Context context) |
限定符和类型 | 方法和说明 |
---|---|
reactor.core.publisher.Mono<Void> |
add(String user,
String contact)
向用户通讯录添加联系人。
|
reactor.core.publisher.Flux<String> |
list(String user)
获取用户联系人列表。
|
reactor.core.publisher.Mono<List<ContactUserPageResource>> |
list(String user,
int limit,
String cursor)
分页获取好友列表。
|
reactor.core.publisher.Mono<Void> |
remove(String user,
String contact)
从用户通讯录移除联系人
API使用示例:
EMService service;
try {
service.contact().remove("user", "contact").block();
} catch (EMException e) {
e.getErrorCode();
e.getMessage();
}
|
reactor.core.publisher.Mono<Void> |
setRemark(String user,
String contact,
String remark)
设置好友备注。
|
public ContactApi(Context context)
public reactor.core.publisher.Mono<Void> add(String user, String contact)
EMService service;
try {
service.contact().add("user", "contact").block();
} catch (EMException e) {
e.getErrorCode();
e.getMessage();
}
user
- 所属用户的用户名contact
- 联系人的用户名public reactor.core.publisher.Mono<Void> remove(String user, String contact)
EMService service;
try {
service.contact().remove("user", "contact").block();
} catch (EMException e) {
e.getErrorCode();
e.getMessage();
}
user
- 所属用户的用户名contact
- 联系人的用户名public reactor.core.publisher.Flux<String> list(String user)
EMService service;
try {
List<String> users = service.contact().list("user").collectList().block();
} catch (EMException e) {
e.getErrorCode();
e.getMessage();
}
user
- 所属用户的用户名public reactor.core.publisher.Mono<List<ContactUserPageResource>> list(String user, int limit, String cursor)
EMService service;
try {
List<ContactUserPageResource> users = service.contact().list("user", 10, null).collectList().block();
} catch (EMException e) {
e.getErrorCode();
e.getMessage();
}
user
- 所属用户的用户名public reactor.core.publisher.Mono<Void> setRemark(String user, String contact, String remark)
EMService service;
try {
service.contact().setRemark("user", "contact", "remark").block();
} catch (EMException e) {
e.getErrorCode();
e.getMessage();
}
user
- 所属用户的用户名contact
- 联系人的用户名remark
- 好友备注。好友备注的长度不能超过 100 个字符。Copyright © 2024. All rights reserved.