@teacinema/contracts 1.1.1 → 1.1.2
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/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/gen/users.ts +68 -0
- package/package.json +1 -1
- package/proto/users.proto +33 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
package/gen/users.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
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: users.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "users.v1";
|
|
12
|
+
|
|
13
|
+
export interface GetMeRequest {
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GetMeResponse {
|
|
18
|
+
user: User | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CreateUserRequest {
|
|
22
|
+
id: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CreateUserResponse {
|
|
26
|
+
ok: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface User {
|
|
30
|
+
id: string;
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
phone?: string | undefined;
|
|
33
|
+
email?: string | undefined;
|
|
34
|
+
avatar?: string | undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const USERS_V1_PACKAGE_NAME = "users.v1";
|
|
38
|
+
|
|
39
|
+
export interface UsersServiceClient {
|
|
40
|
+
getMe(request: GetMeRequest): Observable<GetMeResponse>;
|
|
41
|
+
|
|
42
|
+
createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface UsersServiceController {
|
|
46
|
+
getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
|
|
47
|
+
|
|
48
|
+
createUser(
|
|
49
|
+
request: CreateUserRequest,
|
|
50
|
+
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function UsersServiceControllerMethods() {
|
|
54
|
+
return function (constructor: Function) {
|
|
55
|
+
const grpcMethods: string[] = ["getMe", "createUser"];
|
|
56
|
+
for (const method of grpcMethods) {
|
|
57
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
58
|
+
GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
|
59
|
+
}
|
|
60
|
+
const grpcStreamMethods: string[] = [];
|
|
61
|
+
for (const method of grpcStreamMethods) {
|
|
62
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
63
|
+
GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const USERS_SERVICE_NAME = "UsersService";
|
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package users.v1;
|
|
4
|
+
|
|
5
|
+
service UsersService {
|
|
6
|
+
rpc GetMe (GetMeRequest) returns (GetMeResponse);
|
|
7
|
+
|
|
8
|
+
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message GetMeRequest {
|
|
12
|
+
string id = 1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message GetMeResponse {
|
|
16
|
+
User user = 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message CreateUserRequest {
|
|
20
|
+
string id = 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message CreateUserResponse {
|
|
24
|
+
bool ok = 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message User {
|
|
28
|
+
string id = 1;
|
|
29
|
+
optional string name = 2;
|
|
30
|
+
optional string phone = 3;
|
|
31
|
+
optional string email = 4;
|
|
32
|
+
optional string avatar = 5;
|
|
33
|
+
}
|