@kottvideo/contracts 1.1.0 → 1.1.2

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/account.ts CHANGED
@@ -29,21 +29,99 @@ export interface GetAccountResponse {
29
29
  role: Role;
30
30
  }
31
31
 
32
+ /** Email change */
33
+ export interface BeginEmailChangeRequest {
34
+ userId: string;
35
+ email: string;
36
+ }
37
+
38
+ export interface BeginEmailChangeResponse {
39
+ ok: boolean;
40
+ }
41
+
42
+ export interface ConfirmEmailChangeRequest {
43
+ userId: string;
44
+ email: string;
45
+ code: string;
46
+ }
47
+
48
+ export interface ConfirmEmailChangeResponse {
49
+ ok: boolean;
50
+ }
51
+
52
+ /** Phone change */
53
+ export interface BeginPhoneChangeRequest {
54
+ userId: string;
55
+ phone: string;
56
+ }
57
+
58
+ export interface BeginPhoneChangeResponse {
59
+ ok: boolean;
60
+ }
61
+
62
+ export interface ConfirmPhoneChangeRequest {
63
+ userId: string;
64
+ phone: string;
65
+ code: string;
66
+ }
67
+
68
+ export interface ConfirmPhoneChangeResponse {
69
+ ok: boolean;
70
+ }
71
+
32
72
  export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
33
73
 
34
74
  export interface AccountServiceClient {
35
75
  getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
76
+
77
+ /** Email change */
78
+
79
+ beginEmailChange(request: BeginEmailChangeRequest): Observable<BeginEmailChangeResponse>;
80
+
81
+ confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
82
+
83
+ /** Phone Change */
84
+
85
+ beginPhoneChange(request: BeginPhoneChangeRequest): Observable<BeginPhoneChangeResponse>;
86
+
87
+ confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponse>;
36
88
  }
37
89
 
38
90
  export interface AccountServiceController {
39
91
  getAccount(
40
92
  request: GetAccountRequest,
41
93
  ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
94
+
95
+ /** Email change */
96
+
97
+ beginEmailChange(
98
+ request: BeginEmailChangeRequest,
99
+ ): Promise<BeginEmailChangeResponse> | Observable<BeginEmailChangeResponse> | BeginEmailChangeResponse;
100
+
101
+ confirmEmailChange(
102
+ request: ConfirmEmailChangeRequest,
103
+ ): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
104
+
105
+ /** Phone Change */
106
+
107
+ beginPhoneChange(
108
+ request: BeginPhoneChangeRequest,
109
+ ): Promise<BeginPhoneChangeResponse> | Observable<BeginPhoneChangeResponse> | BeginPhoneChangeResponse;
110
+
111
+ confirmPhoneChange(
112
+ request: ConfirmPhoneChangeRequest,
113
+ ): Promise<ConfirmPhoneChangeResponse> | Observable<ConfirmPhoneChangeResponse> | ConfirmPhoneChangeResponse;
42
114
  }
43
115
 
44
116
  export function AccountServiceControllerMethods() {
45
117
  return function (constructor: Function) {
46
- const grpcMethods: string[] = ["getAccount"];
118
+ const grpcMethods: string[] = [
119
+ "getAccount",
120
+ "beginEmailChange",
121
+ "confirmEmailChange",
122
+ "beginPhoneChange",
123
+ "confirmPhoneChange",
124
+ ];
47
125
  for (const method of grpcMethods) {
48
126
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
49
127
  GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
package/gen/auth.ts CHANGED
@@ -7,9 +7,11 @@
7
7
  /* eslint-disable */
8
8
  import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
9
  import { Observable } from "rxjs";
10
+ import { Empty } from "./google/protobuf/empty";
10
11
 
11
12
  export const protobufPackage = "auth.v1";
12
13
 
14
+ /** One-time passwords */
13
15
  export interface SendOtpRequest {
14
16
  identifier: string;
15
17
  type: string;
@@ -30,6 +32,7 @@ export interface VerifyOtpResponse {
30
32
  refreshToken: string;
31
33
  }
32
34
 
35
+ /** Authentication tokens */
33
36
  export interface RefreshTokenRequest {
34
37
  refreshToken: string;
35
38
  }
@@ -39,6 +42,26 @@ export interface RefreshTokenResponse {
39
42
  refreshToken: string;
40
43
  }
41
44
 
45
+ /** Telegram authentication */
46
+ export interface TelegramInitResponse {
47
+ url: string;
48
+ }
49
+
50
+ export interface TelegramVerifyRequest {
51
+ query: { [key: string]: string };
52
+ }
53
+
54
+ export interface TelegramVerifyRequest_QueryEntry {
55
+ key: string;
56
+ value: string;
57
+ }
58
+
59
+ export interface TelegramVerifyResponse {
60
+ url?: string | undefined;
61
+ accessToken?: string | undefined;
62
+ refreshToken?: string | undefined;
63
+ }
64
+
42
65
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
43
66
 
44
67
  export interface AuthServiceClient {
@@ -51,6 +74,12 @@ export interface AuthServiceClient {
51
74
  /** Authentication tokens */
52
75
 
53
76
  refreshToken(request: RefreshTokenRequest): Observable<RefreshTokenResponse>;
77
+
78
+ /** Telegram authentication */
79
+
80
+ telegramInit(request: Empty): Observable<TelegramInitResponse>;
81
+
82
+ telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
54
83
  }
55
84
 
56
85
  export interface AuthServiceController {
@@ -65,11 +94,19 @@ export interface AuthServiceController {
65
94
  refreshToken(
66
95
  request: RefreshTokenRequest,
67
96
  ): Promise<RefreshTokenResponse> | Observable<RefreshTokenResponse> | RefreshTokenResponse;
97
+
98
+ /** Telegram authentication */
99
+
100
+ telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
101
+
102
+ telegramVerify(
103
+ request: TelegramVerifyRequest,
104
+ ): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
68
105
  }
69
106
 
70
107
  export function AuthServiceControllerMethods() {
71
108
  return function (constructor: Function) {
72
- const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refreshToken"];
109
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refreshToken", "telegramInit", "telegramVerify"];
73
110
  for (const method of grpcMethods) {
74
111
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
75
112
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -0,0 +1,23 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.0
4
+ // protoc v3.21.12
5
+ // source: google/protobuf/empty.proto
6
+
7
+ /* eslint-disable */
8
+
9
+ export const protobufPackage = "google.protobuf";
10
+
11
+ /**
12
+ * A generic empty message that you can re-use to avoid defining duplicated
13
+ * empty messages in your APIs. A typical example is to use it as the request
14
+ * or the response type of an API method. For instance:
15
+ *
16
+ * service Foo {
17
+ * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
18
+ * }
19
+ */
20
+ export interface Empty {
21
+ }
22
+
23
+ export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kottvideo/contracts",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "gRPC contracts for KottVideo microservices",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -4,6 +4,14 @@ package account.v1;
4
4
 
5
5
  service AccountService {
6
6
  rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
7
+
8
+ // Email change
9
+ rpc BeginEmailChange (BeginEmailChangeRequest) returns (BeginEmailChangeResponse);
10
+ rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
11
+
12
+ // Phone Change
13
+ rpc BeginPhoneChange (BeginPhoneChangeRequest) returns (BeginPhoneChangeResponse);
14
+ rpc ConfirmPhoneChange (ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponse);
7
15
  }
8
16
 
9
17
  message GetAccountRequest {
@@ -19,6 +27,46 @@ message GetAccountResponse {
19
27
  Role role = 6;
20
28
  }
21
29
 
30
+ // Email change
31
+ message BeginEmailChangeRequest {
32
+ string user_id = 1;
33
+ string email = 2;
34
+ }
35
+
36
+ message BeginEmailChangeResponse {
37
+ bool ok = 1;
38
+ }
39
+
40
+ message ConfirmEmailChangeRequest {
41
+ string user_id = 1;
42
+ string email = 2;
43
+ string code = 3;
44
+ }
45
+
46
+ message ConfirmEmailChangeResponse {
47
+ bool ok = 1;
48
+ }
49
+
50
+ // Phone change
51
+ message BeginPhoneChangeRequest {
52
+ string user_id = 1;
53
+ string phone = 2;
54
+ }
55
+
56
+ message BeginPhoneChangeResponse {
57
+ bool ok = 1;
58
+ }
59
+
60
+ message ConfirmPhoneChangeRequest {
61
+ string user_id = 1;
62
+ string phone = 2;
63
+ string code = 3;
64
+ }
65
+
66
+ message ConfirmPhoneChangeResponse {
67
+ bool ok = 1;
68
+ }
69
+
22
70
  enum Role {
23
71
  USER = 0;
24
72
  ADMIN = 1;
package/proto/auth.proto CHANGED
@@ -2,6 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  package auth.v1;
4
4
 
5
+ import "google/protobuf/empty.proto";
6
+
5
7
  service AuthService {
6
8
  // One-time passwords
7
9
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
@@ -9,8 +11,13 @@ service AuthService {
9
11
 
10
12
  // Authentication tokens
11
13
  rpc RefreshToken (RefreshTokenRequest) returns (RefreshTokenResponse);
14
+
15
+ // Telegram authentication
16
+ rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
17
+ rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
12
18
  }
13
19
 
20
+ // One-time passwords
14
21
  message SendOtpRequest {
15
22
  string identifier = 1;
16
23
  string type = 2;
@@ -31,6 +38,7 @@ message VerifyOtpResponse {
31
38
  string refresh_token = 2;
32
39
  }
33
40
 
41
+ // Authentication tokens
34
42
  message RefreshTokenRequest {
35
43
  string refresh_token = 1;
36
44
  }
@@ -39,3 +47,20 @@ message RefreshTokenResponse {
39
47
  string access_token = 1;
40
48
  string refresh_token = 2;
41
49
  }
50
+
51
+ // Telegram authentication
52
+ message TelegramInitResponse {
53
+ string url = 1;
54
+ }
55
+
56
+ message TelegramVerifyRequest {
57
+ map<string, string> query = 1;
58
+ }
59
+
60
+ message TelegramVerifyResponse {
61
+ oneof result {
62
+ string url = 1;
63
+ string access_token = 2;
64
+ string refresh_token = 3;
65
+ }
66
+ }