@miradorlabs/web-grpc 3.48.0 → 3.49.0

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.
@@ -0,0 +1,772 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.18.3
4
+ // protoc v3.21.12
5
+ // source: proto/gateway/web/v1/notification_gateway.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { Metadata } from "@grpc/grpc-js";
10
+ import { Timestamp } from "../../../../google/protobuf/timestamp";
11
+ import { ResponseStatus } from "../../common/v1/status";
12
+
13
+ export const protobufPackage = "gateway.web.v1";
14
+
15
+ export const protobufFileName = "proto/gateway/web/v1/notification_gateway.proto";
16
+
17
+ export interface ListAlertsRequest {
18
+ organizationId: string;
19
+ /** 0 is the default (20); above 100 is capped at 100; negative is a validation error. */
20
+ pageSize: number;
21
+ /** Opaque: a prior response's next_page_token; empty starts at the newest alert. Malformed is a validation error. */
22
+ pageToken: string;
23
+ }
24
+
25
+ export interface ListAlertsResponse {
26
+ status: ResponseStatus | undefined;
27
+ alerts: NotificationAlert[];
28
+ /** Empty at the end. */
29
+ nextPageToken: string;
30
+ /** How many of the organization's alerts, over every page, the member has not read. */
31
+ unreadCount: number;
32
+ }
33
+
34
+ export interface NotificationAlert {
35
+ alertId: string;
36
+ /** An open set ("daily_digest" first): clients must tolerate a kind they do not know. */
37
+ kind: string;
38
+ title: string;
39
+ body: string;
40
+ /** An in-app path, such as /usage?day=2026-10-26. */
41
+ linkPath: string;
42
+ /** When the fact the alert reports became complete (a daily digest: the end of its UTC day). */
43
+ occurredAt: Date | undefined;
44
+ read: boolean;
45
+ }
46
+
47
+ export interface MarkAlertsReadRequest {
48
+ organizationId: string;
49
+ /**
50
+ * Exactly one of alert_ids and all is required. At most 100 ids; duplicates count once. Every id must be one of the
51
+ * organization's alerts, or the call is STATUS_CODE_NOT_FOUND and marks nothing.
52
+ */
53
+ alertIds: string[];
54
+ /** Marks every alert the organization has when the call runs; an alert that arrives later stays unread. */
55
+ all: boolean;
56
+ }
57
+
58
+ export interface MarkAlertsReadResponse {
59
+ status: ResponseStatus | undefined;
60
+ unreadCount: number;
61
+ }
62
+
63
+ function createBaseListAlertsRequest(): ListAlertsRequest {
64
+ return { organizationId: "", pageSize: 0, pageToken: "" };
65
+ }
66
+
67
+ export const ListAlertsRequest: MessageFns<ListAlertsRequest> = {
68
+ encode(message: ListAlertsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
69
+ if (message.organizationId !== "") {
70
+ writer.uint32(10).string(message.organizationId);
71
+ }
72
+ if (message.pageSize !== 0) {
73
+ writer.uint32(16).int32(message.pageSize);
74
+ }
75
+ if (message.pageToken !== "") {
76
+ writer.uint32(26).string(message.pageToken);
77
+ }
78
+ return writer;
79
+ },
80
+
81
+ decode(input: BinaryReader | Uint8Array, length?: number): ListAlertsRequest {
82
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
83
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
84
+ if (previousRecursionDepth >= 100) {
85
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
86
+ }
87
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
88
+ try {
89
+ const end = length === undefined ? reader.len : reader.pos + length;
90
+ const message = createBaseListAlertsRequest();
91
+ while (reader.pos < end) {
92
+ const tag = reader.uint32();
93
+ switch (tag >>> 3) {
94
+ case 1: {
95
+ if (tag !== 10) {
96
+ break;
97
+ }
98
+
99
+ message.organizationId = reader.string();
100
+ continue;
101
+ }
102
+ case 2: {
103
+ if (tag !== 16) {
104
+ break;
105
+ }
106
+
107
+ message.pageSize = reader.int32();
108
+ continue;
109
+ }
110
+ case 3: {
111
+ if (tag !== 26) {
112
+ break;
113
+ }
114
+
115
+ message.pageToken = reader.string();
116
+ continue;
117
+ }
118
+ }
119
+ if ((tag & 7) === 4 || tag === 0) {
120
+ break;
121
+ }
122
+ reader.skip(tag & 7);
123
+ }
124
+ return message;
125
+ } finally {
126
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
127
+ }
128
+ },
129
+
130
+ fromJSON(object: any): ListAlertsRequest {
131
+ return {
132
+ organizationId: isSet(object.organizationId)
133
+ ? globalThis.String(object.organizationId)
134
+ : isSet(object.organization_id)
135
+ ? globalThis.String(object.organization_id)
136
+ : "",
137
+ pageSize: isSet(object.pageSize)
138
+ ? globalThis.Number(object.pageSize)
139
+ : isSet(object.page_size)
140
+ ? globalThis.Number(object.page_size)
141
+ : 0,
142
+ pageToken: isSet(object.pageToken)
143
+ ? globalThis.String(object.pageToken)
144
+ : isSet(object.page_token)
145
+ ? globalThis.String(object.page_token)
146
+ : "",
147
+ };
148
+ },
149
+
150
+ toJSON(message: ListAlertsRequest): unknown {
151
+ const obj: any = {};
152
+ if (message.organizationId !== "") {
153
+ obj.organizationId = message.organizationId;
154
+ }
155
+ if (message.pageSize !== 0) {
156
+ obj.pageSize = Math.round(message.pageSize);
157
+ }
158
+ if (message.pageToken !== "") {
159
+ obj.pageToken = message.pageToken;
160
+ }
161
+ return obj;
162
+ },
163
+
164
+ create<I extends Exact<DeepPartial<ListAlertsRequest>, I>>(base?: I): ListAlertsRequest {
165
+ return ListAlertsRequest.fromPartial(base ?? ({} as any));
166
+ },
167
+ fromPartial<I extends Exact<DeepPartial<ListAlertsRequest>, I>>(object: I): ListAlertsRequest {
168
+ const message = createBaseListAlertsRequest();
169
+ message.organizationId = object.organizationId ?? "";
170
+ message.pageSize = object.pageSize ?? 0;
171
+ message.pageToken = object.pageToken ?? "";
172
+ return message;
173
+ },
174
+ };
175
+
176
+ function createBaseListAlertsResponse(): ListAlertsResponse {
177
+ return { status: undefined, alerts: [], nextPageToken: "", unreadCount: 0 };
178
+ }
179
+
180
+ export const ListAlertsResponse: MessageFns<ListAlertsResponse> = {
181
+ encode(message: ListAlertsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
182
+ if (message.status !== undefined) {
183
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
184
+ }
185
+ for (const v of message.alerts) {
186
+ NotificationAlert.encode(v!, writer.uint32(18).fork()).join();
187
+ }
188
+ if (message.nextPageToken !== "") {
189
+ writer.uint32(26).string(message.nextPageToken);
190
+ }
191
+ if (message.unreadCount !== 0) {
192
+ writer.uint32(32).int32(message.unreadCount);
193
+ }
194
+ return writer;
195
+ },
196
+
197
+ decode(input: BinaryReader | Uint8Array, length?: number): ListAlertsResponse {
198
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
199
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
200
+ if (previousRecursionDepth >= 100) {
201
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
202
+ }
203
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
204
+ try {
205
+ const end = length === undefined ? reader.len : reader.pos + length;
206
+ const message = createBaseListAlertsResponse();
207
+ while (reader.pos < end) {
208
+ const tag = reader.uint32();
209
+ switch (tag >>> 3) {
210
+ case 1: {
211
+ if (tag !== 10) {
212
+ break;
213
+ }
214
+
215
+ message.status = ResponseStatus.decode(reader, reader.uint32());
216
+ continue;
217
+ }
218
+ case 2: {
219
+ if (tag !== 18) {
220
+ break;
221
+ }
222
+
223
+ message.alerts.push(NotificationAlert.decode(reader, reader.uint32()));
224
+ continue;
225
+ }
226
+ case 3: {
227
+ if (tag !== 26) {
228
+ break;
229
+ }
230
+
231
+ message.nextPageToken = reader.string();
232
+ continue;
233
+ }
234
+ case 4: {
235
+ if (tag !== 32) {
236
+ break;
237
+ }
238
+
239
+ message.unreadCount = reader.int32();
240
+ continue;
241
+ }
242
+ }
243
+ if ((tag & 7) === 4 || tag === 0) {
244
+ break;
245
+ }
246
+ reader.skip(tag & 7);
247
+ }
248
+ return message;
249
+ } finally {
250
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
251
+ }
252
+ },
253
+
254
+ fromJSON(object: any): ListAlertsResponse {
255
+ return {
256
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
257
+ alerts: globalThis.Array.isArray(object?.alerts)
258
+ ? object.alerts.map((e: any) => NotificationAlert.fromJSON(e))
259
+ : [],
260
+ nextPageToken: isSet(object.nextPageToken)
261
+ ? globalThis.String(object.nextPageToken)
262
+ : isSet(object.next_page_token)
263
+ ? globalThis.String(object.next_page_token)
264
+ : "",
265
+ unreadCount: isSet(object.unreadCount)
266
+ ? globalThis.Number(object.unreadCount)
267
+ : isSet(object.unread_count)
268
+ ? globalThis.Number(object.unread_count)
269
+ : 0,
270
+ };
271
+ },
272
+
273
+ toJSON(message: ListAlertsResponse): unknown {
274
+ const obj: any = {};
275
+ if (message.status !== undefined) {
276
+ obj.status = ResponseStatus.toJSON(message.status);
277
+ }
278
+ if (message.alerts?.length) {
279
+ obj.alerts = message.alerts.map((e) => NotificationAlert.toJSON(e));
280
+ }
281
+ if (message.nextPageToken !== "") {
282
+ obj.nextPageToken = message.nextPageToken;
283
+ }
284
+ if (message.unreadCount !== 0) {
285
+ obj.unreadCount = Math.round(message.unreadCount);
286
+ }
287
+ return obj;
288
+ },
289
+
290
+ create<I extends Exact<DeepPartial<ListAlertsResponse>, I>>(base?: I): ListAlertsResponse {
291
+ return ListAlertsResponse.fromPartial(base ?? ({} as any));
292
+ },
293
+ fromPartial<I extends Exact<DeepPartial<ListAlertsResponse>, I>>(object: I): ListAlertsResponse {
294
+ const message = createBaseListAlertsResponse();
295
+ message.status = (object.status !== undefined && object.status !== null)
296
+ ? ResponseStatus.fromPartial(object.status)
297
+ : undefined;
298
+ message.alerts = object.alerts?.map((e) => NotificationAlert.fromPartial(e)) || [];
299
+ message.nextPageToken = object.nextPageToken ?? "";
300
+ message.unreadCount = object.unreadCount ?? 0;
301
+ return message;
302
+ },
303
+ };
304
+
305
+ function createBaseNotificationAlert(): NotificationAlert {
306
+ return { alertId: "", kind: "", title: "", body: "", linkPath: "", occurredAt: undefined, read: false };
307
+ }
308
+
309
+ export const NotificationAlert: MessageFns<NotificationAlert> = {
310
+ encode(message: NotificationAlert, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
311
+ if (message.alertId !== "") {
312
+ writer.uint32(10).string(message.alertId);
313
+ }
314
+ if (message.kind !== "") {
315
+ writer.uint32(18).string(message.kind);
316
+ }
317
+ if (message.title !== "") {
318
+ writer.uint32(26).string(message.title);
319
+ }
320
+ if (message.body !== "") {
321
+ writer.uint32(34).string(message.body);
322
+ }
323
+ if (message.linkPath !== "") {
324
+ writer.uint32(42).string(message.linkPath);
325
+ }
326
+ if (message.occurredAt !== undefined) {
327
+ Timestamp.encode(toTimestamp(message.occurredAt), writer.uint32(50).fork()).join();
328
+ }
329
+ if (message.read !== false) {
330
+ writer.uint32(56).bool(message.read);
331
+ }
332
+ return writer;
333
+ },
334
+
335
+ decode(input: BinaryReader | Uint8Array, length?: number): NotificationAlert {
336
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
337
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
338
+ if (previousRecursionDepth >= 100) {
339
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
340
+ }
341
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
342
+ try {
343
+ const end = length === undefined ? reader.len : reader.pos + length;
344
+ const message = createBaseNotificationAlert();
345
+ while (reader.pos < end) {
346
+ const tag = reader.uint32();
347
+ switch (tag >>> 3) {
348
+ case 1: {
349
+ if (tag !== 10) {
350
+ break;
351
+ }
352
+
353
+ message.alertId = reader.string();
354
+ continue;
355
+ }
356
+ case 2: {
357
+ if (tag !== 18) {
358
+ break;
359
+ }
360
+
361
+ message.kind = reader.string();
362
+ continue;
363
+ }
364
+ case 3: {
365
+ if (tag !== 26) {
366
+ break;
367
+ }
368
+
369
+ message.title = reader.string();
370
+ continue;
371
+ }
372
+ case 4: {
373
+ if (tag !== 34) {
374
+ break;
375
+ }
376
+
377
+ message.body = reader.string();
378
+ continue;
379
+ }
380
+ case 5: {
381
+ if (tag !== 42) {
382
+ break;
383
+ }
384
+
385
+ message.linkPath = reader.string();
386
+ continue;
387
+ }
388
+ case 6: {
389
+ if (tag !== 50) {
390
+ break;
391
+ }
392
+
393
+ message.occurredAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
394
+ continue;
395
+ }
396
+ case 7: {
397
+ if (tag !== 56) {
398
+ break;
399
+ }
400
+
401
+ message.read = reader.bool();
402
+ continue;
403
+ }
404
+ }
405
+ if ((tag & 7) === 4 || tag === 0) {
406
+ break;
407
+ }
408
+ reader.skip(tag & 7);
409
+ }
410
+ return message;
411
+ } finally {
412
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
413
+ }
414
+ },
415
+
416
+ fromJSON(object: any): NotificationAlert {
417
+ return {
418
+ alertId: isSet(object.alertId)
419
+ ? globalThis.String(object.alertId)
420
+ : isSet(object.alert_id)
421
+ ? globalThis.String(object.alert_id)
422
+ : "",
423
+ kind: isSet(object.kind) ? globalThis.String(object.kind) : "",
424
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
425
+ body: isSet(object.body) ? globalThis.String(object.body) : "",
426
+ linkPath: isSet(object.linkPath)
427
+ ? globalThis.String(object.linkPath)
428
+ : isSet(object.link_path)
429
+ ? globalThis.String(object.link_path)
430
+ : "",
431
+ occurredAt: isSet(object.occurredAt)
432
+ ? fromJsonTimestamp(object.occurredAt)
433
+ : isSet(object.occurred_at)
434
+ ? fromJsonTimestamp(object.occurred_at)
435
+ : undefined,
436
+ read: isSet(object.read) ? globalThis.Boolean(object.read) : false,
437
+ };
438
+ },
439
+
440
+ toJSON(message: NotificationAlert): unknown {
441
+ const obj: any = {};
442
+ if (message.alertId !== "") {
443
+ obj.alertId = message.alertId;
444
+ }
445
+ if (message.kind !== "") {
446
+ obj.kind = message.kind;
447
+ }
448
+ if (message.title !== "") {
449
+ obj.title = message.title;
450
+ }
451
+ if (message.body !== "") {
452
+ obj.body = message.body;
453
+ }
454
+ if (message.linkPath !== "") {
455
+ obj.linkPath = message.linkPath;
456
+ }
457
+ if (message.occurredAt !== undefined) {
458
+ obj.occurredAt = message.occurredAt.toISOString();
459
+ }
460
+ if (message.read !== false) {
461
+ obj.read = message.read;
462
+ }
463
+ return obj;
464
+ },
465
+
466
+ create<I extends Exact<DeepPartial<NotificationAlert>, I>>(base?: I): NotificationAlert {
467
+ return NotificationAlert.fromPartial(base ?? ({} as any));
468
+ },
469
+ fromPartial<I extends Exact<DeepPartial<NotificationAlert>, I>>(object: I): NotificationAlert {
470
+ const message = createBaseNotificationAlert();
471
+ message.alertId = object.alertId ?? "";
472
+ message.kind = object.kind ?? "";
473
+ message.title = object.title ?? "";
474
+ message.body = object.body ?? "";
475
+ message.linkPath = object.linkPath ?? "";
476
+ message.occurredAt = object.occurredAt ?? undefined;
477
+ message.read = object.read ?? false;
478
+ return message;
479
+ },
480
+ };
481
+
482
+ function createBaseMarkAlertsReadRequest(): MarkAlertsReadRequest {
483
+ return { organizationId: "", alertIds: [], all: false };
484
+ }
485
+
486
+ export const MarkAlertsReadRequest: MessageFns<MarkAlertsReadRequest> = {
487
+ encode(message: MarkAlertsReadRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
488
+ if (message.organizationId !== "") {
489
+ writer.uint32(10).string(message.organizationId);
490
+ }
491
+ for (const v of message.alertIds) {
492
+ writer.uint32(18).string(v!);
493
+ }
494
+ if (message.all !== false) {
495
+ writer.uint32(24).bool(message.all);
496
+ }
497
+ return writer;
498
+ },
499
+
500
+ decode(input: BinaryReader | Uint8Array, length?: number): MarkAlertsReadRequest {
501
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
502
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
503
+ if (previousRecursionDepth >= 100) {
504
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
505
+ }
506
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
507
+ try {
508
+ const end = length === undefined ? reader.len : reader.pos + length;
509
+ const message = createBaseMarkAlertsReadRequest();
510
+ while (reader.pos < end) {
511
+ const tag = reader.uint32();
512
+ switch (tag >>> 3) {
513
+ case 1: {
514
+ if (tag !== 10) {
515
+ break;
516
+ }
517
+
518
+ message.organizationId = reader.string();
519
+ continue;
520
+ }
521
+ case 2: {
522
+ if (tag !== 18) {
523
+ break;
524
+ }
525
+
526
+ message.alertIds.push(reader.string());
527
+ continue;
528
+ }
529
+ case 3: {
530
+ if (tag !== 24) {
531
+ break;
532
+ }
533
+
534
+ message.all = reader.bool();
535
+ continue;
536
+ }
537
+ }
538
+ if ((tag & 7) === 4 || tag === 0) {
539
+ break;
540
+ }
541
+ reader.skip(tag & 7);
542
+ }
543
+ return message;
544
+ } finally {
545
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
546
+ }
547
+ },
548
+
549
+ fromJSON(object: any): MarkAlertsReadRequest {
550
+ return {
551
+ organizationId: isSet(object.organizationId)
552
+ ? globalThis.String(object.organizationId)
553
+ : isSet(object.organization_id)
554
+ ? globalThis.String(object.organization_id)
555
+ : "",
556
+ alertIds: globalThis.Array.isArray(object?.alertIds)
557
+ ? object.alertIds.map((e: any) => globalThis.String(e))
558
+ : globalThis.Array.isArray(object?.alert_ids)
559
+ ? object.alert_ids.map((e: any) => globalThis.String(e))
560
+ : [],
561
+ all: isSet(object.all) ? globalThis.Boolean(object.all) : false,
562
+ };
563
+ },
564
+
565
+ toJSON(message: MarkAlertsReadRequest): unknown {
566
+ const obj: any = {};
567
+ if (message.organizationId !== "") {
568
+ obj.organizationId = message.organizationId;
569
+ }
570
+ if (message.alertIds?.length) {
571
+ obj.alertIds = message.alertIds;
572
+ }
573
+ if (message.all !== false) {
574
+ obj.all = message.all;
575
+ }
576
+ return obj;
577
+ },
578
+
579
+ create<I extends Exact<DeepPartial<MarkAlertsReadRequest>, I>>(base?: I): MarkAlertsReadRequest {
580
+ return MarkAlertsReadRequest.fromPartial(base ?? ({} as any));
581
+ },
582
+ fromPartial<I extends Exact<DeepPartial<MarkAlertsReadRequest>, I>>(object: I): MarkAlertsReadRequest {
583
+ const message = createBaseMarkAlertsReadRequest();
584
+ message.organizationId = object.organizationId ?? "";
585
+ message.alertIds = object.alertIds?.map((e) => e) || [];
586
+ message.all = object.all ?? false;
587
+ return message;
588
+ },
589
+ };
590
+
591
+ function createBaseMarkAlertsReadResponse(): MarkAlertsReadResponse {
592
+ return { status: undefined, unreadCount: 0 };
593
+ }
594
+
595
+ export const MarkAlertsReadResponse: MessageFns<MarkAlertsReadResponse> = {
596
+ encode(message: MarkAlertsReadResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
597
+ if (message.status !== undefined) {
598
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
599
+ }
600
+ if (message.unreadCount !== 0) {
601
+ writer.uint32(16).int32(message.unreadCount);
602
+ }
603
+ return writer;
604
+ },
605
+
606
+ decode(input: BinaryReader | Uint8Array, length?: number): MarkAlertsReadResponse {
607
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
608
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
609
+ if (previousRecursionDepth >= 100) {
610
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
611
+ }
612
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
613
+ try {
614
+ const end = length === undefined ? reader.len : reader.pos + length;
615
+ const message = createBaseMarkAlertsReadResponse();
616
+ while (reader.pos < end) {
617
+ const tag = reader.uint32();
618
+ switch (tag >>> 3) {
619
+ case 1: {
620
+ if (tag !== 10) {
621
+ break;
622
+ }
623
+
624
+ message.status = ResponseStatus.decode(reader, reader.uint32());
625
+ continue;
626
+ }
627
+ case 2: {
628
+ if (tag !== 16) {
629
+ break;
630
+ }
631
+
632
+ message.unreadCount = reader.int32();
633
+ continue;
634
+ }
635
+ }
636
+ if ((tag & 7) === 4 || tag === 0) {
637
+ break;
638
+ }
639
+ reader.skip(tag & 7);
640
+ }
641
+ return message;
642
+ } finally {
643
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
644
+ }
645
+ },
646
+
647
+ fromJSON(object: any): MarkAlertsReadResponse {
648
+ return {
649
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
650
+ unreadCount: isSet(object.unreadCount)
651
+ ? globalThis.Number(object.unreadCount)
652
+ : isSet(object.unread_count)
653
+ ? globalThis.Number(object.unread_count)
654
+ : 0,
655
+ };
656
+ },
657
+
658
+ toJSON(message: MarkAlertsReadResponse): unknown {
659
+ const obj: any = {};
660
+ if (message.status !== undefined) {
661
+ obj.status = ResponseStatus.toJSON(message.status);
662
+ }
663
+ if (message.unreadCount !== 0) {
664
+ obj.unreadCount = Math.round(message.unreadCount);
665
+ }
666
+ return obj;
667
+ },
668
+
669
+ create<I extends Exact<DeepPartial<MarkAlertsReadResponse>, I>>(base?: I): MarkAlertsReadResponse {
670
+ return MarkAlertsReadResponse.fromPartial(base ?? ({} as any));
671
+ },
672
+ fromPartial<I extends Exact<DeepPartial<MarkAlertsReadResponse>, I>>(object: I): MarkAlertsReadResponse {
673
+ const message = createBaseMarkAlertsReadResponse();
674
+ message.status = (object.status !== undefined && object.status !== null)
675
+ ? ResponseStatus.fromPartial(object.status)
676
+ : undefined;
677
+ message.unreadCount = object.unreadCount ?? 0;
678
+ return message;
679
+ },
680
+ };
681
+
682
+ /**
683
+ * NotificationGatewayService mirrors notification.api.v1.NotificationService: the organization's in-app alerts, which
684
+ * every member sees, with the signed-in member's own read state. Poll ListAlerts for the bell (on load, on window focus
685
+ * and every 30-60 s); there is no stream.
686
+ */
687
+ export interface NotificationGatewayService {
688
+ /**
689
+ * ListAlerts pages the organization's alerts newest first; pages never overlap. Paging is weakly consistent: an
690
+ * alert that becomes visible behind the cursor during a walk shows up on the next walk from the first page.
691
+ */
692
+ ListAlerts(request: ListAlertsRequest, metadata?: Metadata): Promise<ListAlertsResponse>;
693
+ /** MarkAlertsRead marks alerts read for the signed-in member and returns the new unread count. */
694
+ MarkAlertsRead(request: MarkAlertsReadRequest, metadata?: Metadata): Promise<MarkAlertsReadResponse>;
695
+ }
696
+
697
+ export const NotificationGatewayServiceServiceName = "gateway.web.v1.NotificationGatewayService";
698
+ export class NotificationGatewayServiceClientImpl implements NotificationGatewayService {
699
+ private readonly rpc: Rpc;
700
+ private readonly service: string;
701
+ constructor(rpc: Rpc, opts?: { service?: string }) {
702
+ this.service = opts?.service || NotificationGatewayServiceServiceName;
703
+ this.rpc = rpc;
704
+ this.ListAlerts = this.ListAlerts.bind(this);
705
+ this.MarkAlertsRead = this.MarkAlertsRead.bind(this);
706
+ }
707
+ ListAlerts(request: ListAlertsRequest, metadata?: Metadata): Promise<ListAlertsResponse> {
708
+ const data = ListAlertsRequest.encode(request).finish();
709
+ const promise = this.rpc.request(this.service, "ListAlerts", data, metadata);
710
+ return promise.then((data) => ListAlertsResponse.decode(new BinaryReader(data)));
711
+ }
712
+
713
+ MarkAlertsRead(request: MarkAlertsReadRequest, metadata?: Metadata): Promise<MarkAlertsReadResponse> {
714
+ const data = MarkAlertsReadRequest.encode(request).finish();
715
+ const promise = this.rpc.request(this.service, "MarkAlertsRead", data, metadata);
716
+ return promise.then((data) => MarkAlertsReadResponse.decode(new BinaryReader(data)));
717
+ }
718
+ }
719
+
720
+ interface Rpc {
721
+ request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
722
+ }
723
+
724
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
725
+
726
+ export type DeepPartial<T> = T extends Builtin ? T
727
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
728
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
729
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
730
+ : Partial<T>;
731
+
732
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
733
+ export type Exact<P, I> = P extends Builtin ? P
734
+ :
735
+ & P
736
+ & { [K in keyof P as Extract<K, keyof I>]: Exact<P[K], I[K & keyof I]> }
737
+ & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
738
+
739
+ function toTimestamp(date: Date): Timestamp {
740
+ const seconds = Math.trunc(date.getTime() / 1_000);
741
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
742
+ return { seconds, nanos };
743
+ }
744
+
745
+ function fromTimestamp(t: Timestamp): Date {
746
+ let millis = (t.seconds || 0) * 1_000;
747
+ millis += (t.nanos || 0) / 1_000_000;
748
+ return new globalThis.Date(millis);
749
+ }
750
+
751
+ function fromJsonTimestamp(o: any): Date {
752
+ if (o instanceof globalThis.Date) {
753
+ return o;
754
+ } else if (typeof o === "string") {
755
+ return new globalThis.Date(o);
756
+ } else {
757
+ return fromTimestamp(Timestamp.fromJSON(o));
758
+ }
759
+ }
760
+
761
+ function isSet(value: any): boolean {
762
+ return value !== null && value !== undefined;
763
+ }
764
+
765
+ export interface MessageFns<T> {
766
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
767
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
768
+ fromJSON(object: any): T;
769
+ toJSON(message: T): unknown;
770
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
771
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
772
+ }