qing-client 0.0.55 → 0.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import { BaseClient } from "../client/BaseClient";
2
2
  import { ClientConfig, RequestOptions, PaginatedResponse } from "../types";
3
- import { Group, CreateGroupRequest, GroupListQuery } from "../types/im";
3
+ import { Group, CreateGroupRequest, GroupListQuery, RoomMessagesQuery, RoomMessagesResult } from "../types/im";
4
4
  /**
5
- * IM 群组服务 SDK(im-service /api/v1/groups)
5
+ * IM 群组服务 SDK(im-service /api/v1/groups、/api/v1/rooms
6
6
  */
7
7
  export declare class ImService extends BaseClient {
8
8
  constructor(config: ClientConfig);
@@ -16,4 +16,9 @@ export declare class ImService extends BaseClient {
16
16
  * GET /groups
17
17
  */
18
18
  listGroups(query?: GroupListQuery, options?: RequestOptions): Promise<PaginatedResponse<Group>>;
19
+ /**
20
+ * 房间历史消息(消息持久化)
21
+ * GET /rooms/:roomId/messages
22
+ */
23
+ getRoomMessages(roomId: string, query?: RoomMessagesQuery, options?: RequestOptions): Promise<RoomMessagesResult>;
19
24
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ImService = void 0;
4
4
  const BaseClient_1 = require("../client/BaseClient");
5
5
  /**
6
- * IM 群组服务 SDK(im-service /api/v1/groups)
6
+ * IM 群组服务 SDK(im-service /api/v1/groups、/api/v1/rooms
7
7
  */
8
8
  class ImService extends BaseClient_1.BaseClient {
9
9
  constructor(config) {
@@ -31,5 +31,16 @@ class ImService extends BaseClient_1.BaseClient {
31
31
  params: query,
32
32
  });
33
33
  }
34
+ /**
35
+ * 房间历史消息(消息持久化)
36
+ * GET /rooms/:roomId/messages
37
+ */
38
+ async getRoomMessages(roomId, query, options) {
39
+ return this.request(`/rooms/${encodeURIComponent(roomId)}/messages`, {
40
+ ...options,
41
+ method: "GET",
42
+ params: query,
43
+ });
44
+ }
34
45
  }
35
46
  exports.ImService = ImService;
package/lib/types/im.d.ts CHANGED
@@ -26,3 +26,33 @@ export interface GroupListResult {
26
26
  total_pages: number;
27
27
  };
28
28
  }
29
+ /** 房间历史消息单条(GET /api/v1/rooms/:roomId/messages) */
30
+ export interface RoomMessage {
31
+ id: string;
32
+ roomId: string;
33
+ sender: {
34
+ user_id?: number;
35
+ client_id?: string;
36
+ };
37
+ content: string;
38
+ type: string;
39
+ ts: number;
40
+ createdAt: string;
41
+ }
42
+ /** 房间历史消息查询参数 */
43
+ export interface RoomMessagesQuery {
44
+ page?: number;
45
+ pageSize?: number;
46
+ beforeTs?: number;
47
+ }
48
+ /** 房间历史消息接口返回 */
49
+ export interface RoomMessagesResult {
50
+ success: boolean;
51
+ data: RoomMessage[];
52
+ pagination: {
53
+ page: number;
54
+ pageSize: number;
55
+ total: number;
56
+ totalPages: number;
57
+ };
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qing-client",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {