@teacinema/contracts 1.1.6 → 1.1.7
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/gen/go/.gitkeep +0 -0
- package/gen/ts/.gitkeep +0 -0
- package/gen/ts/media.ts +76 -0
- package/gen/{users.ts → ts/users.ts} +1 -0
- package/package.json +2 -2
- package/proto/media.proto +42 -0
- package/proto/users.proto +1 -0
- /package/gen/{account.ts → ts/account.ts} +0 -0
- /package/gen/{auth.ts → ts/auth.ts} +0 -0
- /package/gen/{google → ts/google}/protobuf/empty.ts +0 -0
package/gen/go/.gitkeep
ADDED
|
File without changes
|
package/gen/ts/.gitkeep
ADDED
|
File without changes
|
package/gen/ts/media.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.8.3
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: media.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "media.v1";
|
|
12
|
+
|
|
13
|
+
export interface UploadRequest {
|
|
14
|
+
fileName: string;
|
|
15
|
+
folder: string;
|
|
16
|
+
contentType: string;
|
|
17
|
+
data: Uint8Array;
|
|
18
|
+
resizeWidth?: number | undefined;
|
|
19
|
+
resizeHeight?: number | undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface UploadResponse {
|
|
23
|
+
key: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GetRequest {
|
|
27
|
+
key: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface GetResponse {
|
|
31
|
+
data: Uint8Array;
|
|
32
|
+
contentType: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface DeleteRequest {
|
|
36
|
+
key: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface DeleteResponse {
|
|
40
|
+
ok: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const MEDIA_V1_PACKAGE_NAME = "media.v1";
|
|
44
|
+
|
|
45
|
+
export interface MediaServiceClient {
|
|
46
|
+
upload(request: UploadRequest): Observable<UploadResponse>;
|
|
47
|
+
|
|
48
|
+
get(request: GetRequest): Observable<GetResponse>;
|
|
49
|
+
|
|
50
|
+
delete(request: DeleteRequest): Observable<DeleteResponse>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface MediaServiceController {
|
|
54
|
+
upload(request: UploadRequest): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
|
|
55
|
+
|
|
56
|
+
get(request: GetRequest): Promise<GetResponse> | Observable<GetResponse> | GetResponse;
|
|
57
|
+
|
|
58
|
+
delete(request: DeleteRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function MediaServiceControllerMethods() {
|
|
62
|
+
return function (constructor: Function) {
|
|
63
|
+
const grpcMethods: string[] = ["upload", "get", "delete"];
|
|
64
|
+
for (const method of grpcMethods) {
|
|
65
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
66
|
+
GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
67
|
+
}
|
|
68
|
+
const grpcStreamMethods: string[] = [];
|
|
69
|
+
for (const method of grpcStreamMethods) {
|
|
70
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
71
|
+
GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const MEDIA_SERVICE_NAME = "MediaService";
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teacinema/contracts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc -p tsconfig.build.json",
|
|
9
|
-
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
9
|
+
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen/ts --ts_proto_opt=nestJs=true,package=omit"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package media.v1;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.com/teacinema/contracts/media;media";
|
|
6
|
+
option java_multiple_files = true;
|
|
7
|
+
|
|
8
|
+
service MediaService {
|
|
9
|
+
rpc Upload (UploadRequest) returns (UploadResponse);
|
|
10
|
+
rpc Get (GetRequest) returns (GetResponse);
|
|
11
|
+
rpc Delete (DeleteRequest) returns (DeleteResponse);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
message UploadRequest {
|
|
15
|
+
string file_name = 1;
|
|
16
|
+
string folder = 2;
|
|
17
|
+
string content_type = 3;
|
|
18
|
+
bytes data = 4;
|
|
19
|
+
optional int32 resize_width = 5;
|
|
20
|
+
optional int32 resize_height = 6;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message UploadResponse {
|
|
24
|
+
string key = 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message GetRequest {
|
|
28
|
+
string key = 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message GetResponse {
|
|
32
|
+
bytes data = 1;
|
|
33
|
+
string content_type = 2;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
message DeleteRequest {
|
|
37
|
+
string key = 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message DeleteResponse {
|
|
41
|
+
bool ok = 1;
|
|
42
|
+
}
|
package/proto/users.proto
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|