From 8f51791da8129cac25d16b6def7b1bd6518cf6b3 Mon Sep 17 00:00:00 2001 From: Johnny Date: Tue, 29 Jul 2025 09:21:51 +0800 Subject: [PATCH] chore: update user setting definition --- proto/api/v1/user_service.proto | 78 +- proto/gen/api/v1/user_service.pb.go | 756 ++++-------------- proto/gen/openapi.yaml | 116 +-- server/router/api/v1/user_service.go | 103 +-- web/src/store/user.ts | 18 +- web/src/types/proto/api/v1/user_service.ts | 552 +------------ .../types/proto/google/protobuf/descriptor.ts | 139 +++- 7 files changed, 340 insertions(+), 1422 deletions(-) diff --git a/proto/api/v1/user_service.proto b/proto/api/v1/user_service.proto index be38a930e..6da10389c 100644 --- a/proto/api/v1/user_service.proto +++ b/proto/api/v1/user_service.proto @@ -403,15 +403,15 @@ message UserSetting { }; // The name of the user setting. - // Format: users/{user}/settings/{setting} + // Format: users/{user}/settings/{setting}, {setting} is the key for the setting. + // For example, "users/123/settings/GENERAL" for general settings. string name = 1 [(google.api.field_behavior) = IDENTIFIER]; oneof value { GeneralSetting general_setting = 2; SessionsSetting sessions_setting = 3; AccessTokensSetting access_tokens_setting = 4; - ShortcutsSetting shortcuts_setting = 5; - WebhooksSetting webhooks_setting = 6; + WebhooksSetting webhooks_setting = 5; } // Enumeration of user setting keys. @@ -423,10 +423,8 @@ message UserSetting { SESSIONS = 2; // ACCESS_TOKENS is the key for access tokens. ACCESS_TOKENS = 3; - // SHORTCUTS is the key for user shortcuts. - SHORTCUTS = 4; // WEBHOOKS is the key for user webhooks. - WEBHOOKS = 5; + WEBHOOKS = 4; } // General user settings configuration. @@ -446,81 +444,19 @@ message UserSetting { // User authentication sessions configuration. message SessionsSetting { // List of active user sessions. - repeated Session sessions = 1; - - // User session information. - message Session { - // Unique session identifier. - string session_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Timestamp when the session was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Timestamp when the session was last accessed. - // Used for sliding expiration calculation (last_accessed_time + 2 weeks). - google.protobuf.Timestamp last_accessed_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Client information associated with this session. - ClientInfo client_info = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Client information for a session. - message ClientInfo { - // User agent string of the client. - string user_agent = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // IP address of the client. - string ip_address = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Optional. Device type (e.g., "mobile", "desktop", "tablet"). - string device_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Optional. Operating system (e.g., "iOS 17.0", "Windows 11"). - string os = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Optional. Browser name and version (e.g., "Chrome 119.0"). - string browser = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - } + repeated UserSession sessions = 1; } // User access tokens configuration. message AccessTokensSetting { // List of user access tokens. - repeated AccessToken access_tokens = 1; - - // User access token information. - message AccessToken { - // The access token is a JWT token. - // Including expiration time, issuer, etc. - string access_token = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // A description for the access token. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - } - } - - // User shortcuts configuration. - message ShortcutsSetting { - // List of user shortcuts. - repeated Shortcut shortcuts = 1; - - // User shortcut definition. - message Shortcut { - // Unique identifier for the shortcut. - string id = 1 [(google.api.field_behavior) = REQUIRED]; - // Display title for the shortcut. - string title = 2 [(google.api.field_behavior) = REQUIRED]; - // Filter expression for the shortcut. - string filter = 3 [(google.api.field_behavior) = REQUIRED]; - } + repeated UserAccessToken access_tokens = 1; } // User webhooks configuration. message WebhooksSetting { // List of user webhooks. - repeated Webhook webhooks = 1; - - // User webhook definition. - message Webhook { - // Unique identifier for the webhook. - string id = 1 [(google.api.field_behavior) = REQUIRED]; - // Descriptive title for the webhook. - string title = 2 [(google.api.field_behavior) = REQUIRED]; - // The webhook URL endpoint. - string url = 3 [(google.api.field_behavior) = REQUIRED]; - } + repeated UserWebhook webhooks = 1; } } diff --git a/proto/gen/api/v1/user_service.pb.go b/proto/gen/api/v1/user_service.pb.go index 94ac6f965..8342c1c59 100644 --- a/proto/gen/api/v1/user_service.pb.go +++ b/proto/gen/api/v1/user_service.pb.go @@ -94,10 +94,8 @@ const ( UserSetting_SESSIONS UserSetting_Key = 2 // ACCESS_TOKENS is the key for access tokens. UserSetting_ACCESS_TOKENS UserSetting_Key = 3 - // SHORTCUTS is the key for user shortcuts. - UserSetting_SHORTCUTS UserSetting_Key = 4 // WEBHOOKS is the key for user webhooks. - UserSetting_WEBHOOKS UserSetting_Key = 5 + UserSetting_WEBHOOKS UserSetting_Key = 4 ) // Enum value maps for UserSetting_Key. @@ -107,16 +105,14 @@ var ( 1: "GENERAL", 2: "SESSIONS", 3: "ACCESS_TOKENS", - 4: "SHORTCUTS", - 5: "WEBHOOKS", + 4: "WEBHOOKS", } UserSetting_Key_value = map[string]int32{ "KEY_UNSPECIFIED": 0, "GENERAL": 1, "SESSIONS": 2, "ACCESS_TOKENS": 3, - "SHORTCUTS": 4, - "WEBHOOKS": 5, + "WEBHOOKS": 4, } ) @@ -1080,14 +1076,14 @@ func (x *ListAllUserStatsResponse) GetStats() []*UserStats { type UserSetting struct { state protoimpl.MessageState `protogen:"open.v1"` // The name of the user setting. - // Format: users/{user}/settings/{setting} + // Format: users/{user}/settings/{setting}, {setting} is the key for the setting. + // For example, "users/123/settings/GENERAL" for general settings. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to Value: // // *UserSetting_GeneralSetting_ // *UserSetting_SessionsSetting_ // *UserSetting_AccessTokensSetting_ - // *UserSetting_ShortcutsSetting_ // *UserSetting_WebhooksSetting_ Value isUserSetting_Value `protobuf_oneof:"value"` unknownFields protoimpl.UnknownFields @@ -1165,15 +1161,6 @@ func (x *UserSetting) GetAccessTokensSetting() *UserSetting_AccessTokensSetting return nil } -func (x *UserSetting) GetShortcutsSetting() *UserSetting_ShortcutsSetting { - if x != nil { - if x, ok := x.Value.(*UserSetting_ShortcutsSetting_); ok { - return x.ShortcutsSetting - } - } - return nil -} - func (x *UserSetting) GetWebhooksSetting() *UserSetting_WebhooksSetting { if x != nil { if x, ok := x.Value.(*UserSetting_WebhooksSetting_); ok { @@ -1199,12 +1186,8 @@ type UserSetting_AccessTokensSetting_ struct { AccessTokensSetting *UserSetting_AccessTokensSetting `protobuf:"bytes,4,opt,name=access_tokens_setting,json=accessTokensSetting,proto3,oneof"` } -type UserSetting_ShortcutsSetting_ struct { - ShortcutsSetting *UserSetting_ShortcutsSetting `protobuf:"bytes,5,opt,name=shortcuts_setting,json=shortcutsSetting,proto3,oneof"` -} - type UserSetting_WebhooksSetting_ struct { - WebhooksSetting *UserSetting_WebhooksSetting `protobuf:"bytes,6,opt,name=webhooks_setting,json=webhooksSetting,proto3,oneof"` + WebhooksSetting *UserSetting_WebhooksSetting `protobuf:"bytes,5,opt,name=webhooks_setting,json=webhooksSetting,proto3,oneof"` } func (*UserSetting_GeneralSetting_) isUserSetting_Value() {} @@ -1213,8 +1196,6 @@ func (*UserSetting_SessionsSetting_) isUserSetting_Value() {} func (*UserSetting_AccessTokensSetting_) isUserSetting_Value() {} -func (*UserSetting_ShortcutsSetting_) isUserSetting_Value() {} - func (*UserSetting_WebhooksSetting_) isUserSetting_Value() {} type GetUserSettingRequest struct { @@ -2468,7 +2449,7 @@ func (x *UserSetting_GeneralSetting) GetTheme() string { type UserSetting_SessionsSetting struct { state protoimpl.MessageState `protogen:"open.v1"` // List of active user sessions. - Sessions []*UserSetting_SessionsSetting_Session `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"` + Sessions []*UserSession `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2503,7 +2484,7 @@ func (*UserSetting_SessionsSetting) Descriptor() ([]byte, []int) { return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 1} } -func (x *UserSetting_SessionsSetting) GetSessions() []*UserSetting_SessionsSetting_Session { +func (x *UserSetting_SessionsSetting) GetSessions() []*UserSession { if x != nil { return x.Sessions } @@ -2514,7 +2495,7 @@ func (x *UserSetting_SessionsSetting) GetSessions() []*UserSetting_SessionsSetti type UserSetting_AccessTokensSetting struct { state protoimpl.MessageState `protogen:"open.v1"` // List of user access tokens. - AccessTokens []*UserSetting_AccessTokensSetting_AccessToken `protobuf:"bytes,1,rep,name=access_tokens,json=accessTokens,proto3" json:"access_tokens,omitempty"` + AccessTokens []*UserAccessToken `protobuf:"bytes,1,rep,name=access_tokens,json=accessTokens,proto3" json:"access_tokens,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2549,71 +2530,25 @@ func (*UserSetting_AccessTokensSetting) Descriptor() ([]byte, []int) { return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 2} } -func (x *UserSetting_AccessTokensSetting) GetAccessTokens() []*UserSetting_AccessTokensSetting_AccessToken { +func (x *UserSetting_AccessTokensSetting) GetAccessTokens() []*UserAccessToken { if x != nil { return x.AccessTokens } return nil } -// User shortcuts configuration. -type UserSetting_ShortcutsSetting struct { - state protoimpl.MessageState `protogen:"open.v1"` - // List of user shortcuts. - Shortcuts []*UserSetting_ShortcutsSetting_Shortcut `protobuf:"bytes,1,rep,name=shortcuts,proto3" json:"shortcuts,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserSetting_ShortcutsSetting) Reset() { - *x = UserSetting_ShortcutsSetting{} - mi := &file_api_v1_user_service_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserSetting_ShortcutsSetting) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserSetting_ShortcutsSetting) ProtoMessage() {} - -func (x *UserSetting_ShortcutsSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[39] - 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 UserSetting_ShortcutsSetting.ProtoReflect.Descriptor instead. -func (*UserSetting_ShortcutsSetting) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 3} -} - -func (x *UserSetting_ShortcutsSetting) GetShortcuts() []*UserSetting_ShortcutsSetting_Shortcut { - if x != nil { - return x.Shortcuts - } - return nil -} - // User webhooks configuration. type UserSetting_WebhooksSetting struct { state protoimpl.MessageState `protogen:"open.v1"` // List of user webhooks. - Webhooks []*UserSetting_WebhooksSetting_Webhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"` + Webhooks []*UserWebhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *UserSetting_WebhooksSetting) Reset() { *x = UserSetting_WebhooksSetting{} - mi := &file_api_v1_user_service_proto_msgTypes[40] + mi := &file_api_v1_user_service_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2625,7 +2560,7 @@ func (x *UserSetting_WebhooksSetting) String() string { func (*UserSetting_WebhooksSetting) ProtoMessage() {} func (x *UserSetting_WebhooksSetting) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[40] + mi := &file_api_v1_user_service_proto_msgTypes[39] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2638,356 +2573,16 @@ func (x *UserSetting_WebhooksSetting) ProtoReflect() protoreflect.Message { // Deprecated: Use UserSetting_WebhooksSetting.ProtoReflect.Descriptor instead. func (*UserSetting_WebhooksSetting) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 4} + return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 3} } -func (x *UserSetting_WebhooksSetting) GetWebhooks() []*UserSetting_WebhooksSetting_Webhook { +func (x *UserSetting_WebhooksSetting) GetWebhooks() []*UserWebhook { if x != nil { return x.Webhooks } return nil } -// User session information. -type UserSetting_SessionsSetting_Session struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Unique session identifier. - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - // Timestamp when the session was created. - CreateTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - // Timestamp when the session was last accessed. - // Used for sliding expiration calculation (last_accessed_time + 2 weeks). - LastAccessedTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=last_accessed_time,json=lastAccessedTime,proto3" json:"last_accessed_time,omitempty"` - // Client information associated with this session. - ClientInfo *UserSetting_SessionsSetting_ClientInfo `protobuf:"bytes,4,opt,name=client_info,json=clientInfo,proto3" json:"client_info,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserSetting_SessionsSetting_Session) Reset() { - *x = UserSetting_SessionsSetting_Session{} - mi := &file_api_v1_user_service_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserSetting_SessionsSetting_Session) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserSetting_SessionsSetting_Session) ProtoMessage() {} - -func (x *UserSetting_SessionsSetting_Session) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[41] - 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 UserSetting_SessionsSetting_Session.ProtoReflect.Descriptor instead. -func (*UserSetting_SessionsSetting_Session) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 1, 0} -} - -func (x *UserSetting_SessionsSetting_Session) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *UserSetting_SessionsSetting_Session) GetCreateTime() *timestamppb.Timestamp { - if x != nil { - return x.CreateTime - } - return nil -} - -func (x *UserSetting_SessionsSetting_Session) GetLastAccessedTime() *timestamppb.Timestamp { - if x != nil { - return x.LastAccessedTime - } - return nil -} - -func (x *UserSetting_SessionsSetting_Session) GetClientInfo() *UserSetting_SessionsSetting_ClientInfo { - if x != nil { - return x.ClientInfo - } - return nil -} - -// Client information for a session. -type UserSetting_SessionsSetting_ClientInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - // User agent string of the client. - UserAgent string `protobuf:"bytes,1,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` - // IP address of the client. - IpAddress string `protobuf:"bytes,2,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` - // Optional. Device type (e.g., "mobile", "desktop", "tablet"). - DeviceType string `protobuf:"bytes,3,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` - // Optional. Operating system (e.g., "iOS 17.0", "Windows 11"). - Os string `protobuf:"bytes,4,opt,name=os,proto3" json:"os,omitempty"` - // Optional. Browser name and version (e.g., "Chrome 119.0"). - Browser string `protobuf:"bytes,5,opt,name=browser,proto3" json:"browser,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserSetting_SessionsSetting_ClientInfo) Reset() { - *x = UserSetting_SessionsSetting_ClientInfo{} - mi := &file_api_v1_user_service_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserSetting_SessionsSetting_ClientInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserSetting_SessionsSetting_ClientInfo) ProtoMessage() {} - -func (x *UserSetting_SessionsSetting_ClientInfo) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[42] - 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 UserSetting_SessionsSetting_ClientInfo.ProtoReflect.Descriptor instead. -func (*UserSetting_SessionsSetting_ClientInfo) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 1, 1} -} - -func (x *UserSetting_SessionsSetting_ClientInfo) GetUserAgent() string { - if x != nil { - return x.UserAgent - } - return "" -} - -func (x *UserSetting_SessionsSetting_ClientInfo) GetIpAddress() string { - if x != nil { - return x.IpAddress - } - return "" -} - -func (x *UserSetting_SessionsSetting_ClientInfo) GetDeviceType() string { - if x != nil { - return x.DeviceType - } - return "" -} - -func (x *UserSetting_SessionsSetting_ClientInfo) GetOs() string { - if x != nil { - return x.Os - } - return "" -} - -func (x *UserSetting_SessionsSetting_ClientInfo) GetBrowser() string { - if x != nil { - return x.Browser - } - return "" -} - -// User access token information. -type UserSetting_AccessTokensSetting_AccessToken struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The access token is a JWT token. - // Including expiration time, issuer, etc. - AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` - // A description for the access token. - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserSetting_AccessTokensSetting_AccessToken) Reset() { - *x = UserSetting_AccessTokensSetting_AccessToken{} - mi := &file_api_v1_user_service_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserSetting_AccessTokensSetting_AccessToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserSetting_AccessTokensSetting_AccessToken) ProtoMessage() {} - -func (x *UserSetting_AccessTokensSetting_AccessToken) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[43] - 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 UserSetting_AccessTokensSetting_AccessToken.ProtoReflect.Descriptor instead. -func (*UserSetting_AccessTokensSetting_AccessToken) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 2, 0} -} - -func (x *UserSetting_AccessTokensSetting_AccessToken) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *UserSetting_AccessTokensSetting_AccessToken) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -// User shortcut definition. -type UserSetting_ShortcutsSetting_Shortcut struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Unique identifier for the shortcut. - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // Display title for the shortcut. - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - // Filter expression for the shortcut. - Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserSetting_ShortcutsSetting_Shortcut) Reset() { - *x = UserSetting_ShortcutsSetting_Shortcut{} - mi := &file_api_v1_user_service_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserSetting_ShortcutsSetting_Shortcut) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserSetting_ShortcutsSetting_Shortcut) ProtoMessage() {} - -func (x *UserSetting_ShortcutsSetting_Shortcut) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[44] - 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 UserSetting_ShortcutsSetting_Shortcut.ProtoReflect.Descriptor instead. -func (*UserSetting_ShortcutsSetting_Shortcut) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 3, 0} -} - -func (x *UserSetting_ShortcutsSetting_Shortcut) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *UserSetting_ShortcutsSetting_Shortcut) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *UserSetting_ShortcutsSetting_Shortcut) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -// User webhook definition. -type UserSetting_WebhooksSetting_Webhook struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Unique identifier for the webhook. - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // Descriptive title for the webhook. - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - // The webhook URL endpoint. - Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UserSetting_WebhooksSetting_Webhook) Reset() { - *x = UserSetting_WebhooksSetting_Webhook{} - mi := &file_api_v1_user_service_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UserSetting_WebhooksSetting_Webhook) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserSetting_WebhooksSetting_Webhook) ProtoMessage() {} - -func (x *UserSetting_WebhooksSetting_Webhook) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[45] - 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 UserSetting_WebhooksSetting_Webhook.ProtoReflect.Descriptor instead. -func (*UserSetting_WebhooksSetting_Webhook) Descriptor() ([]byte, []int) { - return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 4, 0} -} - -func (x *UserSetting_WebhooksSetting_Webhook) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *UserSetting_WebhooksSetting_Webhook) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *UserSetting_WebhooksSetting_Webhook) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - type UserSession_ClientInfo struct { state protoimpl.MessageState `protogen:"open.v1"` // User agent string of the client. @@ -3006,7 +2601,7 @@ type UserSession_ClientInfo struct { func (x *UserSession_ClientInfo) Reset() { *x = UserSession_ClientInfo{} - mi := &file_api_v1_user_service_proto_msgTypes[46] + mi := &file_api_v1_user_service_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3018,7 +2613,7 @@ func (x *UserSession_ClientInfo) String() string { func (*UserSession_ClientInfo) ProtoMessage() {} func (x *UserSession_ClientInfo) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_user_service_proto_msgTypes[46] + mi := &file_api_v1_user_service_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3165,65 +2760,32 @@ const file_api_v1_user_service_proto_rawDesc = "" + "\x11memos.api.v1/UserR\x04name\"\x19\n" + "\x17ListAllUserStatsRequest\"I\n" + "\x18ListAllUserStatsResponse\x12-\n" + - "\x05stats\x18\x01 \x03(\v2\x17.memos.api.v1.UserStatsR\x05stats\"\xd1\x0f\n" + + "\x05stats\x18\x01 \x03(\v2\x17.memos.api.v1.UserStatsR\x05stats\"\xd9\a\n" + "\vUserSetting\x12\x17\n" + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12S\n" + "\x0fgeneral_setting\x18\x02 \x01(\v2(.memos.api.v1.UserSetting.GeneralSettingH\x00R\x0egeneralSetting\x12V\n" + "\x10sessions_setting\x18\x03 \x01(\v2).memos.api.v1.UserSetting.SessionsSettingH\x00R\x0fsessionsSetting\x12c\n" + - "\x15access_tokens_setting\x18\x04 \x01(\v2-.memos.api.v1.UserSetting.AccessTokensSettingH\x00R\x13accessTokensSetting\x12Y\n" + - "\x11shortcuts_setting\x18\x05 \x01(\v2*.memos.api.v1.UserSetting.ShortcutsSettingH\x00R\x10shortcutsSetting\x12V\n" + - "\x10webhooks_setting\x18\x06 \x01(\v2).memos.api.v1.UserSetting.WebhooksSettingH\x00R\x0fwebhooksSetting\x1a\x9b\x01\n" + + "\x15access_tokens_setting\x18\x04 \x01(\v2-.memos.api.v1.UserSetting.AccessTokensSettingH\x00R\x13accessTokensSetting\x12V\n" + + "\x10webhooks_setting\x18\x05 \x01(\v2).memos.api.v1.UserSetting.WebhooksSettingH\x00R\x0fwebhooksSetting\x1a\x9b\x01\n" + "\x0eGeneralSetting\x12\x1b\n" + "\x06locale\x18\x01 \x01(\tB\x03\xe0A\x01R\x06locale\x12#\n" + "\n" + "appearance\x18\x02 \x01(\tB\x03\xe0A\x01R\n" + "appearance\x12,\n" + "\x0fmemo_visibility\x18\x03 \x01(\tB\x03\xe0A\x01R\x0ememoVisibility\x12\x19\n" + - "\x05theme\x18\x04 \x01(\tB\x03\xe0A\x01R\x05theme\x1a\xae\x04\n" + - "\x0fSessionsSetting\x12M\n" + - "\bsessions\x18\x01 \x03(\v21.memos.api.v1.UserSetting.SessionsSetting.SessionR\bsessions\x1a\x9a\x02\n" + - "\aSession\x12\"\n" + - "\n" + - "session_id\x18\x01 \x01(\tB\x03\xe0A\x03R\tsessionId\x12@\n" + - "\vcreate_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + - "createTime\x12M\n" + - "\x12last_accessed_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\x10lastAccessedTime\x12Z\n" + - "\vclient_info\x18\x04 \x01(\v24.memos.api.v1.UserSetting.SessionsSetting.ClientInfoB\x03\xe0A\x03R\n" + - "clientInfo\x1a\xae\x01\n" + - "\n" + - "ClientInfo\x12\"\n" + - "\n" + - "user_agent\x18\x01 \x01(\tB\x03\xe0A\x03R\tuserAgent\x12\"\n" + - "\n" + - "ip_address\x18\x02 \x01(\tB\x03\xe0A\x03R\tipAddress\x12$\n" + - "\vdevice_type\x18\x03 \x01(\tB\x03\xe0A\x03R\n" + - "deviceType\x12\x13\n" + - "\x02os\x18\x04 \x01(\tB\x03\xe0A\x03R\x02os\x12\x1d\n" + - "\abrowser\x18\x05 \x01(\tB\x03\xe0A\x03R\abrowser\x1a\xd3\x01\n" + - "\x13AccessTokensSetting\x12^\n" + - "\raccess_tokens\x18\x01 \x03(\v29.memos.api.v1.UserSetting.AccessTokensSetting.AccessTokenR\faccessTokens\x1a\\\n" + - "\vAccessToken\x12&\n" + - "\faccess_token\x18\x01 \x01(\tB\x03\xe0A\x03R\vaccessToken\x12%\n" + - "\vdescription\x18\x02 \x01(\tB\x03\xe0A\x01R\vdescription\x1a\xbe\x01\n" + - "\x10ShortcutsSetting\x12Q\n" + - "\tshortcuts\x18\x01 \x03(\v23.memos.api.v1.UserSetting.ShortcutsSetting.ShortcutR\tshortcuts\x1aW\n" + - "\bShortcut\x12\x13\n" + - "\x02id\x18\x01 \x01(\tB\x03\xe0A\x02R\x02id\x12\x19\n" + - "\x05title\x18\x02 \x01(\tB\x03\xe0A\x02R\x05title\x12\x1b\n" + - "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x02R\x06filter\x1a\xb2\x01\n" + - "\x0fWebhooksSetting\x12M\n" + - "\bwebhooks\x18\x01 \x03(\v21.memos.api.v1.UserSetting.WebhooksSetting.WebhookR\bwebhooks\x1aP\n" + - "\aWebhook\x12\x13\n" + - "\x02id\x18\x01 \x01(\tB\x03\xe0A\x02R\x02id\x12\x19\n" + - "\x05title\x18\x02 \x01(\tB\x03\xe0A\x02R\x05title\x12\x15\n" + - "\x03url\x18\x03 \x01(\tB\x03\xe0A\x02R\x03url\"e\n" + + "\x05theme\x18\x04 \x01(\tB\x03\xe0A\x01R\x05theme\x1aH\n" + + "\x0fSessionsSetting\x125\n" + + "\bsessions\x18\x01 \x03(\v2\x19.memos.api.v1.UserSessionR\bsessions\x1aY\n" + + "\x13AccessTokensSetting\x12B\n" + + "\raccess_tokens\x18\x01 \x03(\v2\x1d.memos.api.v1.UserAccessTokenR\faccessTokens\x1aH\n" + + "\x0fWebhooksSetting\x125\n" + + "\bwebhooks\x18\x01 \x03(\v2\x19.memos.api.v1.UserWebhookR\bwebhooks\"V\n" + "\x03Key\x12\x13\n" + "\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" + "\aGENERAL\x10\x01\x12\f\n" + "\bSESSIONS\x10\x02\x12\x11\n" + - "\rACCESS_TOKENS\x10\x03\x12\r\n" + - "\tSHORTCUTS\x10\x04\x12\f\n" + - "\bWEBHOOKS\x10\x05:Y\xeaAV\n" + + "\rACCESS_TOKENS\x10\x03\x12\f\n" + + "\bWEBHOOKS\x10\x04:Y\xeaAV\n" + "\x18memos.api.v1/UserSetting\x12\x1fusers/{user}/settings/{setting}*\fuserSettings2\vuserSettingB\a\n" + "\x05value\"M\n" + "\x15GetUserSettingRequest\x124\n" + @@ -3359,154 +2921,143 @@ func file_api_v1_user_service_proto_rawDescGZIP() []byte { } var file_api_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 47) +var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 41) var file_api_v1_user_service_proto_goTypes = []any{ - (User_Role)(0), // 0: memos.api.v1.User.Role - (UserSetting_Key)(0), // 1: memos.api.v1.UserSetting.Key - (*User)(nil), // 2: memos.api.v1.User - (*ListUsersRequest)(nil), // 3: memos.api.v1.ListUsersRequest - (*ListUsersResponse)(nil), // 4: memos.api.v1.ListUsersResponse - (*GetUserRequest)(nil), // 5: memos.api.v1.GetUserRequest - (*CreateUserRequest)(nil), // 6: memos.api.v1.CreateUserRequest - (*UpdateUserRequest)(nil), // 7: memos.api.v1.UpdateUserRequest - (*DeleteUserRequest)(nil), // 8: memos.api.v1.DeleteUserRequest - (*SearchUsersRequest)(nil), // 9: memos.api.v1.SearchUsersRequest - (*SearchUsersResponse)(nil), // 10: memos.api.v1.SearchUsersResponse - (*GetUserAvatarRequest)(nil), // 11: memos.api.v1.GetUserAvatarRequest - (*UserStats)(nil), // 12: memos.api.v1.UserStats - (*GetUserStatsRequest)(nil), // 13: memos.api.v1.GetUserStatsRequest - (*ListAllUserStatsRequest)(nil), // 14: memos.api.v1.ListAllUserStatsRequest - (*ListAllUserStatsResponse)(nil), // 15: memos.api.v1.ListAllUserStatsResponse - (*UserSetting)(nil), // 16: memos.api.v1.UserSetting - (*GetUserSettingRequest)(nil), // 17: memos.api.v1.GetUserSettingRequest - (*UpdateUserSettingRequest)(nil), // 18: memos.api.v1.UpdateUserSettingRequest - (*ListUserSettingsRequest)(nil), // 19: memos.api.v1.ListUserSettingsRequest - (*ListUserSettingsResponse)(nil), // 20: memos.api.v1.ListUserSettingsResponse - (*UserAccessToken)(nil), // 21: memos.api.v1.UserAccessToken - (*ListUserAccessTokensRequest)(nil), // 22: memos.api.v1.ListUserAccessTokensRequest - (*ListUserAccessTokensResponse)(nil), // 23: memos.api.v1.ListUserAccessTokensResponse - (*CreateUserAccessTokenRequest)(nil), // 24: memos.api.v1.CreateUserAccessTokenRequest - (*DeleteUserAccessTokenRequest)(nil), // 25: memos.api.v1.DeleteUserAccessTokenRequest - (*UserSession)(nil), // 26: memos.api.v1.UserSession - (*ListUserSessionsRequest)(nil), // 27: memos.api.v1.ListUserSessionsRequest - (*ListUserSessionsResponse)(nil), // 28: memos.api.v1.ListUserSessionsResponse - (*RevokeUserSessionRequest)(nil), // 29: memos.api.v1.RevokeUserSessionRequest - (*UserWebhook)(nil), // 30: memos.api.v1.UserWebhook - (*ListUserWebhooksRequest)(nil), // 31: memos.api.v1.ListUserWebhooksRequest - (*ListUserWebhooksResponse)(nil), // 32: memos.api.v1.ListUserWebhooksResponse - (*CreateUserWebhookRequest)(nil), // 33: memos.api.v1.CreateUserWebhookRequest - (*UpdateUserWebhookRequest)(nil), // 34: memos.api.v1.UpdateUserWebhookRequest - (*DeleteUserWebhookRequest)(nil), // 35: memos.api.v1.DeleteUserWebhookRequest - nil, // 36: memos.api.v1.UserStats.TagCountEntry - (*UserStats_MemoTypeStats)(nil), // 37: memos.api.v1.UserStats.MemoTypeStats - (*UserSetting_GeneralSetting)(nil), // 38: memos.api.v1.UserSetting.GeneralSetting - (*UserSetting_SessionsSetting)(nil), // 39: memos.api.v1.UserSetting.SessionsSetting - (*UserSetting_AccessTokensSetting)(nil), // 40: memos.api.v1.UserSetting.AccessTokensSetting - (*UserSetting_ShortcutsSetting)(nil), // 41: memos.api.v1.UserSetting.ShortcutsSetting - (*UserSetting_WebhooksSetting)(nil), // 42: memos.api.v1.UserSetting.WebhooksSetting - (*UserSetting_SessionsSetting_Session)(nil), // 43: memos.api.v1.UserSetting.SessionsSetting.Session - (*UserSetting_SessionsSetting_ClientInfo)(nil), // 44: memos.api.v1.UserSetting.SessionsSetting.ClientInfo - (*UserSetting_AccessTokensSetting_AccessToken)(nil), // 45: memos.api.v1.UserSetting.AccessTokensSetting.AccessToken - (*UserSetting_ShortcutsSetting_Shortcut)(nil), // 46: memos.api.v1.UserSetting.ShortcutsSetting.Shortcut - (*UserSetting_WebhooksSetting_Webhook)(nil), // 47: memos.api.v1.UserSetting.WebhooksSetting.Webhook - (*UserSession_ClientInfo)(nil), // 48: memos.api.v1.UserSession.ClientInfo - (State)(0), // 49: memos.api.v1.State - (*timestamppb.Timestamp)(nil), // 50: google.protobuf.Timestamp - (*fieldmaskpb.FieldMask)(nil), // 51: google.protobuf.FieldMask - (*emptypb.Empty)(nil), // 52: google.protobuf.Empty - (*httpbody.HttpBody)(nil), // 53: google.api.HttpBody + (User_Role)(0), // 0: memos.api.v1.User.Role + (UserSetting_Key)(0), // 1: memos.api.v1.UserSetting.Key + (*User)(nil), // 2: memos.api.v1.User + (*ListUsersRequest)(nil), // 3: memos.api.v1.ListUsersRequest + (*ListUsersResponse)(nil), // 4: memos.api.v1.ListUsersResponse + (*GetUserRequest)(nil), // 5: memos.api.v1.GetUserRequest + (*CreateUserRequest)(nil), // 6: memos.api.v1.CreateUserRequest + (*UpdateUserRequest)(nil), // 7: memos.api.v1.UpdateUserRequest + (*DeleteUserRequest)(nil), // 8: memos.api.v1.DeleteUserRequest + (*SearchUsersRequest)(nil), // 9: memos.api.v1.SearchUsersRequest + (*SearchUsersResponse)(nil), // 10: memos.api.v1.SearchUsersResponse + (*GetUserAvatarRequest)(nil), // 11: memos.api.v1.GetUserAvatarRequest + (*UserStats)(nil), // 12: memos.api.v1.UserStats + (*GetUserStatsRequest)(nil), // 13: memos.api.v1.GetUserStatsRequest + (*ListAllUserStatsRequest)(nil), // 14: memos.api.v1.ListAllUserStatsRequest + (*ListAllUserStatsResponse)(nil), // 15: memos.api.v1.ListAllUserStatsResponse + (*UserSetting)(nil), // 16: memos.api.v1.UserSetting + (*GetUserSettingRequest)(nil), // 17: memos.api.v1.GetUserSettingRequest + (*UpdateUserSettingRequest)(nil), // 18: memos.api.v1.UpdateUserSettingRequest + (*ListUserSettingsRequest)(nil), // 19: memos.api.v1.ListUserSettingsRequest + (*ListUserSettingsResponse)(nil), // 20: memos.api.v1.ListUserSettingsResponse + (*UserAccessToken)(nil), // 21: memos.api.v1.UserAccessToken + (*ListUserAccessTokensRequest)(nil), // 22: memos.api.v1.ListUserAccessTokensRequest + (*ListUserAccessTokensResponse)(nil), // 23: memos.api.v1.ListUserAccessTokensResponse + (*CreateUserAccessTokenRequest)(nil), // 24: memos.api.v1.CreateUserAccessTokenRequest + (*DeleteUserAccessTokenRequest)(nil), // 25: memos.api.v1.DeleteUserAccessTokenRequest + (*UserSession)(nil), // 26: memos.api.v1.UserSession + (*ListUserSessionsRequest)(nil), // 27: memos.api.v1.ListUserSessionsRequest + (*ListUserSessionsResponse)(nil), // 28: memos.api.v1.ListUserSessionsResponse + (*RevokeUserSessionRequest)(nil), // 29: memos.api.v1.RevokeUserSessionRequest + (*UserWebhook)(nil), // 30: memos.api.v1.UserWebhook + (*ListUserWebhooksRequest)(nil), // 31: memos.api.v1.ListUserWebhooksRequest + (*ListUserWebhooksResponse)(nil), // 32: memos.api.v1.ListUserWebhooksResponse + (*CreateUserWebhookRequest)(nil), // 33: memos.api.v1.CreateUserWebhookRequest + (*UpdateUserWebhookRequest)(nil), // 34: memos.api.v1.UpdateUserWebhookRequest + (*DeleteUserWebhookRequest)(nil), // 35: memos.api.v1.DeleteUserWebhookRequest + nil, // 36: memos.api.v1.UserStats.TagCountEntry + (*UserStats_MemoTypeStats)(nil), // 37: memos.api.v1.UserStats.MemoTypeStats + (*UserSetting_GeneralSetting)(nil), // 38: memos.api.v1.UserSetting.GeneralSetting + (*UserSetting_SessionsSetting)(nil), // 39: memos.api.v1.UserSetting.SessionsSetting + (*UserSetting_AccessTokensSetting)(nil), // 40: memos.api.v1.UserSetting.AccessTokensSetting + (*UserSetting_WebhooksSetting)(nil), // 41: memos.api.v1.UserSetting.WebhooksSetting + (*UserSession_ClientInfo)(nil), // 42: memos.api.v1.UserSession.ClientInfo + (State)(0), // 43: memos.api.v1.State + (*timestamppb.Timestamp)(nil), // 44: google.protobuf.Timestamp + (*fieldmaskpb.FieldMask)(nil), // 45: google.protobuf.FieldMask + (*emptypb.Empty)(nil), // 46: google.protobuf.Empty + (*httpbody.HttpBody)(nil), // 47: 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 - 49, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State - 50, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp - 50, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp + 43, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State + 44, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp + 44, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp 2, // 4: memos.api.v1.ListUsersResponse.users:type_name -> memos.api.v1.User - 51, // 5: memos.api.v1.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask + 45, // 5: memos.api.v1.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask 2, // 6: memos.api.v1.CreateUserRequest.user:type_name -> memos.api.v1.User 2, // 7: memos.api.v1.UpdateUserRequest.user:type_name -> memos.api.v1.User - 51, // 8: memos.api.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask + 45, // 8: memos.api.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask 2, // 9: memos.api.v1.SearchUsersResponse.users:type_name -> memos.api.v1.User - 50, // 10: memos.api.v1.UserStats.memo_display_timestamps:type_name -> google.protobuf.Timestamp + 44, // 10: memos.api.v1.UserStats.memo_display_timestamps:type_name -> google.protobuf.Timestamp 37, // 11: memos.api.v1.UserStats.memo_type_stats:type_name -> memos.api.v1.UserStats.MemoTypeStats 36, // 12: memos.api.v1.UserStats.tag_count:type_name -> memos.api.v1.UserStats.TagCountEntry 12, // 13: memos.api.v1.ListAllUserStatsResponse.stats:type_name -> memos.api.v1.UserStats 38, // 14: memos.api.v1.UserSetting.general_setting:type_name -> memos.api.v1.UserSetting.GeneralSetting 39, // 15: memos.api.v1.UserSetting.sessions_setting:type_name -> memos.api.v1.UserSetting.SessionsSetting 40, // 16: memos.api.v1.UserSetting.access_tokens_setting:type_name -> memos.api.v1.UserSetting.AccessTokensSetting - 41, // 17: memos.api.v1.UserSetting.shortcuts_setting:type_name -> memos.api.v1.UserSetting.ShortcutsSetting - 42, // 18: memos.api.v1.UserSetting.webhooks_setting:type_name -> memos.api.v1.UserSetting.WebhooksSetting - 16, // 19: memos.api.v1.UpdateUserSettingRequest.setting:type_name -> memos.api.v1.UserSetting - 51, // 20: memos.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask - 16, // 21: memos.api.v1.ListUserSettingsResponse.settings:type_name -> memos.api.v1.UserSetting - 50, // 22: memos.api.v1.UserAccessToken.issued_at:type_name -> google.protobuf.Timestamp - 50, // 23: memos.api.v1.UserAccessToken.expires_at:type_name -> google.protobuf.Timestamp - 21, // 24: memos.api.v1.ListUserAccessTokensResponse.access_tokens:type_name -> memos.api.v1.UserAccessToken - 21, // 25: memos.api.v1.CreateUserAccessTokenRequest.access_token:type_name -> memos.api.v1.UserAccessToken - 50, // 26: memos.api.v1.UserSession.create_time:type_name -> google.protobuf.Timestamp - 50, // 27: memos.api.v1.UserSession.last_accessed_time:type_name -> google.protobuf.Timestamp - 48, // 28: memos.api.v1.UserSession.client_info:type_name -> memos.api.v1.UserSession.ClientInfo - 26, // 29: memos.api.v1.ListUserSessionsResponse.sessions:type_name -> memos.api.v1.UserSession - 50, // 30: memos.api.v1.UserWebhook.create_time:type_name -> google.protobuf.Timestamp - 50, // 31: memos.api.v1.UserWebhook.update_time:type_name -> google.protobuf.Timestamp - 30, // 32: memos.api.v1.ListUserWebhooksResponse.webhooks:type_name -> memos.api.v1.UserWebhook - 30, // 33: memos.api.v1.CreateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook - 30, // 34: memos.api.v1.UpdateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook - 51, // 35: memos.api.v1.UpdateUserWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask - 43, // 36: memos.api.v1.UserSetting.SessionsSetting.sessions:type_name -> memos.api.v1.UserSetting.SessionsSetting.Session - 45, // 37: memos.api.v1.UserSetting.AccessTokensSetting.access_tokens:type_name -> memos.api.v1.UserSetting.AccessTokensSetting.AccessToken - 46, // 38: memos.api.v1.UserSetting.ShortcutsSetting.shortcuts:type_name -> memos.api.v1.UserSetting.ShortcutsSetting.Shortcut - 47, // 39: memos.api.v1.UserSetting.WebhooksSetting.webhooks:type_name -> memos.api.v1.UserSetting.WebhooksSetting.Webhook - 50, // 40: memos.api.v1.UserSetting.SessionsSetting.Session.create_time:type_name -> google.protobuf.Timestamp - 50, // 41: memos.api.v1.UserSetting.SessionsSetting.Session.last_accessed_time:type_name -> google.protobuf.Timestamp - 44, // 42: memos.api.v1.UserSetting.SessionsSetting.Session.client_info:type_name -> memos.api.v1.UserSetting.SessionsSetting.ClientInfo - 3, // 43: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest - 5, // 44: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest - 6, // 45: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest - 7, // 46: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest - 8, // 47: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest - 9, // 48: memos.api.v1.UserService.SearchUsers:input_type -> memos.api.v1.SearchUsersRequest - 11, // 49: memos.api.v1.UserService.GetUserAvatar:input_type -> memos.api.v1.GetUserAvatarRequest - 14, // 50: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest - 13, // 51: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest - 17, // 52: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest - 18, // 53: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest - 19, // 54: memos.api.v1.UserService.ListUserSettings:input_type -> memos.api.v1.ListUserSettingsRequest - 22, // 55: memos.api.v1.UserService.ListUserAccessTokens:input_type -> memos.api.v1.ListUserAccessTokensRequest - 24, // 56: memos.api.v1.UserService.CreateUserAccessToken:input_type -> memos.api.v1.CreateUserAccessTokenRequest - 25, // 57: memos.api.v1.UserService.DeleteUserAccessToken:input_type -> memos.api.v1.DeleteUserAccessTokenRequest - 27, // 58: memos.api.v1.UserService.ListUserSessions:input_type -> memos.api.v1.ListUserSessionsRequest - 29, // 59: memos.api.v1.UserService.RevokeUserSession:input_type -> memos.api.v1.RevokeUserSessionRequest - 31, // 60: memos.api.v1.UserService.ListUserWebhooks:input_type -> memos.api.v1.ListUserWebhooksRequest - 33, // 61: memos.api.v1.UserService.CreateUserWebhook:input_type -> memos.api.v1.CreateUserWebhookRequest - 34, // 62: memos.api.v1.UserService.UpdateUserWebhook:input_type -> memos.api.v1.UpdateUserWebhookRequest - 35, // 63: memos.api.v1.UserService.DeleteUserWebhook:input_type -> memos.api.v1.DeleteUserWebhookRequest - 4, // 64: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse - 2, // 65: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User - 2, // 66: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User - 2, // 67: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User - 52, // 68: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty - 10, // 69: memos.api.v1.UserService.SearchUsers:output_type -> memos.api.v1.SearchUsersResponse - 53, // 70: memos.api.v1.UserService.GetUserAvatar:output_type -> google.api.HttpBody - 15, // 71: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse - 12, // 72: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats - 16, // 73: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting - 16, // 74: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting - 20, // 75: memos.api.v1.UserService.ListUserSettings:output_type -> memos.api.v1.ListUserSettingsResponse - 23, // 76: memos.api.v1.UserService.ListUserAccessTokens:output_type -> memos.api.v1.ListUserAccessTokensResponse - 21, // 77: memos.api.v1.UserService.CreateUserAccessToken:output_type -> memos.api.v1.UserAccessToken - 52, // 78: memos.api.v1.UserService.DeleteUserAccessToken:output_type -> google.protobuf.Empty - 28, // 79: memos.api.v1.UserService.ListUserSessions:output_type -> memos.api.v1.ListUserSessionsResponse - 52, // 80: memos.api.v1.UserService.RevokeUserSession:output_type -> google.protobuf.Empty - 32, // 81: memos.api.v1.UserService.ListUserWebhooks:output_type -> memos.api.v1.ListUserWebhooksResponse - 30, // 82: memos.api.v1.UserService.CreateUserWebhook:output_type -> memos.api.v1.UserWebhook - 30, // 83: memos.api.v1.UserService.UpdateUserWebhook:output_type -> memos.api.v1.UserWebhook - 52, // 84: memos.api.v1.UserService.DeleteUserWebhook:output_type -> google.protobuf.Empty - 64, // [64:85] is the sub-list for method output_type - 43, // [43:64] is the sub-list for method input_type - 43, // [43:43] is the sub-list for extension type_name - 43, // [43:43] is the sub-list for extension extendee - 0, // [0:43] is the sub-list for field type_name + 41, // 17: memos.api.v1.UserSetting.webhooks_setting:type_name -> memos.api.v1.UserSetting.WebhooksSetting + 16, // 18: memos.api.v1.UpdateUserSettingRequest.setting:type_name -> memos.api.v1.UserSetting + 45, // 19: memos.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask + 16, // 20: memos.api.v1.ListUserSettingsResponse.settings:type_name -> memos.api.v1.UserSetting + 44, // 21: memos.api.v1.UserAccessToken.issued_at:type_name -> google.protobuf.Timestamp + 44, // 22: memos.api.v1.UserAccessToken.expires_at:type_name -> google.protobuf.Timestamp + 21, // 23: memos.api.v1.ListUserAccessTokensResponse.access_tokens:type_name -> memos.api.v1.UserAccessToken + 21, // 24: memos.api.v1.CreateUserAccessTokenRequest.access_token:type_name -> memos.api.v1.UserAccessToken + 44, // 25: memos.api.v1.UserSession.create_time:type_name -> google.protobuf.Timestamp + 44, // 26: memos.api.v1.UserSession.last_accessed_time:type_name -> google.protobuf.Timestamp + 42, // 27: memos.api.v1.UserSession.client_info:type_name -> memos.api.v1.UserSession.ClientInfo + 26, // 28: memos.api.v1.ListUserSessionsResponse.sessions:type_name -> memos.api.v1.UserSession + 44, // 29: memos.api.v1.UserWebhook.create_time:type_name -> google.protobuf.Timestamp + 44, // 30: memos.api.v1.UserWebhook.update_time:type_name -> google.protobuf.Timestamp + 30, // 31: memos.api.v1.ListUserWebhooksResponse.webhooks:type_name -> memos.api.v1.UserWebhook + 30, // 32: memos.api.v1.CreateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook + 30, // 33: memos.api.v1.UpdateUserWebhookRequest.webhook:type_name -> memos.api.v1.UserWebhook + 45, // 34: memos.api.v1.UpdateUserWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask + 26, // 35: memos.api.v1.UserSetting.SessionsSetting.sessions:type_name -> memos.api.v1.UserSession + 21, // 36: memos.api.v1.UserSetting.AccessTokensSetting.access_tokens:type_name -> memos.api.v1.UserAccessToken + 30, // 37: memos.api.v1.UserSetting.WebhooksSetting.webhooks:type_name -> memos.api.v1.UserWebhook + 3, // 38: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest + 5, // 39: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest + 6, // 40: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest + 7, // 41: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest + 8, // 42: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest + 9, // 43: memos.api.v1.UserService.SearchUsers:input_type -> memos.api.v1.SearchUsersRequest + 11, // 44: memos.api.v1.UserService.GetUserAvatar:input_type -> memos.api.v1.GetUserAvatarRequest + 14, // 45: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest + 13, // 46: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest + 17, // 47: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest + 18, // 48: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest + 19, // 49: memos.api.v1.UserService.ListUserSettings:input_type -> memos.api.v1.ListUserSettingsRequest + 22, // 50: memos.api.v1.UserService.ListUserAccessTokens:input_type -> memos.api.v1.ListUserAccessTokensRequest + 24, // 51: memos.api.v1.UserService.CreateUserAccessToken:input_type -> memos.api.v1.CreateUserAccessTokenRequest + 25, // 52: memos.api.v1.UserService.DeleteUserAccessToken:input_type -> memos.api.v1.DeleteUserAccessTokenRequest + 27, // 53: memos.api.v1.UserService.ListUserSessions:input_type -> memos.api.v1.ListUserSessionsRequest + 29, // 54: memos.api.v1.UserService.RevokeUserSession:input_type -> memos.api.v1.RevokeUserSessionRequest + 31, // 55: memos.api.v1.UserService.ListUserWebhooks:input_type -> memos.api.v1.ListUserWebhooksRequest + 33, // 56: memos.api.v1.UserService.CreateUserWebhook:input_type -> memos.api.v1.CreateUserWebhookRequest + 34, // 57: memos.api.v1.UserService.UpdateUserWebhook:input_type -> memos.api.v1.UpdateUserWebhookRequest + 35, // 58: memos.api.v1.UserService.DeleteUserWebhook:input_type -> memos.api.v1.DeleteUserWebhookRequest + 4, // 59: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse + 2, // 60: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User + 2, // 61: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User + 2, // 62: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User + 46, // 63: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty + 10, // 64: memos.api.v1.UserService.SearchUsers:output_type -> memos.api.v1.SearchUsersResponse + 47, // 65: memos.api.v1.UserService.GetUserAvatar:output_type -> google.api.HttpBody + 15, // 66: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse + 12, // 67: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats + 16, // 68: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting + 16, // 69: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting + 20, // 70: memos.api.v1.UserService.ListUserSettings:output_type -> memos.api.v1.ListUserSettingsResponse + 23, // 71: memos.api.v1.UserService.ListUserAccessTokens:output_type -> memos.api.v1.ListUserAccessTokensResponse + 21, // 72: memos.api.v1.UserService.CreateUserAccessToken:output_type -> memos.api.v1.UserAccessToken + 46, // 73: memos.api.v1.UserService.DeleteUserAccessToken:output_type -> google.protobuf.Empty + 28, // 74: memos.api.v1.UserService.ListUserSessions:output_type -> memos.api.v1.ListUserSessionsResponse + 46, // 75: memos.api.v1.UserService.RevokeUserSession:output_type -> google.protobuf.Empty + 32, // 76: memos.api.v1.UserService.ListUserWebhooks:output_type -> memos.api.v1.ListUserWebhooksResponse + 30, // 77: memos.api.v1.UserService.CreateUserWebhook:output_type -> memos.api.v1.UserWebhook + 30, // 78: memos.api.v1.UserService.UpdateUserWebhook:output_type -> memos.api.v1.UserWebhook + 46, // 79: memos.api.v1.UserService.DeleteUserWebhook:output_type -> google.protobuf.Empty + 59, // [59:80] is the sub-list for method output_type + 38, // [38:59] is the sub-list for method input_type + 38, // [38:38] is the sub-list for extension type_name + 38, // [38:38] is the sub-list for extension extendee + 0, // [0:38] is the sub-list for field type_name } func init() { file_api_v1_user_service_proto_init() } @@ -3519,7 +3070,6 @@ func file_api_v1_user_service_proto_init() { (*UserSetting_GeneralSetting_)(nil), (*UserSetting_SessionsSetting_)(nil), (*UserSetting_AccessTokensSetting_)(nil), - (*UserSetting_ShortcutsSetting_)(nil), (*UserSetting_WebhooksSetting_)(nil), } type x struct{} @@ -3528,7 +3078,7 @@ func file_api_v1_user_service_proto_init() { 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: 2, - NumMessages: 47, + NumMessages: 41, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml index 352df8975..ddcc9ce35 100644 --- a/proto/gen/openapi.yaml +++ b/proto/gen/openapi.yaml @@ -2256,19 +2256,6 @@ paths: $ref: '#/components/schemas/Status' components: schemas: - AccessTokensSetting_AccessToken: - type: object - properties: - accessToken: - readOnly: true - type: string - description: |- - The access token is a JWT token. - Including expiration time, issuer, etc. - description: - type: string - description: A description for the access token. - description: User access token information. Activity: type: object properties: @@ -3344,55 +3331,6 @@ components: type: integer description: The total count of matching users. format: int32 - SessionsSetting_ClientInfo: - type: object - properties: - userAgent: - readOnly: true - type: string - description: User agent string of the client. - ipAddress: - readOnly: true - type: string - description: IP address of the client. - deviceType: - readOnly: true - type: string - description: Optional. Device type (e.g., "mobile", "desktop", "tablet"). - os: - readOnly: true - type: string - description: Optional. Operating system (e.g., "iOS 17.0", "Windows 11"). - browser: - readOnly: true - type: string - description: Optional. Browser name and version (e.g., "Chrome 119.0"). - description: Client information for a session. - SessionsSetting_Session: - type: object - properties: - sessionId: - readOnly: true - type: string - description: Unique session identifier. - createTime: - readOnly: true - type: string - description: Timestamp when the session was created. - format: date-time - lastAccessedTime: - readOnly: true - type: string - description: |- - Timestamp when the session was last accessed. - Used for sliding expiration calculation (last_accessed_time + 2 weeks). - format: date-time - clientInfo: - readOnly: true - allOf: - - $ref: '#/components/schemas/SessionsSetting_ClientInfo' - description: Client information associated with this session. - description: User session information. SetMemoAttachmentsRequest: required: - name @@ -3441,23 +3379,6 @@ components: filter: type: string description: The filter expression for the shortcut. - ShortcutsSetting_Shortcut: - required: - - id - - title - - filter - type: object - properties: - id: - type: string - description: Unique identifier for the shortcut. - title: - type: string - description: Display title for the shortcut. - filter: - type: string - description: Filter expression for the shortcut. - description: User shortcut definition. SpoilerNode: type: object properties: @@ -3738,15 +3659,14 @@ components: type: string description: |- The name of the user setting. - Format: users/{user}/settings/{setting} + Format: users/{user}/settings/{setting}, {setting} is the key for the setting. + For example, "users/123/settings/GENERAL" for general settings. generalSetting: $ref: '#/components/schemas/UserSetting_GeneralSetting' sessionsSetting: $ref: '#/components/schemas/UserSetting_SessionsSetting' accessTokensSetting: $ref: '#/components/schemas/UserSetting_AccessTokensSetting' - shortcutsSetting: - $ref: '#/components/schemas/UserSetting_ShortcutsSetting' webhooksSetting: $ref: '#/components/schemas/UserSetting_WebhooksSetting' description: User settings message @@ -3756,7 +3676,7 @@ components: accessTokens: type: array items: - $ref: '#/components/schemas/AccessTokensSetting_AccessToken' + $ref: '#/components/schemas/UserAccessToken' description: List of user access tokens. description: User access tokens configuration. UserSetting_GeneralSetting: @@ -3784,25 +3704,16 @@ components: sessions: type: array items: - $ref: '#/components/schemas/SessionsSetting_Session' + $ref: '#/components/schemas/UserSession' description: List of active user sessions. description: User authentication sessions configuration. - UserSetting_ShortcutsSetting: - type: object - properties: - shortcuts: - type: array - items: - $ref: '#/components/schemas/ShortcutsSetting_Shortcut' - description: List of user shortcuts. - description: User shortcuts configuration. UserSetting_WebhooksSetting: type: object properties: webhooks: type: array items: - $ref: '#/components/schemas/WebhooksSetting_Webhook' + $ref: '#/components/schemas/UserWebhook' description: List of user webhooks. description: User webhooks configuration. UserStats: @@ -3880,23 +3791,6 @@ components: description: The last update time of the webhook. format: date-time description: UserWebhook represents a webhook owned by a user. - WebhooksSetting_Webhook: - required: - - id - - title - - url - type: object - properties: - id: - type: string - description: Unique identifier for the webhook. - title: - type: string - description: Descriptive title for the webhook. - url: - type: string - description: The webhook URL endpoint. - description: User webhook definition. WorkspaceProfile: type: object properties: diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go index 51013bd07..93f66d77a 100644 --- a/server/router/api/v1/user_service.go +++ b/server/router/api/v1/user_service.go @@ -1067,15 +1067,13 @@ func ExtractUserIDAndSettingKeyFromName(name string) (int32, string, error) { // convertSettingKeyToStore converts API setting key to store enum. func convertSettingKeyToStore(key string) (storepb.UserSetting_Key, error) { switch key { - case "general": + case v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_GENERAL)]: return storepb.UserSetting_GENERAL, nil - case "sessions": + case v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_SESSIONS)]: return storepb.UserSetting_SESSIONS, nil - case "access-tokens": + case v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_ACCESS_TOKENS)]: return storepb.UserSetting_ACCESS_TOKENS, nil - case "shortcuts": - return storepb.UserSetting_SHORTCUTS, nil - case "webhooks": + case v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_WEBHOOKS)]: return storepb.UserSetting_WEBHOOKS, nil default: return storepb.UserSetting_KEY_UNSPECIFIED, errors.Errorf("unknown setting key: %s", key) @@ -1086,15 +1084,15 @@ func convertSettingKeyToStore(key string) (storepb.UserSetting_Key, error) { func convertSettingKeyFromStore(key storepb.UserSetting_Key) string { switch key { case storepb.UserSetting_GENERAL: - return "general" + return v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_GENERAL)] case storepb.UserSetting_SESSIONS: - return "sessions" + return v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_SESSIONS)] case storepb.UserSetting_ACCESS_TOKENS: - return "access-tokens" + return v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_ACCESS_TOKENS)] case storepb.UserSetting_SHORTCUTS: - return "shortcuts" + return "SHORTCUTS" // Not defined in API proto case storepb.UserSetting_WEBHOOKS: - return "webhooks" + return v1pb.UserSetting_Key_name[int32(v1pb.UserSetting_WEBHOOKS)] default: return "unknown" } @@ -1117,25 +1115,19 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, userID int32 case storepb.UserSetting_SESSIONS: setting.Value = &v1pb.UserSetting_SessionsSetting_{ SessionsSetting: &v1pb.UserSetting_SessionsSetting{ - Sessions: []*v1pb.UserSetting_SessionsSetting_Session{}, + Sessions: []*v1pb.UserSession{}, }, } case storepb.UserSetting_ACCESS_TOKENS: setting.Value = &v1pb.UserSetting_AccessTokensSetting_{ AccessTokensSetting: &v1pb.UserSetting_AccessTokensSetting{ - AccessTokens: []*v1pb.UserSetting_AccessTokensSetting_AccessToken{}, - }, - } - case storepb.UserSetting_SHORTCUTS: - setting.Value = &v1pb.UserSetting_ShortcutsSetting_{ - ShortcutsSetting: &v1pb.UserSetting_ShortcutsSetting{ - Shortcuts: []*v1pb.UserSetting_ShortcutsSetting_Shortcut{}, + AccessTokens: []*v1pb.UserAccessToken{}, }, } case storepb.UserSetting_WEBHOOKS: setting.Value = &v1pb.UserSetting_WebhooksSetting_{ WebhooksSetting: &v1pb.UserSetting_WebhooksSetting{ - Webhooks: []*v1pb.UserSetting_WebhooksSetting_Webhook{}, + Webhooks: []*v1pb.UserWebhook{}, }, } } @@ -1165,13 +1157,14 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, userID int32 } case storepb.UserSetting_SESSIONS: sessions := storeSetting.GetSessions() - apiSessions := make([]*v1pb.UserSetting_SessionsSetting_Session, 0, len(sessions.Sessions)) + apiSessions := make([]*v1pb.UserSession, 0, len(sessions.Sessions)) for _, session := range sessions.Sessions { - apiSession := &v1pb.UserSetting_SessionsSetting_Session{ + apiSession := &v1pb.UserSession{ + Name: fmt.Sprintf("users/%d/sessions/%s", userID, session.SessionId), SessionId: session.SessionId, CreateTime: session.CreateTime, LastAccessedTime: session.LastAccessedTime, - ClientInfo: &v1pb.UserSetting_SessionsSetting_ClientInfo{ + ClientInfo: &v1pb.UserSession_ClientInfo{ UserAgent: session.ClientInfo.UserAgent, IpAddress: session.ClientInfo.IpAddress, DeviceType: session.ClientInfo.DeviceType, @@ -1188,9 +1181,10 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, userID int32 } case storepb.UserSetting_ACCESS_TOKENS: accessTokens := storeSetting.GetAccessTokens() - apiTokens := make([]*v1pb.UserSetting_AccessTokensSetting_AccessToken, 0, len(accessTokens.AccessTokens)) + apiTokens := make([]*v1pb.UserAccessToken, 0, len(accessTokens.AccessTokens)) for _, token := range accessTokens.AccessTokens { - apiToken := &v1pb.UserSetting_AccessTokensSetting_AccessToken{ + apiToken := &v1pb.UserAccessToken{ + Name: fmt.Sprintf("users/%d/accessTokens/%s", userID, token.AccessToken), AccessToken: token.AccessToken, Description: token.Description, } @@ -1201,30 +1195,14 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, userID int32 AccessTokens: apiTokens, }, } - case storepb.UserSetting_SHORTCUTS: - shortcuts := storeSetting.GetShortcuts() - apiShortcuts := make([]*v1pb.UserSetting_ShortcutsSetting_Shortcut, 0, len(shortcuts.Shortcuts)) - for _, shortcut := range shortcuts.Shortcuts { - apiShortcut := &v1pb.UserSetting_ShortcutsSetting_Shortcut{ - Id: shortcut.Id, - Title: shortcut.Title, - Filter: shortcut.Filter, - } - apiShortcuts = append(apiShortcuts, apiShortcut) - } - setting.Value = &v1pb.UserSetting_ShortcutsSetting_{ - ShortcutsSetting: &v1pb.UserSetting_ShortcutsSetting{ - Shortcuts: apiShortcuts, - }, - } case storepb.UserSetting_WEBHOOKS: webhooks := storeSetting.GetWebhooks() - apiWebhooks := make([]*v1pb.UserSetting_WebhooksSetting_Webhook, 0, len(webhooks.Webhooks)) + apiWebhooks := make([]*v1pb.UserWebhook, 0, len(webhooks.Webhooks)) for _, webhook := range webhooks.Webhooks { - apiWebhook := &v1pb.UserSetting_WebhooksSetting_Webhook{ - Id: webhook.Id, - Title: webhook.Title, - Url: webhook.Url, + apiWebhook := &v1pb.UserWebhook{ + Name: fmt.Sprintf("users/%d/webhooks/%s", userID, webhook.Id), + Url: webhook.Url, + DisplayName: webhook.Title, } apiWebhooks = append(apiWebhooks, apiWebhook) } @@ -1303,32 +1281,13 @@ func convertUserSettingToStore(apiSetting *v1pb.UserSetting, userID int32, key s } else { return nil, errors.Errorf("access tokens setting is required") } - case storepb.UserSetting_SHORTCUTS: - if shortcuts := apiSetting.GetShortcutsSetting(); shortcuts != nil { - storeShortcuts := make([]*storepb.ShortcutsUserSetting_Shortcut, 0, len(shortcuts.Shortcuts)) - for _, shortcut := range shortcuts.Shortcuts { - storeShortcut := &storepb.ShortcutsUserSetting_Shortcut{ - Id: shortcut.Id, - Title: shortcut.Title, - Filter: shortcut.Filter, - } - storeShortcuts = append(storeShortcuts, storeShortcut) - } - storeSetting.Value = &storepb.UserSetting_Shortcuts{ - Shortcuts: &storepb.ShortcutsUserSetting{ - Shortcuts: storeShortcuts, - }, - } - } else { - return nil, errors.Errorf("shortcuts setting is required") - } case storepb.UserSetting_WEBHOOKS: if webhooks := apiSetting.GetWebhooksSetting(); webhooks != nil { storeWebhooks := make([]*storepb.WebhooksUserSetting_Webhook, 0, len(webhooks.Webhooks)) for _, webhook := range webhooks.Webhooks { storeWebhook := &storepb.WebhooksUserSetting_Webhook{ - Id: webhook.Id, - Title: webhook.Title, + Id: extractWebhookIDFromName(webhook.Name), + Title: webhook.DisplayName, Url: webhook.Url, } storeWebhooks = append(storeWebhooks, storeWebhook) @@ -1347,3 +1306,13 @@ func convertUserSettingToStore(apiSetting *v1pb.UserSetting, userID int32, key s return storeSetting, nil } + +// extractWebhookIDFromName extracts webhook ID from resource name. +// e.g., "users/123/webhooks/webhook-id" -> "webhook-id". +func extractWebhookIDFromName(name string) string { + parts := strings.Split(name, "/") + if len(parts) >= 4 && parts[0] == "users" && parts[2] == "webhooks" { + return parts[3] + } + return "" +} diff --git a/web/src/store/user.ts b/web/src/store/user.ts index ada7a29fd..8d2aafc97 100644 --- a/web/src/store/user.ts +++ b/web/src/store/user.ts @@ -6,10 +6,10 @@ import { Shortcut } from "@/types/proto/api/v1/shortcut_service"; import { User, UserSetting, + UserSetting_Key, UserSetting_GeneralSetting, UserSetting_SessionsSetting, UserSetting_AccessTokensSetting, - UserSetting_ShortcutsSetting, UserSetting_WebhooksSetting, UserStats, } from "@/types/proto/api/v1/user_service"; @@ -21,7 +21,6 @@ class LocalState { userGeneralSetting?: UserSetting_GeneralSetting; userSessionsSetting?: UserSetting_SessionsSetting; userAccessTokensSetting?: UserSetting_AccessTokensSetting; - userShortcutsSetting?: UserSetting_ShortcutsSetting; userWebhooksSetting?: UserSetting_WebhooksSetting; shortcuts: Shortcut[] = []; inboxes: Inbox[] = []; @@ -145,7 +144,7 @@ const userStore = (() => { throw new Error("No current user"); } - const settingName = `${state.currentUser}/settings/general`; + const settingName = `${state.currentUser}/settings/${UserSetting_Key.GENERAL}`; const userSetting: UserSetting = { name: settingName, generalSetting: generalSetting as UserSetting_GeneralSetting, @@ -166,7 +165,7 @@ const userStore = (() => { throw new Error("No current user"); } - const settingName = `${state.currentUser}/settings/general`; + const settingName = `${state.currentUser}/settings/${UserSetting_Key.GENERAL}`; const userSetting = await userServiceClient.getUserSetting({ name: settingName }); state.setPartial({ @@ -187,24 +186,13 @@ const userStore = (() => { const generalSetting = settings.find((s) => s.generalSetting)?.generalSetting; const sessionsSetting = settings.find((s) => s.sessionsSetting)?.sessionsSetting; const accessTokensSetting = settings.find((s) => s.accessTokensSetting)?.accessTokensSetting; - const shortcutsSetting = settings.find((s) => s.shortcutsSetting)?.shortcutsSetting; const webhooksSetting = settings.find((s) => s.webhooksSetting)?.webhooksSetting; - // Convert user setting shortcuts to proper Shortcut format - const shortcuts: Shortcut[] = - shortcutsSetting?.shortcuts.map((shortcut) => ({ - name: `${state.currentUser}/shortcuts/${shortcut.id}`, - title: shortcut.title, - filter: shortcut.filter, - })) || []; - state.setPartial({ userGeneralSetting: generalSetting, userSessionsSetting: sessionsSetting, userAccessTokensSetting: accessTokensSetting, - userShortcutsSetting: shortcutsSetting, userWebhooksSetting: webhooksSetting, - shortcuts, }); }; diff --git a/web/src/types/proto/api/v1/user_service.ts b/web/src/types/proto/api/v1/user_service.ts index 30247824a..d0c26e763 100644 --- a/web/src/types/proto/api/v1/user_service.ts +++ b/web/src/types/proto/api/v1/user_service.ts @@ -272,13 +272,13 @@ export interface ListAllUserStatsResponse { export interface UserSetting { /** * The name of the user setting. - * Format: users/{user}/settings/{setting} + * Format: users/{user}/settings/{setting}, {setting} is the key for the setting. + * For example, "users/123/settings/GENERAL" for general settings. */ name: string; generalSetting?: UserSetting_GeneralSetting | undefined; sessionsSetting?: UserSetting_SessionsSetting | undefined; accessTokensSetting?: UserSetting_AccessTokensSetting | undefined; - shortcutsSetting?: UserSetting_ShortcutsSetting | undefined; webhooksSetting?: UserSetting_WebhooksSetting | undefined; } @@ -291,8 +291,6 @@ export enum UserSetting_Key { SESSIONS = "SESSIONS", /** ACCESS_TOKENS - ACCESS_TOKENS is the key for access tokens. */ ACCESS_TOKENS = "ACCESS_TOKENS", - /** SHORTCUTS - SHORTCUTS is the key for user shortcuts. */ - SHORTCUTS = "SHORTCUTS", /** WEBHOOKS - WEBHOOKS is the key for user webhooks. */ WEBHOOKS = "WEBHOOKS", UNRECOGNIZED = "UNRECOGNIZED", @@ -313,9 +311,6 @@ export function userSetting_KeyFromJSON(object: any): UserSetting_Key { case "ACCESS_TOKENS": return UserSetting_Key.ACCESS_TOKENS; case 4: - case "SHORTCUTS": - return UserSetting_Key.SHORTCUTS; - case 5: case "WEBHOOKS": return UserSetting_Key.WEBHOOKS; case -1: @@ -335,10 +330,8 @@ export function userSetting_KeyToNumber(object: UserSetting_Key): number { return 2; case UserSetting_Key.ACCESS_TOKENS: return 3; - case UserSetting_Key.SHORTCUTS: - return 4; case UserSetting_Key.WEBHOOKS: - return 5; + return 4; case UserSetting_Key.UNRECOGNIZED: default: return -1; @@ -364,89 +357,19 @@ export interface UserSetting_GeneralSetting { /** User authentication sessions configuration. */ export interface UserSetting_SessionsSetting { /** List of active user sessions. */ - sessions: UserSetting_SessionsSetting_Session[]; -} - -/** User session information. */ -export interface UserSetting_SessionsSetting_Session { - /** Unique session identifier. */ - sessionId: string; - /** Timestamp when the session was created. */ - createTime?: - | Date - | undefined; - /** - * Timestamp when the session was last accessed. - * Used for sliding expiration calculation (last_accessed_time + 2 weeks). - */ - lastAccessedTime?: - | Date - | undefined; - /** Client information associated with this session. */ - clientInfo?: UserSetting_SessionsSetting_ClientInfo | undefined; -} - -/** Client information for a session. */ -export interface UserSetting_SessionsSetting_ClientInfo { - /** User agent string of the client. */ - userAgent: string; - /** IP address of the client. */ - ipAddress: string; - /** Optional. Device type (e.g., "mobile", "desktop", "tablet"). */ - deviceType: string; - /** Optional. Operating system (e.g., "iOS 17.0", "Windows 11"). */ - os: string; - /** Optional. Browser name and version (e.g., "Chrome 119.0"). */ - browser: string; + sessions: UserSession[]; } /** User access tokens configuration. */ export interface UserSetting_AccessTokensSetting { /** List of user access tokens. */ - accessTokens: UserSetting_AccessTokensSetting_AccessToken[]; -} - -/** User access token information. */ -export interface UserSetting_AccessTokensSetting_AccessToken { - /** - * The access token is a JWT token. - * Including expiration time, issuer, etc. - */ - accessToken: string; - /** A description for the access token. */ - description: string; -} - -/** User shortcuts configuration. */ -export interface UserSetting_ShortcutsSetting { - /** List of user shortcuts. */ - shortcuts: UserSetting_ShortcutsSetting_Shortcut[]; -} - -/** User shortcut definition. */ -export interface UserSetting_ShortcutsSetting_Shortcut { - /** Unique identifier for the shortcut. */ - id: string; - /** Display title for the shortcut. */ - title: string; - /** Filter expression for the shortcut. */ - filter: string; + accessTokens: UserAccessToken[]; } /** User webhooks configuration. */ export interface UserSetting_WebhooksSetting { /** List of user webhooks. */ - webhooks: UserSetting_WebhooksSetting_Webhook[]; -} - -/** User webhook definition. */ -export interface UserSetting_WebhooksSetting_Webhook { - /** Unique identifier for the webhook. */ - id: string; - /** Descriptive title for the webhook. */ - title: string; - /** The webhook URL endpoint. */ - url: string; + webhooks: UserWebhook[]; } export interface GetUserSettingRequest { @@ -1869,7 +1792,6 @@ function createBaseUserSetting(): UserSetting { generalSetting: undefined, sessionsSetting: undefined, accessTokensSetting: undefined, - shortcutsSetting: undefined, webhooksSetting: undefined, }; } @@ -1888,11 +1810,8 @@ export const UserSetting: MessageFns = { if (message.accessTokensSetting !== undefined) { UserSetting_AccessTokensSetting.encode(message.accessTokensSetting, writer.uint32(34).fork()).join(); } - if (message.shortcutsSetting !== undefined) { - UserSetting_ShortcutsSetting.encode(message.shortcutsSetting, writer.uint32(42).fork()).join(); - } if (message.webhooksSetting !== undefined) { - UserSetting_WebhooksSetting.encode(message.webhooksSetting, writer.uint32(50).fork()).join(); + UserSetting_WebhooksSetting.encode(message.webhooksSetting, writer.uint32(42).fork()).join(); } return writer; }, @@ -1941,14 +1860,6 @@ export const UserSetting: MessageFns = { break; } - message.shortcutsSetting = UserSetting_ShortcutsSetting.decode(reader, reader.uint32()); - continue; - } - case 6: { - if (tag !== 50) { - break; - } - message.webhooksSetting = UserSetting_WebhooksSetting.decode(reader, reader.uint32()); continue; } @@ -1976,9 +1887,6 @@ export const UserSetting: MessageFns = { message.accessTokensSetting = (object.accessTokensSetting !== undefined && object.accessTokensSetting !== null) ? UserSetting_AccessTokensSetting.fromPartial(object.accessTokensSetting) : undefined; - message.shortcutsSetting = (object.shortcutsSetting !== undefined && object.shortcutsSetting !== null) - ? UserSetting_ShortcutsSetting.fromPartial(object.shortcutsSetting) - : undefined; message.webhooksSetting = (object.webhooksSetting !== undefined && object.webhooksSetting !== null) ? UserSetting_WebhooksSetting.fromPartial(object.webhooksSetting) : undefined; @@ -2075,7 +1983,7 @@ function createBaseUserSetting_SessionsSetting(): UserSetting_SessionsSetting { export const UserSetting_SessionsSetting: MessageFns = { encode(message: UserSetting_SessionsSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.sessions) { - UserSetting_SessionsSetting_Session.encode(v!, writer.uint32(10).fork()).join(); + UserSession.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, @@ -2092,7 +2000,7 @@ export const UserSetting_SessionsSetting: MessageFns): UserSetting_SessionsSetting { const message = createBaseUserSetting_SessionsSetting(); - message.sessions = object.sessions?.map((e) => UserSetting_SessionsSetting_Session.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUserSetting_SessionsSetting_Session(): UserSetting_SessionsSetting_Session { - return { sessionId: "", createTime: undefined, lastAccessedTime: undefined, clientInfo: undefined }; -} - -export const UserSetting_SessionsSetting_Session: MessageFns = { - encode(message: UserSetting_SessionsSetting_Session, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.sessionId !== "") { - writer.uint32(10).string(message.sessionId); - } - if (message.createTime !== undefined) { - Timestamp.encode(toTimestamp(message.createTime), writer.uint32(18).fork()).join(); - } - if (message.lastAccessedTime !== undefined) { - Timestamp.encode(toTimestamp(message.lastAccessedTime), writer.uint32(26).fork()).join(); - } - if (message.clientInfo !== undefined) { - UserSetting_SessionsSetting_ClientInfo.encode(message.clientInfo, writer.uint32(34).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_SessionsSetting_Session { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_SessionsSetting_Session(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.sessionId = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.lastAccessedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.clientInfo = UserSetting_SessionsSetting_ClientInfo.decode(reader, reader.uint32()); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_SessionsSetting_Session { - return UserSetting_SessionsSetting_Session.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting_SessionsSetting_Session { - const message = createBaseUserSetting_SessionsSetting_Session(); - message.sessionId = object.sessionId ?? ""; - message.createTime = object.createTime ?? undefined; - message.lastAccessedTime = object.lastAccessedTime ?? undefined; - message.clientInfo = (object.clientInfo !== undefined && object.clientInfo !== null) - ? UserSetting_SessionsSetting_ClientInfo.fromPartial(object.clientInfo) - : undefined; - return message; - }, -}; - -function createBaseUserSetting_SessionsSetting_ClientInfo(): UserSetting_SessionsSetting_ClientInfo { - return { userAgent: "", ipAddress: "", deviceType: "", os: "", browser: "" }; -} - -export const UserSetting_SessionsSetting_ClientInfo: MessageFns = { - encode(message: UserSetting_SessionsSetting_ClientInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.userAgent !== "") { - writer.uint32(10).string(message.userAgent); - } - if (message.ipAddress !== "") { - writer.uint32(18).string(message.ipAddress); - } - if (message.deviceType !== "") { - writer.uint32(26).string(message.deviceType); - } - if (message.os !== "") { - writer.uint32(34).string(message.os); - } - if (message.browser !== "") { - writer.uint32(42).string(message.browser); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_SessionsSetting_ClientInfo { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_SessionsSetting_ClientInfo(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.userAgent = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.ipAddress = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.deviceType = reader.string(); - continue; - } - case 4: { - if (tag !== 34) { - break; - } - - message.os = reader.string(); - continue; - } - case 5: { - if (tag !== 42) { - break; - } - - message.browser = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_SessionsSetting_ClientInfo { - return UserSetting_SessionsSetting_ClientInfo.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting_SessionsSetting_ClientInfo { - const message = createBaseUserSetting_SessionsSetting_ClientInfo(); - message.userAgent = object.userAgent ?? ""; - message.ipAddress = object.ipAddress ?? ""; - message.deviceType = object.deviceType ?? ""; - message.os = object.os ?? ""; - message.browser = object.browser ?? ""; + message.sessions = object.sessions?.map((e) => UserSession.fromPartial(e)) || []; return message; }, }; @@ -2299,7 +2029,7 @@ function createBaseUserSetting_AccessTokensSetting(): UserSetting_AccessTokensSe export const UserSetting_AccessTokensSetting: MessageFns = { encode(message: UserSetting_AccessTokensSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.accessTokens) { - UserSetting_AccessTokensSetting_AccessToken.encode(v!, writer.uint32(10).fork()).join(); + UserAccessToken.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, @@ -2316,7 +2046,7 @@ export const UserSetting_AccessTokensSetting: MessageFns): UserSetting_AccessTokensSetting { const message = createBaseUserSetting_AccessTokensSetting(); - message.accessTokens = - object.accessTokens?.map((e) => UserSetting_AccessTokensSetting_AccessToken.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUserSetting_AccessTokensSetting_AccessToken(): UserSetting_AccessTokensSetting_AccessToken { - return { accessToken: "", description: "" }; -} - -export const UserSetting_AccessTokensSetting_AccessToken: MessageFns = { - encode( - message: UserSetting_AccessTokensSetting_AccessToken, - writer: BinaryWriter = new BinaryWriter(), - ): BinaryWriter { - if (message.accessToken !== "") { - writer.uint32(10).string(message.accessToken); - } - if (message.description !== "") { - writer.uint32(18).string(message.description); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_AccessTokensSetting_AccessToken { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_AccessTokensSetting_AccessToken(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.accessToken = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.description = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_AccessTokensSetting_AccessToken { - return UserSetting_AccessTokensSetting_AccessToken.fromPartial(base ?? {}); - }, - fromPartial( - object: DeepPartial, - ): UserSetting_AccessTokensSetting_AccessToken { - const message = createBaseUserSetting_AccessTokensSetting_AccessToken(); - message.accessToken = object.accessToken ?? ""; - message.description = object.description ?? ""; - return message; - }, -}; - -function createBaseUserSetting_ShortcutsSetting(): UserSetting_ShortcutsSetting { - return { shortcuts: [] }; -} - -export const UserSetting_ShortcutsSetting: MessageFns = { - encode(message: UserSetting_ShortcutsSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - for (const v of message.shortcuts) { - UserSetting_ShortcutsSetting_Shortcut.encode(v!, writer.uint32(10).fork()).join(); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_ShortcutsSetting { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_ShortcutsSetting(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.shortcuts.push(UserSetting_ShortcutsSetting_Shortcut.decode(reader, reader.uint32())); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_ShortcutsSetting { - return UserSetting_ShortcutsSetting.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting_ShortcutsSetting { - const message = createBaseUserSetting_ShortcutsSetting(); - message.shortcuts = object.shortcuts?.map((e) => UserSetting_ShortcutsSetting_Shortcut.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUserSetting_ShortcutsSetting_Shortcut(): UserSetting_ShortcutsSetting_Shortcut { - return { id: "", title: "", filter: "" }; -} - -export const UserSetting_ShortcutsSetting_Shortcut: MessageFns = { - encode(message: UserSetting_ShortcutsSetting_Shortcut, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.id !== "") { - writer.uint32(10).string(message.id); - } - if (message.title !== "") { - writer.uint32(18).string(message.title); - } - if (message.filter !== "") { - writer.uint32(26).string(message.filter); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_ShortcutsSetting_Shortcut { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_ShortcutsSetting_Shortcut(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.id = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.title = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.filter = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_ShortcutsSetting_Shortcut { - return UserSetting_ShortcutsSetting_Shortcut.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting_ShortcutsSetting_Shortcut { - const message = createBaseUserSetting_ShortcutsSetting_Shortcut(); - message.id = object.id ?? ""; - message.title = object.title ?? ""; - message.filter = object.filter ?? ""; + message.accessTokens = object.accessTokens?.map((e) => UserAccessToken.fromPartial(e)) || []; return message; }, }; @@ -2525,7 +2075,7 @@ function createBaseUserSetting_WebhooksSetting(): UserSetting_WebhooksSetting { export const UserSetting_WebhooksSetting: MessageFns = { encode(message: UserSetting_WebhooksSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.webhooks) { - UserSetting_WebhooksSetting_Webhook.encode(v!, writer.uint32(10).fork()).join(); + UserWebhook.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, @@ -2542,7 +2092,7 @@ export const UserSetting_WebhooksSetting: MessageFns): UserSetting_WebhooksSetting { const message = createBaseUserSetting_WebhooksSetting(); - message.webhooks = object.webhooks?.map((e) => UserSetting_WebhooksSetting_Webhook.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUserSetting_WebhooksSetting_Webhook(): UserSetting_WebhooksSetting_Webhook { - return { id: "", title: "", url: "" }; -} - -export const UserSetting_WebhooksSetting_Webhook: MessageFns = { - encode(message: UserSetting_WebhooksSetting_Webhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.id !== "") { - writer.uint32(10).string(message.id); - } - if (message.title !== "") { - writer.uint32(18).string(message.title); - } - if (message.url !== "") { - writer.uint32(26).string(message.url); - } - return writer; - }, - - decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_WebhooksSetting_Webhook { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUserSetting_WebhooksSetting_Webhook(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (tag !== 10) { - break; - } - - message.id = reader.string(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.title = reader.string(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.url = reader.string(); - continue; - } - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skip(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): UserSetting_WebhooksSetting_Webhook { - return UserSetting_WebhooksSetting_Webhook.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): UserSetting_WebhooksSetting_Webhook { - const message = createBaseUserSetting_WebhooksSetting_Webhook(); - message.id = object.id ?? ""; - message.title = object.title ?? ""; - message.url = object.url ?? ""; + message.webhooks = object.webhooks?.map((e) => UserWebhook.fromPartial(e)) || []; return message; }, }; diff --git a/web/src/types/proto/google/protobuf/descriptor.ts b/web/src/types/proto/google/protobuf/descriptor.ts index 9f55f0344..89514564e 100644 --- a/web/src/types/proto/google/protobuf/descriptor.ts +++ b/web/src/types/proto/google/protobuf/descriptor.ts @@ -35,7 +35,7 @@ export enum Edition { EDITION_2024 = "EDITION_2024", /** * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be - * used or relyed on outside of tests. + * used or relied on outside of tests. */ EDITION_1_TEST_ONLY = "EDITION_1_TEST_ONLY", EDITION_2_TEST_ONLY = "EDITION_2_TEST_ONLY", @@ -177,11 +177,19 @@ export interface FileDescriptorProto { * The supported values are "proto2", "proto3", and "editions". * * If `edition` is present, this value must be "editions". + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. */ syntax?: | string | undefined; - /** The edition of the proto file. */ + /** + * The edition of the proto file. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ edition?: Edition | undefined; } @@ -828,7 +836,12 @@ export interface FileOptions { rubyPackage?: | string | undefined; - /** Any features defined in the specific edition. */ + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ features?: | FeatureSet | undefined; @@ -966,7 +979,12 @@ export interface MessageOptions { deprecatedLegacyJsonFieldConflicts?: | boolean | undefined; - /** Any features defined in the specific edition. */ + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ features?: | FeatureSet | undefined; @@ -976,12 +994,13 @@ export interface MessageOptions { export interface FieldOptions { /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. * The ctype option instructs the C++ code generator to use a different * representation of the field than it normally would. See the specific * options below. This option is only implemented to support use of * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of - * type "bytes" in the open source release -- sorry, we'll try to include - * other types in a future version! + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. */ ctype?: | FieldOptions_CType @@ -1070,7 +1089,12 @@ export interface FieldOptions { retention?: FieldOptions_OptionRetention | undefined; targets: FieldOptions_OptionTargetType[]; editionDefaults: FieldOptions_EditionDefault[]; - /** Any features defined in the specific edition. */ + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ features?: FeatureSet | undefined; featureSupport?: | FieldOptions_FeatureSupport @@ -1169,11 +1193,7 @@ export function fieldOptions_JSTypeToNumber(object: FieldOptions_JSType): number } } -/** - * If set to RETENTION_SOURCE, the option will be omitted from the binary. - * Note: as of January 2023, support for this is in progress and does not yet - * have an effect (b/264593489). - */ +/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ export enum FieldOptions_OptionRetention { RETENTION_UNKNOWN = "RETENTION_UNKNOWN", RETENTION_RUNTIME = "RETENTION_RUNTIME", @@ -1216,8 +1236,7 @@ export function fieldOptions_OptionRetentionToNumber(object: FieldOptions_Option /** * This indicates the types of entities that the field may apply to when used * as an option. If it is unset, then the field may be freely used as an - * option on any kind of entity. Note: as of January 2023, support for this is - * in progress and does not yet have an effect (b/264593489). + * option on any kind of entity. */ export enum FieldOptions_OptionTargetType { TARGET_TYPE_UNKNOWN = "TARGET_TYPE_UNKNOWN", @@ -1341,7 +1360,12 @@ export interface FieldOptions_FeatureSupport { } export interface OneofOptions { - /** Any features defined in the specific edition. */ + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ features?: | FeatureSet | undefined; @@ -1379,7 +1403,12 @@ export interface EnumOptions { deprecatedLegacyJsonFieldConflicts?: | boolean | undefined; - /** Any features defined in the specific edition. */ + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ features?: | FeatureSet | undefined; @@ -1397,7 +1426,12 @@ export interface EnumValueOptions { deprecated?: | boolean | undefined; - /** Any features defined in the specific edition. */ + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ features?: | FeatureSet | undefined; @@ -1418,7 +1452,12 @@ export interface EnumValueOptions { } export interface ServiceOptions { - /** Any features defined in the specific edition. */ + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ features?: | FeatureSet | undefined; @@ -1446,7 +1485,12 @@ export interface MethodOptions { idempotencyLevel?: | MethodOptions_IdempotencyLevel | undefined; - /** Any features defined in the specific edition. */ + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ features?: | FeatureSet | undefined; @@ -1549,6 +1593,7 @@ export interface FeatureSet { utf8Validation?: FeatureSet_Utf8Validation | undefined; messageEncoding?: FeatureSet_MessageEncoding | undefined; jsonFormat?: FeatureSet_JsonFormat | undefined; + enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined; } export enum FeatureSet_FieldPresence { @@ -1791,6 +1836,45 @@ export function featureSet_JsonFormatToNumber(object: FeatureSet_JsonFormat): nu } } +export enum FeatureSet_EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = "ENFORCE_NAMING_STYLE_UNKNOWN", + STYLE2024 = "STYLE2024", + STYLE_LEGACY = "STYLE_LEGACY", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle { + switch (object) { + case 0: + case "ENFORCE_NAMING_STYLE_UNKNOWN": + return FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; + case 1: + case "STYLE2024": + return FeatureSet_EnforceNamingStyle.STYLE2024; + case 2: + case "STYLE_LEGACY": + return FeatureSet_EnforceNamingStyle.STYLE_LEGACY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnforceNamingStyle.UNRECOGNIZED; + } +} + +export function featureSet_EnforceNamingStyleToNumber(object: FeatureSet_EnforceNamingStyle): number { + switch (object) { + case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN: + return 0; + case FeatureSet_EnforceNamingStyle.STYLE2024: + return 1; + case FeatureSet_EnforceNamingStyle.STYLE_LEGACY: + return 2; + case FeatureSet_EnforceNamingStyle.UNRECOGNIZED: + default: + return -1; + } +} + /** * A compiled specification for the defaults of a set of features. These * messages are generated from FeatureSet extensions and can be used to seed @@ -4914,6 +4998,7 @@ function createBaseFeatureSet(): FeatureSet { utf8Validation: FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN, messageEncoding: FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN, jsonFormat: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN, + enforceNamingStyle: FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN, }; } @@ -4948,6 +5033,12 @@ export const FeatureSet: MessageFns = { if (message.jsonFormat !== undefined && message.jsonFormat !== FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN) { writer.uint32(48).int32(featureSet_JsonFormatToNumber(message.jsonFormat)); } + if ( + message.enforceNamingStyle !== undefined && + message.enforceNamingStyle !== FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN + ) { + writer.uint32(56).int32(featureSet_EnforceNamingStyleToNumber(message.enforceNamingStyle)); + } return writer; }, @@ -5006,6 +5097,14 @@ export const FeatureSet: MessageFns = { message.jsonFormat = featureSet_JsonFormatFromJSON(reader.int32()); continue; } + case 7: { + if (tag !== 56) { + break; + } + + message.enforceNamingStyle = featureSet_EnforceNamingStyleFromJSON(reader.int32()); + continue; + } } if ((tag & 7) === 4 || tag === 0) { break; @@ -5027,6 +5126,8 @@ export const FeatureSet: MessageFns = { message.utf8Validation = object.utf8Validation ?? FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; message.messageEncoding = object.messageEncoding ?? FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; message.jsonFormat = object.jsonFormat ?? FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + message.enforceNamingStyle = object.enforceNamingStyle ?? + FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; return message; }, };