@ciganov/contracts 1.0.3 → 1.0.4
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 +2 -1
- package/gen/user.ts +81 -0
- package/package.json +1 -1
- package/proto/user.proto +44 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -4,5 +4,6 @@ exports.PROTO_PATHS = void 0;
|
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
5
|
exports.PROTO_PATHS = {
|
|
6
6
|
AUTH: (0, node_path_1.join)(__dirname, '../../proto/auth.proto'),
|
|
7
|
-
ACCOUNT: (0, node_path_1.join)(__dirname, '../../proto/account.proto')
|
|
7
|
+
ACCOUNT: (0, node_path_1.join)(__dirname, '../../proto/account.proto'),
|
|
8
|
+
USER: (0, node_path_1.join)(__dirname, '../../proto/user.proto')
|
|
8
9
|
};
|
package/gen/user.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.6
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: user.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "user.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 PatchUserRequest {
|
|
30
|
+
user: User | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PatchUserResponse {
|
|
34
|
+
ok: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface User {
|
|
38
|
+
id: string;
|
|
39
|
+
displayName?: string | undefined;
|
|
40
|
+
bio?: string | undefined;
|
|
41
|
+
successRate?: number | undefined;
|
|
42
|
+
loseAmount?: number | undefined;
|
|
43
|
+
avatar?: string | undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const USER_V1_PACKAGE_NAME = "user.v1";
|
|
47
|
+
|
|
48
|
+
export interface UserServiceClient {
|
|
49
|
+
getMe(request: GetMeRequest): Observable<GetMeResponse>;
|
|
50
|
+
|
|
51
|
+
createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
|
|
52
|
+
|
|
53
|
+
patchUser(request: PatchUserRequest): Observable<PatchUserResponse>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface UserServiceController {
|
|
57
|
+
getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
|
|
58
|
+
|
|
59
|
+
createUser(
|
|
60
|
+
request: CreateUserRequest,
|
|
61
|
+
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
|
62
|
+
|
|
63
|
+
patchUser(request: PatchUserRequest): Promise<PatchUserResponse> | Observable<PatchUserResponse> | PatchUserResponse;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function UserServiceControllerMethods() {
|
|
67
|
+
return function (constructor: Function) {
|
|
68
|
+
const grpcMethods: string[] = ["getMe", "createUser", "patchUser"];
|
|
69
|
+
for (const method of grpcMethods) {
|
|
70
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
71
|
+
GrpcMethod("UserService", method)(constructor.prototype[method], method, descriptor);
|
|
72
|
+
}
|
|
73
|
+
const grpcStreamMethods: string[] = [];
|
|
74
|
+
for (const method of grpcStreamMethods) {
|
|
75
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
76
|
+
GrpcStreamMethod("UserService", method)(constructor.prototype[method], method, descriptor);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const USER_SERVICE_NAME = "UserService";
|
package/package.json
CHANGED
package/proto/user.proto
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package user.v1;
|
|
4
|
+
|
|
5
|
+
service UserService {
|
|
6
|
+
rpc GetMe(GetMeRequest) returns (GetMeResponse);
|
|
7
|
+
|
|
8
|
+
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
|
|
9
|
+
|
|
10
|
+
rpc PatchUser(PatchUserRequest) returns (PatchUserResponse);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
message GetMeRequest {
|
|
14
|
+
string id = 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
message GetMeResponse {
|
|
18
|
+
User user = 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message CreateUserRequest {
|
|
22
|
+
string id = 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message CreateUserResponse {
|
|
26
|
+
bool ok = 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message PatchUserRequest {
|
|
30
|
+
User user = 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message PatchUserResponse {
|
|
34
|
+
bool ok = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message User {
|
|
38
|
+
string id = 1;
|
|
39
|
+
optional string display_name = 2;
|
|
40
|
+
optional string bio = 3;
|
|
41
|
+
optional int32 success_rate = 4;
|
|
42
|
+
optional int32 lose_amount = 5;
|
|
43
|
+
optional string avatar = 6;
|
|
44
|
+
}
|