@babacarthiamdev/contracts 1.0.18 → 1.0.20
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/users.ts +111 -1
- package/package.json +1 -1
- package/proto/users.proto +13 -0
package/gen/users.ts
CHANGED
|
@@ -27,6 +27,16 @@ export interface CreateUserResponse {
|
|
|
27
27
|
ok: boolean;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export interface PatchUserRequest {
|
|
31
|
+
userId: string;
|
|
32
|
+
name?: string | undefined;
|
|
33
|
+
avatar?: string | undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface PatchUserResponse {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
export interface User {
|
|
31
41
|
id: string;
|
|
32
42
|
name?: string | undefined;
|
|
@@ -185,6 +195,102 @@ export const CreateUserResponse: MessageFns<CreateUserResponse> = {
|
|
|
185
195
|
},
|
|
186
196
|
};
|
|
187
197
|
|
|
198
|
+
function createBasePatchUserRequest(): PatchUserRequest {
|
|
199
|
+
return { userId: "" };
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export const PatchUserRequest: MessageFns<PatchUserRequest> = {
|
|
203
|
+
encode(message: PatchUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
204
|
+
if (message.userId !== "") {
|
|
205
|
+
writer.uint32(10).string(message.userId);
|
|
206
|
+
}
|
|
207
|
+
if (message.name !== undefined) {
|
|
208
|
+
writer.uint32(18).string(message.name);
|
|
209
|
+
}
|
|
210
|
+
if (message.avatar !== undefined) {
|
|
211
|
+
writer.uint32(26).string(message.avatar);
|
|
212
|
+
}
|
|
213
|
+
return writer;
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
decode(input: BinaryReader | Uint8Array, length?: number): PatchUserRequest {
|
|
217
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
218
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
219
|
+
const message = createBasePatchUserRequest();
|
|
220
|
+
while (reader.pos < end) {
|
|
221
|
+
const tag = reader.uint32();
|
|
222
|
+
switch (tag >>> 3) {
|
|
223
|
+
case 1: {
|
|
224
|
+
if (tag !== 10) {
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
message.userId = reader.string();
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
case 2: {
|
|
232
|
+
if (tag !== 18) {
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
message.name = reader.string();
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
case 3: {
|
|
240
|
+
if (tag !== 26) {
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
message.avatar = reader.string();
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
reader.skip(tag & 7);
|
|
252
|
+
}
|
|
253
|
+
return message;
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
function createBasePatchUserResponse(): PatchUserResponse {
|
|
258
|
+
return { ok: false };
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export const PatchUserResponse: MessageFns<PatchUserResponse> = {
|
|
262
|
+
encode(message: PatchUserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
263
|
+
if (message.ok !== false) {
|
|
264
|
+
writer.uint32(8).bool(message.ok);
|
|
265
|
+
}
|
|
266
|
+
return writer;
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
decode(input: BinaryReader | Uint8Array, length?: number): PatchUserResponse {
|
|
270
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
271
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
272
|
+
const message = createBasePatchUserResponse();
|
|
273
|
+
while (reader.pos < end) {
|
|
274
|
+
const tag = reader.uint32();
|
|
275
|
+
switch (tag >>> 3) {
|
|
276
|
+
case 1: {
|
|
277
|
+
if (tag !== 8) {
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
message.ok = reader.bool();
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
reader.skip(tag & 7);
|
|
289
|
+
}
|
|
290
|
+
return message;
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
|
|
188
294
|
function createBaseUser(): User {
|
|
189
295
|
return { id: "" };
|
|
190
296
|
}
|
|
@@ -270,6 +376,8 @@ export interface UsersServiceClient {
|
|
|
270
376
|
getMe(request: GetMeRequest): Observable<GetMeResponse>;
|
|
271
377
|
|
|
272
378
|
createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
|
|
379
|
+
|
|
380
|
+
patchUser(request: PatchUserRequest): Observable<PatchUserResponse>;
|
|
273
381
|
}
|
|
274
382
|
|
|
275
383
|
export interface UsersServiceController {
|
|
@@ -278,11 +386,13 @@ export interface UsersServiceController {
|
|
|
278
386
|
createUser(
|
|
279
387
|
request: CreateUserRequest,
|
|
280
388
|
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
|
389
|
+
|
|
390
|
+
patchUser(request: PatchUserRequest): Promise<PatchUserResponse> | Observable<PatchUserResponse> | PatchUserResponse;
|
|
281
391
|
}
|
|
282
392
|
|
|
283
393
|
export function UsersServiceControllerMethods() {
|
|
284
394
|
return function (constructor: Function) {
|
|
285
|
-
const grpcMethods: string[] = ["getMe", "createUser"];
|
|
395
|
+
const grpcMethods: string[] = ["getMe", "createUser", "patchUser"];
|
|
286
396
|
for (const method of grpcMethods) {
|
|
287
397
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
288
398
|
GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
package/proto/users.proto
CHANGED
|
@@ -4,7 +4,9 @@ package users.v1;
|
|
|
4
4
|
|
|
5
5
|
service UsersService {
|
|
6
6
|
rpc GetMe (GetMeRequest) returns (GetMeResponse);
|
|
7
|
+
|
|
7
8
|
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
|
|
9
|
+
rpc PatchUser (PatchUserRequest) returns (PatchUserResponse);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
message GetMeRequest {
|
|
@@ -23,6 +25,17 @@ message CreateUserResponse {
|
|
|
23
25
|
bool ok = 1;
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
message PatchUserRequest {
|
|
29
|
+
string user_id = 1;
|
|
30
|
+
|
|
31
|
+
optional string name = 2;
|
|
32
|
+
optional string avatar = 3;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message PatchUserResponse {
|
|
36
|
+
bool ok = 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
message User {
|
|
27
40
|
string id = 1;
|
|
28
41
|
optional string name = 2;
|