@meocinema/contracts 1.0.6 → 1.0.9
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/account.ts +303 -0
- package/gen/auth.ts +151 -0
- package/package.json +1 -1
- package/proto/account.proto +27 -0
- package/proto/auth.proto +10 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
package/gen/account.ts
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v6.33.2
|
|
5
|
+
// source: account.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "account.v1";
|
|
11
|
+
|
|
12
|
+
export enum Role {
|
|
13
|
+
USER = 0,
|
|
14
|
+
ADMIN = 1,
|
|
15
|
+
UNRECOGNIZED = -1,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function roleFromJSON(object: any): Role {
|
|
19
|
+
switch (object) {
|
|
20
|
+
case 0:
|
|
21
|
+
case "USER":
|
|
22
|
+
return Role.USER;
|
|
23
|
+
case 1:
|
|
24
|
+
case "ADMIN":
|
|
25
|
+
return Role.ADMIN;
|
|
26
|
+
case -1:
|
|
27
|
+
case "UNRECOGNIZED":
|
|
28
|
+
default:
|
|
29
|
+
return Role.UNRECOGNIZED;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function roleToJSON(object: Role): string {
|
|
34
|
+
switch (object) {
|
|
35
|
+
case Role.USER:
|
|
36
|
+
return "USER";
|
|
37
|
+
case Role.ADMIN:
|
|
38
|
+
return "ADMIN";
|
|
39
|
+
case Role.UNRECOGNIZED:
|
|
40
|
+
default:
|
|
41
|
+
return "UNRECOGNIZED";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface GetAccountRequest {
|
|
46
|
+
id: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface GetAccountResponse {
|
|
50
|
+
id: string;
|
|
51
|
+
phone: string;
|
|
52
|
+
email: string;
|
|
53
|
+
isPhoneVerified: boolean;
|
|
54
|
+
isEmailVerified: boolean;
|
|
55
|
+
role: Role;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function createBaseGetAccountRequest(): GetAccountRequest {
|
|
59
|
+
return { id: "" };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const GetAccountRequest: MessageFns<GetAccountRequest> = {
|
|
63
|
+
encode(message: GetAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
64
|
+
if (message.id !== "") {
|
|
65
|
+
writer.uint32(10).string(message.id);
|
|
66
|
+
}
|
|
67
|
+
return writer;
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetAccountRequest {
|
|
71
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
72
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
73
|
+
const message = createBaseGetAccountRequest();
|
|
74
|
+
while (reader.pos < end) {
|
|
75
|
+
const tag = reader.uint32();
|
|
76
|
+
switch (tag >>> 3) {
|
|
77
|
+
case 1: {
|
|
78
|
+
if (tag !== 10) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
message.id = reader.string();
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
reader.skip(tag & 7);
|
|
90
|
+
}
|
|
91
|
+
return message;
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
fromJSON(object: any): GetAccountRequest {
|
|
95
|
+
return { id: isSet(object.id) ? globalThis.String(object.id) : "" };
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
toJSON(message: GetAccountRequest): unknown {
|
|
99
|
+
const obj: any = {};
|
|
100
|
+
if (message.id !== "") {
|
|
101
|
+
obj.id = message.id;
|
|
102
|
+
}
|
|
103
|
+
return obj;
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
create<I extends Exact<DeepPartial<GetAccountRequest>, I>>(base?: I): GetAccountRequest {
|
|
107
|
+
return GetAccountRequest.fromPartial(base ?? ({} as any));
|
|
108
|
+
},
|
|
109
|
+
fromPartial<I extends Exact<DeepPartial<GetAccountRequest>, I>>(object: I): GetAccountRequest {
|
|
110
|
+
const message = createBaseGetAccountRequest();
|
|
111
|
+
message.id = object.id ?? "";
|
|
112
|
+
return message;
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function createBaseGetAccountResponse(): GetAccountResponse {
|
|
117
|
+
return { id: "", phone: "", email: "", isPhoneVerified: false, isEmailVerified: false, role: 0 };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const GetAccountResponse: MessageFns<GetAccountResponse> = {
|
|
121
|
+
encode(message: GetAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
122
|
+
if (message.id !== "") {
|
|
123
|
+
writer.uint32(10).string(message.id);
|
|
124
|
+
}
|
|
125
|
+
if (message.phone !== "") {
|
|
126
|
+
writer.uint32(18).string(message.phone);
|
|
127
|
+
}
|
|
128
|
+
if (message.email !== "") {
|
|
129
|
+
writer.uint32(26).string(message.email);
|
|
130
|
+
}
|
|
131
|
+
if (message.isPhoneVerified !== false) {
|
|
132
|
+
writer.uint32(32).bool(message.isPhoneVerified);
|
|
133
|
+
}
|
|
134
|
+
if (message.isEmailVerified !== false) {
|
|
135
|
+
writer.uint32(40).bool(message.isEmailVerified);
|
|
136
|
+
}
|
|
137
|
+
if (message.role !== 0) {
|
|
138
|
+
writer.uint32(48).int32(message.role);
|
|
139
|
+
}
|
|
140
|
+
return writer;
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetAccountResponse {
|
|
144
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
145
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
146
|
+
const message = createBaseGetAccountResponse();
|
|
147
|
+
while (reader.pos < end) {
|
|
148
|
+
const tag = reader.uint32();
|
|
149
|
+
switch (tag >>> 3) {
|
|
150
|
+
case 1: {
|
|
151
|
+
if (tag !== 10) {
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
message.id = reader.string();
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
case 2: {
|
|
159
|
+
if (tag !== 18) {
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
message.phone = reader.string();
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
case 3: {
|
|
167
|
+
if (tag !== 26) {
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
message.email = reader.string();
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
case 4: {
|
|
175
|
+
if (tag !== 32) {
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
message.isPhoneVerified = reader.bool();
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
case 5: {
|
|
183
|
+
if (tag !== 40) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
message.isEmailVerified = reader.bool();
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
case 6: {
|
|
191
|
+
if (tag !== 48) {
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
message.role = reader.int32() as any;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
reader.skip(tag & 7);
|
|
203
|
+
}
|
|
204
|
+
return message;
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
fromJSON(object: any): GetAccountResponse {
|
|
208
|
+
return {
|
|
209
|
+
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
|
210
|
+
phone: isSet(object.phone) ? globalThis.String(object.phone) : "",
|
|
211
|
+
email: isSet(object.email) ? globalThis.String(object.email) : "",
|
|
212
|
+
isPhoneVerified: isSet(object.isPhoneVerified) ? globalThis.Boolean(object.isPhoneVerified) : false,
|
|
213
|
+
isEmailVerified: isSet(object.isEmailVerified) ? globalThis.Boolean(object.isEmailVerified) : false,
|
|
214
|
+
role: isSet(object.role) ? roleFromJSON(object.role) : 0,
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
toJSON(message: GetAccountResponse): unknown {
|
|
219
|
+
const obj: any = {};
|
|
220
|
+
if (message.id !== "") {
|
|
221
|
+
obj.id = message.id;
|
|
222
|
+
}
|
|
223
|
+
if (message.phone !== "") {
|
|
224
|
+
obj.phone = message.phone;
|
|
225
|
+
}
|
|
226
|
+
if (message.email !== "") {
|
|
227
|
+
obj.email = message.email;
|
|
228
|
+
}
|
|
229
|
+
if (message.isPhoneVerified !== false) {
|
|
230
|
+
obj.isPhoneVerified = message.isPhoneVerified;
|
|
231
|
+
}
|
|
232
|
+
if (message.isEmailVerified !== false) {
|
|
233
|
+
obj.isEmailVerified = message.isEmailVerified;
|
|
234
|
+
}
|
|
235
|
+
if (message.role !== 0) {
|
|
236
|
+
obj.role = roleToJSON(message.role);
|
|
237
|
+
}
|
|
238
|
+
return obj;
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
create<I extends Exact<DeepPartial<GetAccountResponse>, I>>(base?: I): GetAccountResponse {
|
|
242
|
+
return GetAccountResponse.fromPartial(base ?? ({} as any));
|
|
243
|
+
},
|
|
244
|
+
fromPartial<I extends Exact<DeepPartial<GetAccountResponse>, I>>(object: I): GetAccountResponse {
|
|
245
|
+
const message = createBaseGetAccountResponse();
|
|
246
|
+
message.id = object.id ?? "";
|
|
247
|
+
message.phone = object.phone ?? "";
|
|
248
|
+
message.email = object.email ?? "";
|
|
249
|
+
message.isPhoneVerified = object.isPhoneVerified ?? false;
|
|
250
|
+
message.isEmailVerified = object.isEmailVerified ?? false;
|
|
251
|
+
message.role = object.role ?? 0;
|
|
252
|
+
return message;
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export interface AccountService {
|
|
257
|
+
GetAccount(request: GetAccountRequest): Promise<GetAccountResponse>;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export const AccountServiceServiceName = "account.v1.AccountService";
|
|
261
|
+
export class AccountServiceClientImpl implements AccountService {
|
|
262
|
+
private readonly rpc: Rpc;
|
|
263
|
+
private readonly service: string;
|
|
264
|
+
constructor(rpc: Rpc, opts?: { service?: string }) {
|
|
265
|
+
this.service = opts?.service || AccountServiceServiceName;
|
|
266
|
+
this.rpc = rpc;
|
|
267
|
+
this.GetAccount = this.GetAccount.bind(this);
|
|
268
|
+
}
|
|
269
|
+
GetAccount(request: GetAccountRequest): Promise<GetAccountResponse> {
|
|
270
|
+
const data = GetAccountRequest.encode(request).finish();
|
|
271
|
+
const promise = this.rpc.request(this.service, "GetAccount", data);
|
|
272
|
+
return promise.then((data) => GetAccountResponse.decode(new BinaryReader(data)));
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
interface Rpc {
|
|
277
|
+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
281
|
+
|
|
282
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
283
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
284
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
285
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
286
|
+
: Partial<T>;
|
|
287
|
+
|
|
288
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
289
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
290
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
291
|
+
|
|
292
|
+
function isSet(value: any): boolean {
|
|
293
|
+
return value !== null && value !== undefined;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface MessageFns<T> {
|
|
297
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
298
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
299
|
+
fromJSON(object: any): T;
|
|
300
|
+
toJSON(message: T): unknown;
|
|
301
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
302
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
303
|
+
}
|
package/gen/auth.ts
CHANGED
|
@@ -29,6 +29,15 @@ export interface VerifyOtpResponse {
|
|
|
29
29
|
refreshToken: string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export interface RefreshRequest {
|
|
33
|
+
refreshToken: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface RefreshResponse {
|
|
37
|
+
accessToken: string;
|
|
38
|
+
refreshToken: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
function createBaseSendOtpRequest(): SendOtpRequest {
|
|
33
42
|
return { identifier: "", type: "" };
|
|
34
43
|
}
|
|
@@ -331,9 +340,144 @@ export const VerifyOtpResponse: MessageFns<VerifyOtpResponse> = {
|
|
|
331
340
|
},
|
|
332
341
|
};
|
|
333
342
|
|
|
343
|
+
function createBaseRefreshRequest(): RefreshRequest {
|
|
344
|
+
return { refreshToken: "" };
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export const RefreshRequest: MessageFns<RefreshRequest> = {
|
|
348
|
+
encode(message: RefreshRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
349
|
+
if (message.refreshToken !== "") {
|
|
350
|
+
writer.uint32(10).string(message.refreshToken);
|
|
351
|
+
}
|
|
352
|
+
return writer;
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
decode(input: BinaryReader | Uint8Array, length?: number): RefreshRequest {
|
|
356
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
357
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
358
|
+
const message = createBaseRefreshRequest();
|
|
359
|
+
while (reader.pos < end) {
|
|
360
|
+
const tag = reader.uint32();
|
|
361
|
+
switch (tag >>> 3) {
|
|
362
|
+
case 1: {
|
|
363
|
+
if (tag !== 10) {
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
message.refreshToken = reader.string();
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
reader.skip(tag & 7);
|
|
375
|
+
}
|
|
376
|
+
return message;
|
|
377
|
+
},
|
|
378
|
+
|
|
379
|
+
fromJSON(object: any): RefreshRequest {
|
|
380
|
+
return { refreshToken: isSet(object.refreshToken) ? globalThis.String(object.refreshToken) : "" };
|
|
381
|
+
},
|
|
382
|
+
|
|
383
|
+
toJSON(message: RefreshRequest): unknown {
|
|
384
|
+
const obj: any = {};
|
|
385
|
+
if (message.refreshToken !== "") {
|
|
386
|
+
obj.refreshToken = message.refreshToken;
|
|
387
|
+
}
|
|
388
|
+
return obj;
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
create<I extends Exact<DeepPartial<RefreshRequest>, I>>(base?: I): RefreshRequest {
|
|
392
|
+
return RefreshRequest.fromPartial(base ?? ({} as any));
|
|
393
|
+
},
|
|
394
|
+
fromPartial<I extends Exact<DeepPartial<RefreshRequest>, I>>(object: I): RefreshRequest {
|
|
395
|
+
const message = createBaseRefreshRequest();
|
|
396
|
+
message.refreshToken = object.refreshToken ?? "";
|
|
397
|
+
return message;
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
function createBaseRefreshResponse(): RefreshResponse {
|
|
402
|
+
return { accessToken: "", refreshToken: "" };
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export const RefreshResponse: MessageFns<RefreshResponse> = {
|
|
406
|
+
encode(message: RefreshResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
407
|
+
if (message.accessToken !== "") {
|
|
408
|
+
writer.uint32(10).string(message.accessToken);
|
|
409
|
+
}
|
|
410
|
+
if (message.refreshToken !== "") {
|
|
411
|
+
writer.uint32(18).string(message.refreshToken);
|
|
412
|
+
}
|
|
413
|
+
return writer;
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
decode(input: BinaryReader | Uint8Array, length?: number): RefreshResponse {
|
|
417
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
418
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
419
|
+
const message = createBaseRefreshResponse();
|
|
420
|
+
while (reader.pos < end) {
|
|
421
|
+
const tag = reader.uint32();
|
|
422
|
+
switch (tag >>> 3) {
|
|
423
|
+
case 1: {
|
|
424
|
+
if (tag !== 10) {
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
message.accessToken = reader.string();
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
case 2: {
|
|
432
|
+
if (tag !== 18) {
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
message.refreshToken = reader.string();
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
reader.skip(tag & 7);
|
|
444
|
+
}
|
|
445
|
+
return message;
|
|
446
|
+
},
|
|
447
|
+
|
|
448
|
+
fromJSON(object: any): RefreshResponse {
|
|
449
|
+
return {
|
|
450
|
+
accessToken: isSet(object.accessToken) ? globalThis.String(object.accessToken) : "",
|
|
451
|
+
refreshToken: isSet(object.refreshToken) ? globalThis.String(object.refreshToken) : "",
|
|
452
|
+
};
|
|
453
|
+
},
|
|
454
|
+
|
|
455
|
+
toJSON(message: RefreshResponse): unknown {
|
|
456
|
+
const obj: any = {};
|
|
457
|
+
if (message.accessToken !== "") {
|
|
458
|
+
obj.accessToken = message.accessToken;
|
|
459
|
+
}
|
|
460
|
+
if (message.refreshToken !== "") {
|
|
461
|
+
obj.refreshToken = message.refreshToken;
|
|
462
|
+
}
|
|
463
|
+
return obj;
|
|
464
|
+
},
|
|
465
|
+
|
|
466
|
+
create<I extends Exact<DeepPartial<RefreshResponse>, I>>(base?: I): RefreshResponse {
|
|
467
|
+
return RefreshResponse.fromPartial(base ?? ({} as any));
|
|
468
|
+
},
|
|
469
|
+
fromPartial<I extends Exact<DeepPartial<RefreshResponse>, I>>(object: I): RefreshResponse {
|
|
470
|
+
const message = createBaseRefreshResponse();
|
|
471
|
+
message.accessToken = object.accessToken ?? "";
|
|
472
|
+
message.refreshToken = object.refreshToken ?? "";
|
|
473
|
+
return message;
|
|
474
|
+
},
|
|
475
|
+
};
|
|
476
|
+
|
|
334
477
|
export interface AuthService {
|
|
335
478
|
SendOtp(request: SendOtpRequest): Promise<SendOtpResponse>;
|
|
336
479
|
VerifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse>;
|
|
480
|
+
Refresh(request: RefreshRequest): Promise<RefreshResponse>;
|
|
337
481
|
}
|
|
338
482
|
|
|
339
483
|
export const AuthServiceServiceName = "auth.v1.AuthService";
|
|
@@ -345,6 +489,7 @@ export class AuthServiceClientImpl implements AuthService {
|
|
|
345
489
|
this.rpc = rpc;
|
|
346
490
|
this.SendOtp = this.SendOtp.bind(this);
|
|
347
491
|
this.VerifyOtp = this.VerifyOtp.bind(this);
|
|
492
|
+
this.Refresh = this.Refresh.bind(this);
|
|
348
493
|
}
|
|
349
494
|
SendOtp(request: SendOtpRequest): Promise<SendOtpResponse> {
|
|
350
495
|
const data = SendOtpRequest.encode(request).finish();
|
|
@@ -357,6 +502,12 @@ export class AuthServiceClientImpl implements AuthService {
|
|
|
357
502
|
const promise = this.rpc.request(this.service, "VerifyOtp", data);
|
|
358
503
|
return promise.then((data) => VerifyOtpResponse.decode(new BinaryReader(data)));
|
|
359
504
|
}
|
|
505
|
+
|
|
506
|
+
Refresh(request: RefreshRequest): Promise<RefreshResponse> {
|
|
507
|
+
const data = RefreshRequest.encode(request).finish();
|
|
508
|
+
const promise = this.rpc.request(this.service, "Refresh", data);
|
|
509
|
+
return promise.then((data) => RefreshResponse.decode(new BinaryReader(data)));
|
|
510
|
+
}
|
|
360
511
|
}
|
|
361
512
|
|
|
362
513
|
interface Rpc {
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package account.v1;
|
|
4
|
+
|
|
5
|
+
service AccountService {
|
|
6
|
+
rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
message GetAccountRequest {
|
|
10
|
+
string id = 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
message GetAccountResponse {
|
|
14
|
+
string id = 1;
|
|
15
|
+
string phone = 2;
|
|
16
|
+
string email = 3;
|
|
17
|
+
|
|
18
|
+
bool is_phone_verified = 4;
|
|
19
|
+
bool is_email_verified = 5;
|
|
20
|
+
|
|
21
|
+
Role role = 6;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
enum Role {
|
|
25
|
+
USER = 0;
|
|
26
|
+
ADMIN = 1;
|
|
27
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -5,6 +5,7 @@ package auth.v1;
|
|
|
5
5
|
service AuthService {
|
|
6
6
|
rpc SendOtp(SendOtpRequest) returns (SendOtpResponse);
|
|
7
7
|
rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
8
|
+
rpc Refresh(RefreshRequest) returns (RefreshResponse);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
message SendOtpRequest {
|
|
@@ -25,4 +26,13 @@ message VerifyOtpRequest {
|
|
|
25
26
|
message VerifyOtpResponse {
|
|
26
27
|
string access_token = 1;
|
|
27
28
|
string refresh_token = 2;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message RefreshRequest {
|
|
32
|
+
string refresh_token = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message RefreshResponse {
|
|
36
|
+
string access_token = 1;
|
|
37
|
+
string refresh_token = 2;
|
|
28
38
|
}
|