@control_yourself/contracts 0.3.1 → 0.3.3

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.
@@ -18,6 +18,7 @@ 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
 
@@ -106,6 +107,35 @@ export interface LinkTelegramAccountResponse {
106
107
  payload: LinkTelegramAccountResponsePayload | undefined;
107
108
  }
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
+ integrationId: number;
136
+ userId: number;
137
+ }
138
+
109
139
  function createBaseGenerateTelegramLinkRequest(): GenerateTelegramLinkRequest {
110
140
  return { userId: 0 };
111
141
  }
@@ -767,6 +797,509 @@ export const LinkTelegramAccountResponse: MessageFns<LinkTelegramAccountResponse
767
797
  },
768
798
  };
769
799
 
800
+ function createBaseGetIntegrationsRequest(): GetIntegrationsRequest {
801
+ return { userId: 0 };
802
+ }
803
+
804
+ export const GetIntegrationsRequest: MessageFns<GetIntegrationsRequest> = {
805
+ encode(message: GetIntegrationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
806
+ if (message.userId !== 0) {
807
+ writer.uint32(8).int32(message.userId);
808
+ }
809
+ return writer;
810
+ },
811
+
812
+ decode(input: BinaryReader | Uint8Array, length?: number): GetIntegrationsRequest {
813
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
814
+ const end = length === undefined ? reader.len : reader.pos + length;
815
+ const message = createBaseGetIntegrationsRequest();
816
+ while (reader.pos < end) {
817
+ const tag = reader.uint32();
818
+ switch (tag >>> 3) {
819
+ case 1: {
820
+ if (tag !== 8) {
821
+ break;
822
+ }
823
+
824
+ message.userId = reader.int32();
825
+ continue;
826
+ }
827
+ }
828
+ if ((tag & 7) === 4 || tag === 0) {
829
+ break;
830
+ }
831
+ reader.skip(tag & 7);
832
+ }
833
+ return message;
834
+ },
835
+
836
+ fromJSON(object: any): GetIntegrationsRequest {
837
+ return {
838
+ userId: isSet(object.userId)
839
+ ? globalThis.Number(object.userId)
840
+ : isSet(object.user_id)
841
+ ? globalThis.Number(object.user_id)
842
+ : 0,
843
+ };
844
+ },
845
+
846
+ toJSON(message: GetIntegrationsRequest): unknown {
847
+ const obj: any = {};
848
+ if (message.userId !== 0) {
849
+ obj.userId = Math.round(message.userId);
850
+ }
851
+ return obj;
852
+ },
853
+
854
+ create<I extends Exact<DeepPartial<GetIntegrationsRequest>, I>>(base?: I): GetIntegrationsRequest {
855
+ return GetIntegrationsRequest.fromPartial(base ?? ({} as any));
856
+ },
857
+ fromPartial<I extends Exact<DeepPartial<GetIntegrationsRequest>, I>>(object: I): GetIntegrationsRequest {
858
+ const message = createBaseGetIntegrationsRequest();
859
+ message.userId = object.userId ?? 0;
860
+ return message;
861
+ },
862
+ };
863
+
864
+ function createBaseIntegration(): Integration {
865
+ return { id: 0, meta: {}, messenger: "", messengerId: "", userId: 0, createdAt: 0, updatedAt: 0, deletedAt: 0 };
866
+ }
867
+
868
+ export const Integration: MessageFns<Integration> = {
869
+ encode(message: Integration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
870
+ if (message.id !== 0) {
871
+ writer.uint32(8).int32(message.id);
872
+ }
873
+ globalThis.Object.entries(message.meta).forEach(([key, value]: [string, string]) => {
874
+ Integration_MetaEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join();
875
+ });
876
+ if (message.messenger !== "") {
877
+ writer.uint32(26).string(message.messenger);
878
+ }
879
+ if (message.messengerId !== "") {
880
+ writer.uint32(34).string(message.messengerId);
881
+ }
882
+ if (message.userId !== 0) {
883
+ writer.uint32(40).int32(message.userId);
884
+ }
885
+ if (message.createdAt !== 0) {
886
+ writer.uint32(48).int32(message.createdAt);
887
+ }
888
+ if (message.updatedAt !== 0) {
889
+ writer.uint32(56).int32(message.updatedAt);
890
+ }
891
+ if (message.deletedAt !== 0) {
892
+ writer.uint32(64).int32(message.deletedAt);
893
+ }
894
+ return writer;
895
+ },
896
+
897
+ decode(input: BinaryReader | Uint8Array, length?: number): Integration {
898
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
899
+ const end = length === undefined ? reader.len : reader.pos + length;
900
+ const message = createBaseIntegration();
901
+ while (reader.pos < end) {
902
+ const tag = reader.uint32();
903
+ switch (tag >>> 3) {
904
+ case 1: {
905
+ if (tag !== 8) {
906
+ break;
907
+ }
908
+
909
+ message.id = reader.int32();
910
+ continue;
911
+ }
912
+ case 2: {
913
+ if (tag !== 18) {
914
+ break;
915
+ }
916
+
917
+ const entry2 = Integration_MetaEntry.decode(reader, reader.uint32());
918
+ if (entry2.value !== undefined) {
919
+ message.meta[entry2.key] = entry2.value;
920
+ }
921
+ continue;
922
+ }
923
+ case 3: {
924
+ if (tag !== 26) {
925
+ break;
926
+ }
927
+
928
+ message.messenger = reader.string();
929
+ continue;
930
+ }
931
+ case 4: {
932
+ if (tag !== 34) {
933
+ break;
934
+ }
935
+
936
+ message.messengerId = reader.string();
937
+ continue;
938
+ }
939
+ case 5: {
940
+ if (tag !== 40) {
941
+ break;
942
+ }
943
+
944
+ message.userId = reader.int32();
945
+ continue;
946
+ }
947
+ case 6: {
948
+ if (tag !== 48) {
949
+ break;
950
+ }
951
+
952
+ message.createdAt = reader.int32();
953
+ continue;
954
+ }
955
+ case 7: {
956
+ if (tag !== 56) {
957
+ break;
958
+ }
959
+
960
+ message.updatedAt = reader.int32();
961
+ continue;
962
+ }
963
+ case 8: {
964
+ if (tag !== 64) {
965
+ break;
966
+ }
967
+
968
+ message.deletedAt = reader.int32();
969
+ continue;
970
+ }
971
+ }
972
+ if ((tag & 7) === 4 || tag === 0) {
973
+ break;
974
+ }
975
+ reader.skip(tag & 7);
976
+ }
977
+ return message;
978
+ },
979
+
980
+ fromJSON(object: any): Integration {
981
+ return {
982
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
983
+ meta: isObject(object.meta)
984
+ ? (globalThis.Object.entries(object.meta) as [string, any][]).reduce(
985
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
986
+ acc[key] = globalThis.String(value);
987
+ return acc;
988
+ },
989
+ {},
990
+ )
991
+ : {},
992
+ messenger: isSet(object.messenger) ? globalThis.String(object.messenger) : "",
993
+ messengerId: isSet(object.messengerId)
994
+ ? globalThis.String(object.messengerId)
995
+ : isSet(object.messenger_id)
996
+ ? globalThis.String(object.messenger_id)
997
+ : "",
998
+ userId: isSet(object.userId)
999
+ ? globalThis.Number(object.userId)
1000
+ : isSet(object.user_id)
1001
+ ? globalThis.Number(object.user_id)
1002
+ : 0,
1003
+ createdAt: isSet(object.createdAt)
1004
+ ? globalThis.Number(object.createdAt)
1005
+ : isSet(object.created_at)
1006
+ ? globalThis.Number(object.created_at)
1007
+ : 0,
1008
+ updatedAt: isSet(object.updatedAt)
1009
+ ? globalThis.Number(object.updatedAt)
1010
+ : isSet(object.updated_at)
1011
+ ? globalThis.Number(object.updated_at)
1012
+ : 0,
1013
+ deletedAt: isSet(object.deletedAt)
1014
+ ? globalThis.Number(object.deletedAt)
1015
+ : isSet(object.deleted_at)
1016
+ ? globalThis.Number(object.deleted_at)
1017
+ : 0,
1018
+ };
1019
+ },
1020
+
1021
+ toJSON(message: Integration): unknown {
1022
+ const obj: any = {};
1023
+ if (message.id !== 0) {
1024
+ obj.id = Math.round(message.id);
1025
+ }
1026
+ if (message.meta) {
1027
+ const entries = globalThis.Object.entries(message.meta) as [string, string][];
1028
+ if (entries.length > 0) {
1029
+ obj.meta = {};
1030
+ entries.forEach(([k, v]) => {
1031
+ obj.meta[k] = v;
1032
+ });
1033
+ }
1034
+ }
1035
+ if (message.messenger !== "") {
1036
+ obj.messenger = message.messenger;
1037
+ }
1038
+ if (message.messengerId !== "") {
1039
+ obj.messengerId = message.messengerId;
1040
+ }
1041
+ if (message.userId !== 0) {
1042
+ obj.userId = Math.round(message.userId);
1043
+ }
1044
+ if (message.createdAt !== 0) {
1045
+ obj.createdAt = Math.round(message.createdAt);
1046
+ }
1047
+ if (message.updatedAt !== 0) {
1048
+ obj.updatedAt = Math.round(message.updatedAt);
1049
+ }
1050
+ if (message.deletedAt !== 0) {
1051
+ obj.deletedAt = Math.round(message.deletedAt);
1052
+ }
1053
+ return obj;
1054
+ },
1055
+
1056
+ create<I extends Exact<DeepPartial<Integration>, I>>(base?: I): Integration {
1057
+ return Integration.fromPartial(base ?? ({} as any));
1058
+ },
1059
+ fromPartial<I extends Exact<DeepPartial<Integration>, I>>(object: I): Integration {
1060
+ const message = createBaseIntegration();
1061
+ message.id = object.id ?? 0;
1062
+ message.meta = (globalThis.Object.entries(object.meta ?? {}) as [string, string][]).reduce(
1063
+ (acc: { [key: string]: string }, [key, value]: [string, string]) => {
1064
+ if (value !== undefined) {
1065
+ acc[key] = globalThis.String(value);
1066
+ }
1067
+ return acc;
1068
+ },
1069
+ {},
1070
+ );
1071
+ message.messenger = object.messenger ?? "";
1072
+ message.messengerId = object.messengerId ?? "";
1073
+ message.userId = object.userId ?? 0;
1074
+ message.createdAt = object.createdAt ?? 0;
1075
+ message.updatedAt = object.updatedAt ?? 0;
1076
+ message.deletedAt = object.deletedAt ?? 0;
1077
+ return message;
1078
+ },
1079
+ };
1080
+
1081
+ function createBaseIntegration_MetaEntry(): Integration_MetaEntry {
1082
+ return { key: "", value: "" };
1083
+ }
1084
+
1085
+ export const Integration_MetaEntry: MessageFns<Integration_MetaEntry> = {
1086
+ encode(message: Integration_MetaEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1087
+ if (message.key !== "") {
1088
+ writer.uint32(10).string(message.key);
1089
+ }
1090
+ if (message.value !== "") {
1091
+ writer.uint32(18).string(message.value);
1092
+ }
1093
+ return writer;
1094
+ },
1095
+
1096
+ decode(input: BinaryReader | Uint8Array, length?: number): Integration_MetaEntry {
1097
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1098
+ const end = length === undefined ? reader.len : reader.pos + length;
1099
+ const message = createBaseIntegration_MetaEntry();
1100
+ while (reader.pos < end) {
1101
+ const tag = reader.uint32();
1102
+ switch (tag >>> 3) {
1103
+ case 1: {
1104
+ if (tag !== 10) {
1105
+ break;
1106
+ }
1107
+
1108
+ message.key = reader.string();
1109
+ continue;
1110
+ }
1111
+ case 2: {
1112
+ if (tag !== 18) {
1113
+ break;
1114
+ }
1115
+
1116
+ message.value = reader.string();
1117
+ continue;
1118
+ }
1119
+ }
1120
+ if ((tag & 7) === 4 || tag === 0) {
1121
+ break;
1122
+ }
1123
+ reader.skip(tag & 7);
1124
+ }
1125
+ return message;
1126
+ },
1127
+
1128
+ fromJSON(object: any): Integration_MetaEntry {
1129
+ return {
1130
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
1131
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
1132
+ };
1133
+ },
1134
+
1135
+ toJSON(message: Integration_MetaEntry): unknown {
1136
+ const obj: any = {};
1137
+ if (message.key !== "") {
1138
+ obj.key = message.key;
1139
+ }
1140
+ if (message.value !== "") {
1141
+ obj.value = message.value;
1142
+ }
1143
+ return obj;
1144
+ },
1145
+
1146
+ create<I extends Exact<DeepPartial<Integration_MetaEntry>, I>>(base?: I): Integration_MetaEntry {
1147
+ return Integration_MetaEntry.fromPartial(base ?? ({} as any));
1148
+ },
1149
+ fromPartial<I extends Exact<DeepPartial<Integration_MetaEntry>, I>>(object: I): Integration_MetaEntry {
1150
+ const message = createBaseIntegration_MetaEntry();
1151
+ message.key = object.key ?? "";
1152
+ message.value = object.value ?? "";
1153
+ return message;
1154
+ },
1155
+ };
1156
+
1157
+ function createBaseGetIntegrationsResponse(): GetIntegrationsResponse {
1158
+ return { integrations: [] };
1159
+ }
1160
+
1161
+ export const GetIntegrationsResponse: MessageFns<GetIntegrationsResponse> = {
1162
+ encode(message: GetIntegrationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1163
+ for (const v of message.integrations) {
1164
+ Integration.encode(v!, writer.uint32(10).fork()).join();
1165
+ }
1166
+ return writer;
1167
+ },
1168
+
1169
+ decode(input: BinaryReader | Uint8Array, length?: number): GetIntegrationsResponse {
1170
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1171
+ const end = length === undefined ? reader.len : reader.pos + length;
1172
+ const message = createBaseGetIntegrationsResponse();
1173
+ while (reader.pos < end) {
1174
+ const tag = reader.uint32();
1175
+ switch (tag >>> 3) {
1176
+ case 1: {
1177
+ if (tag !== 10) {
1178
+ break;
1179
+ }
1180
+
1181
+ message.integrations.push(Integration.decode(reader, reader.uint32()));
1182
+ continue;
1183
+ }
1184
+ }
1185
+ if ((tag & 7) === 4 || tag === 0) {
1186
+ break;
1187
+ }
1188
+ reader.skip(tag & 7);
1189
+ }
1190
+ return message;
1191
+ },
1192
+
1193
+ fromJSON(object: any): GetIntegrationsResponse {
1194
+ return {
1195
+ integrations: globalThis.Array.isArray(object?.integrations)
1196
+ ? object.integrations.map((e: any) => Integration.fromJSON(e))
1197
+ : [],
1198
+ };
1199
+ },
1200
+
1201
+ toJSON(message: GetIntegrationsResponse): unknown {
1202
+ const obj: any = {};
1203
+ if (message.integrations?.length) {
1204
+ obj.integrations = message.integrations.map((e) => Integration.toJSON(e));
1205
+ }
1206
+ return obj;
1207
+ },
1208
+
1209
+ create<I extends Exact<DeepPartial<GetIntegrationsResponse>, I>>(base?: I): GetIntegrationsResponse {
1210
+ return GetIntegrationsResponse.fromPartial(base ?? ({} as any));
1211
+ },
1212
+ fromPartial<I extends Exact<DeepPartial<GetIntegrationsResponse>, I>>(object: I): GetIntegrationsResponse {
1213
+ const message = createBaseGetIntegrationsResponse();
1214
+ message.integrations = object.integrations?.map((e) => Integration.fromPartial(e)) || [];
1215
+ return message;
1216
+ },
1217
+ };
1218
+
1219
+ function createBaseRemoveIntegrationRequest(): RemoveIntegrationRequest {
1220
+ return { integrationId: 0, userId: 0 };
1221
+ }
1222
+
1223
+ export const RemoveIntegrationRequest: MessageFns<RemoveIntegrationRequest> = {
1224
+ encode(message: RemoveIntegrationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1225
+ if (message.integrationId !== 0) {
1226
+ writer.uint32(8).int32(message.integrationId);
1227
+ }
1228
+ if (message.userId !== 0) {
1229
+ writer.uint32(16).int32(message.userId);
1230
+ }
1231
+ return writer;
1232
+ },
1233
+
1234
+ decode(input: BinaryReader | Uint8Array, length?: number): RemoveIntegrationRequest {
1235
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1236
+ const end = length === undefined ? reader.len : reader.pos + length;
1237
+ const message = createBaseRemoveIntegrationRequest();
1238
+ while (reader.pos < end) {
1239
+ const tag = reader.uint32();
1240
+ switch (tag >>> 3) {
1241
+ case 1: {
1242
+ if (tag !== 8) {
1243
+ break;
1244
+ }
1245
+
1246
+ message.integrationId = reader.int32();
1247
+ continue;
1248
+ }
1249
+ case 2: {
1250
+ if (tag !== 16) {
1251
+ break;
1252
+ }
1253
+
1254
+ message.userId = reader.int32();
1255
+ continue;
1256
+ }
1257
+ }
1258
+ if ((tag & 7) === 4 || tag === 0) {
1259
+ break;
1260
+ }
1261
+ reader.skip(tag & 7);
1262
+ }
1263
+ return message;
1264
+ },
1265
+
1266
+ fromJSON(object: any): RemoveIntegrationRequest {
1267
+ return {
1268
+ integrationId: isSet(object.integrationId)
1269
+ ? globalThis.Number(object.integrationId)
1270
+ : isSet(object.integration_id)
1271
+ ? globalThis.Number(object.integration_id)
1272
+ : 0,
1273
+ userId: isSet(object.userId)
1274
+ ? globalThis.Number(object.userId)
1275
+ : isSet(object.user_id)
1276
+ ? globalThis.Number(object.user_id)
1277
+ : 0,
1278
+ };
1279
+ },
1280
+
1281
+ toJSON(message: RemoveIntegrationRequest): unknown {
1282
+ const obj: any = {};
1283
+ if (message.integrationId !== 0) {
1284
+ obj.integrationId = Math.round(message.integrationId);
1285
+ }
1286
+ if (message.userId !== 0) {
1287
+ obj.userId = Math.round(message.userId);
1288
+ }
1289
+ return obj;
1290
+ },
1291
+
1292
+ create<I extends Exact<DeepPartial<RemoveIntegrationRequest>, I>>(base?: I): RemoveIntegrationRequest {
1293
+ return RemoveIntegrationRequest.fromPartial(base ?? ({} as any));
1294
+ },
1295
+ fromPartial<I extends Exact<DeepPartial<RemoveIntegrationRequest>, I>>(object: I): RemoveIntegrationRequest {
1296
+ const message = createBaseRemoveIntegrationRequest();
1297
+ message.integrationId = object.integrationId ?? 0;
1298
+ message.userId = object.userId ?? 0;
1299
+ return message;
1300
+ },
1301
+ };
1302
+
770
1303
  export type MessengerServiceService = typeof MessengerServiceService;
