chore: auto-generate protobuf files [skip ci]
This commit is contained in:
@@ -11,6 +11,23 @@ import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "users.v1";
|
||||
|
||||
export interface UserSettingsMessage {
|
||||
privacyPhone: string;
|
||||
privacyLastSeen: string;
|
||||
privacyPhoto: string;
|
||||
privacyBio: string;
|
||||
privacyCalls: string;
|
||||
privacyGroups: string;
|
||||
privacyVoiceMsgs: string;
|
||||
notifyPrivateChats: boolean;
|
||||
notifyGroups: boolean;
|
||||
notifyChannels: boolean;
|
||||
showMessagePreview: boolean;
|
||||
theme: string;
|
||||
textSize: number;
|
||||
chatBackground?: string | undefined;
|
||||
}
|
||||
|
||||
export interface GetProfileRequest {
|
||||
/** Берется из access токена на API шлюзе */
|
||||
userId: string;
|
||||
@@ -27,6 +44,7 @@ export interface GetProfileResponse {
|
||||
language: string;
|
||||
customStatusText?: string | undefined;
|
||||
customStatusEmoji?: string | undefined;
|
||||
settings?: UserSettingsMessage | undefined;
|
||||
}
|
||||
|
||||
export interface UpdateProfileRequest {
|
||||
@@ -40,6 +58,7 @@ export interface UpdateProfileRequest {
|
||||
timezone?: string | undefined;
|
||||
language?: string | undefined;
|
||||
isPublic?: boolean | undefined;
|
||||
settings?: UserSettingsMessage | undefined;
|
||||
}
|
||||
|
||||
export interface UpdateProfileResponse {
|
||||
@@ -69,6 +88,60 @@ export interface SoftDeleteProfileResponse {
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
export interface ContactItem {
|
||||
contactId: string;
|
||||
alias?: string | undefined;
|
||||
}
|
||||
|
||||
export interface AddContactRequest {
|
||||
userId: string;
|
||||
contactId: string;
|
||||
alias?: string | undefined;
|
||||
}
|
||||
|
||||
export interface AddContactResponse {
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
export interface GetContactsRequest {
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface GetContactsResponse {
|
||||
contacts: ContactItem[];
|
||||
}
|
||||
|
||||
export interface BlockedUserItem {
|
||||
blockedId: string;
|
||||
blockedAt: string;
|
||||
}
|
||||
|
||||
export interface BlockUserRequest {
|
||||
blockerId: string;
|
||||
blockedId: string;
|
||||
}
|
||||
|
||||
export interface BlockUserResponse {
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
export interface UnblockUserRequest {
|
||||
blockerId: string;
|
||||
blockedId: string;
|
||||
}
|
||||
|
||||
export interface UnblockUserResponse {
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
export interface GetBlockedUsersRequest {
|
||||
blockerId: string;
|
||||
}
|
||||
|
||||
export interface GetBlockedUsersResponse {
|
||||
blockedUsers: BlockedUserItem[];
|
||||
}
|
||||
|
||||
export const USERS_V1_PACKAGE_NAME = "users.v1";
|
||||
|
||||
export interface UsersServiceClient {
|
||||
@@ -81,6 +154,18 @@ export interface UsersServiceClient {
|
||||
createProfile(request: CreateProfileRequest, metadata?: Metadata): Observable<CreateProfileResponse>;
|
||||
|
||||
softDeleteProfile(request: SoftDeleteProfileRequest, metadata?: Metadata): Observable<SoftDeleteProfileResponse>;
|
||||
|
||||
/** --- НОВЫЕ МЕТОДЫ МЕССЕНДЖЕРА --- */
|
||||
|
||||
blockUser(request: BlockUserRequest, metadata?: Metadata): Observable<BlockUserResponse>;
|
||||
|
||||
unblockUser(request: UnblockUserRequest, metadata?: Metadata): Observable<UnblockUserResponse>;
|
||||
|
||||
getBlockedUsers(request: GetBlockedUsersRequest, metadata?: Metadata): Observable<GetBlockedUsersResponse>;
|
||||
|
||||
addContact(request: AddContactRequest, metadata?: Metadata): Observable<AddContactResponse>;
|
||||
|
||||
getContacts(request: GetContactsRequest, metadata?: Metadata): Observable<GetContactsResponse>;
|
||||
}
|
||||
|
||||
export interface UsersServiceController {
|
||||
@@ -105,11 +190,48 @@ export interface UsersServiceController {
|
||||
request: SoftDeleteProfileRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<SoftDeleteProfileResponse> | Observable<SoftDeleteProfileResponse> | SoftDeleteProfileResponse;
|
||||
|
||||
/** --- НОВЫЕ МЕТОДЫ МЕССЕНДЖЕРА --- */
|
||||
|
||||
blockUser(
|
||||
request: BlockUserRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<BlockUserResponse> | Observable<BlockUserResponse> | BlockUserResponse;
|
||||
|
||||
unblockUser(
|
||||
request: UnblockUserRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<UnblockUserResponse> | Observable<UnblockUserResponse> | UnblockUserResponse;
|
||||
|
||||
getBlockedUsers(
|
||||
request: GetBlockedUsersRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetBlockedUsersResponse> | Observable<GetBlockedUsersResponse> | GetBlockedUsersResponse;
|
||||
|
||||
addContact(
|
||||
request: AddContactRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<AddContactResponse> | Observable<AddContactResponse> | AddContactResponse;
|
||||
|
||||
getContacts(
|
||||
request: GetContactsRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetContactsResponse> | Observable<GetContactsResponse> | GetContactsResponse;
|
||||
}
|
||||
|
||||
export function UsersServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = ["getProfile", "updateProfile", "createProfile", "softDeleteProfile"];
|
||||
const grpcMethods: string[] = [
|
||||
"getProfile",
|
||||
"updateProfile",
|
||||
"createProfile",
|
||||
"softDeleteProfile",
|
||||
"blockUser",
|
||||
"unblockUser",
|
||||
"getBlockedUsers",
|
||||
"addContact",
|
||||
"getContacts",
|
||||
];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
||||
|
||||
Reference in New Issue
Block a user