Commit c9ab03e1 authored by Steven's avatar Steven

refactor: user service

parent 330282d8
......@@ -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<string, int32> 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;
}
......@@ -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,
},
......
......@@ -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
......
......@@ -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,
......
......@@ -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:
......
......@@ -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,
......
......@@ -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)
}
......
......@@ -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 != "" {
......
......@@ -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
}
......@@ -67,7 +67,7 @@ const ChangeMemberPasswordDialog: React.FC<Props> = (props: Props) => {
<div className="max-w-full shadow flex flex-col justify-start items-start bg-white dark:bg-zinc-800 dark:text-gray-300 p-4 rounded-lg">
<div className="flex flex-row justify-between items-center mb-4 gap-2 w-full">
<p>
{t("setting.account-section.change-password")} ({user.nickname})
{t("setting.account-section.change-password")} ({user.displayName})
</p>
<Button variant="plain" onClick={handleCloseBtnClick}>
<XIcon className="w-5 h-auto" />
......
......@@ -70,9 +70,11 @@ const CreateAccessTokenDialog: React.FC<Props> = (props: Props) => {
try {
await userServiceClient.createUserAccessToken({
name: currentUser.name,
description: state.description,
expiresAt: state.expiration ? new Date(Date.now() + state.expiration * 1000) : undefined,
parent: currentUser.name,
accessToken: {
description: state.description,
expiresAt: state.expiration ? new Date(Date.now() + state.expiration * 1000) : undefined,
},
});
onConfirm();
......
......@@ -109,7 +109,7 @@ const MemoCommentMessage = observer(({ inbox }: Props) => {
onClick={handleNavigateToMemo}
>
{t("inbox.memo-comment", {
user: sender?.nickname || sender?.username,
user: sender?.displayName || sender?.username,
memo: relatedMemo?.name,
interpolation: { escapeValue: false },
})}
......
......@@ -148,7 +148,7 @@ const MemoView: React.FC<Props> = observer((props: Props) => {
to={`/u/${encodeURIComponent(creator.username)}`}
viewTransition
>
{creator.nickname || creator.username}
{creator.displayName || creator.username}
</Link>
<div
className="w-auto -mt-0.5 text-xs leading-tight text-gray-400 dark:text-gray-500 select-none cursor-pointer"
......
......@@ -19,12 +19,12 @@ const stringifyUsers = (users: User[], reactionType: string): string => {
return "";
}
if (users.length < 5) {
return users.map((user) => user.nickname || user.username).join(", ") + " reacted with " + reactionType.toLowerCase();
return users.map((user) => user.displayName || user.username).join(", ") + " reacted with " + reactionType.toLowerCase();
}
return (
`${users
.slice(0, 4)
.map((user) => user.nickname || user.username)
.map((user) => user.displayName || user.username)
.join(", ")} and ${users.length - 4} more reacted with ` + reactionType.toLowerCase()
);
};
......
......@@ -10,8 +10,8 @@ import { useTranslate } from "@/utils/i18n";
import showCreateAccessTokenDialog from "../CreateAccessTokenDialog";
import LearnMore from "../LearnMore";
const listAccessTokens = async (name: string) => {
const { accessTokens } = await userServiceClient.listUserAccessTokens({ name });
const listAccessTokens = async (parent: string) => {
const { accessTokens } = await userServiceClient.listUserAccessTokens({ parent });
return accessTokens.sort((a, b) => (b.issuedAt?.getTime() ?? 0) - (a.issuedAt?.getTime() ?? 0));
};
......@@ -36,12 +36,12 @@ const AccessTokenSection = () => {
toast.success(t("setting.access-token-section.access-token-copied-to-clipboard"));
};
const handleDeleteAccessToken = async (accessToken: string) => {
const formatedAccessToken = getFormatedAccessToken(accessToken);
const handleDeleteAccessToken = async (userAccessToken: UserAccessToken) => {
const formatedAccessToken = getFormatedAccessToken(userAccessToken.accessToken);
const confirmed = window.confirm(t("setting.access-token-section.access-token-deletion", { accessToken: formatedAccessToken }));
if (confirmed) {
await userServiceClient.deleteUserAccessToken({ name: currentUser.name, accessToken: accessToken });
setUserAccessTokens(userAccessTokens.filter((token) => token.accessToken !== accessToken));
await userServiceClient.deleteUserAccessToken({ name: userAccessToken.name });
setUserAccessTokens(userAccessTokens.filter((token) => token.accessToken !== userAccessToken.accessToken));
}
};
......@@ -116,7 +116,7 @@ const AccessTokenSection = () => {
<Button
variant="plain"
onClick={() => {
handleDeleteAccessToken(userAccessToken.accessToken);
handleDeleteAccessToken(userAccessToken);
}}
>
<TrashIcon className="text-red-600 w-4 h-auto" />
......
......@@ -109,7 +109,7 @@ const MemberSection = observer(() => {
};
const handleArchiveUserClick = async (user: User) => {
const confirmed = window.confirm(t("setting.member-section.archive-warning", { username: user.nickname }));
const confirmed = window.confirm(t("setting.member-section.archive-warning", { username: user.displayName }));
if (confirmed) {
await userServiceClient.updateUser({
user: {
......@@ -134,7 +134,7 @@ const MemberSection = observer(() => {
};
const handleDeleteUserClick = async (user: User) => {
const confirmed = window.confirm(t("setting.member-section.delete-warning", { username: user.nickname }));
const confirmed = window.confirm(t("setting.member-section.delete-warning", { username: user.displayName }));
if (confirmed) {
await userStore.deleteUser(user.name);
fetchUsers();
......@@ -209,7 +209,7 @@ const MemberSection = observer(() => {
<span className="ml-1 italic">{user.state === State.ARCHIVED && "(Archived)"}</span>
</td>
<td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">{stringifyUserRole(user.role)}</td>
<td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">{user.nickname}</td>
<td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">{user.displayName}</td>
<td className="whitespace-nowrap px-3 py-2 text-sm text-gray-500 dark:text-gray-400">{user.email}</td>
<td className="relative whitespace-nowrap py-2 pl-3 pr-4 text-right text-sm font-medium flex justify-end">
{currentUser?.name === user.name ? (
......
......@@ -19,7 +19,7 @@ const MyAccountSection = () => {
<UserAvatar className="mr-2 shrink-0 w-10 h-10" avatarUrl={user.avatarUrl} />
<div className="max-w-[calc(100%-3rem)] flex flex-col justify-center items-start">
<p className="w-full">
<span className="text-xl leading-tight font-medium">{user.nickname}</span>
<span className="text-xl leading-tight font-medium">{user.displayName}</span>
<span className="ml-1 text-base leading-tight text-gray-500 dark:text-gray-400">({user.username})</span>
</p>
<p className="w-4/5 leading-tight text-sm truncate">{user.description}</p>
......
......@@ -16,7 +16,7 @@ type Props = DialogProps;
interface State {
avatarUrl: string;
username: string;
nickname: string;
displayName: string;
email: string;
description: string;
}
......@@ -27,7 +27,7 @@ const UpdateAccountDialog = ({ destroy }: Props) => {
const [state, setState] = useState<State>({
avatarUrl: currentUser.avatarUrl,
username: currentUser.username,
nickname: currentUser.nickname,
displayName: currentUser.displayName,
email: currentUser.email,
description: currentUser.description,
});
......@@ -66,9 +66,9 @@ const UpdateAccountDialog = ({ destroy }: Props) => {
}
};
const handleNicknameChanged = (e: React.ChangeEvent<HTMLInputElement>) => {
const handleDisplayNameChanged = (e: React.ChangeEvent<HTMLInputElement>) => {
setPartialState({
nickname: e.target.value as string,
displayName: e.target.value as string,
});
};
......@@ -107,8 +107,8 @@ const UpdateAccountDialog = ({ destroy }: Props) => {
if (!isEqual(currentUser.username, state.username)) {
updateMask.push("username");
}
if (!isEqual(currentUser.nickname, state.nickname)) {
updateMask.push("nickname");
if (!isEqual(currentUser.displayName, state.displayName)) {
updateMask.push("display_name");
}
if (!isEqual(currentUser.email, state.email)) {
updateMask.push("email");
......@@ -123,7 +123,7 @@ const UpdateAccountDialog = ({ destroy }: Props) => {
UserPb.fromPartial({
name: currentUser.name,
username: state.username,
nickname: state.nickname,
displayName: state.displayName,
email: state.email,
avatarUrl: state.avatarUrl,
description: state.description,
......@@ -180,8 +180,8 @@ const UpdateAccountDialog = ({ destroy }: Props) => {
</p>
<Input
className="w-full"
value={state.nickname}
onChange={handleNicknameChanged}
value={state.displayName}
onChange={handleDisplayNameChanged}
disabled={workspaceGeneralSetting.disallowChangeNickname}
/>
<p className="text-sm">
......
......@@ -40,7 +40,7 @@ const UserBanner = (props: Props) => {
)}
{!collapsed && (
<span className="ml-2 text-lg font-medium text-slate-800 dark:text-gray-300 grow truncate">
{currentUser.nickname || currentUser.username}
{currentUser.displayName || currentUser.username}
</span>
)}
</div>
......
......@@ -90,7 +90,7 @@ const UserProfile = observer(() => {
<UserAvatar className="w-16! h-16! drop-shadow rounded-3xl" avatarUrl={user?.avatarUrl} />
<div className="mt-2 w-auto max-w-[calc(100%-6rem)] flex flex-col justify-center items-start">
<p className="w-full text-3xl text-black leading-tight font-medium opacity-80 dark:text-gray-200 truncate">
{user.nickname || user.username}
{user.displayName || user.username}
</p>
<p className="w-full text-gray-500 leading-snug dark:text-gray-400 whitespace-pre-wrap truncate line-clamp-6">
{user.description}
......
......@@ -71,9 +71,15 @@ const userStore = (() => {
return userMap[name];
}
}
const user = await userServiceClient.getUserByUsername({
username,
// Use search instead of the deprecated getUserByUsername
const { users } = await userServiceClient.searchUsers({
query: username,
pageSize: 10,
});
const user = users.find((u) => u.username === username);
if (!user) {
throw new Error(`User with username ${username} not found`);
}
state.setPartial({
userMapByName: {
...userMap,
......@@ -122,8 +128,16 @@ const userStore = (() => {
};
const updateUserSetting = async (userSetting: Partial<UserSetting>, updateMask: string[]) => {
if (!state.currentUser) {
throw new Error("No current user");
}
// Ensure the setting has the proper resource name
const settingWithName = {
...userSetting,
name: `${state.currentUser}/setting`,
};
const updatedUserSetting = await userServiceClient.updateUserSetting({
setting: userSetting,
setting: settingWithName,
updateMask: updateMask,
});
state.setPartial({
......@@ -181,6 +195,7 @@ const userStore = (() => {
}
state.setPartial({
userStatsByName: {
...state.userStatsByName,
...userStatsByName,
},
});
......@@ -210,7 +225,7 @@ const userStore = (() => {
export const initialUserStore = async () => {
try {
const currentUser = await authServiceClient.getAuthStatus({});
const userSetting = await userServiceClient.getUserSetting({});
const userSetting = await userServiceClient.getUserSetting({ name: currentUser.name });
userStore.state.setPartial({
currentUser: currentUser.name,
userSetting: UserSetting.fromPartial({
......
......@@ -16,26 +16,49 @@ export const protobufPackage = "memos.api.v1";
export interface User {
/**
* 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}
*/
name: string;
/** Output only. The system generated unique identifier. */
uid: string;
/** The role of the user. */
role: User_Role;
/** Required. The unique username for login. */
username: string;
/** Optional. The email address of the user. */
email: string;
nickname: string;
/** Optional. The display name of the user. */
displayName: string;
/** Optional. The avatar URL of the user. */
avatarUrl: string;
/** Optional. The description of the user. */
description: string;
/** Input only. The password for the user. */
password: string;
/** The state of the user. */
state: State;
createTime?: Date | undefined;
updateTime?: Date | undefined;
/** Output only. The creation timestamp. */
createTime?:
| Date
| undefined;
/** Output only. The last update timestamp. */
updateTime?:
| Date
| undefined;
/** Output only. The etag for this resource. */
etag: string;
}
/** User role enumeration. */
export enum User_Role {
/** ROLE_UNSPECIFIED - Unspecified role. */
ROLE_UNSPECIFIED = "ROLE_UNSPECIFIED",
/** HOST - Host role with full system access. */
HOST = "HOST",
/** ADMIN - Admin role with administrative privileges. */
ADMIN = "ADMIN",
/** USER - Regular user role. */
USER = "USER",
UNRECOGNIZED = "UNRECOGNIZED",
}
......@@ -78,62 +101,146 @@ export function user_RoleToNumber(object: User_Role): number {
}
export interface 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.
*/
pageSize: number;
/**
* Optional. A page token, received from a previous `ListUsers` call.
* Provide this to retrieve the subsequent page.
*/
pageToken: string;
/**
* 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;
/**
* Optional. The order to sort results by.
* Example: "create_time desc" or "username asc"
*/
orderBy: string;
/** Optional. If true, show deleted users in the response. */
showDeleted: boolean;
}
export interface ListUsersResponse {
/** The list of users. */
users: User[];
/**
* 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;
/** The total count of users (may be approximate). */
totalSize: number;
}
export interface GetUserRequest {
/** The name of the user. */
/**
* Required. The resource name of the user.
* Format: users/{user}
*/
name: string;
/**
* Optional. The fields to return in the response.
* If not specified, all fields are returned.
*/
readMask?: string[] | undefined;
}
export interface GetUserByUsernameRequest {
/** The username of the user. */
username: string;
export interface CreateUserRequest {
/** Required. The user to create. */
user?:
| User
| undefined;
/**
* 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;
/** Optional. If set, validate the request but don't actually create the user. */
validateOnly: boolean;
/**
* Optional. An idempotency token that can be used to ensure that multiple
* requests to create a user have the same result.
*/
requestId: string;
}
export interface UpdateUserRequest {
/** Required. The user to update. */
user?:
| User
| undefined;
/** Required. The list of fields to update. */
updateMask?:
| string[]
| undefined;
/** Optional. If set to true, allows updating sensitive fields. */
allowMissing: boolean;
}
export interface GetUserAvatarBinaryRequest {
/** The name of the user. */
export interface DeleteUserRequest {
/**
* Required. The resource name of the user to delete.
* Format: users/{user}
*/
name: string;
/** The raw HTTP body is bound to this field. */
httpBody?: HttpBody | undefined;
/** Optional. If set to true, the user will be deleted even if they have associated data. */
force: boolean;
}
export interface CreateUserRequest {
user?: User | undefined;
export interface SearchUsersRequest {
/** Required. The search query. */
query: string;
/** Optional. The maximum number of users to return. */
pageSize: number;
/** Optional. A page token for pagination. */
pageToken: string;
}
export interface UpdateUserRequest {
user?: User | undefined;
updateMask?: string[] | undefined;
export interface SearchUsersResponse {
/** The list of users matching the search query. */
users: User[];
/** A token for the next page of results. */
nextPageToken: string;
/** The total count of matching users. */
totalSize: number;
}
export interface DeleteUserRequest {
/** The name of the user. */
export interface GetUserAvatarRequest {
/**
* Required. The resource name of the user.
* Format: users/{user}
*/
name: string;
}
/** User statistics messages */
export interface UserStats {
/** The name of the user. */
name: string;
/**
* 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.
* The resource name of the user whose stats these are.
* Format: users/{user}
*/
name: string;
/** The timestamps when the memos were displayed. */
memoDisplayTimestamps: Date[];
/** The stats of memo types. */
memoTypeStats?:
| UserStats_MemoTypeStats
| undefined;
/**
* The count of tags.
* Format: "tag1": 1, "tag2": 2
*/
/** The count of tags. */
tagCount: { [key: string]: number };
/** The pinned memos of the user. */
pinnedMemos: string[];
/** Total memo count. */
totalMemoCount: number;
}
......@@ -142,6 +249,7 @@ export interface UserStats_TagCountEntry {
value: number;
}
/** Memo type statistics. */
export interface UserStats_MemoTypeStats {
linkCount: number;
codeCount: number;
......@@ -149,20 +257,20 @@ export interface UserStats_MemoTypeStats {
undoCount: number;
}
export interface ListAllUserStatsRequest {
}
export interface ListAllUserStatsResponse {
userStats: UserStats[];
}
export interface GetUserStatsRequest {
/** The name of the user. */
/**
* Required. The resource name of the user.
* Format: users/{user}
*/
name: string;
}
/** User settings message */
export interface UserSetting {
/** The name of the user. */
/**
* The resource name of the user whose setting this is.
* Format: users/{user}
*/
name: string;
/** The preferred locale of the user. */
locale: string;
......@@ -173,58 +281,115 @@ export interface UserSetting {
}
export interface GetUserSettingRequest {
/** The name of the user. */
/**
* Required. The resource name of the user.
* Format: users/{user}
*/
name: string;
}
export interface UpdateUserSettingRequest {
setting?: UserSetting | undefined;
/** Required. The user setting to update. */
setting?:
| UserSetting
| undefined;
/** Required. The list of fields to update. */
updateMask?: string[] | undefined;
}
/** User access token message */
export interface UserAccessToken {
/**
* The resource name of the access token.
* Format: users/{user}/accessTokens/{access_token}
*/
name: string;
/** Output only. The access token value. */
accessToken: string;
/** The description of the access token. */
description: string;
issuedAt?: Date | undefined;
/** Output only. The issued timestamp. */
issuedAt?:
| Date
| undefined;
/** Optional. The expiration timestamp. */
expiresAt?: Date | undefined;
}
export interface ListUserAccessTokensRequest {
/** The name of the user. */
name: string;
/**
* Required. The parent resource whose access tokens will be listed.
* Format: users/{user}
*/
parent: string;
/** Optional. The maximum number of access tokens to return. */
pageSize: number;
/** Optional. A page token for pagination. */
pageToken: string;
}
export interface ListUserAccessTokensResponse {
/** The list of access tokens. */
accessTokens: UserAccessToken[];
/** A token for the next page of results. */
nextPageToken: string;
/** The total count of access tokens. */
totalSize: number;
}
export interface CreateUserAccessTokenRequest {
/** The name of the user. */
name: string;
description: string;
expiresAt?: Date | undefined;
/**
* Required. The parent resource where this access token will be created.
* Format: users/{user}
*/
parent: string;
/** Required. The access token to create. */
accessToken?:
| UserAccessToken
| undefined;
/** Optional. The access token ID to use. */
accessTokenId: string;
}
export interface DeleteUserAccessTokenRequest {
/** The name of the user. */
/**
* Required. The resource name of the access token to delete.
* Format: users/{user}/accessTokens/{access_token}
*/
name: string;
/** access_token is the access token to delete. */
accessToken: string;
}
export interface ListAllUserStatsRequest {
/** Optional. The maximum number of user stats to return. */
pageSize: number;
/** Optional. A page token for pagination. */
pageToken: string;
}
export interface ListAllUserStatsResponse {
/** The list of user statistics. */
userStats: UserStats[];
/** A token for the next page of results. */
nextPageToken: string;
/** The total count of user statistics. */
totalSize: number;
}
function createBaseUser(): User {
return {
name: "",
uid: "",
role: User_Role.ROLE_UNSPECIFIED,
username: "",
email: "",
nickname: "",
displayName: "",
avatarUrl: "",
description: "",
password: "",
state: State.STATE_UNSPECIFIED,
createTime: undefined,
updateTime: undefined,
etag: "",
};
}
......@@ -233,6 +398,9 @@ export const User: MessageFns<User> = {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.uid !== "") {
writer.uint32(18).string(message.uid);
}
if (message.role !== User_Role.ROLE_UNSPECIFIED) {
writer.uint32(24).int32(user_RoleToNumber(message.role));
}
......@@ -242,8 +410,8 @@ export const User: MessageFns<User> = {
if (message.email !== "") {
writer.uint32(42).string(message.email);
}
if (message.nickname !== "") {
writer.uint32(50).string(message.nickname);
if (message.displayName !== "") {
writer.uint32(50).string(message.displayName);
}
if (message.avatarUrl !== "") {
writer.uint32(58).string(message.avatarUrl);
......@@ -263,6 +431,9 @@ export const User: MessageFns<User> = {
if (message.updateTime !== undefined) {
Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(98).fork()).join();
}
if (message.etag !== "") {
writer.uint32(106).string(message.etag);
}
return writer;
},
......@@ -281,6 +452,14 @@ export const User: MessageFns<User> = {
message.name = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.uid = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
......@@ -310,7 +489,7 @@ export const User: MessageFns<User> = {
break;
}
message.nickname = reader.string();
message.displayName = reader.string();
continue;
}
case 7: {
......@@ -361,6 +540,14 @@ export const User: MessageFns<User> = {
message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 13: {
if (tag !== 106) {
break;
}
message.etag = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
......@@ -376,26 +563,43 @@ export const User: MessageFns<User> = {
fromPartial(object: DeepPartial<User>): User {
const message = createBaseUser();
message.name = object.name ?? "";
message.uid = object.uid ?? "";
message.role = object.role ?? User_Role.ROLE_UNSPECIFIED;
message.username = object.username ?? "";
message.email = object.email ?? "";
message.nickname = object.nickname ?? "";
message.displayName = object.displayName ?? "";
message.avatarUrl = object.avatarUrl ?? "";
message.description = object.description ?? "";
message.password = object.password ?? "";
message.state = object.state ?? State.STATE_UNSPECIFIED;
message.createTime = object.createTime ?? undefined;
message.updateTime = object.updateTime ?? undefined;
message.etag = object.etag ?? "";
return message;
},
};
function createBaseListUsersRequest(): ListUsersRequest {
return {};
return { pageSize: 0, pageToken: "", filter: "", orderBy: "", showDeleted: false };
}
export const ListUsersRequest: MessageFns<ListUsersRequest> = {
encode(_: ListUsersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
encode(message: ListUsersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.pageSize !== 0) {
writer.uint32(8).int32(message.pageSize);
}
if (message.pageToken !== "") {
writer.uint32(18).string(message.pageToken);
}
if (message.filter !== "") {
writer.uint32(26).string(message.filter);
}
if (message.orderBy !== "") {
writer.uint32(34).string(message.orderBy);
}
if (message.showDeleted !== false) {
writer.uint32(40).bool(message.showDeleted);
}
return writer;
},
......@@ -406,6 +610,46 @@ export const ListUsersRequest: MessageFns<ListUsersRequest> = {
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.pageSize = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.pageToken = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.filter = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.orderBy = reader.string();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.showDeleted = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
......@@ -418,14 +662,19 @@ export const ListUsersRequest: MessageFns<ListUsersRequest> = {
create(base?: DeepPartial<ListUsersRequest>): ListUsersRequest {
return ListUsersRequest.fromPartial(base ?? {});
},
fromPartial(_: DeepPartial<ListUsersRequest>): ListUsersRequest {
fromPartial(object: DeepPartial<ListUsersRequest>): ListUsersRequest {
const message = createBaseListUsersRequest();
message.pageSize = object.pageSize ?? 0;
message.pageToken = object.pageToken ?? "";
message.filter = object.filter ?? "";
message.orderBy = object.orderBy ?? "";
message.showDeleted = object.showDeleted ?? false;
return message;
},
};
function createBaseListUsersResponse(): ListUsersResponse {
return { users: [] };
return { users: [], nextPageToken: "", totalSize: 0 };
}
export const ListUsersResponse: MessageFns<ListUsersResponse> = {
......@@ -433,6 +682,12 @@ export const ListUsersResponse: MessageFns<ListUsersResponse> = {
for (const v of message.users) {
User.encode(v!, writer.uint32(10).fork()).join();
}
if (message.nextPageToken !== "") {
writer.uint32(18).string(message.nextPageToken);
}
if (message.totalSize !== 0) {
writer.uint32(24).int32(message.totalSize);
}
return writer;
},
......@@ -451,6 +706,22 @@ export const ListUsersResponse: MessageFns<ListUsersResponse> = {
message.users.push(User.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.nextPageToken = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.totalSize = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
......@@ -466,12 +737,14 @@ export const ListUsersResponse: MessageFns<ListUsersResponse> = {
fromPartial(object: DeepPartial<ListUsersResponse>): ListUsersResponse {
const message = createBaseListUsersResponse();
message.users = object.users?.map((e) => User.fromPartial(e)) || [];
message.nextPageToken = object.nextPageToken ?? "";
message.totalSize = object.totalSize ?? 0;
return message;
},
};
function createBaseGetUserRequest(): GetUserRequest {
return { name: "" };
return { name: "", readMask: undefined };
}
export const GetUserRequest: MessageFns<GetUserRequest> = {
......@@ -479,6 +752,9 @@ export const GetUserRequest: MessageFns<GetUserRequest> = {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.readMask !== undefined) {
FieldMask.encode(FieldMask.wrap(message.readMask), writer.uint32(18).fork()).join();
}
return writer;
},
......@@ -497,6 +773,14 @@ export const GetUserRequest: MessageFns<GetUserRequest> = {
message.name = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.readMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
......@@ -512,75 +796,36 @@ export const GetUserRequest: MessageFns<GetUserRequest> = {
fromPartial(object: DeepPartial<GetUserRequest>): GetUserRequest {
const message = createBaseGetUserRequest();
message.name = object.name ?? "";
message.readMask = object.readMask ?? undefined;
return message;
},
};
function createBaseGetUserByUsernameRequest(): GetUserByUsernameRequest {
return { username: "" };
function createBaseCreateUserRequest(): CreateUserRequest {
return { user: undefined, userId: "", validateOnly: false, requestId: "" };
}
export const GetUserByUsernameRequest: MessageFns<GetUserByUsernameRequest> = {
encode(message: GetUserByUsernameRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.username !== "") {
writer.uint32(10).string(message.username);
export const CreateUserRequest: MessageFns<CreateUserRequest> = {
encode(message: CreateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.user !== undefined) {
User.encode(message.user, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GetUserByUsernameRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetUserByUsernameRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.username = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
if (message.userId !== "") {
writer.uint32(18).string(message.userId);
}
return message;
},
create(base?: DeepPartial<GetUserByUsernameRequest>): GetUserByUsernameRequest {
return GetUserByUsernameRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetUserByUsernameRequest>): GetUserByUsernameRequest {
const message = createBaseGetUserByUsernameRequest();
message.username = object.username ?? "";
return message;
},
};
function createBaseGetUserAvatarBinaryRequest(): GetUserAvatarBinaryRequest {
return { name: "", httpBody: undefined };
}
export const GetUserAvatarBinaryRequest: MessageFns<GetUserAvatarBinaryRequest> = {
encode(message: GetUserAvatarBinaryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") {
writer.uint32(10).string(message.name);
if (message.validateOnly !== false) {
writer.uint32(24).bool(message.validateOnly);
}
if (message.httpBody !== undefined) {
HttpBody.encode(message.httpBody, writer.uint32(18).fork()).join();
if (message.requestId !== "") {
writer.uint32(34).string(message.requestId);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GetUserAvatarBinaryRequest {
decode(input: BinaryReader | Uint8Array, length?: number): CreateUserRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetUserAvatarBinaryRequest();
const message = createBaseCreateUserRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
......@@ -589,7 +834,7 @@ export const GetUserAvatarBinaryRequest: MessageFns<GetUserAvatarBinaryRequest>
break;
}
message.name = reader.string();
message.user = User.decode(reader, reader.uint32());
continue;
}
case 2: {
......@@ -597,56 +842,23 @@ export const GetUserAvatarBinaryRequest: MessageFns<GetUserAvatarBinaryRequest>
break;
}
message.httpBody = HttpBody.decode(reader, reader.uint32());
message.userId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<GetUserAvatarBinaryRequest>): GetUserAvatarBinaryRequest {
return GetUserAvatarBinaryRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetUserAvatarBinaryRequest>): GetUserAvatarBinaryRequest {
const message = createBaseGetUserAvatarBinaryRequest();
message.name = object.name ?? "";
message.httpBody = (object.httpBody !== undefined && object.httpBody !== null)
? HttpBody.fromPartial(object.httpBody)
: undefined;
return message;
},
};
function createBaseCreateUserRequest(): CreateUserRequest {
return { user: undefined };
}
export const CreateUserRequest: MessageFns<CreateUserRequest> = {
encode(message: CreateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.user !== undefined) {
User.encode(message.user, writer.uint32(10).fork()).join();
}
return writer;
},
case 3: {
if (tag !== 24) {
break;
}
decode(input: BinaryReader | Uint8Array, length?: number): CreateUserRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateUserRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
message.validateOnly = reader.bool();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.user = User.decode(reader, reader.uint32());
message.requestId = reader.string();
continue;
}
}
......@@ -664,12 +876,15 @@ export const CreateUserRequest: MessageFns<CreateUserRequest> = {
fromPartial(object: DeepPartial<CreateUserRequest>): CreateUserRequest {
const message = createBaseCreateUserRequest();
message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;
message.userId = object.userId ?? "";
message.validateOnly = object.validateOnly ?? false;
message.requestId = object.requestId ?? "";
return message;
},
};
function createBaseUpdateUserRequest(): UpdateUserRequest {
return { user: undefined, updateMask: undefined };
return { user: undefined, updateMask: undefined, allowMissing: false };
}
export const UpdateUserRequest: MessageFns<UpdateUserRequest> = {
......@@ -680,6 +895,9 @@ export const UpdateUserRequest: MessageFns<UpdateUserRequest> = {
if (message.updateMask !== undefined) {
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
}
if (message.allowMissing !== false) {
writer.uint32(24).bool(message.allowMissing);
}
return writer;
},
......@@ -706,6 +924,14 @@ export const UpdateUserRequest: MessageFns<UpdateUserRequest> = {
message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.allowMissing = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
......@@ -722,12 +948,13 @@ export const UpdateUserRequest: MessageFns<UpdateUserRequest> = {
const message = createBaseUpdateUserRequest();
message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined;
message.updateMask = object.updateMask ?? undefined;
message.allowMissing = object.allowMissing ?? false;
return message;
},
};
function createBaseDeleteUserRequest(): DeleteUserRequest {
return { name: "" };
return { name: "", force: false };
}
export const DeleteUserRequest: MessageFns<DeleteUserRequest> = {
......@@ -735,6 +962,9 @@ export const DeleteUserRequest: MessageFns<DeleteUserRequest> = {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.force !== false) {
writer.uint32(16).bool(message.force);
}
return writer;
},
......@@ -753,7 +983,15 @@ export const DeleteUserRequest: MessageFns<DeleteUserRequest> = {
message.name = reader.string();
continue;
}
}
case 2: {
if (tag !== 16) {
break;
}
message.force = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
......@@ -768,6 +1006,193 @@ export const DeleteUserRequest: MessageFns<DeleteUserRequest> = {
fromPartial(object: DeepPartial<DeleteUserRequest>): DeleteUserRequest {
const message = createBaseDeleteUserRequest();
message.name = object.name ?? "";
message.force = object.force ?? false;
return message;
},
};
function createBaseSearchUsersRequest(): SearchUsersRequest {
return { query: "", pageSize: 0, pageToken: "" };
}
export const SearchUsersRequest: MessageFns<SearchUsersRequest> = {
encode(message: SearchUsersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.query !== "") {
writer.uint32(10).string(message.query);
}
if (message.pageSize !== 0) {
writer.uint32(16).int32(message.pageSize);
}
if (message.pageToken !== "") {
writer.uint32(26).string(message.pageToken);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): SearchUsersRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSearchUsersRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.query = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.pageSize = reader.int32();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.pageToken = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<SearchUsersRequest>): SearchUsersRequest {
return SearchUsersRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<SearchUsersRequest>): SearchUsersRequest {
const message = createBaseSearchUsersRequest();
message.query = object.query ?? "";
message.pageSize = object.pageSize ?? 0;
message.pageToken = object.pageToken ?? "";
return message;
},
};
function createBaseSearchUsersResponse(): SearchUsersResponse {
return { users: [], nextPageToken: "", totalSize: 0 };
}
export const SearchUsersResponse: MessageFns<SearchUsersResponse> = {
encode(message: SearchUsersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.users) {
User.encode(v!, writer.uint32(10).fork()).join();
}
if (message.nextPageToken !== "") {
writer.uint32(18).string(message.nextPageToken);
}
if (message.totalSize !== 0) {
writer.uint32(24).int32(message.totalSize);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): SearchUsersResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSearchUsersResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.users.push(User.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.nextPageToken = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.totalSize = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<SearchUsersResponse>): SearchUsersResponse {
return SearchUsersResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<SearchUsersResponse>): SearchUsersResponse {
const message = createBaseSearchUsersResponse();
message.users = object.users?.map((e) => User.fromPartial(e)) || [];
message.nextPageToken = object.nextPageToken ?? "";
message.totalSize = object.totalSize ?? 0;
return message;
},
};
function createBaseGetUserAvatarRequest(): GetUserAvatarRequest {
return { name: "" };
}
export const GetUserAvatarRequest: MessageFns<GetUserAvatarRequest> = {
encode(message: GetUserAvatarRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GetUserAvatarRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetUserAvatarRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<GetUserAvatarRequest>): GetUserAvatarRequest {
return GetUserAvatarRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<GetUserAvatarRequest>): GetUserAvatarRequest {
const message = createBaseGetUserAvatarRequest();
message.name = object.name ?? "";
return message;
},
};
......@@ -1035,86 +1460,6 @@ export const UserStats_MemoTypeStats: MessageFns<UserStats_MemoTypeStats> = {
},
};
function createBaseListAllUserStatsRequest(): ListAllUserStatsRequest {
return {};
}
export const ListAllUserStatsRequest: MessageFns<ListAllUserStatsRequest> = {
encode(_: ListAllUserStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListAllUserStatsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListAllUserStatsRequest>): ListAllUserStatsRequest {
return ListAllUserStatsRequest.fromPartial(base ?? {});
},
fromPartial(_: DeepPartial<ListAllUserStatsRequest>): ListAllUserStatsRequest {
const message = createBaseListAllUserStatsRequest();
return message;
},
};
function createBaseListAllUserStatsResponse(): ListAllUserStatsResponse {
return { userStats: [] };
}
export const ListAllUserStatsResponse: MessageFns<ListAllUserStatsResponse> = {
encode(message: ListAllUserStatsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.userStats) {
UserStats.encode(v!, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListAllUserStatsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.userStats.push(UserStats.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListAllUserStatsResponse>): ListAllUserStatsResponse {
return ListAllUserStatsResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListAllUserStatsResponse>): ListAllUserStatsResponse {
const message = createBaseListAllUserStatsResponse();
message.userStats = object.userStats?.map((e) => UserStats.fromPartial(e)) || [];
return message;
},
};
function createBaseGetUserStatsRequest(): GetUserStatsRequest {
return { name: "" };
}
......@@ -1350,22 +1695,25 @@ export const UpdateUserSettingRequest: MessageFns<UpdateUserSettingRequest> = {
};
function createBaseUserAccessToken(): UserAccessToken {
return { accessToken: "", description: "", issuedAt: undefined, expiresAt: undefined };
return { name: "", accessToken: "", description: "", issuedAt: undefined, expiresAt: undefined };
}
export const UserAccessToken: MessageFns<UserAccessToken> = {
encode(message: UserAccessToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.accessToken !== "") {
writer.uint32(10).string(message.accessToken);
writer.uint32(18).string(message.accessToken);
}
if (message.description !== "") {
writer.uint32(18).string(message.description);
writer.uint32(26).string(message.description);
}
if (message.issuedAt !== undefined) {
Timestamp.encode(toTimestamp(message.issuedAt), writer.uint32(26).fork()).join();
Timestamp.encode(toTimestamp(message.issuedAt), writer.uint32(34).fork()).join();
}
if (message.expiresAt !== undefined) {
Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(34).fork()).join();
Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(42).fork()).join();
}
return writer;
},
......@@ -1382,7 +1730,7 @@ export const UserAccessToken: MessageFns<UserAccessToken> = {
break;
}
message.accessToken = reader.string();
message.name = reader.string();
continue;
}
case 2: {
......@@ -1390,7 +1738,7 @@ export const UserAccessToken: MessageFns<UserAccessToken> = {
break;
}
message.description = reader.string();
message.accessToken = reader.string();
continue;
}
case 3: {
......@@ -1398,7 +1746,7 @@ export const UserAccessToken: MessageFns<UserAccessToken> = {
break;
}
message.issuedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
message.description = reader.string();
continue;
}
case 4: {
......@@ -1406,6 +1754,14 @@ export const UserAccessToken: MessageFns<UserAccessToken> = {
break;
}
message.issuedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.expiresAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
......@@ -1423,6 +1779,7 @@ export const UserAccessToken: MessageFns<UserAccessToken> = {
},
fromPartial(object: DeepPartial<UserAccessToken>): UserAccessToken {
const message = createBaseUserAccessToken();
message.name = object.name ?? "";
message.accessToken = object.accessToken ?? "";
message.description = object.description ?? "";
message.issuedAt = object.issuedAt ?? undefined;
......@@ -1432,13 +1789,19 @@ export const UserAccessToken: MessageFns<UserAccessToken> = {
};
function createBaseListUserAccessTokensRequest(): ListUserAccessTokensRequest {
return { name: "" };
return { parent: "", pageSize: 0, pageToken: "" };
}
export const ListUserAccessTokensRequest: MessageFns<ListUserAccessTokensRequest> = {
encode(message: ListUserAccessTokensRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") {
writer.uint32(10).string(message.name);
if (message.parent !== "") {
writer.uint32(10).string(message.parent);
}
if (message.pageSize !== 0) {
writer.uint32(16).int32(message.pageSize);
}
if (message.pageToken !== "") {
writer.uint32(26).string(message.pageToken);
}
return writer;
},
......@@ -1455,30 +1818,48 @@ export const ListUserAccessTokensRequest: MessageFns<ListUserAccessTokensRequest
break;
}
message.name = reader.string();
message.parent = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListUserAccessTokensRequest>): ListUserAccessTokensRequest {
case 2: {
if (tag !== 16) {
break;
}
message.pageSize = reader.int32();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.pageToken = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListUserAccessTokensRequest>): ListUserAccessTokensRequest {
return ListUserAccessTokensRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListUserAccessTokensRequest>): ListUserAccessTokensRequest {
const message = createBaseListUserAccessTokensRequest();
message.name = object.name ?? "";
message.parent = object.parent ?? "";
message.pageSize = object.pageSize ?? 0;
message.pageToken = object.pageToken ?? "";
return message;
},
};
function createBaseListUserAccessTokensResponse(): ListUserAccessTokensResponse {
return { accessTokens: [] };
return { accessTokens: [], nextPageToken: "", totalSize: 0 };
}
export const ListUserAccessTokensResponse: MessageFns<ListUserAccessTokensResponse> = {
......@@ -1486,6 +1867,12 @@ export const ListUserAccessTokensResponse: MessageFns<ListUserAccessTokensRespon
for (const v of message.accessTokens) {
UserAccessToken.encode(v!, writer.uint32(10).fork()).join();
}
if (message.nextPageToken !== "") {
writer.uint32(18).string(message.nextPageToken);
}
if (message.totalSize !== 0) {
writer.uint32(24).int32(message.totalSize);
}
return writer;
},
......@@ -1504,6 +1891,22 @@ export const ListUserAccessTokensResponse: MessageFns<ListUserAccessTokensRespon
message.accessTokens.push(UserAccessToken.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.nextPageToken = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.totalSize = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
......@@ -1519,24 +1922,26 @@ export const ListUserAccessTokensResponse: MessageFns<ListUserAccessTokensRespon
fromPartial(object: DeepPartial<ListUserAccessTokensResponse>): ListUserAccessTokensResponse {
const message = createBaseListUserAccessTokensResponse();
message.accessTokens = object.accessTokens?.map((e) => UserAccessToken.fromPartial(e)) || [];
message.nextPageToken = object.nextPageToken ?? "";
message.totalSize = object.totalSize ?? 0;
return message;
},
};
function createBaseCreateUserAccessTokenRequest(): CreateUserAccessTokenRequest {
return { name: "", description: "", expiresAt: undefined };
return { parent: "", accessToken: undefined, accessTokenId: "" };
}
export const CreateUserAccessTokenRequest: MessageFns<CreateUserAccessTokenRequest> = {
encode(message: CreateUserAccessTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") {
writer.uint32(10).string(message.name);
if (message.parent !== "") {
writer.uint32(10).string(message.parent);
}
if (message.description !== "") {
writer.uint32(18).string(message.description);
if (message.accessToken !== undefined) {
UserAccessToken.encode(message.accessToken, writer.uint32(18).fork()).join();
}
if (message.expiresAt !== undefined) {
Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(26).fork()).join();
if (message.accessTokenId !== "") {
writer.uint32(26).string(message.accessTokenId);
}
return writer;
},
......@@ -1553,7 +1958,7 @@ export const CreateUserAccessTokenRequest: MessageFns<CreateUserAccessTokenReque
break;
}
message.name = reader.string();
message.parent = reader.string();
continue;
}
case 2: {
......@@ -1561,7 +1966,7 @@ export const CreateUserAccessTokenRequest: MessageFns<CreateUserAccessTokenReque
break;
}
message.description = reader.string();
message.accessToken = UserAccessToken.decode(reader, reader.uint32());
continue;
}
case 3: {
......@@ -1569,7 +1974,7 @@ export const CreateUserAccessTokenRequest: MessageFns<CreateUserAccessTokenReque
break;
}
message.expiresAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
message.accessTokenId = reader.string();
continue;
}
}
......@@ -1586,15 +1991,17 @@ export const CreateUserAccessTokenRequest: MessageFns<CreateUserAccessTokenReque
},
fromPartial(object: DeepPartial<CreateUserAccessTokenRequest>): CreateUserAccessTokenRequest {
const message = createBaseCreateUserAccessTokenRequest();
message.name = object.name ?? "";
message.description = object.description ?? "";
message.expiresAt = object.expiresAt ?? undefined;
message.parent = object.parent ?? "";
message.accessToken = (object.accessToken !== undefined && object.accessToken !== null)
? UserAccessToken.fromPartial(object.accessToken)
: undefined;
message.accessTokenId = object.accessTokenId ?? "";
return message;
},
};
function createBaseDeleteUserAccessTokenRequest(): DeleteUserAccessTokenRequest {
return { name: "", accessToken: "" };
return { name: "" };
}
export const DeleteUserAccessTokenRequest: MessageFns<DeleteUserAccessTokenRequest> = {
......@@ -1602,9 +2009,6 @@ export const DeleteUserAccessTokenRequest: MessageFns<DeleteUserAccessTokenReque
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.accessToken !== "") {
writer.uint32(18).string(message.accessToken);
}
return writer;
},
......@@ -1623,12 +2027,61 @@ export const DeleteUserAccessTokenRequest: MessageFns<DeleteUserAccessTokenReque
message.name = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<DeleteUserAccessTokenRequest>): DeleteUserAccessTokenRequest {
return DeleteUserAccessTokenRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<DeleteUserAccessTokenRequest>): DeleteUserAccessTokenRequest {
const message = createBaseDeleteUserAccessTokenRequest();
message.name = object.name ?? "";
return message;
},
};
function createBaseListAllUserStatsRequest(): ListAllUserStatsRequest {
return { pageSize: 0, pageToken: "" };
}
export const ListAllUserStatsRequest: MessageFns<ListAllUserStatsRequest> = {
encode(message: ListAllUserStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.pageSize !== 0) {
writer.uint32(8).int32(message.pageSize);
}
if (message.pageToken !== "") {
writer.uint32(18).string(message.pageToken);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListAllUserStatsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.pageSize = reader.int32();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.accessToken = reader.string();
message.pageToken = reader.string();
continue;
}
}
......@@ -1640,13 +2093,83 @@ export const DeleteUserAccessTokenRequest: MessageFns<DeleteUserAccessTokenReque
return message;
},
create(base?: DeepPartial<DeleteUserAccessTokenRequest>): DeleteUserAccessTokenRequest {
return DeleteUserAccessTokenRequest.fromPartial(base ?? {});
create(base?: DeepPartial<ListAllUserStatsRequest>): ListAllUserStatsRequest {
return ListAllUserStatsRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<DeleteUserAccessTokenRequest>): DeleteUserAccessTokenRequest {
const message = createBaseDeleteUserAccessTokenRequest();
message.name = object.name ?? "";
message.accessToken = object.accessToken ?? "";
fromPartial(object: DeepPartial<ListAllUserStatsRequest>): ListAllUserStatsRequest {
const message = createBaseListAllUserStatsRequest();
message.pageSize = object.pageSize ?? 0;
message.pageToken = object.pageToken ?? "";
return message;
},
};
function createBaseListAllUserStatsResponse(): ListAllUserStatsResponse {
return { userStats: [], nextPageToken: "", totalSize: 0 };
}
export const ListAllUserStatsResponse: MessageFns<ListAllUserStatsResponse> = {
encode(message: ListAllUserStatsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.userStats) {
UserStats.encode(v!, writer.uint32(10).fork()).join();
}
if (message.nextPageToken !== "") {
writer.uint32(18).string(message.nextPageToken);
}
if (message.totalSize !== 0) {
writer.uint32(24).int32(message.totalSize);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListAllUserStatsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.userStats.push(UserStats.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.nextPageToken = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.totalSize = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<ListAllUserStatsResponse>): ListAllUserStatsResponse {
return ListAllUserStatsResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListAllUserStatsResponse>): ListAllUserStatsResponse {
const message = createBaseListAllUserStatsResponse();
message.userStats = object.userStats?.map((e) => UserStats.fromPartial(e)) || [];
message.nextPageToken = object.nextPageToken ?? "";
message.totalSize = object.totalSize ?? 0;
return message;
},
};
......@@ -1711,21 +2234,27 @@ export const UserServiceDefinition = {
},
},
},
/** GetUserByUsername gets a user by username. */
getUserByUsername: {
name: "GetUserByUsername",
requestType: GetUserByUsernameRequest,
/** CreateUser creates a new user. */
createUser: {
name: "CreateUser",
requestType: CreateUserRequest,
requestStream: false,
responseType: User,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([8, 117, 115, 101, 114, 110, 97, 109, 101])],
8410: [new Uint8Array([4, 117, 115, 101, 114])],
578365826: [
new Uint8Array([
24,
18,
22,
21,
58,
4,
117,
115,
101,
114,
34,
13,
47,
97,
112,
......@@ -1739,42 +2268,46 @@ export const UserServiceDefinition = {
101,
114,
115,
58,
117,
115,
101,
114,
110,
97,
109,
101,
]),
],
},
},
},
/** GetUserAvatarBinary gets the avatar of a user. */
getUserAvatarBinary: {
name: "GetUserAvatarBinary",
requestType: GetUserAvatarBinaryRequest,
/** UpdateUser updates a user. */
updateUser: {
name: "UpdateUser",
requestType: UpdateUserRequest,
requestStream: false,
responseType: HttpBody,
responseType: User,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
8410: [new Uint8Array([16, 117, 115, 101, 114, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])],
578365826: [
new Uint8Array([
29,
18,
35,
58,
4,
117,
115,
101,
114,
50,
27,
47,
102,
97,
112,
105,
108,
101,
47,
118,
49,
47,
123,
117,
115,
101,
114,
46,
110,
97,
109,
......@@ -1788,39 +2321,26 @@ export const UserServiceDefinition = {
47,
42,
125,
47,
97,
118,
97,
116,
97,
114,
]),
],
},
},
},
/** CreateUser creates a new user. */
createUser: {
name: "CreateUser",
requestType: CreateUserRequest,
/** DeleteUser deletes a user. */
deleteUser: {
name: "DeleteUser",
requestType: DeleteUserRequest,
requestStream: false,
responseType: User,
responseType: Empty,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([4, 117, 115, 101, 114])],
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [
new Uint8Array([
21,
58,
4,
117,
115,
101,
114,
34,
13,
24,
42,
22,
47,
97,
112,
......@@ -1829,37 +2349,40 @@ export const UserServiceDefinition = {
118,
49,
47,
123,
110,
97,
109,
101,
61,
117,
115,
101,
114,
115,
47,
42,
125,
]),
],
},
},
},
/** UpdateUser updates a user. */
updateUser: {
name: "UpdateUser",
requestType: UpdateUserRequest,
/** SearchUsers searches for users based on query. */
searchUsers: {
name: "SearchUsers",
requestType: SearchUsersRequest,
requestStream: false,
responseType: User,
responseType: SearchUsersResponse,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([16, 117, 115, 101, 114, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])],
8410: [new Uint8Array([5, 113, 117, 101, 114, 121])],
578365826: [
new Uint8Array([
35,
58,
4,
117,
115,
101,
114,
50,
27,
22,
18,
20,
47,
97,
112,
......@@ -1868,45 +2391,38 @@ export const UserServiceDefinition = {
118,
49,
47,
123,
117,
115,
101,
114,
46,
110,
97,
109,
101,
61,
117,
115,
58,
115,
101,
97,
114,
115,
47,
42,
125,
99,
104,
]),
],
},
},
},
/** DeleteUser deletes a user. */
deleteUser: {
name: "DeleteUser",
requestType: DeleteUserRequest,
/** GetUserAvatar gets the avatar of a user. */
getUserAvatar: {
name: "GetUserAvatar",
requestType: GetUserAvatarRequest,
requestStream: false,
responseType: Empty,
responseType: HttpBody,
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [
new Uint8Array([
24,
42,
22,
31,
18,
29,
47,
97,
112,
......@@ -1929,12 +2445,19 @@ export const UserServiceDefinition = {
47,
42,
125,
47,
97,
118,
97,
116,
97,
114,
]),
],
},
},
},
/** ListAllUserStats returns all user stats. */
/** ListAllUserStats returns statistics for all users. */
listAllUserStats: {
name: "ListAllUserStats",
requestType: ListAllUserStatsRequest,
......@@ -1945,9 +2468,9 @@ export const UserServiceDefinition = {
_unknownFields: {
578365826: [
new Uint8Array([
23,
34,
21,
18,
19,
47,
97,
112,
......@@ -1961,9 +2484,7 @@ export const UserServiceDefinition = {
101,
114,
115,
47,
45,
47,
58,
115,
116,
97,
......@@ -1974,7 +2495,7 @@ export const UserServiceDefinition = {
},
},
},
/** GetUserStats returns the stats of a user. */
/** GetUserStats returns statistics for a specific user. */
getUserStats: {
name: "GetUserStats",
requestType: GetUserStatsRequest,
......@@ -1986,9 +2507,9 @@ export const UserServiceDefinition = {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [
new Uint8Array([
30,
33,
18,
28,
31,
47,
97,
112,
......@@ -2011,8 +2532,11 @@ export const UserServiceDefinition = {
47,
42,
125,
47,
115,
58,
103,
101,
116,
83,
116,
97,
116,
......@@ -2022,7 +2546,7 @@ export const UserServiceDefinition = {
},
},
},
/** GetUserSetting gets the setting of a user. */
/** GetUserSetting returns the user setting. */
getUserSetting: {
name: "GetUserSetting",
requestType: GetUserSettingRequest,
......@@ -2034,9 +2558,9 @@ export const UserServiceDefinition = {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [
new Uint8Array([
32,
35,
18,
30,
33,
47,
97,
112,
......@@ -2059,8 +2583,11 @@ export const UserServiceDefinition = {
47,
42,
125,
47,
115,
58,
103,
101,
116,
83,
101,
116,
116,
......@@ -2072,7 +2599,7 @@ export const UserServiceDefinition = {
},
},
},
/** UpdateUserSetting updates the setting of a user. */
/** UpdateUserSetting updates the user setting. */
updateUserSetting: {
name: "UpdateUserSetting",
requestType: UpdateUserSettingRequest,
......@@ -2107,7 +2634,7 @@ export const UserServiceDefinition = {
],
578365826: [
new Uint8Array([
49,
55,
58,
7,
115,
......@@ -2118,7 +2645,7 @@ export const UserServiceDefinition = {
110,
103,
50,
38,
44,
47,
97,
112,
......@@ -2148,15 +2675,21 @@ export const UserServiceDefinition = {
115,
47,
42,
47,
115,
125,
58,
117,
112,
100,
97,
116,
101,
83,
101,
116,
116,
105,
110,
103,
125,
]),
],
},
......@@ -2171,12 +2704,12 @@ export const UserServiceDefinition = {
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],
578365826: [
new Uint8Array([
38,
39,
18,
36,
37,
47,
97,
112,
......@@ -2186,10 +2719,12 @@ export const UserServiceDefinition = {
49,
47,
123,
110,
112,
97,
109,
114,
101,
110,
116,
61,
117,
115,
......@@ -2206,8 +2741,7 @@ export const UserServiceDefinition = {
101,
115,
115,
95,
116,
84,
111,
107,
101,
......@@ -2227,15 +2761,49 @@ export const UserServiceDefinition = {
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
8410: [
new Uint8Array([
19,
112,
97,
114,
101,
110,
116,
44,
97,
99,
99,
101,
115,
115,
95,
116,
111,
107,
101,
110,
]),
],
578365826: [
new Uint8Array([
41,
53,
58,
1,
42,
12,
97,
99,
99,
101,
115,
115,
95,
116,
111,
107,
101,
110,
34,
36,
37,
47,
97,
112,
......@@ -2245,10 +2813,12 @@ export const UserServiceDefinition = {
49,
47,
123,
110,
112,
97,
109,
114,
101,
110,
116,
61,
117,
115,
......@@ -2265,8 +2835,7 @@ export const UserServiceDefinition = {
101,
115,
115,
95,
116,
84,
111,
107,
101,
......@@ -2277,7 +2846,7 @@ export const UserServiceDefinition = {
},
},
},
/** DeleteUserAccessToken deletes an access token for a user. */
/** DeleteUserAccessToken deletes an access token. */
deleteUserAccessToken: {
name: "DeleteUserAccessToken",
requestType: DeleteUserAccessTokenRequest,
......@@ -2286,12 +2855,12 @@ export const UserServiceDefinition = {
responseStream: false,
options: {
_unknownFields: {
8410: [new Uint8Array([17, 110, 97, 109, 101, 44, 97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110])],
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [
new Uint8Array([
53,
39,
42,
51,
37,
47,
97,
112,
......@@ -2313,7 +2882,6 @@ export const UserServiceDefinition = {
115,
47,
42,
125,
47,
97,
99,
......@@ -2321,27 +2889,14 @@ export const UserServiceDefinition = {
101,
115,
115,
95,
116,
84,
111,
107,
101,
110,
115,
47,
123,
97,
99,
99,
101,
115,
115,
95,
116,
111,
107,
101,
110,
42,
125,
]),
],
......
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.6.1
// protoc unknown
// source: google/api/resource.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "google.api";
/**
* A simple descriptor of a resource type.
*
* ResourceDescriptor annotates a resource message (either by means of a
* protobuf annotation or use in the service config), and associates the
* resource's schema, the resource type, and the pattern of the resource name.
*
* Example:
*
* message Topic {
* // Indicates this message defines a resource schema.
* // Declares the resource type in the format of {service}/{kind}.
* // For Kubernetes resources, the format is {api group}/{kind}.
* option (google.api.resource) = {
* type: "pubsub.googleapis.com/Topic"
* pattern: "projects/{project}/topics/{topic}"
* };
* }
*
* The ResourceDescriptor Yaml config will look like:
*
* resources:
* - type: "pubsub.googleapis.com/Topic"
* pattern: "projects/{project}/topics/{topic}"
*
* Sometimes, resources have multiple patterns, typically because they can
* live under multiple parents.
*
* Example:
*
* message LogEntry {
* option (google.api.resource) = {
* type: "logging.googleapis.com/LogEntry"
* pattern: "projects/{project}/logs/{log}"
* pattern: "folders/{folder}/logs/{log}"
* pattern: "organizations/{organization}/logs/{log}"
* pattern: "billingAccounts/{billing_account}/logs/{log}"
* };
* }
*
* The ResourceDescriptor Yaml config will look like:
*
* resources:
* - type: 'logging.googleapis.com/LogEntry'
* pattern: "projects/{project}/logs/{log}"
* pattern: "folders/{folder}/logs/{log}"
* pattern: "organizations/{organization}/logs/{log}"
* pattern: "billingAccounts/{billing_account}/logs/{log}"
*/
export interface ResourceDescriptor {
/**
* The resource type. It must be in the format of
* {service_name}/{resource_type_kind}. The `resource_type_kind` must be
* singular and must not include version numbers.
*
* Example: `storage.googleapis.com/Bucket`
*
* The value of the resource_type_kind must follow the regular expression
* /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
* should use PascalCase (UpperCamelCase). The maximum number of
* characters allowed for the `resource_type_kind` is 100.
*/
type: string;
/**
* Optional. The relative resource name pattern associated with this resource
* type. The DNS prefix of the full resource name shouldn't be specified here.
*
* The path pattern must follow the syntax, which aligns with HTTP binding
* syntax:
*
* Template = Segment { "/" Segment } ;
* Segment = LITERAL | Variable ;
* Variable = "{" LITERAL "}" ;
*
* Examples:
*
* - "projects/{project}/topics/{topic}"
* - "projects/{project}/knowledgeBases/{knowledge_base}"
*
* The components in braces correspond to the IDs for each resource in the
* hierarchy. It is expected that, if multiple patterns are provided,
* the same component name (e.g. "project") refers to IDs of the same
* type of resource.
*/
pattern: string[];
/**
* Optional. The field on the resource that designates the resource name
* field. If omitted, this is assumed to be "name".
*/
nameField: string;
/**
* Optional. The historical or future-looking state of the resource pattern.
*
* Example:
*
* // The InspectTemplate message originally only supported resource
* // names with organization, and project was added later.
* message InspectTemplate {
* option (google.api.resource) = {
* type: "dlp.googleapis.com/InspectTemplate"
* pattern:
* "organizations/{organization}/inspectTemplates/{inspect_template}"
* pattern: "projects/{project}/inspectTemplates/{inspect_template}"
* history: ORIGINALLY_SINGLE_PATTERN
* };
* }
*/
history: ResourceDescriptor_History;
/**
* The plural name used in the resource name and permission names, such as
* 'projects' for the resource name of 'projects/{project}' and the permission
* name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
* to this is for Nested Collections that have stuttering names, as defined
* in [AIP-122](https://google.aip.dev/122#nested-collections), where the
* collection ID in the resource name pattern does not necessarily directly
* match the `plural` value.
*
* It is the same concept of the `plural` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
*
* Note: The plural form is required even for singleton resources. See
* https://aip.dev/156
*/
plural: string;
/**
* The same concept of the `singular` field in k8s CRD spec
* https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
* Such as "project" for the `resourcemanager.googleapis.com/Project` type.
*/
singular: string;
/**
* Style flag(s) for this resource.
* These indicate that a resource is expected to conform to a given
* style. See the specific style flags for additional information.
*/
style: ResourceDescriptor_Style[];
}
/**
* A description of the historical or future-looking state of the
* resource pattern.
*/
export enum ResourceDescriptor_History {
/** HISTORY_UNSPECIFIED - The "unset" value. */
HISTORY_UNSPECIFIED = "HISTORY_UNSPECIFIED",
/**
* ORIGINALLY_SINGLE_PATTERN - The resource originally had one pattern and launched as such, and
* additional patterns were added later.
*/
ORIGINALLY_SINGLE_PATTERN = "ORIGINALLY_SINGLE_PATTERN",
/**
* FUTURE_MULTI_PATTERN - The resource has one pattern, but the API owner expects to add more
* later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
* that from being necessary once there are multiple patterns.)
*/
FUTURE_MULTI_PATTERN = "FUTURE_MULTI_PATTERN",
UNRECOGNIZED = "UNRECOGNIZED",
}
export function resourceDescriptor_HistoryFromJSON(object: any): ResourceDescriptor_History {
switch (object) {
case 0:
case "HISTORY_UNSPECIFIED":
return ResourceDescriptor_History.HISTORY_UNSPECIFIED;
case 1:
case "ORIGINALLY_SINGLE_PATTERN":
return ResourceDescriptor_History.ORIGINALLY_SINGLE_PATTERN;
case 2:
case "FUTURE_MULTI_PATTERN":
return ResourceDescriptor_History.FUTURE_MULTI_PATTERN;
case -1:
case "UNRECOGNIZED":
default:
return ResourceDescriptor_History.UNRECOGNIZED;
}
}
export function resourceDescriptor_HistoryToNumber(object: ResourceDescriptor_History): number {
switch (object) {
case ResourceDescriptor_History.HISTORY_UNSPECIFIED:
return 0;
case ResourceDescriptor_History.ORIGINALLY_SINGLE_PATTERN:
return 1;
case ResourceDescriptor_History.FUTURE_MULTI_PATTERN:
return 2;
case ResourceDescriptor_History.UNRECOGNIZED:
default:
return -1;
}
}
/** A flag representing a specific style that a resource claims to conform to. */
export enum ResourceDescriptor_Style {
/** STYLE_UNSPECIFIED - The unspecified value. Do not use. */
STYLE_UNSPECIFIED = "STYLE_UNSPECIFIED",
/**
* DECLARATIVE_FRIENDLY - This resource is intended to be "declarative-friendly".
*
* Declarative-friendly resources must be more strictly consistent, and
* setting this to true communicates to tools that this resource should
* adhere to declarative-friendly expectations.
*
* Note: This is used by the API linter (linter.aip.dev) to enable
* additional checks.
*/
DECLARATIVE_FRIENDLY = "DECLARATIVE_FRIENDLY",
UNRECOGNIZED = "UNRECOGNIZED",
}
export function resourceDescriptor_StyleFromJSON(object: any): ResourceDescriptor_Style {
switch (object) {
case 0:
case "STYLE_UNSPECIFIED":
return ResourceDescriptor_Style.STYLE_UNSPECIFIED;
case 1:
case "DECLARATIVE_FRIENDLY":
return ResourceDescriptor_Style.DECLARATIVE_FRIENDLY;
case -1:
case "UNRECOGNIZED":
default:
return ResourceDescriptor_Style.UNRECOGNIZED;
}
}
export function resourceDescriptor_StyleToNumber(object: ResourceDescriptor_Style): number {
switch (object) {
case ResourceDescriptor_Style.STYLE_UNSPECIFIED:
return 0;
case ResourceDescriptor_Style.DECLARATIVE_FRIENDLY:
return 1;
case ResourceDescriptor_Style.UNRECOGNIZED:
default:
return -1;
}
}
/**
* Defines a proto annotation that describes a string field that refers to
* an API resource.
*/
export interface ResourceReference {
/**
* The resource type that the annotated field references.
*
* Example:
*
* message Subscription {
* string topic = 2 [(google.api.resource_reference) = {
* type: "pubsub.googleapis.com/Topic"
* }];
* }
*
* Occasionally, a field may reference an arbitrary resource. In this case,
* APIs use the special value * in their resource reference.
*
* Example:
*
* message GetIamPolicyRequest {
* string resource = 2 [(google.api.resource_reference) = {
* type: "*"
* }];
* }
*/
type: string;
/**
* The resource type of a child collection that the annotated field
* references. This is useful for annotating the `parent` field that
* doesn't have a fixed resource type.
*
* Example:
*
* message ListLogEntriesRequest {
* string parent = 1 [(google.api.resource_reference) = {
* child_type: "logging.googleapis.com/LogEntry"
* };
* }
*/
childType: string;
}
function createBaseResourceDescriptor(): ResourceDescriptor {
return {
type: "",
pattern: [],
nameField: "",
history: ResourceDescriptor_History.HISTORY_UNSPECIFIED,
plural: "",
singular: "",
style: [],
};
}
export const ResourceDescriptor: MessageFns<ResourceDescriptor> = {
encode(message: ResourceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.type !== "") {
writer.uint32(10).string(message.type);
}
for (const v of message.pattern) {
writer.uint32(18).string(v!);
}
if (message.nameField !== "") {
writer.uint32(26).string(message.nameField);
}
if (message.history !== ResourceDescriptor_History.HISTORY_UNSPECIFIED) {
writer.uint32(32).int32(resourceDescriptor_HistoryToNumber(message.history));
}
if (message.plural !== "") {
writer.uint32(42).string(message.plural);
}
if (message.singular !== "") {
writer.uint32(50).string(message.singular);
}
writer.uint32(82).fork();
for (const v of message.style) {
writer.int32(resourceDescriptor_StyleToNumber(v));
}
writer.join();
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ResourceDescriptor {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseResourceDescriptor();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.type = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.pattern.push(reader.string());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.nameField = reader.string();
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.history = resourceDescriptor_HistoryFromJSON(reader.int32());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.plural = reader.string();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.singular = reader.string();
continue;
}
case 10: {
if (tag === 80) {
message.style.push(resourceDescriptor_StyleFromJSON(reader.int32()));
continue;
}
if (tag === 82) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.style.push(resourceDescriptor_StyleFromJSON(reader.int32()));
}
continue;
}
break;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<ResourceDescriptor>): ResourceDescriptor {
return ResourceDescriptor.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ResourceDescriptor>): ResourceDescriptor {
const message = createBaseResourceDescriptor();
message.type = object.type ?? "";
message.pattern = object.pattern?.map((e) => e) || [];
message.nameField = object.nameField ?? "";
message.history = object.history ?? ResourceDescriptor_History.HISTORY_UNSPECIFIED;
message.plural = object.plural ?? "";
message.singular = object.singular ?? "";
message.style = object.style?.map((e) => e) || [];
return message;
},
};
function createBaseResourceReference(): ResourceReference {
return { type: "", childType: "" };
}
export const ResourceReference: MessageFns<ResourceReference> = {
encode(message: ResourceReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.type !== "") {
writer.uint32(10).string(message.type);
}
if (message.childType !== "") {
writer.uint32(18).string(message.childType);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): ResourceReference {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseResourceReference();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.type = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.childType = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
create(base?: DeepPartial<ResourceReference>): ResourceReference {
return ResourceReference.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ResourceReference>): ResourceReference {
const message = createBaseResourceReference();
message.type = object.type ?? "";
message.childType = object.childType ?? "";
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
create(base?: DeepPartial<T>): T;
fromPartial(object: DeepPartial<T>): T;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment