Files
contracts/gen/users/users.ts
2026-04-19 07:52:48 +00:00

275 lines
7.8 KiB
TypeScript

// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.11.6
// protoc v4.25.9
// source: users/users.proto
/* eslint-disable */
import type { Metadata } from "@grpc/grpc-js";
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs";
export const protobufPackage = "users.v1";
export interface UserSettingsMessage {
privacyPhone?: string | undefined;
privacyLastSeen?: string | undefined;
privacyPhoto?: string | undefined;
privacyBio?: string | undefined;
privacyCalls?: string | undefined;
privacyGroups?: string | undefined;
privacyVoiceMsgs?: string | undefined;
notifyPrivateChats?: boolean | undefined;
notifyGroups?: boolean | undefined;
notifyChannels?: boolean | undefined;
showMessagePreview?: boolean | undefined;
theme?: string | undefined;
textSize?: number | undefined;
chatBackground?: string | undefined;
}
export interface GetProfileRequest {
/** Берется из access токена на API шлюзе */
userId: string;
}
export interface GetProfileResponse {
id: string;
email?: string | undefined;
phone?: string | undefined;
fullName?: string | undefined;
avatarUrl?: string | undefined;
isPublic: boolean;
timezone: string;
language: string;
customStatusText?: string | undefined;
customStatusEmoji?: string | undefined;
settings?: UserSettingsMessage | undefined;
}
export interface UpdateProfileRequest {
userId: string;
email?: string | undefined;
phone?: string | undefined;
fullName?: string | undefined;
avatarUrl?: string | undefined;
customStatusText?: string | undefined;
customStatusEmoji?: string | undefined;
timezone?: string | undefined;
language?: string | undefined;
isPublic?: boolean | undefined;
settings?: UserSettingsMessage | undefined;
}
export interface UpdateProfileResponse {
success: boolean;
message: string;
}
/** Вызывается другими сервисами при создании аккаунта */
export interface CreateProfileRequest {
/** Обязательно передаем ID созданного аккаунта! */
userId: string;
email?: string | undefined;
fullName?: string | undefined;
phone?: string | undefined;
avatarUrl?: string | undefined;
}
export interface CreateProfileResponse {
success: boolean;
}
export interface SoftDeleteProfileRequest {
userId: string;
}
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 interface SystemGetProfileBatchRequest {
userIds: string[];
}
export interface ProfileBasicItem {
id: string;
email?: string | undefined;
phone?: string | undefined;
fullName?: string | undefined;
isPublic: boolean;
}
export interface SystemGetProfileBatchResponse {
profiles: ProfileBasicItem[];
}
export const USERS_V1_PACKAGE_NAME = "users.v1";
export interface UsersServiceClient {
getProfile(request: GetProfileRequest, metadata?: Metadata): Observable<GetProfileResponse>;
updateProfile(request: UpdateProfileRequest, metadata?: Metadata): Observable<UpdateProfileResponse>;
/** Для системного использования (вызывается из Auth/Admin) */
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>;
systemGetProfileBatch(
request: SystemGetProfileBatchRequest,
metadata?: Metadata,
): Observable<SystemGetProfileBatchResponse>;
}
export interface UsersServiceController {
getProfile(
request: GetProfileRequest,
metadata?: Metadata,
): Promise<GetProfileResponse> | Observable<GetProfileResponse> | GetProfileResponse;
updateProfile(
request: UpdateProfileRequest,
metadata?: Metadata,
): Promise<UpdateProfileResponse> | Observable<UpdateProfileResponse> | UpdateProfileResponse;
/** Для системного использования (вызывается из Auth/Admin) */
createProfile(
request: CreateProfileRequest,
metadata?: Metadata,
): Promise<CreateProfileResponse> | Observable<CreateProfileResponse> | CreateProfileResponse;
softDeleteProfile(
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;
systemGetProfileBatch(
request: SystemGetProfileBatchRequest,
metadata?: Metadata,
): Promise<SystemGetProfileBatchResponse> | Observable<SystemGetProfileBatchResponse> | SystemGetProfileBatchResponse;
}
export function UsersServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = [
"getProfile",
"updateProfile",
"createProfile",
"softDeleteProfile",
"blockUser",
"unblockUser",
"getBlockedUsers",
"addContact",
"getContacts",
"systemGetProfileBatch",
];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
}
const grpcStreamMethods: string[] = [];
for (const method of grpcStreamMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
}
};
}
export const USERS_SERVICE_NAME = "UsersService";