|
| 1 | +/* |
| 2 | + * | | | | \ \ / / | | | | / _______| |
| 3 | + * | |____| | \ \/ / | |____| | / / |
| 4 | + * | |____| | \ / | |____| | | | _____ |
| 5 | + * | | | | / \ | | | | | | |____ | |
| 6 | + * | | | | / /\ \ | | | | \ \______| | |
| 7 | + * | | | | /_/ \_\ | | | | \_________| |
| 8 | + * |
| 9 | + * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. |
| 10 | + */ |
| 11 | + |
| 12 | +#import <Foundation/Foundation.h> |
| 13 | +#import <JMessage/JMSGConstants.h> |
| 14 | + |
| 15 | +@class JMSGUser; |
| 16 | + |
| 17 | +/*! |
| 18 | + * 聊天室 |
| 19 | + * |
| 20 | + * #### 主要特点 |
| 21 | + * |
| 22 | + * 聊天室的消息没有推送通知和离线保存,也没有常驻成员的概念,只要进入聊天室即可接收消息,开始聊天, |
| 23 | + 一旦退出聊天室,不再会接收到任何消息、通知和提醒。 |
| 24 | + * |
| 25 | + * #### 发送消息 |
| 26 | + * |
| 27 | + * 聊天室消息的发送与单聊、群聊是一样的,通用的发送接口 |
| 28 | + * |
| 29 | + * #### 接收消息 |
| 30 | + * |
| 31 | + * 聊天室消息的接收与单聊、群聊做了区分,聊天室消息的接收将通过 JMSGConversationDelegate 类里的 onReceiveChatRoomConversation:messages: 方法通知到上层 |
| 32 | + * |
| 33 | + */ |
| 34 | +@interface JMSGChatRoom : NSObject |
| 35 | +JMSG_ASSUME_NONNULL_BEGIN |
| 36 | + |
| 37 | +/*! |
| 38 | + * @abstract 分页获取聊天室详情 |
| 39 | + * |
| 40 | + * @param appKey 选填,为 nil 则获取当前应用下的聊天室 |
| 41 | + * @param start 分页获取的下标,第一页从 index = 0 开始 |
| 42 | + * @param count 一页的数量,每页最大值是 50 |
| 43 | + * @param handler 结果回调. 正常返回时 resultObject 类型是 NSArray<JMSGChatRoom> |
| 44 | + * |
| 45 | + * @discussion 该接口总是向服务器端发起请求. |
| 46 | + */ |
| 47 | ++ (void)getChatRoomListWithAppKey:(NSString *JMSG_NULLABLE)appKey |
| 48 | + start:(NSInteger)start |
| 49 | + count:(NSInteger)count |
| 50 | + completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; |
| 51 | + |
| 52 | +/*! |
| 53 | + * @abstract 获取当前用户已加入的聊天室列表 |
| 54 | + * |
| 55 | + * @param handler 结果回调. 正常返回时 resultObject 类型是 NSArray<JMSGChatRoom> |
| 56 | + * |
| 57 | + * @discussion 该接口总是向服务器端发起请求. |
| 58 | + */ |
| 59 | ++ (void)getMyChatRoomListCompletionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; |
| 60 | + |
| 61 | +/*! |
| 62 | + * @abstract 获取聊天室详情 |
| 63 | + * |
| 64 | + * @param roomIds 待获取详情的聊天室 ID 数组 |
| 65 | + * @param handler 结果回调. 正常返回时 resultObject 类型是 NSArray<JMSGChatRoom> |
| 66 | + * |
| 67 | + * @discussion 该接口总是向服务器端发起请求. |
| 68 | + */ |
| 69 | ++ (void)getChatRoomInfosWithRoomIds:(NSArray *JMSG_NONNULL)roomIds |
| 70 | + completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; |
| 71 | + |
| 72 | +/*! |
| 73 | + * @abstract 加入聊天室 |
| 74 | + * |
| 75 | + * @param roomId 聊天室 id |
| 76 | + * @param handler 结果回调. error = nil 表示加入成功,resultObject 为 JMSGConversation 类型 |
| 77 | + * |
| 78 | + * @discussion 成功进入聊天室之后,会将聊天室中最近若干条聊天记录同步下来并以 onReceiveChatRoomConversation: 事件的形式通知到上层。 |
| 79 | + */ |
| 80 | ++ (void)enterChatRoomWithRoomId:(NSString *JMSG_NONNULL)roomId |
| 81 | + completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; |
| 82 | + |
| 83 | +/*! |
| 84 | + * @abstract 退出聊天室 |
| 85 | + * |
| 86 | + * @param roomId 聊天室 id |
| 87 | + * @param handler 结果回调. error = nil 表示加入成功. |
| 88 | + * |
| 89 | + * @discussion 退出聊天室后获取不到任何消息和通知. |
| 90 | + */ |
| 91 | ++ (void)leaveChatRoomWithRoomId:(NSString *JMSG_NONNULL)roomId |
| 92 | + completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; |
| 93 | + |
| 94 | +///---------------------------------------------------- |
| 95 | +/// @name Group basic fields 群组基本属性 |
| 96 | +///---------------------------------------------------- |
| 97 | + |
| 98 | + |
| 99 | +/*! |
| 100 | + * @abstract 聊天室 id |
| 101 | + */ |
| 102 | +@property(nonatomic, strong, readonly) NSString *JMSG_NONNULL roomID; |
| 103 | +/*! |
| 104 | + * @abstract 名称 |
| 105 | + */ |
| 106 | +@property(nonatomic, strong, readonly) NSString *JMSG_NONNULL name; |
| 107 | +/*! |
| 108 | + * @abstract 聊天室所属应用 AppKey |
| 109 | + */ |
| 110 | +@property(nonatomic, strong, readonly) NSString *JMSG_NONNULL appkey; |
| 111 | +/*! |
| 112 | + * @abstract 描述信息 |
| 113 | + */ |
| 114 | +@property(nonatomic, strong, readonly) NSString *JMSG_NULLABLE desc; |
| 115 | + |
| 116 | +/*! |
| 117 | + * @abstract 聊天室人数 |
| 118 | + */ |
| 119 | +@property(nonatomic, assign, readonly) NSInteger totalMemberCount; |
| 120 | + |
| 121 | +/*! |
| 122 | + * @abstract 聊天室最大人数限制 |
| 123 | + */ |
| 124 | +@property(nonatomic, strong, readonly) NSString *JMSG_NULLABLE maxMemberCount; |
| 125 | + |
| 126 | +/*! |
| 127 | + * @abstract 聊天室的创建时间 |
| 128 | + */ |
| 129 | +@property(nonatomic, strong, readonly) NSNumber *ctime; |
| 130 | + |
| 131 | +/*! |
| 132 | + * @abstract 聊天室创建者 |
| 133 | + * |
| 134 | + * @param handler 结果回调. error = nil 表示获取成功, resultObject 为 JMSGUser 类型. |
| 135 | + */ |
| 136 | +- (void)getChatRoomOwnerInfo:(JMSGCompletionHandler JMSG_NULLABLE)handler; |
| 137 | + |
| 138 | +/*! |
| 139 | + * @abstract 聊天室的展示名 |
| 140 | + * |
| 141 | + * @discussion 如果 chatroom.name 为空, 则此接口会返回 chatroom.roomID. |
| 142 | + */ |
| 143 | +- (NSString *)displayName; |
| 144 | + |
| 145 | +JMSG_ASSUME_NONNULL_END |
| 146 | +@end |
0 commit comments