Skip to content

Commit

Permalink
feat: get user by username
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyjoygh committed Feb 1, 2025
1 parent 45c16f9 commit 57014e3
Show file tree
Hide file tree
Showing 9 changed files with 514 additions and 678 deletions.
24 changes: 10 additions & 14 deletions proto/api/v1/user_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ service UserService {
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {
option (google.api.http) = {get: "/api/v1/users"};
}
// SearchUsers searches users by filter.
rpc SearchUsers(SearchUsersRequest) returns (SearchUsersResponse) {
option (google.api.http) = {get: "/api/v1/users:search"};
}
// GetUser gets a user by name.
rpc GetUser(GetUserRequest) returns (User) {
option (google.api.http) = {get: "/api/v1/{name=users/*}"};
option (google.api.method_signature) = "name";
}
// GetUserByUsername gets a user by username.
rpc GetUserByUsername(GetUserByUsernameRequest) returns (User) {
option (google.api.http) = {get: "/api/v1/users:username"};
option (google.api.method_signature) = "username";
}
// GetUserAvatarBinary gets the avatar of a user.
rpc GetUserAvatarBinary(GetUserAvatarBinaryRequest) returns (google.api.HttpBody) {
option (google.api.http) = {get: "/file/{name=users/*}/avatar"};
Expand Down Expand Up @@ -133,21 +134,16 @@ message ListUsersResponse {
repeated User users = 1;
}

message SearchUsersRequest {
// Filter is used to filter users returned in the list.
// Format: "username == 'frank'"
string filter = 1;
}

message SearchUsersResponse {
repeated User users = 1;
}

message GetUserRequest {
// The name of the user.
string name = 1;
}

message GetUserByUsernameRequest {
// The username of the user.
string username = 1;
}

message GetUserAvatarBinaryRequest {
// The name of the user.
string name = 1;
Expand Down
Loading

0 comments on commit 57014e3

Please sign in to comment.