@miradorlabs/web-grpc 2.14.0 → 2.16.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,3064 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v3.21.12
5
+ // source: proto/gateway/web/v1/integration_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
+ import { EnabledStatus, enabledStatusFromJSON, enabledStatusToJSON } from "./common";
13
+
14
+ export const protobufPackage = "gateway.web.v1";
15
+
16
+ export enum IntegrationType {
17
+ INTEGRATION_TYPE_UNSPECIFIED = 0,
18
+ INTEGRATION_TYPE_WEBHOOK = 1,
19
+ INTEGRATION_TYPE_SLACK = 2,
20
+ INTEGRATION_TYPE_EMAIL = 3,
21
+ INTEGRATION_TYPE_PAGERDUTY = 4,
22
+ UNRECOGNIZED = -1,
23
+ }
24
+
25
+ export function integrationTypeFromJSON(object: any): IntegrationType {
26
+ switch (object) {
27
+ case 0:
28
+ case "INTEGRATION_TYPE_UNSPECIFIED":
29
+ return IntegrationType.INTEGRATION_TYPE_UNSPECIFIED;
30
+ case 1:
31
+ case "INTEGRATION_TYPE_WEBHOOK":
32
+ return IntegrationType.INTEGRATION_TYPE_WEBHOOK;
33
+ case 2:
34
+ case "INTEGRATION_TYPE_SLACK":
35
+ return IntegrationType.INTEGRATION_TYPE_SLACK;
36
+ case 3:
37
+ case "INTEGRATION_TYPE_EMAIL":
38
+ return IntegrationType.INTEGRATION_TYPE_EMAIL;
39
+ case 4:
40
+ case "INTEGRATION_TYPE_PAGERDUTY":
41
+ return IntegrationType.INTEGRATION_TYPE_PAGERDUTY;
42
+ case -1:
43
+ case "UNRECOGNIZED":
44
+ default:
45
+ return IntegrationType.UNRECOGNIZED;
46
+ }
47
+ }
48
+
49
+ export function integrationTypeToJSON(object: IntegrationType): string {
50
+ switch (object) {
51
+ case IntegrationType.INTEGRATION_TYPE_UNSPECIFIED:
52
+ return "INTEGRATION_TYPE_UNSPECIFIED";
53
+ case IntegrationType.INTEGRATION_TYPE_WEBHOOK:
54
+ return "INTEGRATION_TYPE_WEBHOOK";
55
+ case IntegrationType.INTEGRATION_TYPE_SLACK:
56
+ return "INTEGRATION_TYPE_SLACK";
57
+ case IntegrationType.INTEGRATION_TYPE_EMAIL:
58
+ return "INTEGRATION_TYPE_EMAIL";
59
+ case IntegrationType.INTEGRATION_TYPE_PAGERDUTY:
60
+ return "INTEGRATION_TYPE_PAGERDUTY";
61
+ case IntegrationType.UNRECOGNIZED:
62
+ default:
63
+ return "UNRECOGNIZED";
64
+ }
65
+ }
66
+
67
+ export enum DeliveryStatus {
68
+ DELIVERY_STATUS_UNSPECIFIED = 0,
69
+ DELIVERY_STATUS_PENDING = 1,
70
+ DELIVERY_STATUS_SUCCESS = 2,
71
+ DELIVERY_STATUS_FAILED = 3,
72
+ UNRECOGNIZED = -1,
73
+ }
74
+
75
+ export function deliveryStatusFromJSON(object: any): DeliveryStatus {
76
+ switch (object) {
77
+ case 0:
78
+ case "DELIVERY_STATUS_UNSPECIFIED":
79
+ return DeliveryStatus.DELIVERY_STATUS_UNSPECIFIED;
80
+ case 1:
81
+ case "DELIVERY_STATUS_PENDING":
82
+ return DeliveryStatus.DELIVERY_STATUS_PENDING;
83
+ case 2:
84
+ case "DELIVERY_STATUS_SUCCESS":
85
+ return DeliveryStatus.DELIVERY_STATUS_SUCCESS;
86
+ case 3:
87
+ case "DELIVERY_STATUS_FAILED":
88
+ return DeliveryStatus.DELIVERY_STATUS_FAILED;
89
+ case -1:
90
+ case "UNRECOGNIZED":
91
+ default:
92
+ return DeliveryStatus.UNRECOGNIZED;
93
+ }
94
+ }
95
+
96
+ export function deliveryStatusToJSON(object: DeliveryStatus): string {
97
+ switch (object) {
98
+ case DeliveryStatus.DELIVERY_STATUS_UNSPECIFIED:
99
+ return "DELIVERY_STATUS_UNSPECIFIED";
100
+ case DeliveryStatus.DELIVERY_STATUS_PENDING:
101
+ return "DELIVERY_STATUS_PENDING";
102
+ case DeliveryStatus.DELIVERY_STATUS_SUCCESS:
103
+ return "DELIVERY_STATUS_SUCCESS";
104
+ case DeliveryStatus.DELIVERY_STATUS_FAILED:
105
+ return "DELIVERY_STATUS_FAILED";
106
+ case DeliveryStatus.UNRECOGNIZED:
107
+ default:
108
+ return "UNRECOGNIZED";
109
+ }
110
+ }
111
+
112
+ export interface Integration {
113
+ id: string;
114
+ organizationId: string;
115
+ name: string;
116
+ type: IntegrationType;
117
+ enabled: EnabledStatus;
118
+ webhookConfig?: WebhookConfig | undefined;
119
+ slackConfig?: SlackConfig | undefined;
120
+ emailConfig?: EmailConfig | undefined;
121
+ pagerdutyConfig?: PagerDutyConfig | undefined;
122
+ createdAt: Date | undefined;
123
+ updatedAt: Date | undefined;
124
+ }
125
+
126
+ export interface WebhookConfig {
127
+ url: string;
128
+ headers: { [key: string]: string };
129
+ }
130
+
131
+ export interface WebhookConfig_HeadersEntry {
132
+ key: string;
133
+ value: string;
134
+ }
135
+
136
+ export interface SlackConfig {
137
+ channelId: string;
138
+ channelName: string;
139
+ teamId: string;
140
+ teamName: string;
141
+ }
142
+
143
+ export interface EmailConfig {
144
+ recipients: string[];
145
+ }
146
+
147
+ export interface PagerDutyConfig {
148
+ serviceId: string;
149
+ serviceName: string;
150
+ }
151
+
152
+ export interface CreateIntegrationRequest {
153
+ organizationId: string;
154
+ name: string;
155
+ type: IntegrationType;
156
+ webhookConfig?: WebhookConfig | undefined;
157
+ slackConfig?: SlackConfig | undefined;
158
+ emailConfig?: EmailConfig | undefined;
159
+ pagerdutyConfig?: PagerDutyConfig | undefined;
160
+ }
161
+
162
+ export interface CreateIntegrationResponse {
163
+ status: ResponseStatus | undefined;
164
+ integration: Integration | undefined;
165
+ }
166
+
167
+ export interface GetIntegrationRequest {
168
+ organizationId: string;
169
+ integrationId: string;
170
+ }
171
+
172
+ export interface GetIntegrationResponse {
173
+ status: ResponseStatus | undefined;
174
+ integration: Integration | undefined;
175
+ }
176
+
177
+ export interface ListIntegrationsRequest {
178
+ organizationId: string;
179
+ typeFilter: IntegrationType;
180
+ }
181
+
182
+ export interface ListIntegrationsResponse {
183
+ status: ResponseStatus | undefined;
184
+ integrations: Integration[];
185
+ }
186
+
187
+ export interface UpdateIntegrationRequest {
188
+ organizationId: string;
189
+ integrationId: string;
190
+ updates: UpdateIntegrationRequest_IntegrationUpdates | undefined;
191
+ }
192
+
193
+ export interface UpdateIntegrationRequest_IntegrationUpdates {
194
+ name?: string | undefined;
195
+ enabled?: EnabledStatus | undefined;
196
+ webhookConfig?: WebhookConfig | undefined;
197
+ slackConfig?: SlackConfig | undefined;
198
+ emailConfig?: EmailConfig | undefined;
199
+ pagerdutyConfig?: PagerDutyConfig | undefined;
200
+ }
201
+
202
+ export interface UpdateIntegrationResponse {
203
+ status: ResponseStatus | undefined;
204
+ integration: Integration | undefined;
205
+ }
206
+
207
+ export interface DeleteIntegrationRequest {
208
+ organizationId: string;
209
+ integrationId: string;
210
+ }
211
+
212
+ export interface DeleteIntegrationResponse {
213
+ status: ResponseStatus | undefined;
214
+ }
215
+
216
+ export interface ListTraceRuleMatchDeliveriesRequest {
217
+ projectId: string;
218
+ matchEventId: string;
219
+ organizationId: string;
220
+ }
221
+
222
+ export interface ListTraceRuleMatchDeliveriesResponse {
223
+ status: ResponseStatus | undefined;
224
+ deliveries: IntegrationDelivery[];
225
+ }
226
+
227
+ export interface IntegrationDelivery {
228
+ deliveryId: string;
229
+ integrationId: string;
230
+ integrationName: string;
231
+ integrationType: IntegrationType;
232
+ status: DeliveryStatus;
233
+ attempts: number;
234
+ maxAttempts: number;
235
+ error: string;
236
+ latencyMs: number;
237
+ createdAt: Date | undefined;
238
+ updatedAt: Date | undefined;
239
+ webhook?: WebhookDestination | undefined;
240
+ email?: EmailDestination | undefined;
241
+ slack?: SlackDestination | undefined;
242
+ pagerduty?: PagerDutyDestination | undefined;
243
+ }
244
+
245
+ export interface WebhookDestination {
246
+ url: string;
247
+ statusCode: number;
248
+ }
249
+
250
+ export interface EmailDestination {
251
+ recipients: string[];
252
+ }
253
+
254
+ export interface SlackDestination {
255
+ channelId: string;
256
+ channelName: string;
257
+ }
258
+
259
+ export interface PagerDutyDestination {
260
+ serviceId: string;
261
+ serviceName: string;
262
+ }
263
+
264
+ function createBaseIntegration(): Integration {
265
+ return {
266
+ id: "",
267
+ organizationId: "",
268
+ name: "",
269
+ type: 0,
270
+ enabled: 0,
271
+ webhookConfig: undefined,
272
+ slackConfig: undefined,
273
+ emailConfig: undefined,
274
+ pagerdutyConfig: undefined,
275
+ createdAt: undefined,
276
+ updatedAt: undefined,
277
+ };
278
+ }
279
+
280
+ export const Integration: MessageFns<Integration> = {
281
+ encode(message: Integration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
282
+ if (message.id !== "") {
283
+ writer.uint32(10).string(message.id);
284
+ }
285
+ if (message.organizationId !== "") {
286
+ writer.uint32(18).string(message.organizationId);
287
+ }
288
+ if (message.name !== "") {
289
+ writer.uint32(26).string(message.name);
290
+ }
291
+ if (message.type !== 0) {
292
+ writer.uint32(32).int32(message.type);
293
+ }
294
+ if (message.enabled !== 0) {
295
+ writer.uint32(40).int32(message.enabled);
296
+ }
297
+ if (message.webhookConfig !== undefined) {
298
+ WebhookConfig.encode(message.webhookConfig, writer.uint32(50).fork()).join();
299
+ }
300
+ if (message.slackConfig !== undefined) {
301
+ SlackConfig.encode(message.slackConfig, writer.uint32(58).fork()).join();
302
+ }
303
+ if (message.emailConfig !== undefined) {
304
+ EmailConfig.encode(message.emailConfig, writer.uint32(66).fork()).join();
305
+ }
306
+ if (message.pagerdutyConfig !== undefined) {
307
+ PagerDutyConfig.encode(message.pagerdutyConfig, writer.uint32(90).fork()).join();
308
+ }
309
+ if (message.createdAt !== undefined) {
310
+ Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(74).fork()).join();
311
+ }
312
+ if (message.updatedAt !== undefined) {
313
+ Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(82).fork()).join();
314
+ }
315
+ return writer;
316
+ },
317
+
318
+ decode(input: BinaryReader | Uint8Array, length?: number): Integration {
319
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
320
+ const end = length === undefined ? reader.len : reader.pos + length;
321
+ const message = createBaseIntegration();
322
+ while (reader.pos < end) {
323
+ const tag = reader.uint32();
324
+ switch (tag >>> 3) {
325
+ case 1: {
326
+ if (tag !== 10) {
327
+ break;
328
+ }
329
+
330
+ message.id = reader.string();
331
+ continue;
332
+ }
333
+ case 2: {
334
+ if (tag !== 18) {
335
+ break;
336
+ }
337
+
338
+ message.organizationId = reader.string();
339
+ continue;
340
+ }
341
+ case 3: {
342
+ if (tag !== 26) {
343
+ break;
344
+ }
345
+
346
+ message.name = reader.string();
347
+ continue;
348
+ }
349
+ case 4: {
350
+ if (tag !== 32) {
351
+ break;
352
+ }
353
+
354
+ message.type = reader.int32() as any;
355
+ continue;
356
+ }
357
+ case 5: {
358
+ if (tag !== 40) {
359
+ break;
360
+ }
361
+
362
+ message.enabled = reader.int32() as any;
363
+ continue;
364
+ }
365
+ case 6: {
366
+ if (tag !== 50) {
367
+ break;
368
+ }
369
+
370
+ message.webhookConfig = WebhookConfig.decode(reader, reader.uint32());
371
+ continue;
372
+ }
373
+ case 7: {
374
+ if (tag !== 58) {
375
+ break;
376
+ }
377
+
378
+ message.slackConfig = SlackConfig.decode(reader, reader.uint32());
379
+ continue;
380
+ }
381
+ case 8: {
382
+ if (tag !== 66) {
383
+ break;
384
+ }
385
+
386
+ message.emailConfig = EmailConfig.decode(reader, reader.uint32());
387
+ continue;
388
+ }
389
+ case 11: {
390
+ if (tag !== 90) {
391
+ break;
392
+ }
393
+
394
+ message.pagerdutyConfig = PagerDutyConfig.decode(reader, reader.uint32());
395
+ continue;
396
+ }
397
+ case 9: {
398
+ if (tag !== 74) {
399
+ break;
400
+ }
401
+
402
+ message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
403
+ continue;
404
+ }
405
+ case 10: {
406
+ if (tag !== 82) {
407
+ break;
408
+ }
409
+
410
+ message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
411
+ continue;
412
+ }
413
+ }
414
+ if ((tag & 7) === 4 || tag === 0) {
415
+ break;
416
+ }
417
+ reader.skip(tag & 7);
418
+ }
419
+ return message;
420
+ },
421
+
422
+ fromJSON(object: any): Integration {
423
+ return {
424
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
425
+ organizationId: isSet(object.organizationId)
426
+ ? globalThis.String(object.organizationId)
427
+ : isSet(object.organization_id)
428
+ ? globalThis.String(object.organization_id)
429
+ : "",
430
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
431
+ type: isSet(object.type) ? integrationTypeFromJSON(object.type) : 0,
432
+ enabled: isSet(object.enabled) ? enabledStatusFromJSON(object.enabled) : 0,
433
+ webhookConfig: isSet(object.webhookConfig)
434
+ ? WebhookConfig.fromJSON(object.webhookConfig)
435
+ : isSet(object.webhook_config)
436
+ ? WebhookConfig.fromJSON(object.webhook_config)
437
+ : undefined,
438
+ slackConfig: isSet(object.slackConfig)
439
+ ? SlackConfig.fromJSON(object.slackConfig)
440
+ : isSet(object.slack_config)
441
+ ? SlackConfig.fromJSON(object.slack_config)
442
+ : undefined,
443
+ emailConfig: isSet(object.emailConfig)
444
+ ? EmailConfig.fromJSON(object.emailConfig)
445
+ : isSet(object.email_config)
446
+ ? EmailConfig.fromJSON(object.email_config)
447
+ : undefined,
448
+ pagerdutyConfig: isSet(object.pagerdutyConfig)
449
+ ? PagerDutyConfig.fromJSON(object.pagerdutyConfig)
450
+ : isSet(object.pagerduty_config)
451
+ ? PagerDutyConfig.fromJSON(object.pagerduty_config)
452
+ : undefined,
453
+ createdAt: isSet(object.createdAt)
454
+ ? fromJsonTimestamp(object.createdAt)
455
+ : isSet(object.created_at)
456
+ ? fromJsonTimestamp(object.created_at)
457
+ : undefined,
458
+ updatedAt: isSet(object.updatedAt)
459
+ ? fromJsonTimestamp(object.updatedAt)
460
+ : isSet(object.updated_at)
461
+ ? fromJsonTimestamp(object.updated_at)
462
+ : undefined,
463
+ };
464
+ },
465
+
466
+ toJSON(message: Integration): unknown {
467
+ const obj: any = {};
468
+ if (message.id !== "") {
469
+ obj.id = message.id;
470
+ }
471
+ if (message.organizationId !== "") {
472
+ obj.organizationId = message.organizationId;
473
+ }
474
+ if (message.name !== "") {
475
+ obj.name = message.name;
476
+ }
477
+ if (message.type !== 0) {
478
+ obj.type = integrationTypeToJSON(message.type);
479
+ }
480
+ if (message.enabled !== 0) {
481
+ obj.enabled = enabledStatusToJSON(message.enabled);
482
+ }
483
+ if (message.webhookConfig !== undefined) {
484
+ obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig);
485
+ }
486
+ if (message.slackConfig !== undefined) {
487
+ obj.slackConfig = SlackConfig.toJSON(message.slackConfig);
488
+ }
489
+ if (message.emailConfig !== undefined) {
490
+ obj.emailConfig = EmailConfig.toJSON(message.emailConfig);
491
+ }
492
+ if (message.pagerdutyConfig !== undefined) {
493
+ obj.pagerdutyConfig = PagerDutyConfig.toJSON(message.pagerdutyConfig);
494
+ }
495
+ if (message.createdAt !== undefined) {
496
+ obj.createdAt = message.createdAt.toISOString();
497
+ }
498
+ if (message.updatedAt !== undefined) {
499
+ obj.updatedAt = message.updatedAt.toISOString();
500
+ }
501
+ return obj;
502
+ },
503
+
504
+ create<I extends Exact<DeepPartial<Integration>, I>>(base?: I): Integration {
505
+ return Integration.fromPartial(base ?? ({} as any));
506
+ },
507
+ fromPartial<I extends Exact<DeepPartial<Integration>, I>>(object: I): Integration {
508
+ const message = createBaseIntegration();
509
+ message.id = object.id ?? "";
510
+ message.organizationId = object.organizationId ?? "";
511
+ message.name = object.name ?? "";
512
+ message.type = object.type ?? 0;
513
+ message.enabled = object.enabled ?? 0;
514
+ message.webhookConfig = (object.webhookConfig !== undefined && object.webhookConfig !== null)
515
+ ? WebhookConfig.fromPartial(object.webhookConfig)
516
+ : undefined;
517
+ message.slackConfig = (object.slackConfig !== undefined && object.slackConfig !== null)
518
+ ? SlackConfig.fromPartial(object.slackConfig)
519
+ : undefined;
520
+ message.emailConfig = (object.emailConfig !== undefined && object.emailConfig !== null)
521
+ ? EmailConfig.fromPartial(object.emailConfig)
522
+ : undefined;
523
+ message.pagerdutyConfig = (object.pagerdutyConfig !== undefined && object.pagerdutyConfig !== null)
524
+ ? PagerDutyConfig.fromPartial(object.pagerdutyConfig)
525
+ : undefined;
526
+ message.createdAt = object.createdAt ?? undefined;
527
+ message.updatedAt = object.updatedAt ?? undefined;
528
+ return message;
529
+ },
530
+ };
531
+
532
+ function createBaseWebhookConfig(): WebhookConfig {
533
+ return { url: "", headers: {} };
534
+ }
535
+
536
+ export const WebhookConfig: MessageFns<WebhookConfig> = {
537
+ encode(message: WebhookConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
538
+ if (message.url !== "") {
539
+ writer.uint32(10).string(message.url);
540
+ }
541
+ globalThis.Object.entries(message.headers).forEach(([key, value]: [string, string]) => {
542
+ WebhookConfig_HeadersEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join();
543
+ });
544
+ return writer;
545
+ },
546
+
547
+ decode(input: BinaryReader | Uint8Array, length?: number): WebhookConfig {
548
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
549
+ const end = length === undefined ? reader.len : reader.pos + length;
550
+ const message = createBaseWebhookConfig();
551
+ while (reader.pos < end) {
552
+ const tag = reader.uint32();
553
+ switch (tag >>> 3) {
554
+ case 1: {
555
+ if (tag !== 10) {
556
+ break;
557
+ }
558
+
559
+ message.url = reader.string();
560
+ continue;
561
+ }
562
+ case 2: {
563
+ if (tag !== 18) {
564
+ break;
565
+ }
566
+
567
+ const entry2 = WebhookConfig_HeadersEntry.decode(reader, reader.uint32());
568
+ if (entry2.value !== undefined) {
569
+ message.headers[entry2.key] = entry2.value;
570
+ }
571
+ continue;
572
+ }
573
+ }
574
+ if ((tag & 7) === 4 || tag === 0) {
575
+ break;
576
+ }
577
+ reader.skip(tag & 7);
578
+ }
579
+ return message;
580
+ },
581
+
582
+ fromJSON(object: any): WebhookConfig {
583
+ return {
584
+ url: isSet(object.url) ? globalThis.String(object.url) : "",
585
+ headers: isObject(object.headers)
586
+ ? (globalThis.Object.entries(object.headers) as [string, any][]).reduce(
587
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
588
+ acc[key] = globalThis.String(value);
589
+ return acc;
590
+ },
591
+ {},
592
+ )
593
+ : {},
594
+ };
595
+ },
596
+
597
+ toJSON(message: WebhookConfig): unknown {
598
+ const obj: any = {};
599
+ if (message.url !== "") {
600
+ obj.url = message.url;
601
+ }
602
+ if (message.headers) {
603
+ const entries = globalThis.Object.entries(message.headers) as [string, string][];
604
+ if (entries.length > 0) {
605
+ obj.headers = {};
606
+ entries.forEach(([k, v]) => {
607
+ obj.headers[k] = v;
608
+ });
609
+ }
610
+ }
611
+ return obj;
612
+ },
613
+
614
+ create<I extends Exact<DeepPartial<WebhookConfig>, I>>(base?: I): WebhookConfig {
615
+ return WebhookConfig.fromPartial(base ?? ({} as any));
616
+ },
617
+ fromPartial<I extends Exact<DeepPartial<WebhookConfig>, I>>(object: I): WebhookConfig {
618
+ const message = createBaseWebhookConfig();
619
+ message.url = object.url ?? "";
620
+ message.headers = (globalThis.Object.entries(object.headers ?? {}) as [string, string][]).reduce(
621
+ (acc: { [key: string]: string }, [key, value]: [string, string]) => {
622
+ if (value !== undefined) {
623
+ acc[key] = globalThis.String(value);
624
+ }
625
+ return acc;
626
+ },
627
+ {},
628
+ );
629
+ return message;
630
+ },
631
+ };
632
+
633
+ function createBaseWebhookConfig_HeadersEntry(): WebhookConfig_HeadersEntry {
634
+ return { key: "", value: "" };
635
+ }
636
+
637
+ export const WebhookConfig_HeadersEntry: MessageFns<WebhookConfig_HeadersEntry> = {
638
+ encode(message: WebhookConfig_HeadersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
639
+ if (message.key !== "") {
640
+ writer.uint32(10).string(message.key);
641
+ }
642
+ if (message.value !== "") {
643
+ writer.uint32(18).string(message.value);
644
+ }
645
+ return writer;
646
+ },
647
+
648
+ decode(input: BinaryReader | Uint8Array, length?: number): WebhookConfig_HeadersEntry {
649
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
650
+ const end = length === undefined ? reader.len : reader.pos + length;
651
+ const message = createBaseWebhookConfig_HeadersEntry();
652
+ while (reader.pos < end) {
653
+ const tag = reader.uint32();
654
+ switch (tag >>> 3) {
655
+ case 1: {
656
+ if (tag !== 10) {
657
+ break;
658
+ }
659
+
660
+ message.key = reader.string();
661
+ continue;
662
+ }
663
+ case 2: {
664
+ if (tag !== 18) {
665
+ break;
666
+ }
667
+
668
+ message.value = reader.string();
669
+ continue;
670
+ }
671
+ }
672
+ if ((tag & 7) === 4 || tag === 0) {
673
+ break;
674
+ }
675
+ reader.skip(tag & 7);
676
+ }
677
+ return message;
678
+ },
679
+
680
+ fromJSON(object: any): WebhookConfig_HeadersEntry {
681
+ return {
682
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
683
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
684
+ };
685
+ },
686
+
687
+ toJSON(message: WebhookConfig_HeadersEntry): unknown {
688
+ const obj: any = {};
689
+ if (message.key !== "") {
690
+ obj.key = message.key;
691
+ }
692
+ if (message.value !== "") {
693
+ obj.value = message.value;
694
+ }
695
+ return obj;
696
+ },
697
+
698
+ create<I extends Exact<DeepPartial<WebhookConfig_HeadersEntry>, I>>(base?: I): WebhookConfig_HeadersEntry {
699
+ return WebhookConfig_HeadersEntry.fromPartial(base ?? ({} as any));
700
+ },
701
+ fromPartial<I extends Exact<DeepPartial<WebhookConfig_HeadersEntry>, I>>(object: I): WebhookConfig_HeadersEntry {
702
+ const message = createBaseWebhookConfig_HeadersEntry();
703
+ message.key = object.key ?? "";
704
+ message.value = object.value ?? "";
705
+ return message;
706
+ },
707
+ };
708
+
709
+ function createBaseSlackConfig(): SlackConfig {
710
+ return { channelId: "", channelName: "", teamId: "", teamName: "" };
711
+ }
712
+
713
+ export const SlackConfig: MessageFns<SlackConfig> = {
714
+ encode(message: SlackConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
715
+ if (message.channelId !== "") {
716
+ writer.uint32(10).string(message.channelId);
717
+ }
718
+ if (message.channelName !== "") {
719
+ writer.uint32(18).string(message.channelName);
720
+ }
721
+ if (message.teamId !== "") {
722
+ writer.uint32(26).string(message.teamId);
723
+ }
724
+ if (message.teamName !== "") {
725
+ writer.uint32(34).string(message.teamName);
726
+ }
727
+ return writer;
728
+ },
729
+
730
+ decode(input: BinaryReader | Uint8Array, length?: number): SlackConfig {
731
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
732
+ const end = length === undefined ? reader.len : reader.pos + length;
733
+ const message = createBaseSlackConfig();
734
+ while (reader.pos < end) {
735
+ const tag = reader.uint32();
736
+ switch (tag >>> 3) {
737
+ case 1: {
738
+ if (tag !== 10) {
739
+ break;
740
+ }
741
+
742
+ message.channelId = reader.string();
743
+ continue;
744
+ }
745
+ case 2: {
746
+ if (tag !== 18) {
747
+ break;
748
+ }
749
+
750
+ message.channelName = reader.string();
751
+ continue;
752
+ }
753
+ case 3: {
754
+ if (tag !== 26) {
755
+ break;
756
+ }
757
+
758
+ message.teamId = reader.string();
759
+ continue;
760
+ }
761
+ case 4: {
762
+ if (tag !== 34) {
763
+ break;
764
+ }
765
+
766
+ message.teamName = reader.string();
767
+ continue;
768
+ }
769
+ }
770
+ if ((tag & 7) === 4 || tag === 0) {
771
+ break;
772
+ }
773
+ reader.skip(tag & 7);
774
+ }
775
+ return message;
776
+ },
777
+
778
+ fromJSON(object: any): SlackConfig {
779
+ return {
780
+ channelId: isSet(object.channelId)
781
+ ? globalThis.String(object.channelId)
782
+ : isSet(object.channel_id)
783
+ ? globalThis.String(object.channel_id)
784
+ : "",
785
+ channelName: isSet(object.channelName)
786
+ ? globalThis.String(object.channelName)
787
+ : isSet(object.channel_name)
788
+ ? globalThis.String(object.channel_name)
789
+ : "",
790
+ teamId: isSet(object.teamId)
791
+ ? globalThis.String(object.teamId)
792
+ : isSet(object.team_id)
793
+ ? globalThis.String(object.team_id)
794
+ : "",
795
+ teamName: isSet(object.teamName)
796
+ ? globalThis.String(object.teamName)
797
+ : isSet(object.team_name)
798
+ ? globalThis.String(object.team_name)
799
+ : "",
800
+ };
801
+ },
802
+
803
+ toJSON(message: SlackConfig): unknown {
804
+ const obj: any = {};
805
+ if (message.channelId !== "") {
806
+ obj.channelId = message.channelId;
807
+ }
808
+ if (message.channelName !== "") {
809
+ obj.channelName = message.channelName;
810
+ }
811
+ if (message.teamId !== "") {
812
+ obj.teamId = message.teamId;
813
+ }
814
+ if (message.teamName !== "") {
815
+ obj.teamName = message.teamName;
816
+ }
817
+ return obj;
818
+ },
819
+
820
+ create<I extends Exact<DeepPartial<SlackConfig>, I>>(base?: I): SlackConfig {
821
+ return SlackConfig.fromPartial(base ?? ({} as any));
822
+ },
823
+ fromPartial<I extends Exact<DeepPartial<SlackConfig>, I>>(object: I): SlackConfig {
824
+ const message = createBaseSlackConfig();
825
+ message.channelId = object.channelId ?? "";
826
+ message.channelName = object.channelName ?? "";
827
+ message.teamId = object.teamId ?? "";
828
+ message.teamName = object.teamName ?? "";
829
+ return message;
830
+ },
831
+ };
832
+
833
+ function createBaseEmailConfig(): EmailConfig {
834
+ return { recipients: [] };
835
+ }
836
+
837
+ export const EmailConfig: MessageFns<EmailConfig> = {
838
+ encode(message: EmailConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
839
+ for (const v of message.recipients) {
840
+ writer.uint32(10).string(v!);
841
+ }
842
+ return writer;
843
+ },
844
+
845
+ decode(input: BinaryReader | Uint8Array, length?: number): EmailConfig {
846
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
847
+ const end = length === undefined ? reader.len : reader.pos + length;
848
+ const message = createBaseEmailConfig();
849
+ while (reader.pos < end) {
850
+ const tag = reader.uint32();
851
+ switch (tag >>> 3) {
852
+ case 1: {
853
+ if (tag !== 10) {
854
+ break;
855
+ }
856
+
857
+ message.recipients.push(reader.string());
858
+ continue;
859
+ }
860
+ }
861
+ if ((tag & 7) === 4 || tag === 0) {
862
+ break;
863
+ }
864
+ reader.skip(tag & 7);
865
+ }
866
+ return message;
867
+ },
868
+
869
+ fromJSON(object: any): EmailConfig {
870
+ return {
871
+ recipients: globalThis.Array.isArray(object?.recipients)
872
+ ? object.recipients.map((e: any) => globalThis.String(e))
873
+ : [],
874
+ };
875
+ },
876
+
877
+ toJSON(message: EmailConfig): unknown {
878
+ const obj: any = {};
879
+ if (message.recipients?.length) {
880
+ obj.recipients = message.recipients;
881
+ }
882
+ return obj;
883
+ },
884
+
885
+ create<I extends Exact<DeepPartial<EmailConfig>, I>>(base?: I): EmailConfig {
886
+ return EmailConfig.fromPartial(base ?? ({} as any));
887
+ },
888
+ fromPartial<I extends Exact<DeepPartial<EmailConfig>, I>>(object: I): EmailConfig {
889
+ const message = createBaseEmailConfig();
890
+ message.recipients = object.recipients?.map((e) => e) || [];
891
+ return message;
892
+ },
893
+ };
894
+
895
+ function createBasePagerDutyConfig(): PagerDutyConfig {
896
+ return { serviceId: "", serviceName: "" };
897
+ }
898
+
899
+ export const PagerDutyConfig: MessageFns<PagerDutyConfig> = {
900
+ encode(message: PagerDutyConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
901
+ if (message.serviceId !== "") {
902
+ writer.uint32(10).string(message.serviceId);
903
+ }
904
+ if (message.serviceName !== "") {
905
+ writer.uint32(18).string(message.serviceName);
906
+ }
907
+ return writer;
908
+ },
909
+
910
+ decode(input: BinaryReader | Uint8Array, length?: number): PagerDutyConfig {
911
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
912
+ const end = length === undefined ? reader.len : reader.pos + length;
913
+ const message = createBasePagerDutyConfig();
914
+ while (reader.pos < end) {
915
+ const tag = reader.uint32();
916
+ switch (tag >>> 3) {
917
+ case 1: {
918
+ if (tag !== 10) {
919
+ break;
920
+ }
921
+
922
+ message.serviceId = reader.string();
923
+ continue;
924
+ }
925
+ case 2: {
926
+ if (tag !== 18) {
927
+ break;
928
+ }
929
+
930
+ message.serviceName = reader.string();
931
+ continue;
932
+ }
933
+ }
934
+ if ((tag & 7) === 4 || tag === 0) {
935
+ break;
936
+ }
937
+ reader.skip(tag & 7);
938
+ }
939
+ return message;
940
+ },
941
+
942
+ fromJSON(object: any): PagerDutyConfig {
943
+ return {
944
+ serviceId: isSet(object.serviceId)
945
+ ? globalThis.String(object.serviceId)
946
+ : isSet(object.service_id)
947
+ ? globalThis.String(object.service_id)
948
+ : "",
949
+ serviceName: isSet(object.serviceName)
950
+ ? globalThis.String(object.serviceName)
951
+ : isSet(object.service_name)
952
+ ? globalThis.String(object.service_name)
953
+ : "",
954
+ };
955
+ },
956
+
957
+ toJSON(message: PagerDutyConfig): unknown {
958
+ const obj: any = {};
959
+ if (message.serviceId !== "") {
960
+ obj.serviceId = message.serviceId;
961
+ }
962
+ if (message.serviceName !== "") {
963
+ obj.serviceName = message.serviceName;
964
+ }
965
+ return obj;
966
+ },
967
+
968
+ create<I extends Exact<DeepPartial<PagerDutyConfig>, I>>(base?: I): PagerDutyConfig {
969
+ return PagerDutyConfig.fromPartial(base ?? ({} as any));
970
+ },
971
+ fromPartial<I extends Exact<DeepPartial<PagerDutyConfig>, I>>(object: I): PagerDutyConfig {
972
+ const message = createBasePagerDutyConfig();
973
+ message.serviceId = object.serviceId ?? "";
974
+ message.serviceName = object.serviceName ?? "";
975
+ return message;
976
+ },
977
+ };
978
+
979
+ function createBaseCreateIntegrationRequest(): CreateIntegrationRequest {
980
+ return {
981
+ organizationId: "",
982
+ name: "",
983
+ type: 0,
984
+ webhookConfig: undefined,
985
+ slackConfig: undefined,
986
+ emailConfig: undefined,
987
+ pagerdutyConfig: undefined,
988
+ };
989
+ }
990
+
991
+ export const CreateIntegrationRequest: MessageFns<CreateIntegrationRequest> = {
992
+ encode(message: CreateIntegrationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
993
+ if (message.organizationId !== "") {
994
+ writer.uint32(10).string(message.organizationId);
995
+ }
996
+ if (message.name !== "") {
997
+ writer.uint32(18).string(message.name);
998
+ }
999
+ if (message.type !== 0) {
1000
+ writer.uint32(24).int32(message.type);
1001
+ }
1002
+ if (message.webhookConfig !== undefined) {
1003
+ WebhookConfig.encode(message.webhookConfig, writer.uint32(34).fork()).join();
1004
+ }
1005
+ if (message.slackConfig !== undefined) {
1006
+ SlackConfig.encode(message.slackConfig, writer.uint32(42).fork()).join();
1007
+ }
1008
+ if (message.emailConfig !== undefined) {
1009
+ EmailConfig.encode(message.emailConfig, writer.uint32(50).fork()).join();
1010
+ }
1011
+ if (message.pagerdutyConfig !== undefined) {
1012
+ PagerDutyConfig.encode(message.pagerdutyConfig, writer.uint32(58).fork()).join();
1013
+ }
1014
+ return writer;
1015
+ },
1016
+
1017
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateIntegrationRequest {
1018
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1019
+ const end = length === undefined ? reader.len : reader.pos + length;
1020
+ const message = createBaseCreateIntegrationRequest();
1021
+ while (reader.pos < end) {
1022
+ const tag = reader.uint32();
1023
+ switch (tag >>> 3) {
1024
+ case 1: {
1025
+ if (tag !== 10) {
1026
+ break;
1027
+ }
1028
+
1029
+ message.organizationId = reader.string();
1030
+ continue;
1031
+ }
1032
+ case 2: {
1033
+ if (tag !== 18) {
1034
+ break;
1035
+ }
1036
+
1037
+ message.name = reader.string();
1038
+ continue;
1039
+ }
1040
+ case 3: {
1041
+ if (tag !== 24) {
1042
+ break;
1043
+ }
1044
+
1045
+ message.type = reader.int32() as any;
1046
+ continue;
1047
+ }
1048
+ case 4: {
1049
+ if (tag !== 34) {
1050
+ break;
1051
+ }
1052
+
1053
+ message.webhookConfig = WebhookConfig.decode(reader, reader.uint32());
1054
+ continue;
1055
+ }
1056
+ case 5: {
1057
+ if (tag !== 42) {
1058
+ break;
1059
+ }
1060
+
1061
+ message.slackConfig = SlackConfig.decode(reader, reader.uint32());
1062
+ continue;
1063
+ }
1064
+ case 6: {
1065
+ if (tag !== 50) {
1066
+ break;
1067
+ }
1068
+
1069
+ message.emailConfig = EmailConfig.decode(reader, reader.uint32());
1070
+ continue;
1071
+ }
1072
+ case 7: {
1073
+ if (tag !== 58) {
1074
+ break;
1075
+ }
1076
+
1077
+ message.pagerdutyConfig = PagerDutyConfig.decode(reader, reader.uint32());
1078
+ continue;
1079
+ }
1080
+ }
1081
+ if ((tag & 7) === 4 || tag === 0) {
1082
+ break;
1083
+ }
1084
+ reader.skip(tag & 7);
1085
+ }
1086
+ return message;
1087
+ },
1088
+
1089
+ fromJSON(object: any): CreateIntegrationRequest {
1090
+ return {
1091
+ organizationId: isSet(object.organizationId)
1092
+ ? globalThis.String(object.organizationId)
1093
+ : isSet(object.organization_id)
1094
+ ? globalThis.String(object.organization_id)
1095
+ : "",
1096
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1097
+ type: isSet(object.type) ? integrationTypeFromJSON(object.type) : 0,
1098
+ webhookConfig: isSet(object.webhookConfig)
1099
+ ? WebhookConfig.fromJSON(object.webhookConfig)
1100
+ : isSet(object.webhook_config)
1101
+ ? WebhookConfig.fromJSON(object.webhook_config)
1102
+ : undefined,
1103
+ slackConfig: isSet(object.slackConfig)
1104
+ ? SlackConfig.fromJSON(object.slackConfig)
1105
+ : isSet(object.slack_config)
1106
+ ? SlackConfig.fromJSON(object.slack_config)
1107
+ : undefined,
1108
+ emailConfig: isSet(object.emailConfig)
1109
+ ? EmailConfig.fromJSON(object.emailConfig)
1110
+ : isSet(object.email_config)
1111
+ ? EmailConfig.fromJSON(object.email_config)
1112
+ : undefined,
1113
+ pagerdutyConfig: isSet(object.pagerdutyConfig)
1114
+ ? PagerDutyConfig.fromJSON(object.pagerdutyConfig)
1115
+ : isSet(object.pagerduty_config)
1116
+ ? PagerDutyConfig.fromJSON(object.pagerduty_config)
1117
+ : undefined,
1118
+ };
1119
+ },
1120
+
1121
+ toJSON(message: CreateIntegrationRequest): unknown {
1122
+ const obj: any = {};
1123
+ if (message.organizationId !== "") {
1124
+ obj.organizationId = message.organizationId;
1125
+ }
1126
+ if (message.name !== "") {
1127
+ obj.name = message.name;
1128
+ }
1129
+ if (message.type !== 0) {
1130
+ obj.type = integrationTypeToJSON(message.type);
1131
+ }
1132
+ if (message.webhookConfig !== undefined) {
1133
+ obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig);
1134
+ }
1135
+ if (message.slackConfig !== undefined) {
1136
+ obj.slackConfig = SlackConfig.toJSON(message.slackConfig);
1137
+ }
1138
+ if (message.emailConfig !== undefined) {
1139
+ obj.emailConfig = EmailConfig.toJSON(message.emailConfig);
1140
+ }
1141
+ if (message.pagerdutyConfig !== undefined) {
1142
+ obj.pagerdutyConfig = PagerDutyConfig.toJSON(message.pagerdutyConfig);
1143
+ }
1144
+ return obj;
1145
+ },
1146
+
1147
+ create<I extends Exact<DeepPartial<CreateIntegrationRequest>, I>>(base?: I): CreateIntegrationRequest {
1148
+ return CreateIntegrationRequest.fromPartial(base ?? ({} as any));
1149
+ },
1150
+ fromPartial<I extends Exact<DeepPartial<CreateIntegrationRequest>, I>>(object: I): CreateIntegrationRequest {
1151
+ const message = createBaseCreateIntegrationRequest();
1152
+ message.organizationId = object.organizationId ?? "";
1153
+ message.name = object.name ?? "";
1154
+ message.type = object.type ?? 0;
1155
+ message.webhookConfig = (object.webhookConfig !== undefined && object.webhookConfig !== null)
1156
+ ? WebhookConfig.fromPartial(object.webhookConfig)
1157
+ : undefined;
1158
+ message.slackConfig = (object.slackConfig !== undefined && object.slackConfig !== null)
1159
+ ? SlackConfig.fromPartial(object.slackConfig)
1160
+ : undefined;
1161
+ message.emailConfig = (object.emailConfig !== undefined && object.emailConfig !== null)
1162
+ ? EmailConfig.fromPartial(object.emailConfig)
1163
+ : undefined;
1164
+ message.pagerdutyConfig = (object.pagerdutyConfig !== undefined && object.pagerdutyConfig !== null)
1165
+ ? PagerDutyConfig.fromPartial(object.pagerdutyConfig)
1166
+ : undefined;
1167
+ return message;
1168
+ },
1169
+ };
1170
+
1171
+ function createBaseCreateIntegrationResponse(): CreateIntegrationResponse {
1172
+ return { status: undefined, integration: undefined };
1173
+ }
1174
+
1175
+ export const CreateIntegrationResponse: MessageFns<CreateIntegrationResponse> = {
1176
+ encode(message: CreateIntegrationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1177
+ if (message.status !== undefined) {
1178
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1179
+ }
1180
+ if (message.integration !== undefined) {
1181
+ Integration.encode(message.integration, writer.uint32(18).fork()).join();
1182
+ }
1183
+ return writer;
1184
+ },
1185
+
1186
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateIntegrationResponse {
1187
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1188
+ const end = length === undefined ? reader.len : reader.pos + length;
1189
+ const message = createBaseCreateIntegrationResponse();
1190
+ while (reader.pos < end) {
1191
+ const tag = reader.uint32();
1192
+ switch (tag >>> 3) {
1193
+ case 1: {
1194
+ if (tag !== 10) {
1195
+ break;
1196
+ }
1197
+
1198
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1199
+ continue;
1200
+ }
1201
+ case 2: {
1202
+ if (tag !== 18) {
1203
+ break;
1204
+ }
1205
+
1206
+ message.integration = Integration.decode(reader, reader.uint32());
1207
+ continue;
1208
+ }
1209
+ }
1210
+ if ((tag & 7) === 4 || tag === 0) {
1211
+ break;
1212
+ }
1213
+ reader.skip(tag & 7);
1214
+ }
1215
+ return message;
1216
+ },
1217
+
1218
+ fromJSON(object: any): CreateIntegrationResponse {
1219
+ return {
1220
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1221
+ integration: isSet(object.integration) ? Integration.fromJSON(object.integration) : undefined,
1222
+ };
1223
+ },
1224
+
1225
+ toJSON(message: CreateIntegrationResponse): unknown {
1226
+ const obj: any = {};
1227
+ if (message.status !== undefined) {
1228
+ obj.status = ResponseStatus.toJSON(message.status);
1229
+ }
1230
+ if (message.integration !== undefined) {
1231
+ obj.integration = Integration.toJSON(message.integration);
1232
+ }
1233
+ return obj;
1234
+ },
1235
+
1236
+ create<I extends Exact<DeepPartial<CreateIntegrationResponse>, I>>(base?: I): CreateIntegrationResponse {
1237
+ return CreateIntegrationResponse.fromPartial(base ?? ({} as any));
1238
+ },
1239
+ fromPartial<I extends Exact<DeepPartial<CreateIntegrationResponse>, I>>(object: I): CreateIntegrationResponse {
1240
+ const message = createBaseCreateIntegrationResponse();
1241
+ message.status = (object.status !== undefined && object.status !== null)
1242
+ ? ResponseStatus.fromPartial(object.status)
1243
+ : undefined;
1244
+ message.integration = (object.integration !== undefined && object.integration !== null)
1245
+ ? Integration.fromPartial(object.integration)
1246
+ : undefined;
1247
+ return message;
1248
+ },
1249
+ };
1250
+
1251
+ function createBaseGetIntegrationRequest(): GetIntegrationRequest {
1252
+ return { organizationId: "", integrationId: "" };
1253
+ }
1254
+
1255
+ export const GetIntegrationRequest: MessageFns<GetIntegrationRequest> = {
1256
+ encode(message: GetIntegrationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1257
+ if (message.organizationId !== "") {
1258
+ writer.uint32(10).string(message.organizationId);
1259
+ }
1260
+ if (message.integrationId !== "") {
1261
+ writer.uint32(18).string(message.integrationId);
1262
+ }
1263
+ return writer;
1264
+ },
1265
+
1266
+ decode(input: BinaryReader | Uint8Array, length?: number): GetIntegrationRequest {
1267
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1268
+ const end = length === undefined ? reader.len : reader.pos + length;
1269
+ const message = createBaseGetIntegrationRequest();
1270
+ while (reader.pos < end) {
1271
+ const tag = reader.uint32();
1272
+ switch (tag >>> 3) {
1273
+ case 1: {
1274
+ if (tag !== 10) {
1275
+ break;
1276
+ }
1277
+
1278
+ message.organizationId = reader.string();
1279
+ continue;
1280
+ }
1281
+ case 2: {
1282
+ if (tag !== 18) {
1283
+ break;
1284
+ }
1285
+
1286
+ message.integrationId = reader.string();
1287
+ continue;
1288
+ }
1289
+ }
1290
+ if ((tag & 7) === 4 || tag === 0) {
1291
+ break;
1292
+ }
1293
+ reader.skip(tag & 7);
1294
+ }
1295
+ return message;
1296
+ },
1297
+
1298
+ fromJSON(object: any): GetIntegrationRequest {
1299
+ return {
1300
+ organizationId: isSet(object.organizationId)
1301
+ ? globalThis.String(object.organizationId)
1302
+ : isSet(object.organization_id)
1303
+ ? globalThis.String(object.organization_id)
1304
+ : "",
1305
+ integrationId: isSet(object.integrationId)
1306
+ ? globalThis.String(object.integrationId)
1307
+ : isSet(object.integration_id)
1308
+ ? globalThis.String(object.integration_id)
1309
+ : "",
1310
+ };
1311
+ },
1312
+
1313
+ toJSON(message: GetIntegrationRequest): unknown {
1314
+ const obj: any = {};
1315
+ if (message.organizationId !== "") {
1316
+ obj.organizationId = message.organizationId;
1317
+ }
1318
+ if (message.integrationId !== "") {
1319
+ obj.integrationId = message.integrationId;
1320
+ }
1321
+ return obj;
1322
+ },
1323
+
1324
+ create<I extends Exact<DeepPartial<GetIntegrationRequest>, I>>(base?: I): GetIntegrationRequest {
1325
+ return GetIntegrationRequest.fromPartial(base ?? ({} as any));
1326
+ },
1327
+ fromPartial<I extends Exact<DeepPartial<GetIntegrationRequest>, I>>(object: I): GetIntegrationRequest {
1328
+ const message = createBaseGetIntegrationRequest();
1329
+ message.organizationId = object.organizationId ?? "";
1330
+ message.integrationId = object.integrationId ?? "";
1331
+ return message;
1332
+ },
1333
+ };
1334
+
1335
+ function createBaseGetIntegrationResponse(): GetIntegrationResponse {
1336
+ return { status: undefined, integration: undefined };
1337
+ }
1338
+
1339
+ export const GetIntegrationResponse: MessageFns<GetIntegrationResponse> = {
1340
+ encode(message: GetIntegrationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1341
+ if (message.status !== undefined) {
1342
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1343
+ }
1344
+ if (message.integration !== undefined) {
1345
+ Integration.encode(message.integration, writer.uint32(18).fork()).join();
1346
+ }
1347
+ return writer;
1348
+ },
1349
+
1350
+ decode(input: BinaryReader | Uint8Array, length?: number): GetIntegrationResponse {
1351
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1352
+ const end = length === undefined ? reader.len : reader.pos + length;
1353
+ const message = createBaseGetIntegrationResponse();
1354
+ while (reader.pos < end) {
1355
+ const tag = reader.uint32();
1356
+ switch (tag >>> 3) {
1357
+ case 1: {
1358
+ if (tag !== 10) {
1359
+ break;
1360
+ }
1361
+
1362
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1363
+ continue;
1364
+ }
1365
+ case 2: {
1366
+ if (tag !== 18) {
1367
+ break;
1368
+ }
1369
+
1370
+ message.integration = Integration.decode(reader, reader.uint32());
1371
+ continue;
1372
+ }
1373
+ }
1374
+ if ((tag & 7) === 4 || tag === 0) {
1375
+ break;
1376
+ }
1377
+ reader.skip(tag & 7);
1378
+ }
1379
+ return message;
1380
+ },
1381
+
1382
+ fromJSON(object: any): GetIntegrationResponse {
1383
+ return {
1384
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1385
+ integration: isSet(object.integration) ? Integration.fromJSON(object.integration) : undefined,
1386
+ };
1387
+ },
1388
+
1389
+ toJSON(message: GetIntegrationResponse): unknown {
1390
+ const obj: any = {};
1391
+ if (message.status !== undefined) {
1392
+ obj.status = ResponseStatus.toJSON(message.status);
1393
+ }
1394
+ if (message.integration !== undefined) {
1395
+ obj.integration = Integration.toJSON(message.integration);
1396
+ }
1397
+ return obj;
1398
+ },
1399
+
1400
+ create<I extends Exact<DeepPartial<GetIntegrationResponse>, I>>(base?: I): GetIntegrationResponse {
1401
+ return GetIntegrationResponse.fromPartial(base ?? ({} as any));
1402
+ },
1403
+ fromPartial<I extends Exact<DeepPartial<GetIntegrationResponse>, I>>(object: I): GetIntegrationResponse {
1404
+ const message = createBaseGetIntegrationResponse();
1405
+ message.status = (object.status !== undefined && object.status !== null)
1406
+ ? ResponseStatus.fromPartial(object.status)
1407
+ : undefined;
1408
+ message.integration = (object.integration !== undefined && object.integration !== null)
1409
+ ? Integration.fromPartial(object.integration)
1410
+ : undefined;
1411
+ return message;
1412
+ },
1413
+ };
1414
+
1415
+ function createBaseListIntegrationsRequest(): ListIntegrationsRequest {
1416
+ return { organizationId: "", typeFilter: 0 };
1417
+ }
1418
+
1419
+ export const ListIntegrationsRequest: MessageFns<ListIntegrationsRequest> = {
1420
+ encode(message: ListIntegrationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1421
+ if (message.organizationId !== "") {
1422
+ writer.uint32(10).string(message.organizationId);
1423
+ }
1424
+ if (message.typeFilter !== 0) {
1425
+ writer.uint32(16).int32(message.typeFilter);
1426
+ }
1427
+ return writer;
1428
+ },
1429
+
1430
+ decode(input: BinaryReader | Uint8Array, length?: number): ListIntegrationsRequest {
1431
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1432
+ const end = length === undefined ? reader.len : reader.pos + length;
1433
+ const message = createBaseListIntegrationsRequest();
1434
+ while (reader.pos < end) {
1435
+ const tag = reader.uint32();
1436
+ switch (tag >>> 3) {
1437
+ case 1: {
1438
+ if (tag !== 10) {
1439
+ break;
1440
+ }
1441
+
1442
+ message.organizationId = reader.string();
1443
+ continue;
1444
+ }
1445
+ case 2: {
1446
+ if (tag !== 16) {
1447
+ break;
1448
+ }
1449
+
1450
+ message.typeFilter = reader.int32() as any;
1451
+ continue;
1452
+ }
1453
+ }
1454
+ if ((tag & 7) === 4 || tag === 0) {
1455
+ break;
1456
+ }
1457
+ reader.skip(tag & 7);
1458
+ }
1459
+ return message;
1460
+ },
1461
+
1462
+ fromJSON(object: any): ListIntegrationsRequest {
1463
+ return {
1464
+ organizationId: isSet(object.organizationId)
1465
+ ? globalThis.String(object.organizationId)
1466
+ : isSet(object.organization_id)
1467
+ ? globalThis.String(object.organization_id)
1468
+ : "",
1469
+ typeFilter: isSet(object.typeFilter)
1470
+ ? integrationTypeFromJSON(object.typeFilter)
1471
+ : isSet(object.type_filter)
1472
+ ? integrationTypeFromJSON(object.type_filter)
1473
+ : 0,
1474
+ };
1475
+ },
1476
+
1477
+ toJSON(message: ListIntegrationsRequest): unknown {
1478
+ const obj: any = {};
1479
+ if (message.organizationId !== "") {
1480
+ obj.organizationId = message.organizationId;
1481
+ }
1482
+ if (message.typeFilter !== 0) {
1483
+ obj.typeFilter = integrationTypeToJSON(message.typeFilter);
1484
+ }
1485
+ return obj;
1486
+ },
1487
+
1488
+ create<I extends Exact<DeepPartial<ListIntegrationsRequest>, I>>(base?: I): ListIntegrationsRequest {
1489
+ return ListIntegrationsRequest.fromPartial(base ?? ({} as any));
1490
+ },
1491
+ fromPartial<I extends Exact<DeepPartial<ListIntegrationsRequest>, I>>(object: I): ListIntegrationsRequest {
1492
+ const message = createBaseListIntegrationsRequest();
1493
+ message.organizationId = object.organizationId ?? "";
1494
+ message.typeFilter = object.typeFilter ?? 0;
1495
+ return message;
1496
+ },
1497
+ };
1498
+
1499
+ function createBaseListIntegrationsResponse(): ListIntegrationsResponse {
1500
+ return { status: undefined, integrations: [] };
1501
+ }
1502
+
1503
+ export const ListIntegrationsResponse: MessageFns<ListIntegrationsResponse> = {
1504
+ encode(message: ListIntegrationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1505
+ if (message.status !== undefined) {
1506
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1507
+ }
1508
+ for (const v of message.integrations) {
1509
+ Integration.encode(v!, writer.uint32(18).fork()).join();
1510
+ }
1511
+ return writer;
1512
+ },
1513
+
1514
+ decode(input: BinaryReader | Uint8Array, length?: number): ListIntegrationsResponse {
1515
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1516
+ const end = length === undefined ? reader.len : reader.pos + length;
1517
+ const message = createBaseListIntegrationsResponse();
1518
+ while (reader.pos < end) {
1519
+ const tag = reader.uint32();
1520
+ switch (tag >>> 3) {
1521
+ case 1: {
1522
+ if (tag !== 10) {
1523
+ break;
1524
+ }
1525
+
1526
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1527
+ continue;
1528
+ }
1529
+ case 2: {
1530
+ if (tag !== 18) {
1531
+ break;
1532
+ }
1533
+
1534
+ message.integrations.push(Integration.decode(reader, reader.uint32()));
1535
+ continue;
1536
+ }
1537
+ }
1538
+ if ((tag & 7) === 4 || tag === 0) {
1539
+ break;
1540
+ }
1541
+ reader.skip(tag & 7);
1542
+ }
1543
+ return message;
1544
+ },
1545
+
1546
+ fromJSON(object: any): ListIntegrationsResponse {
1547
+ return {
1548
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1549
+ integrations: globalThis.Array.isArray(object?.integrations)
1550
+ ? object.integrations.map((e: any) => Integration.fromJSON(e))
1551
+ : [],
1552
+ };
1553
+ },
1554
+
1555
+ toJSON(message: ListIntegrationsResponse): unknown {
1556
+ const obj: any = {};
1557
+ if (message.status !== undefined) {
1558
+ obj.status = ResponseStatus.toJSON(message.status);
1559
+ }
1560
+ if (message.integrations?.length) {
1561
+ obj.integrations = message.integrations.map((e) => Integration.toJSON(e));
1562
+ }
1563
+ return obj;
1564
+ },
1565
+
1566
+ create<I extends Exact<DeepPartial<ListIntegrationsResponse>, I>>(base?: I): ListIntegrationsResponse {
1567
+ return ListIntegrationsResponse.fromPartial(base ?? ({} as any));
1568
+ },
1569
+ fromPartial<I extends Exact<DeepPartial<ListIntegrationsResponse>, I>>(object: I): ListIntegrationsResponse {
1570
+ const message = createBaseListIntegrationsResponse();
1571
+ message.status = (object.status !== undefined && object.status !== null)
1572
+ ? ResponseStatus.fromPartial(object.status)
1573
+ : undefined;
1574
+ message.integrations = object.integrations?.map((e) => Integration.fromPartial(e)) || [];
1575
+ return message;
1576
+ },
1577
+ };
1578
+
1579
+ function createBaseUpdateIntegrationRequest(): UpdateIntegrationRequest {
1580
+ return { organizationId: "", integrationId: "", updates: undefined };
1581
+ }
1582
+
1583
+ export const UpdateIntegrationRequest: MessageFns<UpdateIntegrationRequest> = {
1584
+ encode(message: UpdateIntegrationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1585
+ if (message.organizationId !== "") {
1586
+ writer.uint32(10).string(message.organizationId);
1587
+ }
1588
+ if (message.integrationId !== "") {
1589
+ writer.uint32(18).string(message.integrationId);
1590
+ }
1591
+ if (message.updates !== undefined) {
1592
+ UpdateIntegrationRequest_IntegrationUpdates.encode(message.updates, writer.uint32(26).fork()).join();
1593
+ }
1594
+ return writer;
1595
+ },
1596
+
1597
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateIntegrationRequest {
1598
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1599
+ const end = length === undefined ? reader.len : reader.pos + length;
1600
+ const message = createBaseUpdateIntegrationRequest();
1601
+ while (reader.pos < end) {
1602
+ const tag = reader.uint32();
1603
+ switch (tag >>> 3) {
1604
+ case 1: {
1605
+ if (tag !== 10) {
1606
+ break;
1607
+ }
1608
+
1609
+ message.organizationId = reader.string();
1610
+ continue;
1611
+ }
1612
+ case 2: {
1613
+ if (tag !== 18) {
1614
+ break;
1615
+ }
1616
+
1617
+ message.integrationId = reader.string();
1618
+ continue;
1619
+ }
1620
+ case 3: {
1621
+ if (tag !== 26) {
1622
+ break;
1623
+ }
1624
+
1625
+ message.updates = UpdateIntegrationRequest_IntegrationUpdates.decode(reader, reader.uint32());
1626
+ continue;
1627
+ }
1628
+ }
1629
+ if ((tag & 7) === 4 || tag === 0) {
1630
+ break;
1631
+ }
1632
+ reader.skip(tag & 7);
1633
+ }
1634
+ return message;
1635
+ },
1636
+
1637
+ fromJSON(object: any): UpdateIntegrationRequest {
1638
+ return {
1639
+ organizationId: isSet(object.organizationId)
1640
+ ? globalThis.String(object.organizationId)
1641
+ : isSet(object.organization_id)
1642
+ ? globalThis.String(object.organization_id)
1643
+ : "",
1644
+ integrationId: isSet(object.integrationId)
1645
+ ? globalThis.String(object.integrationId)
1646
+ : isSet(object.integration_id)
1647
+ ? globalThis.String(object.integration_id)
1648
+ : "",
1649
+ updates: isSet(object.updates) ? UpdateIntegrationRequest_IntegrationUpdates.fromJSON(object.updates) : undefined,
1650
+ };
1651
+ },
1652
+
1653
+ toJSON(message: UpdateIntegrationRequest): unknown {
1654
+ const obj: any = {};
1655
+ if (message.organizationId !== "") {
1656
+ obj.organizationId = message.organizationId;
1657
+ }
1658
+ if (message.integrationId !== "") {
1659
+ obj.integrationId = message.integrationId;
1660
+ }
1661
+ if (message.updates !== undefined) {
1662
+ obj.updates = UpdateIntegrationRequest_IntegrationUpdates.toJSON(message.updates);
1663
+ }
1664
+ return obj;
1665
+ },
1666
+
1667
+ create<I extends Exact<DeepPartial<UpdateIntegrationRequest>, I>>(base?: I): UpdateIntegrationRequest {
1668
+ return UpdateIntegrationRequest.fromPartial(base ?? ({} as any));
1669
+ },
1670
+ fromPartial<I extends Exact<DeepPartial<UpdateIntegrationRequest>, I>>(object: I): UpdateIntegrationRequest {
1671
+ const message = createBaseUpdateIntegrationRequest();
1672
+ message.organizationId = object.organizationId ?? "";
1673
+ message.integrationId = object.integrationId ?? "";
1674
+ message.updates = (object.updates !== undefined && object.updates !== null)
1675
+ ? UpdateIntegrationRequest_IntegrationUpdates.fromPartial(object.updates)
1676
+ : undefined;
1677
+ return message;
1678
+ },
1679
+ };
1680
+
1681
+ function createBaseUpdateIntegrationRequest_IntegrationUpdates(): UpdateIntegrationRequest_IntegrationUpdates {
1682
+ return {
1683
+ name: undefined,
1684
+ enabled: undefined,
1685
+ webhookConfig: undefined,
1686
+ slackConfig: undefined,
1687
+ emailConfig: undefined,
1688
+ pagerdutyConfig: undefined,
1689
+ };
1690
+ }
1691
+
1692
+ export const UpdateIntegrationRequest_IntegrationUpdates: MessageFns<UpdateIntegrationRequest_IntegrationUpdates> = {
1693
+ encode(
1694
+ message: UpdateIntegrationRequest_IntegrationUpdates,
1695
+ writer: BinaryWriter = new BinaryWriter(),
1696
+ ): BinaryWriter {
1697
+ if (message.name !== undefined) {
1698
+ writer.uint32(10).string(message.name);
1699
+ }
1700
+ if (message.enabled !== undefined) {
1701
+ writer.uint32(16).int32(message.enabled);
1702
+ }
1703
+ if (message.webhookConfig !== undefined) {
1704
+ WebhookConfig.encode(message.webhookConfig, writer.uint32(26).fork()).join();
1705
+ }
1706
+ if (message.slackConfig !== undefined) {
1707
+ SlackConfig.encode(message.slackConfig, writer.uint32(34).fork()).join();
1708
+ }
1709
+ if (message.emailConfig !== undefined) {
1710
+ EmailConfig.encode(message.emailConfig, writer.uint32(42).fork()).join();
1711
+ }
1712
+ if (message.pagerdutyConfig !== undefined) {
1713
+ PagerDutyConfig.encode(message.pagerdutyConfig, writer.uint32(50).fork()).join();
1714
+ }
1715
+ return writer;
1716
+ },
1717
+
1718
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateIntegrationRequest_IntegrationUpdates {
1719
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1720
+ const end = length === undefined ? reader.len : reader.pos + length;
1721
+ const message = createBaseUpdateIntegrationRequest_IntegrationUpdates();
1722
+ while (reader.pos < end) {
1723
+ const tag = reader.uint32();
1724
+ switch (tag >>> 3) {
1725
+ case 1: {
1726
+ if (tag !== 10) {
1727
+ break;
1728
+ }
1729
+
1730
+ message.name = reader.string();
1731
+ continue;
1732
+ }
1733
+ case 2: {
1734
+ if (tag !== 16) {
1735
+ break;
1736
+ }
1737
+
1738
+ message.enabled = reader.int32() as any;
1739
+ continue;
1740
+ }
1741
+ case 3: {
1742
+ if (tag !== 26) {
1743
+ break;
1744
+ }
1745
+
1746
+ message.webhookConfig = WebhookConfig.decode(reader, reader.uint32());
1747
+ continue;
1748
+ }
1749
+ case 4: {
1750
+ if (tag !== 34) {
1751
+ break;
1752
+ }
1753
+
1754
+ message.slackConfig = SlackConfig.decode(reader, reader.uint32());
1755
+ continue;
1756
+ }
1757
+ case 5: {
1758
+ if (tag !== 42) {
1759
+ break;
1760
+ }
1761
+
1762
+ message.emailConfig = EmailConfig.decode(reader, reader.uint32());
1763
+ continue;
1764
+ }
1765
+ case 6: {
1766
+ if (tag !== 50) {
1767
+ break;
1768
+ }
1769
+
1770
+ message.pagerdutyConfig = PagerDutyConfig.decode(reader, reader.uint32());
1771
+ continue;
1772
+ }
1773
+ }
1774
+ if ((tag & 7) === 4 || tag === 0) {
1775
+ break;
1776
+ }
1777
+ reader.skip(tag & 7);
1778
+ }
1779
+ return message;
1780
+ },
1781
+
1782
+ fromJSON(object: any): UpdateIntegrationRequest_IntegrationUpdates {
1783
+ return {
1784
+ name: isSet(object.name) ? globalThis.String(object.name) : undefined,
1785
+ enabled: isSet(object.enabled) ? enabledStatusFromJSON(object.enabled) : undefined,
1786
+ webhookConfig: isSet(object.webhookConfig)
1787
+ ? WebhookConfig.fromJSON(object.webhookConfig)
1788
+ : isSet(object.webhook_config)
1789
+ ? WebhookConfig.fromJSON(object.webhook_config)
1790
+ : undefined,
1791
+ slackConfig: isSet(object.slackConfig)
1792
+ ? SlackConfig.fromJSON(object.slackConfig)
1793
+ : isSet(object.slack_config)
1794
+ ? SlackConfig.fromJSON(object.slack_config)
1795
+ : undefined,
1796
+ emailConfig: isSet(object.emailConfig)
1797
+ ? EmailConfig.fromJSON(object.emailConfig)
1798
+ : isSet(object.email_config)
1799
+ ? EmailConfig.fromJSON(object.email_config)
1800
+ : undefined,
1801
+ pagerdutyConfig: isSet(object.pagerdutyConfig)
1802
+ ? PagerDutyConfig.fromJSON(object.pagerdutyConfig)
1803
+ : isSet(object.pagerduty_config)
1804
+ ? PagerDutyConfig.fromJSON(object.pagerduty_config)
1805
+ : undefined,
1806
+ };
1807
+ },
1808
+
1809
+ toJSON(message: UpdateIntegrationRequest_IntegrationUpdates): unknown {
1810
+ const obj: any = {};
1811
+ if (message.name !== undefined) {
1812
+ obj.name = message.name;
1813
+ }
1814
+ if (message.enabled !== undefined) {
1815
+ obj.enabled = enabledStatusToJSON(message.enabled);
1816
+ }
1817
+ if (message.webhookConfig !== undefined) {
1818
+ obj.webhookConfig = WebhookConfig.toJSON(message.webhookConfig);
1819
+ }
1820
+ if (message.slackConfig !== undefined) {
1821
+ obj.slackConfig = SlackConfig.toJSON(message.slackConfig);
1822
+ }
1823
+ if (message.emailConfig !== undefined) {
1824
+ obj.emailConfig = EmailConfig.toJSON(message.emailConfig);
1825
+ }
1826
+ if (message.pagerdutyConfig !== undefined) {
1827
+ obj.pagerdutyConfig = PagerDutyConfig.toJSON(message.pagerdutyConfig);
1828
+ }
1829
+ return obj;
1830
+ },
1831
+
1832
+ create<I extends Exact<DeepPartial<UpdateIntegrationRequest_IntegrationUpdates>, I>>(
1833
+ base?: I,
1834
+ ): UpdateIntegrationRequest_IntegrationUpdates {
1835
+ return UpdateIntegrationRequest_IntegrationUpdates.fromPartial(base ?? ({} as any));
1836
+ },
1837
+ fromPartial<I extends Exact<DeepPartial<UpdateIntegrationRequest_IntegrationUpdates>, I>>(
1838
+ object: I,
1839
+ ): UpdateIntegrationRequest_IntegrationUpdates {
1840
+ const message = createBaseUpdateIntegrationRequest_IntegrationUpdates();
1841
+ message.name = object.name ?? undefined;
1842
+ message.enabled = object.enabled ?? undefined;
1843
+ message.webhookConfig = (object.webhookConfig !== undefined && object.webhookConfig !== null)
1844
+ ? WebhookConfig.fromPartial(object.webhookConfig)
1845
+ : undefined;
1846
+ message.slackConfig = (object.slackConfig !== undefined && object.slackConfig !== null)
1847
+ ? SlackConfig.fromPartial(object.slackConfig)
1848
+ : undefined;
1849
+ message.emailConfig = (object.emailConfig !== undefined && object.emailConfig !== null)
1850
+ ? EmailConfig.fromPartial(object.emailConfig)
1851
+ : undefined;
1852
+ message.pagerdutyConfig = (object.pagerdutyConfig !== undefined && object.pagerdutyConfig !== null)
1853
+ ? PagerDutyConfig.fromPartial(object.pagerdutyConfig)
1854
+ : undefined;
1855
+ return message;
1856
+ },
1857
+ };
1858
+
1859
+ function createBaseUpdateIntegrationResponse(): UpdateIntegrationResponse {
1860
+ return { status: undefined, integration: undefined };
1861
+ }
1862
+
1863
+ export const UpdateIntegrationResponse: MessageFns<UpdateIntegrationResponse> = {
1864
+ encode(message: UpdateIntegrationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1865
+ if (message.status !== undefined) {
1866
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1867
+ }
1868
+ if (message.integration !== undefined) {
1869
+ Integration.encode(message.integration, writer.uint32(18).fork()).join();
1870
+ }
1871
+ return writer;
1872
+ },
1873
+
1874
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateIntegrationResponse {
1875
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1876
+ const end = length === undefined ? reader.len : reader.pos + length;
1877
+ const message = createBaseUpdateIntegrationResponse();
1878
+ while (reader.pos < end) {
1879
+ const tag = reader.uint32();
1880
+ switch (tag >>> 3) {
1881
+ case 1: {
1882
+ if (tag !== 10) {
1883
+ break;
1884
+ }
1885
+
1886
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1887
+ continue;
1888
+ }
1889
+ case 2: {
1890
+ if (tag !== 18) {
1891
+ break;
1892
+ }
1893
+
1894
+ message.integration = Integration.decode(reader, reader.uint32());
1895
+ continue;
1896
+ }
1897
+ }
1898
+ if ((tag & 7) === 4 || tag === 0) {
1899
+ break;
1900
+ }
1901
+ reader.skip(tag & 7);
1902
+ }
1903
+ return message;
1904
+ },
1905
+
1906
+ fromJSON(object: any): UpdateIntegrationResponse {
1907
+ return {
1908
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1909
+ integration: isSet(object.integration) ? Integration.fromJSON(object.integration) : undefined,
1910
+ };
1911
+ },
1912
+
1913
+ toJSON(message: UpdateIntegrationResponse): unknown {
1914
+ const obj: any = {};
1915
+ if (message.status !== undefined) {
1916
+ obj.status = ResponseStatus.toJSON(message.status);
1917
+ }
1918
+ if (message.integration !== undefined) {
1919
+ obj.integration = Integration.toJSON(message.integration);
1920
+ }
1921
+ return obj;
1922
+ },
1923
+
1924
+ create<I extends Exact<DeepPartial<UpdateIntegrationResponse>, I>>(base?: I): UpdateIntegrationResponse {
1925
+ return UpdateIntegrationResponse.fromPartial(base ?? ({} as any));
1926
+ },
1927
+ fromPartial<I extends Exact<DeepPartial<UpdateIntegrationResponse>, I>>(object: I): UpdateIntegrationResponse {
1928
+ const message = createBaseUpdateIntegrationResponse();
1929
+ message.status = (object.status !== undefined && object.status !== null)
1930
+ ? ResponseStatus.fromPartial(object.status)
1931
+ : undefined;
1932
+ message.integration = (object.integration !== undefined && object.integration !== null)
1933
+ ? Integration.fromPartial(object.integration)
1934
+ : undefined;
1935
+ return message;
1936
+ },
1937
+ };
1938
+
1939
+ function createBaseDeleteIntegrationRequest(): DeleteIntegrationRequest {
1940
+ return { organizationId: "", integrationId: "" };
1941
+ }
1942
+
1943
+ export const DeleteIntegrationRequest: MessageFns<DeleteIntegrationRequest> = {
1944
+ encode(message: DeleteIntegrationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1945
+ if (message.organizationId !== "") {
1946
+ writer.uint32(10).string(message.organizationId);
1947
+ }
1948
+ if (message.integrationId !== "") {
1949
+ writer.uint32(18).string(message.integrationId);
1950
+ }
1951
+ return writer;
1952
+ },
1953
+
1954
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteIntegrationRequest {
1955
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1956
+ const end = length === undefined ? reader.len : reader.pos + length;
1957
+ const message = createBaseDeleteIntegrationRequest();
1958
+ while (reader.pos < end) {
1959
+ const tag = reader.uint32();
1960
+ switch (tag >>> 3) {
1961
+ case 1: {
1962
+ if (tag !== 10) {
1963
+ break;
1964
+ }
1965
+
1966
+ message.organizationId = reader.string();
1967
+ continue;
1968
+ }
1969
+ case 2: {
1970
+ if (tag !== 18) {
1971
+ break;
1972
+ }
1973
+
1974
+ message.integrationId = reader.string();
1975
+ continue;
1976
+ }
1977
+ }
1978
+ if ((tag & 7) === 4 || tag === 0) {
1979
+ break;
1980
+ }
1981
+ reader.skip(tag & 7);
1982
+ }
1983
+ return message;
1984
+ },
1985
+
1986
+ fromJSON(object: any): DeleteIntegrationRequest {
1987
+ return {
1988
+ organizationId: isSet(object.organizationId)
1989
+ ? globalThis.String(object.organizationId)
1990
+ : isSet(object.organization_id)
1991
+ ? globalThis.String(object.organization_id)
1992
+ : "",
1993
+ integrationId: isSet(object.integrationId)
1994
+ ? globalThis.String(object.integrationId)
1995
+ : isSet(object.integration_id)
1996
+ ? globalThis.String(object.integration_id)
1997
+ : "",
1998
+ };
1999
+ },
2000
+
2001
+ toJSON(message: DeleteIntegrationRequest): unknown {
2002
+ const obj: any = {};
2003
+ if (message.organizationId !== "") {
2004
+ obj.organizationId = message.organizationId;
2005
+ }
2006
+ if (message.integrationId !== "") {
2007
+ obj.integrationId = message.integrationId;
2008
+ }
2009
+ return obj;
2010
+ },
2011
+
2012
+ create<I extends Exact<DeepPartial<DeleteIntegrationRequest>, I>>(base?: I): DeleteIntegrationRequest {
2013
+ return DeleteIntegrationRequest.fromPartial(base ?? ({} as any));
2014
+ },
2015
+ fromPartial<I extends Exact<DeepPartial<DeleteIntegrationRequest>, I>>(object: I): DeleteIntegrationRequest {
2016
+ const message = createBaseDeleteIntegrationRequest();
2017
+ message.organizationId = object.organizationId ?? "";
2018
+ message.integrationId = object.integrationId ?? "";
2019
+ return message;
2020
+ },
2021
+ };
2022
+
2023
+ function createBaseDeleteIntegrationResponse(): DeleteIntegrationResponse {
2024
+ return { status: undefined };
2025
+ }
2026
+
2027
+ export const DeleteIntegrationResponse: MessageFns<DeleteIntegrationResponse> = {
2028
+ encode(message: DeleteIntegrationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2029
+ if (message.status !== undefined) {
2030
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2031
+ }
2032
+ return writer;
2033
+ },
2034
+
2035
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteIntegrationResponse {
2036
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2037
+ const end = length === undefined ? reader.len : reader.pos + length;
2038
+ const message = createBaseDeleteIntegrationResponse();
2039
+ while (reader.pos < end) {
2040
+ const tag = reader.uint32();
2041
+ switch (tag >>> 3) {
2042
+ case 1: {
2043
+ if (tag !== 10) {
2044
+ break;
2045
+ }
2046
+
2047
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2048
+ continue;
2049
+ }
2050
+ }
2051
+ if ((tag & 7) === 4 || tag === 0) {
2052
+ break;
2053
+ }
2054
+ reader.skip(tag & 7);
2055
+ }
2056
+ return message;
2057
+ },
2058
+
2059
+ fromJSON(object: any): DeleteIntegrationResponse {
2060
+ return { status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined };
2061
+ },
2062
+
2063
+ toJSON(message: DeleteIntegrationResponse): unknown {
2064
+ const obj: any = {};
2065
+ if (message.status !== undefined) {
2066
+ obj.status = ResponseStatus.toJSON(message.status);
2067
+ }
2068
+ return obj;
2069
+ },
2070
+
2071
+ create<I extends Exact<DeepPartial<DeleteIntegrationResponse>, I>>(base?: I): DeleteIntegrationResponse {
2072
+ return DeleteIntegrationResponse.fromPartial(base ?? ({} as any));
2073
+ },
2074
+ fromPartial<I extends Exact<DeepPartial<DeleteIntegrationResponse>, I>>(object: I): DeleteIntegrationResponse {
2075
+ const message = createBaseDeleteIntegrationResponse();
2076
+ message.status = (object.status !== undefined && object.status !== null)
2077
+ ? ResponseStatus.fromPartial(object.status)
2078
+ : undefined;
2079
+ return message;
2080
+ },
2081
+ };
2082
+
2083
+ function createBaseListTraceRuleMatchDeliveriesRequest(): ListTraceRuleMatchDeliveriesRequest {
2084
+ return { projectId: "", matchEventId: "", organizationId: "" };
2085
+ }
2086
+
2087
+ export const ListTraceRuleMatchDeliveriesRequest: MessageFns<ListTraceRuleMatchDeliveriesRequest> = {
2088
+ encode(message: ListTraceRuleMatchDeliveriesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2089
+ if (message.projectId !== "") {
2090
+ writer.uint32(10).string(message.projectId);
2091
+ }
2092
+ if (message.matchEventId !== "") {
2093
+ writer.uint32(18).string(message.matchEventId);
2094
+ }
2095
+ if (message.organizationId !== "") {
2096
+ writer.uint32(26).string(message.organizationId);
2097
+ }
2098
+ return writer;
2099
+ },
2100
+
2101
+ decode(input: BinaryReader | Uint8Array, length?: number): ListTraceRuleMatchDeliveriesRequest {
2102
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2103
+ const end = length === undefined ? reader.len : reader.pos + length;
2104
+ const message = createBaseListTraceRuleMatchDeliveriesRequest();
2105
+ while (reader.pos < end) {
2106
+ const tag = reader.uint32();
2107
+ switch (tag >>> 3) {
2108
+ case 1: {
2109
+ if (tag !== 10) {
2110
+ break;
2111
+ }
2112
+
2113
+ message.projectId = reader.string();
2114
+ continue;
2115
+ }
2116
+ case 2: {
2117
+ if (tag !== 18) {
2118
+ break;
2119
+ }
2120
+
2121
+ message.matchEventId = reader.string();
2122
+ continue;
2123
+ }
2124
+ case 3: {
2125
+ if (tag !== 26) {
2126
+ break;
2127
+ }
2128
+
2129
+ message.organizationId = reader.string();
2130
+ continue;
2131
+ }
2132
+ }
2133
+ if ((tag & 7) === 4 || tag === 0) {
2134
+ break;
2135
+ }
2136
+ reader.skip(tag & 7);
2137
+ }
2138
+ return message;
2139
+ },
2140
+
2141
+ fromJSON(object: any): ListTraceRuleMatchDeliveriesRequest {
2142
+ return {
2143
+ projectId: isSet(object.projectId)
2144
+ ? globalThis.String(object.projectId)
2145
+ : isSet(object.project_id)
2146
+ ? globalThis.String(object.project_id)
2147
+ : "",
2148
+ matchEventId: isSet(object.matchEventId)
2149
+ ? globalThis.String(object.matchEventId)
2150
+ : isSet(object.match_event_id)
2151
+ ? globalThis.String(object.match_event_id)
2152
+ : "",
2153
+ organizationId: isSet(object.organizationId)
2154
+ ? globalThis.String(object.organizationId)
2155
+ : isSet(object.organization_id)
2156
+ ? globalThis.String(object.organization_id)
2157
+ : "",
2158
+ };
2159
+ },
2160
+
2161
+ toJSON(message: ListTraceRuleMatchDeliveriesRequest): unknown {
2162
+ const obj: any = {};
2163
+ if (message.projectId !== "") {
2164
+ obj.projectId = message.projectId;
2165
+ }
2166
+ if (message.matchEventId !== "") {
2167
+ obj.matchEventId = message.matchEventId;
2168
+ }
2169
+ if (message.organizationId !== "") {
2170
+ obj.organizationId = message.organizationId;
2171
+ }
2172
+ return obj;
2173
+ },
2174
+
2175
+ create<I extends Exact<DeepPartial<ListTraceRuleMatchDeliveriesRequest>, I>>(
2176
+ base?: I,
2177
+ ): ListTraceRuleMatchDeliveriesRequest {
2178
+ return ListTraceRuleMatchDeliveriesRequest.fromPartial(base ?? ({} as any));
2179
+ },
2180
+ fromPartial<I extends Exact<DeepPartial<ListTraceRuleMatchDeliveriesRequest>, I>>(
2181
+ object: I,
2182
+ ): ListTraceRuleMatchDeliveriesRequest {
2183
+ const message = createBaseListTraceRuleMatchDeliveriesRequest();
2184
+ message.projectId = object.projectId ?? "";
2185
+ message.matchEventId = object.matchEventId ?? "";
2186
+ message.organizationId = object.organizationId ?? "";
2187
+ return message;
2188
+ },
2189
+ };
2190
+
2191
+ function createBaseListTraceRuleMatchDeliveriesResponse(): ListTraceRuleMatchDeliveriesResponse {
2192
+ return { status: undefined, deliveries: [] };
2193
+ }
2194
+
2195
+ export const ListTraceRuleMatchDeliveriesResponse: MessageFns<ListTraceRuleMatchDeliveriesResponse> = {
2196
+ encode(message: ListTraceRuleMatchDeliveriesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2197
+ if (message.status !== undefined) {
2198
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2199
+ }
2200
+ for (const v of message.deliveries) {
2201
+ IntegrationDelivery.encode(v!, writer.uint32(18).fork()).join();
2202
+ }
2203
+ return writer;
2204
+ },
2205
+
2206
+ decode(input: BinaryReader | Uint8Array, length?: number): ListTraceRuleMatchDeliveriesResponse {
2207
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2208
+ const end = length === undefined ? reader.len : reader.pos + length;
2209
+ const message = createBaseListTraceRuleMatchDeliveriesResponse();
2210
+ while (reader.pos < end) {
2211
+ const tag = reader.uint32();
2212
+ switch (tag >>> 3) {
2213
+ case 1: {
2214
+ if (tag !== 10) {
2215
+ break;
2216
+ }
2217
+
2218
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2219
+ continue;
2220
+ }
2221
+ case 2: {
2222
+ if (tag !== 18) {
2223
+ break;
2224
+ }
2225
+
2226
+ message.deliveries.push(IntegrationDelivery.decode(reader, reader.uint32()));
2227
+ continue;
2228
+ }
2229
+ }
2230
+ if ((tag & 7) === 4 || tag === 0) {
2231
+ break;
2232
+ }
2233
+ reader.skip(tag & 7);
2234
+ }
2235
+ return message;
2236
+ },
2237
+
2238
+ fromJSON(object: any): ListTraceRuleMatchDeliveriesResponse {
2239
+ return {
2240
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2241
+ deliveries: globalThis.Array.isArray(object?.deliveries)
2242
+ ? object.deliveries.map((e: any) => IntegrationDelivery.fromJSON(e))
2243
+ : [],
2244
+ };
2245
+ },
2246
+
2247
+ toJSON(message: ListTraceRuleMatchDeliveriesResponse): unknown {
2248
+ const obj: any = {};
2249
+ if (message.status !== undefined) {
2250
+ obj.status = ResponseStatus.toJSON(message.status);
2251
+ }
2252
+ if (message.deliveries?.length) {
2253
+ obj.deliveries = message.deliveries.map((e) => IntegrationDelivery.toJSON(e));
2254
+ }
2255
+ return obj;
2256
+ },
2257
+
2258
+ create<I extends Exact<DeepPartial<ListTraceRuleMatchDeliveriesResponse>, I>>(
2259
+ base?: I,
2260
+ ): ListTraceRuleMatchDeliveriesResponse {
2261
+ return ListTraceRuleMatchDeliveriesResponse.fromPartial(base ?? ({} as any));
2262
+ },
2263
+ fromPartial<I extends Exact<DeepPartial<ListTraceRuleMatchDeliveriesResponse>, I>>(
2264
+ object: I,
2265
+ ): ListTraceRuleMatchDeliveriesResponse {
2266
+ const message = createBaseListTraceRuleMatchDeliveriesResponse();
2267
+ message.status = (object.status !== undefined && object.status !== null)
2268
+ ? ResponseStatus.fromPartial(object.status)
2269
+ : undefined;
2270
+ message.deliveries = object.deliveries?.map((e) => IntegrationDelivery.fromPartial(e)) || [];
2271
+ return message;
2272
+ },
2273
+ };
2274
+
2275
+ function createBaseIntegrationDelivery(): IntegrationDelivery {
2276
+ return {
2277
+ deliveryId: "",
2278
+ integrationId: "",
2279
+ integrationName: "",
2280
+ integrationType: 0,
2281
+ status: 0,
2282
+ attempts: 0,
2283
+ maxAttempts: 0,
2284
+ error: "",
2285
+ latencyMs: 0,
2286
+ createdAt: undefined,
2287
+ updatedAt: undefined,
2288
+ webhook: undefined,
2289
+ email: undefined,
2290
+ slack: undefined,
2291
+ pagerduty: undefined,
2292
+ };
2293
+ }
2294
+
2295
+ export const IntegrationDelivery: MessageFns<IntegrationDelivery> = {
2296
+ encode(message: IntegrationDelivery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2297
+ if (message.deliveryId !== "") {
2298
+ writer.uint32(10).string(message.deliveryId);
2299
+ }
2300
+ if (message.integrationId !== "") {
2301
+ writer.uint32(18).string(message.integrationId);
2302
+ }
2303
+ if (message.integrationName !== "") {
2304
+ writer.uint32(26).string(message.integrationName);
2305
+ }
2306
+ if (message.integrationType !== 0) {
2307
+ writer.uint32(32).int32(message.integrationType);
2308
+ }
2309
+ if (message.status !== 0) {
2310
+ writer.uint32(40).int32(message.status);
2311
+ }
2312
+ if (message.attempts !== 0) {
2313
+ writer.uint32(48).int32(message.attempts);
2314
+ }
2315
+ if (message.maxAttempts !== 0) {
2316
+ writer.uint32(56).int32(message.maxAttempts);
2317
+ }
2318
+ if (message.error !== "") {
2319
+ writer.uint32(66).string(message.error);
2320
+ }
2321
+ if (message.latencyMs !== 0) {
2322
+ writer.uint32(72).int64(message.latencyMs);
2323
+ }
2324
+ if (message.createdAt !== undefined) {
2325
+ Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(82).fork()).join();
2326
+ }
2327
+ if (message.updatedAt !== undefined) {
2328
+ Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(90).fork()).join();
2329
+ }
2330
+ if (message.webhook !== undefined) {
2331
+ WebhookDestination.encode(message.webhook, writer.uint32(162).fork()).join();
2332
+ }
2333
+ if (message.email !== undefined) {
2334
+ EmailDestination.encode(message.email, writer.uint32(170).fork()).join();
2335
+ }
2336
+ if (message.slack !== undefined) {
2337
+ SlackDestination.encode(message.slack, writer.uint32(178).fork()).join();
2338
+ }
2339
+ if (message.pagerduty !== undefined) {
2340
+ PagerDutyDestination.encode(message.pagerduty, writer.uint32(186).fork()).join();
2341
+ }
2342
+ return writer;
2343
+ },
2344
+
2345
+ decode(input: BinaryReader | Uint8Array, length?: number): IntegrationDelivery {
2346
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2347
+ const end = length === undefined ? reader.len : reader.pos + length;
2348
+ const message = createBaseIntegrationDelivery();
2349
+ while (reader.pos < end) {
2350
+ const tag = reader.uint32();
2351
+ switch (tag >>> 3) {
2352
+ case 1: {
2353
+ if (tag !== 10) {
2354
+ break;
2355
+ }
2356
+
2357
+ message.deliveryId = reader.string();
2358
+ continue;
2359
+ }
2360
+ case 2: {
2361
+ if (tag !== 18) {
2362
+ break;
2363
+ }
2364
+
2365
+ message.integrationId = reader.string();
2366
+ continue;
2367
+ }
2368
+ case 3: {
2369
+ if (tag !== 26) {
2370
+ break;
2371
+ }
2372
+
2373
+ message.integrationName = reader.string();
2374
+ continue;
2375
+ }
2376
+ case 4: {
2377
+ if (tag !== 32) {
2378
+ break;
2379
+ }
2380
+
2381
+ message.integrationType = reader.int32() as any;
2382
+ continue;
2383
+ }
2384
+ case 5: {
2385
+ if (tag !== 40) {
2386
+ break;
2387
+ }
2388
+
2389
+ message.status = reader.int32() as any;
2390
+ continue;
2391
+ }
2392
+ case 6: {
2393
+ if (tag !== 48) {
2394
+ break;
2395
+ }
2396
+
2397
+ message.attempts = reader.int32();
2398
+ continue;
2399
+ }
2400
+ case 7: {
2401
+ if (tag !== 56) {
2402
+ break;
2403
+ }
2404
+
2405
+ message.maxAttempts = reader.int32();
2406
+ continue;
2407
+ }
2408
+ case 8: {
2409
+ if (tag !== 66) {
2410
+ break;
2411
+ }
2412
+
2413
+ message.error = reader.string();
2414
+ continue;
2415
+ }
2416
+ case 9: {
2417
+ if (tag !== 72) {
2418
+ break;
2419
+ }
2420
+
2421
+ message.latencyMs = longToNumber(reader.int64());
2422
+ continue;
2423
+ }
2424
+ case 10: {
2425
+ if (tag !== 82) {
2426
+ break;
2427
+ }
2428
+
2429
+ message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2430
+ continue;
2431
+ }
2432
+ case 11: {
2433
+ if (tag !== 90) {
2434
+ break;
2435
+ }
2436
+
2437
+ message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2438
+ continue;
2439
+ }
2440
+ case 20: {
2441
+ if (tag !== 162) {
2442
+ break;
2443
+ }
2444
+
2445
+ message.webhook = WebhookDestination.decode(reader, reader.uint32());
2446
+ continue;
2447
+ }
2448
+ case 21: {
2449
+ if (tag !== 170) {
2450
+ break;
2451
+ }
2452
+
2453
+ message.email = EmailDestination.decode(reader, reader.uint32());
2454
+ continue;
2455
+ }
2456
+ case 22: {
2457
+ if (tag !== 178) {
2458
+ break;
2459
+ }
2460
+
2461
+ message.slack = SlackDestination.decode(reader, reader.uint32());
2462
+ continue;
2463
+ }
2464
+ case 23: {
2465
+ if (tag !== 186) {
2466
+ break;
2467
+ }
2468
+
2469
+ message.pagerduty = PagerDutyDestination.decode(reader, reader.uint32());
2470
+ continue;
2471
+ }
2472
+ }
2473
+ if ((tag & 7) === 4 || tag === 0) {
2474
+ break;
2475
+ }
2476
+ reader.skip(tag & 7);
2477
+ }
2478
+ return message;
2479
+ },
2480
+
2481
+ fromJSON(object: any): IntegrationDelivery {
2482
+ return {
2483
+ deliveryId: isSet(object.deliveryId)
2484
+ ? globalThis.String(object.deliveryId)
2485
+ : isSet(object.delivery_id)
2486
+ ? globalThis.String(object.delivery_id)
2487
+ : "",
2488
+ integrationId: isSet(object.integrationId)
2489
+ ? globalThis.String(object.integrationId)
2490
+ : isSet(object.integration_id)
2491
+ ? globalThis.String(object.integration_id)
2492
+ : "",
2493
+ integrationName: isSet(object.integrationName)
2494
+ ? globalThis.String(object.integrationName)
2495
+ : isSet(object.integration_name)
2496
+ ? globalThis.String(object.integration_name)
2497
+ : "",
2498
+ integrationType: isSet(object.integrationType)
2499
+ ? integrationTypeFromJSON(object.integrationType)
2500
+ : isSet(object.integration_type)
2501
+ ? integrationTypeFromJSON(object.integration_type)
2502
+ : 0,
2503
+ status: isSet(object.status) ? deliveryStatusFromJSON(object.status) : 0,
2504
+ attempts: isSet(object.attempts) ? globalThis.Number(object.attempts) : 0,
2505
+ maxAttempts: isSet(object.maxAttempts)
2506
+ ? globalThis.Number(object.maxAttempts)
2507
+ : isSet(object.max_attempts)
2508
+ ? globalThis.Number(object.max_attempts)
2509
+ : 0,
2510
+ error: isSet(object.error) ? globalThis.String(object.error) : "",
2511
+ latencyMs: isSet(object.latencyMs)
2512
+ ? globalThis.Number(object.latencyMs)
2513
+ : isSet(object.latency_ms)
2514
+ ? globalThis.Number(object.latency_ms)
2515
+ : 0,
2516
+ createdAt: isSet(object.createdAt)
2517
+ ? fromJsonTimestamp(object.createdAt)
2518
+ : isSet(object.created_at)
2519
+ ? fromJsonTimestamp(object.created_at)
2520
+ : undefined,
2521
+ updatedAt: isSet(object.updatedAt)
2522
+ ? fromJsonTimestamp(object.updatedAt)
2523
+ : isSet(object.updated_at)
2524
+ ? fromJsonTimestamp(object.updated_at)
2525
+ : undefined,
2526
+ webhook: isSet(object.webhook) ? WebhookDestination.fromJSON(object.webhook) : undefined,
2527
+ email: isSet(object.email) ? EmailDestination.fromJSON(object.email) : undefined,
2528
+ slack: isSet(object.slack) ? SlackDestination.fromJSON(object.slack) : undefined,
2529
+ pagerduty: isSet(object.pagerduty) ? PagerDutyDestination.fromJSON(object.pagerduty) : undefined,
2530
+ };
2531
+ },
2532
+
2533
+ toJSON(message: IntegrationDelivery): unknown {
2534
+ const obj: any = {};
2535
+ if (message.deliveryId !== "") {
2536
+ obj.deliveryId = message.deliveryId;
2537
+ }
2538
+ if (message.integrationId !== "") {
2539
+ obj.integrationId = message.integrationId;
2540
+ }
2541
+ if (message.integrationName !== "") {
2542
+ obj.integrationName = message.integrationName;
2543
+ }
2544
+ if (message.integrationType !== 0) {
2545
+ obj.integrationType = integrationTypeToJSON(message.integrationType);
2546
+ }
2547
+ if (message.status !== 0) {
2548
+ obj.status = deliveryStatusToJSON(message.status);
2549
+ }
2550
+ if (message.attempts !== 0) {
2551
+ obj.attempts = Math.round(message.attempts);
2552
+ }
2553
+ if (message.maxAttempts !== 0) {
2554
+ obj.maxAttempts = Math.round(message.maxAttempts);
2555
+ }
2556
+ if (message.error !== "") {
2557
+ obj.error = message.error;
2558
+ }
2559
+ if (message.latencyMs !== 0) {
2560
+ obj.latencyMs = Math.round(message.latencyMs);
2561
+ }
2562
+ if (message.createdAt !== undefined) {
2563
+ obj.createdAt = message.createdAt.toISOString();
2564
+ }
2565
+ if (message.updatedAt !== undefined) {
2566
+ obj.updatedAt = message.updatedAt.toISOString();
2567
+ }
2568
+ if (message.webhook !== undefined) {
2569
+ obj.webhook = WebhookDestination.toJSON(message.webhook);
2570
+ }
2571
+ if (message.email !== undefined) {
2572
+ obj.email = EmailDestination.toJSON(message.email);
2573
+ }
2574
+ if (message.slack !== undefined) {
2575
+ obj.slack = SlackDestination.toJSON(message.slack);
2576
+ }
2577
+ if (message.pagerduty !== undefined) {
2578
+ obj.pagerduty = PagerDutyDestination.toJSON(message.pagerduty);
2579
+ }
2580
+ return obj;
2581
+ },
2582
+
2583
+ create<I extends Exact<DeepPartial<IntegrationDelivery>, I>>(base?: I): IntegrationDelivery {
2584
+ return IntegrationDelivery.fromPartial(base ?? ({} as any));
2585
+ },
2586
+ fromPartial<I extends Exact<DeepPartial<IntegrationDelivery>, I>>(object: I): IntegrationDelivery {
2587
+ const message = createBaseIntegrationDelivery();
2588
+ message.deliveryId = object.deliveryId ?? "";
2589
+ message.integrationId = object.integrationId ?? "";
2590
+ message.integrationName = object.integrationName ?? "";
2591
+ message.integrationType = object.integrationType ?? 0;
2592
+ message.status = object.status ?? 0;
2593
+ message.attempts = object.attempts ?? 0;
2594
+ message.maxAttempts = object.maxAttempts ?? 0;
2595
+ message.error = object.error ?? "";
2596
+ message.latencyMs = object.latencyMs ?? 0;
2597
+ message.createdAt = object.createdAt ?? undefined;
2598
+ message.updatedAt = object.updatedAt ?? undefined;
2599
+ message.webhook = (object.webhook !== undefined && object.webhook !== null)
2600
+ ? WebhookDestination.fromPartial(object.webhook)
2601
+ : undefined;
2602
+ message.email = (object.email !== undefined && object.email !== null)
2603
+ ? EmailDestination.fromPartial(object.email)
2604
+ : undefined;
2605
+ message.slack = (object.slack !== undefined && object.slack !== null)
2606
+ ? SlackDestination.fromPartial(object.slack)
2607
+ : undefined;
2608
+ message.pagerduty = (object.pagerduty !== undefined && object.pagerduty !== null)
2609
+ ? PagerDutyDestination.fromPartial(object.pagerduty)
2610
+ : undefined;
2611
+ return message;
2612
+ },
2613
+ };
2614
+
2615
+ function createBaseWebhookDestination(): WebhookDestination {
2616
+ return { url: "", statusCode: 0 };
2617
+ }
2618
+
2619
+ export const WebhookDestination: MessageFns<WebhookDestination> = {
2620
+ encode(message: WebhookDestination, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2621
+ if (message.url !== "") {
2622
+ writer.uint32(10).string(message.url);
2623
+ }
2624
+ if (message.statusCode !== 0) {
2625
+ writer.uint32(16).int32(message.statusCode);
2626
+ }
2627
+ return writer;
2628
+ },
2629
+
2630
+ decode(input: BinaryReader | Uint8Array, length?: number): WebhookDestination {
2631
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2632
+ const end = length === undefined ? reader.len : reader.pos + length;
2633
+ const message = createBaseWebhookDestination();
2634
+ while (reader.pos < end) {
2635
+ const tag = reader.uint32();
2636
+ switch (tag >>> 3) {
2637
+ case 1: {
2638
+ if (tag !== 10) {
2639
+ break;
2640
+ }
2641
+
2642
+ message.url = reader.string();
2643
+ continue;
2644
+ }
2645
+ case 2: {
2646
+ if (tag !== 16) {
2647
+ break;
2648
+ }
2649
+
2650
+ message.statusCode = reader.int32();
2651
+ continue;
2652
+ }
2653
+ }
2654
+ if ((tag & 7) === 4 || tag === 0) {
2655
+ break;
2656
+ }
2657
+ reader.skip(tag & 7);
2658
+ }
2659
+ return message;
2660
+ },
2661
+
2662
+ fromJSON(object: any): WebhookDestination {
2663
+ return {
2664
+ url: isSet(object.url) ? globalThis.String(object.url) : "",
2665
+ statusCode: isSet(object.statusCode)
2666
+ ? globalThis.Number(object.statusCode)
2667
+ : isSet(object.status_code)
2668
+ ? globalThis.Number(object.status_code)
2669
+ : 0,
2670
+ };
2671
+ },
2672
+
2673
+ toJSON(message: WebhookDestination): unknown {
2674
+ const obj: any = {};
2675
+ if (message.url !== "") {
2676
+ obj.url = message.url;
2677
+ }
2678
+ if (message.statusCode !== 0) {
2679
+ obj.statusCode = Math.round(message.statusCode);
2680
+ }
2681
+ return obj;
2682
+ },
2683
+
2684
+ create<I extends Exact<DeepPartial<WebhookDestination>, I>>(base?: I): WebhookDestination {
2685
+ return WebhookDestination.fromPartial(base ?? ({} as any));
2686
+ },
2687
+ fromPartial<I extends Exact<DeepPartial<WebhookDestination>, I>>(object: I): WebhookDestination {
2688
+ const message = createBaseWebhookDestination();
2689
+ message.url = object.url ?? "";
2690
+ message.statusCode = object.statusCode ?? 0;
2691
+ return message;
2692
+ },
2693
+ };
2694
+
2695
+ function createBaseEmailDestination(): EmailDestination {
2696
+ return { recipients: [] };
2697
+ }
2698
+
2699
+ export const EmailDestination: MessageFns<EmailDestination> = {
2700
+ encode(message: EmailDestination, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2701
+ for (const v of message.recipients) {
2702
+ writer.uint32(10).string(v!);
2703
+ }
2704
+ return writer;
2705
+ },
2706
+
2707
+ decode(input: BinaryReader | Uint8Array, length?: number): EmailDestination {
2708
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2709
+ const end = length === undefined ? reader.len : reader.pos + length;
2710
+ const message = createBaseEmailDestination();
2711
+ while (reader.pos < end) {
2712
+ const tag = reader.uint32();
2713
+ switch (tag >>> 3) {
2714
+ case 1: {
2715
+ if (tag !== 10) {
2716
+ break;
2717
+ }
2718
+
2719
+ message.recipients.push(reader.string());
2720
+ continue;
2721
+ }
2722
+ }
2723
+ if ((tag & 7) === 4 || tag === 0) {
2724
+ break;
2725
+ }
2726
+ reader.skip(tag & 7);
2727
+ }
2728
+ return message;
2729
+ },
2730
+
2731
+ fromJSON(object: any): EmailDestination {
2732
+ return {
2733
+ recipients: globalThis.Array.isArray(object?.recipients)
2734
+ ? object.recipients.map((e: any) => globalThis.String(e))
2735
+ : [],
2736
+ };
2737
+ },
2738
+
2739
+ toJSON(message: EmailDestination): unknown {
2740
+ const obj: any = {};
2741
+ if (message.recipients?.length) {
2742
+ obj.recipients = message.recipients;
2743
+ }
2744
+ return obj;
2745
+ },
2746
+
2747
+ create<I extends Exact<DeepPartial<EmailDestination>, I>>(base?: I): EmailDestination {
2748
+ return EmailDestination.fromPartial(base ?? ({} as any));
2749
+ },
2750
+ fromPartial<I extends Exact<DeepPartial<EmailDestination>, I>>(object: I): EmailDestination {
2751
+ const message = createBaseEmailDestination();
2752
+ message.recipients = object.recipients?.map((e) => e) || [];
2753
+ return message;
2754
+ },
2755
+ };
2756
+
2757
+ function createBaseSlackDestination(): SlackDestination {
2758
+ return { channelId: "", channelName: "" };
2759
+ }
2760
+
2761
+ export const SlackDestination: MessageFns<SlackDestination> = {
2762
+ encode(message: SlackDestination, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2763
+ if (message.channelId !== "") {
2764
+ writer.uint32(10).string(message.channelId);
2765
+ }
2766
+ if (message.channelName !== "") {
2767
+ writer.uint32(18).string(message.channelName);
2768
+ }
2769
+ return writer;
2770
+ },
2771
+
2772
+ decode(input: BinaryReader | Uint8Array, length?: number): SlackDestination {
2773
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2774
+ const end = length === undefined ? reader.len : reader.pos + length;
2775
+ const message = createBaseSlackDestination();
2776
+ while (reader.pos < end) {
2777
+ const tag = reader.uint32();
2778
+ switch (tag >>> 3) {
2779
+ case 1: {
2780
+ if (tag !== 10) {
2781
+ break;
2782
+ }
2783
+
2784
+ message.channelId = reader.string();
2785
+ continue;
2786
+ }
2787
+ case 2: {
2788
+ if (tag !== 18) {
2789
+ break;
2790
+ }
2791
+
2792
+ message.channelName = reader.string();
2793
+ continue;
2794
+ }
2795
+ }
2796
+ if ((tag & 7) === 4 || tag === 0) {
2797
+ break;
2798
+ }
2799
+ reader.skip(tag & 7);
2800
+ }
2801
+ return message;
2802
+ },
2803
+
2804
+ fromJSON(object: any): SlackDestination {
2805
+ return {
2806
+ channelId: isSet(object.channelId)
2807
+ ? globalThis.String(object.channelId)
2808
+ : isSet(object.channel_id)
2809
+ ? globalThis.String(object.channel_id)
2810
+ : "",
2811
+ channelName: isSet(object.channelName)
2812
+ ? globalThis.String(object.channelName)
2813
+ : isSet(object.channel_name)
2814
+ ? globalThis.String(object.channel_name)
2815
+ : "",
2816
+ };
2817
+ },
2818
+
2819
+ toJSON(message: SlackDestination): unknown {
2820
+ const obj: any = {};
2821
+ if (message.channelId !== "") {
2822
+ obj.channelId = message.channelId;
2823
+ }
2824
+ if (message.channelName !== "") {
2825
+ obj.channelName = message.channelName;
2826
+ }
2827
+ return obj;
2828
+ },
2829
+
2830
+ create<I extends Exact<DeepPartial<SlackDestination>, I>>(base?: I): SlackDestination {
2831
+ return SlackDestination.fromPartial(base ?? ({} as any));
2832
+ },
2833
+ fromPartial<I extends Exact<DeepPartial<SlackDestination>, I>>(object: I): SlackDestination {
2834
+ const message = createBaseSlackDestination();
2835
+ message.channelId = object.channelId ?? "";
2836
+ message.channelName = object.channelName ?? "";
2837
+ return message;
2838
+ },
2839
+ };
2840
+
2841
+ function createBasePagerDutyDestination(): PagerDutyDestination {
2842
+ return { serviceId: "", serviceName: "" };
2843
+ }
2844
+
2845
+ export const PagerDutyDestination: MessageFns<PagerDutyDestination> = {
2846
+ encode(message: PagerDutyDestination, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2847
+ if (message.serviceId !== "") {
2848
+ writer.uint32(10).string(message.serviceId);
2849
+ }
2850
+ if (message.serviceName !== "") {
2851
+ writer.uint32(18).string(message.serviceName);
2852
+ }
2853
+ return writer;
2854
+ },
2855
+
2856
+ decode(input: BinaryReader | Uint8Array, length?: number): PagerDutyDestination {
2857
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2858
+ const end = length === undefined ? reader.len : reader.pos + length;
2859
+ const message = createBasePagerDutyDestination();
2860
+ while (reader.pos < end) {
2861
+ const tag = reader.uint32();
2862
+ switch (tag >>> 3) {
2863
+ case 1: {
2864
+ if (tag !== 10) {
2865
+ break;
2866
+ }
2867
+
2868
+ message.serviceId = reader.string();
2869
+ continue;
2870
+ }
2871
+ case 2: {
2872
+ if (tag !== 18) {
2873
+ break;
2874
+ }
2875
+
2876
+ message.serviceName = reader.string();
2877
+ continue;
2878
+ }
2879
+ }
2880
+ if ((tag & 7) === 4 || tag === 0) {
2881
+ break;
2882
+ }
2883
+ reader.skip(tag & 7);
2884
+ }
2885
+ return message;
2886
+ },
2887
+
2888
+ fromJSON(object: any): PagerDutyDestination {
2889
+ return {
2890
+ serviceId: isSet(object.serviceId)
2891
+ ? globalThis.String(object.serviceId)
2892
+ : isSet(object.service_id)
2893
+ ? globalThis.String(object.service_id)
2894
+ : "",
2895
+ serviceName: isSet(object.serviceName)
2896
+ ? globalThis.String(object.serviceName)
2897
+ : isSet(object.service_name)
2898
+ ? globalThis.String(object.service_name)
2899
+ : "",
2900
+ };
2901
+ },
2902
+
2903
+ toJSON(message: PagerDutyDestination): unknown {
2904
+ const obj: any = {};
2905
+ if (message.serviceId !== "") {
2906
+ obj.serviceId = message.serviceId;
2907
+ }
2908
+ if (message.serviceName !== "") {
2909
+ obj.serviceName = message.serviceName;
2910
+ }
2911
+ return obj;
2912
+ },
2913
+
2914
+ create<I extends Exact<DeepPartial<PagerDutyDestination>, I>>(base?: I): PagerDutyDestination {
2915
+ return PagerDutyDestination.fromPartial(base ?? ({} as any));
2916
+ },
2917
+ fromPartial<I extends Exact<DeepPartial<PagerDutyDestination>, I>>(object: I): PagerDutyDestination {
2918
+ const message = createBasePagerDutyDestination();
2919
+ message.serviceId = object.serviceId ?? "";
2920
+ message.serviceName = object.serviceName ?? "";
2921
+ return message;
2922
+ },
2923
+ };
2924
+
2925
+ /**
2926
+ * IntegrationGatewayService provides web client access to integration
2927
+ * management and the notification delivery ledger.
2928
+ */
2929
+ export interface IntegrationGatewayService {
2930
+ CreateIntegration(request: CreateIntegrationRequest, metadata?: Metadata): Promise<CreateIntegrationResponse>;
2931
+ GetIntegration(request: GetIntegrationRequest, metadata?: Metadata): Promise<GetIntegrationResponse>;
2932
+ ListIntegrations(request: ListIntegrationsRequest, metadata?: Metadata): Promise<ListIntegrationsResponse>;
2933
+ UpdateIntegration(request: UpdateIntegrationRequest, metadata?: Metadata): Promise<UpdateIntegrationResponse>;
2934
+ DeleteIntegration(request: DeleteIntegrationRequest, metadata?: Metadata): Promise<DeleteIntegrationResponse>;
2935
+ /**
2936
+ * ListTraceRuleMatchDeliveries returns the per-integration delivery records
2937
+ * for a single trace-rule match (the FE calls this on-demand when expanding a
2938
+ * rule-match row on a trace). The delivery ledger is integration-owned.
2939
+ */
2940
+ ListTraceRuleMatchDeliveries(
2941
+ request: ListTraceRuleMatchDeliveriesRequest,
2942
+ metadata?: Metadata,
2943
+ ): Promise<ListTraceRuleMatchDeliveriesResponse>;
2944
+ }
2945
+
2946
+ export const IntegrationGatewayServiceServiceName = "gateway.web.v1.IntegrationGatewayService";
2947
+ export class IntegrationGatewayServiceClientImpl implements IntegrationGatewayService {
2948
+ private readonly rpc: Rpc;
2949
+ private readonly service: string;
2950
+ constructor(rpc: Rpc, opts?: { service?: string }) {
2951
+ this.service = opts?.service || IntegrationGatewayServiceServiceName;
2952
+ this.rpc = rpc;
2953
+ this.CreateIntegration = this.CreateIntegration.bind(this);
2954
+ this.GetIntegration = this.GetIntegration.bind(this);
2955
+ this.ListIntegrations = this.ListIntegrations.bind(this);
2956
+ this.UpdateIntegration = this.UpdateIntegration.bind(this);
2957
+ this.DeleteIntegration = this.DeleteIntegration.bind(this);
2958
+ this.ListTraceRuleMatchDeliveries = this.ListTraceRuleMatchDeliveries.bind(this);
2959
+ }
2960
+ CreateIntegration(request: CreateIntegrationRequest, metadata?: Metadata): Promise<CreateIntegrationResponse> {
2961
+ const data = CreateIntegrationRequest.encode(request).finish();
2962
+ const promise = this.rpc.request(this.service, "CreateIntegration", data, metadata);
2963
+ return promise.then((data) => CreateIntegrationResponse.decode(new BinaryReader(data)));
2964
+ }
2965
+
2966
+ GetIntegration(request: GetIntegrationRequest, metadata?: Metadata): Promise<GetIntegrationResponse> {
2967
+ const data = GetIntegrationRequest.encode(request).finish();
2968
+ const promise = this.rpc.request(this.service, "GetIntegration", data, metadata);
2969
+ return promise.then((data) => GetIntegrationResponse.decode(new BinaryReader(data)));
2970
+ }
2971
+
2972
+ ListIntegrations(request: ListIntegrationsRequest, metadata?: Metadata): Promise<ListIntegrationsResponse> {
2973
+ const data = ListIntegrationsRequest.encode(request).finish();
2974
+ const promise = this.rpc.request(this.service, "ListIntegrations", data, metadata);
2975
+ return promise.then((data) => ListIntegrationsResponse.decode(new BinaryReader(data)));
2976
+ }
2977
+
2978
+ UpdateIntegration(request: UpdateIntegrationRequest, metadata?: Metadata): Promise<UpdateIntegrationResponse> {
2979
+ const data = UpdateIntegrationRequest.encode(request).finish();
2980
+ const promise = this.rpc.request(this.service, "UpdateIntegration", data, metadata);
2981
+ return promise.then((data) => UpdateIntegrationResponse.decode(new BinaryReader(data)));
2982
+ }
2983
+
2984
+ DeleteIntegration(request: DeleteIntegrationRequest, metadata?: Metadata): Promise<DeleteIntegrationResponse> {
2985
+ const data = DeleteIntegrationRequest.encode(request).finish();
2986
+ const promise = this.rpc.request(this.service, "DeleteIntegration", data, metadata);
2987
+ return promise.then((data) => DeleteIntegrationResponse.decode(new BinaryReader(data)));
2988
+ }
2989
+
2990
+ ListTraceRuleMatchDeliveries(
2991
+ request: ListTraceRuleMatchDeliveriesRequest,
2992
+ metadata?: Metadata,
2993
+ ): Promise<ListTraceRuleMatchDeliveriesResponse> {
2994
+ const data = ListTraceRuleMatchDeliveriesRequest.encode(request).finish();
2995
+ const promise = this.rpc.request(this.service, "ListTraceRuleMatchDeliveries", data, metadata);
2996
+ return promise.then((data) => ListTraceRuleMatchDeliveriesResponse.decode(new BinaryReader(data)));
2997
+ }
2998
+ }
2999
+
3000
+ interface Rpc {
3001
+ request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
3002
+ }
3003
+
3004
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
3005
+
3006
+ export type DeepPartial<T> = T extends Builtin ? T
3007
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
3008
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
3009
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
3010
+ : Partial<T>;
3011
+
3012
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
3013
+ export type Exact<P, I extends P> = P extends Builtin ? P
3014
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
3015
+
3016
+ function toTimestamp(date: Date): Timestamp {
3017
+ const seconds = Math.trunc(date.getTime() / 1_000);
3018
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
3019
+ return { seconds, nanos };
3020
+ }
3021
+
3022
+ function fromTimestamp(t: Timestamp): Date {
3023
+ let millis = (t.seconds || 0) * 1_000;
3024
+ millis += (t.nanos || 0) / 1_000_000;
3025
+ return new globalThis.Date(millis);
3026
+ }
3027
+
3028
+ function fromJsonTimestamp(o: any): Date {
3029
+ if (o instanceof globalThis.Date) {
3030
+ return o;
3031
+ } else if (typeof o === "string") {
3032
+ return new globalThis.Date(o);
3033
+ } else {
3034
+ return fromTimestamp(Timestamp.fromJSON(o));
3035
+ }
3036
+ }
3037
+
3038
+ function longToNumber(int64: { toString(): string }): number {
3039
+ const num = globalThis.Number(int64.toString());
3040
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
3041
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
3042
+ }
3043
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
3044
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
3045
+ }
3046
+ return num;
3047
+ }
3048
+
3049
+ function isObject(value: any): boolean {
3050
+ return typeof value === "object" && value !== null;
3051
+ }
3052
+
3053
+ function isSet(value: any): boolean {
3054
+ return value !== null && value !== undefined;
3055
+ }
3056
+
3057
+ export interface MessageFns<T> {
3058
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
3059
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
3060
+ fromJSON(object: any): T;
3061
+ toJSON(message: T): unknown;
3062
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
3063
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
3064
+ }