Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: batch get users (#16096)

boojack48d63899a344
diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.go
index 3638c853b1..7ddb55fc10 100644
--- a/backend/api/v1/user_service.go
+++ b/backend/api/v1/user_service.go
@@ -86,6 +86,19 @@ func (s *UserService) GetUser(ctx context.Context, request *v1pb.GetUserRequest)
return convertToUser(user), nil
}
+// BatchGetUsers get users in batch.
+func (s *UserService) BatchGetUsers(ctx context.Context, request *v1pb.BatchGetUsersRequest) (*v1pb.BatchGetUsersResponse, error) {
+ response := &v1pb.BatchGetUsersResponse{}
+ for _, name := range request.Names {
+ user, err := s.GetUser(ctx, &v1pb.GetUserRequest{Name: name})
+ if err != nil {
+ return nil, err
+ }
+ response.Users = append(response.Users, user)
+ }
+ return response, nil
+}
+
// GetCurrentUser gets the current authenticated user.
func (*UserService) GetCurrentUser(ctx context.Context, _ *emptypb.Empty) (*v1pb.User, error) {
user, ok := ctx.Value(common.UserContextKey).(*store.UserMessage)
diff --git a/frontend/src/types/proto/v1/user_service.ts b/frontend/src/types/proto/v1/user_service.ts
index afbe394f9b..6298635bcd 100644
--- a/frontend/src/types/proto/v1/user_service.ts
+++ b/frontend/src/types/proto/v1/user_service.ts
@@ -83,6 +83,19 @@ export interface GetUserRequest {
name: string;
}
+export interface BatchGetUsersRequest {
+ /**
+ * The user names to retrieve.
+ * Format: users/{user uid or user email}
+ */
+ names: string[];
+}
+
+export interface BatchGetUsersResponse {
+ /** The users from the specified request. */
+ users: User[];
+}
+
export interface ListUsersRequest {
/**
* The maximum number of users to return. The service may return fewer than
@@ -280,6 +293,122 @@ export const GetUserRequest: MessageFns<GetUserRequest> = {
},
};
+function createBaseBatchGetUsersRequest(): BatchGetUsersRequest {
+ return { names: [] };
+}
+
+export const BatchGetUsersRequest: MessageFns<BatchGetUsersRequest> = {
+ encode(message: BatchGetUsersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ for (const v of message.names) {
+ writer.uint32(10).string(v!);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): BatchGetUsersRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBatchGetUsersRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.names.push(reader.string());
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): BatchGetUsersRequest {
+ return { names: globalThis.Array.isArray(object?.names) ? object.names.map((e: any) => globalThis.String(e)) : [] };
+ },
+
+ toJSON(message: BatchGetUsersRequest): unknown {
+ const obj: any = {};
+ if (message.names?.length) {
+ obj.names = message.names;
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<BatchGetUsersRequest>): BatchGetUsersRequest {
+ return BatchGetUsersRequest.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<BatchGetUsersRequest>): BatchGetUsersRequest {
+ const message = createBaseBatchGetUsersRequest();
+ message.names = object.names?.map((e) => e) || [];
+ return message;
+ },
+};
+
+function createBaseBatchGetUsersResponse(): BatchGetUsersResponse {
+ return { users: [] };
+}
+
+export const BatchGetUsersResponse: MessageFns<BatchGetUsersResponse> = {
+ encode(message: BatchGetUsersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ for (const v of message.users) {
+ User.encode(v!, writer.uint32(10).fork()).join();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): BatchGetUsersResponse {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBatchGetUsersResponse();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.users.push(User.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): BatchGetUsersResponse {
+ return { users: globalThis.Array.isArray(object?.users) ? object.users.map((e: any) => User.fromJSON(e)) : [] };
+ },
+
+ toJSON(message: BatchGetUsersResponse): unknown {
+ const obj: any = {};
+ if (message.users?.length) {
+ obj.users = message.users.map((e) => User.toJSON(e));
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<BatchGetUsersResponse>): BatchGetUsersResponse {
+ return BatchGetUsersResponse.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<BatchGetUsersResponse>): BatchGetUsersResponse {
+ const message = createBaseBatchGetUsersResponse();
+ message.users = object.users?.map((e) => User.fromPartial(e)) || [];
+ return message;
+ },
+};
+
function createBaseListUsersRequest(): ListUsersRequest {
return { pageSize: 0, pageToken: "", showDeleted: false, filter: "" };
}
@@ -1171,6 +1300,47 @@ export const UserServiceDefinition = {
},
},
},
+ /**
+ * Get the users in batch.
+ * Any authenticated user can batch get users.
+ */
+ batchGetUsers: {
+ name: "BatchGetUsers",
+ requestType: BatchGetUsersRequest,
+ requestStream: false,
+ responseType: BatchGetUsersResponse,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 800016: [new Uint8Array([2])],
+ 578365826: [
+ new Uint8Array([
+ 20,
+ 18,
+ 18,
+ 47,
+ 118,
+ 49,
+ 47,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 58,
+ 98,
+ 97,
+ 116,
+ 99,
+ 104,
+ 71,
+ 101,
+ 116,
+ ]),
+ ],
+ },
+ },
+ },
/** Get the current authenticated user. */
getCurrentUser: {
name: "GetCurrentUser",
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index e1893dd855..d518f41d89 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -7277,6 +7277,37 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
+ /v1/users:batchGet:
+ get:
+ tags:
+ - UserService
+ description: |-
+ Get the users in batch.
+ Any authenticated user can batch get users.
+ operationId: UserService_BatchGetUsers
+ parameters:
+ - name: names
+ in: query
+ description: |-
+ The user names to retrieve.
+ Format: users/{user uid or user email}
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/BatchGetUsersResponse'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
/v1/worksheets:
post:
tags:
@@ -8264,6 +8295,14 @@ components:
type: string
policy:
$ref: '#/components/schemas/IamPolicy'
+ BatchGetUsersResponse:
+ type: object
+ properties:
+ users:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ description: The users from the specified request.
BatchParseRequest:
type: object
properties:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index a35318425c..8b7c800ed6 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -279,6 +279,8 @@
- [SettingService](#bytebase-v1-SettingService)
- [v1/user_service.proto](#v1_user_service-proto)
+ - [BatchGetUsersRequest](#bytebase-v1-BatchGetUsersRequest)
+ - [BatchGetUsersResponse](#bytebase-v1-BatchGetUsersResponse)
- [CreateUserRequest](#bytebase-v1-CreateUserRequest)
- [DeleteUserRequest](#bytebase-v1-DeleteUserRequest)
- [GetUserRequest](#bytebase-v1-GetUserRequest)
@@ -5055,6 +5057,36 @@ We support three types of SMTP encryption: NONE, STARTTLS, and SSL/TLS.
+<a name="bytebase-v1-BatchGetUsersRequest"></a>
+
+### BatchGetUsersRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| names | [string](#string) | repeated | The user names to retrieve. Format: users/{user uid or user email} |
+
+
+
+
+
+
+<a name="bytebase-v1-BatchGetUsersResponse"></a>
+
+### BatchGetUsersResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |
+
+
+
+
+
+
<a name="bytebase-v1-CreateUserRequest"></a>
### CreateUserRequest
@@ -5247,6 +5279,7 @@ The user&#39;s `name` field is used to identify the user to update. Format: user
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | Get the user. Any authenticated user can get the user. |
+| BatchGetUsers | [BatchGetUsersRequest](#bytebase-v1-BatchGetUsersRequest) | [BatchGetUsersResponse](#bytebase-v1-BatchGetUsersResponse) | Get the users in batch. Any authenticated user can batch get users. |
| GetCurrentUser | [.google.protobuf.Empty](#google-protobuf-Empty) | [User](#bytebase-v1-User) | Get the current authenticated user. |
| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | List all users. Any authenticated user can list users. |
| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | Create a user. When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user. Otherwise, any unauthenticated user can create a user. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index e2ea7bbea4..b89532cfd4 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -1245,6 +1245,14 @@
<a href="#v1%2fuser_service.proto">v1/user_service.proto</a>
<ul>
+ <li>
+ <a href="#bytebase.v1.BatchGetUsersRequest"><span class="badge">M</span>BatchGetUsersRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.BatchGetUsersResponse"><span class="badge">M</span>BatchGetUsersResponse</a>
+ </li>
+
<li>
<a href="#bytebase.v1.CreateUserRequest"><span class="badge">M</span>CreateUserRequest</a>
</li>
@@ -14628,6 +14636,55 @@ Default to this mode.</p></td>
<p></p>
+ <h3 id="bytebase.v1.BatchGetUsersRequest">BatchGetUsersRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>names</td>
+ <td><a href="#string">string</a></td>
+ <td>repeated</td>
+ <td><p>The user names to retrieve.
+Format: users/{user uid or user email} </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.BatchGetUsersResponse">BatchGetUsersResponse</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>users</td>
+ <td><a href="#bytebase.v1.User">User</a></td>
+ <td>repeated</td>
+ <td><p>The users from the specified request. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.v1.CreateUserRequest">CreateUserRequest</h3>
<p></p>
@@ -15087,6 +15144,14 @@ Could be empty. </p></td>
Any authenticated user can get the user.</p></td>
</tr>
+ <tr>
+ <td>BatchGetUsers</td>
+ <td><a href="#bytebase.v1.BatchGetUsersRequest">BatchGetUsersRequest</a></td>
+ <td><a href="#bytebase.v1.BatchGetUsersResponse">BatchGetUsersResponse</a></td>
+ <td><p>Get the users in batch.
+Any authenticated user can batch get users.</p></td>
+ </tr>
+
<tr>
<td>GetCurrentUser</td>
<td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
@@ -15163,6 +15228,16 @@ The last remaining workspace admin cannot be deleted.</p></td>
+ <tr>
+ <td>BatchGetUsers</td>
+ <td>GET</td>
+ <td>/v1/users:batchGet</td>
+ <td></td>
+ </tr>
+
+
+
+
<tr>
<td>GetCurrentUser</td>
<td>GET</td>
diff --git a/proto/generated-go/v1/user_service.pb.go b/proto/generated-go/v1/user_service.pb.go
index f97b02a0e2..d83d01f3d4 100644
--- a/proto/generated-go/v1/user_service.pb.go
+++ b/proto/generated-go/v1/user_service.pb.go
@@ -123,6 +123,97 @@ func (x *GetUserRequest) GetName() string {
return ""
}
+type BatchGetUsersRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The user names to retrieve.
+ // Format: users/{user uid or user email}
+ Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *BatchGetUsersRequest) Reset() {
+ *x = BatchGetUsersRequest{}
+ mi := &file_v1_user_service_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *BatchGetUsersRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BatchGetUsersRequest) ProtoMessage() {}
+
+func (x *BatchGetUsersRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_user_service_proto_msgTypes[1]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BatchGetUsersRequest.ProtoReflect.Descriptor instead.
+func (*BatchGetUsersRequest) Descriptor() ([]byte, []int) {
+ return file_v1_user_service_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *BatchGetUsersRequest) GetNames() []string {
+ if x != nil {
+ return x.Names
+ }
+ return nil
+}
+
+type BatchGetUsersResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The users from the specified request.
+ Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *BatchGetUsersResponse) Reset() {
+ *x = BatchGetUsersResponse{}
+ mi := &file_v1_user_service_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *BatchGetUsersResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BatchGetUsersResponse) ProtoMessage() {}
+
+func (x *BatchGetUsersResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_user_service_proto_msgTypes[2]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BatchGetUsersResponse.ProtoReflect.Descriptor instead.
+func (*BatchGetUsersResponse) Descriptor() ([]byte, []int) {
+ return file_v1_user_service_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *BatchGetUsersResponse) GetUsers() []*User {
+ if x != nil {
+ return x.Users
+ }
+ return nil
+}
+
type ListUsersRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The maximum number of users to return. The service may return fewer than
@@ -168,7 +259,7 @@ type ListUsersRequest struct {
func (x *ListUsersRequest) Reset() {
*x = ListUsersRequest{}
- mi := &file_v1_user_service_proto_msgTypes[1]
+ mi := &file_v1_user_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -180,7 +271,7 @@ func (x *ListUsersRequest) String() string {
func (*ListUsersRequest) ProtoMessage() {}
func (x *ListUsersRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[1]
+ mi := &file_v1_user_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -193,7 +284,7 @@ func (x *ListUsersRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListUsersRequest.ProtoReflect.Descriptor instead.
func (*ListUsersRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{1}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{3}
}
func (x *ListUsersRequest) GetPageSize() int32 {
@@ -237,7 +328,7 @@ type ListUsersResponse struct {
func (x *ListUsersResponse) Reset() {
*x = ListUsersResponse{}
- mi := &file_v1_user_service_proto_msgTypes[2]
+ mi := &file_v1_user_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -249,7 +340,7 @@ func (x *ListUsersResponse) String() string {
func (*ListUsersResponse) ProtoMessage() {}
func (x *ListUsersResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[2]
+ mi := &file_v1_user_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -262,7 +353,7 @@ func (x *ListUsersResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListUsersResponse.ProtoReflect.Descriptor instead.
func (*ListUsersResponse) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{2}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{4}
}
func (x *ListUsersResponse) GetUsers() []*User {
@@ -289,7 +380,7 @@ type CreateUserRequest struct {
func (x *CreateUserRequest) Reset() {
*x = CreateUserRequest{}
- mi := &file_v1_user_service_proto_msgTypes[3]
+ mi := &file_v1_user_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -301,7 +392,7 @@ func (x *CreateUserRequest) String() string {
func (*CreateUserRequest) ProtoMessage() {}
func (x *CreateUserRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[3]
+ mi := &file_v1_user_service_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -314,7 +405,7 @@ func (x *CreateUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.
func (*CreateUserRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{3}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{5}
}
func (x *CreateUserRequest) GetUser() *User {
@@ -346,7 +437,7 @@ type UpdateUserRequest struct {
func (x *UpdateUserRequest) Reset() {
*x = UpdateUserRequest{}
- mi := &file_v1_user_service_proto_msgTypes[4]
+ mi := &file_v1_user_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -358,7 +449,7 @@ func (x *UpdateUserRequest) String() string {
func (*UpdateUserRequest) ProtoMessage() {}
func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[4]
+ mi := &file_v1_user_service_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -371,7 +462,7 @@ func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{4}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{6}
}
func (x *UpdateUserRequest) GetUser() *User {
@@ -420,7 +511,7 @@ type DeleteUserRequest struct {
func (x *DeleteUserRequest) Reset() {
*x = DeleteUserRequest{}
- mi := &file_v1_user_service_proto_msgTypes[5]
+ mi := &file_v1_user_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -432,7 +523,7 @@ func (x *DeleteUserRequest) String() string {
func (*DeleteUserRequest) ProtoMessage() {}
func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[5]
+ mi := &file_v1_user_service_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -445,7 +536,7 @@ func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.
func (*DeleteUserRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{5}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{7}
}
func (x *DeleteUserRequest) GetName() string {
@@ -466,7 +557,7 @@ type UndeleteUserRequest struct {
func (x *UndeleteUserRequest) Reset() {
*x = UndeleteUserRequest{}
- mi := &file_v1_user_service_proto_msgTypes[6]
+ mi := &file_v1_user_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -478,7 +569,7 @@ func (x *UndeleteUserRequest) String() string {
func (*UndeleteUserRequest) ProtoMessage() {}
func (x *UndeleteUserRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[6]
+ mi := &file_v1_user_service_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -491,7 +582,7 @@ func (x *UndeleteUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UndeleteUserRequest.ProtoReflect.Descriptor instead.
func (*UndeleteUserRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{6}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{8}
}
func (x *UndeleteUserRequest) GetName() string {
@@ -528,7 +619,7 @@ type User struct {
func (x *User) Reset() {
*x = User{}
- mi := &file_v1_user_service_proto_msgTypes[7]
+ mi := &file_v1_user_service_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -540,7 +631,7 @@ func (x *User) String() string {
func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[7]
+ mi := &file_v1_user_service_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -553,7 +644,7 @@ func (x *User) ProtoReflect() protoreflect.Message {
// Deprecated: Use User.ProtoReflect.Descriptor instead.
func (*User) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{7}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{9}
}
func (x *User) GetName() string {
@@ -652,7 +743,7 @@ type User_Profile struct {
func (x *User_Profile) Reset() {
*x = User_Profile{}
- mi := &file_v1_user_service_proto_msgTypes[8]
+ mi := &file_v1_user_service_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -664,7 +755,7 @@ func (x *User_Profile) String() string {
func (*User_Profile) ProtoMessage() {}
func (x *User_Profile) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[8]
+ mi := &file_v1_user_service_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -677,7 +768,7 @@ func (x *User_Profile) ProtoReflect() protoreflect.Message {
// Deprecated: Use User_Profile.ProtoReflect.Descriptor instead.
func (*User_Profile) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{7, 0}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{9, 0}
}
func (x *User_Profile) GetLastLoginTime() *timestamppb.Timestamp {
@@ -708,7 +799,12 @@ const file_v1_user_service_proto_rawDesc = "" +
"\x15v1/user_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\"@\n" +
"\x0eGetUserRequest\x12.\n" +
"\x04name\x18\x01 \x01(\tB\x1a\xe2A\x01\x02\xfaA\x13\n" +
- "\x11bytebase.com/UserR\x04name\"\x89\x01\n" +
+ "\x11bytebase.com/UserR\x04name\"H\n" +
+ "\x14BatchGetUsersRequest\x120\n" +
+ "\x05names\x18\x01 \x03(\tB\x1a\xe2A\x01\x02\xfaA\x13\n" +
+ "\x11bytebase.com/UserR\x05names\"@\n" +
+ "\x15BatchGetUsersResponse\x12'\n" +
+ "\x05users\x18\x01 \x03(\v2\x11.bytebase.v1.UserR\x05users\"\x89\x01\n" +
"\x10ListUsersRequest\x12\x1b\n" +
"\tpage_size\x18\x01 \x01(\x05R\bpageSize\x12\x1d\n" +
"\n" +
@@ -761,9 +857,10 @@ const file_v1_user_service_proto_rawDesc = "" +
"\x04USER\x10\x01\x12\x0e\n" +
"\n" +
"SYSTEM_BOT\x10\x02\x12\x13\n" +
- "\x0fSERVICE_ACCOUNT\x10\x032\x8d\x06\n" +
+ "\x0fSERVICE_ACCOUNT\x10\x032\x85\a\n" +
"\vUserService\x12`\n" +
- "\aGetUser\x12\x1b.bytebase.v1.GetUserRequest\x1a\x11.bytebase.v1.User\"%\xdaA\x04name\x90\xea0\x02\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/{name=users/*}\x12Y\n" +
+ "\aGetUser\x12\x1b.bytebase.v1.GetUserRequest\x1a\x11.bytebase.v1.User\"%\xdaA\x04name\x90\xea0\x02\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/{name=users/*}\x12v\n" +
+ "\rBatchGetUsers\x12!.bytebase.v1.BatchGetUsersRequest\x1a\".bytebase.v1.BatchGetUsersResponse\"\x1e\x90\xea0\x02\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/users:batchGet\x12Y\n" +
"\x0eGetCurrentUser\x12\x16.google.protobuf.Empty\x1a\x11.bytebase.v1.User\"\x1c\x80\xea0\x01\x90\xea0\x02\x82\xd3\xe4\x93\x02\x0e\x12\f/v1/users/me\x12j\n" +
"\tListUsers\x12\x1d.bytebase.v1.ListUsersRequest\x1a\x1e.bytebase.v1.ListUsersResponse\"\x1e\xdaA\x06parent\x90\xea0\x02\x82\xd3\xe4\x93\x02\v\x12\t/v1/users\x12k\n" +
"\n" +
@@ -787,52 +884,57 @@ func file_v1_user_service_proto_rawDescGZIP() []byte {
}
var file_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
+var file_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_v1_user_service_proto_goTypes = []any{
(UserType)(0), // 0: bytebase.v1.UserType
(*GetUserRequest)(nil), // 1: bytebase.v1.GetUserRequest
- (*ListUsersRequest)(nil), // 2: bytebase.v1.ListUsersRequest
- (*ListUsersResponse)(nil), // 3: bytebase.v1.ListUsersResponse
- (*CreateUserRequest)(nil), // 4: bytebase.v1.CreateUserRequest
- (*UpdateUserRequest)(nil), // 5: bytebase.v1.UpdateUserRequest
- (*DeleteUserRequest)(nil), // 6: bytebase.v1.DeleteUserRequest
- (*UndeleteUserRequest)(nil), // 7: bytebase.v1.UndeleteUserRequest
- (*User)(nil), // 8: bytebase.v1.User
- (*User_Profile)(nil), // 9: bytebase.v1.User.Profile
- (*fieldmaskpb.FieldMask)(nil), // 10: google.protobuf.FieldMask
- (State)(0), // 11: bytebase.v1.State
- (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp
- (*emptypb.Empty)(nil), // 13: google.protobuf.Empty
+ (*BatchGetUsersRequest)(nil), // 2: bytebase.v1.BatchGetUsersRequest
+ (*BatchGetUsersResponse)(nil), // 3: bytebase.v1.BatchGetUsersResponse
+ (*ListUsersRequest)(nil), // 4: bytebase.v1.ListUsersRequest
+ (*ListUsersResponse)(nil), // 5: bytebase.v1.ListUsersResponse
+ (*CreateUserRequest)(nil), // 6: bytebase.v1.CreateUserRequest
+ (*UpdateUserRequest)(nil), // 7: bytebase.v1.UpdateUserRequest
+ (*DeleteUserRequest)(nil), // 8: bytebase.v1.DeleteUserRequest
+ (*UndeleteUserRequest)(nil), // 9: bytebase.v1.UndeleteUserRequest
+ (*User)(nil), // 10: bytebase.v1.User
+ (*User_Profile)(nil), // 11: bytebase.v1.User.Profile
+ (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask
+ (State)(0), // 13: bytebase.v1.State
+ (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp
+ (*emptypb.Empty)(nil), // 15: google.protobuf.Empty
}
var file_v1_user_service_proto_depIdxs = []int32{
- 8, // 0: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User
- 8, // 1: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User
- 8, // 2: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User
- 10, // 3: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask
- 11, // 4: bytebase.v1.User.state:type_name -> bytebase.v1.State
- 0, // 5: bytebase.v1.User.user_type:type_name -> bytebase.v1.UserType
- 9, // 6: bytebase.v1.User.profile:type_name -> bytebase.v1.User.Profile
- 12, // 7: bytebase.v1.User.Profile.last_login_time:type_name -> google.protobuf.Timestamp
- 12, // 8: bytebase.v1.User.Profile.last_change_password_time:type_name -> google.protobuf.Timestamp
- 1, // 9: bytebase.v1.UserService.GetUser:input_type -> bytebase.v1.GetUserRequest
- 13, // 10: bytebase.v1.UserService.GetCurrentUser:input_type -> google.protobuf.Empty
- 2, // 11: bytebase.v1.UserService.ListUsers:input_type -> bytebase.v1.ListUsersRequest
- 4, // 12: bytebase.v1.UserService.CreateUser:input_type -> bytebase.v1.CreateUserRequest
- 5, // 13: bytebase.v1.UserService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest
- 6, // 14: bytebase.v1.UserService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest
- 7, // 15: bytebase.v1.UserService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest
- 8, // 16: bytebase.v1.UserService.GetUser:output_type -> bytebase.v1.User
- 8, // 17: bytebase.v1.UserService.GetCurrentUser:output_type -> bytebase.v1.User
- 3, // 18: bytebase.v1.UserService.ListUsers:output_type -> bytebase.v1.ListUsersResponse
- 8, // 19: bytebase.v1.UserService.CreateUser:output_type -> bytebase.v1.User
- 8, // 20: bytebase.v1.UserService.UpdateUser:output_type -> bytebase.v1.User
- 13, // 21: bytebase.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty
- 8, // 22: bytebase.v1.UserService.UndeleteUser:output_type -> bytebase.v1.User
- 16, // [16:23] is the sub-list for method output_type
- 9, // [9:16] is the sub-list for method input_type
- 9, // [9:9] is the sub-list for extension type_name
- 9, // [9:9] is the sub-list for extension extendee
- 0, // [0:9] is the sub-list for field type_name
+ 10, // 0: bytebase.v1.BatchGetUsersResponse.users:type_name -> bytebase.v1.User
+ 10, // 1: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User
+ 10, // 2: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User
+ 10, // 3: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User
+ 12, // 4: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 13, // 5: bytebase.v1.User.state:type_name -> bytebase.v1.State
+ 0, // 6: bytebase.v1.User.user_type:type_name -> bytebase.v1.UserType
+ 11, // 7: bytebase.v1.User.profile:type_name -> bytebase.v1.User.Profile
+ 14, // 8: bytebase.v1.User.Profile.last_login_time:type_name -> google.protobuf.Timestamp
+ 14, // 9: bytebase.v1.User.Profile.last_change_password_time:type_name -> google.protobuf.Timestamp
+ 1, // 10: bytebase.v1.UserService.GetUser:input_type -> bytebase.v1.GetUserRequest
+ 2, // 11: bytebase.v1.UserService.BatchGetUsers:input_type -> bytebase.v1.BatchGetUsersRequest
+ 15, // 12: bytebase.v1.UserService.GetCurrentUser:input_type -> google.protobuf.Empty
+ 4, // 13: bytebase.v1.UserService.ListUsers:input_type -> bytebase.v1.ListUsersRequest
+ 6, // 14: bytebase.v1.UserService.CreateUser:input_type -> bytebase.v1.CreateUserRequest
+ 7, // 15: bytebase.v1.UserService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest
+ 8, // 16: bytebase.v1.UserService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest
+ 9, // 17: bytebase.v1.UserService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest
+ 10, // 18: bytebase.v1.UserService.GetUser:output_type -> bytebase.v1.User
+ 3, // 19: bytebase.v1.UserService.BatchGetUsers:output_type -> bytebase.v1.BatchGetUsersResponse
+ 10, // 20: bytebase.v1.UserService.GetCurrentUser:output_type -> bytebase.v1.User
+ 5, // 21: bytebase.v1.UserService.ListUsers:output_type -> bytebase.v1.ListUsersResponse
+ 10, // 22: bytebase.v1.UserService.CreateUser:output_type -> bytebase.v1.User
+ 10, // 23: bytebase.v1.UserService.UpdateUser:output_type -> bytebase.v1.User
+ 15, // 24: bytebase.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty
+ 10, // 25: bytebase.v1.UserService.UndeleteUser:output_type -> bytebase.v1.User
+ 18, // [18:26] is the sub-list for method output_type
+ 10, // [10:18] is the sub-list for method input_type
+ 10, // [10:10] is the sub-list for extension type_name
+ 10, // [10:10] is the sub-list for extension extendee
+ 0, // [0:10] is the sub-list for field type_name
}
func init() { file_v1_user_service_proto_init() }
@@ -842,14 +944,14 @@ func file_v1_user_service_proto_init() {
}
file_v1_annotation_proto_init()
file_v1_common_proto_init()
- file_v1_user_service_proto_msgTypes[4].OneofWrappers = []any{}
+ file_v1_user_service_proto_msgTypes[6].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_user_service_proto_rawDesc), len(file_v1_user_service_proto_rawDesc)),
NumEnums: 1,
- NumMessages: 9,
+ NumMessages: 11,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/generated-go/v1/user_service.pb.gw.go b/proto/generated-go/v1/user_service.pb.gw.go
index 461fae847d..71d4694850 100644
--- a/proto/generated-go/v1/user_service.pb.gw.go
+++ b/proto/generated-go/v1/user_service.pb.gw.go
@@ -73,6 +73,39 @@ func local_request_UserService_GetUser_0(ctx context.Context, marshaler runtime.
return msg, metadata, err
}
+var filter_UserService_BatchGetUsers_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
+
+func request_UserService_BatchGetUsers_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq BatchGetUsersRequest
+ metadata runtime.ServerMetadata
+ )
+ io.Copy(io.Discard, req.Body)
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_BatchGetUsers_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := client.BatchGetUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_UserService_BatchGetUsers_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq BatchGetUsersRequest
+ metadata runtime.ServerMetadata
+ )
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_BatchGetUsers_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.BatchGetUsers(ctx, &protoReq)
+ return msg, metadata, err
+}
+
func request_UserService_GetCurrentUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq emptypb.Empty
@@ -332,6 +365,26 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_UserService_BatchGetUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.UserService/BatchGetUsers", runtime.WithHTTPPathPattern("/v1/users:batchGet"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_UserService_BatchGetUsers_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_BatchGetUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodGet, pattern_UserService_GetCurrentUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -509,6 +562,23 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_UserService_BatchGetUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.UserService/BatchGetUsers", runtime.WithHTTPPathPattern("/v1/users:batchGet"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_UserService_BatchGetUsers_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_BatchGetUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodGet, pattern_UserService_GetCurrentUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -616,6 +686,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
var (
pattern_UserService_GetUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "name"}, ""))
+ pattern_UserService_BatchGetUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, "batchGet"))
pattern_UserService_GetCurrentUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "users", "me"}, ""))
pattern_UserService_ListUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))
pattern_UserService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))
@@ -626,6 +697,7 @@ var (
var (
forward_UserService_GetUser_0 = runtime.ForwardResponseMessage
+ forward_UserService_BatchGetUsers_0 = runtime.ForwardResponseMessage
forward_UserService_GetCurrentUser_0 = runtime.ForwardResponseMessage
forward_UserService_ListUsers_0 = runtime.ForwardResponseMessage
forward_UserService_CreateUser_0 = runtime.ForwardResponseMessage
diff --git a/proto/generated-go/v1/user_service_grpc.pb.go b/proto/generated-go/v1/user_service_grpc.pb.go
index 3d3125b569..266a6b87fc 100644
--- a/proto/generated-go/v1/user_service_grpc.pb.go
+++ b/proto/generated-go/v1/user_service_grpc.pb.go
@@ -21,6 +21,7 @@ const _ = grpc.SupportPackageIsVersion9
const (
UserService_GetUser_FullMethodName = "/bytebase.v1.UserService/GetUser"
+ UserService_BatchGetUsers_FullMethodName = "/bytebase.v1.UserService/BatchGetUsers"
UserService_GetCurrentUser_FullMethodName = "/bytebase.v1.UserService/GetCurrentUser"
UserService_ListUsers_FullMethodName = "/bytebase.v1.UserService/ListUsers"
UserService_CreateUser_FullMethodName = "/bytebase.v1.UserService/CreateUser"
@@ -36,6 +37,9 @@ type UserServiceClient interface {
// Get the user.
// Any authenticated user can get the user.
GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error)
+ // Get the users in batch.
+ // Any authenticated user can batch get users.
+ BatchGetUsers(ctx context.Context, in *BatchGetUsersRequest, opts ...grpc.CallOption) (*BatchGetUsersResponse, error)
// Get the current authenticated user.
GetCurrentUser(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*User, error)
// List all users.
@@ -72,6 +76,16 @@ func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opt
return out, nil
}
+func (c *userServiceClient) BatchGetUsers(ctx context.Context, in *BatchGetUsersRequest, opts ...grpc.CallOption) (*BatchGetUsersResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(BatchGetUsersResponse)
+ err := c.cc.Invoke(ctx, UserService_BatchGetUsers_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *userServiceClient) GetCurrentUser(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(User)
@@ -139,6 +153,9 @@ type UserServiceServer interface {
// Get the user.
// Any authenticated user can get the user.
GetUser(context.Context, *GetUserRequest) (*User, error)
+ // Get the users in batch.
+ // Any authenticated user can batch get users.
+ BatchGetUsers(context.Context, *BatchGetUsersRequest) (*BatchGetUsersResponse, error)
// Get the current authenticated user.
GetCurrentUser(context.Context, *emptypb.Empty) (*User, error)
// List all users.
@@ -168,6 +185,9 @@ type UnimplementedUserServiceServer struct{}
func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")
}
+func (UnimplementedUserServiceServer) BatchGetUsers(context.Context, *BatchGetUsersRequest) (*BatchGetUsersResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method BatchGetUsers not implemented")
+}
func (UnimplementedUserServiceServer) GetCurrentUser(context.Context, *emptypb.Empty) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCurrentUser not implemented")
}
@@ -225,6 +245,24 @@ func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func
return interceptor(ctx, in, info, handler)
}
+func _UserService_BatchGetUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(BatchGetUsersRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserServiceServer).BatchGetUsers(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserService_BatchGetUsers_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserServiceServer).BatchGetUsers(ctx, req.(*BatchGetUsersRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _UserService_GetCurrentUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
@@ -344,6 +382,10 @@ var UserService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetUser",
Handler: _UserService_GetUser_Handler,
},
+ {
+ MethodName: "BatchGetUsers",
+ Handler: _UserService_BatchGetUsers_Handler,
+ },
{
MethodName: "GetCurrentUser",
Handler: _UserService_GetCurrentUser_Handler,
diff --git a/proto/v1/v1/user_service.proto b/proto/v1/v1/user_service.proto
index 63c69fffc7..9845ff2a85 100644
--- a/proto/v1/v1/user_service.proto
+++ b/proto/v1/v1/user_service.proto
@@ -23,6 +23,13 @@ service UserService {
option (bytebase.v1.auth_method) = CUSTOM;
}
+ // Get the users in batch.
+ // Any authenticated user can batch get users.
+ rpc BatchGetUsers(BatchGetUsersRequest) returns (BatchGetUsersResponse) {
+ option (google.api.http) = {get: "/v1/users:batchGet"};
+ option (bytebase.v1.auth_method) = CUSTOM;
+ }
+
// Get the current authenticated user.
rpc GetCurrentUser(google.protobuf.Empty) returns (User) {
option (google.api.http) = {get: "/v1/users/me"};
@@ -92,6 +99,20 @@ message GetUserRequest {
];
}
+message BatchGetUsersRequest {
+ // The user names to retrieve.
+ // Format: users/{user uid or user email}
+ repeated string names = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {type: "bytebase.com/User"}
+ ];
+}
+
+message BatchGetUsersResponse {
+ // The users from the specified request.
+ repeated User users = 1;
+}
+
message ListUsersRequest {
// The maximum number of users to return. The service may return fewer than
// this value.