1
0
mirror of https://github.com/hexolan/stocklet.git synced 2026-08-25 13:04:38 +01:00
Files
stocklet/schema/protobufs/stocklet/user/v1/service.proto
T
hexolan c0d57da2be chore: format buf
Signed-off-by: Declan Teevan <dt@hexolan.com>
2026-08-19 09:45:19 +01:00

87 lines
2.3 KiB
Protocol Buffer

// Copyright (C) 2024 Declan Teevan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
syntax = "proto3";
package stocklet.user.v1;
import "buf/validate/validate.proto";
import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "stocklet/common/v1/requests.proto";
import "stocklet/user/v1/types.proto";
option go_package = "github.com/hexolan/stocklet/internal/pkg/protogen/user/v1;user_v1";
service UserService {
// View information about the service.
//
// buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
rpc ServiceInfo(stocklet.common.v1.ServiceInfoRequest) returns (stocklet.common.v1.ServiceInfoResponse) {
option (google.api.http) = {get: "/v1/user/service"};
}
rpc ViewUser(ViewUserRequest) returns (ViewUserResponse) {
option (google.api.http) = {get: "/v1/user/users/{id}"};
}
rpc RegisterUser(RegisterUserRequest) returns (RegisterUserResponse) {
option (google.api.http) = {post: "/v1/user/register"};
}
}
message ViewUserRequest {
string id = 1 [(buf.validate.field).string.min_len = 1];
}
message ViewUserResponse {
User user = 1;
}
message RegisterUserRequest {
string first_name = 1 [
(google.api.field_behavior) = REQUIRED,
(buf.validate.field).string = {
min_len: 1
max_len: 35
}
];
string last_name = 2 [
(google.api.field_behavior) = REQUIRED,
(buf.validate.field).string = {
min_len: 1
max_len: 35
}
];
string email = 3 [
(google.api.field_behavior) = REQUIRED,
(buf.validate.field).string.email = true
];
string password = 4 [
(google.api.field_behavior) = REQUIRED,
(buf.validate.field).string = {
min_len: 1
max_len: 64
}
];
}
message RegisterUserResponse {
User user = 1;
}