@outlyapp/contracts 1.0.1 → 1.0.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.
@@ -3,6 +3,9 @@
3
3
  // protoc-gen-ts_proto v1.181.2
4
4
  // protoc v6.33.4
5
5
  // source: auth/auth.proto
6
+
6
7
  /* eslint-disable */
8
+
7
9
  export const protobufPackage = "";
10
+
8
11
  export const _PACKAGE_NAME = "";
@@ -1,3 +1,6 @@
1
+
1
2
  export * as auth from "./auth/auth";
2
3
  export * as listings from "./listings/listings";
3
4
  export * as users from "./users/users";
5
+
6
+ export * from "./paths";
@@ -3,6 +3,9 @@
3
3
  // protoc-gen-ts_proto v1.181.2
4
4
  // protoc v6.33.4
5
5
  // source: listings/listings.proto
6
+
6
7
  /* eslint-disable */
8
+
7
9
  export const protobufPackage = "";
10
+
8
11
  export const _PACKAGE_NAME = "";
@@ -0,0 +1,5 @@
1
+ import { join } from "path";
2
+
3
+ export const AUTH_PROTO_PATH = join(__dirname, "../auth/auth.proto");
4
+ export const LISTINGS_PROTO_PATH = join(__dirname, "../listings/listings.proto");
5
+ export const USERS_PROTO_PATH = join(__dirname, "../users/users.proto");
@@ -0,0 +1,364 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v1.181.2
4
+ // protoc v6.33.4
5
+ // source: users/users.proto
6
+
7
+ /* eslint-disable */
8
+ import type { handleUnaryCall, UntypedServiceImplementation } from "@grpc/grpc-js";
9
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
10
+ import _m0 from "protobufjs/minimal";
11
+ import { Observable } from "rxjs";
12
+
13
+ export const protobufPackage = "users";
14
+
15
+ export interface CreateProfileRequest {
16
+ id: string;
17
+ email: string;
18
+ username: string;
19
+ name: string;
20
+ }
21
+
22
+ export interface GetUserByIdRequest {
23
+ id: string;
24
+ }
25
+
26
+ export interface GetUserByUsernameRequest {
27
+ username: string;
28
+ }
29
+
30
+ export interface UserResponse {
31
+ id: string;
32
+ email: string;
33
+ username: string;
34
+ name: string;
35
+ avatarUrl: string;
36
+ hasSellerProfile: boolean;
37
+ ratingAvg: number;
38
+ ratingCount: number;
39
+ }
40
+
41
+ export const USERS_PACKAGE_NAME = "users";
42
+
43
+ function createBaseCreateProfileRequest(): CreateProfileRequest {
44
+ return { id: "", email: "", username: "", name: "" };
45
+ }
46
+
47
+ export const CreateProfileRequest = {
48
+ encode(message: CreateProfileRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
49
+ if (message.id !== "") {
50
+ writer.uint32(10).string(message.id);
51
+ }
52
+ if (message.email !== "") {
53
+ writer.uint32(18).string(message.email);
54
+ }
55
+ if (message.username !== "") {
56
+ writer.uint32(26).string(message.username);
57
+ }
58
+ if (message.name !== "") {
59
+ writer.uint32(34).string(message.name);
60
+ }
61
+ return writer;
62
+ },
63
+
64
+ decode(input: _m0.Reader | Uint8Array, length?: number): CreateProfileRequest {
65
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
66
+ let end = length === undefined ? reader.len : reader.pos + length;
67
+ const message = createBaseCreateProfileRequest();
68
+ while (reader.pos < end) {
69
+ const tag = reader.uint32();
70
+ switch (tag >>> 3) {
71
+ case 1:
72
+ if (tag !== 10) {
73
+ break;
74
+ }
75
+
76
+ message.id = reader.string();
77
+ continue;
78
+ case 2:
79
+ if (tag !== 18) {
80
+ break;
81
+ }
82
+
83
+ message.email = reader.string();
84
+ continue;
85
+ case 3:
86
+ if (tag !== 26) {
87
+ break;
88
+ }
89
+
90
+ message.username = reader.string();
91
+ continue;
92
+ case 4:
93
+ if (tag !== 34) {
94
+ break;
95
+ }
96
+
97
+ message.name = reader.string();
98
+ continue;
99
+ }
100
+ if ((tag & 7) === 4 || tag === 0) {
101
+ break;
102
+ }
103
+ reader.skipType(tag & 7);
104
+ }
105
+ return message;
106
+ },
107
+ };
108
+
109
+ function createBaseGetUserByIdRequest(): GetUserByIdRequest {
110
+ return { id: "" };
111
+ }
112
+
113
+ export const GetUserByIdRequest = {
114
+ encode(message: GetUserByIdRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
115
+ if (message.id !== "") {
116
+ writer.uint32(10).string(message.id);
117
+ }
118
+ return writer;
119
+ },
120
+
121
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetUserByIdRequest {
122
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
123
+ let end = length === undefined ? reader.len : reader.pos + length;
124
+ const message = createBaseGetUserByIdRequest();
125
+ while (reader.pos < end) {
126
+ const tag = reader.uint32();
127
+ switch (tag >>> 3) {
128
+ case 1:
129
+ if (tag !== 10) {
130
+ break;
131
+ }
132
+
133
+ message.id = reader.string();
134
+ continue;
135
+ }
136
+ if ((tag & 7) === 4 || tag === 0) {
137
+ break;
138
+ }
139
+ reader.skipType(tag & 7);
140
+ }
141
+ return message;
142
+ },
143
+ };
144
+
145
+ function createBaseGetUserByUsernameRequest(): GetUserByUsernameRequest {
146
+ return { username: "" };
147
+ }
148
+
149
+ export const GetUserByUsernameRequest = {
150
+ encode(message: GetUserByUsernameRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
151
+ if (message.username !== "") {
152
+ writer.uint32(10).string(message.username);
153
+ }
154
+ return writer;
155
+ },
156
+
157
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetUserByUsernameRequest {
158
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
159
+ let end = length === undefined ? reader.len : reader.pos + length;
160
+ const message = createBaseGetUserByUsernameRequest();
161
+ while (reader.pos < end) {
162
+ const tag = reader.uint32();
163
+ switch (tag >>> 3) {
164
+ case 1:
165
+ if (tag !== 10) {
166
+ break;
167
+ }
168
+
169
+ message.username = reader.string();
170
+ continue;
171
+ }
172
+ if ((tag & 7) === 4 || tag === 0) {
173
+ break;
174
+ }
175
+ reader.skipType(tag & 7);
176
+ }
177
+ return message;
178
+ },
179
+ };
180
+
181
+ function createBaseUserResponse(): UserResponse {
182
+ return {
183
+ id: "",
184
+ email: "",
185
+ username: "",
186
+ name: "",
187
+ avatarUrl: "",
188
+ hasSellerProfile: false,
189
+ ratingAvg: 0,
190
+ ratingCount: 0,
191
+ };
192
+ }
193
+
194
+ export const UserResponse = {
195
+ encode(message: UserResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
196
+ if (message.id !== "") {
197
+ writer.uint32(10).string(message.id);
198
+ }
199
+ if (message.email !== "") {
200
+ writer.uint32(18).string(message.email);
201
+ }
202
+ if (message.username !== "") {
203
+ writer.uint32(26).string(message.username);
204
+ }
205
+ if (message.name !== "") {
206
+ writer.uint32(34).string(message.name);
207
+ }
208
+ if (message.avatarUrl !== "") {
209
+ writer.uint32(42).string(message.avatarUrl);
210
+ }
211
+ if (message.hasSellerProfile !== false) {
212
+ writer.uint32(48).bool(message.hasSellerProfile);
213
+ }
214
+ if (message.ratingAvg !== 0) {
215
+ writer.uint32(61).float(message.ratingAvg);
216
+ }
217
+ if (message.ratingCount !== 0) {
218
+ writer.uint32(64).int32(message.ratingCount);
219
+ }
220
+ return writer;
221
+ },
222
+
223
+ decode(input: _m0.Reader | Uint8Array, length?: number): UserResponse {
224
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
225
+ let end = length === undefined ? reader.len : reader.pos + length;
226
+ const message = createBaseUserResponse();
227
+ while (reader.pos < end) {
228
+ const tag = reader.uint32();
229
+ switch (tag >>> 3) {
230
+ case 1:
231
+ if (tag !== 10) {
232
+ break;
233
+ }
234
+
235
+ message.id = reader.string();
236
+ continue;
237
+ case 2:
238
+ if (tag !== 18) {
239
+ break;
240
+ }
241
+
242
+ message.email = reader.string();
243
+ continue;
244
+ case 3:
245
+ if (tag !== 26) {
246
+ break;
247
+ }
248
+
249
+ message.username = reader.string();
250
+ continue;
251
+ case 4:
252
+ if (tag !== 34) {
253
+ break;
254
+ }
255
+
256
+ message.name = reader.string();
257
+ continue;
258
+ case 5:
259
+ if (tag !== 42) {
260
+ break;
261
+ }
262
+
263
+ message.avatarUrl = reader.string();
264
+ continue;
265
+ case 6:
266
+ if (tag !== 48) {
267
+ break;
268
+ }
269
+
270
+ message.hasSellerProfile = reader.bool();
271
+ continue;
272
+ case 7:
273
+ if (tag !== 61) {
274
+ break;
275
+ }
276
+
277
+ message.ratingAvg = reader.float();
278
+ continue;
279
+ case 8:
280
+ if (tag !== 64) {
281
+ break;
282
+ }
283
+
284
+ message.ratingCount = reader.int32();
285
+ continue;
286
+ }
287
+ if ((tag & 7) === 4 || tag === 0) {
288
+ break;
289
+ }
290
+ reader.skipType(tag & 7);
291
+ }
292
+ return message;
293
+ },
294
+ };
295
+
296
+ export interface UsersServiceClient {
297
+ createProfile(request: CreateProfileRequest): Observable<UserResponse>;
298
+
299
+ getUserById(request: GetUserByIdRequest): Observable<UserResponse>;
300
+
301
+ getUserByUsername(request: GetUserByUsernameRequest): Observable<UserResponse>;
302
+ }
303
+
304
+ export interface UsersServiceController {
305
+ createProfile(request: CreateProfileRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
306
+
307
+ getUserById(request: GetUserByIdRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
308
+
309
+ getUserByUsername(request: GetUserByUsernameRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
310
+ }
311
+
312
+ export function UsersServiceControllerMethods() {
313
+ return function (constructor: Function) {
314
+ const grpcMethods: string[] = ["createProfile", "getUserById", "getUserByUsername"];
315
+ for (const method of grpcMethods) {
316
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
317
+ GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
318
+ }
319
+ const grpcStreamMethods: string[] = [];
320
+ for (const method of grpcStreamMethods) {
321
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
322
+ GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
323
+ }
324
+ };
325
+ }
326
+
327
+ export const USERS_SERVICE_NAME = "UsersService";
328
+
329
+ export type UsersServiceService = typeof UsersServiceService;
330
+ export const UsersServiceService = {
331
+ createProfile: {
332
+ path: "/users.UsersService/CreateProfile",
333
+ requestStream: false,
334
+ responseStream: false,
335
+ requestSerialize: (value: CreateProfileRequest) => Buffer.from(CreateProfileRequest.encode(value).finish()),
336
+ requestDeserialize: (value: Buffer) => CreateProfileRequest.decode(value),
337
+ responseSerialize: (value: UserResponse) => Buffer.from(UserResponse.encode(value).finish()),
338
+ responseDeserialize: (value: Buffer) => UserResponse.decode(value),
339
+ },
340
+ getUserById: {
341
+ path: "/users.UsersService/GetUserById",
342
+ requestStream: false,
343
+ responseStream: false,
344
+ requestSerialize: (value: GetUserByIdRequest) => Buffer.from(GetUserByIdRequest.encode(value).finish()),
345
+ requestDeserialize: (value: Buffer) => GetUserByIdRequest.decode(value),
346
+ responseSerialize: (value: UserResponse) => Buffer.from(UserResponse.encode(value).finish()),
347
+ responseDeserialize: (value: Buffer) => UserResponse.decode(value),
348
+ },
349
+ getUserByUsername: {
350
+ path: "/users.UsersService/GetUserByUsername",
351
+ requestStream: false,
352
+ responseStream: false,
353
+ requestSerialize: (value: GetUserByUsernameRequest) => Buffer.from(GetUserByUsernameRequest.encode(value).finish()),
354
+ requestDeserialize: (value: Buffer) => GetUserByUsernameRequest.decode(value),
355
+ responseSerialize: (value: UserResponse) => Buffer.from(UserResponse.encode(value).finish()),
356
+ responseDeserialize: (value: Buffer) => UserResponse.decode(value),
357
+ },
358
+ } as const;
359
+
360
+ export interface UsersServiceServer extends UntypedServiceImplementation {
361
+ createProfile: handleUnaryCall<CreateProfileRequest, UserResponse>;
362
+ getUserById: handleUnaryCall<GetUserByIdRequest, UserResponse>;
363
+ getUserByUsername: handleUnaryCall<GetUserByUsernameRequest, UserResponse>;
364
+ }
package/package.json CHANGED
@@ -1,18 +1,21 @@
1
1
  {
2
2
  "name": "@outlyapp/contracts",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "private": false,
5
5
  "type": "module",
6
- "files": ["dist"],
7
- "main": "dist/index.js",
8
- "types": "dist/index.d.ts",
6
+ "files": [
7
+ "generated"
8
+ ],
9
+ "main": "generated/index.js",
10
+ "types": "generated/index.d.ts",
9
11
  "publishConfig": {
10
- "access": "public"
11
- },
12
- "scripts": {
13
- "build": "node scripts/gen.js && tsc -p tsconfig.json",
14
- "publish:contracts": "pnpm build && npm publish"
15
- },
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "clean": "rm -rf generated",
16
+ "gen": "pnpm clean && node scripts/gen.js",
17
+ "publish:contracts": "pnpm gen && git add . && git commit -m 'chore: update generated contracts' && npm version patch && npm publish --access public"
18
+ },
16
19
  "devDependencies": {
17
20
  "protobufjs": "^7.0.0",
18
21
  "ts-proto": "^1.173.0",
@@ -23,4 +26,4 @@
23
26
  "@nestjs/microservices": "^11.1.14",
24
27
  "rxjs": "^7.8.2"
25
28
  }
26
- }
29
+ }
@@ -1,2 +0,0 @@
1
- export declare const protobufPackage = "";
2
- export declare const _PACKAGE_NAME = "";
File without changes
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * as auth from "./auth/auth";
2
- export * as listings from "./listings/listings";
3
- export * as users from "./users/users";
@@ -1,2 +0,0 @@
1
- export declare const protobufPackage = "";
2
- export declare const _PACKAGE_NAME = "";
File without changes
package/dist/paths.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const AUTH_PROTO_PATH: string;
2
- export declare const LISTINGS_PROTO_PATH: string;
3
- export declare const USERS_PROTO_PATH: string;
package/dist/paths.js DELETED
@@ -1,4 +0,0 @@
1
- import { join } from "path";
2
- export const AUTH_PROTO_PATH = join(__dirname, "auth/auth.proto");
3
- export const LISTINGS_PROTO_PATH = join(__dirname, "listings/listings.proto");
4
- export const USERS_PROTO_PATH = join(__dirname, "users/users.proto");
@@ -1,90 +0,0 @@
1
- import type { handleUnaryCall, UntypedServiceImplementation } from "@grpc/grpc-js";
2
- import _m0 from "protobufjs/minimal";
3
- import { Observable } from "rxjs";
4
- export declare const protobufPackage = "users";
5
- export interface CreateProfileRequest {
6
- id: string;
7
- email: string;
8
- username: string;
9
- name: string;
10
- }
11
- export interface GetUserByIdRequest {
12
- id: string;
13
- }
14
- export interface GetUserByUsernameRequest {
15
- username: string;
16
- }
17
- export interface UserResponse {
18
- id: string;
19
- email: string;
20
- username: string;
21
- name: string;
22
- avatarUrl: string;
23
- hasSellerProfile: boolean;
24
- ratingAvg: number;
25
- ratingCount: number;
26
- }
27
- export declare const USERS_PACKAGE_NAME = "users";
28
- export declare const CreateProfileRequest: {
29
- encode(message: CreateProfileRequest, writer?: _m0.Writer): _m0.Writer;
30
- decode(input: _m0.Reader | Uint8Array, length?: number): CreateProfileRequest;
31
- };
32
- export declare const GetUserByIdRequest: {
33
- encode(message: GetUserByIdRequest, writer?: _m0.Writer): _m0.Writer;
34
- decode(input: _m0.Reader | Uint8Array, length?: number): GetUserByIdRequest;
35
- };
36
- export declare const GetUserByUsernameRequest: {
37
- encode(message: GetUserByUsernameRequest, writer?: _m0.Writer): _m0.Writer;
38
- decode(input: _m0.Reader | Uint8Array, length?: number): GetUserByUsernameRequest;
39
- };
40
- export declare const UserResponse: {
41
- encode(message: UserResponse, writer?: _m0.Writer): _m0.Writer;
42
- decode(input: _m0.Reader | Uint8Array, length?: number): UserResponse;
43
- };
44
- export interface UsersServiceClient {
45
- createProfile(request: CreateProfileRequest): Observable<UserResponse>;
46
- getUserById(request: GetUserByIdRequest): Observable<UserResponse>;
47
- getUserByUsername(request: GetUserByUsernameRequest): Observable<UserResponse>;
48
- }
49
- export interface UsersServiceController {
50
- createProfile(request: CreateProfileRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
51
- getUserById(request: GetUserByIdRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
52
- getUserByUsername(request: GetUserByUsernameRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
53
- }
54
- export declare function UsersServiceControllerMethods(): (constructor: Function) => void;
55
- export declare const USERS_SERVICE_NAME = "UsersService";
56
- export type UsersServiceService = typeof UsersServiceService;
57
- export declare const UsersServiceService: {
58
- readonly createProfile: {
59
- readonly path: "/users.UsersService/CreateProfile";
60
- readonly requestStream: false;
61
- readonly responseStream: false;
62
- readonly requestSerialize: (value: CreateProfileRequest) => Buffer<ArrayBuffer>;
63
- readonly requestDeserialize: (value: Buffer) => CreateProfileRequest;
64
- readonly responseSerialize: (value: UserResponse) => Buffer<ArrayBuffer>;
65
- readonly responseDeserialize: (value: Buffer) => UserResponse;
66
- };
67
- readonly getUserById: {
68
- readonly path: "/users.UsersService/GetUserById";
69
- readonly requestStream: false;
70
- readonly responseStream: false;
71
- readonly requestSerialize: (value: GetUserByIdRequest) => Buffer<ArrayBuffer>;
72
- readonly requestDeserialize: (value: Buffer) => GetUserByIdRequest;
73
- readonly responseSerialize: (value: UserResponse) => Buffer<ArrayBuffer>;
74
- readonly responseDeserialize: (value: Buffer) => UserResponse;
75
- };
76
- readonly getUserByUsername: {
77
- readonly path: "/users.UsersService/GetUserByUsername";
78
- readonly requestStream: false;
79
- readonly responseStream: false;
80
- readonly requestSerialize: (value: GetUserByUsernameRequest) => Buffer<ArrayBuffer>;
81
- readonly requestDeserialize: (value: Buffer) => GetUserByUsernameRequest;
82
- readonly responseSerialize: (value: UserResponse) => Buffer<ArrayBuffer>;
83
- readonly responseDeserialize: (value: Buffer) => UserResponse;
84
- };
85
- };
86
- export interface UsersServiceServer extends UntypedServiceImplementation {
87
- createProfile: handleUnaryCall<CreateProfileRequest, UserResponse>;
88
- getUserById: handleUnaryCall<GetUserByIdRequest, UserResponse>;
89
- getUserByUsername: handleUnaryCall<GetUserByUsernameRequest, UserResponse>;
90
- }
@@ -1,280 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v1.181.2
4
- // protoc v6.33.4
5
- // source: users/users.proto
6
- import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
7
- import _m0 from "protobufjs/minimal";
8
- export const protobufPackage = "users";
9
- export const USERS_PACKAGE_NAME = "users";
10
- function createBaseCreateProfileRequest() {
11
- return { id: "", email: "", username: "", name: "" };
12
- }
13
- export const CreateProfileRequest = {
14
- encode(message, writer = _m0.Writer.create()) {
15
- if (message.id !== "") {
16
- writer.uint32(10).string(message.id);
17
- }
18
- if (message.email !== "") {
19
- writer.uint32(18).string(message.email);
20
- }
21
- if (message.username !== "") {
22
- writer.uint32(26).string(message.username);
23
- }
24
- if (message.name !== "") {
25
- writer.uint32(34).string(message.name);
26
- }
27
- return writer;
28
- },
29
- decode(input, length) {
30
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
31
- let end = length === undefined ? reader.len : reader.pos + length;
32
- const message = createBaseCreateProfileRequest();
33
- while (reader.pos < end) {
34
- const tag = reader.uint32();
35
- switch (tag >>> 3) {
36
- case 1:
37
- if (tag !== 10) {
38
- break;
39
- }
40
- message.id = reader.string();
41
- continue;
42
- case 2:
43
- if (tag !== 18) {
44
- break;
45
- }
46
- message.email = reader.string();
47
- continue;
48
- case 3:
49
- if (tag !== 26) {
50
- break;
51
- }
52
- message.username = reader.string();
53
- continue;
54
- case 4:
55
- if (tag !== 34) {
56
- break;
57
- }
58
- message.name = reader.string();
59
- continue;
60
- }
61
- if ((tag & 7) === 4 || tag === 0) {
62
- break;
63
- }
64
- reader.skipType(tag & 7);
65
- }
66
- return message;
67
- },
68
- };
69
- function createBaseGetUserByIdRequest() {
70
- return { id: "" };
71
- }
72
- export const GetUserByIdRequest = {
73
- encode(message, writer = _m0.Writer.create()) {
74
- if (message.id !== "") {
75
- writer.uint32(10).string(message.id);
76
- }
77
- return writer;
78
- },
79
- decode(input, length) {
80
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
81
- let end = length === undefined ? reader.len : reader.pos + length;
82
- const message = createBaseGetUserByIdRequest();
83
- while (reader.pos < end) {
84
- const tag = reader.uint32();
85
- switch (tag >>> 3) {
86
- case 1:
87
- if (tag !== 10) {
88
- break;
89
- }
90
- message.id = reader.string();
91
- continue;
92
- }
93
- if ((tag & 7) === 4 || tag === 0) {
94
- break;
95
- }
96
- reader.skipType(tag & 7);
97
- }
98
- return message;
99
- },
100
- };
101
- function createBaseGetUserByUsernameRequest() {
102
- return { username: "" };
103
- }
104
- export const GetUserByUsernameRequest = {
105
- encode(message, writer = _m0.Writer.create()) {
106
- if (message.username !== "") {
107
- writer.uint32(10).string(message.username);
108
- }
109
- return writer;
110
- },
111
- decode(input, length) {
112
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
113
- let end = length === undefined ? reader.len : reader.pos + length;
114
- const message = createBaseGetUserByUsernameRequest();
115
- while (reader.pos < end) {
116
- const tag = reader.uint32();
117
- switch (tag >>> 3) {
118
- case 1:
119
- if (tag !== 10) {
120
- break;
121
- }
122
- message.username = reader.string();
123
- continue;
124
- }
125
- if ((tag & 7) === 4 || tag === 0) {
126
- break;
127
- }
128
- reader.skipType(tag & 7);
129
- }
130
- return message;
131
- },
132
- };
133
- function createBaseUserResponse() {
134
- return {
135
- id: "",
136
- email: "",
137
- username: "",
138
- name: "",
139
- avatarUrl: "",
140
- hasSellerProfile: false,
141
- ratingAvg: 0,
142
- ratingCount: 0,
143
- };
144
- }
145
- export const UserResponse = {
146
- encode(message, writer = _m0.Writer.create()) {
147
- if (message.id !== "") {
148
- writer.uint32(10).string(message.id);
149
- }
150
- if (message.email !== "") {
151
- writer.uint32(18).string(message.email);
152
- }
153
- if (message.username !== "") {
154
- writer.uint32(26).string(message.username);
155
- }
156
- if (message.name !== "") {
157
- writer.uint32(34).string(message.name);
158
- }
159
- if (message.avatarUrl !== "") {
160
- writer.uint32(42).string(message.avatarUrl);
161
- }
162
- if (message.hasSellerProfile !== false) {
163
- writer.uint32(48).bool(message.hasSellerProfile);
164
- }
165
- if (message.ratingAvg !== 0) {
166
- writer.uint32(61).float(message.ratingAvg);
167
- }
168
- if (message.ratingCount !== 0) {
169
- writer.uint32(64).int32(message.ratingCount);
170
- }
171
- return writer;
172
- },
173
- decode(input, length) {
174
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
175
- let end = length === undefined ? reader.len : reader.pos + length;
176
- const message = createBaseUserResponse();
177
- while (reader.pos < end) {
178
- const tag = reader.uint32();
179
- switch (tag >>> 3) {
180
- case 1:
181
- if (tag !== 10) {
182
- break;
183
- }
184
- message.id = reader.string();
185
- continue;
186
- case 2:
187
- if (tag !== 18) {
188
- break;
189
- }
190
- message.email = reader.string();
191
- continue;
192
- case 3:
193
- if (tag !== 26) {
194
- break;
195
- }
196
- message.username = reader.string();
197
- continue;
198
- case 4:
199
- if (tag !== 34) {
200
- break;
201
- }
202
- message.name = reader.string();
203
- continue;
204
- case 5:
205
- if (tag !== 42) {
206
- break;
207
- }
208
- message.avatarUrl = reader.string();
209
- continue;
210
- case 6:
211
- if (tag !== 48) {
212
- break;
213
- }
214
- message.hasSellerProfile = reader.bool();
215
- continue;
216
- case 7:
217
- if (tag !== 61) {
218
- break;
219
- }
220
- message.ratingAvg = reader.float();
221
- continue;
222
- case 8:
223
- if (tag !== 64) {
224
- break;
225
- }
226
- message.ratingCount = reader.int32();
227
- continue;
228
- }
229
- if ((tag & 7) === 4 || tag === 0) {
230
- break;
231
- }
232
- reader.skipType(tag & 7);
233
- }
234
- return message;
235
- },
236
- };
237
- export function UsersServiceControllerMethods() {
238
- return function (constructor) {
239
- const grpcMethods = ["createProfile", "getUserById", "getUserByUsername"];
240
- for (const method of grpcMethods) {
241
- const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
242
- GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
243
- }
244
- const grpcStreamMethods = [];
245
- for (const method of grpcStreamMethods) {
246
- const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
247
- GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
248
- }
249
- };
250
- }
251
- export const USERS_SERVICE_NAME = "UsersService";
252
- export const UsersServiceService = {
253
- createProfile: {
254
- path: "/users.UsersService/CreateProfile",
255
- requestStream: false,
256
- responseStream: false,
257
- requestSerialize: (value) => Buffer.from(CreateProfileRequest.encode(value).finish()),
258
- requestDeserialize: (value) => CreateProfileRequest.decode(value),
259
- responseSerialize: (value) => Buffer.from(UserResponse.encode(value).finish()),
260
- responseDeserialize: (value) => UserResponse.decode(value),
261
- },
262
- getUserById: {
263
- path: "/users.UsersService/GetUserById",
264
- requestStream: false,
265
- responseStream: false,
266
- requestSerialize: (value) => Buffer.from(GetUserByIdRequest.encode(value).finish()),
267
- requestDeserialize: (value) => GetUserByIdRequest.decode(value),
268
- responseSerialize: (value) => Buffer.from(UserResponse.encode(value).finish()),
269
- responseDeserialize: (value) => UserResponse.decode(value),
270
- },
271
- getUserByUsername: {
272
- path: "/users.UsersService/GetUserByUsername",
273
- requestStream: false,
274
- responseStream: false,
275
- requestSerialize: (value) => Buffer.from(GetUserByUsernameRequest.encode(value).finish()),
276
- requestDeserialize: (value) => GetUserByUsernameRequest.decode(value),
277
- responseSerialize: (value) => Buffer.from(UserResponse.encode(value).finish()),
278
- responseDeserialize: (value) => UserResponse.decode(value),
279
- },
280
- };
@@ -1,35 +0,0 @@
1
- syntax = "proto3";
2
-
3
- package users;
4
-
5
- service UsersService {
6
- rpc CreateProfile (CreateProfileRequest) returns (UserResponse);
7
- rpc GetUserById (GetUserByIdRequest) returns (UserResponse);
8
- rpc GetUserByUsername (GetUserByUsernameRequest) returns (UserResponse);
9
- }
10
-
11
- message CreateProfileRequest {
12
- string id = 1;
13
- string email = 2;
14
- string username = 3;
15
- string name = 4;
16
- }
17
-
18
- message GetUserByIdRequest {
19
- string id = 1;
20
- }
21
-
22
- message GetUserByUsernameRequest {
23
- string username = 1;
24
- }
25
-
26
- message UserResponse {
27
- string id = 1;
28
- string email = 2;
29
- string username = 3;
30
- string name = 4;
31
- string avatarUrl = 5;
32
- bool hasSellerProfile = 6;
33
- float ratingAvg = 7;
34
- int32 ratingCount = 8;
35
- }