@yarcinema/contracts 1.1.2 → 1.1.3
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/user.ts +17 -1
- package/package.json +1 -1
- package/proto/user.proto +12 -0
package/gen/user.ts
CHANGED
|
@@ -26,6 +26,16 @@ export interface CreateUserResponse {
|
|
|
26
26
|
ok: boolean;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export interface UpdateUserRequest {
|
|
30
|
+
userId: string;
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
avatar?: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface UpdateUserResponse {
|
|
36
|
+
ok: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
export interface User {
|
|
30
40
|
id: string;
|
|
31
41
|
name?: string | undefined;
|
|
@@ -40,6 +50,8 @@ export interface UserServiceClient {
|
|
|
40
50
|
getMe(request: GetMeRequest): Observable<GetMeResponse>;
|
|
41
51
|
|
|
42
52
|
createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
|
|
53
|
+
|
|
54
|
+
updateUser(request: UpdateUserRequest): Observable<UpdateUserResponse>;
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
export interface UserServiceController {
|
|
@@ -48,11 +60,15 @@ export interface UserServiceController {
|
|
|
48
60
|
createUser(
|
|
49
61
|
request: CreateUserRequest,
|
|
50
62
|
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
|
63
|
+
|
|
64
|
+
updateUser(
|
|
65
|
+
request: UpdateUserRequest,
|
|
66
|
+
): Promise<UpdateUserResponse> | Observable<UpdateUserResponse> | UpdateUserResponse;
|
|
51
67
|
}
|
|
52
68
|
|
|
53
69
|
export function UserServiceControllerMethods() {
|
|
54
70
|
return function (constructor: Function) {
|
|
55
|
-
const grpcMethods: string[] = ["getMe", "createUser"];
|
|
71
|
+
const grpcMethods: string[] = ["getMe", "createUser", "updateUser"];
|
|
56
72
|
for (const method of grpcMethods) {
|
|
57
73
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
58
74
|
GrpcMethod("UserService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
package/proto/user.proto
CHANGED
|
@@ -6,6 +6,8 @@ service UserService {
|
|
|
6
6
|
rpc GetMe (GetMeRequest) returns (GetMeResponse);
|
|
7
7
|
|
|
8
8
|
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
|
|
9
|
+
|
|
10
|
+
rpc UpdateUser (UpdateUserRequest) returns (UpdateUserResponse);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
message GetMeRequest {
|
|
@@ -24,6 +26,16 @@ message CreateUserResponse {
|
|
|
24
26
|
bool ok = 1;
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
message UpdateUserRequest {
|
|
30
|
+
string user_id = 1;
|
|
31
|
+
optional string name = 2;
|
|
32
|
+
optional string avatar = 3;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message UpdateUserResponse {
|
|
36
|
+
bool ok = 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
27
39
|
message User {
|
|
28
40
|
string id = 1;
|
|
29
41
|
optional string name = 2;
|