@control_yourself/contracts 0.3.1 → 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.
- package/dist/generated/messenger_pb.d.ts +36 -0
- package/dist/generated/messenger_pb.js +7 -2
- package/dist/generated/messenger_pb.js.map +1 -1
- package/dist/generated-grpc/messenger.d.ts +57 -0
- package/dist/generated-grpc/messenger.js +448 -1
- package/dist/generated-grpc/messenger.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/generated/messenger_pb.ts +122 -1
- package/generated-grpc/messenger.ts +559 -0
- package/package.json +1 -1
- package/protos/messenger.proto +29 -1
|
@@ -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,34 @@ 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
|
+
id: number;
|
|
136
|
+
}
|
|
137
|
+
|
|
109
138
|
function createBaseGenerateTelegramLinkRequest(): GenerateTelegramLinkRequest {
|
|
110
139
|
return { userId: 0 };
|
|
111
140
|
}
|
|
@@ -767,6 +796,483 @@ export const LinkTelegramAccountResponse: MessageFns<LinkTelegramAccountResponse
|
|
|
767
796
|
},
|
|
768
797
|
};
|
|
769
798
|
|
|
799
|
+
function createBaseGetIntegrationsRequest(): GetIntegrationsRequest {
|
|
800
|
+
return { userId: 0 };
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export const GetIntegrationsRequest: MessageFns<GetIntegrationsRequest> = {
|
|
804
|
+
encode(message: GetIntegrationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
805
|
+
if (message.userId !== 0) {
|
|
806
|
+
writer.uint32(8).int32(message.userId);
|
|
807
|
+
}
|
|
808
|
+
return writer;
|
|
809
|
+
},
|
|
810
|
+
|
|
811
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetIntegrationsRequest {
|
|
812
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
813
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
814
|
+
const message = createBaseGetIntegrationsRequest();
|
|
815
|
+
while (reader.pos < end) {
|
|
816
|
+
const tag = reader.uint32();
|
|
817
|
+
switch (tag >>> 3) {
|
|
818
|
+
case 1: {
|
|
819
|
+
if (tag !== 8) {
|
|
820
|
+
break;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
message.userId = reader.int32();
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
828
|
+
break;
|
|
829
|
+
}
|
|
830
|
+
reader.skip(tag & 7);
|
|
831
|
+
}
|
|
832
|
+
return message;
|
|
833
|
+
},
|
|
834
|
+
|
|
835
|
+
fromJSON(object: any): GetIntegrationsRequest {
|
|
836
|
+
return {
|
|
837
|
+
userId: isSet(object.userId)
|
|
838
|
+
? globalThis.Number(object.userId)
|
|
839
|
+
: isSet(object.user_id)
|
|
840
|
+
? globalThis.Number(object.user_id)
|
|
841
|
+
: 0,
|
|
842
|
+
};
|
|
843
|
+
},
|
|
844
|
+
|
|
845
|
+
toJSON(message: GetIntegrationsRequest): unknown {
|
|
846
|
+
const obj: any = {};
|
|
847
|
+
if (message.userId !== 0) {
|
|
848
|
+
obj.userId = Math.round(message.userId);
|
|
849
|
+
}
|
|
850
|
+
return obj;
|
|
851
|
+
},
|
|
852
|
+
|
|
853
|
+
create<I extends Exact<DeepPartial<GetIntegrationsRequest>, I>>(base?: I): GetIntegrationsRequest {
|
|
854
|
+
return GetIntegrationsRequest.fromPartial(base ?? ({} as any));
|
|
855
|
+
},
|
|
856
|
+
fromPartial<I extends Exact<DeepPartial<GetIntegrationsRequest>, I>>(object: I): GetIntegrationsRequest {
|
|
857
|
+
const message = createBaseGetIntegrationsRequest();
|
|
858
|
+
message.userId = object.userId ?? 0;
|
|
859
|
+
return message;
|
|
860
|
+
},
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
function createBaseIntegration(): Integration {
|
|
864
|
+
return { id: 0, meta: {}, messenger: "", messengerId: "", userId: 0, createdAt: 0, updatedAt: 0, deletedAt: 0 };
|
|
865
|
+
}
|
|
866
|
+
|
|
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);
|
|
892
|
+
}
|
|
893
|
+
return writer;
|
|
894
|
+
},
|
|
895
|
+
|
|
896
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Integration {
|
|
897
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
898
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
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();
|
|
1099
|
+
while (reader.pos < end) {
|
|
1100
|
+
const tag = reader.uint32();
|
|
1101
|
+
switch (tag >>> 3) {
|
|
1102
|
+
case 1: {
|
|
1103
|
+
if (tag !== 10) {
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
message.key = reader.string();
|
|
1108
|
+
continue;
|
|
1109
|
+
}
|
|
1110
|
+
case 2: {
|
|
1111
|
+
if (tag !== 18) {
|
|
1112
|
+
break;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
message.value = reader.string();
|
|
1116
|
+
continue;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1120
|
+
break;
|
|
1121
|
+
}
|
|
1122
|
+
reader.skip(tag & 7);
|
|
1123
|
+
}
|
|
1124
|
+
return message;
|
|
1125
|
+
},
|
|
1126
|
+
|
|
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
|
+
};
|
|
1132
|
+
},
|
|
1133
|
+
|
|
1134
|
+
toJSON(message: Integration_MetaEntry): unknown {
|
|
1135
|
+
const obj: any = {};
|
|
1136
|
+
if (message.key !== "") {
|
|
1137
|
+
obj.key = message.key;
|
|
1138
|
+
}
|
|
1139
|
+
if (message.value !== "") {
|
|
1140
|
+
obj.value = message.value;
|
|
1141
|
+
}
|
|
1142
|
+
return obj;
|
|
1143
|
+
},
|
|
1144
|
+
|
|
1145
|
+
create<I extends Exact<DeepPartial<Integration_MetaEntry>, I>>(base?: I): Integration_MetaEntry {
|
|
1146
|
+
return Integration_MetaEntry.fromPartial(base ?? ({} as any));
|
|
1147
|
+
},
|
|
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;
|
|
1272
|
+
return message;
|
|
1273
|
+
},
|
|
1274
|
+
};
|
|
1275
|
+
|
|
770
1276
|
export type MessengerServiceService = typeof MessengerServiceService;
|
|
771
1277
|
export const MessengerServiceService = {
|
|
772
1278
|
generateTelegramLink: {
|
|
@@ -791,11 +1297,34 @@ export const MessengerServiceService = {
|
|
|
791
1297
|
Buffer.from(LinkTelegramAccountResponse.encode(value).finish()),
|
|
792
1298
|
responseDeserialize: (value: Buffer): LinkTelegramAccountResponse => LinkTelegramAccountResponse.decode(value),
|
|
793
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
|
+
},
|
|
794
1321
|
} as const;
|
|
795
1322
|
|
|
796
1323
|
export interface MessengerServiceServer extends UntypedServiceImplementation {
|
|
797
1324
|
generateTelegramLink: handleUnaryCall<GenerateTelegramLinkRequest, GenerateTelegramLinkResponse>;
|
|
798
1325
|
linkTelegramAccount: handleUnaryCall<LinkTelegramAccountRequest, LinkTelegramAccountResponse>;
|
|
1326
|
+
getIntegrations: handleUnaryCall<GetIntegrationsRequest, GetIntegrationsResponse>;
|
|
1327
|
+
removeIntegration: handleUnaryCall<RemoveIntegrationRequest, Empty>;
|
|
799
1328
|
}
|
|
800
1329
|
|
|
801
1330
|
export interface MessengerServiceClient extends Client {
|
|
@@ -829,6 +1358,36 @@ export interface MessengerServiceClient extends Client {
|
|
|
829
1358
|
options: Partial<CallOptions>,
|
|
830
1359
|
callback: (error: ServiceError | null, response: LinkTelegramAccountResponse) => void,
|
|
831
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;
|
|
832
1391
|
}
|
|
833
1392
|
|
|
834
1393
|
export const MessengerServiceClient = makeGenericClientConstructor(
|
package/package.json
CHANGED
package/protos/messenger.proto
CHANGED
|
@@ -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,31 @@ 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 id = 1;
|
|
75
|
+
};
|