@lumina-cinema/contracts 1.1.3 → 1.1.5

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.
@@ -1,69 +1,126 @@
1
+ // Account service messages and RPCs.
2
+ //
3
+ // This file defines APIs for retrieving account data and for performing
4
+ // email and phone change flows which typically involve an initialization
5
+ // step (send confirmation code) and a confirmation step (verify code).
6
+
1
7
  syntax = "proto3";
2
8
 
3
9
  package account.v1;
4
10
 
11
+ // AccountService exposes methods to read account information and
12
+ // to manage verification flows when changing email or phone.
5
13
  service AccountService {
14
+ // Retrieves account details by identifier.
6
15
  rpc GetAccount(GetAccountRequest) returns (GetAccountResponse);
7
16
 
17
+ // Starts the email change flow (sends a verification code to the new email).
8
18
  rpc InitEmailChange(InitEmailChangeRequest) returns (InitEmailChangeResponse);
19
+
20
+ // Confirms the email change using a verification code.
9
21
  rpc ConfirmEmailChange(ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
10
22
 
23
+ // Starts the phone change flow (sends a verification code to the new phone).
11
24
  rpc InitPhoneChange(InitPhoneChangeRequest) returns (InitPhoneChangeResponse);
25
+
26
+ // Confirms the phone change using a verification code.
12
27
  rpc ConfirmPhoneChange(ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponse);
13
28
  }
14
29
 
30
+ // Request to get account details for a specific user.
15
31
  message GetAccountRequest {
32
+ // The account's user identifier.
16
33
  string id = 1;
17
34
  }
18
35
 
36
+ // Response containing basic account attributes and verification flags.
19
37
  message GetAccountResponse {
38
+ // User identifier.
20
39
  string id = 1;
40
+
41
+ // Account phone number (if any).
21
42
  string phone = 2;
43
+
44
+ // Account email address (if any).
22
45
  string email = 3;
46
+
47
+ // Whether the phone number has been verified.
23
48
  bool is_phone_verified = 4;
49
+
50
+ // Whether the email address has been verified.
24
51
  bool is_email_verified = 5;
52
+
53
+ // Account role (e.g. USER, ADMIN).
25
54
  Role role = 6;
26
55
  }
27
56
 
57
+ // Request to initialize an email change flow.
28
58
  message InitEmailChangeRequest {
59
+ // New email address to set.
29
60
  string email = 1;
61
+
62
+ // User identifier for whom the change is requested.
30
63
  string user_id = 2;
31
64
  }
32
65
 
66
+ // Response for InitEmailChange indicating whether the initialization succeeded.
33
67
  message InitEmailChangeResponse {
34
68
  bool ok = 1;
35
69
  }
36
70
 
71
+ // Request to confirm an email change with a verification code.
37
72
  message ConfirmEmailChangeRequest {
73
+ // The email address being confirmed.
38
74
  string email = 1;
75
+
76
+ // Verification code sent to the email.
39
77
  string code = 2;
78
+
79
+ // Target user id for the email change.
40
80
  string user_id = 3;
41
81
  }
42
82
 
83
+ // Response for ConfirmEmailChange indicating success.
43
84
  message ConfirmEmailChangeResponse {
44
85
  bool ok = 1;
45
86
  }
46
87
 
88
+ // Request to initialize a phone change flow.
47
89
  message InitPhoneChangeRequest {
90
+ // New phone number to set (E.164 recommended).
48
91
  string phone = 1;
92
+
93
+ // User identifier for whom the change is requested.
49
94
  string user_id = 2;
50
95
  }
51
96
 
97
+ // Response for InitPhoneChange indicating whether the initialization succeeded.
52
98
  message InitPhoneChangeResponse {
53
99
  bool ok = 1;
54
100
  }
55
101
 
102
+ // Request to confirm a phone change with a verification code.
56
103
  message ConfirmPhoneChangeRequest {
104
+ // The phone number being confirmed.
57
105
  string phone = 1;
106
+
107
+ // Verification code sent to the phone.
58
108
  string code = 2;
109
+
110
+ // Target user id for the phone change.
59
111
  string user_id = 3;
60
112
  }
61
113
 
114
+ // Response for ConfirmPhoneChange indicating success.
62
115
  message ConfirmPhoneChangeResponse {
63
116
  bool ok = 1;
64
117
  }
65
118
 
119
+ // Account roles enumerations.
66
120
  enum Role {
121
+ // Regular user account.
67
122
  USER = 0;
123
+
124
+ // Administrator account with elevated privileges.
68
125
  ADMIN = 1;
69
126
  }
package/proto/auth.proto CHANGED
@@ -1,105 +1,127 @@
1
+ // Authentication service APIs and messages.
2
+ //
3
+ // This file defines RPCs and messages used by the AuthService to handle
4
+ // short-lived one-time-password (OTP) flows, token issuance and refresh,
5
+ // and integrations for Telegram-based login. Messages include both
6
+ // requests and responses as well as small helper structures used by the
7
+ // Telegram flow.
8
+
1
9
  syntax = "proto3";
2
10
 
3
11
  package auth.v1;
4
12
 
5
13
  import "google/protobuf/empty.proto";
6
14
 
15
+ // AuthService provides authentication-related operations such as sending
16
+ // and verifying OTPs, issuing and refreshing tokens, and handling the
17
+ // Telegram login flow.
7
18
  service AuthService {
8
- // Sends a one-time password (OTP) to the specified identifier (email/phone).
9
- // The identifier format and delivery channel are defined by `type`.
19
+ // Sends a one-time password (OTP) to the given identifier.
20
+ // The identifier typically represents either a phone number or an email
21
+ // address and `type` indicates which delivery channel to use.
10
22
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
11
23
 
12
- // Verifies the OTP provided by the user.
13
- // On success returns a new access/refresh token pair.
24
+ // Verifies the one-time password provided by a client. On success the
25
+ // service issues a new access and refresh token pair for the authenticated user.
14
26
  rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
15
27
 
16
- // Exchanges a valid refresh token for a new access/refresh token pair.
28
+ // Exchanges a refresh token for a new access/refresh token pair. The
29
+ // service may rotate refresh tokens depending on policy.
17
30
  rpc Refresh(RefreshRequest) returns (RefreshResponse);
18
31
 
19
- // Initializes Telegram login flow and returns a Telegram authorization URL.
32
+ // Starts the Telegram login flow and returns an authorization URL that
33
+ // the client should open to continue the flow in Telegram.
20
34
  rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
21
35
 
22
- // Verifies Telegram login payload (signature + auth_date) and starts/continues the flow.
23
- // Depending on the user state, may return tokens immediately or a bot deep link to complete signup.
36
+ // Validates the Telegram login payload (signature and auth_date) and
37
+ // progresses the login flow. Depending on the account state this RPC
38
+ // may return immediate tokens or a bot deep link instructing the user
39
+ // how to complete signup.
24
40
  rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
25
41
 
26
- // Completes Telegram login flow by binding a phone number to the Telegram session.
42
+ // Completes Telegram-based login by binding additional data (for example,
43
+ // a phone number) to a previously started Telegram session.
27
44
  rpc TelegramComplete (TelegramCompleteRequest) returns (TelegramCompleteResponse);
28
45
 
29
- // Consumes a completed Telegram session and returns access/refresh tokens.
30
- // Intended to be called once per session_id.
46
+ // Consumes a completed Telegram session and issues an access/refresh
47
+ // token pair. This endpoint should be called once per session identifier.
31
48
  rpc TelegramConsume (TelegramConsumeRequest) returns (TelegramConsumeResponse);
32
49
  }
33
50
 
34
- // Request to send an OTP to an identifier (email/phone).
51
+ // Request to send an OTP to an identifier (email or phone).
35
52
  message SendOtpRequest {
36
- // Target identifier to deliver OTP to (e.g. "+31612345678" or "user@example.com").
53
+ // Target identifier to deliver the OTP (for example "+31612345678" or
54
+ // "user@example.com").
37
55
  string identifier = 1;
38
56
 
39
- // Identifier/delivery type. Recommended values: "phone" or "email".
57
+ // Delivery type for the identifier: commonly "phone" or "email".
40
58
  string type = 2;
41
59
  }
42
60
 
43
- // Send OTP result.
61
+ // Response for SendOtp request.
44
62
  message SendOtpResponse {
45
- // True if the OTP was accepted for delivery (does not necessarily guarantee delivery).
63
+ // True when the OTP request was accepted for delivery. This does not
64
+ // guarantee that the recipient has received the message.
46
65
  bool ok = 1;
47
66
  }
48
67
 
49
- // Request to verify an OTP for an identifier.
68
+ // Request to verify an OTP code for a previously targeted identifier.
50
69
  message VerifyOtpRequest {
51
- // Identifier that received the OTP (must match the identifier used in SendOtp).
70
+ // Identifier that originally received the OTP (must match SendOtp identifier).
52
71
  string identifier = 1;
53
72
 
54
- // Identifier type used for delivery. Recommended values: "phone" or "email".
73
+ // Delivery type used when sending the OTP: "phone" or "email".
55
74
  string type = 2;
56
75
 
57
- // OTP code entered by the user.
76
+ // OTP code provided by the client.
58
77
  string code = 3;
59
78
  }
60
79
 
61
- // Successful OTP verification response.
80
+ // Response returned when an OTP was successfully verified.
62
81
  message VerifyOtpResponse {
63
- // Short-lived access token.
82
+ // Short-lived access token to authenticate future requests.
64
83
  string access_token = 1;
65
84
 
66
85
  // Long-lived refresh token used to obtain new access tokens.
67
86
  string refresh_token = 2;
68
87
  }
69
88
 
70
- // Request to refresh tokens.
89
+ // Request to refresh an access token using a refresh token.
71
90
  message RefreshRequest {
72
- // Refresh token previously issued by the service.
91
+ // The refresh token previously issued to the client.
73
92
  string refresh_token = 1;
74
93
  }
75
94
 
76
- // Response containing a new token pair.
95
+ // Response containing a newly issued token pair.
77
96
  message RefreshResponse {
78
- // New access token.
97
+ // Newly issued access token.
79
98
  string access_token = 1;
80
99
 
81
- // New refresh token (may be rotated on each refresh).
100
+ // Newly issued refresh token (may be rotated).
82
101
  string refresh_token = 2;
83
102
  }
84
103
 
85
- // Telegram initialization response.
104
+ // Response for Telegram initialization, containing an authorization URL.
86
105
  message TelegramInitResponse {
87
- // Telegram OAuth authorization URL to open in the client.
106
+ // HTTPS URL that the client should open for Telegram authorization.
88
107
  string url = 1;
89
108
  }
90
109
 
91
- // Telegram verification request.
110
+ // Request carrying raw Telegram query parameters returned by Telegram
111
+ // during OAuth-style authentication. The service validates signature
112
+ // and freshness of the parameters.
92
113
  message TelegramVerifyRequest {
93
114
  // Raw query parameters returned by Telegram (must include `hash` and `auth_date`).
94
- // The service validates signature and freshness.
95
115
  map<string, string> query = 1;
96
116
  }
97
117
 
98
- // Telegram verification result.
99
- // The response depends on whether the account is fully linked.
118
+ // Result of Telegram verification. The oneof allows returning either a
119
+ // deep link instructing the client to continue the flow, or tokens when
120
+ // login can be completed immediately.
100
121
  message TelegramVerifyResponse {
101
122
  oneof result {
102
- // Bot deep link to continue/complete the flow (e.g. provide phone, confirm consent).
123
+ // Bot deep link URL to continue or complete the flow (for example
124
+ // to provide a phone number or confirm consent).
103
125
  string url = 1;
104
126
 
105
127
  // Access token issued when Telegram login can be completed immediately.
@@ -110,32 +132,33 @@ message TelegramVerifyResponse {
110
132
  }
111
133
  }
112
134
 
113
- // Request to complete Telegram login by providing additional data.
135
+ // Request to complete a Telegram login by supplying additional required data.
114
136
  message TelegramCompleteRequest {
115
- // Telegram session identifier obtained from the bot deep link.
137
+ // Session identifier created and returned by the Telegram bot flow.
116
138
  string session_id = 1;
117
139
 
118
- // Phone number to bind to the Telegram session (recommended E.164 format).
140
+ // Optional phone number to bind to the Telegram session (E.164 recommended).
119
141
  string phone = 2;
120
142
  }
121
143
 
122
- // Telegram completion response.
144
+ // Response returned after completing a Telegram session; the client can
145
+ // use the session id to exchange it for tokens.
123
146
  message TelegramCompleteResponse {
124
- // Session identifier that can be consumed to exchange for tokens.
147
+ // Session identifier that can be consumed to obtain tokens.
125
148
  string session_id = 1;
126
149
  }
127
150
 
128
- // Request to exchange a completed Telegram session for tokens.
151
+ // Request to exchange a completed Telegram session for token pair.
129
152
  message TelegramConsumeRequest {
130
- // Session identifier from TelegramCompleteResponse.
153
+ // Session identifier previously returned from TelegramCompleteResponse.
131
154
  string session_id = 1;
132
155
  }
133
156
 
134
- // Token pair returned after consuming a Telegram session.
157
+ // Token pair returned when consuming a Telegram session.
135
158
  message TelegramConsumeResponse {
136
- // Access token.
159
+ // Access token for authenticated requests.
137
160
  string access_token = 1;
138
161
 
139
- // Refresh token.
162
+ // Refresh token to obtain new access tokens.
140
163
  string refresh_token = 2;
141
- }
164
+ }
@@ -0,0 +1,42 @@
1
+ syntax = "proto3";
2
+
3
+ package media.v1;
4
+
5
+ option go_package = 'github.com/lumina-cinema/contracts/media;media';
6
+ option java_multiple_files = true;
7
+
8
+ service MediaService {
9
+ rpc Upload (UploadRequest) returns (UploadResponse);
10
+ rpc Get (GetRequest) returns (GetResponse);
11
+ rpc Delete (DeleteRequest) returns (DeleteResponse);
12
+ }
13
+
14
+ message UploadRequest {
15
+ string file_name = 1;
16
+ string folder = 2;
17
+ string content_type = 3;
18
+ bytes data = 4;
19
+ optional int32 resize_width = 5;
20
+ optional int32 resize_height = 6;
21
+ }
22
+
23
+ message UploadResponse {
24
+ string key = 1;
25
+ }
26
+
27
+ message GetRequest {
28
+ string key = 1;
29
+ }
30
+
31
+ message GetResponse {
32
+ bytes data = 1;
33
+ string content_type = 2;
34
+ }
35
+
36
+ message DeleteRequest {
37
+ string key = 1;
38
+ }
39
+
40
+ message DeleteResponse {
41
+ bool ok = 1;
42
+ }
package/proto/users.proto CHANGED
@@ -1,33 +1,81 @@
1
+ // User management service and related messages.
2
+ //
3
+ // This file defines simple user-related RPCs used to retrieve the
4
+ // currently authenticated user's profile, create a lightweight user
5
+ // record, and update basic profile fields.
6
+
1
7
  syntax = "proto3";
2
8
 
3
9
  package users.v1;
4
10
 
11
+ // UsersService exposes endpoints for basic user profile operations.
5
12
  service UsersService {
13
+ // Retrieves the profile of the current user.
6
14
  rpc GetMe (GetMeRequest) returns (GetMeResponse);
7
15
 
16
+ // Creates a new user record using the provided identifier.
8
17
  rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
18
+
19
+ // Partially updates user profile fields such as name and avatar.
20
+ rpc PatchUser (PatchUserRequest) returns (PatchUserResponse);
9
21
  }
10
22
 
23
+ // Request to get the current user's profile.
11
24
  message GetMeRequest {
25
+ // The identifier of the user to fetch (typically from auth token).
12
26
  string id = 1;
13
27
  }
14
28
 
29
+ // Response containing the requested user profile.
15
30
  message GetMeResponse {
31
+ // The user profile.
16
32
  User user = 1;
17
33
  }
18
34
 
35
+ // Request to create a user record.
19
36
  message CreateUserRequest {
37
+ // Unique identifier for the new user (typically assigned by auth).
20
38
  string id = 1;
21
39
  }
22
40
 
41
+ // Response for CreateUser operation.
23
42
  message CreateUserResponse {
43
+ // True when the user was created successfully.
24
44
  bool ok = 1;
25
45
  }
26
46
 
47
+ // Request to update a user partially. Fields left unset are not modified.
48
+ message PatchUserRequest {
49
+ // Target user id to patch.
50
+ string user_id = 1;
51
+
52
+ // Optional new display name for the user.
53
+ optional string name = 2;
54
+
55
+ // Optional new avatar URL.
56
+ optional string avatar = 3;
57
+ }
58
+
59
+ // Response for PatchUser operation.
60
+ message PatchUserResponse {
61
+ // True when the patch operation succeeded.
62
+ bool ok = 1;
63
+ }
64
+
65
+ // User profile representation.
27
66
  message User {
67
+ // Unique user identifier.
28
68
  string id = 1;
69
+
70
+ // Optional display name.
29
71
  optional string name = 2;
30
- optional string phone = 4;
72
+
73
+ // Optional email address associated with the user.
31
74
  optional string email = 3;
75
+
76
+ // Optional phone number (E.164 recommended).
77
+ optional string phone = 4;
78
+
79
+ // Optional avatar image URL.
32
80
  optional string avatar = 5;
33
81
  }