chore: auto-generate protobuf files [skip ci]
This commit is contained in:
82
gen/media/media.ts
Normal file
82
gen/media/media.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.8
|
||||
// protoc v4.25.9
|
||||
// source: media/media.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import type { Metadata } from "@grpc/grpc-js";
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "media.v1";
|
||||
|
||||
/** contracts/proto/media/v1/media.proto */
|
||||
|
||||
export interface UploadRequest {
|
||||
fileName: string;
|
||||
/** Сами байты файла */
|
||||
data: Uint8Array;
|
||||
/** "avatar", "chat", "raw" */
|
||||
mode: string;
|
||||
}
|
||||
|
||||
export interface UploadResponse {
|
||||
fileName: string;
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface GetPresignedUrlRequest {
|
||||
fileName: string;
|
||||
/** Если true, ссылка живет 24 часа, иначе 2 минуты */
|
||||
isPublic: boolean;
|
||||
}
|
||||
|
||||
export interface GetPresignedUrlResponse {
|
||||
url: string;
|
||||
}
|
||||
|
||||
export const MEDIA_V1_PACKAGE_NAME = "media.v1";
|
||||
|
||||
export interface MediaServiceClient {
|
||||
/** Загрузка файла */
|
||||
|
||||
upload(request: UploadRequest, metadata?: Metadata): Observable<UploadResponse>;
|
||||
|
||||
/** Генерация временной ссылки для скачивания/просмотра */
|
||||
|
||||
getPresignedUrl(request: GetPresignedUrlRequest, metadata?: Metadata): Observable<GetPresignedUrlResponse>;
|
||||
}
|
||||
|
||||
export interface MediaServiceController {
|
||||
/** Загрузка файла */
|
||||
|
||||
upload(
|
||||
request: UploadRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
|
||||
|
||||
/** Генерация временной ссылки для скачивания/просмотра */
|
||||
|
||||
getPresignedUrl(
|
||||
request: GetPresignedUrlRequest,
|
||||
metadata?: Metadata,
|
||||
): Promise<GetPresignedUrlResponse> | Observable<GetPresignedUrlResponse> | GetPresignedUrlResponse;
|
||||
}
|
||||
|
||||
export function MediaServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = ["upload", "getPresignedUrl"];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const MEDIA_SERVICE_NAME = "MediaService";
|
||||
Reference in New Issue
Block a user