@control_yourself/contracts 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.11.1
3
+ // protoc-gen-ts_proto v2.11.2
4
4
  // protoc unknown
5
5
  // source: messenger.proto
6
6
 
@@ -18,9 +18,55 @@ import {
18
18
  type ServiceError,
19
19
  type UntypedServiceImplementation,
20
20
  } from "@grpc/grpc-js";
21
+ import { Empty } from "./google/protobuf/empty";
21
22
 
22
23
  export const protobufPackage = "messenger.v1";
23
24
 
25
+ export enum LinkTelegramAccountStatus {
26
+ STATUS_UNSPECIFIED = 0,
27
+ STATUS_COMPLETED = 1,
28
+ STATUS_PROCESSING = 2,
29
+ STATUS_FAILED = 3,
30
+ UNRECOGNIZED = -1,
31
+ }
32
+
33
+ export function linkTelegramAccountStatusFromJSON(object: any): LinkTelegramAccountStatus {
34
+ switch (object) {
35
+ case 0:
36
+ case "STATUS_UNSPECIFIED":
37
+ return LinkTelegramAccountStatus.STATUS_UNSPECIFIED;
38
+ case 1:
39
+ case "STATUS_COMPLETED":
40
+ return LinkTelegramAccountStatus.STATUS_COMPLETED;
41
+ case 2:
42
+ case "STATUS_PROCESSING":
43
+ return LinkTelegramAccountStatus.STATUS_PROCESSING;
44
+ case 3:
45
+ case "STATUS_FAILED":
46
+ return LinkTelegramAccountStatus.STATUS_FAILED;
47
+ case -1:
48
+ case "UNRECOGNIZED":
49
+ default:
50
+ return LinkTelegramAccountStatus.UNRECOGNIZED;
51
+ }
52
+ }
53
+
54
+ export function linkTelegramAccountStatusToJSON(object: LinkTelegramAccountStatus): string {
55
+ switch (object) {
56
+ case LinkTelegramAccountStatus.STATUS_UNSPECIFIED:
57
+ return "STATUS_UNSPECIFIED";
58
+ case LinkTelegramAccountStatus.STATUS_COMPLETED:
59
+ return "STATUS_COMPLETED";
60
+ case LinkTelegramAccountStatus.STATUS_PROCESSING:
61
+ return "STATUS_PROCESSING";
62
+ case LinkTelegramAccountStatus.STATUS_FAILED:
63
+ return "STATUS_FAILED";
64
+ case LinkTelegramAccountStatus.UNRECOGNIZED:
65
+ default:
66
+ return "UNRECOGNIZED";
67
+ }
68
+ }
69
+
24
70
  export interface GenerateTelegramLinkRequest {
25
71
  userId: number;
26
72
  }
@@ -29,22 +75,743 @@ export interface GenerateTelegramLinkResponse {
29
75
  link: string;
30
76
  }
31
77
 
