fetchPinnedConversations method

  1. @Deprecated('Use [fetchConversationsByOptions] instead')
Future<ChatCursorResult<ChatConversation>> fetchPinnedConversations({
  1. String? cursor,
  2. int pageSize = 20,
})

~english Gets the list of pinned conversations from the server with pagination.

The SDK returns the pinned conversations in the reverse chronological order of their pinning.

Param cursor The position from which to start getting data. If this parameter is not set, the SDK retrieves conversations from the latest pinned one.

Param pageSize The number of conversations that you expect to get on each page. The value range is 1,50.

Return The pinned conversation list of the current user.

Throws A description of the exception. See ChatError. ~end

~chinese 分页从服务器获取置顶会话。

SDK 按照会话的置顶时间的倒序返回会话列表。

Param cursor 查询的开始位置,如不传, SDK 从最新置顶的会话开始查询。

Param pageSize 每页期望返回的会话数量。取值范围为 1,50

Return 当前用户的置顶会话列表。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end

Implementation

@Deprecated('Use [fetchConversationsByOptions] instead')

/// ~english
/// Gets the list of pinned conversations from the server with pagination.
///
/// The SDK returns the pinned conversations in the reverse chronological order of their pinning.
///
/// Param [cursor] The position from which to start getting data. If this parameter is not set, the SDK retrieves conversations from the latest pinned one.
///
/// Param [pageSize] The number of conversations that you expect to get on each page. The value range is [1,50].
///
/// **Return** The pinned conversation list of the current user.
///
/// **Throws** A description of the exception. See [ChatError].
/// ~end
///
/// ~chinese
/// 分页从服务器获取置顶会话。
///
/// SDK 按照会话的置顶时间的倒序返回会话列表。
///
/// Param [cursor] 查询的开始位置,如不传, SDK 从最新置顶的会话开始查询。
///
/// Param [pageSize] 每页期望返回的会话数量。取值范围为 [1,50]。
///
/// **Return** 当前用户的置顶会话列表。
///
/// **Throws**  如果有异常会在这里抛出,包含错误码和错误描述,详见 [ChatError]。
/// ~end
Future<ChatCursorResult<ChatConversation>> fetchPinnedConversations({
  String? cursor,
  int pageSize = 20,
}) async {
  Map map = {
    "pageSize": pageSize,
  };
  map.putIfNotNull('cursor', cursor);
  Map result = await ChatChannel.invokeMethod(
    ChatMethodKeys.getPinnedConversationsFromServerWithCursor,
    map,
  );
  try {
    ChatError.hasErrorFromResult(result);
    return ChatCursorResult.fromJson(
        result[ChatMethodKeys.getPinnedConversationsFromServerWithCursor],
        dataItemCallback: (map) {
      return ChatConversation.fromJson(map);
    });
  } on ChatError catch (e) {
    throw e;
  }
}