771
1304
  export const MessengerServiceService = {
772
1305
  generateTelegramLink: {
@@ -791,11 +1324,34 @@ export const MessengerServiceService = {
791
1324
  Buffer.from(LinkTelegramAccountResponse.encode(value).finish()),
792
1325
  responseDeserialize: (value: Buffer): LinkTelegramAccountResponse => LinkTelegramAccountResponse.decode(value),
793
1326
  },
1327
+ getIntegrations: {
1328
+ path: "/messenger.v1.MessengerService/GetIntegrations",
1329
+ requestStream: false,
1330
+ responseStream: false,
1331
+ requestSerialize: (value: GetIntegrationsRequest): Buffer =>
1332
+ Buffer.from(GetIntegrationsRequest.encode(value).finish()),
1333
+ requestDeserialize: (value: Buffer): GetIntegrationsRequest => GetIntegrationsRequest.decode(value),
1334
+ responseSerialize: (value: GetIntegrationsResponse): Buffer =>
1335
+ Buffer.from(GetIntegrationsResponse.encode(value).finish()),
1336
+ responseDeserialize: (value: Buffer): GetIntegrationsResponse => GetIntegrationsResponse.decode(value),
1337
+ },
1338
+ removeIntegration: {
1339
+ path: "/messenger.v1.MessengerService/RemoveIntegration",
1340
+ requestStream: false,
1341
+ responseStream: false,
1342
+ requestSerialize: (value: RemoveIntegrationRequest): Buffer =>
1343
+ Buffer.from(RemoveIntegrationRequest.encode(value).finish()),
1344
+ requestDeserialize: (value: Buffer): RemoveIntegrationRequest => RemoveIntegrationRequest.decode(value),
1345
+ responseSerialize: (value: Empty): Buffer => Buffer.from(Empty.encode(value).finish()),
1346
+ responseDeserialize: (value: Buffer): Empty => Empty.decode(value),
1347
+ },
794
1348
  } as const;
795
1349
 
796
1350
  export interface MessengerServiceServer extends UntypedServiceImplementation {
797
1351
  generateTelegramLink: handleUnaryCall<GenerateTelegramLinkRequest, GenerateTelegramLinkResponse>;
798
1352
  linkTelegramAccount: handleUnaryCall<LinkTelegramAccountRequest, LinkTelegramAccountResponse>;
1353
+ getIntegrations: handleUnaryCall<GetIntegrationsRequest, GetIntegrationsResponse>;
1354
+ removeIntegration: handleUnaryCall<RemoveIntegrationRequest, Empty>;
799
1355
  }
800
1356
 
801
1357
  export interface MessengerServiceClient extends Client {
@@ -829,6 +1385,36 @@ export interface MessengerServiceClient extends Client {
829
1385
  options: Partial<CallOptions>,
830
1386
  callback: (error: ServiceError | null, response: LinkTelegramAccountResponse) => void,
831
1387
  ): ClientUnaryCall;
1388
+ getIntegrations(
1389
+ request: GetIntegrationsRequest,
1390
+ callback: (error: ServiceError | null, response: GetIntegrationsResponse) => void,
1391
+ ): ClientUnaryCall;
1392
+ getIntegrations(
1393
+ request: GetIntegrationsRequest,
1394
+ metadata: Metadata,
1395
+ callback: (error: ServiceError | null, response: GetIntegrationsResponse) => void,
1396
+ ): ClientUnaryCall;
1397
+ getIntegrations(
1398
+ request: GetIntegrationsRequest,
1399
+ metadata: Metadata,
1400
+ options: Partial<CallOptions>,
1401
+ callback: (error: ServiceError | null, response: GetIntegrationsResponse) => void,
1402
+ ): ClientUnaryCall;
1403
+ removeIntegration(
1404
+ request: RemoveIntegrationRequest,
1405
+ callback: (error: ServiceError | null, response: Empty) => void,
1406
+ ): ClientUnaryCall;
1407
+ removeIntegration(
1408
+ request: RemoveIntegrationRequest,
1409
+ metadata: Metadata,
1410
+ callback: (error: ServiceError | null, response: Empty) => void,
1411
+ ): ClientUnaryCall;
1412
+ removeIntegration(
1413
+ request: RemoveIntegrationRequest,
1414
+ metadata: Metadata,
1415
+ options: Partial<CallOptions>,
1416
+ callback: (error: ServiceError | null, response: Empty) => void,
1417
+ ): ClientUnaryCall;
832
1418
  }
833
1419
 
834
1420
  export const MessengerServiceClient = makeGenericClientConstructor(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@control_yourself/contracts",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "author": "vladimir.pariy@gmail.com",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,10 +1,13 @@
1
1
  syntax = "proto3";
2
2
 
3
3
  package messenger.v1;
4
+ import "google/protobuf/empty.proto";
4
5
 
5
6
  service MessengerService {
6
7
  rpc GenerateTelegramLink (GenerateTelegramLinkRequest) returns (GenerateTelegramLinkResponse);
7
8
  rpc LinkTelegramAccount (LinkTelegramAccountRequest) returns (LinkTelegramAccountResponse);
9
+ rpc GetIntegrations (GetIntegrationsRequest) returns (GetIntegrationsResponse);
10
+ rpc RemoveIntegration (RemoveIntegrationRequest) returns (google.protobuf.Empty);
8
11
  }
9
12
 
10
13
  message GenerateTelegramLinkRequest {
@@ -24,6 +27,7 @@ enum LinkTelegramAccountStatus {
24
27
  STATUS_PROCESSING = 2;
25
28
  STATUS_FAILED = 3;
26
29
  }
30
+
27
31
  message LinkTelegramAccountResponsePayload {
28
32
  LinkTelegramAccountStatus status = 1;
29
33
  string message = 2;
@@ -41,7 +45,32 @@ message LinkTelegramAccountRequest {
41
45
  TelegramMeta meta = 1;
42
46
  LinkTelegramAccountRequestPayload payload = 2;
43
47
  };
48
+
44
49
  message LinkTelegramAccountResponse {
45
50
  TelegramMeta meta = 1;
46
51
  LinkTelegramAccountResponsePayload payload = 2;
47
- };
52
+ };
53
+
54
+ message GetIntegrationsRequest {
55
+ int32 user_id = 1;
56
+ };
57
+
58
+ message Integration {
59
+ int32 id = 1;
60
+ map<string, string> meta = 2;
61
+ string messenger = 3;
62
+ string messenger_id = 4;
63
+ int32 user_id = 5;
64
+ int32 created_at = 6;
65
+ int32 updated_at = 7;
66
+ int32 deleted_at = 8;
67
+ };
68
+
69
+ message GetIntegrationsResponse {
70
+ repeated Integration integrations = 1;
71
+ };
72
+
73
+ message RemoveIntegrationRequest {
74
+ int32 integration_id = 1;
75
+ int32 user_id = 2;
76
+ };