32
- function createBaseGenerateTelegramLinkRequest(): GenerateTelegramLinkRequest {
78
+ export interface LinkTelegramAccountRequestPayload {
79
+ token: string;
80
+ }
81
+
82
+ export interface LinkTelegramAccountResponsePayload {
83
+ status: LinkTelegramAccountStatus;
84
+ message: string;
85
+ }
86
+
87
+ export interface TelegramMeta {
88
+ timestamp: number;
89
+ correlationId: string;
90
+ telegramUserId: number;
91
+ chatId: number;
92
+ headers: { [key: string]: string };
93
+ }
94
+
95
+ export interface TelegramMeta_HeadersEntry {
96
+ key: string;
97
+ value: string;
98
+ }
99
+
100
+ export interface LinkTelegramAccountRequest {
101
+ meta: TelegramMeta | undefined;
102
+ payload: LinkTelegramAccountRequestPayload | undefined;
103
+ }
104
+
105
+ export interface LinkTelegramAccountResponse {
106
+ meta: TelegramMeta | undefined;
107
+ payload: LinkTelegramAccountResponsePayload | undefined;
108
+ }
109
+
110
+ export interface GetIntegrationsRequest {
111
+ userId: number;
112
+ }
113
+
114
+ export interface Integration {
115
+ id: number;
116
+ meta: { [key: string]: string };
117
+ messenger: string;
118
+ messengerId: string;
119
+ userId: number;
120
+ createdAt: number;
121
+ updatedAt: number;
122
+ deletedAt: number;
123
+ }
124
+
125
+ export interface Integration_MetaEntry {
126
+ key: string;
127
+ value: string;
128
+ }
129
+
130
+ export interface GetIntegrationsResponse {
131
+ integrations: Integration[];
132
+ }
133
+
134
+ export interface RemoveIntegrationRequest {
135
+ id: number;
136
+ }
137
+
138
+ function createBaseGenerateTelegramLinkRequest(): GenerateTelegramLinkRequest {
139
+ return { userId: 0 };
140
+ }
141
+
142
+ export const GenerateTelegramLinkRequest: MessageFns<GenerateTelegramLinkRequest> = {
143
+ encode(message: GenerateTelegramLinkRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
144
+ if (message.userId !== 0) {
145
+ writer.uint32(8).int32(message.userId);
146
+ }
147
+ return writer;
148
+ },
149
+
150
+ decode(input: BinaryReader | Uint8Array, length?: number): GenerateTelegramLinkRequest {
151
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
152
+ const end = length === undefined ? reader.len : reader.pos + length;
153
+ const message = createBaseGenerateTelegramLinkRequest();
154
+ while (reader.pos < end) {
155
+ const tag = reader.uint32();
156
+ switch (tag >>> 3) {
157
+ case 1: {
158
+ if (tag !== 8) {
159
+ break;
160
+ }
161
+
162
+ message.userId = reader.int32();
163
+ continue;
164
+ }
165
+ }
166
+ if ((tag & 7) === 4 || tag === 0) {
167
+ break;
168
+ }
169
+ reader.skip(tag & 7);
170
+ }
171
+ return message;
172
+ },
173
+
174
+ fromJSON(object: any): GenerateTelegramLinkRequest {
175
+ return {
176
+ userId: isSet(object.userId)
177
+ ? globalThis.Number(object.userId)
178
+ : isSet(object.user_id)
179
+ ? globalThis.Number(object.user_id)
180
+ : 0,
181
+ };
182
+ },
183
+
184
+ toJSON(message: GenerateTelegramLinkRequest): unknown {
185
+ const obj: any = {};
186
+ if (message.userId !== 0) {
187
+ obj.userId = Math.round(message.userId);
188
+ }
189
+ return obj;
190
+ },
191
+
192
+ create<I extends Exact<DeepPartial<GenerateTelegramLinkRequest>, I>>(base?: I): GenerateTelegramLinkRequest {
193
+ return GenerateTelegramLinkRequest.fromPartial(base ?? ({} as any));
194
+ },
195
+ fromPartial<I extends Exact<DeepPartial<GenerateTelegramLinkRequest>, I>>(object: I): GenerateTelegramLinkRequest {
196
+ const message = createBaseGenerateTelegramLinkRequest();
197
+ message.userId = object.userId ?? 0;
198
+ return message;
199
+ },
200
+ };
201
+
202
+ function createBaseGenerateTelegramLinkResponse(): GenerateTelegramLinkResponse {
203
+ return { link: "" };
204
+ }
205
+
206
+ export const GenerateTelegramLinkResponse: MessageFns<GenerateTelegramLinkResponse> = {
207
+ encode(message: GenerateTelegramLinkResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
208
+ if (message.link !== "") {
209
+ writer.uint32(10).string(message.link);
210
+ }
211
+ return writer;
212
+ },
213
+
214
+ decode(input: BinaryReader | Uint8Array, length?: number): GenerateTelegramLinkResponse {
215
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
216
+ const end = length === undefined ? reader.len : reader.pos + length;
217
+ const message = createBaseGenerateTelegramLinkResponse();
218
+ while (reader.pos < end) {
219
+ const tag = reader.uint32();
220
+ switch (tag >>> 3) {
221
+ case 1: {
222
+ if (tag !== 10) {
223
+ break;
224
+ }
225
+
226
+ message.link = reader.string();
227
+ continue;
228
+ }
229
+ }
230
+ if ((tag & 7) === 4 || tag === 0) {
231
+ break;
232
+ }
233
+ reader.skip(tag & 7);
234
+ }
235
+ return message;
236
+ },
237
+
238
+ fromJSON(object: any): GenerateTelegramLinkResponse {
239
+ return { link: isSet(object.link) ? globalThis.String(object.link) : "" };
240
+ },
241
+
242
+ toJSON(message: GenerateTelegramLinkResponse): unknown {
243
+ const obj: any = {};
244
+ if (message.link !== "") {
245
+ obj.link = message.link;
246
+ }
247
+ return obj;
248
+ },
249
+
250
+ create<I extends Exact<DeepPartial<GenerateTelegramLinkResponse>, I>>(base?: I): GenerateTelegramLinkResponse {
251
+ return GenerateTelegramLinkResponse.fromPartial(base ?? ({} as any));
252
+ },
253
+ fromPartial<I extends Exact<DeepPartial<GenerateTelegramLinkResponse>, I>>(object: I): GenerateTelegramLinkResponse {
254
+ const message = createBaseGenerateTelegramLinkResponse();
255
+ message.link = object.link ?? "";
256
+ return message;
257
+ },
258
+ };
259
+
260
+ function createBaseLinkTelegramAccountRequestPayload(): LinkTelegramAccountRequestPayload {
261
+ return { token: "" };
262
+ }
263
+
264
+ export const LinkTelegramAccountRequestPayload: MessageFns<LinkTelegramAccountRequestPayload> = {
265
+ encode(message: LinkTelegramAccountRequestPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
266
+ if (message.token !== "") {
267
+ writer.uint32(10).string(message.token);
268
+ }
269
+ return writer;
270
+ },
271
+
272
+ decode(input: BinaryReader | Uint8Array, length?: number): LinkTelegramAccountRequestPayload {
273
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
274
+ const end = length === undefined ? reader.len : reader.pos + length;
275
+ const message = createBaseLinkTelegramAccountRequestPayload();
276
+ while (reader.pos < end) {
277
+ const tag = reader.uint32();
278
+ switch (tag >>> 3) {
279
+ case 1: {
280
+ if (tag !== 10) {
281
+ break;
282
+ }
283
+
284
+ message.token = reader.string();
285
+ continue;
286
+ }
287
+ }
288
+ if ((tag & 7) === 4 || tag === 0) {
289
+ break;
290
+ }
291
+ reader.skip(tag & 7);
292
+ }
293
+ return message;
294
+ },
295
+
296
+ fromJSON(object: any): LinkTelegramAccountRequestPayload {
297
+ return { token: isSet(object.token) ? globalThis.String(object.token) : "" };
298
+ },
299
+
300
+ toJSON(message: LinkTelegramAccountRequestPayload): unknown {
301
+ const obj: any = {};
302
+ if (message.token !== "") {
303
+ obj.token = message.token;
304
+ }
305
+ return obj;
306
+ },
307
+
308
+ create<I extends Exact<DeepPartial<LinkTelegramAccountRequestPayload>, I>>(
309
+ base?: I,
310
+ ): LinkTelegramAccountRequestPayload {
311
+ return LinkTelegramAccountRequestPayload.fromPartial(base ?? ({} as any));
312
+ },
313
+ fromPartial<I extends Exact<DeepPartial<LinkTelegramAccountRequestPayload>, I>>(
314
+ object: I,
315
+ ): LinkTelegramAccountRequestPayload {
316
+ const message = createBaseLinkTelegramAccountRequestPayload();
317
+ message.token = object.token ?? "";
318
+ return message;
319
+ },
320
+ };
321
+
322
+ function createBaseLinkTelegramAccountResponsePayload(): LinkTelegramAccountResponsePayload {
323
+ return { status: 0, message: "" };
324
+ }
325
+
326
+ export const LinkTelegramAccountResponsePayload: MessageFns<LinkTelegramAccountResponsePayload> = {
327
+ encode(message: LinkTelegramAccountResponsePayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
328
+ if (message.status !== 0) {
329
+ writer.uint32(8).int32(message.status);
330
+ }
331
+ if (message.message !== "") {
332
+ writer.uint32(18).string(message.message);
333
+ }
334
+ return writer;
335
+ },
336
+
337
+ decode(input: BinaryReader | Uint8Array, length?: number): LinkTelegramAccountResponsePayload {
338
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
339
+ const end = length === undefined ? reader.len : reader.pos + length;
340
+ const message = createBaseLinkTelegramAccountResponsePayload();
341
+ while (reader.pos < end) {
342
+ const tag = reader.uint32();
343
+ switch (tag >>> 3) {
344
+ case 1: {
345
+ if (tag !== 8) {
346
+ break;
347
+ }
348
+
349
+ message.status = reader.int32() as any;
350
+ continue;
351
+ }
352
+ case 2: {
353
+ if (tag !== 18) {
354
+ break;
355
+ }
356
+
357
+ message.message = reader.string();
358
+ continue;
359
+ }
360
+ }
361
+ if ((tag & 7) === 4 || tag === 0) {
362
+ break;
363
+ }
364
+ reader.skip(tag & 7);
365
+ }
366
+ return message;
367
+ },
368
+
369
+ fromJSON(object: any): LinkTelegramAccountResponsePayload {
370
+ return {
371
+ status: isSet(object.status) ? linkTelegramAccountStatusFromJSON(object.status) : 0,
372
+ message: isSet(object.message) ? globalThis.String(object.message) : "",
373
+ };
374
+ },
375
+
376
+ toJSON(message: LinkTelegramAccountResponsePayload): unknown {
377
+ const obj: any = {};
378
+ if (message.status !== 0) {
379
+ obj.status = linkTelegramAccountStatusToJSON(message.status);
380
+ }
381
+ if (message.message !== "") {
382
+ obj.message = message.message;
383
+ }
384
+ return obj;
385
+ },
386
+
387
+ create<I extends Exact<DeepPartial<LinkTelegramAccountResponsePayload>, I>>(
388
+ base?: I,
389
+ ): LinkTelegramAccountResponsePayload {
390
+ return LinkTelegramAccountResponsePayload.fromPartial(base ?? ({} as any));
391
+ },
392
+ fromPartial<I extends Exact<DeepPartial<LinkTelegramAccountResponsePayload>, I>>(
393
+ object: I,
394
+ ): LinkTelegramAccountResponsePayload {
395
+ const message = createBaseLinkTelegramAccountResponsePayload();
396
+ message.status = object.status ?? 0;
397
+ message.message = object.message ?? "";
398
+ return message;
399
+ },
400
+ };
401
+
402
+ function createBaseTelegramMeta(): TelegramMeta {
403
+ return { timestamp: 0, correlationId: "", telegramUserId: 0, chatId: 0, headers: {} };
404
+ }
405
+
406
+ export const TelegramMeta: MessageFns<TelegramMeta> = {
407
+ encode(message: TelegramMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
408
+ if (message.timestamp !== 0) {
409
+ writer.uint32(8).int64(message.timestamp);
410
+ }
411
+ if (message.correlationId !== "") {
412
+ writer.uint32(18).string(message.correlationId);
413
+ }
414
+ if (message.telegramUserId !== 0) {
415
+ writer.uint32(24).int64(message.telegramUserId);
416
+ }
417
+ if (message.chatId !== 0) {
418
+ writer.uint32(32).int64(message.chatId);
419
+ }
420
+ globalThis.Object.entries(message.headers).forEach(([key, value]: [string, string]) => {
421
+ TelegramMeta_HeadersEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).join();
422
+ });
423
+ return writer;
424
+ },
425
+
426
+ decode(input: BinaryReader | Uint8Array, length?: number): TelegramMeta {
427
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
428
+ const end = length === undefined ? reader.len : reader.pos + length;
429
+ const message = createBaseTelegramMeta();
430
+ while (reader.pos < end) {
431
+ const tag = reader.uint32();
432
+ switch (tag >>> 3) {
433
+ case 1: {
434
+ if (tag !== 8) {
435
+ break;
436
+ }
437
+
438
+ message.timestamp = longToNumber(reader.int64());
439
+ continue;
440
+ }
441
+ case 2: {
442
+ if (tag !== 18) {
443
+ break;
444
+ }
445
+
446
+ message.correlationId = reader.string();
447
+ continue;
448
+ }
449
+ case 3: {
450
+ if (tag !== 24) {
451
+ break;
452
+ }
453
+
454
+ message.telegramUserId = longToNumber(reader.int64());
455
+ continue;
456
+ }
457
+ case 4: {
458
+ if (tag !== 32) {
459
+ break;
460
+ }
461
+
462
+ message.chatId = longToNumber(reader.int64());
463
+ continue;
464
+ }
465
+ case 5: {
466
+ if (tag !== 42) {
467
+ break;
468
+ }
469
+
470
+ const entry5 = TelegramMeta_HeadersEntry.decode(reader, reader.uint32());
471
+ if (entry5.value !== undefined) {
472
+ message.headers[entry5.key] = entry5.value;
473
+ }
474
+ continue;
475
+ }
476
+ }
477
+ if ((tag & 7) === 4 || tag === 0) {
478
+ break;
479
+ }
480
+ reader.skip(tag & 7);
481
+ }
482
+ return message;
483
+ },
484
+
485
+ fromJSON(object: any): TelegramMeta {
486
+ return {
487
+ timestamp: isSet(object.timestamp) ? globalThis.Number(object.timestamp) : 0,
488
+ correlationId: isSet(object.correlationId)
489
+ ? globalThis.String(object.correlationId)
490
+ : isSet(object.correlation_id)
491
+ ? globalThis.String(object.correlation_id)
492
+ : "",
493
+ telegramUserId: isSet(object.telegramUserId)
494
+ ? globalThis.Number(object.telegramUserId)
495
+ : isSet(object.telegram_user_id)
496
+ ? globalThis.Number(object.telegram_user_id)
497
+ : 0,
498
+ chatId: isSet(object.chatId)
499
+ ? globalThis.Number(object.chatId)
500
+ : isSet(object.chat_id)
501
+ ? globalThis.Number(object.chat_id)
502
+ : 0,
503
+ headers: isObject(object.headers)
504
+ ? (globalThis.Object.entries(object.headers) as [string, any][]).reduce(
505
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
506
+ acc[key] = globalThis.String(value);
507
+ return acc;
508
+ },
509
+ {},
510
+ )
511
+ : {},
512
+ };
513
+ },
514
+
515
+ toJSON(message: TelegramMeta): unknown {
516
+ const obj: any = {};
517
+ if (message.timestamp !== 0) {
518
+ obj.timestamp = Math.round(message.timestamp);
519
+ }
520
+ if (message.correlationId !== "") {
521
+ obj.correlationId = message.correlationId;
522
+ }
523
+ if (message.telegramUserId !== 0) {
524
+ obj.telegramUserId = Math.round(message.telegramUserId);
525
+ }
526
+ if (message.chatId !== 0) {
527
+ obj.chatId = Math.round(message.chatId);
528
+ }
529
+ if (message.headers) {
530
+ const entries = globalThis.Object.entries(message.headers) as [string, string][];
531
+ if (entries.length > 0) {
532
+ obj.headers = {};
533
+ entries.forEach(([k, v]) => {
534
+ obj.headers[k] = v;
535
+ });
536
+ }
537
+ }
538
+ return obj;
539
+ },
540
+
541
+ create<I extends Exact<DeepPartial<TelegramMeta>, I>>(base?: I): TelegramMeta {
542
+ return TelegramMeta.fromPartial(base ?? ({} as any));
543
+ },
544
+ fromPartial<I extends Exact<DeepPartial<TelegramMeta>, I>>(object: I): TelegramMeta {
545
+ const message = createBaseTelegramMeta();
546
+ message.timestamp = object.timestamp ?? 0;
547
+ message.correlationId = object.correlationId ?? "";
548
+ message.telegramUserId = object.telegramUserId ?? 0;
549
+ message.chatId = object.chatId ?? 0;
550
+ message.headers = (globalThis.Object.entries(object.headers ?? {}) as [string, string][]).reduce(
551
+ (acc: { [key: string]: string }, [key, value]: [string, string]) => {
552
+ if (value !== undefined) {
553
+ acc[key] = globalThis.String(value);
554
+ }
555
+ return acc;
556
+ },
557
+ {},
558
+ );
559
+ return message;
560
+ },
561
+ };
562
+
563
+ function createBaseTelegramMeta_HeadersEntry(): TelegramMeta_HeadersEntry {
564
+ return { key: "", value: "" };
565
+ }
566
+
567
+ export const TelegramMeta_HeadersEntry: MessageFns<TelegramMeta_HeadersEntry> = {
568
+ encode(message: TelegramMeta_HeadersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
569
+ if (message.key !== "") {
570
+ writer.uint32(10).string(message.key);
571
+ }
572
+ if (message.value !== "") {
573
+ writer.uint32(18).string(message.value);
574
+ }
575
+ return writer;
576
+ },
577
+
578
+ decode(input: BinaryReader | Uint8Array, length?: number): TelegramMeta_HeadersEntry {
579
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
580
+ const end = length === undefined ? reader.len : reader.pos + length;
581
+ const message = createBaseTelegramMeta_HeadersEntry();
582
+ while (reader.pos < end) {
583
+ const tag = reader.uint32();
584
+ switch (tag >>> 3) {
585
+ case 1: {
586
+ if (tag !== 10) {
587
+ break;
588
+ }
589
+
590
+ message.key = reader.string();
591
+ continue;
592
+ }
593
+ case 2: {
594
+ if (tag !== 18) {
595
+ break;
596
+ }
597
+
598
+ message.value = reader.string();
599
+ continue;
600
+ }
601
+ }
602
+ if ((tag & 7) === 4 || tag === 0) {
603
+ break;
604
+ }
605
+ reader.skip(tag & 7);
606
+ }
607
+ return message;
608
+ },
609
+
610
+ fromJSON(object: any): TelegramMeta_HeadersEntry {
611
+ return {
612
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
613
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
614
+ };
615
+ },
616
+
617
+ toJSON(message: TelegramMeta_HeadersEntry): unknown {
618
+ const obj: any = {};
619
+ if (message.key !== "") {
620
+ obj.key = message.key;
621
+ }
622
+ if (message.value !== "") {
623
+ obj.value = message.value;
624
+ }
625
+ return obj;
626
+ },
627
+
628
+ create<I extends Exact<DeepPartial<TelegramMeta_HeadersEntry>, I>>(base?: I): TelegramMeta_HeadersEntry {
629
+ return TelegramMeta_HeadersEntry.fromPartial(base ?? ({} as any));
630
+ },
631
+ fromPartial<I extends Exact<DeepPartial<TelegramMeta_HeadersEntry>, I>>(object: I): TelegramMeta_HeadersEntry {
632
+ const message = createBaseTelegramMeta_HeadersEntry();
633
+ message.key = object.key ?? "";
634
+ message.value = object.value ?? "";
635
+ return message;
636
+ },
637
+ };
638
+
639
+ function createBaseLinkTelegramAccountRequest(): LinkTelegramAccountRequest {
640
+ return { meta: undefined, payload: undefined };
641
+ }
642
+
643
+ export const LinkTelegramAccountRequest: MessageFns<LinkTelegramAccountRequest> = {
644
+ encode(message: LinkTelegramAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
645
+ if (message.meta !== undefined) {
646
+ TelegramMeta.encode(message.meta, writer.uint32(10).fork()).join();
647
+ }
648
+ if (message.payload !== undefined) {
649
+ LinkTelegramAccountRequestPayload.encode(message.payload, writer.uint32(18).fork()).join();
650
+ }
651
+ return writer;
652
+ },
653
+
654
+ decode(input: BinaryReader | Uint8Array, length?: number): LinkTelegramAccountRequest {
655
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
656
+ const end = length === undefined ? reader.len : reader.pos + length;
657
+ const message = createBaseLinkTelegramAccountRequest();
658
+ while (reader.pos < end) {
659
+ const tag = reader.uint32();
660
+ switch (tag >>> 3) {
661
+ case 1: {
662
+ if (tag !== 10) {
663
+ break;
664
+ }
665
+
666
+ message.meta = TelegramMeta.decode(reader, reader.uint32());
667
+ continue;
668
+ }
669
+ case 2: {
670
+ if (tag !== 18) {
671
+ break;
672
+ }
673
+
674
+ message.payload = LinkTelegramAccountRequestPayload.decode(reader, reader.uint32());
675
+ continue;
676
+ }
677
+ }
678
+ if ((tag & 7) === 4 || tag === 0) {
679
+ break;
680
+ }
681
+ reader.skip(tag & 7);
682
+ }
683
+ return message;
684
+ },
685
+
686
+ fromJSON(object: any): LinkTelegramAccountRequest {
687
+ return {
688
+ meta: isSet(object.meta) ? TelegramMeta.fromJSON(object.meta) : undefined,
689
+ payload: isSet(object.payload) ? LinkTelegramAccountRequestPayload.fromJSON(object.payload) : undefined,
690
+ };
691
+ },
692
+
693
+ toJSON(message: LinkTelegramAccountRequest): unknown {
694
+ const obj: any = {};
695
+ if (message.meta !== undefined) {
696
+ obj.meta = TelegramMeta.toJSON(message.meta);
697
+ }
698
+ if (message.payload !== undefined) {
699
+ obj.payload = LinkTelegramAccountRequestPayload.toJSON(message.payload);
700
+ }
701
+ return obj;
702
+ },
703
+
704
+ create<I extends Exact<DeepPartial<LinkTelegramAccountRequest>, I>>(base?: I): LinkTelegramAccountRequest {
705
+ return LinkTelegramAccountRequest.fromPartial(base ?? ({} as any));
706
+ },
707
+ fromPartial<I extends Exact<DeepPartial<LinkTelegramAccountRequest>, I>>(object: I): LinkTelegramAccountRequest {
708
+ const message = createBaseLinkTelegramAccountRequest();
709
+ message.meta = (object.meta !== undefined && object.meta !== null)
710
+ ? TelegramMeta.fromPartial(object.meta)
711
+ : undefined;
712
+ message.payload = (object.payload !== undefined && object.payload !== null)
713
+ ? LinkTelegramAccountRequestPayload.fromPartial(object.payload)
714
+ : undefined;
715
+ return message;
716
+ },
717
+ };
718
+
719
+ function createBaseLinkTelegramAccountResponse(): LinkTelegramAccountResponse {
720
+ return { meta: undefined, payload: undefined };
721
+ }
722
+
723
+ export const LinkTelegramAccountResponse: MessageFns<LinkTelegramAccountResponse> = {
724
+ encode(message: LinkTelegramAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
725
+ if (message.meta !== undefined) {
726
+ TelegramMeta.encode(message.meta, writer.uint32(10).fork()).join();
727
+ }
728
+ if (message.payload !== undefined) {
729
+ LinkTelegramAccountResponsePayload.encode(message.payload, writer.uint32(18).fork()).join();
730
+ }
731
+ return writer;
732
+ },
733
+
734
+ decode(input: BinaryReader | Uint8Array, length?: number): LinkTelegramAccountResponse {
735
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
736
+ const end = length === undefined ? reader.len : reader.pos + length;
737
+ const message = createBaseLinkTelegramAccountResponse();
738
+ while (reader.pos < end) {
739
+ const tag = reader.uint32();
740
+ switch (tag >>> 3) {
741
+ case 1: {
742
+ if (tag !== 10) {
743
+ break;
744
+ }
745
+
746
+ message.meta = TelegramMeta.decode(reader, reader.uint32());
747
+ continue;
748
+ }
749
+ case 2: {
750
+ if (tag !== 18) {
751
+ break;
752
+ }
753
+
754
+ message.payload = LinkTelegramAccountResponsePayload.decode(reader, reader.uint32());
755
+ continue;
756
+ }
757
+ }
758
+ if ((tag & 7) === 4 || tag === 0) {
759
+ break;
760
+ }
761
+ reader.skip(tag & 7);
762
+ }
763
+ return message;
764
+ },
765
+
766
+ fromJSON(object: any): LinkTelegramAccountResponse {
767
+ return {
768
+ meta: isSet(object.meta) ? TelegramMeta.fromJSON(object.meta) : undefined,
769
+ payload: isSet(object.payload) ? LinkTelegramAccountResponsePayload.fromJSON(object.payload) : undefined,
770
+ };
771
+ },
772
+
773
+ toJSON(message: LinkTelegramAccountResponse): unknown {
774
+ const obj: any = {};
775
+ if (message.meta !== undefined) {
776
+ obj.meta = TelegramMeta.toJSON(message.meta);
777
+ }
778
+ if (message.payload !== undefined) {
779
+ obj.payload = LinkTelegramAccountResponsePayload.toJSON(message.payload);
780
+ }
781
+ return obj;
782
+ },
783
+
784
+ create<I extends Exact<DeepPartial<LinkTelegramAccountResponse>, I>>(base?: I): LinkTelegramAccountResponse {
785
+ return LinkTelegramAccountResponse.fromPartial(base ?? ({} as any));
786
+ },
787
+ fromPartial<I extends Exact<DeepPartial<LinkTelegramAccountResponse>, I>>(object: I): LinkTelegramAccountResponse {
788
+ const message = createBaseLinkTelegramAccountResponse();
789
+ message.meta = (object.meta !== undefined && object.meta !== null)
790
+ ? TelegramMeta.fromPartial(object.meta)
791
+ : undefined;
792
+ message.payload = (object.payload !== undefined && object.payload !== null)
793
+ ? LinkTelegramAccountResponsePayload.fromPartial(object.payload)
794
+ : undefined;
795
+ return message;
796
+ },
797
+ };
798
+
799
+ function createBaseGetIntegrationsRequest(): GetIntegrationsRequest {
33
800
  return { userId: 0 };
34
801
  }
