mezon-js 2.8.31 → 2.8.33
Sign up to get free protection for your applications and to get access to all the features.
- package/api/api.ts +19515 -0
- package/api.gen.ts +36 -0
- package/dist/api.gen.d.ts +27 -0
- package/dist/mezon-js.cjs.js +3 -3
- package/dist/mezon-js.esm.mjs +3 -3
- package/dist/socket.d.ts +12 -103
- package/google/protobuf/timestamp.ts +220 -0
- package/google/protobuf/wrappers.ts +626 -0
- package/package.json +1 -1
- package/rtapi/realtime.ts +6670 -0
- package/socket.ts +16 -157
package/api.gen.ts
CHANGED
@@ -523,6 +523,8 @@ export interface ApiChannelMessage {
|
|
523
523
|
update_time_ms?: number;
|
524
524
|
//The username of the message sender, if any.
|
525
525
|
username?: string;
|
526
|
+
// channel mode
|
527
|
+
mode?: number;
|
526
528
|
}
|
527
529
|
|
528
530
|
/** */
|
@@ -948,6 +950,16 @@ export interface ApiMessageAttachment {
|
|
948
950
|
url?: string;
|
949
951
|
//
|
950
952
|
width?: number;
|
953
|
+
/** The channel this message belongs to. */
|
954
|
+
channel_id:string;
|
955
|
+
// The mode
|
956
|
+
mode: number;
|
957
|
+
// The channel label
|
958
|
+
channel_label: string;
|
959
|
+
/** The message that user react */
|
960
|
+
message_id: string;
|
961
|
+
/** Message sender, usually a user ID. */
|
962
|
+
sender_id: string;
|
951
963
|
}
|
952
964
|
|
953
965
|
/** */
|
@@ -976,6 +988,16 @@ export interface ApiMessageMention {
|
|
976
988
|
s?: number;
|
977
989
|
// end position
|
978
990
|
e?: number;
|
991
|
+
/** The channel this message belongs to. */
|
992
|
+
channel_id:string;
|
993
|
+
// The mode
|
994
|
+
mode: number;
|
995
|
+
// The channel label
|
996
|
+
channel_label: string;
|
997
|
+
/** The message that user react */
|
998
|
+
message_id: string;
|
999
|
+
/** Message sender, usually a user ID. */
|
1000
|
+
sender_id: string;
|
979
1001
|
}
|
980
1002
|
|
981
1003
|
/** */
|
@@ -996,6 +1018,14 @@ export interface ApiMessageReaction {
|
|
996
1018
|
sender_avatar?: string;
|
997
1019
|
// count of emoji
|
998
1020
|
count: number;
|
1021
|
+
/** The channel this message belongs to. */
|
1022
|
+
channel_id:string;
|
1023
|
+
// The mode
|
1024
|
+
mode: number;
|
1025
|
+
// The channel label
|
1026
|
+
channel_label: string;
|
1027
|
+
/** The message that user react */
|
1028
|
+
message_id: string;
|
999
1029
|
}
|
1000
1030
|
|
1001
1031
|
/** */
|
@@ -1020,6 +1050,12 @@ export interface ApiMessageRef {
|
|
1020
1050
|
content?:string;
|
1021
1051
|
//
|
1022
1052
|
has_attachment: boolean;
|
1053
|
+
/** The channel this message belongs to. */
|
1054
|
+
channel_id:string;
|
1055
|
+
// The mode
|
1056
|
+
mode: number;
|
1057
|
+
// The channel label
|
1058
|
+
channel_label: string;
|
1023
1059
|
}
|
1024
1060
|
|
1025
1061
|
/** A notification in the server. */
|
package/dist/api.gen.d.ts
CHANGED
@@ -299,6 +299,7 @@ export interface ApiChannelMessage {
|
|
299
299
|
update_time?: string;
|
300
300
|
update_time_ms?: number;
|
301
301
|
username?: string;
|
302
|
+
mode?: number;
|
302
303
|
}
|
303
304
|
/** */
|
304
305
|
export interface ApiChannelMessageHeader {
|
@@ -545,6 +546,14 @@ export interface ApiMessageAttachment {
|
|
545
546
|
size?: number;
|
546
547
|
url?: string;
|
547
548
|
width?: number;
|
549
|
+
/** The channel this message belongs to. */
|
550
|
+
channel_id: string;
|
551
|
+
mode: number;
|
552
|
+
channel_label: string;
|
553
|
+
/** The message that user react */
|
554
|
+
message_id: string;
|
555
|
+
/** Message sender, usually a user ID. */
|
556
|
+
sender_id: string;
|
548
557
|
}
|
549
558
|
/** */
|
550
559
|
export interface ApiMessageDeleted {
|
@@ -561,6 +570,14 @@ export interface ApiMessageMention {
|
|
561
570
|
rolename?: string;
|
562
571
|
s?: number;
|
563
572
|
e?: number;
|
573
|
+
/** The channel this message belongs to. */
|
574
|
+
channel_id: string;
|
575
|
+
mode: number;
|
576
|
+
channel_label: string;
|
577
|
+
/** The message that user react */
|
578
|
+
message_id: string;
|
579
|
+
/** Message sender, usually a user ID. */
|
580
|
+
sender_id: string;
|
564
581
|
}
|
565
582
|
/** */
|
566
583
|
export interface ApiMessageReaction {
|
@@ -572,6 +589,12 @@ export interface ApiMessageReaction {
|
|
572
589
|
sender_name?: string;
|
573
590
|
sender_avatar?: string;
|
574
591
|
count: number;
|
592
|
+
/** The channel this message belongs to. */
|
593
|
+
channel_id: string;
|
594
|
+
mode: number;
|
595
|
+
channel_label: string;
|
596
|
+
/** The message that user react */
|
597
|
+
message_id: string;
|
575
598
|
}
|
576
599
|
/** */
|
577
600
|
export interface ApiMessageRef {
|
@@ -585,6 +608,10 @@ export interface ApiMessageRef {
|
|
585
608
|
message_sender_display_name?: string;
|
586
609
|
content?: string;
|
587
610
|
has_attachment: boolean;
|
611
|
+
/** The channel this message belongs to. */
|
612
|
+
channel_id: string;
|
613
|
+
mode: number;
|
614
|
+
channel_label: string;
|
588
615
|
}
|
589
616
|
/** A notification in the server. */
|
590
617
|
export interface ApiNotification {
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -4805,7 +4805,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4805
4805
|
clan_id: message.channel_message.clan_id,
|
4806
4806
|
code: message.channel_message.code,
|
4807
4807
|
create_time: message.channel_message.create_time,
|
4808
|
-
|
4808
|
+
message_id: message.channel_message.message_id,
|
4809
4809
|
sender_id: message.channel_message.sender_id,
|
4810
4810
|
update_time: message.channel_message.update_time,
|
4811
4811
|
clan_logo: message.channel_message.clan_logo,
|
@@ -5223,9 +5223,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5223
5223
|
return response.notification_clan_setting_event;
|
5224
5224
|
});
|
5225
5225
|
}
|
5226
|
-
getNotificationReactMessage(
|
5226
|
+
getNotificationReactMessage(channel_id) {
|
5227
5227
|
return __async(this, null, function* () {
|
5228
|
-
const response = yield this.send({ notifi_react_message_event: {
|
5228
|
+
const response = yield this.send({ notifi_react_message_event: { channel_id } });
|
5229
5229
|
return response.notifi_react_message_event;
|
5230
5230
|
});
|
5231
5231
|
}
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -4776,7 +4776,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4776
4776
|
clan_id: message.channel_message.clan_id,
|
4777
4777
|
code: message.channel_message.code,
|
4778
4778
|
create_time: message.channel_message.create_time,
|
4779
|
-
|
4779
|
+
message_id: message.channel_message.message_id,
|
4780
4780
|
sender_id: message.channel_message.sender_id,
|
4781
4781
|
update_time: message.channel_message.update_time,
|
4782
4782
|
clan_logo: message.channel_message.clan_logo,
|
@@ -5194,9 +5194,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5194
5194
|
return response.notification_clan_setting_event;
|
5195
5195
|
});
|
5196
5196
|
}
|
5197
|
-
getNotificationReactMessage(
|
5197
|
+
getNotificationReactMessage(channel_id) {
|
5198
5198
|
return __async(this, null, function* () {
|
5199
|
-
const response = yield this.send({ notifi_react_message_event: {
|
5199
|
+
const response = yield this.send({ notifi_react_message_event: { channel_id } });
|
5200
5200
|
return response.notifi_react_message_event;
|
5201
5201
|
});
|
5202
5202
|
}
|
package/dist/socket.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiRpc } from "./api.gen";
|
16
|
+
import { ApiChannelMessage, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiRpc } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Notification } from "./client";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -114,71 +114,6 @@ export interface LastSeenMessageEvent {
|
|
114
114
|
/** The unique ID of this message. */
|
115
115
|
message_id: string;
|
116
116
|
}
|
117
|
-
/** User is react to message */
|
118
|
-
export interface MessageReactionEvent {
|
119
|
-
id: string;
|
120
|
-
/** The channel this message belongs to. */
|
121
|
-
channel_id: string;
|
122
|
-
mode: number;
|
123
|
-
channel_label: string;
|
124
|
-
/** The message that user react */
|
125
|
-
message_id: string;
|
126
|
-
/** Message sender, usually a user ID. */
|
127
|
-
sender_id: string;
|
128
|
-
sender_name?: string;
|
129
|
-
sender_avatar?: string;
|
130
|
-
/** Emoji id. */
|
131
|
-
emoji_id: string;
|
132
|
-
/** Emoji shortname. */
|
133
|
-
emoji: string;
|
134
|
-
count: number;
|
135
|
-
action: boolean;
|
136
|
-
}
|
137
|
-
/** User is react to message */
|
138
|
-
export interface MessageMentionEvent {
|
139
|
-
/** The channel this message belongs to. */
|
140
|
-
channel_id: string;
|
141
|
-
mode: number;
|
142
|
-
channel_label: string;
|
143
|
-
/** The message that user react */
|
144
|
-
message_id: string;
|
145
|
-
/** Message sender, usually a user ID. */
|
146
|
-
sender_id: string;
|
147
|
-
user_id: string;
|
148
|
-
username: string;
|
149
|
-
s?: number;
|
150
|
-
e?: number;
|
151
|
-
}
|
152
|
-
/** User is react to message */
|
153
|
-
export interface MessageAttachmentEvent {
|
154
|
-
/** The channel this message belongs to. */
|
155
|
-
channel_id: string;
|
156
|
-
mode: number;
|
157
|
-
channel_label: string;
|
158
|
-
/** The message that user react */
|
159
|
-
message_id: string;
|
160
|
-
/** Message sender, usually a user ID. */
|
161
|
-
sender_id: string;
|
162
|
-
filename: string;
|
163
|
-
size: number;
|
164
|
-
url: string;
|
165
|
-
filetype: string;
|
166
|
-
width?: number;
|
167
|
-
height?: number;
|
168
|
-
}
|
169
|
-
/** User is delete to message */
|
170
|
-
export interface MessageRefEvent {
|
171
|
-
/** The channel this message belongs to. */
|
172
|
-
channel_id: string;
|
173
|
-
mode: number;
|
174
|
-
channel_label: string;
|
175
|
-
/** The message that user react */
|
176
|
-
message_id: string;
|
177
|
-
/** Message reference ID. */
|
178
|
-
message_ref_id: string;
|
179
|
-
/** reference type */
|
180
|
-
ref_type: number;
|
181
|
-
}
|
182
117
|
/** User is typing */
|
183
118
|
export interface MessageTypingEvent {
|
184
119
|
/** The channel this message belongs to. */
|
@@ -196,32 +131,6 @@ export interface UserProfileUpdatedEvent {
|
|
196
131
|
channel_id: string;
|
197
132
|
clan_id: string;
|
198
133
|
}
|
199
|
-
/** An incoming message on a realtime chat channel. */
|
200
|
-
export interface ChannelMessageEvent {
|
201
|
-
avatar?: string;
|
202
|
-
channel_id: string;
|
203
|
-
mode: number;
|
204
|
-
channel_label: string;
|
205
|
-
clan_id?: string;
|
206
|
-
code: number;
|
207
|
-
content: string;
|
208
|
-
create_time: string;
|
209
|
-
id: string;
|
210
|
-
persistent?: boolean;
|
211
|
-
sender_id: string;
|
212
|
-
update_time: string;
|
213
|
-
clan_logo: string;
|
214
|
-
category_name: string;
|
215
|
-
username: string;
|
216
|
-
clan_nick: string;
|
217
|
-
clan_avatar: string;
|
218
|
-
display_name: string;
|
219
|
-
reactions?: Array<ApiMessageReaction>;
|
220
|
-
mentions?: Array<ApiMessageMention>;
|
221
|
-
attachments?: Array<ApiMessageAttachment>;
|
222
|
-
references?: Array<ApiMessageRef>;
|
223
|
-
referenced_message?: ChannelMessageEvent;
|
224
|
-
}
|
225
134
|
/** An acknowledgement received in response to sending a message on a chat channel. */
|
226
135
|
export interface ChannelMessageAck {
|
227
136
|
/** The server-assigned channel ID. */
|
@@ -251,8 +160,8 @@ interface ChannelMessageSend {
|
|
251
160
|
channel_label: string;
|
252
161
|
/** The content payload. */
|
253
162
|
content: any;
|
254
|
-
mentions?: Array<
|
255
|
-
attachments?: Array<
|
163
|
+
mentions?: Array<ApiMessageMention>;
|
164
|
+
attachments?: Array<ApiMessageAttachment>;
|
256
165
|
anonymous_message?: boolean;
|
257
166
|
mention_everyone?: boolean;
|
258
167
|
avatar: string;
|
@@ -269,9 +178,9 @@ interface ChannelMessageUpdate {
|
|
269
178
|
/** The content payload. */
|
270
179
|
content: any;
|
271
180
|
/** mentions */
|
272
|
-
mentions?: Array<
|
181
|
+
mentions?: Array<ApiMessageMention>;
|
273
182
|
/** attachments */
|
274
|
-
attachments?: Array<
|
183
|
+
attachments?: Array<ApiMessageAttachment>;
|
275
184
|
/** The mode payload. */
|
276
185
|
mode: number;
|
277
186
|
};
|
@@ -564,7 +473,7 @@ export interface Socket {
|
|
564
473
|
/** Send message typing */
|
565
474
|
writeMessageTyping(clan_id: string, channel_id: string, mode: number): Promise<MessageTypingEvent>;
|
566
475
|
/** Send message reaction */
|
567
|
-
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<
|
476
|
+
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction>;
|
568
477
|
/** Send last seen message */
|
569
478
|
writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
|
570
479
|
/** Send last pin message */
|
@@ -596,11 +505,11 @@ export interface Socket {
|
|
596
505
|
onheartbeattimeout: () => void;
|
597
506
|
oncustomstatus: (statusEvent: CustomStatusEvent) => void;
|
598
507
|
/** Receive channel message. */
|
599
|
-
onchannelmessage: (channelMessage:
|
508
|
+
onchannelmessage: (channelMessage: ApiChannelMessage) => void;
|
600
509
|
/** Receive typing event */
|
601
510
|
onmessagetyping: (messageTypingEvent: MessageTypingEvent) => void;
|
602
511
|
/** Receive reaction event */
|
603
|
-
onmessagereaction: (messageReactionEvent:
|
512
|
+
onmessagereaction: (messageReactionEvent: ApiMessageReaction) => void;
|
604
513
|
/** Receive channel presence updates. */
|
605
514
|
onchannelpresence: (channelPresence: ChannelPresenceEvent) => void;
|
606
515
|
/** pin message event */
|
@@ -665,8 +574,8 @@ export declare class DefaultSocket implements Socket {
|
|
665
574
|
ondisconnect(evt: Event): void;
|
666
575
|
onerror(evt: Event): void;
|
667
576
|
onmessagetyping(messagetyping: MessageTypingEvent): void;
|
668
|
-
onmessagereaction(messagereaction:
|
669
|
-
onchannelmessage(channelMessage:
|
577
|
+
onmessagereaction(messagereaction: ApiMessageReaction): void;
|
578
|
+
onchannelmessage(channelMessage: ApiChannelMessage): void;
|
670
579
|
onchannelpresence(channelPresence: ChannelPresenceEvent): void;
|
671
580
|
onuserchanneladded(user: UserChannelAddedEvent): void;
|
672
581
|
onuserprofileupdate(user: UserProfileUpdatedEvent): void;
|
@@ -701,7 +610,7 @@ export declare class DefaultSocket implements Socket {
|
|
701
610
|
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>): Promise<ChannelMessageAck>;
|
702
611
|
updateStatus(status?: string): Promise<void>;
|
703
612
|
writeChatMessage(clan_id: string, channel_id: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, avatar?: string): Promise<ChannelMessageAck>;
|
704
|
-
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<
|
613
|
+
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction>;
|
705
614
|
writeMessageTyping(clan_id: string, channel_id: string, mode: number): Promise<MessageTypingEvent>;
|
706
615
|
writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
|
707
616
|
writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string, operation: number): Promise<LastPinMessageEvent>;
|
@@ -716,7 +625,7 @@ export declare class DefaultSocket implements Socket {
|
|
716
625
|
getNotificationChannelSetting(channel_id: string): Promise<NotificationChannelSettingEvent>;
|
717
626
|
getNotificationCategorySetting(category_id: string): Promise<NotificationCategorySettingEvent>;
|
718
627
|
getNotificationClanSetting(clan_id: string): Promise<NotificationClanSettingEvent>;
|
719
|
-
getNotificationReactMessage(
|
628
|
+
getNotificationReactMessage(channel_id: string): Promise<NotifiReactMessageEvent>;
|
720
629
|
private pingPong;
|
721
630
|
}
|
722
631
|
export {};
|
@@ -0,0 +1,220 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
import Long from "long";
|
3
|
+
import _m0 from "protobufjs/minimal";
|
4
|
+
|
5
|
+
export const protobufPackage = "google.protobuf";
|
6
|
+
|
7
|
+
/**
|
8
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
9
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
10
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
11
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
12
|
+
* Gregorian calendar backwards to year one.
|
13
|
+
*
|
14
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
15
|
+
* second table is needed for interpretation, using a [24-hour linear
|
16
|
+
* smear](https://developers.google.com/time/smear).
|
17
|
+
*
|
18
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
19
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
20
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
21
|
+
*
|
22
|
+
* # Examples
|
23
|
+
*
|
24
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
25
|
+
*
|
26
|
+
* Timestamp timestamp;
|
27
|
+
* timestamp.set_seconds(time(NULL));
|
28
|
+
* timestamp.set_nanos(0);
|
29
|
+
*
|
30
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
31
|
+
*
|
32
|
+
* struct timeval tv;
|
33
|
+
* gettimeofday(&tv, NULL);
|
34
|
+
*
|
35
|
+
* Timestamp timestamp;
|
36
|
+
* timestamp.set_seconds(tv.tv_sec);
|
37
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
38
|
+
*
|
39
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
40
|
+
*
|
41
|
+
* FILETIME ft;
|
42
|
+
* GetSystemTimeAsFileTime(&ft);
|
43
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
44
|
+
*
|
45
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
46
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
47
|
+
* Timestamp timestamp;
|
48
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
49
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
50
|
+
*
|
51
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
52
|
+
*
|
53
|
+
* long millis = System.currentTimeMillis();
|
54
|
+
*
|
55
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
56
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
57
|
+
*
|
58
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
59
|
+
*
|
60
|
+
* Instant now = Instant.now();
|
61
|
+
*
|
62
|
+
* Timestamp timestamp =
|
63
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
64
|
+
* .setNanos(now.getNano()).build();
|
65
|
+
*
|
66
|
+
* Example 6: Compute Timestamp from current time in Python.
|
67
|
+
*
|
68
|
+
* timestamp = Timestamp()
|
69
|
+
* timestamp.GetCurrentTime()
|
70
|
+
*
|
71
|
+
* # JSON Mapping
|
72
|
+
*
|
73
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
74
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
75
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
76
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
77
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
78
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
79
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
80
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
81
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
82
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
83
|
+
*
|
84
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
85
|
+
* 01:30 UTC on January 15, 2017.
|
86
|
+
*
|
87
|
+
* In JavaScript, one can convert a Date object to this format using the
|
88
|
+
* standard
|
89
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
90
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
91
|
+
* to this format using
|
92
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
93
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
94
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
95
|
+
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
96
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
97
|
+
*/
|
98
|
+
export interface Timestamp {
|
99
|
+
/**
|
100
|
+
* Represents seconds of UTC time since Unix epoch
|
101
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
102
|
+
* 9999-12-31T23:59:59Z inclusive.
|
103
|
+
*/
|
104
|
+
seconds: number;
|
105
|
+
/**
|
106
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
107
|
+
* second values with fractions must still have non-negative nanos values
|
108
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
109
|
+
* inclusive.
|
110
|
+
*/
|
111
|
+
nanos: number;
|
112
|
+
}
|
113
|
+
|
114
|
+
function createBaseTimestamp(): Timestamp {
|
115
|
+
return { seconds: 0, nanos: 0 };
|
116
|
+
}
|
117
|
+
|
118
|
+
export const Timestamp = {
|
119
|
+
encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
120
|
+
if (message.seconds !== 0) {
|
121
|
+
writer.uint32(8).int64(message.seconds);
|
122
|
+
}
|
123
|
+
if (message.nanos !== 0) {
|
124
|
+
writer.uint32(16).int32(message.nanos);
|
125
|
+
}
|
126
|
+
return writer;
|
127
|
+
},
|
128
|
+
|
129
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {
|
130
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
131
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
132
|
+
const message = createBaseTimestamp();
|
133
|
+
while (reader.pos < end) {
|
134
|
+
const tag = reader.uint32();
|
135
|
+
switch (tag >>> 3) {
|
136
|
+
case 1:
|
137
|
+
message.seconds = longToNumber(reader.int64() as Long);
|
138
|
+
break;
|
139
|
+
case 2:
|
140
|
+
message.nanos = reader.int32();
|
141
|
+
break;
|
142
|
+
default:
|
143
|
+
reader.skipType(tag & 7);
|
144
|
+
break;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
return message;
|
148
|
+
},
|
149
|
+
|
150
|
+
fromJSON(object: any): Timestamp {
|
151
|
+
return {
|
152
|
+
seconds: isSet(object.seconds) ? Number(object.seconds) : 0,
|
153
|
+
nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
|
154
|
+
};
|
155
|
+
},
|
156
|
+
|
157
|
+
toJSON(message: Timestamp): unknown {
|
158
|
+
const obj: any = {};
|
159
|
+
message.seconds !== undefined && (obj.seconds = Math.round(message.seconds));
|
160
|
+
message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
|
161
|
+
return obj;
|
162
|
+
},
|
163
|
+
|
164
|
+
create<I extends Exact<DeepPartial<Timestamp>, I>>(base?: I): Timestamp {
|
165
|
+
return Timestamp.fromPartial(base ?? {});
|
166
|
+
},
|
167
|
+
|
168
|
+
fromPartial<I extends Exact<DeepPartial<Timestamp>, I>>(object: I): Timestamp {
|
169
|
+
const message = createBaseTimestamp();
|
170
|
+
message.seconds = object.seconds ?? 0;
|
171
|
+
message.nanos = object.nanos ?? 0;
|
172
|
+
return message;
|
173
|
+
},
|
174
|
+
};
|
175
|
+
|
176
|
+
declare var self: any | undefined;
|
177
|
+
declare var window: any | undefined;
|
178
|
+
declare var global: any | undefined;
|
179
|
+
var tsProtoGlobalThis: any = (() => {
|
180
|
+
if (typeof globalThis !== "undefined") {
|
181
|
+
return globalThis;
|
182
|
+
}
|
183
|
+
if (typeof self !== "undefined") {
|
184
|
+
return self;
|
185
|
+
}
|
186
|
+
if (typeof window !== "undefined") {
|
187
|
+
return window;
|
188
|
+
}
|
189
|
+
if (typeof global !== "undefined") {
|
190
|
+
return global;
|
191
|
+
}
|
192
|
+
throw "Unable to locate global object";
|
193
|
+
})();
|
194
|
+
|
195
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
196
|
+
|
197
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
198
|
+
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
199
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
200
|
+
: Partial<T>;
|
201
|
+
|
202
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
203
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
204
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
205
|
+
|
206
|
+
function longToNumber(long: Long): number {
|
207
|
+
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
208
|
+
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
209
|
+
}
|
210
|
+
return long.toNumber();
|
211
|
+
}
|
212
|
+
|
213
|
+
if (_m0.util.Long !== Long) {
|
214
|
+
_m0.util.Long = Long as any;
|
215
|
+
_m0.configure();
|
216
|
+
}
|
217
|
+
|
218
|
+
function isSet(value: any): boolean {
|
219
|
+
return value !== null && value !== undefined;
|
220
|
+
}
|