@daocloud-proto/ghippo 0.5.3 → 0.5.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daocloud-proto/ghippo",
3
- "version": "0.5.3",
3
+ "version":"0.5.4",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC"
@@ -5,10 +5,17 @@
5
5
  */
6
6
 
7
7
  import * as fm from "../fetch.pb"
8
+
9
+ export enum ReadType {
10
+ all = "all",
11
+ read = "read",
12
+ unread = "unread",
13
+ }
14
+
8
15
  export type ListMessagesRequest = {
9
- isCount?: boolean
16
+ unreadCount?: boolean
10
17
  search?: string
11
- read?: string
18
+ read?: ReadType
12
19
  offset?: number
13
20
  size?: number
14
21
  }
@@ -23,14 +30,23 @@ export type MessageInfo = {
23
30
  type?: string
24
31
  subject?: string
25
32
  message?: string
26
- read?: string
27
- create_at?: string
33
+ read?: ReadType
34
+ created_at?: string
28
35
  }
29
36
 
30
37
  export type GetMessageRequest = {
31
38
  id?: number
32
39
  }
33
40
 
41
+ export type ToggleUnreadMessageRequest = {
42
+ id?: number
43
+ next?: boolean
44
+ }
45
+
46
+ export type ToggleUnreadMessageResponse = {
47
+ message?: MessageInfo
48
+ }
49
+
34
50
  export type GetMessageResponse = {
35
51
  message?: MessageInfo
36
52
  }
@@ -43,6 +59,7 @@ export type DeleteMessagesResponse = {
43
59
  }
44
60
 
45
61
  export type SetReadMessagesRequest = {
62
+ all?: boolean
46
63
  ids?: number[]
47
64
  }
48
65
 
@@ -56,10 +73,13 @@ export class Message {
56
73
  static GetMessage(req: GetMessageRequest, initReq?: fm.InitReq): Promise<GetMessageResponse> {
57
74
  return fm.fetchReq<GetMessageRequest, GetMessageResponse>(`/apis/ghippo.io/v1alpha1/messages/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
58
75
  }
76
+ static ToggleUnreadMessage(req: ToggleUnreadMessageRequest, initReq?: fm.InitReq): Promise<ToggleUnreadMessageResponse> {
77
+ return fm.fetchReq<ToggleUnreadMessageRequest, ToggleUnreadMessageResponse>(`/apis/ghippo.io/v1alpha1/messages/toggle-unread?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
78
+ }
59
79
  static DeleteMessages(req: DeleteMessagesRequest, initReq?: fm.InitReq): Promise<DeleteMessagesResponse> {
60
80
  return fm.fetchReq<DeleteMessagesRequest, DeleteMessagesResponse>(`/apis/ghippo.io/v1alpha1/messages`, {...initReq, method: "DELETE"})
61
81
  }
62
82
  static SetReadMessages(req: SetReadMessagesRequest, initReq?: fm.InitReq): Promise<SetReadMessagesResponse> {
63
- return fm.fetchReq<SetReadMessagesRequest, SetReadMessagesResponse>(`/apis/ghippo.io/v1alpha1/messages`, {...initReq, method: "PUT"})
83
+ return fm.fetchReq<SetReadMessagesRequest, SetReadMessagesResponse>(`/apis/ghippo.io/v1alpha1/read-messages`, {...initReq, method: "POST", body: JSON.stringify(req)})
64
84
  }
65
85
  }