35
802
 
36
- export const GenerateTelegramLinkRequest: MessageFns<GenerateTelegramLinkRequest> = {
37
- encode(message: GenerateTelegramLinkRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
803
+ export const GetIntegrationsRequest: MessageFns<GetIntegrationsRequest> = {
804
+ encode(message: GetIntegrationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
38
805
  if (message.userId !== 0) {
39
806
  writer.uint32(8).int32(message.userId);
40
807
  }
41
808
  return writer;
42
809
  },
43
810
 
44
- decode(input: BinaryReader | Uint8Array, length?: number): GenerateTelegramLinkRequest {
811
+ decode(input: BinaryReader | Uint8Array, length?: number): GetIntegrationsRequest {
45
812
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
46
813
  const end = length === undefined ? reader.len : reader.pos + length;
47
- const message = createBaseGenerateTelegramLinkRequest();
814
+ const message = createBaseGetIntegrationsRequest();
48
815
  while (reader.pos < end) {
49
816
  const tag = reader.uint32();
50
817
  switch (tag >>> 3) {
@@ -65,7 +832,7 @@ export const GenerateTelegramLinkRequest: MessageFns<GenerateTelegramLinkRequest
65
832
  return message;
66
833
  },
67
834
 
68
- fromJSON(object: any): GenerateTelegramLinkRequest {
835
+ fromJSON(object: any): GetIntegrationsRequest {
69
836
  return {
70
837
  userId: isSet(object.userId)
71
838
  ? globalThis.Number(object.userId)
@@ -75,7 +842,7 @@ export const GenerateTelegramLinkRequest: MessageFns<GenerateTelegramLinkRequest
75
842
  };
76
843
  },
77
844
 
78
- toJSON(message: GenerateTelegramLinkRequest): unknown {
845
+ toJSON(message: GetIntegrationsRequest): unknown {
79
846
  const obj: any = {};
80
847
  if (message.userId !== 0) {
81
848
  obj.userId = Math.round(message.userId);
@@ -83,32 +850,252 @@ export const GenerateTelegramLinkRequest: MessageFns<GenerateTelegramLinkRequest
83
850
  return obj;
84
851
  },
85
852
 
86
- create<I extends Exact<DeepPartial<GenerateTelegramLinkRequest>, I>>(base?: I): GenerateTelegramLinkRequest {
87
- return GenerateTelegramLinkRequest.fromPartial(base ?? ({} as any));
853
+ create<I extends Exact<DeepPartial<GetIntegrationsRequest>, I>>(base?: I): GetIntegrationsRequest {
854
+ return GetIntegrationsRequest.fromPartial(base ?? ({} as any));
88
855
  },
89
- fromPartial<I extends Exact<DeepPartial<GenerateTelegramLinkRequest>, I>>(object: I): GenerateTelegramLinkRequest {
90
- const message = createBaseGenerateTelegramLinkRequest();
856
+ fromPartial<I extends Exact<DeepPartial<GetIntegrationsRequest>, I>>(object: I): GetIntegrationsRequest {
857
+ const message = createBaseGetIntegrationsRequest();
91
858
  message.userId = object.userId ?? 0;
92
859
  return message;
93
860
  },
94
861
  };
95
862
 
96
- function createBaseGenerateTelegramLinkResponse(): GenerateTelegramLinkResponse {
97
- return { link: "" };
863
+ function createBaseIntegration(): Integration {
864
+ return { id: 0, meta: {}, messenger: "", messengerId: "", userId: 0, createdAt: 0, updatedAt: 0, deletedAt: 0 };
98
865
  }
99
866
 
100
- export const GenerateTelegramLinkResponse: MessageFns<GenerateTelegramLinkResponse> = {
101
- encode(message: GenerateTelegramLinkResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
102
- if (message.link !== "") {
103
- writer.uint32(10).string(message.link);
867
+ export const Integration: MessageFns<Integration> = {
868
+ encode(message: Integration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
869
+ if (message.id !== 0) {
870
+ writer.uint32(8).int32(message.id);
871
+ }
872
+ globalThis.Object.entries(message.meta).forEach(([key, value]: [string, string]) => {
873
+ Integration_MetaEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join();
874
+ });
875
+ if (message.messenger !== "") {
876
+ writer.uint32(26).string(message.messenger);
877
+ }
878
+ if (message.messengerId !== "") {
879
+ writer.uint32(34).string(message.messengerId);
880
+ }
881
+ if (message.userId !== 0) {
882
+ writer.uint32(40).int32(message.userId);
883
+ }
884
+ if (message.createdAt !== 0) {
885
+ writer.uint32(48).int32(message.createdAt);
886
+ }
887
+ if (message.updatedAt !== 0) {
888
+ writer.uint32(56).int32(message.updatedAt);
889
+ }
890
+ if (message.deletedAt !== 0) {
891
+ writer.uint32(64).int32(message.deletedAt);
104
892
  }
105
893
  return writer;
106
894
  },
107
895
 
108
- decode(input: BinaryReader | Uint8Array, length?: number): GenerateTelegramLinkResponse {
896
+ decode(input: BinaryReader | Uint8Array, length?: number): Integration {
109
897
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
110
898
  const end = length === undefined ? reader.len : reader.pos + length;
111
- const message = createBaseGenerateTelegramLinkResponse();
899
+ const message = createBaseIntegration();
900
+ while (reader.pos < end) {
901
+ const tag = reader.uint32();
902
+ switch (tag >>> 3) {
903
+ case 1: {
904
+ if (tag !== 8) {
905
+ break;
906
+ }
907
+
908
+ message.id = reader.int32();
909
+ continue;
910
+ }
911
+ case 2: {
912
+ if (tag !== 18) {
913
+ break;
914
+ }
915
+
916
+ const entry2 = Integration_MetaEntry.decode(reader, reader.uint32());
917
+ if (entry2.value !== undefined) {
918
+ message.meta[entry2.key] = entry2.value;
919
+ }
920
+ continue;
921
+ }
922
+ case 3: {
923
+ if (tag !== 26) {
924
+ break;
925
+ }
926
+
927
+ message.messenger = reader.string();
928
+ continue;
929
+ }
930
+ case 4: {
931
+ if (tag !== 34) {
932
+ break;
933
+ }
934
+
935
+ message.messengerId = reader.string();
936
+ continue;
937
+ }
938
+ case 5: {
939
+ if (tag !== 40) {
940
+ break;
941
+ }
942
+
943
+ message.userId = reader.int32();
944
+ continue;
945
+ }
946
+ case 6: {
947
+ if (tag !== 48) {
948
+ break;
949
+ }
950
+
951
+ message.createdAt = reader.int32();
952
+ continue;
953
+ }
954
+ case 7: {
955
+ if (tag !== 56) {
956
+ break;
957
+ }
958
+
959
+ message.updatedAt = reader.int32();
960
+ continue;
961
+ }
962
+ case 8: {
963
+ if (tag !== 64) {
964
+ break;
965
+ }
966
+
967
+ message.deletedAt = reader.int32();
968
+ continue;
969
+ }
970
+ }
971
+ if ((tag & 7) === 4 || tag === 0) {
972
+ break;
973
+ }
974
+ reader.skip(tag & 7);
975
+ }
976
+ return message;
977
+ },
978
+
979
+ fromJSON(object: any): Integration {
980
+ return {
981
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
982
+ meta: isObject(object.meta)
983
+ ? (globalThis.Object.entries(object.meta) as [string, any][]).reduce(
984
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
985
+ acc[key] = globalThis.String(value);
986
+ return acc;
987
+ },
988
+ {},
989
+ )
990
+ : {},
991
+ messenger: isSet(object.messenger) ? globalThis.String(object.messenger) : "",
992
+ messengerId: isSet(object.messengerId)
993
+ ? globalThis.String(object.messengerId)
994
+ : isSet(object.messenger_id)
995
+ ? globalThis.String(object.messenger_id)
996
+ : "",
997
+ userId: isSet(object.userId)
998
+ ? globalThis.Number(object.userId)
999
+ : isSet(object.user_id)
1000
+ ? globalThis.Number(object.user_id)
1001
+ : 0,
1002
+ createdAt: isSet(object.createdAt)
1003
+ ? globalThis.Number(object.createdAt)
1004
+ : isSet(object.created_at)
1005
+ ? globalThis.Number(object.created_at)
1006
+ : 0,
1007
+ updatedAt: isSet(object.updatedAt)
1008
+ ? globalThis.Number(object.updatedAt)
1009
+ : isSet(object.updated_at)
1010
+ ? globalThis.Number(object.updated_at)
1011
+ : 0,
1012
+ deletedAt: isSet(object.deletedAt)
1013
+ ? globalThis.Number(object.deletedAt)
1014
+ : isSet(object.deleted_at)
1015
+ ? globalThis.Number(object.deleted_at)
1016
+ : 0,
1017
+ };
1018
+ },
1019
+
1020
+ toJSON(message: Integration): unknown {
1021
+ const obj: any = {};
1022
+ if (message.id !== 0) {
1023
+ obj.id = Math.round(message.id);
1024
+ }
1025
+ if (message.meta) {
1026
+ const entries = globalThis.Object.entries(message.meta) as [string, string][];
1027
+ if (entries.length > 0) {
1028
+ obj.meta = {};
1029
+ entries.forEach(([k, v]) => {
1030
+ obj.meta[k] = v;
1031
+ });
1032
+ }
1033
+ }
1034
+ if (message.messenger !== "") {
1035
+ obj.messenger = message.messenger;
1036
+ }
1037
+ if (message.messengerId !== "") {
1038
+ obj.messengerId = message.messengerId;
1039
+ }
1040
+ if (message.userId !== 0) {
1041
+ obj.userId = Math.round(message.userId);
1042
+ }
1043
+ if (message.createdAt !== 0) {
1044
+ obj.createdAt = Math.round(message.createdAt);
1045
+ }
1046
+ if (message.updatedAt !== 0) {
1047
+ obj.updatedAt = Math.round(message.updatedAt);
1048
+ }
1049
+ if (message.deletedAt !== 0) {
1050
+ obj.deletedAt = Math.round(message.deletedAt);
1051
+ }
1052
+ return obj;
1053
+ },
1054
+
1055
+ create<I extends Exact<DeepPartial<Integration>, I>>(base?: I): Integration {
1056
+ return Integration.fromPartial(base ?? ({} as any));
1057
+ },
1058
+ fromPartial<I extends Exact<DeepPartial<Integration>, I>>(object: I): Integration {
1059
+ const message = createBaseIntegration();
1060
+ message.id = object.id ?? 0;
1061
+ message.meta = (globalThis.Object.entries(object.meta ?? {}) as [string, string][]).reduce(
1062
+ (acc: { [key: string]: string }, [key, value]: [string, string]) => {
1063
+ if (value !== undefined) {
1064
+ acc[key] = globalThis.String(value);
1065
+ }
1066
+ return acc;
1067
+ },
1068
+ {},
1069
+ );
1070
+ message.messenger = object.messenger ?? "";
1071
+ message.messengerId = object.messengerId ?? "";
1072
+ message.userId = object.userId ?? 0;
1073
+ message.createdAt = object.createdAt ?? 0;
1074
+ message.updatedAt = object.updatedAt ?? 0;
1075
+ message.deletedAt = object.deletedAt ?? 0;
1076
+ return message;
1077
+ },
1078
+ };
1079
+
1080
+ function createBaseIntegration_MetaEntry(): Integration_MetaEntry {
1081
+ return { key: "", value: "" };
1082
+ }
1083
+
1084
+ export const Integration_MetaEntry: MessageFns<Integration_MetaEntry> = {
1085
+ encode(message: Integration_MetaEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1086
+ if (message.key !== "") {
1087
+ writer.uint32(10).string(message.key);
1088
+ }
1089
+ if (message.value !== "") {
1090
+ writer.uint32(18).string(message.value);
1091
+ }
1092
+ return writer;
1093
+ },
1094
+
1095
+ decode(input: BinaryReader | Uint8Array, length?: number): Integration_MetaEntry {
1096
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1097
+ const end = length === undefined ? reader.len : reader.pos + length;
1098
+ const message = createBaseIntegration_MetaEntry();
112
1099
  while (reader.pos < end) {
113
1100
  const tag = reader.uint32();
114
1101
  switch (tag >>> 3) {
@@ -117,7 +1104,15 @@ export const GenerateTelegramLinkResponse: MessageFns<GenerateTelegramLinkRespon
117
1104
  break;
118
1105
  }
119
1106
 
120
- message.link = reader.string();
1107
+ message.key = reader.string();
1108
+ continue;
1109
+ }
1110
+ case 2: {
1111
+ if (tag !== 18) {
1112
+ break;
1113
+ }
1114
+
1115
+ message.value = reader.string();
121
1116
  continue;
122
1117
  }
123
1118
  }
@@ -129,24 +1124,151 @@ export const GenerateTelegramLinkResponse: MessageFns<GenerateTelegramLinkRespon
129
1124
  return message;
130
1125
  },
131
1126
 
132
- fromJSON(object: any): GenerateTelegramLinkResponse {
133
- return { link: isSet(object.link) ? globalThis.String(object.link) : "" };
1127
+ fromJSON(object: any): Integration_MetaEntry {
1128
+ return {
1129
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
1130
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
1131
+ };
134
1132
  },
135
1133
 
136
- toJSON(message: GenerateTelegramLinkResponse): unknown {
1134
+ toJSON(message: Integration_MetaEntry): unknown {
137
1135
  const obj: any = {};
138
- if (message.link !== "") {
139
- obj.link = message.link;
1136
+ if (message.key !== "") {
1137
+ obj.key = message.key;
1138
+ }
1139
+ if (message.value !== "") {
1140
+ obj.value = message.value;
140
1141
  }
141
1142
  return obj;
142
1143
  },
143
1144
 
144
- create<I extends Exact<DeepPartial<GenerateTelegramLinkResponse>, I>>(base?: I): GenerateTelegramLinkResponse {
145
- return GenerateTelegramLinkResponse.fromPartial(base ?? ({} as any));
1145
+ create<I extends Exact<DeepPartial<Integration_MetaEntry>, I>>(base?: I): Integration_MetaEntry {
1146
+ return Integration_MetaEntry.fromPartial(base ?? ({} as any));
146
1147
  },
147
- fromPartial<I extends Exact<DeepPartial<GenerateTelegramLinkResponse>, I>>(object: I): GenerateTelegramLinkResponse {
148
- const message = createBaseGenerateTelegramLinkResponse();
149
- message.link = object.link ?? "";
1148
+ fromPartial<I extends Exact<DeepPartial<Integration_MetaEntry>, I>>(object: I): Integration_MetaEntry {
1149
+ const message = createBaseIntegration_MetaEntry();
1150
+ message.key = object.key ?? "";
1151
+ message.value = object.value ?? "";
1152
+ return message;
1153
+ },
1154
+ };
1155
+
1156
+ function createBaseGetIntegrationsResponse(): GetIntegrationsResponse {
1157
+ return { integrations: [] };
1158
+ }
1159
+
1160
+ export const GetIntegrationsResponse: MessageFns<GetIntegrationsResponse> = {
1161
+ encode(message: GetIntegrationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1162
+ for (const v of message.integrations) {
1163
+ Integration.encode(v!, writer.uint32(10).fork()).join();
1164
+ }
1165
+ return writer;
1166
+ },
1167
+
1168
+ decode(input: BinaryReader | Uint8Array, length?: number): GetIntegrationsResponse {
1169
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1170
+ const end = length === undefined ? reader.len : reader.pos + length;
1171
+ const message = createBaseGetIntegrationsResponse();
1172
+ while (reader.pos < end) {
1173
+ const tag = reader.uint32();
1174
+ switch (tag >>> 3) {
1175
+ case 1: {
1176
+ if (tag !== 10) {
1177
+ break;
1178
+ }
1179
+
1180
+ message.integrations.push(Integration.decode(reader, reader.uint32()));
1181
+ continue;
1182
+ }
1183
+ }
1184
+ if ((tag & 7) === 4 || tag === 0) {
1185
+ break;
1186
+ }
1187
+ reader.skip(tag & 7);
1188
+ }
1189
+ return message;
1190
+ },
1191
+
1192
+ fromJSON(object: any): GetIntegrationsResponse {
1193
+ return {
1194
+ integrations: globalThis.Array.isArray(object?.integrations)
1195
+ ? object.integrations.map((e: any) => Integration.fromJSON(e))
1196
+ : [],
1197
+ };
1198
+ },
1199
+
1200
+ toJSON(message: GetIntegrationsResponse): unknown {
1201
+ const obj: any = {};
1202
+ if (message.integrations?.length) {
1203
+ obj.integrations = message.integrations.map((e) => Integration.toJSON(e));
1204
+ }
1205
+ return obj;
1206
+ },
1207
+
1208
+ create<I extends Exact<DeepPartial<GetIntegrationsResponse>, I>>(base?: I): GetIntegrationsResponse {
1209
+ return GetIntegrationsResponse.fromPartial(base ?? ({} as any));
1210
+ },
1211
+ fromPartial<I extends Exact<DeepPartial<GetIntegrationsResponse>, I>>(object: I): GetIntegrationsResponse {
1212
+ const message = createBaseGetIntegrationsResponse();
1213
+ message.integrations = object.integrations?.map((e) => Integration.fromPartial(e)) || [];
1214
+ return message;
1215
+ },
1216
+ };
1217
+
1218
+ function createBaseRemoveIntegrationRequest(): RemoveIntegrationRequest {
1219
+ return { id: 0 };
1220
+ }
1221
+
1222
+ export const RemoveIntegrationRequest: MessageFns<RemoveIntegrationRequest> = {
1223
+ encode(message: RemoveIntegrationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1224
+ if (message.id !== 0) {
1225
+ writer.uint32(8).int32(message.id);
1226
+ }
1227
+ return writer;
1228
+ },
1229
+
1230
+ decode(input: BinaryReader | Uint8Array, length?: number): RemoveIntegrationRequest {
1231
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1232
+ const end = length === undefined ? reader.len : reader.pos + length;
1233
+ const message = createBaseRemoveIntegrationRequest();
1234
+ while (reader.pos < end) {
1235
+ const tag = reader.uint32();
1236
+ switch (tag >>> 3) {
1237
+ case 1: {
1238
+ if (tag !== 8) {
1239
+ break;
1240
+ }
1241
+
1242
+ message.id = reader.int32();
1243
+ continue;
1244
+ }
1245
+ }
1246
+ if ((tag & 7) === 4 || tag === 0) {
1247
+ break;
1248
+ }
1249
+ reader.skip(tag & 7);
1250
+ }
1251
+ return message;
1252
+ },
1253
+
1254
+ fromJSON(object: any): RemoveIntegrationRequest {
1255
+ return { id: isSet(object.id) ? globalThis.Number(object.id) : 0 };
1256
+ },
1257
+
1258
+ toJSON(message: RemoveIntegrationRequest): unknown {
1259
+ const obj: any = {};
1260
+ if (message.id !== 0) {
1261
+ obj.id = Math.round(message.id);
1262
+ }
1263
+ return obj;
1264
+ },
1265
+
1266
+ create<I extends Exact<DeepPartial<RemoveIntegrationRequest>, I>>(base?: I): RemoveIntegrationRequest {
1267
+ return RemoveIntegrationRequest.fromPartial(base ?? ({} as any));
1268
+ },
1269
+ fromPartial<I extends Exact<DeepPartial<RemoveIntegrationRequest>, I>>(object: I): RemoveIntegrationRequest {
1270
+ const message = createBaseRemoveIntegrationRequest();
1271
+ message.id = object.id ?? 0;
150
1272
  return message;
151
1273
  },
152
1274
  };
@@ -164,10 +1286,45 @@ export const MessengerServiceService = {
164
1286
  Buffer.from(GenerateTelegramLinkResponse.encode(value).finish()),
165
1287
  responseDeserialize: (value: Buffer): GenerateTelegramLinkResponse => GenerateTelegramLinkResponse.decode(value),
166
1288
  },
1289
+ linkTelegramAccount: {
1290
+ path: "/messenger.v1.MessengerService/LinkTelegramAccount",
1291
+ requestStream: false,
1292
+ responseStream: false,
1293
+ requestSerialize: (value: LinkTelegramAccountRequest): Buffer =>
1294
+ Buffer.from(LinkTelegramAccountRequest.encode(value).finish()),
1295
+ requestDeserialize: (value: Buffer): LinkTelegramAccountRequest => LinkTelegramAccountRequest.decode(value),
1296
+ responseSerialize: (value: LinkTelegramAccountResponse): Buffer =>
1297
+ Buffer.from(LinkTelegramAccountResponse.encode(value).finish()),
1298
+ responseDeserialize: (value: Buffer): LinkTelegramAccountResponse => LinkTelegramAccountResponse.decode(value),
1299
+ },
1300
+ getIntegrations: {
1301
+ path: "/messenger.v1.MessengerService/GetIntegrations",
1302
+ requestStream: false,
1303
+ responseStream: false,
1304
+ requestSerialize: (value: GetIntegrationsRequest): Buffer =>
1305
+ Buffer.from(GetIntegrationsRequest.encode(value).finish()),
1306
+ requestDeserialize: (value: Buffer): GetIntegrationsRequest => GetIntegrationsRequest.decode(value),
1307
+ responseSerialize: (value: GetIntegrationsResponse): Buffer =>
1308
+ Buffer.from(GetIntegrationsResponse.encode(value).finish()),
1309
+ responseDeserialize: (value: Buffer): GetIntegrationsResponse => GetIntegrationsResponse.decode(value),
1310
+ },
1311
+ removeIntegration: {
1312
+ path: "/messenger.v1.MessengerService/RemoveIntegration",
1313
+ requestStream: false,
1314
+ responseStream: false,
1315
+ requestSerialize: (value: RemoveIntegrationRequest): Buffer =>
1316
+ Buffer.from(RemoveIntegrationRequest.encode(value).finish()),
1317
+ requestDeserialize: (value: Buffer): RemoveIntegrationRequest => RemoveIntegrationRequest.decode(value),
1318
+ responseSerialize: (value: Empty): Buffer => Buffer.from(Empty.encode(value).finish()),
1319
+ responseDeserialize: (value: Buffer): Empty => Empty.decode(value),
1320
+ },
167
1321
  } as const;
168
1322
 
169
1323
  export interface MessengerServiceServer extends UntypedServiceImplementation {
170
1324
  generateTelegramLink: handleUnaryCall<GenerateTelegramLinkRequest, GenerateTelegramLinkResponse>;
1325
+ linkTelegramAccount: handleUnaryCall<LinkTelegramAccountRequest, LinkTelegramAccountResponse>;
1326
+ getIntegrations: handleUnaryCall<GetIntegrationsRequest, GetIntegrationsResponse>;
1327
+ removeIntegration: handleUnaryCall<RemoveIntegrationRequest, Empty>;
171
1328
  }
172
1329
 
173
1330
  export interface MessengerServiceClient extends Client {
@@ -186,6 +1343,51 @@ export interface MessengerServiceClient extends Client {
186
1343
  options: Partial<CallOptions>,
187
1344
  callback: (error: ServiceError | null, response: GenerateTelegramLinkResponse) => void,
188
1345
  ): ClientUnaryCall;
1346
+ linkTelegramAccount(
1347
+ request: LinkTelegramAccountRequest,
1348
+ callback: (error: ServiceError | null, response: LinkTelegramAccountResponse) => void,
1349
+ ): ClientUnaryCall;
1350
+ linkTelegramAccount(
1351
+ request: LinkTelegramAccountRequest,
1352
+ metadata: Metadata,
1353
+ callback: (error: ServiceError | null, response: LinkTelegramAccountResponse) => void,
1354
+ ): ClientUnaryCall;
1355
+ linkTelegramAccount(
1356
+ request: LinkTelegramAccountRequest,
1357
+ metadata: Metadata,
1358
+ options: Partial<CallOptions>,
1359
+ callback: (error: ServiceError | null, response: LinkTelegramAccountResponse) => void,
1360
+ ): ClientUnaryCall;
1361
+ getIntegrations(
1362
+ request: GetIntegrationsRequest,
1363
+ callback: (error: ServiceError | null, response: GetIntegrationsResponse) => void,
1364
+ ): ClientUnaryCall;
1365
+ getIntegrations(
1366
+ request: GetIntegrationsRequest,
1367
+ metadata: Metadata,
1368
+ callback: (error: ServiceError | null, response: GetIntegrationsResponse) => void,
1369
+ ): ClientUnaryCall;
1370
+ getIntegrations(
1371
+ request: GetIntegrationsRequest,
1372
+ metadata: Metadata,
1373
+ options: Partial<CallOptions>,
1374
+ callback: (error: ServiceError | null, response: GetIntegrationsResponse) => void,
1375
+ ): ClientUnaryCall;
1376
+ removeIntegration(
1377
+ request: RemoveIntegrationRequest,
1378
+ callback: (error: ServiceError | null, response: Empty) => void,
1379
+ ): ClientUnaryCall;
1380
+ removeIntegration(
1381
+ request: RemoveIntegrationRequest,
1382
+ metadata: Metadata,
1383
+ callback: (error: ServiceError | null, response: Empty) => void,
1384
+ ): ClientUnaryCall;
1385
+ removeIntegration(
1386
+ request: RemoveIntegrationRequest,
1387
+ metadata: Metadata,
1388
+ options: Partial<CallOptions>,
1389
+ callback: (error: ServiceError | null, response: Empty) => void,
1390
+ ): ClientUnaryCall;
189
1391
  }
190
1392
 
191
1393
  export const MessengerServiceClient = makeGenericClientConstructor(
@@ -209,6 +1411,21 @@ type KeysOfUnion<T> = T extends T ? keyof T : never;
209
1411
  export type Exact<P, I extends P> = P extends Builtin ? P
210
1412
  : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
211
1413
 
1414
+ function longToNumber(int64: { toString(): string }): number {
1415
+ const num = globalThis.Number(int64.toString());
1416
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
1417
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1418
+ }
1419
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
1420
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
1421
+ }
1422
+ return num;
1423
+ }
1424
+
1425
+ function isObject(value: any): boolean {
1426
+ return typeof value === "object" && value !== null;
1427
+ }
1428
+
212
1429
  function isSet(value: any): boolean {
213
1430
  return value !== null && value !== undefined;
214
1431
  }