From c9ab03e1a088e63eb85b286185a60bed2978da57 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 16 Jun 2025 21:49:38 +0800 Subject: [PATCH] refactor: user service --- proto/api/v1/user_service.proto | 408 +++-- proto/gen/api/v1/user_service.pb.go | 1167 +++++++++----- proto/gen/api/v1/user_service.pb.gw.go | 416 +++-- proto/gen/api/v1/user_service_grpc.pb.go | 146 +- proto/gen/apidocs.swagger.yaml | 530 ++++-- server/router/api/v1/acl_config.go | 3 +- server/router/api/v1/auth_service.go | 3 +- server/router/api/v1/user_service.go | 162 +- server/router/api/v1/user_service_stats.go | 138 +- .../components/ChangeMemberPasswordDialog.tsx | 2 +- .../components/CreateAccessTokenDialog.tsx | 8 +- .../components/Inbox/MemoCommentMessage.tsx | 2 +- web/src/components/MemoView.tsx | 2 +- web/src/components/ReactionView.tsx | 4 +- .../Settings/AccessTokenSection.tsx | 14 +- web/src/components/Settings/MemberSection.tsx | 6 +- .../components/Settings/MyAccountSection.tsx | 2 +- web/src/components/UpdateAccountDialog.tsx | 18 +- web/src/components/UserBanner.tsx | 2 +- web/src/pages/UserProfile.tsx | 2 +- web/src/store/v2/user.ts | 23 +- web/src/types/proto/api/v1/user_service.ts | 1419 ++++++++++++----- web/src/types/proto/google/api/resource.ts | 501 ++++++ 23 files changed, 3513 insertions(+), 1465 deletions(-) create mode 100644 web/src/types/proto/google/api/resource.ts diff --git a/proto/api/v1/user_service.proto b/proto/api/v1/user_service.proto index 70251c441..9e98ed56b 100644 --- a/proto/api/v1/user_service.proto +++ b/proto/api/v1/user_service.proto @@ -7,6 +7,7 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/httpbody.proto"; +import "google/api/resource.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -18,21 +19,13 @@ service UserService { rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) { option (google.api.http) = {get: "/api/v1/users"}; } + // 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"}; - option (google.api.method_signature) = "name"; - } + // CreateUser creates a new user. rpc CreateUser(CreateUserRequest) returns (User) { option (google.api.http) = { @@ -41,6 +34,7 @@ service UserService { }; option (google.api.method_signature) = "user"; } + // UpdateUser updates a user. rpc UpdateUser(UpdateUserRequest) returns (User) { option (google.api.http) = { @@ -49,147 +43,288 @@ service UserService { }; option (google.api.method_signature) = "user,update_mask"; } + // DeleteUser deletes a user. rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) { option (google.api.http) = {delete: "/api/v1/{name=users/*}"}; option (google.api.method_signature) = "name"; } - // ListAllUserStats returns all user stats. + + // SearchUsers searches for users based on query. + rpc SearchUsers(SearchUsersRequest) returns (SearchUsersResponse) { + option (google.api.http) = {get: "/api/v1/users:search"}; + option (google.api.method_signature) = "query"; + } + + // GetUserAvatar gets the avatar of a user. + rpc GetUserAvatar(GetUserAvatarRequest) returns (google.api.HttpBody) { + option (google.api.http) = {get: "/api/v1/{name=users/*}/avatar"}; + option (google.api.method_signature) = "name"; + } + + // ListAllUserStats returns statistics for all users. rpc ListAllUserStats(ListAllUserStatsRequest) returns (ListAllUserStatsResponse) { - option (google.api.http) = {post: "/api/v1/users/-/stats"}; + option (google.api.http) = {get: "/api/v1/users:stats"}; } - // GetUserStats returns the stats of a user. + + // GetUserStats returns statistics for a specific user. rpc GetUserStats(GetUserStatsRequest) returns (UserStats) { - option (google.api.http) = {get: "/api/v1/{name=users/*}/stats"}; + option (google.api.http) = {get: "/api/v1/{name=users/*}:getStats"}; option (google.api.method_signature) = "name"; } - // GetUserSetting gets the setting of a user. + + // GetUserSetting returns the user setting. rpc GetUserSetting(GetUserSettingRequest) returns (UserSetting) { - option (google.api.http) = {get: "/api/v1/{name=users/*}/setting"}; + option (google.api.http) = {get: "/api/v1/{name=users/*}:getSetting"}; option (google.api.method_signature) = "name"; } - // UpdateUserSetting updates the setting of a user. + + // UpdateUserSetting updates the user setting. rpc UpdateUserSetting(UpdateUserSettingRequest) returns (UserSetting) { option (google.api.http) = { - patch: "/api/v1/{setting.name=users/*/setting}" + patch: "/api/v1/{setting.name=users/*}:updateSetting" body: "setting" }; option (google.api.method_signature) = "setting,update_mask"; } + // ListUserAccessTokens returns a list of access tokens for a user. rpc ListUserAccessTokens(ListUserAccessTokensRequest) returns (ListUserAccessTokensResponse) { - option (google.api.http) = {get: "/api/v1/{name=users/*}/access_tokens"}; - option (google.api.method_signature) = "name"; + option (google.api.http) = {get: "/api/v1/{parent=users/*}/accessTokens"}; + option (google.api.method_signature) = "parent"; } + // CreateUserAccessToken creates a new access token for a user. rpc CreateUserAccessToken(CreateUserAccessTokenRequest) returns (UserAccessToken) { option (google.api.http) = { - post: "/api/v1/{name=users/*}/access_tokens" - body: "*" + post: "/api/v1/{parent=users/*}/accessTokens" + body: "access_token" }; - option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "parent,access_token"; } - // DeleteUserAccessToken deletes an access token for a user. + + // DeleteUserAccessToken deletes an access token. rpc DeleteUserAccessToken(DeleteUserAccessTokenRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=users/*}/access_tokens/{access_token}"}; - option (google.api.method_signature) = "name,access_token"; + option (google.api.http) = {delete: "/api/v1/{name=users/*/accessTokens/*}"}; + option (google.api.method_signature) = "name"; } } message User { - // The name of the user. - // Format: users/{id}, id is the system generated auto-incremented id. - string name = 1 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = IDENTIFIER - ]; + option (google.api.resource) = { + type: "memos.api.v1/User" + pattern: "users/{user}" + name_field: "name" + singular: "user" + plural: "users" + }; - enum Role { - ROLE_UNSPECIFIED = 0; - HOST = 1; - ADMIN = 2; - USER = 3; - } - Role role = 3; + // The resource name of the user. + // Format: users/{user} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; - string username = 4; + // Output only. The system generated unique identifier. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - string email = 5; + // The role of the user. + Role role = 3 [(google.api.field_behavior) = REQUIRED]; - string nickname = 6; + // Required. The unique username for login. + string username = 4 [(google.api.field_behavior) = REQUIRED]; - string avatar_url = 7; + // Optional. The email address of the user. + string email = 5 [(google.api.field_behavior) = OPTIONAL]; - string description = 8; + // Optional. The display name of the user. + string display_name = 6 [(google.api.field_behavior) = OPTIONAL]; + // Optional. The avatar URL of the user. + string avatar_url = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The description of the user. + string description = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Input only. The password for the user. string password = 9 [(google.api.field_behavior) = INPUT_ONLY]; - State state = 10; + // The state of the user. + State state = 10 [(google.api.field_behavior) = REQUIRED]; + // Output only. The creation timestamp. google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The last update timestamp. google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The etag for this resource. + string etag = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User role enumeration. + enum Role { + // Unspecified role. + ROLE_UNSPECIFIED = 0; + // Host role with full system access. + HOST = 1; + // Admin role with administrative privileges. + ADMIN = 2; + // Regular user role. + USER = 3; + } } -message ListUsersRequest {} +message ListUsersRequest { + // Optional. The maximum number of users to return. + // The service may return fewer than this value. + // If unspecified, at most 50 users will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListUsers` call. + // Provide this to retrieve the subsequent page. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filter to apply to the list results. + // Example: "state=ACTIVE" or "role=USER" or "email:@example.com" + // Supported operators: =, !=, <, <=, >, >=, : + // Supported fields: username, email, role, state, create_time, update_time + string filter = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The order to sort results by. + // Example: "create_time desc" or "username asc" + string order_by = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, show deleted users in the response. + bool show_deleted = 5 [(google.api.field_behavior) = OPTIONAL]; +} message ListUsersResponse { + // The list of users. repeated User users = 1; -} -message GetUserRequest { - // The name of the user. - string name = 1; -} + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; -message GetUserByUsernameRequest { - // The username of the user. - string username = 1; + // The total count of users (may be approximate). + int32 total_size = 3; } -message GetUserAvatarBinaryRequest { - // The name of the user. - string name = 1; +message GetUserRequest { + // Required. The resource name of the user. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api.v1/User"} + ]; - // The raw HTTP body is bound to this field. - google.api.HttpBody http_body = 2; + // Optional. The fields to return in the response. + // If not specified, all fields are returned. + google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL]; } message CreateUserRequest { - User user = 1; + // Required. The user to create. + User user = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // Optional. The user ID to use for this user. + // If empty, a unique ID will be generated. + // Must match the pattern [a-z0-9-]+ + string user_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set, validate the request but don't actually create the user. + bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An idempotency token that can be used to ensure that multiple + // requests to create a user have the same result. + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; } message UpdateUserRequest { + // Required. The user to update. User user = 1 [(google.api.field_behavior) = REQUIRED]; - google.protobuf.FieldMask update_mask = 2; + // Required. The list of fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. If set to true, allows updating sensitive fields. + bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL]; } message DeleteUserRequest { - // The name of the user. - string name = 1; + // Required. The resource name of the user to delete. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api.v1/User"} + ]; + + // Optional. If set to true, the user will be deleted even if they have associated data. + bool force = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +message SearchUsersRequest { + // Required. The search query. + string query = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The maximum number of users to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token for pagination. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +message SearchUsersResponse { + // The list of users matching the search query. + repeated User users = 1; + + // A token for the next page of results. + string next_page_token = 2; + + // The total count of matching users. + int32 total_size = 3; +} + +message GetUserAvatarRequest { + // Required. The resource name of the user. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api.v1/User"} + ]; } +// User statistics messages message UserStats { - // The name of the user. - string name = 1; + option (google.api.resource) = { + type: "memos.api.v1/UserStats" + pattern: "users/{user}" + singular: "userStats" + plural: "userStats" + }; + + // The resource name of the user whose stats these are. + // Format: users/{user} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; // The timestamps when the memos were displayed. - // We should return raw data to the client, and let the client format the data with the user's timezone. repeated google.protobuf.Timestamp memo_display_timestamps = 2; // The stats of memo types. MemoTypeStats memo_type_stats = 3; // The count of tags. - // Format: "tag1": 1, "tag2": 2 map tag_count = 4; // The pinned memos of the user. repeated string pinned_memos = 5; + // Total memo count. int32 total_memo_count = 6; + // Memo type statistics. message MemoTypeStats { int32 link_count = 1; int32 code_count = 2; @@ -198,67 +333,146 @@ message UserStats { } } -message ListAllUserStatsRequest {} - -message ListAllUserStatsResponse { - repeated UserStats user_stats = 1; -} - message GetUserStatsRequest { - // The name of the user. - string name = 1; + // Required. The resource name of the user. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api.v1/User"} + ]; } +// User settings message message UserSetting { - // The name of the user. - string name = 1; + option (google.api.resource) = { + type: "memos.api.v1/UserSetting" + pattern: "users/{user}" + singular: "userSetting" + plural: "userSettings" + }; + + // The resource name of the user whose setting this is. + // Format: users/{user} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + // The preferred locale of the user. - string locale = 2; + string locale = 2 [(google.api.field_behavior) = OPTIONAL]; + // The preferred appearance of the user. - string appearance = 3; + string appearance = 3 [(google.api.field_behavior) = OPTIONAL]; + // The default visibility of the memo. - string memo_visibility = 4; + string memo_visibility = 4 [(google.api.field_behavior) = OPTIONAL]; } message GetUserSettingRequest { - // The name of the user. - string name = 1; + // Required. The resource name of the user. + // Format: users/{user} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api.v1/User"} + ]; } message UpdateUserSettingRequest { + // Required. The user setting to update. UserSetting setting = 1 [(google.api.field_behavior) = REQUIRED]; - google.protobuf.FieldMask update_mask = 2; + // Required. The list of fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; } +// User access token message message UserAccessToken { - string access_token = 1; - string description = 2; - google.protobuf.Timestamp issued_at = 3; - google.protobuf.Timestamp expires_at = 4; + option (google.api.resource) = { + type: "memos.api.v1/UserAccessToken" + pattern: "users/{user}/accessTokens/{access_token}" + singular: "userAccessToken" + plural: "userAccessTokens" + }; + + // The resource name of the access token. + // Format: users/{user}/accessTokens/{access_token} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. The access token value. + string access_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of the access token. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The issued timestamp. + google.protobuf.Timestamp issued_at = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The expiration timestamp. + google.protobuf.Timestamp expires_at = 5 [(google.api.field_behavior) = OPTIONAL]; } message ListUserAccessTokensRequest { - // The name of the user. - string name = 1; + // Required. The parent resource whose access tokens will be listed. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api.v1/User"} + ]; + + // Optional. The maximum number of access tokens to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token for pagination. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; } message ListUserAccessTokensResponse { + // The list of access tokens. repeated UserAccessToken access_tokens = 1; + + // A token for the next page of results. + string next_page_token = 2; + + // The total count of access tokens. + int32 total_size = 3; } message CreateUserAccessTokenRequest { - // The name of the user. - string name = 1; + // Required. The parent resource where this access token will be created. + // Format: users/{user} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api.v1/User"} + ]; - string description = 2; + // Required. The access token to create. + UserAccessToken access_token = 2 [(google.api.field_behavior) = REQUIRED]; - optional google.protobuf.Timestamp expires_at = 3; + // Optional. The access token ID to use. + string access_token_id = 3 [(google.api.field_behavior) = OPTIONAL]; } message DeleteUserAccessTokenRequest { - // The name of the user. - string name = 1; - // access_token is the access token to delete. - string access_token = 2; + // Required. The resource name of the access token to delete. + // Format: users/{user}/accessTokens/{access_token} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = {type: "memos.api.v1/UserAccessToken"} + ]; +} + +message ListAllUserStatsRequest { + // Optional. The maximum number of user stats to return. + int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token for pagination. + string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +message ListAllUserStatsResponse { + // The list of user statistics. + repeated UserStats user_stats = 1; + + // A token for the next page of results. + string next_page_token = 2; + + // The total count of user statistics. + int32 total_size = 3; } diff --git a/proto/gen/api/v1/user_service.pb.go b/proto/gen/api/v1/user_service.pb.go index db6bea2f9..673a4c0b3 100644 --- a/proto/gen/api/v1/user_service.pb.go +++ b/proto/gen/api/v1/user_service.pb.go @@ -26,13 +26,18 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// User role enumeration. type User_Role int32 const ( + // Unspecified role. User_ROLE_UNSPECIFIED User_Role = 0 - User_HOST User_Role = 1 - User_ADMIN User_Role = 2 - User_USER User_Role = 3 + // Host role with full system access. + User_HOST User_Role = 1 + // Admin role with administrative privileges. + User_ADMIN User_Role = 2 + // Regular user role. + User_USER User_Role = 3 ) // Enum value maps for User_Role. @@ -80,19 +85,33 @@ func (User_Role) EnumDescriptor() ([]byte, []int) { type User struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. - // Format: users/{id}, id is the system generated auto-incremented id. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Role User_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.v1.User_Role" json:"role,omitempty"` - Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` - Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"` - Nickname string `protobuf:"bytes,6,opt,name=nickname,proto3" json:"nickname,omitempty"` - AvatarUrl string `protobuf:"bytes,7,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` - Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` - Password string `protobuf:"bytes,9,opt,name=password,proto3" json:"password,omitempty"` - State State `protobuf:"varint,10,opt,name=state,proto3,enum=memos.api.v1.State" json:"state,omitempty"` - CreateTime *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - UpdateTime *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + // The resource name of the user. + // Format: users/{user} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Output only. The system generated unique identifier. + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"` + // The role of the user. + Role User_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.v1.User_Role" json:"role,omitempty"` + // Required. The unique username for login. + Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` + // Optional. The email address of the user. + Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"` + // Optional. The display name of the user. + DisplayName string `protobuf:"bytes,6,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + // Optional. The avatar URL of the user. + AvatarUrl string `protobuf:"bytes,7,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` + // Optional. The description of the user. + Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` + // Input only. The password for the user. + Password string `protobuf:"bytes,9,opt,name=password,proto3" json:"password,omitempty"` + // The state of the user. + State State `protobuf:"varint,10,opt,name=state,proto3,enum=memos.api.v1.State" json:"state,omitempty"` + // Output only. The creation timestamp. + CreateTime *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + // Output only. The last update timestamp. + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` + // Output only. The etag for this resource. + Etag string `protobuf:"bytes,13,opt,name=etag,proto3" json:"etag,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -134,6 +153,13 @@ func (x *User) GetName() string { return "" } +func (x *User) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + func (x *User) GetRole() User_Role { if x != nil { return x.Role @@ -155,9 +181,9 @@ func (x *User) GetEmail() string { return "" } -func (x *User) GetNickname() string { +func (x *User) GetDisplayName() string { if x != nil { - return x.Nickname + return x.DisplayName } return "" } @@ -204,8 +230,33 @@ func (x *User) GetUpdateTime() *timestamppb.Timestamp { return nil } +func (x *User) GetEtag() string { + if x != nil { + return x.Etag + } + return "" +} + type ListUsersRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` + state protoimpl.MessageState `protogen:"open.v1"` + // Optional. The maximum number of users to return. + // The service may return fewer than this value. + // If unspecified, at most 50 users will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token, received from a previous `ListUsers` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + // Optional. Filter to apply to the list results. + // Example: "state=ACTIVE" or "role=USER" or "email:@example.com" + // Supported operators: =, !=, <, <=, >, >=, : + // Supported fields: username, email, role, state, create_time, update_time + Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` + // Optional. The order to sort results by. + // Example: "create_time desc" or "username asc" + OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` + // Optional. If true, show deleted users in the response. + ShowDeleted bool `protobuf:"varint,5,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -240,9 +291,50 @@ func (*ListUsersRequest) Descriptor() ([]byte, []int) { return file_api_v1_user_service_proto_rawDescGZIP(), []int{1} } +func (x *ListUsersRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUsersRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +func (x *ListUsersRequest) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +func (x *ListUsersRequest) GetOrderBy() string { + if x != nil { + return x.OrderBy + } + return "" +} + +func (x *ListUsersRequest) GetShowDeleted() bool { + if x != nil { + return x.ShowDeleted + } + return false +} + type ListUsersResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // The list of users. + Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + // The total count of users (may be approximate). + TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -284,10 +376,28 @@ func (x *ListUsersResponse) GetUsers() []*User { return nil } +func (x *ListUsersResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +func (x *ListUsersResponse) GetTotalSize() int32 { + if x != nil { + return x.TotalSize + } + return 0 +} + type GetUserRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Required. The resource name of the user. + // Format: users/{user} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Optional. The fields to return in the response. + // If not specified, all fields are returned. + ReadMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=read_mask,json=readMask,proto3" json:"read_mask,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -329,28 +439,44 @@ func (x *GetUserRequest) GetName() string { return "" } -type GetUserByUsernameRequest struct { +func (x *GetUserRequest) GetReadMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.ReadMask + } + return nil +} + +type CreateUserRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The username of the user. - Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + // Required. The user to create. + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + // Optional. The user ID to use for this user. + // If empty, a unique ID will be generated. + // Must match the pattern [a-z0-9-]+ + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + // Optional. If set, validate the request but don't actually create the user. + ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"` + // Optional. An idempotency token that can be used to ensure that multiple + // requests to create a user have the same result. + RequestId string `protobuf:"bytes,4,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *GetUserByUsernameRequest) Reset() { - *x = GetUserByUsernameRequest{} +func (x *CreateUserRequest) Reset() { + *x = CreateUserRequest{} mi := &file_api_v1_user_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GetUserByUsernameRequest) String() string { +func (x *CreateUserRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetUserByUsernameRequest) ProtoMessage() {} +func (*CreateUserRequest) ProtoMessage() {} -func (x *GetUserByUsernameRequest) ProtoReflect() protoreflect.Message { +func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { mi := &file_api_v1_user_service_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -362,42 +488,65 @@ func (x *GetUserByUsernameRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetUserByUsernameRequest.ProtoReflect.Descriptor instead. -func (*GetUserByUsernameRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead. +func (*CreateUserRequest) Descriptor() ([]byte, []int) { return file_api_v1_user_service_proto_rawDescGZIP(), []int{4} } -func (x *GetUserByUsernameRequest) GetUsername() string { +func (x *CreateUserRequest) GetUser() *User { if x != nil { - return x.Username + return x.User + } + return nil +} + +func (x *CreateUserRequest) GetUserId() string { + if x != nil { + return x.UserId } return "" } -type GetUserAvatarBinaryRequest struct { +func (x *CreateUserRequest) GetValidateOnly() bool { + if x != nil { + return x.ValidateOnly + } + return false +} + +func (x *CreateUserRequest) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +type UpdateUserRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The raw HTTP body is bound to this field. - HttpBody *httpbody.HttpBody `protobuf:"bytes,2,opt,name=http_body,json=httpBody,proto3" json:"http_body,omitempty"` + // Required. The user to update. + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + // Required. The list of fields to update. + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` + // Optional. If set to true, allows updating sensitive fields. + AllowMissing bool `protobuf:"varint,3,opt,name=allow_missing,json=allowMissing,proto3" json:"allow_missing,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *GetUserAvatarBinaryRequest) Reset() { - *x = GetUserAvatarBinaryRequest{} +func (x *UpdateUserRequest) Reset() { + *x = UpdateUserRequest{} mi := &file_api_v1_user_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GetUserAvatarBinaryRequest) String() string { +func (x *UpdateUserRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetUserAvatarBinaryRequest) ProtoMessage() {} +func (*UpdateUserRequest) ProtoMessage() {} -func (x *GetUserAvatarBinaryRequest) ProtoReflect() protoreflect.Message { +func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { mi := &file_api_v1_user_service_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -409,46 +558,57 @@ func (x *GetUserAvatarBinaryRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetUserAvatarBinaryRequest.ProtoReflect.Descriptor instead. -func (*GetUserAvatarBinaryRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserRequest) Descriptor() ([]byte, []int) { return file_api_v1_user_service_proto_rawDescGZIP(), []int{5} } -func (x *GetUserAvatarBinaryRequest) GetName() string { +func (x *UpdateUserRequest) GetUser() *User { if x != nil { - return x.Name + return x.User } - return "" + return nil } -func (x *GetUserAvatarBinaryRequest) GetHttpBody() *httpbody.HttpBody { +func (x *UpdateUserRequest) GetUpdateMask() *fieldmaskpb.FieldMask { if x != nil { - return x.HttpBody + return x.UpdateMask } return nil } -type CreateUserRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +func (x *UpdateUserRequest) GetAllowMissing() bool { + if x != nil { + return x.AllowMissing + } + return false +} + +type DeleteUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the user to delete. + // Format: users/{user} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Optional. If set to true, the user will be deleted even if they have associated data. + Force bool `protobuf:"varint,2,opt,name=force,proto3" json:"force,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *CreateUserRequest) Reset() { - *x = CreateUserRequest{} +func (x *DeleteUserRequest) Reset() { + *x = DeleteUserRequest{} mi := &file_api_v1_user_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *CreateUserRequest) String() string { +func (x *DeleteUserRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateUserRequest) ProtoMessage() {} +func (*DeleteUserRequest) ProtoMessage() {} -func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { +func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { mi := &file_api_v1_user_service_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -460,40 +620,51 @@ func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead. -func (*CreateUserRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserRequest) Descriptor() ([]byte, []int) { return file_api_v1_user_service_proto_rawDescGZIP(), []int{6} } -func (x *CreateUserRequest) GetUser() *User { +func (x *DeleteUserRequest) GetName() string { if x != nil { - return x.User + return x.Name } - return nil + return "" } -type UpdateUserRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` +func (x *DeleteUserRequest) GetForce() bool { + if x != nil { + return x.Force + } + return false +} + +type SearchUsersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The search query. + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + // Optional. The maximum number of users to return. + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token for pagination. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *UpdateUserRequest) Reset() { - *x = UpdateUserRequest{} +func (x *SearchUsersRequest) Reset() { + *x = SearchUsersRequest{} mi := &file_api_v1_user_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *UpdateUserRequest) String() string { +func (x *SearchUsersRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*UpdateUserRequest) ProtoMessage() {} +func (*SearchUsersRequest) ProtoMessage() {} -func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { +func (x *SearchUsersRequest) ProtoReflect() protoreflect.Message { mi := &file_api_v1_user_service_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -505,47 +676,58 @@ func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead. -func (*UpdateUserRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use SearchUsersRequest.ProtoReflect.Descriptor instead. +func (*SearchUsersRequest) Descriptor() ([]byte, []int) { return file_api_v1_user_service_proto_rawDescGZIP(), []int{7} } -func (x *UpdateUserRequest) GetUser() *User { +func (x *SearchUsersRequest) GetQuery() string { if x != nil { - return x.User + return x.Query } - return nil + return "" } -func (x *UpdateUserRequest) GetUpdateMask() *fieldmaskpb.FieldMask { +func (x *SearchUsersRequest) GetPageSize() int32 { if x != nil { - return x.UpdateMask + return x.PageSize } - return nil + return 0 } -type DeleteUserRequest struct { +func (x *SearchUsersRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type SearchUsersResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The list of users matching the search query. + Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` + // A token for the next page of results. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + // The total count of matching users. + TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *DeleteUserRequest) Reset() { - *x = DeleteUserRequest{} +func (x *SearchUsersResponse) Reset() { + *x = SearchUsersResponse{} mi := &file_api_v1_user_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *DeleteUserRequest) String() string { +func (x *SearchUsersResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DeleteUserRequest) ProtoMessage() {} +func (*SearchUsersResponse) ProtoMessage() {} -func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { +func (x *SearchUsersResponse) ProtoReflect() protoreflect.Message { mi := &file_api_v1_user_service_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -557,40 +739,101 @@ func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead. -func (*DeleteUserRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use SearchUsersResponse.ProtoReflect.Descriptor instead. +func (*SearchUsersResponse) Descriptor() ([]byte, []int) { return file_api_v1_user_service_proto_rawDescGZIP(), []int{8} } -func (x *DeleteUserRequest) GetName() string { +func (x *SearchUsersResponse) GetUsers() []*User { + if x != nil { + return x.Users + } + return nil +} + +func (x *SearchUsersResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +func (x *SearchUsersResponse) GetTotalSize() int32 { + if x != nil { + return x.TotalSize + } + return 0 +} + +type GetUserAvatarRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The resource name of the user. + // Format: users/{user} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserAvatarRequest) Reset() { + *x = GetUserAvatarRequest{} + mi := &file_api_v1_user_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserAvatarRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserAvatarRequest) ProtoMessage() {} + +func (x *GetUserAvatarRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_user_service_proto_msgTypes[9] + 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 GetUserAvatarRequest.ProtoReflect.Descriptor instead. +func (*GetUserAvatarRequest) Descriptor() ([]byte, []int) { + return file_api_v1_user_service_proto_rawDescGZIP(), []int{9} +} + +func (x *GetUserAvatarRequest) GetName() string { if x != nil { return x.Name } return "" } +// User statistics messages type UserStats struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. + // The resource name of the user whose stats these are. + // Format: users/{user} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The timestamps when the memos were displayed. - // We should return raw data to the client, and let the client format the data with the user's timezone. MemoDisplayTimestamps []*timestamppb.Timestamp `protobuf:"bytes,2,rep,name=memo_display_timestamps,json=memoDisplayTimestamps,proto3" json:"memo_display_timestamps,omitempty"` // The stats of memo types. MemoTypeStats *UserStats_MemoTypeStats `protobuf:"bytes,3,opt,name=memo_type_stats,json=memoTypeStats,proto3" json:"memo_type_stats,omitempty"` // The count of tags. - // Format: "tag1": 1, "tag2": 2 TagCount map[string]int32 `protobuf:"bytes,4,rep,name=tag_count,json=tagCount,proto3" json:"tag_count,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` // The pinned memos of the user. - PinnedMemos []string `protobuf:"bytes,5,rep,name=pinned_memos,json=pinnedMemos,proto3" json:"pinned_memos,omitempty"` - TotalMemoCount int32 `protobuf:"varint,6,opt,name=total_memo_count,json=totalMemoCount,proto3" json:"total_memo_count,omitempty"` + PinnedMemos []string `protobuf:"bytes,5,rep,name=pinned_memos,json=pinnedMemos,proto3" json:"pinned_memos,omitempty"` + // Total memo count. + TotalMemoCount int32 `protobuf:"varint,6,opt,name=total_memo_count,json=totalMemoCount,proto3" json:"total_memo_count,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *UserStats) Reset() { *x = UserStats{} - mi := &file_api_v1_user_service_proto_msgTypes[9] + mi := &file_api_v1_user_service_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -602,7 +845,7 @@ func (x *UserStats) String() string { func (*UserStats) ProtoMessage() {} func (x *UserStats) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[9] + mi := &file_api_v1_user_service_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -615,7 +858,7 @@ func (x *UserStats) ProtoReflect() protoreflect.Message { // Deprecated: Use UserStats.ProtoReflect.Descriptor instead. func (*UserStats) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{9} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{10} } func (x *UserStats) GetName() string { @@ -660,89 +903,10 @@ func (x *UserStats) GetTotalMemoCount() int32 { return 0 } -type ListAllUserStatsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListAllUserStatsRequest) Reset() { - *x = ListAllUserStatsRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListAllUserStatsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAllUserStatsRequest) ProtoMessage() {} - -func (x *ListAllUserStatsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[10] - 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 ListAllUserStatsRequest.ProtoReflect.Descriptor instead. -func (*ListAllUserStatsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{10} -} - -type ListAllUserStatsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserStats []*UserStats `protobuf:"bytes,1,rep,name=user_stats,json=userStats,proto3" json:"user_stats,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListAllUserStatsResponse) Reset() { - *x = ListAllUserStatsResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListAllUserStatsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAllUserStatsResponse) ProtoMessage() {} - -func (x *ListAllUserStatsResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[11] - 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 ListAllUserStatsResponse.ProtoReflect.Descriptor instead. -func (*ListAllUserStatsResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{11} -} - -func (x *ListAllUserStatsResponse) GetUserStats() []*UserStats { - if x != nil { - return x.UserStats - } - return nil -} - type GetUserStatsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. + // Required. The resource name of the user. + // Format: users/{user} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -750,7 +914,7 @@ type GetUserStatsRequest struct { func (x *GetUserStatsRequest) Reset() { *x = GetUserStatsRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[12] + mi := &file_api_v1_user_service_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -762,7 +926,7 @@ func (x *GetUserStatsRequest) String() string { func (*GetUserStatsRequest) ProtoMessage() {} func (x *GetUserStatsRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[12] + mi := &file_api_v1_user_service_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -775,7 +939,7 @@ func (x *GetUserStatsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetUserStatsRequest.ProtoReflect.Descriptor instead. func (*GetUserStatsRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{12} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{11} } func (x *GetUserStatsRequest) GetName() string { @@ -785,9 +949,11 @@ func (x *GetUserStatsRequest) GetName() string { return "" } +// User settings message type UserSetting struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. + // The resource name of the user whose setting this is. + // Format: users/{user} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The preferred locale of the user. Locale string `protobuf:"bytes,2,opt,name=locale,proto3" json:"locale,omitempty"` @@ -801,7 +967,7 @@ type UserSetting struct { func (x *UserSetting) Reset() { *x = UserSetting{} - mi := &file_api_v1_user_service_proto_msgTypes[13] + mi := &file_api_v1_user_service_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -813,7 +979,7 @@ func (x *UserSetting) String() string { func (*UserSetting) ProtoMessage() {} func (x *UserSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[13] + mi := &file_api_v1_user_service_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -826,7 +992,7 @@ func (x *UserSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use UserSetting.ProtoReflect.Descriptor instead. func (*UserSetting) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{13} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{12} } func (x *UserSetting) GetName() string { @@ -859,7 +1025,8 @@ func (x *UserSetting) GetMemoVisibility() string { type GetUserSettingRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. + // Required. The resource name of the user. + // Format: users/{user} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -867,7 +1034,7 @@ type GetUserSettingRequest struct { func (x *GetUserSettingRequest) Reset() { *x = GetUserSettingRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[14] + mi := &file_api_v1_user_service_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -879,7 +1046,7 @@ func (x *GetUserSettingRequest) String() string { func (*GetUserSettingRequest) ProtoMessage() {} func (x *GetUserSettingRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[14] + mi := &file_api_v1_user_service_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -892,7 +1059,7 @@ func (x *GetUserSettingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetUserSettingRequest.ProtoReflect.Descriptor instead. func (*GetUserSettingRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{14} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{13} } func (x *GetUserSettingRequest) GetName() string { @@ -903,8 +1070,10 @@ func (x *GetUserSettingRequest) GetName() string { } type UpdateUserSettingRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Setting *UserSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // Required. The user setting to update. + Setting *UserSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"` + // Required. The list of fields to update. UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -912,7 +1081,7 @@ type UpdateUserSettingRequest struct { func (x *UpdateUserSettingRequest) Reset() { *x = UpdateUserSettingRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[15] + mi := &file_api_v1_user_service_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -924,7 +1093,7 @@ func (x *UpdateUserSettingRequest) String() string { func (*UpdateUserSettingRequest) ProtoMessage() {} func (x *UpdateUserSettingRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[15] + mi := &file_api_v1_user_service_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -937,7 +1106,7 @@ func (x *UpdateUserSettingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateUserSettingRequest.ProtoReflect.Descriptor instead. func (*UpdateUserSettingRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{15} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{14} } func (x *UpdateUserSettingRequest) GetSetting() *UserSetting { @@ -954,19 +1123,27 @@ func (x *UpdateUserSettingRequest) GetUpdateMask() *fieldmaskpb.FieldMask { return nil } +// User access token message type UserAccessToken struct { - state protoimpl.MessageState `protogen:"open.v1"` - AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - IssuedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=issued_at,json=issuedAt,proto3" json:"issued_at,omitempty"` - ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // The resource name of the access token. + // Format: users/{user}/accessTokens/{access_token} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Output only. The access token value. + AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + // The description of the access token. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // Output only. The issued timestamp. + IssuedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=issued_at,json=issuedAt,proto3" json:"issued_at,omitempty"` + // Optional. The expiration timestamp. + ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *UserAccessToken) Reset() { *x = UserAccessToken{} - mi := &file_api_v1_user_service_proto_msgTypes[16] + mi := &file_api_v1_user_service_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -978,7 +1155,7 @@ func (x *UserAccessToken) String() string { func (*UserAccessToken) ProtoMessage() {} func (x *UserAccessToken) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[16] + mi := &file_api_v1_user_service_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -991,7 +1168,14 @@ func (x *UserAccessToken) ProtoReflect() protoreflect.Message { // Deprecated: Use UserAccessToken.ProtoReflect.Descriptor instead. func (*UserAccessToken) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{16} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{15} +} + +func (x *UserAccessToken) GetName() string { + if x != nil { + return x.Name + } + return "" } func (x *UserAccessToken) GetAccessToken() string { @@ -1024,15 +1208,20 @@ func (x *UserAccessToken) GetExpiresAt() *timestamppb.Timestamp { type ListUserAccessTokensRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Required. The parent resource whose access tokens will be listed. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Optional. The maximum number of access tokens to return. + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token for pagination. + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *ListUserAccessTokensRequest) Reset() { *x = ListUserAccessTokensRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[17] + mi := &file_api_v1_user_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1044,7 +1233,7 @@ func (x *ListUserAccessTokensRequest) String() string { func (*ListUserAccessTokensRequest) ProtoMessage() {} func (x *ListUserAccessTokensRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[17] + mi := &file_api_v1_user_service_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1057,26 +1246,45 @@ func (x *ListUserAccessTokensRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListUserAccessTokensRequest.ProtoReflect.Descriptor instead. func (*ListUserAccessTokensRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{17} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{16} } -func (x *ListUserAccessTokensRequest) GetName() string { +func (x *ListUserAccessTokensRequest) GetParent() string { if x != nil { - return x.Name + return x.Parent + } + return "" +} + +func (x *ListUserAccessTokensRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListUserAccessTokensRequest) GetPageToken() string { + if x != nil { + return x.PageToken } return "" } type ListUserAccessTokensResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - AccessTokens []*UserAccessToken `protobuf:"bytes,1,rep,name=access_tokens,json=accessTokens,proto3" json:"access_tokens,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // The list of access tokens. + AccessTokens []*UserAccessToken `protobuf:"bytes,1,rep,name=access_tokens,json=accessTokens,proto3" json:"access_tokens,omitempty"` + // A token for the next page of results. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + // The total count of access tokens. + TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *ListUserAccessTokensResponse) Reset() { *x = ListUserAccessTokensResponse{} - mi := &file_api_v1_user_service_proto_msgTypes[18] + mi := &file_api_v1_user_service_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1088,7 +1296,7 @@ func (x *ListUserAccessTokensResponse) String() string { func (*ListUserAccessTokensResponse) ProtoMessage() {} func (x *ListUserAccessTokensResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[18] + mi := &file_api_v1_user_service_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1101,7 +1309,7 @@ func (x *ListUserAccessTokensResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListUserAccessTokensResponse.ProtoReflect.Descriptor instead. func (*ListUserAccessTokensResponse) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{18} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{17} } func (x *ListUserAccessTokensResponse) GetAccessTokens() []*UserAccessToken { @@ -1111,19 +1319,36 @@ func (x *ListUserAccessTokensResponse) GetAccessTokens() []*UserAccessToken { return nil } +func (x *ListUserAccessTokensResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +func (x *ListUserAccessTokensResponse) GetTotalSize() int32 { + if x != nil { + return x.TotalSize + } + return 0 +} + type CreateUserAccessTokenRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expires_at,json=expiresAt,proto3,oneof" json:"expires_at,omitempty"` + // Required. The parent resource where this access token will be created. + // Format: users/{user} + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // Required. The access token to create. + AccessToken *UserAccessToken `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + // Optional. The access token ID to use. + AccessTokenId string `protobuf:"bytes,3,opt,name=access_token_id,json=accessTokenId,proto3" json:"access_token_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *CreateUserAccessTokenRequest) Reset() { *x = CreateUserAccessTokenRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[19] + mi := &file_api_v1_user_service_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1135,7 +1360,7 @@ func (x *CreateUserAccessTokenRequest) String() string { func (*CreateUserAccessTokenRequest) ProtoMessage() {} func (x *CreateUserAccessTokenRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[19] + mi := &file_api_v1_user_service_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1148,43 +1373,42 @@ func (x *CreateUserAccessTokenRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateUserAccessTokenRequest.ProtoReflect.Descriptor instead. func (*CreateUserAccessTokenRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{19} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{18} } -func (x *CreateUserAccessTokenRequest) GetName() string { +func (x *CreateUserAccessTokenRequest) GetParent() string { if x != nil { - return x.Name + return x.Parent } return "" } -func (x *CreateUserAccessTokenRequest) GetDescription() string { +func (x *CreateUserAccessTokenRequest) GetAccessToken() *UserAccessToken { if x != nil { - return x.Description + return x.AccessToken } - return "" + return nil } -func (x *CreateUserAccessTokenRequest) GetExpiresAt() *timestamppb.Timestamp { +func (x *CreateUserAccessTokenRequest) GetAccessTokenId() string { if x != nil { - return x.ExpiresAt + return x.AccessTokenId } - return nil + return "" } type DeleteUserAccessTokenRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // The name of the user. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // access_token is the access token to delete. - AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + // Required. The resource name of the access token to delete. + // Format: users/{user}/accessTokens/{access_token} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *DeleteUserAccessTokenRequest) Reset() { *x = DeleteUserAccessTokenRequest{} - mi := &file_api_v1_user_service_proto_msgTypes[20] + mi := &file_api_v1_user_service_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1196,7 +1420,7 @@ func (x *DeleteUserAccessTokenRequest) String() string { func (*DeleteUserAccessTokenRequest) ProtoMessage() {} func (x *DeleteUserAccessTokenRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[20] + mi := &file_api_v1_user_service_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1209,7 +1433,7 @@ func (x *DeleteUserAccessTokenRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteUserAccessTokenRequest.ProtoReflect.Descriptor instead. func (*DeleteUserAccessTokenRequest) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{20} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{19} } func (x *DeleteUserAccessTokenRequest) GetName() string { @@ -1219,13 +1443,124 @@ func (x *DeleteUserAccessTokenRequest) GetName() string { return "" } -func (x *DeleteUserAccessTokenRequest) GetAccessToken() string { +type ListAllUserStatsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Optional. The maximum number of user stats to return. + PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. A page token for pagination. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListAllUserStatsRequest) Reset() { + *x = ListAllUserStatsRequest{} + mi := &file_api_v1_user_service_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAllUserStatsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAllUserStatsRequest) ProtoMessage() {} + +func (x *ListAllUserStatsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_user_service_proto_msgTypes[20] if x != nil { - return x.AccessToken + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListAllUserStatsRequest.ProtoReflect.Descriptor instead. +func (*ListAllUserStatsRequest) Descriptor() ([]byte, []int) { + return file_api_v1_user_service_proto_rawDescGZIP(), []int{20} +} + +func (x *ListAllUserStatsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListAllUserStatsRequest) GetPageToken() string { + if x != nil { + return x.PageToken } return "" } +type ListAllUserStatsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The list of user statistics. + UserStats []*UserStats `protobuf:"bytes,1,rep,name=user_stats,json=userStats,proto3" json:"user_stats,omitempty"` + // A token for the next page of results. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + // The total count of user statistics. + TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListAllUserStatsResponse) Reset() { + *x = ListAllUserStatsResponse{} + mi := &file_api_v1_user_service_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAllUserStatsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAllUserStatsResponse) ProtoMessage() {} + +func (x *ListAllUserStatsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_user_service_proto_msgTypes[21] + 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 ListAllUserStatsResponse.ProtoReflect.Descriptor instead. +func (*ListAllUserStatsResponse) Descriptor() ([]byte, []int) { + return file_api_v1_user_service_proto_rawDescGZIP(), []int{21} +} + +func (x *ListAllUserStatsResponse) GetUserStats() []*UserStats { + if x != nil { + return x.UserStats + } + return nil +} + +func (x *ListAllUserStatsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +func (x *ListAllUserStatsResponse) GetTotalSize() int32 { + if x != nil { + return x.TotalSize + } + return 0 +} + +// Memo type statistics. type UserStats_MemoTypeStats struct { state protoimpl.MessageState `protogen:"open.v1"` LinkCount int32 `protobuf:"varint,1,opt,name=link_count,json=linkCount,proto3" json:"link_count,omitempty"` @@ -1238,7 +1573,7 @@ type UserStats_MemoTypeStats struct { func (x *UserStats_MemoTypeStats) Reset() { *x = UserStats_MemoTypeStats{} - mi := &file_api_v1_user_service_proto_msgTypes[22] + mi := &file_api_v1_user_service_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1250,7 +1585,7 @@ func (x *UserStats_MemoTypeStats) String() string { func (*UserStats_MemoTypeStats) ProtoMessage() {} func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[22] + mi := &file_api_v1_user_service_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1263,7 +1598,7 @@ func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message { // Deprecated: Use UserStats_MemoTypeStats.ProtoReflect.Descriptor instead. func (*UserStats_MemoTypeStats) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{9, 1} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{10, 1} } func (x *UserStats_MemoTypeStats) GetLinkCount() int32 { @@ -1298,48 +1633,77 @@ var File_api_v1_user_service_proto protoreflect.FileDescriptor const file_api_v1_user_service_proto_rawDesc = "" + "\n" + - "\x19api/v1/user_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xeb\x03\n" + - "\x04User\x12\x1a\n" + - "\x04name\x18\x01 \x01(\tB\x06\xe0A\x03\xe0A\bR\x04name\x12+\n" + - "\x04role\x18\x03 \x01(\x0e2\x17.memos.api.v1.User.RoleR\x04role\x12\x1a\n" + - "\busername\x18\x04 \x01(\tR\busername\x12\x14\n" + - "\x05email\x18\x05 \x01(\tR\x05email\x12\x1a\n" + - "\bnickname\x18\x06 \x01(\tR\bnickname\x12\x1d\n" + + "\x19api/v1/user_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xfb\x04\n" + + "\x04User\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x15\n" + + "\x03uid\x18\x02 \x01(\tB\x03\xe0A\x03R\x03uid\x120\n" + + "\x04role\x18\x03 \x01(\x0e2\x17.memos.api.v1.User.RoleB\x03\xe0A\x02R\x04role\x12\x1f\n" + + "\busername\x18\x04 \x01(\tB\x03\xe0A\x02R\busername\x12\x19\n" + + "\x05email\x18\x05 \x01(\tB\x03\xe0A\x01R\x05email\x12&\n" + + "\fdisplay_name\x18\x06 \x01(\tB\x03\xe0A\x01R\vdisplayName\x12\"\n" + "\n" + - "avatar_url\x18\a \x01(\tR\tavatarUrl\x12 \n" + - "\vdescription\x18\b \x01(\tR\vdescription\x12\x1f\n" + - "\bpassword\x18\t \x01(\tB\x03\xe0A\x04R\bpassword\x12)\n" + + "avatar_url\x18\a \x01(\tB\x03\xe0A\x01R\tavatarUrl\x12%\n" + + "\vdescription\x18\b \x01(\tB\x03\xe0A\x01R\vdescription\x12\x1f\n" + + "\bpassword\x18\t \x01(\tB\x03\xe0A\x04R\bpassword\x12.\n" + "\x05state\x18\n" + - " \x01(\x0e2\x13.memos.api.v1.StateR\x05state\x12@\n" + + " \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x02R\x05state\x12@\n" + "\vcreate_time\x18\v \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + "createTime\x12@\n" + "\vupdate_time\x18\f \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + - "updateTime\";\n" + + "updateTime\x12\x17\n" + + "\x04etag\x18\r \x01(\tB\x03\xe0A\x03R\x04etag\";\n" + "\x04Role\x12\x14\n" + "\x10ROLE_UNSPECIFIED\x10\x00\x12\b\n" + "\x04HOST\x10\x01\x12\t\n" + "\x05ADMIN\x10\x02\x12\b\n" + - "\x04USER\x10\x03\"\x12\n" + - "\x10ListUsersRequest\"=\n" + + "\x04USER\x10\x03:7\xeaA4\n" + + "\x11memos.api.v1/User\x12\fusers/{user}\x1a\x04name*\x05users2\x04user\"\xbd\x01\n" + + "\x10ListUsersRequest\x12 \n" + + "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + + "\n" + + "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1b\n" + + "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x01R\x06filter\x12\x1e\n" + + "\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderBy\x12&\n" + + "\fshow_deleted\x18\x05 \x01(\bB\x03\xe0A\x01R\vshowDeleted\"\x84\x01\n" + "\x11ListUsersResponse\x12(\n" + - "\x05users\x18\x01 \x03(\v2\x12.memos.api.v1.UserR\x05users\"$\n" + - "\x0eGetUserRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\"6\n" + - "\x18GetUserByUsernameRequest\x12\x1a\n" + - "\busername\x18\x01 \x01(\tR\busername\"c\n" + - "\x1aGetUserAvatarBinaryRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\x121\n" + - "\thttp_body\x18\x02 \x01(\v2\x14.google.api.HttpBodyR\bhttpBody\";\n" + - "\x11CreateUserRequest\x12&\n" + - "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserR\x04user\"}\n" + + "\x05users\x18\x01 \x03(\v2\x12.memos.api.v1.UserR\x05users\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" + + "\n" + + "total_size\x18\x03 \x01(\x05R\ttotalSize\"}\n" + + "\x0eGetUserRequest\x12-\n" + + "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + + "\x11memos.api.v1/UserR\x04name\x12<\n" + + "\tread_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\breadMask\"\xaf\x01\n" + + "\x11CreateUserRequest\x12.\n" + + "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserB\x06\xe0A\x02\xe0A\x04R\x04user\x12\x1c\n" + + "\auser_id\x18\x02 \x01(\tB\x03\xe0A\x01R\x06userId\x12(\n" + + "\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12\"\n" + + "\n" + + "request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\xac\x01\n" + "\x11UpdateUserRequest\x12+\n" + - "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserB\x03\xe0A\x02R\x04user\x12;\n" + - "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + - "updateMask\"'\n" + - "\x11DeleteUserRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\"\x9e\x04\n" + - "\tUserStats\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\x12R\n" + + "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserB\x03\xe0A\x02R\x04user\x12@\n" + + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + + "updateMask\x12(\n" + + "\rallow_missing\x18\x03 \x01(\bB\x03\xe0A\x01R\fallowMissing\"]\n" + + "\x11DeleteUserRequest\x12-\n" + + "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + + "\x11memos.api.v1/UserR\x04name\x12\x19\n" + + "\x05force\x18\x02 \x01(\bB\x03\xe0A\x01R\x05force\"u\n" + + "\x12SearchUsersRequest\x12\x19\n" + + "\x05query\x18\x01 \x01(\tB\x03\xe0A\x02R\x05query\x12 \n" + + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + + "\n" + + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x86\x01\n" + + "\x13SearchUsersResponse\x12(\n" + + "\x05users\x18\x01 \x03(\v2\x12.memos.api.v1.UserR\x05users\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" + + "\n" + + "total_size\x18\x03 \x01(\x05R\ttotalSize\"E\n" + + "\x14GetUserAvatarRequest\x12-\n" + + "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + + "\x11memos.api.v1/UserR\x04name\"\xe4\x04\n" + + "\tUserStats\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12R\n" + "\x17memo_display_timestamps\x18\x02 \x03(\v2\x1a.google.protobuf.TimestampR\x15memoDisplayTimestamps\x12M\n" + "\x0fmemo_type_stats\x18\x03 \x01(\v2%.memos.api.v1.UserStats.MemoTypeStatsR\rmemoTypeStats\x12B\n" + "\ttag_count\x18\x04 \x03(\v2%.memos.api.v1.UserStats.TagCountEntryR\btagCount\x12!\n" + @@ -1356,63 +1720,81 @@ const file_api_v1_user_service_proto_rawDesc = "" + "\n" + "todo_count\x18\x03 \x01(\x05R\ttodoCount\x12\x1d\n" + "\n" + - "undo_count\x18\x04 \x01(\x05R\tundoCount\"\x19\n" + - "\x17ListAllUserStatsRequest\"R\n" + - "\x18ListAllUserStatsResponse\x126\n" + - "\n" + - "user_stats\x18\x01 \x03(\v2\x17.memos.api.v1.UserStatsR\tuserStats\")\n" + - "\x13GetUserStatsRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\"\x82\x01\n" + - "\vUserSetting\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + - "\x06locale\x18\x02 \x01(\tR\x06locale\x12\x1e\n" + + "undo_count\x18\x04 \x01(\x05R\tundoCount:?\xeaA<\n" + + "\x16memos.api.v1/UserStats\x12\fusers/{user}*\tuserStats2\tuserStats\"D\n" + + "\x13GetUserStatsRequest\x12-\n" + + "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + + "\x11memos.api.v1/UserR\x04name\"\xde\x01\n" + + "\vUserSetting\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x1b\n" + + "\x06locale\x18\x02 \x01(\tB\x03\xe0A\x01R\x06locale\x12#\n" + "\n" + - "appearance\x18\x03 \x01(\tR\n" + - "appearance\x12'\n" + - "\x0fmemo_visibility\x18\x04 \x01(\tR\x0ememoVisibility\"+\n" + - "\x15GetUserSettingRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\"\x91\x01\n" + + "appearance\x18\x03 \x01(\tB\x03\xe0A\x01R\n" + + "appearance\x12,\n" + + "\x0fmemo_visibility\x18\x04 \x01(\tB\x03\xe0A\x01R\x0ememoVisibility:F\xeaAC\n" + + "\x18memos.api.v1/UserSetting\x12\fusers/{user}*\fuserSettings2\vuserSetting\"F\n" + + "\x15GetUserSettingRequest\x12-\n" + + "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + + "\x11memos.api.v1/UserR\x04name\"\x96\x01\n" + "\x18UpdateUserSettingRequest\x128\n" + - "\asetting\x18\x01 \x01(\v2\x19.memos.api.v1.UserSettingB\x03\xe0A\x02R\asetting\x12;\n" + - "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + - "updateMask\"\xca\x01\n" + - "\x0fUserAccessToken\x12!\n" + - "\faccess_token\x18\x01 \x01(\tR\vaccessToken\x12 \n" + - "\vdescription\x18\x02 \x01(\tR\vdescription\x127\n" + - "\tissued_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\bissuedAt\x129\n" + + "\asetting\x18\x01 \x01(\v2\x19.memos.api.v1.UserSettingB\x03\xe0A\x02R\asetting\x12@\n" + + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + + "updateMask\"\xe7\x02\n" + + "\x0fUserAccessToken\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12&\n" + + "\faccess_token\x18\x02 \x01(\tB\x03\xe0A\x03R\vaccessToken\x12%\n" + + "\vdescription\x18\x03 \x01(\tB\x03\xe0A\x01R\vdescription\x12<\n" + + "\tissued_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\bissuedAt\x12>\n" + "\n" + - "expires_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\"1\n" + - "\x1bListUserAccessTokensRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\"b\n" + + "expires_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x01R\texpiresAt:n\xeaAk\n" + + "\x1cmemos.api.v1/UserAccessToken\x12(users/{user}/accessTokens/{access_token}*\x10userAccessTokens2\x0fuserAccessToken\"\x96\x01\n" + + "\x1bListUserAccessTokensRequest\x121\n" + + "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + + "\x11memos.api.v1/UserR\x06parent\x12 \n" + + "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + + "\n" + + "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\xa9\x01\n" + "\x1cListUserAccessTokensResponse\x12B\n" + - "\raccess_tokens\x18\x01 \x03(\v2\x1d.memos.api.v1.UserAccessTokenR\faccessTokens\"\xa3\x01\n" + - "\x1cCreateUserAccessTokenRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\x12 \n" + - "\vdescription\x18\x02 \x01(\tR\vdescription\x12>\n" + + "\raccess_tokens\x18\x01 \x03(\v2\x1d.memos.api.v1.UserAccessTokenR\faccessTokens\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" + + "\n" + + "total_size\x18\x03 \x01(\x05R\ttotalSize\"\xc5\x01\n" + + "\x1cCreateUserAccessTokenRequest\x121\n" + + "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" + + "\x11memos.api.v1/UserR\x06parent\x12E\n" + + "\faccess_token\x18\x02 \x01(\v2\x1d.memos.api.v1.UserAccessTokenB\x03\xe0A\x02R\vaccessToken\x12+\n" + + "\x0faccess_token_id\x18\x03 \x01(\tB\x03\xe0A\x01R\raccessTokenId\"X\n" + + "\x1cDeleteUserAccessTokenRequest\x128\n" + + "\x04name\x18\x01 \x01(\tB$\xe0A\x02\xfaA\x1e\n" + + "\x1cmemos.api.v1/UserAccessTokenR\x04name\"_\n" + + "\x17ListAllUserStatsRequest\x12 \n" + + "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + + "\n" + + "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x99\x01\n" + + "\x18ListAllUserStatsResponse\x126\n" + + "\n" + + "user_stats\x18\x01 \x03(\v2\x17.memos.api.v1.UserStatsR\tuserStats\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" + "\n" + - "expires_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampH\x00R\texpiresAt\x88\x01\x01B\r\n" + - "\v_expires_at\"U\n" + - "\x1cDeleteUserAccessTokenRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\x12!\n" + - "\faccess_token\x18\x02 \x01(\tR\vaccessToken2\xc2\x0e\n" + + "total_size\x18\x03 \x01(\x05R\ttotalSize2\xc2\x0e\n" + "\vUserService\x12c\n" + "\tListUsers\x12\x1e.memos.api.v1.ListUsersRequest\x1a\x1f.memos.api.v1.ListUsersResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/api/v1/users\x12b\n" + - "\aGetUser\x12\x1c.memos.api.v1.GetUserRequest\x1a\x12.memos.api.v1.User\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18\x12\x16/api/v1/{name=users/*}\x12z\n" + - "\x11GetUserByUsername\x12&.memos.api.v1.GetUserByUsernameRequest\x1a\x12.memos.api.v1.User\")\xdaA\busername\x82\xd3\xe4\x93\x02\x18\x12\x16/api/v1/users:username\x12\x81\x01\n" + - "\x13GetUserAvatarBinary\x12(.memos.api.v1.GetUserAvatarBinaryRequest\x1a\x14.google.api.HttpBody\"*\xdaA\x04name\x82\xd3\xe4\x93\x02\x1d\x12\x1b/file/{name=users/*}/avatar\x12e\n" + + "\aGetUser\x12\x1c.memos.api.v1.GetUserRequest\x1a\x12.memos.api.v1.User\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18\x12\x16/api/v1/{name=users/*}\x12e\n" + "\n" + "CreateUser\x12\x1f.memos.api.v1.CreateUserRequest\x1a\x12.memos.api.v1.User\"\"\xdaA\x04user\x82\xd3\xe4\x93\x02\x15:\x04user\"\r/api/v1/users\x12\x7f\n" + "\n" + "UpdateUser\x12\x1f.memos.api.v1.UpdateUserRequest\x1a\x12.memos.api.v1.User\"<\xdaA\x10user,update_mask\x82\xd3\xe4\x93\x02#:\x04user2\x1b/api/v1/{user.name=users/*}\x12l\n" + "\n" + - "DeleteUser\x12\x1f.memos.api.v1.DeleteUserRequest\x1a\x16.google.protobuf.Empty\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18*\x16/api/v1/{name=users/*}\x12\x80\x01\n" + - "\x10ListAllUserStats\x12%.memos.api.v1.ListAllUserStatsRequest\x1a&.memos.api.v1.ListAllUserStatsResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x15/api/v1/users/-/stats\x12w\n" + - "\fGetUserStats\x12!.memos.api.v1.GetUserStatsRequest\x1a\x17.memos.api.v1.UserStats\"+\xdaA\x04name\x82\xd3\xe4\x93\x02\x1e\x12\x1c/api/v1/{name=users/*}/stats\x12\x7f\n" + - "\x0eGetUserSetting\x12#.memos.api.v1.GetUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"-\xdaA\x04name\x82\xd3\xe4\x93\x02 \x12\x1e/api/v1/{name=users/*}/setting\x12\xa5\x01\n" + - "\x11UpdateUserSetting\x12&.memos.api.v1.UpdateUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"M\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x021:\asetting2&/api/v1/{setting.name=users/*/setting}\x12\xa2\x01\n" + - "\x14ListUserAccessTokens\x12).memos.api.v1.ListUserAccessTokensRequest\x1a*.memos.api.v1.ListUserAccessTokensResponse\"3\xdaA\x04name\x82\xd3\xe4\x93\x02&\x12$/api/v1/{name=users/*}/access_tokens\x12\x9a\x01\n" + - "\x15CreateUserAccessToken\x12*.memos.api.v1.CreateUserAccessTokenRequest\x1a\x1d.memos.api.v1.UserAccessToken\"6\xdaA\x04name\x82\xd3\xe4\x93\x02):\x01*\"$/api/v1/{name=users/*}/access_tokens\x12\xac\x01\n" + - "\x15DeleteUserAccessToken\x12*.memos.api.v1.DeleteUserAccessTokenRequest\x1a\x16.google.protobuf.Empty\"O\xdaA\x11name,access_token\x82\xd3\xe4\x93\x025*3/api/v1/{name=users/*}/access_tokens/{access_token}B\xa8\x01\n" + + "DeleteUser\x12\x1f.memos.api.v1.DeleteUserRequest\x1a\x16.google.protobuf.Empty\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18*\x16/api/v1/{name=users/*}\x12x\n" + + "\vSearchUsers\x12 .memos.api.v1.SearchUsersRequest\x1a!.memos.api.v1.SearchUsersResponse\"$\xdaA\x05query\x82\xd3\xe4\x93\x02\x16\x12\x14/api/v1/users:search\x12w\n" + + "\rGetUserAvatar\x12\".memos.api.v1.GetUserAvatarRequest\x1a\x14.google.api.HttpBody\",\xdaA\x04name\x82\xd3\xe4\x93\x02\x1f\x12\x1d/api/v1/{name=users/*}/avatar\x12~\n" + + "\x10ListAllUserStats\x12%.memos.api.v1.ListAllUserStatsRequest\x1a&.memos.api.v1.ListAllUserStatsResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/api/v1/users:stats\x12z\n" + + "\fGetUserStats\x12!.memos.api.v1.GetUserStatsRequest\x1a\x17.memos.api.v1.UserStats\".\xdaA\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/api/v1/{name=users/*}:getStats\x12\x82\x01\n" + + "\x0eGetUserSetting\x12#.memos.api.v1.GetUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#\x12!/api/v1/{name=users/*}:getSetting\x12\xab\x01\n" + + "\x11UpdateUserSetting\x12&.memos.api.v1.UpdateUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"S\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x027:\asetting2,/api/v1/{setting.name=users/*}:updateSetting\x12\xa5\x01\n" + + "\x14ListUserAccessTokens\x12).memos.api.v1.ListUserAccessTokensRequest\x1a*.memos.api.v1.ListUserAccessTokensResponse\"6\xdaA\x06parent\x82\xd3\xe4\x93\x02'\x12%/api/v1/{parent=users/*}/accessTokens\x12\xb5\x01\n" + + "\x15CreateUserAccessToken\x12*.memos.api.v1.CreateUserAccessTokenRequest\x1a\x1d.memos.api.v1.UserAccessToken\"Q\xdaA\x13parent,access_token\x82\xd3\xe4\x93\x025:\faccess_token\"%/api/v1/{parent=users/*}/accessTokens\x12\x91\x01\n" + + "\x15DeleteUserAccessToken\x12*.memos.api.v1.DeleteUserAccessTokenRequest\x1a\x16.google.protobuf.Empty\"4\xdaA\x04name\x82\xd3\xe4\x93\x02'*%/api/v1/{name=users/*/accessTokens/*}B\xa8\x01\n" + "\x10com.memos.api.v1B\x10UserServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" var ( @@ -1428,91 +1810,93 @@ func file_api_v1_user_service_proto_rawDescGZIP() []byte { } var file_api_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_api_v1_user_service_proto_goTypes = []any{ (User_Role)(0), // 0: memos.api.v1.User.Role (*User)(nil), // 1: memos.api.v1.User (*ListUsersRequest)(nil), // 2: memos.api.v1.ListUsersRequest (*ListUsersResponse)(nil), // 3: memos.api.v1.ListUsersResponse (*GetUserRequest)(nil), // 4: memos.api.v1.GetUserRequest - (*GetUserByUsernameRequest)(nil), // 5: memos.api.v1.GetUserByUsernameRequest - (*GetUserAvatarBinaryRequest)(nil), // 6: memos.api.v1.GetUserAvatarBinaryRequest - (*CreateUserRequest)(nil), // 7: memos.api.v1.CreateUserRequest - (*UpdateUserRequest)(nil), // 8: memos.api.v1.UpdateUserRequest - (*DeleteUserRequest)(nil), // 9: memos.api.v1.DeleteUserRequest - (*UserStats)(nil), // 10: memos.api.v1.UserStats - (*ListAllUserStatsRequest)(nil), // 11: memos.api.v1.ListAllUserStatsRequest - (*ListAllUserStatsResponse)(nil), // 12: memos.api.v1.ListAllUserStatsResponse - (*GetUserStatsRequest)(nil), // 13: memos.api.v1.GetUserStatsRequest - (*UserSetting)(nil), // 14: memos.api.v1.UserSetting - (*GetUserSettingRequest)(nil), // 15: memos.api.v1.GetUserSettingRequest - (*UpdateUserSettingRequest)(nil), // 16: memos.api.v1.UpdateUserSettingRequest - (*UserAccessToken)(nil), // 17: memos.api.v1.UserAccessToken - (*ListUserAccessTokensRequest)(nil), // 18: memos.api.v1.ListUserAccessTokensRequest - (*ListUserAccessTokensResponse)(nil), // 19: memos.api.v1.ListUserAccessTokensResponse - (*CreateUserAccessTokenRequest)(nil), // 20: memos.api.v1.CreateUserAccessTokenRequest - (*DeleteUserAccessTokenRequest)(nil), // 21: memos.api.v1.DeleteUserAccessTokenRequest - nil, // 22: memos.api.v1.UserStats.TagCountEntry - (*UserStats_MemoTypeStats)(nil), // 23: memos.api.v1.UserStats.MemoTypeStats - (State)(0), // 24: memos.api.v1.State - (*timestamppb.Timestamp)(nil), // 25: google.protobuf.Timestamp - (*httpbody.HttpBody)(nil), // 26: google.api.HttpBody + (*CreateUserRequest)(nil), // 5: memos.api.v1.CreateUserRequest + (*UpdateUserRequest)(nil), // 6: memos.api.v1.UpdateUserRequest + (*DeleteUserRequest)(nil), // 7: memos.api.v1.DeleteUserRequest + (*SearchUsersRequest)(nil), // 8: memos.api.v1.SearchUsersRequest + (*SearchUsersResponse)(nil), // 9: memos.api.v1.SearchUsersResponse + (*GetUserAvatarRequest)(nil), // 10: memos.api.v1.GetUserAvatarRequest + (*UserStats)(nil), // 11: memos.api.v1.UserStats + (*GetUserStatsRequest)(nil), // 12: memos.api.v1.GetUserStatsRequest + (*UserSetting)(nil), // 13: memos.api.v1.UserSetting + (*GetUserSettingRequest)(nil), // 14: memos.api.v1.GetUserSettingRequest + (*UpdateUserSettingRequest)(nil), // 15: memos.api.v1.UpdateUserSettingRequest + (*UserAccessToken)(nil), // 16: memos.api.v1.UserAccessToken + (*ListUserAccessTokensRequest)(nil), // 17: memos.api.v1.ListUserAccessTokensRequest + (*ListUserAccessTokensResponse)(nil), // 18: memos.api.v1.ListUserAccessTokensResponse + (*CreateUserAccessTokenRequest)(nil), // 19: memos.api.v1.CreateUserAccessTokenRequest + (*DeleteUserAccessTokenRequest)(nil), // 20: memos.api.v1.DeleteUserAccessTokenRequest + (*ListAllUserStatsRequest)(nil), // 21: memos.api.v1.ListAllUserStatsRequest + (*ListAllUserStatsResponse)(nil), // 22: memos.api.v1.ListAllUserStatsResponse + nil, // 23: memos.api.v1.UserStats.TagCountEntry + (*UserStats_MemoTypeStats)(nil), // 24: memos.api.v1.UserStats.MemoTypeStats + (State)(0), // 25: memos.api.v1.State + (*timestamppb.Timestamp)(nil), // 26: google.protobuf.Timestamp (*fieldmaskpb.FieldMask)(nil), // 27: google.protobuf.FieldMask (*emptypb.Empty)(nil), // 28: google.protobuf.Empty + (*httpbody.HttpBody)(nil), // 29: google.api.HttpBody } var file_api_v1_user_service_proto_depIdxs = []int32{ 0, // 0: memos.api.v1.User.role:type_name -> memos.api.v1.User.Role - 24, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State - 25, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp - 25, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp + 25, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State + 26, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp + 26, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp 1, // 4: memos.api.v1.ListUsersResponse.users:type_name -> memos.api.v1.User - 26, // 5: memos.api.v1.GetUserAvatarBinaryRequest.http_body:type_name -> google.api.HttpBody + 27, // 5: memos.api.v1.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask 1, // 6: memos.api.v1.CreateUserRequest.user:type_name -> memos.api.v1.User 1, // 7: memos.api.v1.UpdateUserRequest.user:type_name -> memos.api.v1.User 27, // 8: memos.api.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask - 25, // 9: memos.api.v1.UserStats.memo_display_timestamps:type_name -> google.protobuf.Timestamp - 23, // 10: memos.api.v1.UserStats.memo_type_stats:type_name -> memos.api.v1.UserStats.MemoTypeStats - 22, // 11: memos.api.v1.UserStats.tag_count:type_name -> memos.api.v1.UserStats.TagCountEntry - 10, // 12: memos.api.v1.ListAllUserStatsResponse.user_stats:type_name -> memos.api.v1.UserStats - 14, // 13: memos.api.v1.UpdateUserSettingRequest.setting:type_name -> memos.api.v1.UserSetting + 1, // 9: memos.api.v1.SearchUsersResponse.users:type_name -> memos.api.v1.User + 26, // 10: memos.api.v1.UserStats.memo_display_timestamps:type_name -> google.protobuf.Timestamp + 24, // 11: memos.api.v1.UserStats.memo_type_stats:type_name -> memos.api.v1.UserStats.MemoTypeStats + 23, // 12: memos.api.v1.UserStats.tag_count:type_name -> memos.api.v1.UserStats.TagCountEntry + 13, // 13: memos.api.v1.UpdateUserSettingRequest.setting:type_name -> memos.api.v1.UserSetting 27, // 14: memos.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask - 25, // 15: memos.api.v1.UserAccessToken.issued_at:type_name -> google.protobuf.Timestamp - 25, // 16: memos.api.v1.UserAccessToken.expires_at:type_name -> google.protobuf.Timestamp - 17, // 17: memos.api.v1.ListUserAccessTokensResponse.access_tokens:type_name -> memos.api.v1.UserAccessToken - 25, // 18: memos.api.v1.CreateUserAccessTokenRequest.expires_at:type_name -> google.protobuf.Timestamp - 2, // 19: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest - 4, // 20: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest - 5, // 21: memos.api.v1.UserService.GetUserByUsername:input_type -> memos.api.v1.GetUserByUsernameRequest - 6, // 22: memos.api.v1.UserService.GetUserAvatarBinary:input_type -> memos.api.v1.GetUserAvatarBinaryRequest - 7, // 23: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest - 8, // 24: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest - 9, // 25: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest - 11, // 26: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest - 13, // 27: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest - 15, // 28: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest - 16, // 29: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest - 18, // 30: memos.api.v1.UserService.ListUserAccessTokens:input_type -> memos.api.v1.ListUserAccessTokensRequest - 20, // 31: memos.api.v1.UserService.CreateUserAccessToken:input_type -> memos.api.v1.CreateUserAccessTokenRequest - 21, // 32: memos.api.v1.UserService.DeleteUserAccessToken:input_type -> memos.api.v1.DeleteUserAccessTokenRequest - 3, // 33: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse - 1, // 34: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User - 1, // 35: memos.api.v1.UserService.GetUserByUsername:output_type -> memos.api.v1.User - 26, // 36: memos.api.v1.UserService.GetUserAvatarBinary:output_type -> google.api.HttpBody - 1, // 37: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User - 1, // 38: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User - 28, // 39: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty - 12, // 40: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse - 10, // 41: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats - 14, // 42: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting - 14, // 43: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting - 19, // 44: memos.api.v1.UserService.ListUserAccessTokens:output_type -> memos.api.v1.ListUserAccessTokensResponse - 17, // 45: memos.api.v1.UserService.CreateUserAccessToken:output_type -> memos.api.v1.UserAccessToken - 28, // 46: memos.api.v1.UserService.DeleteUserAccessToken:output_type -> google.protobuf.Empty - 33, // [33:47] is the sub-list for method output_type - 19, // [19:33] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 26, // 15: memos.api.v1.UserAccessToken.issued_at:type_name -> google.protobuf.Timestamp + 26, // 16: memos.api.v1.UserAccessToken.expires_at:type_name -> google.protobuf.Timestamp + 16, // 17: memos.api.v1.ListUserAccessTokensResponse.access_tokens:type_name -> memos.api.v1.UserAccessToken + 16, // 18: memos.api.v1.CreateUserAccessTokenRequest.access_token:type_name -> memos.api.v1.UserAccessToken + 11, // 19: memos.api.v1.ListAllUserStatsResponse.user_stats:type_name -> memos.api.v1.UserStats + 2, // 20: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest + 4, // 21: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest + 5, // 22: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest + 6, // 23: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest + 7, // 24: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest + 8, // 25: memos.api.v1.UserService.SearchUsers:input_type -> memos.api.v1.SearchUsersRequest + 10, // 26: memos.api.v1.UserService.GetUserAvatar:input_type -> memos.api.v1.GetUserAvatarRequest + 21, // 27: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest + 12, // 28: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest + 14, // 29: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest + 15, // 30: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest + 17, // 31: memos.api.v1.UserService.ListUserAccessTokens:input_type -> memos.api.v1.ListUserAccessTokensRequest + 19, // 32: memos.api.v1.UserService.CreateUserAccessToken:input_type -> memos.api.v1.CreateUserAccessTokenRequest + 20, // 33: memos.api.v1.UserService.DeleteUserAccessToken:input_type -> memos.api.v1.DeleteUserAccessTokenRequest + 3, // 34: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse + 1, // 35: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User + 1, // 36: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User + 1, // 37: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User + 28, // 38: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty + 9, // 39: memos.api.v1.UserService.SearchUsers:output_type -> memos.api.v1.SearchUsersResponse + 29, // 40: memos.api.v1.UserService.GetUserAvatar:output_type -> google.api.HttpBody + 22, // 41: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse + 11, // 42: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats + 13, // 43: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting + 13, // 44: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting + 18, // 45: memos.api.v1.UserService.ListUserAccessTokens:output_type -> memos.api.v1.ListUserAccessTokensResponse + 16, // 46: memos.api.v1.UserService.CreateUserAccessToken:output_type -> memos.api.v1.UserAccessToken + 28, // 47: memos.api.v1.UserService.DeleteUserAccessToken:output_type -> google.protobuf.Empty + 34, // [34:48] is the sub-list for method output_type + 20, // [20:34] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_api_v1_user_service_proto_init() } @@ -1521,14 +1905,13 @@ func file_api_v1_user_service_proto_init() { return } file_api_v1_common_proto_init() - file_api_v1_user_service_proto_msgTypes[19].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_user_service_proto_rawDesc), len(file_api_v1_user_service_proto_rawDesc)), NumEnums: 1, - NumMessages: 23, + NumMessages: 24, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/gen/api/v1/user_service.pb.gw.go b/proto/gen/api/v1/user_service.pb.gw.go index 0b14ae43d..a12738246 100644 --- a/proto/gen/api/v1/user_service.pb.gw.go +++ b/proto/gen/api/v1/user_service.pb.gw.go @@ -35,100 +35,44 @@ var ( _ = metadata.Join ) -func request_UserService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq ListUsersRequest - metadata runtime.ServerMetadata - ) - io.Copy(io.Discard, req.Body) - msg, err := client.ListUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} +var filter_UserService_ListUsers_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -func local_request_UserService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_UserService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq ListUsersRequest metadata runtime.ServerMetadata ) - msg, err := server.ListUsers(ctx, &protoReq) - return msg, metadata, err -} - -func request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetUserRequest - metadata runtime.ServerMetadata - err error - ) - io.Copy(io.Discard, req.Body) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := client.GetUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err -} - -func local_request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetUserRequest - metadata runtime.ServerMetadata - err error - ) - val, ok := pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - msg, err := server.GetUser(ctx, &protoReq) - return msg, metadata, err -} - -var filter_UserService_GetUserByUsername_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} - -func request_UserService_GetUserByUsername_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var ( - protoReq GetUserByUsernameRequest - 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_GetUserByUsername_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUsers_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetUserByUsername(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ListUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_UserService_GetUserByUsername_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_UserService_ListUsers_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq GetUserByUsernameRequest + protoReq ListUsersRequest 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_GetUserByUsername_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUsers_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetUserByUsername(ctx, &protoReq) + msg, err := server.ListUsers(ctx, &protoReq) return msg, metadata, err } -var filter_UserService_GetUserAvatarBinary_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var filter_UserService_GetUser_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -func request_UserService_GetUserAvatarBinary_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq GetUserAvatarBinaryRequest + protoReq GetUserRequest metadata runtime.ServerMetadata err error ) @@ -144,16 +88,16 @@ func request_UserService_GetUserAvatarBinary_0(ctx context.Context, marshaler ru if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_GetUserAvatarBinary_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_GetUser_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetUserAvatarBinary(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_UserService_GetUserAvatarBinary_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq GetUserAvatarBinaryRequest + protoReq GetUserRequest metadata runtime.ServerMetadata err error ) @@ -168,13 +112,15 @@ func local_request_UserService_GetUserAvatarBinary_0(ctx context.Context, marsha if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_GetUserAvatarBinary_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_GetUser_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetUserAvatarBinary(ctx, &protoReq) + msg, err := server.GetUser(ctx, &protoReq) return msg, metadata, err } +var filter_UserService_CreateUser_0 = &utilities.DoubleArray{Encoding: map[string]int{"user": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + func request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq CreateUserRequest @@ -183,6 +129,12 @@ func request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Mar if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.User); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_CreateUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } msg, err := client.CreateUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -195,6 +147,12 @@ func local_request_UserService_CreateUser_0(ctx context.Context, marshaler runti if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.User); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_CreateUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } msg, err := server.CreateUser(ctx, &protoReq) return msg, metadata, err } @@ -277,6 +235,8 @@ func local_request_UserService_UpdateUser_0(ctx context.Context, marshaler runti return msg, metadata, err } +var filter_UserService_DeleteUser_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + func request_UserService_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq DeleteUserRequest @@ -292,6 +252,12 @@ func request_UserService_DeleteUser_0(ctx context.Context, marshaler runtime.Mar if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_DeleteUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } msg, err := client.DeleteUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -310,16 +276,100 @@ func local_request_UserService_DeleteUser_0(ctx context.Context, marshaler runti if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_DeleteUser_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } msg, err := server.DeleteUser(ctx, &protoReq) return msg, metadata, err } +var filter_UserService_SearchUsers_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + +func request_UserService_SearchUsers_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq SearchUsersRequest + 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_SearchUsers_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.SearchUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_SearchUsers_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq SearchUsersRequest + 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_SearchUsers_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.SearchUsers(ctx, &protoReq) + return msg, metadata, err +} + +func request_UserService_GetUserAvatar_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetUserAvatarRequest + metadata runtime.ServerMetadata + err error + ) + io.Copy(io.Discard, req.Body) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := client.GetUserAvatar(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_UserService_GetUserAvatar_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetUserAvatarRequest + metadata runtime.ServerMetadata + err error + ) + val, ok := pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + msg, err := server.GetUserAvatar(ctx, &protoReq) + return msg, metadata, err +} + +var filter_UserService_ListAllUserStats_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + func request_UserService_ListAllUserStats_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq ListAllUserStatsRequest 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_ListAllUserStats_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } msg, err := client.ListAllUserStats(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -329,6 +379,12 @@ func local_request_UserService_ListAllUserStats_0(ctx context.Context, marshaler protoReq ListAllUserStatsRequest 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_ListAllUserStats_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } msg, err := server.ListAllUserStats(ctx, &protoReq) return msg, metadata, err } @@ -485,6 +541,8 @@ func local_request_UserService_UpdateUserSetting_0(ctx context.Context, marshale return msg, metadata, err } +var filter_UserService_ListUserAccessTokens_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + func request_UserService_ListUserAccessTokens_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq ListUserAccessTokensRequest @@ -492,13 +550,19 @@ func request_UserService_ListUserAccessTokens_0(ctx context.Context, marshaler r err error ) io.Copy(io.Discard, req.Body) - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserAccessTokens_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.ListUserAccessTokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -510,34 +574,48 @@ func local_request_UserService_ListUserAccessTokens_0(ctx context.Context, marsh metadata runtime.ServerMetadata err error ) - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserAccessTokens_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.ListUserAccessTokens(ctx, &protoReq) return msg, metadata, err } +var filter_UserService_CreateUserAccessToken_0 = &utilities.DoubleArray{Encoding: map[string]int{"access_token": 0, "parent": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} + func request_UserService_CreateUserAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq CreateUserAccessTokenRequest metadata runtime.ServerMetadata err error ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.AccessToken); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_CreateUserAccessToken_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.CreateUserAccessToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -549,16 +627,22 @@ func local_request_UserService_CreateUserAccessToken_0(ctx context.Context, mars metadata runtime.ServerMetadata err error ) - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.AccessToken); err != nil && !errors.Is(err, io.EOF) { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - val, ok := pathParams["name"] + val, ok := pathParams["parent"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") } - protoReq.Name, err = runtime.String(val) + protoReq.Parent, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_CreateUserAccessToken_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.CreateUserAccessToken(ctx, &protoReq) return msg, metadata, err @@ -579,14 +663,6 @@ func request_UserService_DeleteUserAccessToken_0(ctx context.Context, marshaler if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - val, ok = pathParams["access_token"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "access_token") - } - protoReq.AccessToken, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "access_token", err) - } msg, err := client.DeleteUserAccessToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -605,14 +681,6 @@ func local_request_UserService_DeleteUserAccessToken_0(ctx context.Context, mars if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - val, ok = pathParams["access_token"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "access_token") - } - protoReq.AccessToken, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "access_token", err) - } msg, err := server.DeleteUserAccessToken(ctx, &protoReq) return msg, metadata, err } @@ -663,113 +731,113 @@ 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_GetUserByUsername_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_UserService_CreateUser_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, "/memos.api.v1.UserService/GetUserByUsername", runtime.WithHTTPPathPattern("/api/v1/users:username")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/api/v1/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_GetUserByUsername_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_CreateUser_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_GetUserByUsername_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_UserService_GetUserAvatarBinary_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPatch, pattern_UserService_UpdateUser_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, "/memos.api.v1.UserService/GetUserAvatarBinary", runtime.WithHTTPPathPattern("/file/{name=users/*}/avatar")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/api/v1/{user.name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_GetUserAvatarBinary_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_UpdateUser_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_GetUserAvatarBinary_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_UserService_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodDelete, pattern_UserService_DeleteUser_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, "/memos.api.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/api/v1/users")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_CreateUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_DeleteUser_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_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPatch, pattern_UserService_UpdateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_SearchUsers_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, "/memos.api.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/api/v1/{user.name=users/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/SearchUsers", runtime.WithHTTPPathPattern("/api/v1/users:search")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_UpdateUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_SearchUsers_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_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_SearchUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodDelete, pattern_UserService_DeleteUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_GetUserAvatar_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, "/memos.api.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserAvatar", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/avatar")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_DeleteUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_GetUserAvatar_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_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_GetUserAvatar_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_UserService_ListAllUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_ListAllUserStats_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, "/memos.api.v1.UserService/ListAllUserStats", runtime.WithHTTPPathPattern("/api/v1/users/-/stats")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListAllUserStats", runtime.WithHTTPPathPattern("/api/v1/users:stats")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -789,7 +857,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserStats", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/stats")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserStats", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:getStats")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -809,7 +877,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/setting")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:getSetting")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -829,7 +897,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*/setting}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*}:updateSetting")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -849,7 +917,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserAccessTokens", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/access_tokens")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserAccessTokens", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/accessTokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -869,7 +937,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUserAccessToken", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/access_tokens")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUserAccessToken", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/accessTokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -889,7 +957,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserAccessToken", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/access_tokens/{access_token}")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserAccessToken", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/accessTokens/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -977,96 +1045,96 @@ 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_GetUserByUsername_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPost, pattern_UserService_CreateUser_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, "/memos.api.v1.UserService/GetUserByUsername", runtime.WithHTTPPathPattern("/api/v1/users:username")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/api/v1/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_GetUserByUsername_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_CreateUser_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_GetUserByUsername_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_UserService_GetUserAvatarBinary_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodPatch, pattern_UserService_UpdateUser_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, "/memos.api.v1.UserService/GetUserAvatarBinary", runtime.WithHTTPPathPattern("/file/{name=users/*}/avatar")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/api/v1/{user.name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_GetUserAvatarBinary_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_UpdateUser_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_GetUserAvatarBinary_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_UserService_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodDelete, pattern_UserService_DeleteUser_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, "/memos.api.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/api/v1/users")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_CreateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_DeleteUser_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_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPatch, pattern_UserService_UpdateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_SearchUsers_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, "/memos.api.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/api/v1/{user.name=users/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/SearchUsers", runtime.WithHTTPPathPattern("/api/v1/users:search")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_UpdateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_SearchUsers_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_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_SearchUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodDelete, pattern_UserService_DeleteUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_GetUserAvatar_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, "/memos.api.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserAvatar", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/avatar")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_DeleteUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_GetUserAvatar_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_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_GetUserAvatar_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodPost, pattern_UserService_ListAllUserStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_UserService_ListAllUserStats_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, "/memos.api.v1.UserService/ListAllUserStats", runtime.WithHTTPPathPattern("/api/v1/users/-/stats")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListAllUserStats", runtime.WithHTTPPathPattern("/api/v1/users:stats")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1083,7 +1151,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserStats", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/stats")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserStats", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:getStats")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1100,7 +1168,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/setting")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:getSetting")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1117,7 +1185,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*/setting}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*}:updateSetting")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1134,7 +1202,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserAccessTokens", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/access_tokens")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserAccessTokens", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/accessTokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1151,7 +1219,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUserAccessToken", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/access_tokens")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUserAccessToken", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/accessTokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1168,7 +1236,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserAccessToken", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}/access_tokens/{access_token}")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserAccessToken", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/accessTokens/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -1187,28 +1255,28 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux var ( pattern_UserService_ListUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "")) pattern_UserService_GetUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "")) - pattern_UserService_GetUserByUsername_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "username")) - pattern_UserService_GetUserAvatarBinary_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"file", "users", "name", "avatar"}, "")) pattern_UserService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "")) pattern_UserService_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "user.name"}, "")) pattern_UserService_DeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "")) - pattern_UserService_ListAllUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"api", "v1", "users", "-", "stats"}, "")) - pattern_UserService_GetUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "name", "stats"}, "")) - pattern_UserService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "name", "setting"}, "")) - pattern_UserService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 4, 3, 5, 4}, []string{"api", "v1", "users", "setting", "setting.name"}, "")) - pattern_UserService_ListUserAccessTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "name", "access_tokens"}, "")) - pattern_UserService_CreateUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "name", "access_tokens"}, "")) - pattern_UserService_DeleteUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v1", "users", "name", "access_tokens", "access_token"}, "")) + pattern_UserService_SearchUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "search")) + pattern_UserService_GetUserAvatar_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "name", "avatar"}, "")) + pattern_UserService_ListAllUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "stats")) + pattern_UserService_GetUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "getStats")) + pattern_UserService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "getSetting")) + pattern_UserService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "setting.name"}, "updateSetting")) + pattern_UserService_ListUserAccessTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "accessTokens"}, "")) + pattern_UserService_CreateUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "accessTokens"}, "")) + pattern_UserService_DeleteUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "accessTokens", "name"}, "")) ) var ( forward_UserService_ListUsers_0 = runtime.ForwardResponseMessage forward_UserService_GetUser_0 = runtime.ForwardResponseMessage - forward_UserService_GetUserByUsername_0 = runtime.ForwardResponseMessage - forward_UserService_GetUserAvatarBinary_0 = runtime.ForwardResponseMessage forward_UserService_CreateUser_0 = runtime.ForwardResponseMessage forward_UserService_UpdateUser_0 = runtime.ForwardResponseMessage forward_UserService_DeleteUser_0 = runtime.ForwardResponseMessage + forward_UserService_SearchUsers_0 = runtime.ForwardResponseMessage + forward_UserService_GetUserAvatar_0 = runtime.ForwardResponseMessage forward_UserService_ListAllUserStats_0 = runtime.ForwardResponseMessage forward_UserService_GetUserStats_0 = runtime.ForwardResponseMessage forward_UserService_GetUserSetting_0 = runtime.ForwardResponseMessage diff --git a/proto/gen/api/v1/user_service_grpc.pb.go b/proto/gen/api/v1/user_service_grpc.pb.go index 72fe8d553..127fdfb5b 100644 --- a/proto/gen/api/v1/user_service_grpc.pb.go +++ b/proto/gen/api/v1/user_service_grpc.pb.go @@ -23,11 +23,11 @@ const _ = grpc.SupportPackageIsVersion9 const ( UserService_ListUsers_FullMethodName = "/memos.api.v1.UserService/ListUsers" UserService_GetUser_FullMethodName = "/memos.api.v1.UserService/GetUser" - UserService_GetUserByUsername_FullMethodName = "/memos.api.v1.UserService/GetUserByUsername" - UserService_GetUserAvatarBinary_FullMethodName = "/memos.api.v1.UserService/GetUserAvatarBinary" UserService_CreateUser_FullMethodName = "/memos.api.v1.UserService/CreateUser" UserService_UpdateUser_FullMethodName = "/memos.api.v1.UserService/UpdateUser" UserService_DeleteUser_FullMethodName = "/memos.api.v1.UserService/DeleteUser" + UserService_SearchUsers_FullMethodName = "/memos.api.v1.UserService/SearchUsers" + UserService_GetUserAvatar_FullMethodName = "/memos.api.v1.UserService/GetUserAvatar" UserService_ListAllUserStats_FullMethodName = "/memos.api.v1.UserService/ListAllUserStats" UserService_GetUserStats_FullMethodName = "/memos.api.v1.UserService/GetUserStats" UserService_GetUserSetting_FullMethodName = "/memos.api.v1.UserService/GetUserSetting" @@ -45,29 +45,29 @@ type UserServiceClient interface { ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) // GetUser gets a user by name. GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*User, error) - // GetUserByUsername gets a user by username. - GetUserByUsername(ctx context.Context, in *GetUserByUsernameRequest, opts ...grpc.CallOption) (*User, error) - // GetUserAvatarBinary gets the avatar of a user. - GetUserAvatarBinary(ctx context.Context, in *GetUserAvatarBinaryRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) // CreateUser creates a new user. CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) // UpdateUser updates a user. UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error) // DeleteUser deletes a user. DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - // ListAllUserStats returns all user stats. + // SearchUsers searches for users based on query. + SearchUsers(ctx context.Context, in *SearchUsersRequest, opts ...grpc.CallOption) (*SearchUsersResponse, error) + // GetUserAvatar gets the avatar of a user. + GetUserAvatar(ctx context.Context, in *GetUserAvatarRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) + // ListAllUserStats returns statistics for all users. ListAllUserStats(ctx context.Context, in *ListAllUserStatsRequest, opts ...grpc.CallOption) (*ListAllUserStatsResponse, error) - // GetUserStats returns the stats of a user. + // GetUserStats returns statistics for a specific user. GetUserStats(ctx context.Context, in *GetUserStatsRequest, opts ...grpc.CallOption) (*UserStats, error) - // GetUserSetting gets the setting of a user. + // GetUserSetting returns the user setting. GetUserSetting(ctx context.Context, in *GetUserSettingRequest, opts ...grpc.CallOption) (*UserSetting, error) - // UpdateUserSetting updates the setting of a user. + // UpdateUserSetting updates the user setting. UpdateUserSetting(ctx context.Context, in *UpdateUserSettingRequest, opts ...grpc.CallOption) (*UserSetting, error) // ListUserAccessTokens returns a list of access tokens for a user. ListUserAccessTokens(ctx context.Context, in *ListUserAccessTokensRequest, opts ...grpc.CallOption) (*ListUserAccessTokensResponse, error) // CreateUserAccessToken creates a new access token for a user. CreateUserAccessToken(ctx context.Context, in *CreateUserAccessTokenRequest, opts ...grpc.CallOption) (*UserAccessToken, error) - // DeleteUserAccessToken deletes an access token for a user. + // DeleteUserAccessToken deletes an access token. DeleteUserAccessToken(ctx context.Context, in *DeleteUserAccessTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } @@ -99,50 +99,50 @@ func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opt return out, nil } -func (c *userServiceClient) GetUserByUsername(ctx context.Context, in *GetUserByUsernameRequest, opts ...grpc.CallOption) (*User, error) { +func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(User) - err := c.cc.Invoke(ctx, UserService_GetUserByUsername_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *userServiceClient) GetUserAvatarBinary(ctx context.Context, in *GetUserAvatarBinaryRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) { +func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(httpbody.HttpBody) - err := c.cc.Invoke(ctx, UserService_GetUserAvatarBinary_FullMethodName, in, out, cOpts...) + out := new(User) + err := c.cc.Invoke(ctx, UserService_UpdateUser_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) { +func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(User) - err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, cOpts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, UserService_DeleteUser_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error) { +func (c *userServiceClient) SearchUsers(ctx context.Context, in *SearchUsersRequest, opts ...grpc.CallOption) (*SearchUsersResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(User) - err := c.cc.Invoke(ctx, UserService_UpdateUser_FullMethodName, in, out, cOpts...) + out := new(SearchUsersResponse) + err := c.cc.Invoke(ctx, UserService_SearchUsers_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { +func (c *userServiceClient) GetUserAvatar(ctx context.Context, in *GetUserAvatarRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, UserService_DeleteUser_FullMethodName, in, out, cOpts...) + out := new(httpbody.HttpBody) + err := c.cc.Invoke(ctx, UserService_GetUserAvatar_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -227,29 +227,29 @@ type UserServiceServer interface { ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) // GetUser gets a user by name. GetUser(context.Context, *GetUserRequest) (*User, error) - // GetUserByUsername gets a user by username. - GetUserByUsername(context.Context, *GetUserByUsernameRequest) (*User, error) - // GetUserAvatarBinary gets the avatar of a user. - GetUserAvatarBinary(context.Context, *GetUserAvatarBinaryRequest) (*httpbody.HttpBody, error) // CreateUser creates a new user. CreateUser(context.Context, *CreateUserRequest) (*User, error) // UpdateUser updates a user. UpdateUser(context.Context, *UpdateUserRequest) (*User, error) // DeleteUser deletes a user. DeleteUser(context.Context, *DeleteUserRequest) (*emptypb.Empty, error) - // ListAllUserStats returns all user stats. + // SearchUsers searches for users based on query. + SearchUsers(context.Context, *SearchUsersRequest) (*SearchUsersResponse, error) + // GetUserAvatar gets the avatar of a user. + GetUserAvatar(context.Context, *GetUserAvatarRequest) (*httpbody.HttpBody, error) + // ListAllUserStats returns statistics for all users. ListAllUserStats(context.Context, *ListAllUserStatsRequest) (*ListAllUserStatsResponse, error) - // GetUserStats returns the stats of a user. + // GetUserStats returns statistics for a specific user. GetUserStats(context.Context, *GetUserStatsRequest) (*UserStats, error) - // GetUserSetting gets the setting of a user. + // GetUserSetting returns the user setting. GetUserSetting(context.Context, *GetUserSettingRequest) (*UserSetting, error) - // UpdateUserSetting updates the setting of a user. + // UpdateUserSetting updates the user setting. UpdateUserSetting(context.Context, *UpdateUserSettingRequest) (*UserSetting, error) // ListUserAccessTokens returns a list of access tokens for a user. ListUserAccessTokens(context.Context, *ListUserAccessTokensRequest) (*ListUserAccessTokensResponse, error) // CreateUserAccessToken creates a new access token for a user. CreateUserAccessToken(context.Context, *CreateUserAccessTokenRequest) (*UserAccessToken, error) - // DeleteUserAccessToken deletes an access token for a user. + // DeleteUserAccessToken deletes an access token. DeleteUserAccessToken(context.Context, *DeleteUserAccessTokenRequest) (*emptypb.Empty, error) mustEmbedUnimplementedUserServiceServer() } @@ -267,12 +267,6 @@ func (UnimplementedUserServiceServer) ListUsers(context.Context, *ListUsersReque func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) (*User, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") } -func (UnimplementedUserServiceServer) GetUserByUsername(context.Context, *GetUserByUsernameRequest) (*User, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetUserByUsername not implemented") -} -func (UnimplementedUserServiceServer) GetUserAvatarBinary(context.Context, *GetUserAvatarBinaryRequest) (*httpbody.HttpBody, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetUserAvatarBinary not implemented") -} func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*User, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented") } @@ -282,6 +276,12 @@ func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserReq func (UnimplementedUserServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented") } +func (UnimplementedUserServiceServer) SearchUsers(context.Context, *SearchUsersRequest) (*SearchUsersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchUsers not implemented") +} +func (UnimplementedUserServiceServer) GetUserAvatar(context.Context, *GetUserAvatarRequest) (*httpbody.HttpBody, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUserAvatar not implemented") +} func (UnimplementedUserServiceServer) ListAllUserStats(context.Context, *ListAllUserStatsRequest) (*ListAllUserStatsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListAllUserStats not implemented") } @@ -360,92 +360,92 @@ func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } -func _UserService_GetUserByUsername_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUserByUsernameRequest) +func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).GetUserByUsername(ctx, in) + return srv.(UserServiceServer).CreateUser(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_GetUserByUsername_FullMethodName, + FullMethod: UserService_CreateUser_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).GetUserByUsername(ctx, req.(*GetUserByUsernameRequest)) + return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest)) } return interceptor(ctx, in, info, handler) } -func _UserService_GetUserAvatarBinary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUserAvatarBinaryRequest) +func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).GetUserAvatarBinary(ctx, in) + return srv.(UserServiceServer).UpdateUser(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_GetUserAvatarBinary_FullMethodName, + FullMethod: UserService_UpdateUser_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).GetUserAvatarBinary(ctx, req.(*GetUserAvatarBinaryRequest)) + return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserRequest)) } return interceptor(ctx, in, info, handler) } -func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateUserRequest) +func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).CreateUser(ctx, in) + return srv.(UserServiceServer).DeleteUser(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_CreateUser_FullMethodName, + FullMethod: UserService_DeleteUser_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest)) + return srv.(UserServiceServer).DeleteUser(ctx, req.(*DeleteUserRequest)) } return interceptor(ctx, in, info, handler) } -func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateUserRequest) +func _UserService_SearchUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchUsersRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).UpdateUser(ctx, in) + return srv.(UserServiceServer).SearchUsers(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_UpdateUser_FullMethodName, + FullMethod: UserService_SearchUsers_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserRequest)) + return srv.(UserServiceServer).SearchUsers(ctx, req.(*SearchUsersRequest)) } return interceptor(ctx, in, info, handler) } -func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteUserRequest) +func _UserService_GetUserAvatar_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserAvatarRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServiceServer).DeleteUser(ctx, in) + return srv.(UserServiceServer).GetUserAvatar(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: UserService_DeleteUser_FullMethodName, + FullMethod: UserService_GetUserAvatar_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServiceServer).DeleteUser(ctx, req.(*DeleteUserRequest)) + return srv.(UserServiceServer).GetUserAvatar(ctx, req.(*GetUserAvatarRequest)) } return interceptor(ctx, in, info, handler) } @@ -591,14 +591,6 @@ var UserService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetUser", Handler: _UserService_GetUser_Handler, }, - { - MethodName: "GetUserByUsername", - Handler: _UserService_GetUserByUsername_Handler, - }, - { - MethodName: "GetUserAvatarBinary", - Handler: _UserService_GetUserAvatarBinary_Handler, - }, { MethodName: "CreateUser", Handler: _UserService_CreateUser_Handler, @@ -611,6 +603,14 @@ var UserService_ServiceDesc = grpc.ServiceDesc{ MethodName: "DeleteUser", Handler: _UserService_DeleteUser_Handler, }, + { + MethodName: "SearchUsers", + Handler: _UserService_SearchUsers_Handler, + }, + { + MethodName: "GetUserAvatar", + Handler: _UserService_GetUserAvatar_Handler, + }, { MethodName: "ListAllUserStats", Handler: _UserService_ListAllUserStats_Handler, diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index d39efe174..b453eb077 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -452,6 +452,45 @@ paths: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' + parameters: + - name: pageSize + description: |- + Optional. The maximum number of users to return. + The service may return fewer than this value. + If unspecified, at most 50 users will be returned. + The maximum value is 1000; values above 1000 will be coerced to 1000. + in: query + required: false + type: integer + format: int32 + - name: pageToken + description: |- + Optional. A page token, received from a previous `ListUsers` call. + Provide this to retrieve the subsequent page. + in: query + required: false + type: string + - name: filter + description: |- + Optional. Filter to apply to the list results. + Example: "state=ACTIVE" or "role=USER" or "email:@example.com" + Supported operators: =, !=, <, <=, >, >=, : + Supported fields: username, email, role, state, create_time, update_time + in: query + required: false + type: string + - name: orderBy + description: |- + Optional. The order to sort results by. + Example: "create_time desc" or "username asc" + in: query + required: false + type: string + - name: showDeleted + description: Optional. If true, show deleted users in the response. + in: query + required: false + type: boolean tags: - UserService post: @@ -468,43 +507,89 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: user + description: Required. The user to create. in: body required: true schema: $ref: '#/definitions/v1User' + required: + - user + - name: userId + description: |- + Optional. The user ID to use for this user. + If empty, a unique ID will be generated. + Must match the pattern [a-z0-9-]+ + in: query + required: false + type: string + - name: validateOnly + description: Optional. If set, validate the request but don't actually create the user. + in: query + required: false + type: boolean + - name: requestId + description: |- + Optional. An idempotency token that can be used to ensure that multiple + requests to create a user have the same result. + in: query + required: false + type: string tags: - UserService - /api/v1/users/-/stats: - post: - summary: ListAllUserStats returns all user stats. - operationId: UserService_ListAllUserStats + /api/v1/users:search: + get: + summary: SearchUsers searches for users based on query. + operationId: UserService_SearchUsers responses: "200": description: A successful response. schema: - $ref: '#/definitions/v1ListAllUserStatsResponse' + $ref: '#/definitions/v1SearchUsersResponse' default: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' + parameters: + - name: query + description: Required. The search query. + in: query + required: true + type: string + - name: pageSize + description: Optional. The maximum number of users to return. + in: query + required: false + type: integer + format: int32 + - name: pageToken + description: Optional. A page token for pagination. + in: query + required: false + type: string tags: - UserService - /api/v1/users:username: + /api/v1/users:stats: get: - summary: GetUserByUsername gets a user by username. - operationId: UserService_GetUserByUsername + summary: ListAllUserStats returns statistics for all users. + operationId: UserService_ListAllUserStats responses: "200": description: A successful response. schema: - $ref: '#/definitions/v1User' + $ref: '#/definitions/v1ListAllUserStatsResponse' default: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: username - description: The username of the user. + - name: pageSize + description: Optional. The maximum number of user stats to return. + in: query + required: false + type: integer + format: int32 + - name: pageToken + description: Optional. A page token for pagination. in: query required: false type: string @@ -914,16 +999,25 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: The name of the user. + description: |- + Required. The resource name of the user. + Format: users/{user} in: path required: true type: string pattern: users/[^/]+ + - name: readMask + description: |- + Optional. The fields to return in the response. + If not specified, all fields are returned. + in: query + required: false + type: string tags: - UserService delete: - summary: DeleteIdentityProvider deletes an identity provider. - operationId: IdentityProviderService_DeleteIdentityProvider + summary: DeleteUserAccessToken deletes an access token. + operationId: UserService_DeleteUserAccessToken responses: "200": description: A successful response. @@ -936,13 +1030,15 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: The name of the identityProvider to delete. + description: |- + Required. The resource name of the access token to delete. + Format: users/{user}/accessTokens/{access_token} in: path required: true type: string - pattern: identityProviders/[^/]+ + pattern: users/[^/]+/accessTokens/[^/]+ tags: - - IdentityProviderService + - UserService /api/v1/{name_2}: get: summary: GetIdentityProvider gets an identity provider. @@ -966,8 +1062,8 @@ paths: tags: - IdentityProviderService delete: - summary: DeleteInbox deletes an inbox. - operationId: InboxService_DeleteInbox + summary: DeleteIdentityProvider deletes an identity provider. + operationId: IdentityProviderService_DeleteIdentityProvider responses: "200": description: A successful response. @@ -980,13 +1076,13 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: The name of the inbox to delete. + description: The name of the identityProvider to delete. in: path required: true type: string - pattern: inboxes/[^/]+ + pattern: identityProviders/[^/]+ tags: - - InboxService + - IdentityProviderService /api/v1/{name_3}: get: summary: GetResource returns a resource by name. @@ -1010,8 +1106,8 @@ paths: tags: - ResourceService delete: - summary: DeleteResource deletes a resource by name. - operationId: ResourceService_DeleteResource + summary: DeleteInbox deletes an inbox. + operationId: InboxService_DeleteInbox responses: "200": description: A successful response. @@ -1024,13 +1120,13 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: The name of the resource. + description: The name of the inbox to delete. in: path required: true type: string - pattern: resources/[^/]+ + pattern: inboxes/[^/]+ tags: - - ResourceService + - InboxService /api/v1/{name_4}: get: summary: GetMemo gets a memo. @@ -1053,6 +1149,29 @@ paths: pattern: memos/[^/]+ tags: - MemoService + delete: + summary: DeleteResource deletes a resource by name. + operationId: ResourceService_DeleteResource + responses: + "200": + description: A successful response. + schema: + type: object + properties: {} + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: name_4 + description: The name of the resource. + in: path + required: true + type: string + pattern: resources/[^/]+ + tags: + - ResourceService + /api/v1/{name_5}: delete: summary: DeleteMemo deletes a memo. operationId: MemoService_DeleteMemo @@ -1067,7 +1186,7 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: name_4 + - name: name_5 description: The name of the memo. in: path required: true @@ -1114,87 +1233,42 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: The name of the user. + description: |- + Required. The resource name of the user to delete. + Format: users/{user} in: path required: true type: string pattern: users/[^/]+ + - name: force + description: Optional. If set to true, the user will be deleted even if they have associated data. + in: query + required: false + type: boolean tags: - UserService - /api/v1/{name}/access_tokens: + /api/v1/{name}/avatar: get: - summary: ListUserAccessTokens returns a list of access tokens for a user. - operationId: UserService_ListUserAccessTokens - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/v1ListUserAccessTokensResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - parameters: - - name: name - description: The name of the user. - in: path - required: true - type: string - pattern: users/[^/]+ - tags: - - UserService - post: - summary: CreateUserAccessToken creates a new access token for a user. - operationId: UserService_CreateUserAccessToken - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/v1UserAccessToken' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - parameters: - - name: name - description: The name of the user. - in: path - required: true - type: string - pattern: users/[^/]+ - - name: body - in: body - required: true - schema: - $ref: '#/definitions/UserServiceCreateUserAccessTokenBody' - tags: - - UserService - /api/v1/{name}/access_tokens/{accessToken}: - delete: - summary: DeleteUserAccessToken deletes an access token for a user. - operationId: UserService_DeleteUserAccessToken + summary: GetUserAvatar gets the avatar of a user. + operationId: UserService_GetUserAvatar responses: "200": description: A successful response. schema: - type: object - properties: {} + $ref: '#/definitions/apiHttpBody' default: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: The name of the user. + description: |- + Required. The resource name of the user. + Format: users/{user} in: path required: true type: string pattern: users/[^/]+ - - name: accessToken - description: access_token is the access token to delete. - in: path - required: true - type: string tags: - UserService /api/v1/{name}/comments: @@ -1392,9 +1466,9 @@ paths: $ref: '#/definitions/MemoServiceSetMemoResourcesBody' tags: - MemoService - /api/v1/{name}/setting: + /api/v1/{name}:getSetting: get: - summary: GetUserSetting gets the setting of a user. + summary: GetUserSetting returns the user setting. operationId: UserService_GetUserSetting responses: "200": @@ -1407,16 +1481,18 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: The name of the user. + description: |- + Required. The resource name of the user. + Format: users/{user} in: path required: true type: string pattern: users/[^/]+ tags: - UserService - /api/v1/{name}/stats: + /api/v1/{name}:getStats: get: - summary: GetUserStats returns the stats of a user. + summary: GetUserStats returns statistics for a specific user. operationId: UserService_GetUserStats responses: "200": @@ -1429,13 +1505,86 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: The name of the user. + description: |- + Required. The resource name of the user. + Format: users/{user} in: path required: true type: string pattern: users/[^/]+ tags: - UserService + /api/v1/{parent}/accessTokens: + get: + summary: ListUserAccessTokens returns a list of access tokens for a user. + operationId: UserService_ListUserAccessTokens + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v1ListUserAccessTokensResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: parent + description: |- + Required. The parent resource whose access tokens will be listed. + Format: users/{user} + in: path + required: true + type: string + pattern: users/[^/]+ + - name: pageSize + description: Optional. The maximum number of access tokens to return. + in: query + required: false + type: integer + format: int32 + - name: pageToken + description: Optional. A page token for pagination. + in: query + required: false + type: string + tags: + - UserService + post: + summary: CreateUserAccessToken creates a new access token for a user. + operationId: UserService_CreateUserAccessToken + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v1UserAccessToken' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: parent + description: |- + Required. The parent resource where this access token will be created. + Format: users/{user} + in: path + required: true + type: string + pattern: users/[^/]+ + - name: accessToken + description: Required. The access token to create. + in: body + required: true + schema: + $ref: '#/definitions/v1UserAccessToken' + required: + - accessToken + - name: accessTokenId + description: Optional. The access token ID to use. + in: query + required: false + type: string + tags: + - UserService /api/v1/{parent}/memos: get: summary: ListMemos lists memos with pagination and filter. @@ -1746,9 +1895,9 @@ paths: description: The related memo. Refer to `Memo.name`. tags: - ResourceService - /api/v1/{setting.name}: + /api/v1/{setting.name}:updateSetting: patch: - summary: UpdateUserSetting updates the setting of a user. + summary: UpdateUserSetting updates the user setting. operationId: UserService_UpdateUserSetting responses: "200": @@ -1761,12 +1910,15 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: The name of the user. + description: |- + The resource name of the user whose setting this is. + Format: users/{user} in: path required: true type: string - pattern: users/[^/]+/setting + pattern: users/[^/]+ - name: setting + description: Required. The user setting to update. in: body required: true schema: @@ -1781,6 +1933,7 @@ paths: memoVisibility: type: string description: The default visibility of the memo. + title: Required. The user setting to update. required: - setting tags: @@ -1801,77 +1954,72 @@ paths: parameters: - name: user.name description: |- - The name of the user. - Format: users/{id}, id is the system generated auto-incremented id. + The resource name of the user. + Format: users/{user} in: path required: true type: string pattern: users/[^/]+ - name: user + description: Required. The user to update. in: body required: true schema: type: object properties: + uid: + type: string + description: Output only. The system generated unique identifier. + readOnly: true role: $ref: '#/definitions/UserRole' + description: The role of the user. username: type: string + description: Required. The unique username for login. email: type: string - nickname: + description: Optional. The email address of the user. + displayName: type: string + description: Optional. The display name of the user. avatarUrl: type: string + description: Optional. The avatar URL of the user. description: type: string + description: Optional. The description of the user. password: type: string + description: Input only. The password for the user. state: $ref: '#/definitions/v1State' + description: The state of the user. createTime: type: string format: date-time + description: Output only. The creation timestamp. readOnly: true updateTime: type: string format: date-time + description: Output only. The last update timestamp. + readOnly: true + etag: + type: string + description: Output only. The etag for this resource. readOnly: true + title: Required. The user to update. required: + - role + - username + - state - user - tags: - - UserService - /file/{name}/avatar: - get: - summary: GetUserAvatarBinary gets the avatar of a user. - operationId: UserService_GetUserAvatarBinary - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/apiHttpBody' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - parameters: - - name: name - description: The name of the user. - in: path - required: true - type: string - pattern: users/[^/]+ - - name: httpBody.contentType - description: The HTTP Content-Type header value specifying the content type of the body. + - name: allowMissing + description: Optional. If set to true, allows updating sensitive fields. in: query required: false - type: string - - name: httpBody.data - description: The HTTP request/response body as raw binary. - in: query - required: false - type: string - format: byte + type: boolean tags: - UserService /file/{name}/{filename}: @@ -1959,14 +2107,13 @@ definitions: - ADMIN - USER default: ROLE_UNSPECIFIED - UserServiceCreateUserAccessTokenBody: - type: object - properties: - description: - type: string - expiresAt: - type: string - format: date-time + description: |- + User role enumeration. + + - ROLE_UNSPECIFIED: Unspecified role. + - HOST: Host role with full system access. + - ADMIN: Admin role with administrative privileges. + - USER: Regular user role. UserStatsMemoTypeStats: type: object properties: @@ -1982,6 +2129,7 @@ definitions: undoCount: type: integer format: int32 + description: Memo type statistics. WorkspaceStorageSettingS3Config: type: object properties: @@ -2233,7 +2381,9 @@ definitions: properties: name: type: string - description: The name of the user. + title: |- + The resource name of the user whose setting this is. + Format: users/{user} locale: type: string description: The preferred locale of the user. @@ -2243,6 +2393,7 @@ definitions: memoVisibility: type: string description: The default visibility of the memo. + title: User settings message apiv1WorkspaceCustomProfile: type: object properties: @@ -2715,6 +2866,14 @@ definitions: items: type: object $ref: '#/definitions/v1UserStats' + description: The list of user statistics. + nextPageToken: + type: string + description: A token for the next page of results. + totalSize: + type: integer + format: int32 + description: The total count of user statistics. v1ListIdentityProvidersResponse: type: object properties: @@ -2818,6 +2977,14 @@ definitions: items: type: object $ref: '#/definitions/v1UserAccessToken' + description: The list of access tokens. + nextPageToken: + type: string + description: A token for the next page of results. + totalSize: + type: integer + format: int32 + description: The total count of access tokens. v1ListUsersResponse: type: object properties: @@ -2826,6 +2993,16 @@ definitions: items: type: object $ref: '#/definitions/v1User' + description: The list of users. + nextPageToken: + type: string + description: |- + A token that can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + totalSize: + type: integer + format: int32 + description: The total count of users (may be approximate). v1ListWebhooksResponse: type: object properties: @@ -3115,6 +3292,22 @@ definitions: redirectUri: type: string description: The redirect URI. + v1SearchUsersResponse: + type: object + properties: + users: + type: array + items: + type: object + $ref: '#/definitions/v1User' + description: The list of users matching the search query. + nextPageToken: + type: string + description: A token for the next page of results. + totalSize: + type: integer + format: int32 + description: The total count of matching users. v1SpoilerNode: type: object properties: @@ -3215,61 +3408,94 @@ definitions: properties: name: type: string - description: |- - The name of the user. - Format: users/{id}, id is the system generated auto-incremented id. + title: |- + The resource name of the user. + Format: users/{user} + uid: + type: string + description: Output only. The system generated unique identifier. readOnly: true role: $ref: '#/definitions/UserRole' + description: The role of the user. username: type: string + description: Required. The unique username for login. email: type: string - nickname: + description: Optional. The email address of the user. + displayName: type: string + description: Optional. The display name of the user. avatarUrl: type: string + description: Optional. The avatar URL of the user. description: type: string + description: Optional. The description of the user. password: type: string + description: Input only. The password for the user. state: $ref: '#/definitions/v1State' + description: The state of the user. createTime: type: string format: date-time + description: Output only. The creation timestamp. readOnly: true updateTime: type: string format: date-time + description: Output only. The last update timestamp. + readOnly: true + etag: + type: string + description: Output only. The etag for this resource. readOnly: true + required: + - role + - username + - state v1UserAccessToken: type: object properties: + name: + type: string + title: |- + The resource name of the access token. + Format: users/{user}/accessTokens/{access_token} accessToken: type: string + description: Output only. The access token value. + readOnly: true description: type: string + description: The description of the access token. issuedAt: type: string format: date-time + description: Output only. The issued timestamp. + readOnly: true expiresAt: type: string format: date-time + description: Optional. The expiration timestamp. + title: User access token message v1UserStats: type: object properties: name: type: string - description: The name of the user. + title: |- + The resource name of the user whose stats these are. + Format: users/{user} memoDisplayTimestamps: type: array items: type: string format: date-time - description: |- - The timestamps when the memos were displayed. - We should return raw data to the client, and let the client format the data with the user's timezone. + description: The timestamps when the memos were displayed. memoTypeStats: $ref: '#/definitions/UserStatsMemoTypeStats' description: The stats of memo types. @@ -3278,9 +3504,7 @@ definitions: additionalProperties: type: integer format: int32 - title: |- - The count of tags. - Format: "tag1": 1, "tag2": 2 + description: The count of tags. pinnedMemos: type: array items: @@ -3289,6 +3513,8 @@ definitions: totalMemoCount: type: integer format: int32 + description: Total memo count. + title: User statistics messages v1Visibility: type: string enum: diff --git a/server/router/api/v1/acl_config.go b/server/router/api/v1/acl_config.go index 8f32ebb37..fcce4d293 100644 --- a/server/router/api/v1/acl_config.go +++ b/server/router/api/v1/acl_config.go @@ -12,8 +12,7 @@ var authenticationAllowlistMethods = map[string]bool{ "/memos.api.v1.AuthService/SignOut": true, "/memos.api.v1.AuthService/SignUp": true, "/memos.api.v1.UserService/GetUser": true, - "/memos.api.v1.UserService/GetUserByUsername": true, - "/memos.api.v1.UserService/GetUserAvatarBinary": true, + "/memos.api.v1.UserService/GetUserAvatar": true, "/memos.api.v1.UserService/GetUserStats": true, "/memos.api.v1.UserService/ListAllUserStats": true, "/memos.api.v1.UserService/SearchUsers": true, diff --git a/server/router/api/v1/auth_service.go b/server/router/api/v1/auth_service.go index e5050e360..b4a94e95c 100644 --- a/server/router/api/v1/auth_service.go +++ b/server/router/api/v1/auth_service.go @@ -244,8 +244,7 @@ func (s *APIV1Service) SignOut(ctx context.Context, _ *v1pb.SignOutRequest) (*em user, _ := s.GetCurrentUser(ctx) if user != nil { if _, err := s.DeleteUserAccessToken(ctx, &v1pb.DeleteUserAccessTokenRequest{ - Name: fmt.Sprintf("%s%d", UserNamePrefix, user.ID), - AccessToken: accessToken, + Name: fmt.Sprintf("%s%d/accessTokens/%s", UserNamePrefix, user.ID, accessToken), }); err != nil { slog.Error("failed to delete access token", "error", err) } diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go index fa31bc99f..312babfc8 100644 --- a/server/router/api/v1/user_service.go +++ b/server/router/api/v1/user_service.go @@ -2,6 +2,7 @@ package v1 import ( "context" + "crypto/md5" "encoding/base64" "fmt" "net/http" @@ -40,8 +41,11 @@ func (s *APIV1Service) ListUsers(ctx context.Context, _ *v1pb.ListUsersRequest) return nil, status.Errorf(codes.Internal, "failed to list users: %v", err) } + // TODO: Implement proper filtering, ordering, and pagination + // For now, return all users with basic structure response := &v1pb.ListUsersResponse{ - Users: []*v1pb.User{}, + Users: []*v1pb.User{}, + TotalSize: int32(len(users)), } for _, user := range users { response.Users = append(response.Users, convertUserFromStore(user)) @@ -63,25 +67,50 @@ func (s *APIV1Service) GetUser(ctx context.Context, request *v1pb.GetUserRequest if user == nil { return nil, status.Errorf(codes.NotFound, "user not found") } + userPb := convertUserFromStore(user) - return convertUserFromStore(user), nil + // TODO: Implement read_mask field filtering + // For now, return all fields + + return userPb, nil } -func (s *APIV1Service) GetUserByUsername(ctx context.Context, request *v1pb.GetUserByUsernameRequest) (*v1pb.User, error) { - user, err := s.Store.GetUser(ctx, &store.FindUser{ - Username: &request.Username, - }) +func (s *APIV1Service) SearchUsers(ctx context.Context, request *v1pb.SearchUsersRequest) (*v1pb.SearchUsersResponse, error) { + currentUser, err := s.GetCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) } - if user == nil { - return nil, status.Errorf(codes.NotFound, "user not found") + if currentUser.Role != store.RoleHost && currentUser.Role != store.RoleAdmin { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - return convertUserFromStore(user), nil + // Search users by username, email, or display name + users, err := s.Store.ListUsers(ctx, &store.FindUser{}) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to list users: %v", err) + } + + var filteredUsers []*store.User + query := strings.ToLower(request.Query) + for _, user := range users { + if strings.Contains(strings.ToLower(user.Username), query) || + strings.Contains(strings.ToLower(user.Email), query) || + strings.Contains(strings.ToLower(user.Nickname), query) { + filteredUsers = append(filteredUsers, user) + } + } + + response := &v1pb.SearchUsersResponse{ + Users: []*v1pb.User{}, + TotalSize: int32(len(filteredUsers)), + } + for _, user := range filteredUsers { + response.Users = append(response.Users, convertUserFromStore(user)) + } + return response, nil } -func (s *APIV1Service) GetUserAvatarBinary(ctx context.Context, request *v1pb.GetUserAvatarBinaryRequest) (*httpbody.HttpBody, error) { +func (s *APIV1Service) GetUserAvatar(ctx context.Context, request *v1pb.GetUserAvatarRequest) (*httpbody.HttpBody, error) { userID, err := ExtractUserIDFromName(request.Name) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) @@ -122,9 +151,24 @@ func (s *APIV1Service) CreateUser(ctx context.Context, request *v1pb.CreateUserR if currentUser.Role != store.RoleHost { return nil, status.Errorf(codes.PermissionDenied, "permission denied") } + // TODO: Handle request_id for idempotency + // TODO: Handle user_id field if provided + if !base.UIDMatcher.MatchString(strings.ToLower(request.User.Username)) { return nil, status.Errorf(codes.InvalidArgument, "invalid username: %s", request.User.Username) } + + // If validate_only is true, just validate without creating + if request.ValidateOnly { + // Perform validation checks without actually creating the user + return &v1pb.User{ + Username: request.User.Username, + Email: request.User.Email, + DisplayName: request.User.DisplayName, + Role: request.User.Role, + }, nil + } + passwordHash, err := bcrypt.GenerateFromPassword([]byte(request.User.Password), bcrypt.DefaultCost) if err != nil { return nil, echo.NewHTTPError(http.StatusInternalServerError, "failed to generate password hash").SetInternal(err) @@ -134,7 +178,7 @@ func (s *APIV1Service) CreateUser(ctx context.Context, request *v1pb.CreateUserR Username: request.User.Username, Role: convertUserRoleToStore(request.User.Role), Email: request.User.Email, - Nickname: request.User.Nickname, + Nickname: request.User.DisplayName, PasswordHash: string(passwordHash), }) if err != nil { @@ -167,6 +211,11 @@ func (s *APIV1Service) UpdateUser(ctx context.Context, request *v1pb.UpdateUserR return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) } if user == nil { + // Handle allow_missing field + if request.AllowMissing { + // Could create user if missing, but for now return not found + return nil, status.Errorf(codes.NotFound, "user not found") + } return nil, status.Errorf(codes.NotFound, "user not found") } @@ -188,11 +237,11 @@ func (s *APIV1Service) UpdateUser(ctx context.Context, request *v1pb.UpdateUserR return nil, status.Errorf(codes.InvalidArgument, "invalid username: %s", request.User.Username) } update.Username = &request.User.Username - } else if field == "nickname" { + } else if field == "display_name" { if workspaceGeneralSetting.DisallowChangeNickname { return nil, status.Errorf(codes.PermissionDenied, "permission denied: disallow change nickname") } - update.Nickname = &request.User.Nickname + update.Nickname = &request.User.DisplayName } else if field == "email" { update.Email = &request.User.Email } else if field == "avatar_url" { @@ -261,25 +310,39 @@ func (s *APIV1Service) DeleteUser(ctx context.Context, request *v1pb.DeleteUserR func getDefaultUserSetting() *v1pb.UserSetting { return &v1pb.UserSetting{ + Name: "", // Will be set by caller Locale: "en", Appearance: "system", MemoVisibility: "PRIVATE", } } -func (s *APIV1Service) GetUserSetting(ctx context.Context, _ *v1pb.GetUserSettingRequest) (*v1pb.UserSetting, error) { - user, err := s.GetCurrentUser(ctx) +func (s *APIV1Service) GetUserSetting(ctx context.Context, request *v1pb.GetUserSettingRequest) (*v1pb.UserSetting, error) { + userID, err := ExtractUserIDFromName(request.Name) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) + } + + currentUser, err := s.GetCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) } + // Only allow user to get their own settings + if currentUser.ID != userID { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + userSettings, err := s.Store.ListUserSettings(ctx, &store.FindUserSetting{ - UserID: &user.ID, + UserID: &userID, }) if err != nil { return nil, status.Errorf(codes.Internal, "failed to list user settings: %v", err) } + userSettingMessage := getDefaultUserSetting() + userSettingMessage.Name = fmt.Sprintf("users/%d/setting", userID) + for _, setting := range userSettings { if setting.Key == storepb.UserSettingKey_LOCALE { userSettingMessage.Locale = setting.GetLocale() @@ -293,11 +356,27 @@ func (s *APIV1Service) GetUserSetting(ctx context.Context, _ *v1pb.GetUserSettin } func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.UpdateUserSettingRequest) (*v1pb.UserSetting, error) { - user, err := s.GetCurrentUser(ctx) + // Extract user ID from the setting resource name + parts := strings.Split(request.Setting.Name, "/") + if len(parts) != 3 || parts[0] != "users" || parts[2] != "setting" { + return nil, status.Errorf(codes.InvalidArgument, "invalid setting name format: %s", request.Setting.Name) + } + + userID, err := ExtractUserIDFromName(fmt.Sprintf("users/%s", parts[1])) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) + } + + currentUser, err := s.GetCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) } + // Only allow user to update their own settings + if currentUser.ID != userID { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 { return nil, status.Errorf(codes.InvalidArgument, "update mask is empty") } @@ -305,7 +384,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda for _, field := range request.UpdateMask.Paths { if field == "locale" { if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ - UserId: user.ID, + UserId: userID, Key: storepb.UserSettingKey_LOCALE, Value: &storepb.UserSetting_Locale{ Locale: request.Setting.Locale, @@ -315,7 +394,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda } } else if field == "appearance" { if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ - UserId: user.ID, + UserId: userID, Key: storepb.UserSettingKey_APPEARANCE, Value: &storepb.UserSetting_Appearance{ Appearance: request.Setting.Appearance, @@ -325,7 +404,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda } } else if field == "memo_visibility" { if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ - UserId: user.ID, + UserId: userID, Key: storepb.UserSettingKey_MEMO_VISIBILITY, Value: &storepb.UserSetting_MemoVisibility{ MemoVisibility: request.Setting.MemoVisibility, @@ -338,11 +417,11 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda } } - return s.GetUserSetting(ctx, &v1pb.GetUserSettingRequest{}) + return s.GetUserSetting(ctx, &v1pb.GetUserSettingRequest{Name: request.Setting.Name}) } func (s *APIV1Service) ListUserAccessTokens(ctx context.Context, request *v1pb.ListUserAccessTokensRequest) (*v1pb.ListUserAccessTokensResponse, error) { - userID, err := ExtractUserIDFromName(request.Name) + userID, err := ExtractUserIDFromName(request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) } @@ -382,15 +461,16 @@ func (s *APIV1Service) ListUserAccessTokens(ctx context.Context, request *v1pb.L continue } - userAccessToken := &v1pb.UserAccessToken{ + accessTokenResponse := &v1pb.UserAccessToken{ + Name: fmt.Sprintf("users/%d/accessTokens/%s", userID, userAccessToken.AccessToken), AccessToken: userAccessToken.AccessToken, Description: userAccessToken.Description, IssuedAt: timestamppb.New(claims.IssuedAt.Time), } if claims.ExpiresAt != nil { - userAccessToken.ExpiresAt = timestamppb.New(claims.ExpiresAt.Time) + accessTokenResponse.ExpiresAt = timestamppb.New(claims.ExpiresAt.Time) } - accessTokens = append(accessTokens, userAccessToken) + accessTokens = append(accessTokens, accessTokenResponse) } // Sort by issued time in descending order. @@ -404,7 +484,7 @@ func (s *APIV1Service) ListUserAccessTokens(ctx context.Context, request *v1pb.L } func (s *APIV1Service) CreateUserAccessToken(ctx context.Context, request *v1pb.CreateUserAccessTokenRequest) (*v1pb.UserAccessToken, error) { - userID, err := ExtractUserIDFromName(request.Name) + userID, err := ExtractUserIDFromName(request.Parent) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) } @@ -420,8 +500,8 @@ func (s *APIV1Service) CreateUserAccessToken(ctx context.Context, request *v1pb. } expiresAt := time.Time{} - if request.ExpiresAt != nil { - expiresAt = request.ExpiresAt.AsTime() + if request.AccessToken.ExpiresAt != nil { + expiresAt = request.AccessToken.ExpiresAt.AsTime() } accessToken, err := GenerateAccessToken(currentUser.Username, currentUser.ID, expiresAt, []byte(s.Secret)) @@ -446,13 +526,14 @@ func (s *APIV1Service) CreateUserAccessToken(ctx context.Context, request *v1pb. } // Upsert the access token to user setting store. - if err := s.UpsertAccessTokenToStore(ctx, currentUser, accessToken, request.Description); err != nil { + if err := s.UpsertAccessTokenToStore(ctx, currentUser, accessToken, request.AccessToken.Description); err != nil { return nil, status.Errorf(codes.Internal, "failed to upsert access token to store: %v", err) } userAccessToken := &v1pb.UserAccessToken{ + Name: fmt.Sprintf("users/%d/accessTokens/%s", userID, accessToken), AccessToken: accessToken, - Description: request.Description, + Description: request.AccessToken.Description, IssuedAt: timestamppb.New(claims.IssuedAt.Time), } if claims.ExpiresAt != nil { @@ -462,10 +543,19 @@ func (s *APIV1Service) CreateUserAccessToken(ctx context.Context, request *v1pb. } func (s *APIV1Service) DeleteUserAccessToken(ctx context.Context, request *v1pb.DeleteUserAccessTokenRequest) (*emptypb.Empty, error) { - userID, err := ExtractUserIDFromName(request.Name) + // Extract user ID from the access token resource name + // Format: users/{user}/accessTokens/{access_token} + parts := strings.Split(request.Name, "/") + if len(parts) != 4 || parts[0] != "users" || parts[2] != "accessTokens" { + return nil, status.Errorf(codes.InvalidArgument, "invalid access token name format: %s", request.Name) + } + + userID, err := ExtractUserIDFromName(fmt.Sprintf("users/%s", parts[1])) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) } + accessTokenToDelete := parts[3] + currentUser, err := s.GetCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) @@ -483,7 +573,7 @@ func (s *APIV1Service) DeleteUserAccessToken(ctx context.Context, request *v1pb. } updatedUserAccessTokens := []*storepb.AccessTokensUserSetting_AccessToken{} for _, userAccessToken := range userAccessTokens { - if userAccessToken.AccessToken == request.AccessToken { + if userAccessToken.AccessToken == accessTokenToDelete { continue } updatedUserAccessTokens = append(updatedUserAccessTokens, userAccessToken) @@ -528,6 +618,11 @@ func (s *APIV1Service) UpsertAccessTokenToStore(ctx context.Context, user *store } func convertUserFromStore(user *store.User) *v1pb.User { + // Generate etag based on user data + etagData := fmt.Sprintf("%d-%d-%s-%s-%s", user.ID, user.UpdatedTs, user.Username, user.Email, user.Nickname) + hash := md5.Sum([]byte(etagData)) + etag := fmt.Sprintf("%x", hash) + userpb := &v1pb.User{ Name: fmt.Sprintf("%s%d", UserNamePrefix, user.ID), State: convertStateFromStore(user.RowStatus), @@ -536,9 +631,10 @@ func convertUserFromStore(user *store.User) *v1pb.User { Role: convertUserRoleFromStore(user.Role), Username: user.Username, Email: user.Email, - Nickname: user.Nickname, + DisplayName: user.Nickname, AvatarUrl: user.AvatarURL, Description: user.Description, + Etag: etag, } // Use the avatar URL instead of raw base64 image data to reduce the response size. if user.AvatarURL != "" { diff --git a/server/router/api/v1/user_service_stats.go b/server/router/api/v1/user_service_stats.go index ada62da63..0f61eb6c3 100644 --- a/server/router/api/v1/user_service_stats.go +++ b/server/router/api/v1/user_service_stats.go @@ -51,51 +51,28 @@ func (s *APIV1Service) ListAllUserStats(ctx context.Context, _ *v1pb.ListAllUser if err != nil { return nil, status.Errorf(codes.Internal, "failed to list memos: %v", err) } - userStatsMap := map[string]*v1pb.UserStats{} + + userMemoStatMap := make(map[int32]*v1pb.UserStats) for _, memo := range memos { - creator := fmt.Sprintf("%s%d", UserNamePrefix, memo.CreatorID) - if _, ok := userStatsMap[creator]; !ok { - userStatsMap[creator] = &v1pb.UserStats{ - Name: creator, - MemoDisplayTimestamps: []*timestamppb.Timestamp{}, - MemoTypeStats: &v1pb.UserStats_MemoTypeStats{}, - TagCount: map[string]int32{}, - } - } displayTs := memo.CreatedTs if workspaceMemoRelatedSetting.DisplayWithUpdateTime { displayTs = memo.UpdatedTs } - userStats := userStatsMap[creator] - userStats.MemoDisplayTimestamps = append(userStats.MemoDisplayTimestamps, timestamppb.New(time.Unix(displayTs, 0))) - // Handle duplicated tags. - for _, tag := range memo.Payload.Tags { - userStats.TagCount[tag]++ - } - if memo.Pinned { - userStats.PinnedMemos = append(userStats.PinnedMemos, fmt.Sprintf("%s%s", MemoNamePrefix, memo.UID)) - } - if memo.Payload.Property.GetHasLink() { - userStats.MemoTypeStats.LinkCount++ + userMemoStatMap[memo.CreatorID] = &v1pb.UserStats{ + Name: fmt.Sprintf("users/%d/stats", memo.CreatorID), } - if memo.Payload.Property.GetHasCode() { - userStats.MemoTypeStats.CodeCount++ - } - if memo.Payload.Property.GetHasTaskList() { - userStats.MemoTypeStats.TodoCount++ - } - if memo.Payload.Property.GetHasIncompleteTasks() { - userStats.MemoTypeStats.UndoCount++ - } - userStats.TotalMemoCount++ + userMemoStatMap[memo.CreatorID].MemoDisplayTimestamps = append(userMemoStatMap[memo.CreatorID].MemoDisplayTimestamps, timestamppb.New(time.Unix(displayTs, 0))) } - userStatsList := []*v1pb.UserStats{} - for _, userStats := range userStatsMap { - userStatsList = append(userStatsList, userStats) + + userMemoStats := []*v1pb.UserStats{} + for _, userMemoStat := range userMemoStatMap { + userMemoStats = append(userMemoStats, userMemoStat) } - return &v1pb.ListAllUserStatsResponse{ - UserStats: userStatsList, - }, nil + + response := &v1pb.ListAllUserStatsResponse{ + UserStats: userMemoStats, + } + return response, nil } func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserStatsRequest) (*v1pb.UserStats, error) { @@ -103,32 +80,27 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err) } - user, err := s.Store.GetUser(ctx, &store.FindUser{ID: &userID}) + + currentUser, err := s.GetCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) } normalStatus := store.Normal memoFind := &store.FindMemo{ + CreatorID: &userID, // Exclude comments by default. ExcludeComments: true, ExcludeContent: true, - CreatorID: &userID, RowStatus: &normalStatus, } - currentUser, err := s.GetCurrentUser(ctx) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) - } - visibilities := []store.Visibility{store.Public} - if currentUser != nil { - visibilities = append(visibilities, store.Protected) - if currentUser.ID == user.ID { - visibilities = append(visibilities, store.Private) - } + if currentUser == nil { + memoFind.VisibilityList = []store.Visibility{store.Public} + } else if currentUser.ID != userID { + memoFind.VisibilityList = []store.Visibility{store.Public, store.Protected} } - memoFind.VisibilityList = visibilities + memos, err := s.Store.ListMemos(ctx, memoFind) if err != nil { return nil, status.Errorf(codes.Internal, "failed to list memos: %v", err) @@ -138,38 +110,56 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt if err != nil { return nil, errors.Wrap(err, "failed to get workspace memo related setting") } - userStats := &v1pb.UserStats{ - Name: fmt.Sprintf("%s%d", UserNamePrefix, user.ID), - MemoDisplayTimestamps: []*timestamppb.Timestamp{}, - MemoTypeStats: &v1pb.UserStats_MemoTypeStats{}, - TagCount: map[string]int32{}, - TotalMemoCount: int32(len(memos)), - } + + displayTimestamps := []*timestamppb.Timestamp{} + tagCount := make(map[string]int32) + linkCount := int32(0) + codeCount := int32(0) + todoCount := int32(0) + undoCount := int32(0) + pinnedMemos := []string{} + for _, memo := range memos { displayTs := memo.CreatedTs if workspaceMemoRelatedSetting.DisplayWithUpdateTime { displayTs = memo.UpdatedTs } - userStats.MemoDisplayTimestamps = append(userStats.MemoDisplayTimestamps, timestamppb.New(time.Unix(displayTs, 0))) - // Handle duplicated tags. - for _, tag := range memo.Payload.Tags { - userStats.TagCount[tag]++ + displayTimestamps = append(displayTimestamps, timestamppb.New(time.Unix(displayTs, 0))) + + // Count different memo types based on content + if memo.Payload != nil && memo.Payload.Property != nil { + if memo.Payload.Property.HasLink { + linkCount++ + } + if memo.Payload.Property.HasCode { + codeCount++ + } + if memo.Payload.Property.HasTaskList { + todoCount++ + } + if memo.Payload.Property.HasIncompleteTasks { + undoCount++ + } } + if memo.Pinned { - userStats.PinnedMemos = append(userStats.PinnedMemos, fmt.Sprintf("%s%s", MemoNamePrefix, memo.UID)) - } - if memo.Payload.Property.GetHasLink() { - userStats.MemoTypeStats.LinkCount++ - } - if memo.Payload.Property.GetHasCode() { - userStats.MemoTypeStats.CodeCount++ - } - if memo.Payload.Property.GetHasTaskList() { - userStats.MemoTypeStats.TodoCount++ - } - if memo.Payload.Property.GetHasIncompleteTasks() { - userStats.MemoTypeStats.UndoCount++ + pinnedMemos = append(pinnedMemos, fmt.Sprintf("users/%d/memos/%d", userID, memo.ID)) } } + + userStats := &v1pb.UserStats{ + Name: fmt.Sprintf("users/%d/stats", userID), + MemoDisplayTimestamps: displayTimestamps, + TagCount: tagCount, + PinnedMemos: pinnedMemos, + TotalMemoCount: int32(len(memos)), + MemoTypeStats: &v1pb.UserStats_MemoTypeStats{ + LinkCount: linkCount, + CodeCount: codeCount, + TodoCount: todoCount, + UndoCount: undoCount, + }, + } + return userStats, nil } diff --git a/web/src/components/ChangeMemberPasswordDialog.tsx b/web/src/components/ChangeMemberPasswordDialog.tsx index d81654dbf..1974d2279 100644 --- a/web/src/components/ChangeMemberPasswordDialog.tsx +++ b/web/src/components/ChangeMemberPasswordDialog.tsx @@ -67,7 +67,7 @@ const ChangeMemberPasswordDialog: React.FC = (props: Props) => {

- {t("setting.account-section.change-password")} ({user.nickname}) + {t("setting.account-section.change-password")} ({user.displayName})