@barumetric/contracts 1.4.12 → 1.4.13
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,9 +1,9 @@
|
|
|
1
|
-
import type { MessageType } from
|
|
1
|
+
import type { MessageType } from "./message-types";
|
|
2
2
|
/**
|
|
3
|
-
* RMQ
|
|
3
|
+
* RMQ event
|
|
4
4
|
* pattern: `messages.message.send`
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface SendMessageEvent {
|
|
7
7
|
conversationId: string;
|
|
8
8
|
senderId: string;
|
|
9
9
|
text?: string;
|
package/gen/ts/messages.ts
CHANGED
|
@@ -12,68 +12,29 @@ import { Timestamp } from "./google/protobuf/timestamp";
|
|
|
12
12
|
export const protobufPackage = "messages.v1";
|
|
13
13
|
|
|
14
14
|
export enum MessageType {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
UNSPECIFIED = 0,
|
|
16
|
+
TEXT = 1,
|
|
17
|
+
IMAGE = 2,
|
|
18
|
+
FILE = 3,
|
|
19
|
+
VOICE = 4,
|
|
20
|
+
LOCATION = 5,
|
|
21
|
+
SYSTEM = 6,
|
|
22
22
|
UNRECOGNIZED = -1,
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export interface Conversation {
|
|
26
|
-
id: string;
|
|
27
|
-
/** optional */
|
|
28
|
-
listingId: string;
|
|
29
|
-
/** participants */
|
|
30
|
-
sellerId: string;
|
|
31
|
-
buyerId: string;
|
|
32
|
-
lastMessageAt: Timestamp | undefined;
|
|
33
|
-
lastMessageId: string;
|
|
34
|
-
lastMessagePreview: string;
|
|
35
|
-
unreadForSeller: number;
|
|
36
|
-
unreadForBuyer: number;
|
|
37
|
-
createdAt: Timestamp | undefined;
|
|
38
|
-
updatedAt: Timestamp | undefined;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface Message {
|
|
42
|
-
id: string;
|
|
43
|
-
conversationId: string;
|
|
44
|
-
senderId: string;
|
|
45
|
-
text: string;
|
|
46
|
-
type: MessageType;
|
|
47
|
-
imageUrl: string;
|
|
48
|
-
fileUrl: string;
|
|
49
|
-
fileName: string;
|
|
50
|
-
fileSize: number;
|
|
51
|
-
mimeType: string;
|
|
52
|
-
read: boolean;
|
|
53
|
-
readAt: Timestamp | undefined;
|
|
54
|
-
delivered: boolean;
|
|
55
|
-
deliveredAt: Timestamp | undefined;
|
|
56
|
-
replyToIds: string[];
|
|
57
|
-
createdAt: Timestamp | undefined;
|
|
58
|
-
updatedAt: Timestamp | undefined;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** Requests */
|
|
62
25
|
export interface GetConversationsRequest {
|
|
63
26
|
userId: string;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
cursor: string;
|
|
27
|
+
take?: number | undefined;
|
|
28
|
+
skip?: number | undefined;
|
|
67
29
|
}
|
|
68
30
|
|
|
69
31
|
export interface GetConversationsResponse {
|
|
70
32
|
conversations: Conversation[];
|
|
71
|
-
|
|
33
|
+
total: number;
|
|
72
34
|
}
|
|
73
35
|
|
|
74
36
|
export interface GetConversationRequest {
|
|
75
37
|
conversationId: string;
|
|
76
|
-
/** access check */
|
|
77
38
|
userId: string;
|
|
78
39
|
}
|
|
79
40
|
|
|
@@ -82,43 +43,37 @@ export interface GetConversationResponse {
|
|
|
82
43
|
}
|
|
83
44
|
|
|
84
45
|
export interface CreateConversationRequest {
|
|
85
|
-
|
|
86
|
-
buyerId: string;
|
|
87
|
-
/** optional */
|
|
46
|
+
userId: string;
|
|
88
47
|
listingId: string;
|
|
89
48
|
}
|
|
90
49
|
|
|
91
50
|
export interface CreateConversationResponse {
|
|
92
|
-
|
|
51
|
+
id: string;
|
|
93
52
|
}
|
|
94
53
|
|
|
95
54
|
export interface GetMessagesRequest {
|
|
96
55
|
conversationId: string;
|
|
97
|
-
/** access check */
|
|
98
56
|
userId: string;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
cursor: string;
|
|
57
|
+
take?: number | undefined;
|
|
58
|
+
skip?: number | undefined;
|
|
102
59
|
}
|
|
103
60
|
|
|
104
61
|
export interface GetMessagesResponse {
|
|
105
62
|
messages: Message[];
|
|
106
|
-
|
|
63
|
+
total: number;
|
|
107
64
|
}
|
|
108
65
|
|
|
109
66
|
export interface SendMessageRequest {
|
|
110
67
|
conversationId: string;
|
|
111
68
|
senderId: string;
|
|
112
|
-
text
|
|
69
|
+
text?: string | undefined;
|
|
113
70
|
type: MessageType;
|
|
114
|
-
imageUrl
|
|
115
|
-
fileUrl
|
|
116
|
-
fileName
|
|
117
|
-
fileSize
|
|
118
|
-
mimeType
|
|
71
|
+
imageUrl?: string | undefined;
|
|
72
|
+
fileUrl?: string | undefined;
|
|
73
|
+
fileName?: string | undefined;
|
|
74
|
+
fileSize?: number | undefined;
|
|
75
|
+
mimeType?: string | undefined;
|
|
119
76
|
replyToIds: string[];
|
|
120
|
-
/** for idempotency / client-side correlation (optional) */
|
|
121
|
-
clientMessageId: string;
|
|
122
77
|
}
|
|
123
78
|
|
|
124
79
|
export interface SendMessageResponse {
|
|
@@ -138,17 +93,49 @@ export interface MarkAsReadResponse {
|
|
|
138
93
|
|
|
139
94
|
export interface SearchMessagesRequest {
|
|
140
95
|
userId: string;
|
|
141
|
-
/** optional */
|
|
142
96
|
conversationId: string;
|
|
143
97
|
query: string;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
cursor: string;
|
|
98
|
+
take?: number | undefined;
|
|
99
|
+
skip?: number | undefined;
|
|
147
100
|
}
|
|
148
101
|
|
|
149
102
|
export interface SearchMessagesResponse {
|
|
150
103
|
messages: Message[];
|
|
151
|
-
|
|
104
|
+
total: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface Conversation {
|
|
108
|
+
id: string;
|
|
109
|
+
/** optional */
|
|
110
|
+
listingId: string;
|
|
111
|
+
/** participants */
|
|
112
|
+
sellerId: string;
|
|
113
|
+
buyerId: string;
|
|
114
|
+
lastMessageAt?: Timestamp | undefined;
|
|
115
|
+
lastMessageId?: string | undefined;
|
|
116
|
+
lastMessagePreview?: string | undefined;
|
|
117
|
+
unreadForSeller: number;
|
|
118
|
+
unreadForBuyer: number;
|
|
119
|
+
createdAt: Timestamp | undefined;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface Message {
|
|
123
|
+
id: string;
|
|
124
|
+
conversationId: string;
|
|
125
|
+
senderId: string;
|
|
126
|
+
text?: string | undefined;
|
|
127
|
+
type: MessageType;
|
|
128
|
+
imageUrl?: string | undefined;
|
|
129
|
+
fileUrl?: string | undefined;
|
|
130
|
+
fileName?: string | undefined;
|
|
131
|
+
fileSize?: number | undefined;
|
|
132
|
+
mimeType?: string | undefined;
|
|
133
|
+
read: boolean;
|
|
134
|
+
readAt?: Timestamp | undefined;
|
|
135
|
+
delivered: boolean;
|
|
136
|
+
deliveredAt?: Timestamp | undefined;
|
|
137
|
+
replyToIds: string[];
|
|
138
|
+
createdAt: Timestamp | undefined;
|
|
152
139
|
}
|
|
153
140
|
|
|
154
141
|
export const MESSAGES_V1_PACKAGE_NAME = "messages.v1";
|
package/package.json
CHANGED
package/proto/messages.proto
CHANGED
|
@@ -16,75 +16,20 @@ service MessagesService {
|
|
|
16
16
|
rpc SearchMessages(SearchMessagesRequest) returns (SearchMessagesResponse);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
message Conversation {
|
|
20
|
-
string id = 1;
|
|
21
|
-
string listing_id = 2; // optional
|
|
22
|
-
|
|
23
|
-
// participants
|
|
24
|
-
string seller_id = 3;
|
|
25
|
-
string buyer_id = 4;
|
|
26
|
-
|
|
27
|
-
google.protobuf.Timestamp last_message_at = 5;
|
|
28
|
-
string last_message_id = 6;
|
|
29
|
-
string last_message_preview = 7;
|
|
30
|
-
|
|
31
|
-
int32 unread_for_seller = 8;
|
|
32
|
-
int32 unread_for_buyer = 9;
|
|
33
|
-
|
|
34
|
-
google.protobuf.Timestamp created_at = 10;
|
|
35
|
-
google.protobuf.Timestamp updated_at = 11;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
enum MessageType {
|
|
39
|
-
MESSAGE_TYPE_UNSPECIFIED = 0;
|
|
40
|
-
MESSAGE_TYPE_TEXT = 1;
|
|
41
|
-
MESSAGE_TYPE_IMAGE = 2;
|
|
42
|
-
MESSAGE_TYPE_FILE = 3;
|
|
43
|
-
MESSAGE_TYPE_VOICE = 4;
|
|
44
|
-
MESSAGE_TYPE_LOCATION = 5;
|
|
45
|
-
MESSAGE_TYPE_SYSTEM = 6;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
message Message {
|
|
49
|
-
string id = 1;
|
|
50
|
-
string conversation_id = 2;
|
|
51
|
-
string sender_id = 3;
|
|
52
|
-
|
|
53
|
-
string text = 4;
|
|
54
|
-
MessageType type = 5;
|
|
55
|
-
|
|
56
|
-
string image_url = 6;
|
|
57
|
-
string file_url = 7;
|
|
58
|
-
string file_name = 8;
|
|
59
|
-
int64 file_size = 9;
|
|
60
|
-
string mime_type = 10;
|
|
61
|
-
|
|
62
|
-
bool read = 11;
|
|
63
|
-
google.protobuf.Timestamp read_at = 12;
|
|
64
|
-
bool delivered = 13;
|
|
65
|
-
google.protobuf.Timestamp delivered_at = 14;
|
|
66
|
-
|
|
67
|
-
repeated string reply_to_ids = 15;
|
|
68
|
-
|
|
69
|
-
google.protobuf.Timestamp created_at = 16;
|
|
70
|
-
google.protobuf.Timestamp updated_at = 17;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Requests
|
|
74
19
|
message GetConversationsRequest {
|
|
75
20
|
string user_id = 1;
|
|
76
|
-
int32
|
|
77
|
-
|
|
21
|
+
optional int32 take = 2;
|
|
22
|
+
optional int32 skip = 3;
|
|
78
23
|
}
|
|
79
24
|
|
|
80
25
|
message GetConversationsResponse {
|
|
81
26
|
repeated Conversation conversations = 1;
|
|
82
|
-
|
|
27
|
+
int32 total = 2;
|
|
83
28
|
}
|
|
84
29
|
|
|
85
30
|
message GetConversationRequest {
|
|
86
31
|
string conversation_id = 1;
|
|
87
|
-
string user_id = 2;
|
|
32
|
+
string user_id = 2;
|
|
88
33
|
}
|
|
89
34
|
|
|
90
35
|
message GetConversationResponse {
|
|
@@ -92,44 +37,41 @@ message GetConversationResponse {
|
|
|
92
37
|
}
|
|
93
38
|
|
|
94
39
|
message CreateConversationRequest {
|
|
95
|
-
string
|
|
96
|
-
string
|
|
97
|
-
string listing_id = 3; // optional
|
|
40
|
+
string user_id = 1;
|
|
41
|
+
string listing_id = 2;
|
|
98
42
|
}
|
|
99
43
|
|
|
100
44
|
message CreateConversationResponse {
|
|
101
|
-
|
|
45
|
+
string id = 1;
|
|
102
46
|
}
|
|
103
47
|
|
|
104
48
|
message GetMessagesRequest {
|
|
105
49
|
string conversation_id = 1;
|
|
106
|
-
string user_id = 2;
|
|
107
|
-
int32
|
|
108
|
-
|
|
50
|
+
string user_id = 2;
|
|
51
|
+
optional int32 take = 3;
|
|
52
|
+
optional int32 skip = 4;
|
|
109
53
|
}
|
|
110
54
|
|
|
111
55
|
message GetMessagesResponse {
|
|
112
56
|
repeated Message messages = 1;
|
|
113
|
-
|
|
57
|
+
int32 total = 2;
|
|
114
58
|
}
|
|
115
59
|
|
|
116
60
|
message SendMessageRequest {
|
|
117
61
|
string conversation_id = 1;
|
|
118
62
|
string sender_id = 2;
|
|
119
63
|
|
|
120
|
-
string text = 3;
|
|
64
|
+
optional string text = 3;
|
|
121
65
|
MessageType type = 4;
|
|
122
66
|
|
|
123
|
-
string image_url = 5;
|
|
124
|
-
string file_url = 6;
|
|
125
|
-
string file_name = 7;
|
|
126
|
-
int64 file_size = 8;
|
|
127
|
-
string mime_type = 9;
|
|
67
|
+
optional string image_url = 5;
|
|
68
|
+
optional string file_url = 6;
|
|
69
|
+
optional string file_name = 7;
|
|
70
|
+
optional int64 file_size = 8;
|
|
71
|
+
optional string mime_type = 9;
|
|
128
72
|
|
|
129
73
|
repeated string reply_to_ids = 10;
|
|
130
74
|
|
|
131
|
-
// for idempotency / client-side correlation (optional)
|
|
132
|
-
string client_message_id = 11;
|
|
133
75
|
}
|
|
134
76
|
|
|
135
77
|
message SendMessageResponse {
|
|
@@ -148,13 +90,65 @@ message MarkAsReadResponse {
|
|
|
148
90
|
|
|
149
91
|
message SearchMessagesRequest {
|
|
150
92
|
string user_id = 1;
|
|
151
|
-
string conversation_id = 2;
|
|
93
|
+
string conversation_id = 2;
|
|
152
94
|
string query = 3;
|
|
153
|
-
int32
|
|
154
|
-
|
|
95
|
+
optional int32 take = 4;
|
|
96
|
+
optional int32 skip = 5;
|
|
155
97
|
}
|
|
156
98
|
|
|
157
99
|
message SearchMessagesResponse {
|
|
158
100
|
repeated Message messages = 1;
|
|
159
|
-
|
|
101
|
+
int32 total = 2;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
message Conversation {
|
|
105
|
+
string id = 1;
|
|
106
|
+
string listing_id = 2; // optional
|
|
107
|
+
|
|
108
|
+
// participants
|
|
109
|
+
string seller_id = 3;
|
|
110
|
+
string buyer_id = 4;
|
|
111
|
+
|
|
112
|
+
optional google.protobuf.Timestamp last_message_at = 5;
|
|
113
|
+
optional string last_message_id = 6;
|
|
114
|
+
optional string last_message_preview = 7;
|
|
115
|
+
|
|
116
|
+
int32 unread_for_seller = 8;
|
|
117
|
+
int32 unread_for_buyer = 9;
|
|
118
|
+
|
|
119
|
+
google.protobuf.Timestamp created_at = 10;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
message Message {
|
|
123
|
+
string id = 1;
|
|
124
|
+
string conversation_id = 2;
|
|
125
|
+
string sender_id = 3;
|
|
126
|
+
|
|
127
|
+
optional string text = 4;
|
|
128
|
+
MessageType type = 5;
|
|
129
|
+
|
|
130
|
+
optional string image_url = 6;
|
|
131
|
+
optional string file_url = 7;
|
|
132
|
+
optional string file_name = 8;
|
|
133
|
+
optional int64 file_size = 9;
|
|
134
|
+
optional string mime_type = 10;
|
|
135
|
+
|
|
136
|
+
bool read = 11;
|
|
137
|
+
optional google.protobuf.Timestamp read_at = 12;
|
|
138
|
+
bool delivered = 13;
|
|
139
|
+
optional google.protobuf.Timestamp delivered_at = 14;
|
|
140
|
+
|
|
141
|
+
repeated string reply_to_ids = 15;
|
|
142
|
+
|
|
143
|
+
google.protobuf.Timestamp created_at = 16;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
enum MessageType {
|
|
147
|
+
UNSPECIFIED = 0;
|
|
148
|
+
TEXT = 1;
|
|
149
|
+
IMAGE = 2;
|
|
150
|
+
FILE = 3;
|
|
151
|
+
VOICE = 4;
|
|
152
|
+
LOCATION = 5;
|
|
153
|
+
SYSTEM = 6;
|
|
160
154
|
}
|