contracts/gen/ts/users.ts
2026-04-05 08:59:26 +03:00

83 lines
2.3 KiB
TypeScript

// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.11.0
// protoc v6.33.4
// source: users.proto
/* eslint-disable */
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs";
export const protobufPackage = "users.v1";
export interface GetMeRequest {
id: string;
}
export interface GetMeResponse {
user: User | undefined;
}
export interface CreateUserRequest {
id: string;
}
export interface CreateUserResponse {
ok: boolean;
}
export interface User {
id: string;
name?: string | undefined;
phone?: string | undefined;
email?: string | undefined;
avatar?: string | undefined;
}
export interface PatchUserRequest {
userId: string;
name?: string | undefined;
avatar?: string | undefined;
}
export interface PatchUserResponse {
ok: boolean;
}
export const USERS_V1_PACKAGE_NAME = "users.v1";
export interface UsersServiceClient {
getMe(request: GetMeRequest): Observable<GetMeResponse>;
createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
patchUser(request: PatchUserRequest): Observable<PatchUserResponse>;
}
export interface UsersServiceController {
getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
createUser(
request: CreateUserRequest,
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
patchUser(request: PatchUserRequest): Promise<PatchUserResponse> | Observable<PatchUserResponse> | PatchUserResponse;
}
export function UsersServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = ["getMe", "createUser", "patchUser"];
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";