Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: update user settings

johnnyjoyc5d497a1f039
diff --git a/proto/api/v1/user_service.proto b/proto/api/v1/user_service.proto
index b0b0ab15b..be38a930e 100644
--- a/proto/api/v1/user_service.proto
+++ b/proto/api/v1/user_service.proto
@@ -75,19 +75,25 @@ service UserService {
// GetUserSetting returns the user setting.
rpc GetUserSetting(GetUserSettingRequest) returns (UserSetting) {
- option (google.api.http) = {get: "/api/v1/{name=users/*}:getSetting"};
+ option (google.api.http) = {get: "/api/v1/{name=users/*/settings/*}"};
option (google.api.method_signature) = "name";
}
// UpdateUserSetting updates the user setting.
rpc UpdateUserSetting(UpdateUserSettingRequest) returns (UserSetting) {
option (google.api.http) = {
- patch: "/api/v1/{setting.name=users/*}:updateSetting"
+ patch: "/api/v1/{setting.name=users/*/settings/*}"
body: "setting"
};
option (google.api.method_signature) = "setting,update_mask";
}
+ // ListUserSettings returns a list of user settings.
+ rpc ListUserSettings(ListUserSettingsRequest) returns (ListUserSettingsResponse) {
+ option (google.api.http) = {get: "/api/v1/{parent=users/*}/settings"};
+ option (google.api.method_signature) = "parent";
+ }
+
// ListUserAccessTokens returns a list of access tokens for a user.
rpc ListUserAccessTokens(ListUserAccessTokensRequest) returns (ListUserAccessTokensResponse) {
option (google.api.http) = {get: "/api/v1/{parent=users/*}/accessTokens"};
@@ -120,6 +126,36 @@ service UserService {
option (google.api.http) = {delete: "/api/v1/{name=users/*/sessions/*}"};
option (google.api.method_signature) = "name";
}
+
+ // ListUserWebhooks returns a list of webhooks for a user.
+ rpc ListUserWebhooks(ListUserWebhooksRequest) returns (ListUserWebhooksResponse) {
+ option (google.api.http) = {get: "/api/v1/{parent=users/*}/webhooks"};
+ option (google.api.method_signature) = "parent";
+ }
+
+ // CreateUserWebhook creates a new webhook for a user.
+ rpc CreateUserWebhook(CreateUserWebhookRequest) returns (UserWebhook) {
+ option (google.api.http) = {
+ post: "/api/v1/{parent=users/*}/webhooks"
+ body: "webhook"
+ };
+ option (google.api.method_signature) = "parent,webhook";
+ }
+
+ // UpdateUserWebhook updates an existing webhook for a user.
+ rpc UpdateUserWebhook(UpdateUserWebhookRequest) returns (UserWebhook) {
+ option (google.api.http) = {
+ patch: "/api/v1/{webhook.name=users/*/webhooks/*}"
+ body: "webhook"
+ };
+ option (google.api.method_signature) = "webhook,update_mask";
+ }
+
+ // DeleteUserWebhook deletes a webhook for a user.
+ rpc DeleteUserWebhook(DeleteUserWebhookRequest) returns (google.protobuf.Empty) {
+ option (google.api.http) = {delete: "/api/v1/{name=users/*/webhooks/*}"};
+ option (google.api.method_signature) = "name";
+ }
}
message User {
@@ -348,40 +384,152 @@ message GetUserStatsRequest {
];
}
+message ListAllUserStatsRequest {
+ // This endpoint doesn't take any parameters.
+}
+
+message ListAllUserStatsResponse {
+ // The list of user statistics.
+ repeated UserStats stats = 1;
+}
+
// User settings message
message UserSetting {
option (google.api.resource) = {
type: "memos.api.v1/UserSetting"
- pattern: "users/{user}"
+ pattern: "users/{user}/settings/{setting}"
singular: "userSetting"
plural: "userSettings"
};
- // The resource name of the user whose setting this is.
- // Format: users/{user}
+ // The name of the user setting.
+ // Format: users/{user}/settings/{setting}
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
- // The preferred locale of the user.
- string locale = 2 [(google.api.field_behavior) = OPTIONAL];
+ oneof value {
+ GeneralSetting general_setting = 2;
+ SessionsSetting sessions_setting = 3;
+ AccessTokensSetting access_tokens_setting = 4;
+ ShortcutsSetting shortcuts_setting = 5;
+ WebhooksSetting webhooks_setting = 6;
+ }
- // The preferred appearance of the user.
- string appearance = 3 [(google.api.field_behavior) = OPTIONAL];
+ // Enumeration of user setting keys.
+ enum Key {
+ KEY_UNSPECIFIED = 0;
+ // GENERAL is the key for general user settings.
+ GENERAL = 1;
+ // SESSIONS is the key for user authentication sessions.
+ 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;
+ }
- // The default visibility of the memo.
- string memo_visibility = 4 [(google.api.field_behavior) = OPTIONAL];
+ // General user settings configuration.
+ message GeneralSetting {
+ // The preferred locale of the user.
+ string locale = 1 [(google.api.field_behavior) = OPTIONAL];
+ // The preferred appearance of the user.
+ string appearance = 2 [(google.api.field_behavior) = OPTIONAL];
+ // The default visibility of the memo.
+ string memo_visibility = 3 [(google.api.field_behavior) = OPTIONAL];
+ // The preferred theme of the user.
+ // This references a CSS file in the web/public/themes/ directory.
+ // If not set, the default theme will be used.
+ string theme = 4 [(google.api.field_behavior) = OPTIONAL];
+ }
+
+ // 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];
+ }
+ }
+
+ // 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];
+ }
+ }
- // The preferred theme of the user.
- // This references a CSS file in the web/public/themes/ directory.
- // If not set, the default theme will be used.
- string theme = 5 [(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];
+ }
+ }
+
+ // 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];
+ }
+ }
}
message GetUserSettingRequest {
- // Required. The resource name of the user.
- // Format: users/{user}
+ // Required. The resource name of the user setting.
+ // Format: users/{user}/settings/{setting}
string name = 1 [
(google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "memos.api.v1/User"}
+ (google.api.resource_reference) = {type: "memos.api.v1/UserSetting"}
];
}
@@ -393,6 +541,39 @@ message UpdateUserSettingRequest {
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
}
+// Request message for ListUserSettings method.
+message ListUserSettingsRequest {
+ // Required. The parent resource whose settings will be listed.
+ // Format: users/{user}
+ string parent = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {type: "memos.api.v1/User"}
+ ];
+
+ // Optional. The maximum number of settings to return.
+ // The service may return fewer than this value.
+ // If unspecified, at most 50 settings will be returned.
+ // The maximum value is 1000; values above 1000 will be coerced to 1000.
+ int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
+
+ // Optional. A page token, received from a previous `ListUserSettings` call.
+ // Provide this to retrieve the subsequent page.
+ string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
+}
+
+// Response message for ListUserSettings method.
+message ListUserSettingsResponse {
+ // The list of user settings.
+ repeated UserSetting settings = 1;
+
+ // A token that can be sent as `page_token` to retrieve the next page.
+ // If this field is omitted, there are no subsequent pages.
+ string next_page_token = 2;
+
+ // The total count of settings (may be approximate).
+ int32 total_size = 3;
+}
+
// User access token message
message UserAccessToken {
option (google.api.resource) = {
@@ -526,29 +707,60 @@ message ListUserSessionsResponse {
}
message RevokeUserSessionRequest {
- // Required. The resource name of the session to revoke.
+ // The name of the session to revoke.
// Format: users/{user}/sessions/{session}
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "memos.api.v1/UserSession"}
- ];
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
}
-message ListAllUserStatsRequest {
- // Optional. The maximum number of user stats to return.
- int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
+// UserWebhook represents a webhook owned by a user.
+message UserWebhook {
+ // The name of the webhook.
+ // Format: users/{user}/webhooks/{webhook}
+ string name = 1;
- // Optional. A page token for pagination.
- string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
+ // The URL to send the webhook to.
+ string url = 2;
+
+ // Optional. Human-readable name for the webhook.
+ string display_name = 3;
+
+ // The creation time of the webhook.
+ google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ // The last update time of the webhook.
+ google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}
-message ListAllUserStatsResponse {
- // The list of user statistics.
- repeated UserStats user_stats = 1;
+message ListUserWebhooksRequest {
+ // The parent user resource.
+ // Format: users/{user}
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
+}
- // A token for the next page of results.
- string next_page_token = 2;
+message ListUserWebhooksResponse {
+ // The list of webhooks.
+ repeated UserWebhook webhooks = 1;
+}
- // The total count of user statistics.
- int32 total_size = 3;
+message CreateUserWebhookRequest {
+ // The parent user resource.
+ // Format: users/{user}
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // The webhook to create.
+ UserWebhook webhook = 2 [(google.api.field_behavior) = REQUIRED];
+}
+
+message UpdateUserWebhookRequest {
+ // The webhook to update.
+ UserWebhook webhook = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // The list of fields to update.
+ google.protobuf.FieldMask update_mask = 2;
+}
+
+message DeleteUserWebhookRequest {
+ // The name of the webhook to delete.
+ // Format: users/{user}/webhooks/{webhook}
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
}
diff --git a/proto/api/v1/webhook_service.proto b/proto/api/v1/webhook_service.proto
deleted file mode 100644
index acbee62c1..000000000
--- a/proto/api/v1/webhook_service.proto
+++ /dev/null
@@ -1,124 +0,0 @@
-syntax = "proto3";
-
-package memos.api.v1;
-
-import "google/api/annotations.proto";
-import "google/api/client.proto";
-import "google/api/field_behavior.proto";
-import "google/api/resource.proto";
-import "google/protobuf/empty.proto";
-import "google/protobuf/field_mask.proto";
-
-option go_package = "gen/api/v1";
-
-service WebhookService {
- // ListWebhooks returns a list of webhooks for a user.
- rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) {
- option (google.api.http) = {get: "/api/v1/{parent=users/*}/webhooks"};
- option (google.api.method_signature) = "parent";
- }
-
- // GetWebhook gets a webhook by name.
- rpc GetWebhook(GetWebhookRequest) returns (Webhook) {
- option (google.api.http) = {get: "/api/v1/{name=users/*/webhooks/*}"};
- option (google.api.method_signature) = "name";
- }
-
- // CreateWebhook creates a new webhook for a user.
- rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
- option (google.api.http) = {
- post: "/api/v1/{parent=users/*}/webhooks"
- body: "webhook"
- };
- option (google.api.method_signature) = "parent,webhook";
- }
-
- // UpdateWebhook updates a webhook for a user.
- rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) {
- option (google.api.http) = {
- patch: "/api/v1/{webhook.name=users/*/webhooks/*}"
- body: "webhook"
- };
- option (google.api.method_signature) = "webhook,update_mask";
- }
-
- // DeleteWebhook deletes a webhook for a user.
- rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {delete: "/api/v1/{name=users/*/webhooks/*}"};
- option (google.api.method_signature) = "name";
- }
-}
-
-message Webhook {
- option (google.api.resource) = {
- type: "memos.api.v1/Webhook"
- pattern: "users/{user}/webhooks/{webhook}"
- singular: "webhook"
- plural: "webhooks"
- };
-
- // The resource name of the webhook.
- // Format: users/{user}/webhooks/{webhook}
- string name = 1 [(google.api.field_behavior) = IDENTIFIER];
-
- // The display name of the webhook.
- string display_name = 2 [(google.api.field_behavior) = REQUIRED];
-
- // The target URL for the webhook.
- string url = 3 [(google.api.field_behavior) = REQUIRED];
-}
-
-message ListWebhooksRequest {
- // Required. The parent resource where webhooks are listed.
- // Format: users/{user}
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {child_type: "memos.api.v1/Webhook"}
- ];
-}
-
-message ListWebhooksResponse {
- // The list of webhooks.
- repeated Webhook webhooks = 1;
-}
-
-message GetWebhookRequest {
- // Required. The resource name of the webhook to retrieve.
- // Format: users/{user}/webhooks/{webhook}
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "memos.api.v1/Webhook"}
- ];
-}
-
-message CreateWebhookRequest {
- // Required. The parent resource where this webhook will be created.
- // Format: users/{user}
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {child_type: "memos.api.v1/Webhook"}
- ];
-
- // Required. The webhook to create.
- Webhook webhook = 2 [(google.api.field_behavior) = REQUIRED];
-
- // Optional. If set, validate the request, but do not actually create the webhook.
- bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
-}
-
-message UpdateWebhookRequest {
- // Required. The webhook resource which replaces the resource on the server.
- Webhook webhook = 1 [(google.api.field_behavior) = REQUIRED];
-
- // Optional. The list of fields to update.
- google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
-}
-
-message DeleteWebhookRequest {
- // Required. The resource name of the webhook to delete.
- // Format: users/{user}/webhooks/{webhook}
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type: "memos.api.v1/Webhook"}
- ];
-}
diff --git a/proto/gen/api/v1/user_service.pb.go b/proto/gen/api/v1/user_service.pb.go
index 5bf6833bd..94ac6f965 100644
--- a/proto/gen/api/v1/user_service.pb.go
+++ b/proto/gen/api/v1/user_service.pb.go
@@ -83,6 +83,70 @@ func (User_Role) EnumDescriptor() ([]byte, []int) {
return file_api_v1_user_service_proto_rawDescGZIP(), []int{0, 0}
}
+// Enumeration of user setting keys.
+type UserSetting_Key int32
+
+const (
+ UserSetting_KEY_UNSPECIFIED UserSetting_Key = 0
+ // GENERAL is the key for general user settings.
+ UserSetting_GENERAL UserSetting_Key = 1
+ // SESSIONS is the key for user authentication sessions.
+ 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
+)
+
+// Enum value maps for UserSetting_Key.
+var (
+ UserSetting_Key_name = map[int32]string{
+ 0: "KEY_UNSPECIFIED",
+ 1: "GENERAL",
+ 2: "SESSIONS",
+ 3: "ACCESS_TOKENS",
+ 4: "SHORTCUTS",
+ 5: "WEBHOOKS",
+ }
+ UserSetting_Key_value = map[string]int32{
+ "KEY_UNSPECIFIED": 0,
+ "GENERAL": 1,
+ "SESSIONS": 2,
+ "ACCESS_TOKENS": 3,
+ "SHORTCUTS": 4,
+ "WEBHOOKS": 5,
+ }
+)
+
+func (x UserSetting_Key) Enum() *UserSetting_Key {
+ p := new(UserSetting_Key)
+ *p = x
+ return p
+}
+
+func (x UserSetting_Key) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (UserSetting_Key) Descriptor() protoreflect.EnumDescriptor {
+ return file_api_v1_user_service_proto_enumTypes[1].Descriptor()
+}
+
+func (UserSetting_Key) Type() protoreflect.EnumType {
+ return &file_api_v1_user_service_proto_enumTypes[1]
+}
+
+func (x UserSetting_Key) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use UserSetting_Key.Descriptor instead.
+func (UserSetting_Key) EnumDescriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 0}
+}
+
type User struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The resource name of the user.
@@ -931,29 +995,108 @@ func (x *GetUserStatsRequest) GetName() string {
return ""
}
+type ListAllUserStatsRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListAllUserStatsRequest) Reset() {
+ *x = ListAllUserStatsRequest{}
+ mi := &file_api_v1_user_service_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListAllUserStatsRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListAllUserStatsRequest) ProtoMessage() {}
+
+func (x *ListAllUserStatsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[12]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ListAllUserStatsRequest.ProtoReflect.Descriptor instead.
+func (*ListAllUserStatsRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{12}
+}
+
+type ListAllUserStatsResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The list of user statistics.
+ Stats []*UserStats `protobuf:"bytes,1,rep,name=stats,proto3" json:"stats,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListAllUserStatsResponse) Reset() {
+ *x = ListAllUserStatsResponse{}
+ mi := &file_api_v1_user_service_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListAllUserStatsResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListAllUserStatsResponse) ProtoMessage() {}
+
+func (x *ListAllUserStatsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[13]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ListAllUserStatsResponse.ProtoReflect.Descriptor instead.
+func (*ListAllUserStatsResponse) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *ListAllUserStatsResponse) GetStats() []*UserStats {
+ if x != nil {
+ return x.Stats
+ }
+ return nil
+}
+
// User settings message
type UserSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // The resource name of the user whose setting this is.
- // Format: users/{user}
+ // The name of the user setting.
+ // Format: users/{user}/settings/{setting}
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // The preferred locale of the user.
- Locale string `protobuf:"bytes,2,opt,name=locale,proto3" json:"locale,omitempty"`
- // The preferred appearance of the user.
- Appearance string `protobuf:"bytes,3,opt,name=appearance,proto3" json:"appearance,omitempty"`
- // The default visibility of the memo.
- MemoVisibility string `protobuf:"bytes,4,opt,name=memo_visibility,json=memoVisibility,proto3" json:"memo_visibility,omitempty"`
- // The preferred theme of the user.
- // This references a CSS file in the web/public/themes/ directory.
- // If not set, the default theme will be used.
- Theme string `protobuf:"bytes,5,opt,name=theme,proto3" json:"theme,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
sizeCache protoimpl.SizeCache
}
func (x *UserSetting) Reset() {
*x = UserSetting{}
- mi := &file_api_v1_user_service_proto_msgTypes[12]
+ mi := &file_api_v1_user_service_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -965,7 +1108,7 @@ func (x *UserSetting) String() string {
func (*UserSetting) ProtoMessage() {}
func (x *UserSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[12]
+ mi := &file_api_v1_user_service_proto_msgTypes[14]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -978,7 +1121,7 @@ func (x *UserSetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use UserSetting.ProtoReflect.Descriptor instead.
func (*UserSetting) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{12}
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{14}
}
func (x *UserSetting) GetName() string {
@@ -988,38 +1131,96 @@ func (x *UserSetting) GetName() string {
return ""
}
-func (x *UserSetting) GetLocale() string {
+func (x *UserSetting) GetValue() isUserSetting_Value {
if x != nil {
- return x.Locale
+ return x.Value
}
- return ""
+ return nil
}
-func (x *UserSetting) GetAppearance() string {
+func (x *UserSetting) GetGeneralSetting() *UserSetting_GeneralSetting {
if x != nil {
- return x.Appearance
+ if x, ok := x.Value.(*UserSetting_GeneralSetting_); ok {
+ return x.GeneralSetting
+ }
}
- return ""
+ return nil
}
-func (x *UserSetting) GetMemoVisibility() string {
+func (x *UserSetting) GetSessionsSetting() *UserSetting_SessionsSetting {
if x != nil {
- return x.MemoVisibility
+ if x, ok := x.Value.(*UserSetting_SessionsSetting_); ok {
+ return x.SessionsSetting
+ }
}
- return ""
+ return nil
}
-func (x *UserSetting) GetTheme() string {
+func (x *UserSetting) GetAccessTokensSetting() *UserSetting_AccessTokensSetting {
if x != nil {
- return x.Theme
+ if x, ok := x.Value.(*UserSetting_AccessTokensSetting_); ok {
+ return x.AccessTokensSetting
+ }
}
- return ""
+ 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 {
+ return x.WebhooksSetting
+ }
+ }
+ return nil
+}
+
+type isUserSetting_Value interface {
+ isUserSetting_Value()
}
+type UserSetting_GeneralSetting_ struct {
+ GeneralSetting *UserSetting_GeneralSetting `protobuf:"bytes,2,opt,name=general_setting,json=generalSetting,proto3,oneof"`
+}
+
+type UserSetting_SessionsSetting_ struct {
+ SessionsSetting *UserSetting_SessionsSetting `protobuf:"bytes,3,opt,name=sessions_setting,json=sessionsSetting,proto3,oneof"`
+}
+
+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"`
+}
+
+func (*UserSetting_GeneralSetting_) isUserSetting_Value() {}
+
+func (*UserSetting_SessionsSetting_) isUserSetting_Value() {}
+
+func (*UserSetting_AccessTokensSetting_) isUserSetting_Value() {}
+
+func (*UserSetting_ShortcutsSetting_) isUserSetting_Value() {}
+
+func (*UserSetting_WebhooksSetting_) isUserSetting_Value() {}
+
type GetUserSettingRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The resource name of the user.
- // Format: users/{user}
+ // Required. The resource name of the user setting.
+ // Format: users/{user}/settings/{setting}
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -1027,7 +1228,7 @@ type GetUserSettingRequest struct {
func (x *GetUserSettingRequest) Reset() {
*x = GetUserSettingRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[13]
+ mi := &file_api_v1_user_service_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1039,7 +1240,7 @@ func (x *GetUserSettingRequest) String() string {
func (*GetUserSettingRequest) ProtoMessage() {}
func (x *GetUserSettingRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[13]
+ mi := &file_api_v1_user_service_proto_msgTypes[15]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1052,7 +1253,7 @@ func (x *GetUserSettingRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetUserSettingRequest.ProtoReflect.Descriptor instead.
func (*GetUserSettingRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{13}
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{15}
}
func (x *GetUserSettingRequest) GetName() string {
@@ -1074,7 +1275,7 @@ type UpdateUserSettingRequest struct {
func (x *UpdateUserSettingRequest) Reset() {
*x = UpdateUserSettingRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[14]
+ mi := &file_api_v1_user_service_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1086,7 +1287,7 @@ func (x *UpdateUserSettingRequest) String() string {
func (*UpdateUserSettingRequest) ProtoMessage() {}
func (x *UpdateUserSettingRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[14]
+ mi := &file_api_v1_user_service_proto_msgTypes[16]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1099,7 +1300,7 @@ func (x *UpdateUserSettingRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateUserSettingRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserSettingRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{14}
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{16}
}
func (x *UpdateUserSettingRequest) GetSetting() *UserSetting {
@@ -1116,39 +1317,39 @@ func (x *UpdateUserSettingRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
return nil
}
-// User access token message
-type UserAccessToken struct {
+// Request message for ListUserSettings method.
+type ListUserSettingsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // The resource name of the access token.
- // Format: users/{user}/accessTokens/{access_token}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // Output only. The access token value.
- AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
- // The description of the access token.
- Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
- // Output only. The issued timestamp.
- IssuedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=issued_at,json=issuedAt,proto3" json:"issued_at,omitempty"`
- // Optional. The expiration timestamp.
- ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"`
+ // Required. The parent resource whose settings will be listed.
+ // Format: users/{user}
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ // Optional. The maximum number of settings to return.
+ // The service may return fewer than this value.
+ // If unspecified, at most 50 settings will be returned.
+ // The maximum value is 1000; values above 1000 will be coerced to 1000.
+ PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+ // Optional. A page token, received from a previous `ListUserSettings` call.
+ // Provide this to retrieve the subsequent page.
+ PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
-func (x *UserAccessToken) Reset() {
- *x = UserAccessToken{}
- mi := &file_api_v1_user_service_proto_msgTypes[15]
+func (x *ListUserSettingsRequest) Reset() {
+ *x = ListUserSettingsRequest{}
+ mi := &file_api_v1_user_service_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *UserAccessToken) String() string {
+func (x *ListUserSettingsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*UserAccessToken) ProtoMessage() {}
+func (*ListUserSettingsRequest) ProtoMessage() {}
-func (x *UserAccessToken) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[15]
+func (x *ListUserSettingsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1159,74 +1360,61 @@ func (x *UserAccessToken) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use UserAccessToken.ProtoReflect.Descriptor instead.
-func (*UserAccessToken) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{15}
+// Deprecated: Use ListUserSettingsRequest.ProtoReflect.Descriptor instead.
+func (*ListUserSettingsRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{17}
}
-func (x *UserAccessToken) GetName() string {
+func (x *ListUserSettingsRequest) GetParent() string {
if x != nil {
- return x.Name
+ return x.Parent
}
return ""
}
-func (x *UserAccessToken) GetAccessToken() string {
+func (x *ListUserSettingsRequest) GetPageSize() int32 {
if x != nil {
- return x.AccessToken
+ return x.PageSize
}
- return ""
+ return 0
}
-func (x *UserAccessToken) GetDescription() string {
+func (x *ListUserSettingsRequest) GetPageToken() string {
if x != nil {
- return x.Description
+ return x.PageToken
}
return ""
}
-func (x *UserAccessToken) GetIssuedAt() *timestamppb.Timestamp {
- if x != nil {
- return x.IssuedAt
- }
- return nil
-}
-
-func (x *UserAccessToken) GetExpiresAt() *timestamppb.Timestamp {
- if x != nil {
- return x.ExpiresAt
- }
- return nil
-}
-
-type ListUserAccessTokensRequest struct {
+// Response message for ListUserSettings method.
+type ListUserSettingsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The parent resource whose access tokens will be listed.
- // Format: users/{user}
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- // Optional. The maximum number of access tokens to return.
- PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
- // Optional. A page token for pagination.
- PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
+ // The list of user settings.
+ Settings []*UserSetting `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty"`
+ // A token that can be sent as `page_token` to retrieve the next page.
+ // If this field is omitted, there are no subsequent pages.
+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
+ // The total count of settings (may be approximate).
+ TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
-func (x *ListUserAccessTokensRequest) Reset() {
- *x = ListUserAccessTokensRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[16]
+func (x *ListUserSettingsResponse) Reset() {
+ *x = ListUserSettingsResponse{}
+ mi := &file_api_v1_user_service_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *ListUserAccessTokensRequest) String() string {
+func (x *ListUserSettingsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*ListUserAccessTokensRequest) ProtoMessage() {}
+func (*ListUserSettingsResponse) ProtoMessage() {}
-func (x *ListUserAccessTokensRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[16]
+func (x *ListUserSettingsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1237,9 +1425,156 @@ func (x *ListUserAccessTokensRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use ListUserAccessTokensRequest.ProtoReflect.Descriptor instead.
-func (*ListUserAccessTokensRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{16}
+// Deprecated: Use ListUserSettingsResponse.ProtoReflect.Descriptor instead.
+func (*ListUserSettingsResponse) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{18}
+}
+
+func (x *ListUserSettingsResponse) GetSettings() []*UserSetting {
+ if x != nil {
+ return x.Settings
+ }
+ return nil
+}
+
+func (x *ListUserSettingsResponse) GetNextPageToken() string {
+ if x != nil {
+ return x.NextPageToken
+ }
+ return ""
+}
+
+func (x *ListUserSettingsResponse) GetTotalSize() int32 {
+ if x != nil {
+ return x.TotalSize
+ }
+ return 0
+}
+
+// User access token message
+type UserAccessToken struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The resource name of the access token.
+ // Format: users/{user}/accessTokens/{access_token}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Output only. The access token value.
+ AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
+ // The description of the access token.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // Output only. The issued timestamp.
+ IssuedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=issued_at,json=issuedAt,proto3" json:"issued_at,omitempty"`
+ // Optional. The expiration timestamp.
+ ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UserAccessToken) Reset() {
+ *x = UserAccessToken{}
+ mi := &file_api_v1_user_service_proto_msgTypes[19]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UserAccessToken) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserAccessToken) ProtoMessage() {}
+
+func (x *UserAccessToken) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[19]
+ 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 UserAccessToken.ProtoReflect.Descriptor instead.
+func (*UserAccessToken) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{19}
+}
+
+func (x *UserAccessToken) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *UserAccessToken) GetAccessToken() string {
+ if x != nil {
+ return x.AccessToken
+ }
+ return ""
+}
+
+func (x *UserAccessToken) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *UserAccessToken) GetIssuedAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.IssuedAt
+ }
+ return nil
+}
+
+func (x *UserAccessToken) GetExpiresAt() *timestamppb.Timestamp {
+ if x != nil {
+ return x.ExpiresAt
+ }
+ return nil
+}
+
+type ListUserAccessTokensRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Required. The parent resource whose access tokens will be listed.
+ // Format: users/{user}
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ // Optional. The maximum number of access tokens to return.
+ PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+ // Optional. A page token for pagination.
+ PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListUserAccessTokensRequest) Reset() {
+ *x = ListUserAccessTokensRequest{}
+ mi := &file_api_v1_user_service_proto_msgTypes[20]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListUserAccessTokensRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListUserAccessTokensRequest) ProtoMessage() {}
+
+func (x *ListUserAccessTokensRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[20]
+ 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 ListUserAccessTokensRequest.ProtoReflect.Descriptor instead.
+func (*ListUserAccessTokensRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{20}
}
func (x *ListUserAccessTokensRequest) GetParent() string {
@@ -1277,7 +1612,7 @@ type ListUserAccessTokensResponse struct {
func (x *ListUserAccessTokensResponse) Reset() {
*x = ListUserAccessTokensResponse{}
- mi := &file_api_v1_user_service_proto_msgTypes[17]
+ mi := &file_api_v1_user_service_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1289,7 +1624,7 @@ func (x *ListUserAccessTokensResponse) String() string {
func (*ListUserAccessTokensResponse) ProtoMessage() {}
func (x *ListUserAccessTokensResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[17]
+ mi := &file_api_v1_user_service_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1302,7 +1637,7 @@ func (x *ListUserAccessTokensResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListUserAccessTokensResponse.ProtoReflect.Descriptor instead.
func (*ListUserAccessTokensResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{17}
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{21}
}
func (x *ListUserAccessTokensResponse) GetAccessTokens() []*UserAccessToken {
@@ -1341,7 +1676,7 @@ type CreateUserAccessTokenRequest struct {
func (x *CreateUserAccessTokenRequest) Reset() {
*x = CreateUserAccessTokenRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[18]
+ mi := &file_api_v1_user_service_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1353,7 +1688,7 @@ func (x *CreateUserAccessTokenRequest) String() string {
func (*CreateUserAccessTokenRequest) ProtoMessage() {}
func (x *CreateUserAccessTokenRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[18]
+ mi := &file_api_v1_user_service_proto_msgTypes[22]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1366,7 +1701,7 @@ func (x *CreateUserAccessTokenRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateUserAccessTokenRequest.ProtoReflect.Descriptor instead.
func (*CreateUserAccessTokenRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{18}
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{22}
}
func (x *CreateUserAccessTokenRequest) GetParent() string {
@@ -1401,7 +1736,7 @@ type DeleteUserAccessTokenRequest struct {
func (x *DeleteUserAccessTokenRequest) Reset() {
*x = DeleteUserAccessTokenRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[19]
+ mi := &file_api_v1_user_service_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1413,7 +1748,7 @@ func (x *DeleteUserAccessTokenRequest) String() string {
func (*DeleteUserAccessTokenRequest) ProtoMessage() {}
func (x *DeleteUserAccessTokenRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[19]
+ mi := &file_api_v1_user_service_proto_msgTypes[23]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1426,7 +1761,7 @@ func (x *DeleteUserAccessTokenRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteUserAccessTokenRequest.ProtoReflect.Descriptor instead.
func (*DeleteUserAccessTokenRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{19}
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{23}
}
func (x *DeleteUserAccessTokenRequest) GetName() string {
@@ -1454,21 +1789,751 @@ type UserSession struct {
sizeCache protoimpl.SizeCache
}
-func (x *UserSession) Reset() {
- *x = UserSession{}
- mi := &file_api_v1_user_service_proto_msgTypes[20]
+func (x *UserSession) Reset() {
+ *x = UserSession{}
+ mi := &file_api_v1_user_service_proto_msgTypes[24]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UserSession) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserSession) ProtoMessage() {}
+
+func (x *UserSession) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[24]
+ 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 UserSession.ProtoReflect.Descriptor instead.
+func (*UserSession) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{24}
+}
+
+func (x *UserSession) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *UserSession) GetSessionId() string {
+ if x != nil {
+ return x.SessionId
+ }
+ return ""
+}
+
+func (x *UserSession) GetCreateTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreateTime
+ }
+ return nil
+}
+
+func (x *UserSession) GetLastAccessedTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.LastAccessedTime
+ }
+ return nil
+}
+
+func (x *UserSession) GetClientInfo() *UserSession_ClientInfo {
+ if x != nil {
+ return x.ClientInfo
+ }
+ return nil
+}
+
+type ListUserSessionsRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Required. The resource name of the parent.
+ // Format: users/{user}
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListUserSessionsRequest) Reset() {
+ *x = ListUserSessionsRequest{}
+ mi := &file_api_v1_user_service_proto_msgTypes[25]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListUserSessionsRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListUserSessionsRequest) ProtoMessage() {}
+
+func (x *ListUserSessionsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[25]
+ 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 ListUserSessionsRequest.ProtoReflect.Descriptor instead.
+func (*ListUserSessionsRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{25}
+}
+
+func (x *ListUserSessionsRequest) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+type ListUserSessionsResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The list of user sessions.
+ Sessions []*UserSession `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListUserSessionsResponse) Reset() {
+ *x = ListUserSessionsResponse{}
+ mi := &file_api_v1_user_service_proto_msgTypes[26]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListUserSessionsResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListUserSessionsResponse) ProtoMessage() {}
+
+func (x *ListUserSessionsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[26]
+ 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 ListUserSessionsResponse.ProtoReflect.Descriptor instead.
+func (*ListUserSessionsResponse) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{26}
+}
+
+func (x *ListUserSessionsResponse) GetSessions() []*UserSession {
+ if x != nil {
+ return x.Sessions
+ }
+ return nil
+}
+
+type RevokeUserSessionRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The name of the session to revoke.
+ // Format: users/{user}/sessions/{session}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *RevokeUserSessionRequest) Reset() {
+ *x = RevokeUserSessionRequest{}
+ mi := &file_api_v1_user_service_proto_msgTypes[27]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *RevokeUserSessionRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RevokeUserSessionRequest) ProtoMessage() {}
+
+func (x *RevokeUserSessionRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[27]
+ 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 RevokeUserSessionRequest.ProtoReflect.Descriptor instead.
+func (*RevokeUserSessionRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{27}
+}
+
+func (x *RevokeUserSessionRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+// UserWebhook represents a webhook owned by a user.
+type UserWebhook struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The name of the webhook.
+ // Format: users/{user}/webhooks/{webhook}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // The URL to send the webhook to.
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ // Optional. Human-readable name for the webhook.
+ DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
+ // The creation time of the webhook.
+ CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
+ // The last update time of the webhook.
+ UpdateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UserWebhook) Reset() {
+ *x = UserWebhook{}
+ mi := &file_api_v1_user_service_proto_msgTypes[28]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UserWebhook) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserWebhook) ProtoMessage() {}
+
+func (x *UserWebhook) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[28]
+ 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 UserWebhook.ProtoReflect.Descriptor instead.
+func (*UserWebhook) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{28}
+}
+
+func (x *UserWebhook) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *UserWebhook) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *UserWebhook) GetDisplayName() string {
+ if x != nil {
+ return x.DisplayName
+ }
+ return ""
+}
+
+func (x *UserWebhook) GetCreateTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreateTime
+ }
+ return nil
+}
+
+func (x *UserWebhook) GetUpdateTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdateTime
+ }
+ return nil
+}
+
+type ListUserWebhooksRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The parent user resource.
+ // Format: users/{user}
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListUserWebhooksRequest) Reset() {
+ *x = ListUserWebhooksRequest{}
+ mi := &file_api_v1_user_service_proto_msgTypes[29]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListUserWebhooksRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListUserWebhooksRequest) ProtoMessage() {}
+
+func (x *ListUserWebhooksRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[29]
+ 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 ListUserWebhooksRequest.ProtoReflect.Descriptor instead.
+func (*ListUserWebhooksRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{29}
+}
+
+func (x *ListUserWebhooksRequest) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+type ListUserWebhooksResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The list of webhooks.
+ Webhooks []*UserWebhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListUserWebhooksResponse) Reset() {
+ *x = ListUserWebhooksResponse{}
+ mi := &file_api_v1_user_service_proto_msgTypes[30]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListUserWebhooksResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListUserWebhooksResponse) ProtoMessage() {}
+
+func (x *ListUserWebhooksResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[30]
+ 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 ListUserWebhooksResponse.ProtoReflect.Descriptor instead.
+func (*ListUserWebhooksResponse) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{30}
+}
+
+func (x *ListUserWebhooksResponse) GetWebhooks() []*UserWebhook {
+ if x != nil {
+ return x.Webhooks
+ }
+ return nil
+}
+
+type CreateUserWebhookRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The parent user resource.
+ // Format: users/{user}
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ // The webhook to create.
+ Webhook *UserWebhook `protobuf:"bytes,2,opt,name=webhook,proto3" json:"webhook,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *CreateUserWebhookRequest) Reset() {
+ *x = CreateUserWebhookRequest{}
+ mi := &file_api_v1_user_service_proto_msgTypes[31]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *CreateUserWebhookRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateUserWebhookRequest) ProtoMessage() {}
+
+func (x *CreateUserWebhookRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[31]
+ 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 CreateUserWebhookRequest.ProtoReflect.Descriptor instead.
+func (*CreateUserWebhookRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{31}
+}
+
+func (x *CreateUserWebhookRequest) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+func (x *CreateUserWebhookRequest) GetWebhook() *UserWebhook {
+ if x != nil {
+ return x.Webhook
+ }
+ return nil
+}
+
+type UpdateUserWebhookRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The webhook to update.
+ Webhook *UserWebhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"`
+ // The list of fields to update.
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UpdateUserWebhookRequest) Reset() {
+ *x = UpdateUserWebhookRequest{}
+ mi := &file_api_v1_user_service_proto_msgTypes[32]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UpdateUserWebhookRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateUserWebhookRequest) ProtoMessage() {}
+
+func (x *UpdateUserWebhookRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[32]
+ 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 UpdateUserWebhookRequest.ProtoReflect.Descriptor instead.
+func (*UpdateUserWebhookRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{32}
+}
+
+func (x *UpdateUserWebhookRequest) GetWebhook() *UserWebhook {
+ if x != nil {
+ return x.Webhook
+ }
+ return nil
+}
+
+func (x *UpdateUserWebhookRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+type DeleteUserWebhookRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The name of the webhook to delete.
+ // Format: users/{user}/webhooks/{webhook}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *DeleteUserWebhookRequest) Reset() {
+ *x = DeleteUserWebhookRequest{}
+ mi := &file_api_v1_user_service_proto_msgTypes[33]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *DeleteUserWebhookRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteUserWebhookRequest) ProtoMessage() {}
+
+func (x *DeleteUserWebhookRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[33]
+ 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 DeleteUserWebhookRequest.ProtoReflect.Descriptor instead.
+func (*DeleteUserWebhookRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{33}
+}
+
+func (x *DeleteUserWebhookRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+// Memo type statistics.
+type UserStats_MemoTypeStats struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ LinkCount int32 `protobuf:"varint,1,opt,name=link_count,json=linkCount,proto3" json:"link_count,omitempty"`
+ CodeCount int32 `protobuf:"varint,2,opt,name=code_count,json=codeCount,proto3" json:"code_count,omitempty"`
+ TodoCount int32 `protobuf:"varint,3,opt,name=todo_count,json=todoCount,proto3" json:"todo_count,omitempty"`
+ UndoCount int32 `protobuf:"varint,4,opt,name=undo_count,json=undoCount,proto3" json:"undo_count,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UserStats_MemoTypeStats) Reset() {
+ *x = UserStats_MemoTypeStats{}
+ mi := &file_api_v1_user_service_proto_msgTypes[35]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UserStats_MemoTypeStats) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserStats_MemoTypeStats) ProtoMessage() {}
+
+func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[35]
+ 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 UserStats_MemoTypeStats.ProtoReflect.Descriptor instead.
+func (*UserStats_MemoTypeStats) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{10, 1}
+}
+
+func (x *UserStats_MemoTypeStats) GetLinkCount() int32 {
+ if x != nil {
+ return x.LinkCount
+ }
+ return 0
+}
+
+func (x *UserStats_MemoTypeStats) GetCodeCount() int32 {
+ if x != nil {
+ return x.CodeCount
+ }
+ return 0
+}
+
+func (x *UserStats_MemoTypeStats) GetTodoCount() int32 {
+ if x != nil {
+ return x.TodoCount
+ }
+ return 0
+}
+
+func (x *UserStats_MemoTypeStats) GetUndoCount() int32 {
+ if x != nil {
+ return x.UndoCount
+ }
+ return 0
+}
+
+// General user settings configuration.
+type UserSetting_GeneralSetting struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The preferred locale of the user.
+ Locale string `protobuf:"bytes,1,opt,name=locale,proto3" json:"locale,omitempty"`
+ // The preferred appearance of the user.
+ Appearance string `protobuf:"bytes,2,opt,name=appearance,proto3" json:"appearance,omitempty"`
+ // The default visibility of the memo.
+ MemoVisibility string `protobuf:"bytes,3,opt,name=memo_visibility,json=memoVisibility,proto3" json:"memo_visibility,omitempty"`
+ // The preferred theme of the user.
+ // This references a CSS file in the web/public/themes/ directory.
+ // If not set, the default theme will be used.
+ Theme string `protobuf:"bytes,4,opt,name=theme,proto3" json:"theme,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UserSetting_GeneralSetting) Reset() {
+ *x = UserSetting_GeneralSetting{}
+ mi := &file_api_v1_user_service_proto_msgTypes[36]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UserSetting_GeneralSetting) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserSetting_GeneralSetting) ProtoMessage() {}
+
+func (x *UserSetting_GeneralSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[36]
+ 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_GeneralSetting.ProtoReflect.Descriptor instead.
+func (*UserSetting_GeneralSetting) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 0}
+}
+
+func (x *UserSetting_GeneralSetting) GetLocale() string {
+ if x != nil {
+ return x.Locale
+ }
+ return ""
+}
+
+func (x *UserSetting_GeneralSetting) GetAppearance() string {
+ if x != nil {
+ return x.Appearance
+ }
+ return ""
+}
+
+func (x *UserSetting_GeneralSetting) GetMemoVisibility() string {
+ if x != nil {
+ return x.MemoVisibility
+ }
+ return ""
+}
+
+func (x *UserSetting_GeneralSetting) GetTheme() string {
+ if x != nil {
+ return x.Theme
+ }
+ return ""
+}
+
+// User authentication sessions configuration.
+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"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UserSetting_SessionsSetting) Reset() {
+ *x = UserSetting_SessionsSetting{}
+ mi := &file_api_v1_user_service_proto_msgTypes[37]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UserSetting_SessionsSetting) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserSetting_SessionsSetting) ProtoMessage() {}
+
+func (x *UserSetting_SessionsSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[37]
+ 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.ProtoReflect.Descriptor instead.
+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 {
+ if x != nil {
+ return x.Sessions
+ }
+ return nil
+}
+
+// User access tokens configuration.
+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"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UserSetting_AccessTokensSetting) Reset() {
+ *x = UserSetting_AccessTokensSetting{}
+ mi := &file_api_v1_user_service_proto_msgTypes[38]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *UserSession) String() string {
+func (x *UserSetting_AccessTokensSetting) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*UserSession) ProtoMessage() {}
+func (*UserSetting_AccessTokensSetting) ProtoMessage() {}
-func (x *UserSession) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[20]
+func (x *UserSetting_AccessTokensSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[38]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1479,70 +2544,88 @@ func (x *UserSession) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use UserSession.ProtoReflect.Descriptor instead.
-func (*UserSession) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{20}
+// Deprecated: Use UserSetting_AccessTokensSetting.ProtoReflect.Descriptor instead.
+func (*UserSetting_AccessTokensSetting) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 2}
}
-func (x *UserSession) GetName() string {
+func (x *UserSetting_AccessTokensSetting) GetAccessTokens() []*UserSetting_AccessTokensSetting_AccessToken {
if x != nil {
- return x.Name
+ return x.AccessTokens
}
- return ""
+ return nil
}
-func (x *UserSession) GetSessionId() string {
- if x != nil {
- return x.SessionId
- }
- return ""
+// 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 *UserSession) GetCreateTime() *timestamppb.Timestamp {
- if x != nil {
- return x.CreateTime
- }
- return nil
+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 *UserSession) GetLastAccessedTime() *timestamppb.Timestamp {
+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 {
- return x.LastAccessedTime
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
}
- return nil
+ return mi.MessageOf(x)
}
-func (x *UserSession) GetClientInfo() *UserSession_ClientInfo {
+// 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.ClientInfo
+ return x.Shortcuts
}
return nil
}
-type ListUserSessionsRequest struct {
+// User webhooks configuration.
+type UserSetting_WebhooksSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The resource name of the parent.
- // Format: users/{user}
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ // List of user webhooks.
+ Webhooks []*UserSetting_WebhooksSetting_Webhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
-func (x *ListUserSessionsRequest) Reset() {
- *x = ListUserSessionsRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[21]
+func (x *UserSetting_WebhooksSetting) Reset() {
+ *x = UserSetting_WebhooksSetting{}
+ mi := &file_api_v1_user_service_proto_msgTypes[40]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *ListUserSessionsRequest) String() string {
+func (x *UserSetting_WebhooksSetting) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*ListUserSessionsRequest) ProtoMessage() {}
+func (*UserSetting_WebhooksSetting) ProtoMessage() {}
-func (x *ListUserSessionsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[21]
+func (x *UserSetting_WebhooksSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_user_service_proto_msgTypes[40]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1553,41 +2636,49 @@ func (x *ListUserSessionsRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use ListUserSessionsRequest.ProtoReflect.Descriptor instead.
-func (*ListUserSessionsRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{21}
+// Deprecated: Use UserSetting_WebhooksSetting.ProtoReflect.Descriptor instead.
+func (*UserSetting_WebhooksSetting) Descriptor() ([]byte, []int) {
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{14, 4}
}
-func (x *ListUserSessionsRequest) GetParent() string {
+func (x *UserSetting_WebhooksSetting) GetWebhooks() []*UserSetting_WebhooksSetting_Webhook {
if x != nil {
- return x.Parent
+ return x.Webhooks
}
- return ""
+ return nil
}
-type ListUserSessionsResponse struct {
+// User session information.
+type UserSetting_SessionsSetting_Session struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // The list of user sessions.
- Sessions []*UserSession `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"`
+ // 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 *ListUserSessionsResponse) Reset() {
- *x = ListUserSessionsResponse{}
- mi := &file_api_v1_user_service_proto_msgTypes[22]
+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 *ListUserSessionsResponse) String() string {
+func (x *UserSetting_SessionsSetting_Session) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*ListUserSessionsResponse) ProtoMessage() {}
+func (*UserSetting_SessionsSetting_Session) ProtoMessage() {}
-func (x *ListUserSessionsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[22]
+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 {
@@ -1598,42 +2689,71 @@ func (x *ListUserSessionsResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use ListUserSessionsResponse.ProtoReflect.Descriptor instead.
-func (*ListUserSessionsResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{22}
+// 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 *ListUserSessionsResponse) GetSessions() []*UserSession {
+func (x *UserSetting_SessionsSetting_Session) GetSessionId() string {
if x != nil {
- return x.Sessions
+ return x.SessionId
+ }
+ return ""
+}
+
+func (x *UserSetting_SessionsSetting_Session) GetCreateTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreateTime
}
return nil
}
-type RevokeUserSessionRequest struct {
+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"`
- // Required. The resource name of the session to revoke.
- // Format: users/{user}/sessions/{session}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // 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 *RevokeUserSessionRequest) Reset() {
- *x = RevokeUserSessionRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[23]
+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 *RevokeUserSessionRequest) String() string {
+func (x *UserSetting_SessionsSetting_ClientInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*RevokeUserSessionRequest) ProtoMessage() {}
+func (*UserSetting_SessionsSetting_ClientInfo) ProtoMessage() {}
-func (x *RevokeUserSessionRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[23]
+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 {
@@ -1644,43 +2764,73 @@ func (x *RevokeUserSessionRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use RevokeUserSessionRequest.ProtoReflect.Descriptor instead.
-func (*RevokeUserSessionRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{23}
+// 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 *RevokeUserSessionRequest) GetName() string {
+func (x *UserSetting_SessionsSetting_ClientInfo) GetUserAgent() string {
if x != nil {
- return x.Name
+ return x.UserAgent
}
return ""
}
-type ListAllUserStatsRequest struct {
+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"`
- // Optional. The maximum number of user stats to return.
- PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
- // Optional. A page token for pagination.
- PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
+ // 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 *ListAllUserStatsRequest) Reset() {
- *x = ListAllUserStatsRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[24]
+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 *ListAllUserStatsRequest) String() string {
+func (x *UserSetting_AccessTokensSetting_AccessToken) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*ListAllUserStatsRequest) ProtoMessage() {}
+func (*UserSetting_AccessTokensSetting_AccessToken) ProtoMessage() {}
-func (x *ListAllUserStatsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[24]
+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 {
@@ -1691,52 +2841,53 @@ func (x *ListAllUserStatsRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use ListAllUserStatsRequest.ProtoReflect.Descriptor instead.
-func (*ListAllUserStatsRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{24}
+// 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 *ListAllUserStatsRequest) GetPageSize() int32 {
+func (x *UserSetting_AccessTokensSetting_AccessToken) GetAccessToken() string {
if x != nil {
- return x.PageSize
+ return x.AccessToken
}
- return 0
+ return ""
}
-func (x *ListAllUserStatsRequest) GetPageToken() string {
+func (x *UserSetting_AccessTokensSetting_AccessToken) GetDescription() string {
if x != nil {
- return x.PageToken
+ return x.Description
}
return ""
}
-type ListAllUserStatsResponse struct {
+// User shortcut definition.
+type UserSetting_ShortcutsSetting_Shortcut struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // The list of user statistics.
- UserStats []*UserStats `protobuf:"bytes,1,rep,name=user_stats,json=userStats,proto3" json:"user_stats,omitempty"`
- // A token for the next page of results.
- NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
- // The total count of user statistics.
- TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"`
+ // 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 *ListAllUserStatsResponse) Reset() {
- *x = ListAllUserStatsResponse{}
- mi := &file_api_v1_user_service_proto_msgTypes[25]
+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 *ListAllUserStatsResponse) String() string {
+func (x *UserSetting_ShortcutsSetting_Shortcut) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*ListAllUserStatsResponse) ProtoMessage() {}
+func (*UserSetting_ShortcutsSetting_Shortcut) ProtoMessage() {}
-func (x *ListAllUserStatsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[25]
+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 {
@@ -1747,58 +2898,60 @@ func (x *ListAllUserStatsResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use ListAllUserStatsResponse.ProtoReflect.Descriptor instead.
-func (*ListAllUserStatsResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{25}
+// 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 *ListAllUserStatsResponse) GetUserStats() []*UserStats {
+func (x *UserSetting_ShortcutsSetting_Shortcut) GetId() string {
if x != nil {
- return x.UserStats
+ return x.Id
}
- return nil
+ return ""
}
-func (x *ListAllUserStatsResponse) GetNextPageToken() string {
+func (x *UserSetting_ShortcutsSetting_Shortcut) GetTitle() string {
if x != nil {
- return x.NextPageToken
+ return x.Title
}
return ""
}
-func (x *ListAllUserStatsResponse) GetTotalSize() int32 {
+func (x *UserSetting_ShortcutsSetting_Shortcut) GetFilter() string {
if x != nil {
- return x.TotalSize
+ return x.Filter
}
- return 0
+ return ""
}
-// Memo type statistics.
-type UserStats_MemoTypeStats struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- LinkCount int32 `protobuf:"varint,1,opt,name=link_count,json=linkCount,proto3" json:"link_count,omitempty"`
- CodeCount int32 `protobuf:"varint,2,opt,name=code_count,json=codeCount,proto3" json:"code_count,omitempty"`
- TodoCount int32 `protobuf:"varint,3,opt,name=todo_count,json=todoCount,proto3" json:"todo_count,omitempty"`
- UndoCount int32 `protobuf:"varint,4,opt,name=undo_count,json=undoCount,proto3" json:"undo_count,omitempty"`
+// 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 *UserStats_MemoTypeStats) Reset() {
- *x = UserStats_MemoTypeStats{}
- mi := &file_api_v1_user_service_proto_msgTypes[27]
+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 *UserStats_MemoTypeStats) String() string {
+func (x *UserSetting_WebhooksSetting_Webhook) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*UserStats_MemoTypeStats) ProtoMessage() {}
+func (*UserSetting_WebhooksSetting_Webhook) ProtoMessage() {}
-func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[27]
+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 {
@@ -1809,37 +2962,30 @@ func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use UserStats_MemoTypeStats.ProtoReflect.Descriptor instead.
-func (*UserStats_MemoTypeStats) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{10, 1}
-}
-
-func (x *UserStats_MemoTypeStats) GetLinkCount() int32 {
- if x != nil {
- return x.LinkCount
- }
- return 0
+// 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 *UserStats_MemoTypeStats) GetCodeCount() int32 {
+func (x *UserSetting_WebhooksSetting_Webhook) GetId() string {
if x != nil {
- return x.CodeCount
+ return x.Id
}
- return 0
+ return ""
}
-func (x *UserStats_MemoTypeStats) GetTodoCount() int32 {
+func (x *UserSetting_WebhooksSetting_Webhook) GetTitle() string {
if x != nil {
- return x.TodoCount
+ return x.Title
}
- return 0
+ return ""
}
-func (x *UserStats_MemoTypeStats) GetUndoCount() int32 {
+func (x *UserSetting_WebhooksSetting_Webhook) GetUrl() string {
if x != nil {
- return x.UndoCount
+ return x.Url
}
- return 0
+ return ""
}
type UserSession_ClientInfo struct {
@@ -1860,7 +3006,7 @@ type UserSession_ClientInfo struct {
func (x *UserSession_ClientInfo) Reset() {
*x = UserSession_ClientInfo{}
- mi := &file_api_v1_user_service_proto_msgTypes[28]
+ mi := &file_api_v1_user_service_proto_msgTypes[46]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1872,7 +3018,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[28]
+ mi := &file_api_v1_user_service_proto_msgTypes[46]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1885,7 +3031,7 @@ func (x *UserSession_ClientInfo) ProtoReflect() protoreflect.Message {
// Deprecated: Use UserSession_ClientInfo.ProtoReflect.Descriptor instead.
func (*UserSession_ClientInfo) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{20, 0}
+ return file_api_v1_user_service_proto_rawDescGZIP(), []int{24, 0}
}
func (x *UserSession_ClientInfo) GetUserAgent() string {
@@ -2016,23 +3162,88 @@ const file_api_v1_user_service_proto_rawDesc = "" +
"\x16memos.api.v1/UserStats\x12\fusers/{user}*\tuserStats2\tuserStats\"D\n" +
"\x13GetUserStatsRequest\x12-\n" +
"\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" +
- "\x11memos.api.v1/UserR\x04name\"\xf9\x01\n" +
+ "\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" +
"\vUserSetting\x12\x17\n" +
- "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x1b\n" +
- "\x06locale\x18\x02 \x01(\tB\x03\xe0A\x01R\x06locale\x12#\n" +
+ "\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" +
+ "\x0eGeneralSetting\x12\x1b\n" +
+ "\x06locale\x18\x01 \x01(\tB\x03\xe0A\x01R\x06locale\x12#\n" +
"\n" +
- "appearance\x18\x03 \x01(\tB\x03\xe0A\x01R\n" +
+ "appearance\x18\x02 \x01(\tB\x03\xe0A\x01R\n" +
"appearance\x12,\n" +
- "\x0fmemo_visibility\x18\x04 \x01(\tB\x03\xe0A\x01R\x0ememoVisibility\x12\x19\n" +
- "\x05theme\x18\x05 \x01(\tB\x03\xe0A\x01R\x05theme:F\xeaAC\n" +
- "\x18memos.api.v1/UserSetting\x12\fusers/{user}*\fuserSettings2\vuserSetting\"F\n" +
- "\x15GetUserSettingRequest\x12-\n" +
- "\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" +
- "\x11memos.api.v1/UserR\x04name\"\x96\x01\n" +
+ "\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" +
+ "\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" +
+ "\x18memos.api.v1/UserSetting\x12\x1fusers/{user}/settings/{setting}*\fuserSettings2\vuserSettingB\a\n" +
+ "\x05value\"M\n" +
+ "\x15GetUserSettingRequest\x124\n" +
+ "\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" +
+ "\x18memos.api.v1/UserSettingR\x04name\"\x96\x01\n" +
"\x18UpdateUserSettingRequest\x128\n" +
"\asetting\x18\x01 \x01(\v2\x19.memos.api.v1.UserSettingB\x03\xe0A\x02R\asetting\x12@\n" +
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" +
- "updateMask\"\xe7\x02\n" +
+ "updateMask\"\x92\x01\n" +
+ "\x17ListUserSettingsRequest\x121\n" +
+ "\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" +
+ "\x11memos.api.v1/UserR\x06parent\x12 \n" +
+ "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" +
+ "\n" +
+ "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x98\x01\n" +
+ "\x18ListUserSettingsResponse\x125\n" +
+ "\bsettings\x18\x01 \x03(\v2\x19.memos.api.v1.UserSettingR\bsettings\x12&\n" +
+ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" +
+ "\n" +
+ "total_size\x18\x03 \x01(\x05R\ttotalSize\"\xe7\x02\n" +
"\x0fUserAccessToken\x12\x17\n" +
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12&\n" +
"\faccess_token\x18\x02 \x01(\tB\x03\xe0A\x03R\vaccessToken\x12%\n" +
@@ -2084,20 +3295,30 @@ const file_api_v1_user_service_proto_rawDesc = "" +
"\x06parent\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" +
"\x11memos.api.v1/UserR\x06parent\"Q\n" +
"\x18ListUserSessionsResponse\x125\n" +
- "\bsessions\x18\x01 \x03(\v2\x19.memos.api.v1.UserSessionR\bsessions\"P\n" +
- "\x18RevokeUserSessionRequest\x124\n" +
- "\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" +
- "\x18memos.api.v1/UserSessionR\x04name\"_\n" +
- "\x17ListAllUserStatsRequest\x12 \n" +
- "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" +
- "\n" +
- "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x99\x01\n" +
- "\x18ListAllUserStatsResponse\x126\n" +
- "\n" +
- "user_stats\x18\x01 \x03(\v2\x17.memos.api.v1.UserStatsR\tuserStats\x12&\n" +
- "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" +
- "\n" +
- "total_size\x18\x03 \x01(\x05R\ttotalSize2\xe2\x10\n" +
+ "\bsessions\x18\x01 \x03(\v2\x19.memos.api.v1.UserSessionR\bsessions\"3\n" +
+ "\x18RevokeUserSessionRequest\x12\x17\n" +
+ "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"\xda\x01\n" +
+ "\vUserWebhook\x12\x12\n" +
+ "\x04name\x18\x01 \x01(\tR\x04name\x12\x10\n" +
+ "\x03url\x18\x02 \x01(\tR\x03url\x12!\n" +
+ "\fdisplay_name\x18\x03 \x01(\tR\vdisplayName\x12@\n" +
+ "\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
+ "createTime\x12@\n" +
+ "\vupdate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
+ "updateTime\"6\n" +
+ "\x17ListUserWebhooksRequest\x12\x1b\n" +
+ "\x06parent\x18\x01 \x01(\tB\x03\xe0A\x02R\x06parent\"Q\n" +
+ "\x18ListUserWebhooksResponse\x125\n" +
+ "\bwebhooks\x18\x01 \x03(\v2\x19.memos.api.v1.UserWebhookR\bwebhooks\"q\n" +
+ "\x18CreateUserWebhookRequest\x12\x1b\n" +
+ "\x06parent\x18\x01 \x01(\tB\x03\xe0A\x02R\x06parent\x128\n" +
+ "\awebhook\x18\x02 \x01(\v2\x19.memos.api.v1.UserWebhookB\x03\xe0A\x02R\awebhook\"\x91\x01\n" +
+ "\x18UpdateUserWebhookRequest\x128\n" +
+ "\awebhook\x18\x01 \x01(\v2\x19.memos.api.v1.UserWebhookB\x03\xe0A\x02R\awebhook\x12;\n" +
+ "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +
+ "updateMask\"3\n" +
+ "\x18DeleteUserWebhookRequest\x12\x17\n" +
+ "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name2\xe0\x16\n" +
"\vUserService\x12c\n" +
"\tListUsers\x12\x1e.memos.api.v1.ListUsersRequest\x1a\x1f.memos.api.v1.ListUsersResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/api/v1/users\x12b\n" +
"\aGetUser\x12\x1c.memos.api.v1.GetUserRequest\x1a\x12.memos.api.v1.User\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18\x12\x16/api/v1/{name=users/*}\x12e\n" +
@@ -2111,13 +3332,18 @@ const file_api_v1_user_service_proto_rawDesc = "" +
"\rGetUserAvatar\x12\".memos.api.v1.GetUserAvatarRequest\x1a\x14.google.api.HttpBody\",\xdaA\x04name\x82\xd3\xe4\x93\x02\x1f\x12\x1d/api/v1/{name=users/*}/avatar\x12~\n" +
"\x10ListAllUserStats\x12%.memos.api.v1.ListAllUserStatsRequest\x1a&.memos.api.v1.ListAllUserStatsResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/api/v1/users:stats\x12z\n" +
"\fGetUserStats\x12!.memos.api.v1.GetUserStatsRequest\x1a\x17.memos.api.v1.UserStats\".\xdaA\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/api/v1/{name=users/*}:getStats\x12\x82\x01\n" +
- "\x0eGetUserSetting\x12#.memos.api.v1.GetUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#\x12!/api/v1/{name=users/*}:getSetting\x12\xab\x01\n" +
- "\x11UpdateUserSetting\x12&.memos.api.v1.UpdateUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"S\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x027:\asetting2,/api/v1/{setting.name=users/*}:updateSetting\x12\xa5\x01\n" +
+ "\x0eGetUserSetting\x12#.memos.api.v1.GetUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#\x12!/api/v1/{name=users/*/settings/*}\x12\xa8\x01\n" +
+ "\x11UpdateUserSetting\x12&.memos.api.v1.UpdateUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"P\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x024:\asetting2)/api/v1/{setting.name=users/*/settings/*}\x12\x95\x01\n" +
+ "\x10ListUserSettings\x12%.memos.api.v1.ListUserSettingsRequest\x1a&.memos.api.v1.ListUserSettingsResponse\"2\xdaA\x06parent\x82\xd3\xe4\x93\x02#\x12!/api/v1/{parent=users/*}/settings\x12\xa5\x01\n" +
"\x14ListUserAccessTokens\x12).memos.api.v1.ListUserAccessTokensRequest\x1a*.memos.api.v1.ListUserAccessTokensResponse\"6\xdaA\x06parent\x82\xd3\xe4\x93\x02'\x12%/api/v1/{parent=users/*}/accessTokens\x12\xb5\x01\n" +
"\x15CreateUserAccessToken\x12*.memos.api.v1.CreateUserAccessTokenRequest\x1a\x1d.memos.api.v1.UserAccessToken\"Q\xdaA\x13parent,access_token\x82\xd3\xe4\x93\x025:\faccess_token\"%/api/v1/{parent=users/*}/accessTokens\x12\x91\x01\n" +
"\x15DeleteUserAccessToken\x12*.memos.api.v1.DeleteUserAccessTokenRequest\x1a\x16.google.protobuf.Empty\"4\xdaA\x04name\x82\xd3\xe4\x93\x02'*%/api/v1/{name=users/*/accessTokens/*}\x12\x95\x01\n" +
"\x10ListUserSessions\x12%.memos.api.v1.ListUserSessionsRequest\x1a&.memos.api.v1.ListUserSessionsResponse\"2\xdaA\x06parent\x82\xd3\xe4\x93\x02#\x12!/api/v1/{parent=users/*}/sessions\x12\x85\x01\n" +
- "\x11RevokeUserSession\x12&.memos.api.v1.RevokeUserSessionRequest\x1a\x16.google.protobuf.Empty\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#*!/api/v1/{name=users/*/sessions/*}B\xa8\x01\n" +
+ "\x11RevokeUserSession\x12&.memos.api.v1.RevokeUserSessionRequest\x1a\x16.google.protobuf.Empty\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#*!/api/v1/{name=users/*/sessions/*}\x12\x95\x01\n" +
+ "\x10ListUserWebhooks\x12%.memos.api.v1.ListUserWebhooksRequest\x1a&.memos.api.v1.ListUserWebhooksResponse\"2\xdaA\x06parent\x82\xd3\xe4\x93\x02#\x12!/api/v1/{parent=users/*}/webhooks\x12\x9b\x01\n" +
+ "\x11CreateUserWebhook\x12&.memos.api.v1.CreateUserWebhookRequest\x1a\x19.memos.api.v1.UserWebhook\"C\xdaA\x0eparent,webhook\x82\xd3\xe4\x93\x02,:\awebhook\"!/api/v1/{parent=users/*}/webhooks\x12\xa8\x01\n" +
+ "\x11UpdateUserWebhook\x12&.memos.api.v1.UpdateUserWebhookRequest\x1a\x19.memos.api.v1.UserWebhook\"P\xdaA\x13webhook,update_mask\x82\xd3\xe4\x93\x024:\awebhook2)/api/v1/{webhook.name=users/*/webhooks/*}\x12\x85\x01\n" +
+ "\x11DeleteUserWebhook\x12&.memos.api.v1.DeleteUserWebhookRequest\x1a\x16.google.protobuf.Empty\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#*!/api/v1/{name=users/*/webhooks/*}B\xa8\x01\n" +
"\x10com.memos.api.v1B\x10UserServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
var (
@@ -2132,107 +3358,155 @@ func file_api_v1_user_service_proto_rawDescGZIP() []byte {
return file_api_v1_user_service_proto_rawDescData
}
-var file_api_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 29)
+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_goTypes = []any{
- (User_Role)(0), // 0: memos.api.v1.User.Role
- (*User)(nil), // 1: memos.api.v1.User
- (*ListUsersRequest)(nil), // 2: memos.api.v1.ListUsersRequest
- (*ListUsersResponse)(nil), // 3: memos.api.v1.ListUsersResponse
- (*GetUserRequest)(nil), // 4: memos.api.v1.GetUserRequest
- (*CreateUserRequest)(nil), // 5: memos.api.v1.CreateUserRequest
- (*UpdateUserRequest)(nil), // 6: memos.api.v1.UpdateUserRequest
- (*DeleteUserRequest)(nil), // 7: memos.api.v1.DeleteUserRequest
- (*SearchUsersRequest)(nil), // 8: memos.api.v1.SearchUsersRequest
- (*SearchUsersResponse)(nil), // 9: memos.api.v1.SearchUsersResponse
- (*GetUserAvatarRequest)(nil), // 10: memos.api.v1.GetUserAvatarRequest
- (*UserStats)(nil), // 11: memos.api.v1.UserStats
- (*GetUserStatsRequest)(nil), // 12: memos.api.v1.GetUserStatsRequest
- (*UserSetting)(nil), // 13: memos.api.v1.UserSetting
- (*GetUserSettingRequest)(nil), // 14: memos.api.v1.GetUserSettingRequest
- (*UpdateUserSettingRequest)(nil), // 15: memos.api.v1.UpdateUserSettingRequest
- (*UserAccessToken)(nil), // 16: memos.api.v1.UserAccessToken
- (*ListUserAccessTokensRequest)(nil), // 17: memos.api.v1.ListUserAccessTokensRequest
- (*ListUserAccessTokensResponse)(nil), // 18: memos.api.v1.ListUserAccessTokensResponse
- (*CreateUserAccessTokenRequest)(nil), // 19: memos.api.v1.CreateUserAccessTokenRequest
- (*DeleteUserAccessTokenRequest)(nil), // 20: memos.api.v1.DeleteUserAccessTokenRequest
- (*UserSession)(nil), // 21: memos.api.v1.UserSession
- (*ListUserSessionsRequest)(nil), // 22: memos.api.v1.ListUserSessionsRequest
- (*ListUserSessionsResponse)(nil), // 23: memos.api.v1.ListUserSessionsResponse
- (*RevokeUserSessionRequest)(nil), // 24: memos.api.v1.RevokeUserSessionRequest
- (*ListAllUserStatsRequest)(nil), // 25: memos.api.v1.ListAllUserStatsRequest
- (*ListAllUserStatsResponse)(nil), // 26: memos.api.v1.ListAllUserStatsResponse
- nil, // 27: memos.api.v1.UserStats.TagCountEntry
- (*UserStats_MemoTypeStats)(nil), // 28: memos.api.v1.UserStats.MemoTypeStats
- (*UserSession_ClientInfo)(nil), // 29: memos.api.v1.UserSession.ClientInfo
- (State)(0), // 30: memos.api.v1.State
- (*timestamppb.Timestamp)(nil), // 31: google.protobuf.Timestamp
- (*fieldmaskpb.FieldMask)(nil), // 32: google.protobuf.FieldMask
- (*emptypb.Empty)(nil), // 33: google.protobuf.Empty
- (*httpbody.HttpBody)(nil), // 34: 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_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
}
var file_api_v1_user_service_proto_depIdxs = []int32{
0, // 0: memos.api.v1.User.role:type_name -> memos.api.v1.User.Role
- 30, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State
- 31, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp
- 31, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp
- 1, // 4: memos.api.v1.ListUsersResponse.users:type_name -> memos.api.v1.User
- 32, // 5: memos.api.v1.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask
- 1, // 6: memos.api.v1.CreateUserRequest.user:type_name -> memos.api.v1.User
- 1, // 7: memos.api.v1.UpdateUserRequest.user:type_name -> memos.api.v1.User
- 32, // 8: memos.api.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask
- 1, // 9: memos.api.v1.SearchUsersResponse.users:type_name -> memos.api.v1.User
- 31, // 10: memos.api.v1.UserStats.memo_display_timestamps:type_name -> google.protobuf.Timestamp
- 28, // 11: memos.api.v1.UserStats.memo_type_stats:type_name -> memos.api.v1.UserStats.MemoTypeStats
- 27, // 12: memos.api.v1.UserStats.tag_count:type_name -> memos.api.v1.UserStats.TagCountEntry
- 13, // 13: memos.api.v1.UpdateUserSettingRequest.setting:type_name -> memos.api.v1.UserSetting
- 32, // 14: memos.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
- 31, // 15: memos.api.v1.UserAccessToken.issued_at:type_name -> google.protobuf.Timestamp
- 31, // 16: memos.api.v1.UserAccessToken.expires_at:type_name -> google.protobuf.Timestamp
- 16, // 17: memos.api.v1.ListUserAccessTokensResponse.access_tokens:type_name -> memos.api.v1.UserAccessToken
- 16, // 18: memos.api.v1.CreateUserAccessTokenRequest.access_token:type_name -> memos.api.v1.UserAccessToken
- 31, // 19: memos.api.v1.UserSession.create_time:type_name -> google.protobuf.Timestamp
- 31, // 20: memos.api.v1.UserSession.last_accessed_time:type_name -> google.protobuf.Timestamp
- 29, // 21: memos.api.v1.UserSession.client_info:type_name -> memos.api.v1.UserSession.ClientInfo
- 21, // 22: memos.api.v1.ListUserSessionsResponse.sessions:type_name -> memos.api.v1.UserSession
- 11, // 23: memos.api.v1.ListAllUserStatsResponse.user_stats:type_name -> memos.api.v1.UserStats
- 2, // 24: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest
- 4, // 25: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest
- 5, // 26: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest
- 6, // 27: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest
- 7, // 28: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest
- 8, // 29: memos.api.v1.UserService.SearchUsers:input_type -> memos.api.v1.SearchUsersRequest
- 10, // 30: memos.api.v1.UserService.GetUserAvatar:input_type -> memos.api.v1.GetUserAvatarRequest
- 25, // 31: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest
- 12, // 32: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest
- 14, // 33: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest
- 15, // 34: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest
- 17, // 35: memos.api.v1.UserService.ListUserAccessTokens:input_type -> memos.api.v1.ListUserAccessTokensRequest
- 19, // 36: memos.api.v1.UserService.CreateUserAccessToken:input_type -> memos.api.v1.CreateUserAccessTokenRequest
- 20, // 37: memos.api.v1.UserService.DeleteUserAccessToken:input_type -> memos.api.v1.DeleteUserAccessTokenRequest
- 22, // 38: memos.api.v1.UserService.ListUserSessions:input_type -> memos.api.v1.ListUserSessionsRequest
- 24, // 39: memos.api.v1.UserService.RevokeUserSession:input_type -> memos.api.v1.RevokeUserSessionRequest
- 3, // 40: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse
- 1, // 41: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User
- 1, // 42: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User
- 1, // 43: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User
- 33, // 44: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty
- 9, // 45: memos.api.v1.UserService.SearchUsers:output_type -> memos.api.v1.SearchUsersResponse
- 34, // 46: memos.api.v1.UserService.GetUserAvatar:output_type -> google.api.HttpBody
- 26, // 47: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse
- 11, // 48: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats
- 13, // 49: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting
- 13, // 50: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting
- 18, // 51: memos.api.v1.UserService.ListUserAccessTokens:output_type -> memos.api.v1.ListUserAccessTokensResponse
- 16, // 52: memos.api.v1.UserService.CreateUserAccessToken:output_type -> memos.api.v1.UserAccessToken
- 33, // 53: memos.api.v1.UserService.DeleteUserAccessToken:output_type -> google.protobuf.Empty
- 23, // 54: memos.api.v1.UserService.ListUserSessions:output_type -> memos.api.v1.ListUserSessionsResponse
- 33, // 55: memos.api.v1.UserService.RevokeUserSession:output_type -> google.protobuf.Empty
- 40, // [40:56] is the sub-list for method output_type
- 24, // [24:40] is the sub-list for method input_type
- 24, // [24:24] is the sub-list for extension type_name
- 24, // [24:24] is the sub-list for extension extendee
- 0, // [0:24] is the sub-list for field type_name
+ 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
+ 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
+ 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
+ 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
+ 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
}
func init() { file_api_v1_user_service_proto_init() }
@@ -2241,13 +3515,20 @@ func file_api_v1_user_service_proto_init() {
return
}
file_api_v1_common_proto_init()
+ file_api_v1_user_service_proto_msgTypes[14].OneofWrappers = []any{
+ (*UserSetting_GeneralSetting_)(nil),
+ (*UserSetting_SessionsSetting_)(nil),
+ (*UserSetting_AccessTokensSetting_)(nil),
+ (*UserSetting_ShortcutsSetting_)(nil),
+ (*UserSetting_WebhooksSetting_)(nil),
+ }
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_user_service_proto_rawDesc), len(file_api_v1_user_service_proto_rawDesc)),
- NumEnums: 1,
- NumMessages: 29,
+ NumEnums: 2,
+ NumMessages: 47,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/gen/api/v1/user_service.pb.gw.go b/proto/gen/api/v1/user_service.pb.gw.go
index 0432db86d..766aa2cd8 100644
--- a/proto/gen/api/v1/user_service.pb.gw.go
+++ b/proto/gen/api/v1/user_service.pb.gw.go
@@ -372,8 +372,6 @@ func local_request_UserService_GetUserAvatar_0(ctx context.Context, marshaler ru
return msg, metadata, err
}
-var filter_UserService_ListAllUserStats_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
-
func request_UserService_ListAllUserStats_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ListAllUserStatsRequest
@@ -382,12 +380,6 @@ func request_UserService_ListAllUserStats_0(ctx context.Context, marshaler runti
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListAllUserStats_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
msg, err := client.ListAllUserStats(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
@@ -397,12 +389,6 @@ func local_request_UserService_ListAllUserStats_0(ctx context.Context, marshaler
protoReq ListAllUserStatsRequest
metadata runtime.ServerMetadata
)
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListAllUserStats_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
msg, err := server.ListAllUserStats(ctx, &protoReq)
return msg, metadata, err
}
@@ -566,6 +552,59 @@ func local_request_UserService_UpdateUserSetting_0(ctx context.Context, marshale
return msg, metadata, err
}
+var filter_UserService_ListUserSettings_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
+
+func request_UserService_ListUserSettings_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListUserSettingsRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserSettings_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := client.ListUserSettings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_UserService_ListUserSettings_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListUserSettingsRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_ListUserSettings_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.ListUserSettings(ctx, &protoReq)
+ return msg, metadata, err
+}
+
var filter_UserService_ListUserAccessTokens_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
func request_UserService_ListUserAccessTokens_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
@@ -795,6 +834,210 @@ func local_request_UserService_RevokeUserSession_0(ctx context.Context, marshale
return msg, metadata, err
}
+func request_UserService_ListUserWebhooks_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListUserWebhooksRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ msg, err := client.ListUserWebhooks(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_UserService_ListUserWebhooks_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListUserWebhooksRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ msg, err := server.ListUserWebhooks(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+func request_UserService_CreateUserWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq CreateUserWebhookRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ msg, err := client.CreateUserWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_UserService_CreateUserWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq CreateUserWebhookRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ msg, err := server.CreateUserWebhook(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+var filter_UserService_UpdateUserWebhook_0 = &utilities.DoubleArray{Encoding: map[string]int{"webhook": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
+
+func request_UserService_UpdateUserWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq UpdateUserWebhookRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
+ if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Webhook); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ } else {
+ protoReq.UpdateMask = fieldMask
+ }
+ }
+ val, ok := pathParams["webhook.name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "webhook.name")
+ }
+ err = runtime.PopulateFieldFromPath(&protoReq, "webhook.name", val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "webhook.name", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserWebhook_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := client.UpdateUserWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_UserService_UpdateUserWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq UpdateUserWebhookRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
+ if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Webhook); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ } else {
+ protoReq.UpdateMask = fieldMask
+ }
+ }
+ val, ok := pathParams["webhook.name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "webhook.name")
+ }
+ err = runtime.PopulateFieldFromPath(&protoReq, "webhook.name", val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "webhook.name", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateUserWebhook_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.UpdateUserWebhook(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+func request_UserService_DeleteUserWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq DeleteUserWebhookRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ msg, err := client.DeleteUserWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_UserService_DeleteUserWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq DeleteUserWebhookRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ msg, err := server.DeleteUserWebhook(ctx, &protoReq)
+ return msg, metadata, err
+}
+
// RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux".
// UnaryRPC :call UserServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -987,7 +1230,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:getSetting"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/settings/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -1007,7 +1250,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*}:updateSetting"))
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*/settings/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -1021,6 +1264,26 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_UpdateUserSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_UserService_ListUserSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserSettings", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/settings"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_UserService_ListUserSettings_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_ListUserSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodGet, pattern_UserService_ListUserAccessTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -1121,6 +1384,86 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_RevokeUserSession_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_UserService_ListUserWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserWebhooks", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_UserService_ListUserWebhooks_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_ListUserWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_UserService_CreateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_UserService_CreateUserWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_CreateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPatch, pattern_UserService_UpdateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{webhook.name=users/*/webhooks/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_UserService_UpdateUserWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_UpdateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodDelete, pattern_UserService_DeleteUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_UserService_DeleteUserWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_DeleteUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
@@ -1318,7 +1661,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*}:getSetting"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/settings/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -1335,7 +1678,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*}:updateSetting"))
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v1/{setting.name=users/*/settings/*}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
@@ -1348,6 +1691,23 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_UpdateUserSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_UserService_ListUserSettings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserSettings", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/settings"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_UserService_ListUserSettings_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_ListUserSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodGet, pattern_UserService_ListUserAccessTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -1433,6 +1793,74 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_RevokeUserSession_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_UserService_ListUserWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListUserWebhooks", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_UserService_ListUserWebhooks_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_ListUserWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_UserService_CreateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreateUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_UserService_CreateUserWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_CreateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPatch, pattern_UserService_UpdateUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{webhook.name=users/*/webhooks/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_UserService_UpdateUserWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_UpdateUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodDelete, pattern_UserService_DeleteUserWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteUserWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_UserService_DeleteUserWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_DeleteUserWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
@@ -1446,13 +1874,18 @@ var (
pattern_UserService_GetUserAvatar_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "name", "avatar"}, ""))
pattern_UserService_ListAllUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "users"}, "stats"))
pattern_UserService_GetUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "getStats"))
- pattern_UserService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "name"}, "getSetting"))
- pattern_UserService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "users", "setting.name"}, "updateSetting"))
+ pattern_UserService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "settings", "name"}, ""))
+ pattern_UserService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "settings", "setting.name"}, ""))
+ pattern_UserService_ListUserSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "settings"}, ""))
pattern_UserService_ListUserAccessTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "accessTokens"}, ""))
pattern_UserService_CreateUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "accessTokens"}, ""))
pattern_UserService_DeleteUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "accessTokens", "name"}, ""))
pattern_UserService_ListUserSessions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "sessions"}, ""))
pattern_UserService_RevokeUserSession_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "sessions", "name"}, ""))
+ pattern_UserService_ListUserWebhooks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "webhooks"}, ""))
+ pattern_UserService_CreateUserWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "webhooks"}, ""))
+ pattern_UserService_UpdateUserWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "webhooks", "webhook.name"}, ""))
+ pattern_UserService_DeleteUserWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "webhooks", "name"}, ""))
)
var (
@@ -1467,9 +1900,14 @@ var (
forward_UserService_GetUserStats_0 = runtime.ForwardResponseMessage
forward_UserService_GetUserSetting_0 = runtime.ForwardResponseMessage
forward_UserService_UpdateUserSetting_0 = runtime.ForwardResponseMessage
+ forward_UserService_ListUserSettings_0 = runtime.ForwardResponseMessage
forward_UserService_ListUserAccessTokens_0 = runtime.ForwardResponseMessage
forward_UserService_CreateUserAccessToken_0 = runtime.ForwardResponseMessage
forward_UserService_DeleteUserAccessToken_0 = runtime.ForwardResponseMessage
forward_UserService_ListUserSessions_0 = runtime.ForwardResponseMessage
forward_UserService_RevokeUserSession_0 = runtime.ForwardResponseMessage
+ forward_UserService_ListUserWebhooks_0 = runtime.ForwardResponseMessage
+ forward_UserService_CreateUserWebhook_0 = runtime.ForwardResponseMessage
+ forward_UserService_UpdateUserWebhook_0 = runtime.ForwardResponseMessage
+ forward_UserService_DeleteUserWebhook_0 = runtime.ForwardResponseMessage
)
diff --git a/proto/gen/api/v1/user_service_grpc.pb.go b/proto/gen/api/v1/user_service_grpc.pb.go
index 8f2c5560b..6abff800d 100644
--- a/proto/gen/api/v1/user_service_grpc.pb.go
+++ b/proto/gen/api/v1/user_service_grpc.pb.go
@@ -32,11 +32,16 @@ const (
UserService_GetUserStats_FullMethodName = "/memos.api.v1.UserService/GetUserStats"
UserService_GetUserSetting_FullMethodName = "/memos.api.v1.UserService/GetUserSetting"
UserService_UpdateUserSetting_FullMethodName = "/memos.api.v1.UserService/UpdateUserSetting"
+ UserService_ListUserSettings_FullMethodName = "/memos.api.v1.UserService/ListUserSettings"
UserService_ListUserAccessTokens_FullMethodName = "/memos.api.v1.UserService/ListUserAccessTokens"
UserService_CreateUserAccessToken_FullMethodName = "/memos.api.v1.UserService/CreateUserAccessToken"
UserService_DeleteUserAccessToken_FullMethodName = "/memos.api.v1.UserService/DeleteUserAccessToken"
UserService_ListUserSessions_FullMethodName = "/memos.api.v1.UserService/ListUserSessions"
UserService_RevokeUserSession_FullMethodName = "/memos.api.v1.UserService/RevokeUserSession"
+ UserService_ListUserWebhooks_FullMethodName = "/memos.api.v1.UserService/ListUserWebhooks"
+ UserService_CreateUserWebhook_FullMethodName = "/memos.api.v1.UserService/CreateUserWebhook"
+ UserService_UpdateUserWebhook_FullMethodName = "/memos.api.v1.UserService/UpdateUserWebhook"
+ UserService_DeleteUserWebhook_FullMethodName = "/memos.api.v1.UserService/DeleteUserWebhook"
)
// UserServiceClient is the client API for UserService service.
@@ -65,6 +70,8 @@ type UserServiceClient interface {
GetUserSetting(ctx context.Context, in *GetUserSettingRequest, opts ...grpc.CallOption) (*UserSetting, error)
// UpdateUserSetting updates the user setting.
UpdateUserSetting(ctx context.Context, in *UpdateUserSettingRequest, opts ...grpc.CallOption) (*UserSetting, error)
+ // ListUserSettings returns a list of user settings.
+ ListUserSettings(ctx context.Context, in *ListUserSettingsRequest, opts ...grpc.CallOption) (*ListUserSettingsResponse, error)
// ListUserAccessTokens returns a list of access tokens for a user.
ListUserAccessTokens(ctx context.Context, in *ListUserAccessTokensRequest, opts ...grpc.CallOption) (*ListUserAccessTokensResponse, error)
// CreateUserAccessToken creates a new access token for a user.
@@ -75,6 +82,14 @@ type UserServiceClient interface {
ListUserSessions(ctx context.Context, in *ListUserSessionsRequest, opts ...grpc.CallOption) (*ListUserSessionsResponse, error)
// RevokeUserSession revokes a specific session for a user.
RevokeUserSession(ctx context.Context, in *RevokeUserSessionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
+ // ListUserWebhooks returns a list of webhooks for a user.
+ ListUserWebhooks(ctx context.Context, in *ListUserWebhooksRequest, opts ...grpc.CallOption) (*ListUserWebhooksResponse, error)
+ // CreateUserWebhook creates a new webhook for a user.
+ CreateUserWebhook(ctx context.Context, in *CreateUserWebhookRequest, opts ...grpc.CallOption) (*UserWebhook, error)
+ // UpdateUserWebhook updates an existing webhook for a user.
+ UpdateUserWebhook(ctx context.Context, in *UpdateUserWebhookRequest, opts ...grpc.CallOption) (*UserWebhook, error)
+ // DeleteUserWebhook deletes a webhook for a user.
+ DeleteUserWebhook(ctx context.Context, in *DeleteUserWebhookRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type userServiceClient struct {
@@ -195,6 +210,16 @@ func (c *userServiceClient) UpdateUserSetting(ctx context.Context, in *UpdateUse
return out, nil
}
+func (c *userServiceClient) ListUserSettings(ctx context.Context, in *ListUserSettingsRequest, opts ...grpc.CallOption) (*ListUserSettingsResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(ListUserSettingsResponse)
+ err := c.cc.Invoke(ctx, UserService_ListUserSettings_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *userServiceClient) ListUserAccessTokens(ctx context.Context, in *ListUserAccessTokensRequest, opts ...grpc.CallOption) (*ListUserAccessTokensResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListUserAccessTokensResponse)
@@ -245,6 +270,46 @@ func (c *userServiceClient) RevokeUserSession(ctx context.Context, in *RevokeUse
return out, nil
}
+func (c *userServiceClient) ListUserWebhooks(ctx context.Context, in *ListUserWebhooksRequest, opts ...grpc.CallOption) (*ListUserWebhooksResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(ListUserWebhooksResponse)
+ err := c.cc.Invoke(ctx, UserService_ListUserWebhooks_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *userServiceClient) CreateUserWebhook(ctx context.Context, in *CreateUserWebhookRequest, opts ...grpc.CallOption) (*UserWebhook, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(UserWebhook)
+ err := c.cc.Invoke(ctx, UserService_CreateUserWebhook_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *userServiceClient) UpdateUserWebhook(ctx context.Context, in *UpdateUserWebhookRequest, opts ...grpc.CallOption) (*UserWebhook, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(UserWebhook)
+ err := c.cc.Invoke(ctx, UserService_UpdateUserWebhook_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *userServiceClient) DeleteUserWebhook(ctx context.Context, in *DeleteUserWebhookRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(emptypb.Empty)
+ err := c.cc.Invoke(ctx, UserService_DeleteUserWebhook_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// UserServiceServer is the server API for UserService service.
// All implementations must embed UnimplementedUserServiceServer
// for forward compatibility.
@@ -271,6 +336,8 @@ type UserServiceServer interface {
GetUserSetting(context.Context, *GetUserSettingRequest) (*UserSetting, error)
// UpdateUserSetting updates the user setting.
UpdateUserSetting(context.Context, *UpdateUserSettingRequest) (*UserSetting, error)
+ // ListUserSettings returns a list of user settings.
+ ListUserSettings(context.Context, *ListUserSettingsRequest) (*ListUserSettingsResponse, error)
// ListUserAccessTokens returns a list of access tokens for a user.
ListUserAccessTokens(context.Context, *ListUserAccessTokensRequest) (*ListUserAccessTokensResponse, error)
// CreateUserAccessToken creates a new access token for a user.
@@ -281,6 +348,14 @@ type UserServiceServer interface {
ListUserSessions(context.Context, *ListUserSessionsRequest) (*ListUserSessionsResponse, error)
// RevokeUserSession revokes a specific session for a user.
RevokeUserSession(context.Context, *RevokeUserSessionRequest) (*emptypb.Empty, error)
+ // ListUserWebhooks returns a list of webhooks for a user.
+ ListUserWebhooks(context.Context, *ListUserWebhooksRequest) (*ListUserWebhooksResponse, error)
+ // CreateUserWebhook creates a new webhook for a user.
+ CreateUserWebhook(context.Context, *CreateUserWebhookRequest) (*UserWebhook, error)
+ // UpdateUserWebhook updates an existing webhook for a user.
+ UpdateUserWebhook(context.Context, *UpdateUserWebhookRequest) (*UserWebhook, error)
+ // DeleteUserWebhook deletes a webhook for a user.
+ DeleteUserWebhook(context.Context, *DeleteUserWebhookRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedUserServiceServer()
}
@@ -324,6 +399,9 @@ func (UnimplementedUserServiceServer) GetUserSetting(context.Context, *GetUserSe
func (UnimplementedUserServiceServer) UpdateUserSetting(context.Context, *UpdateUserSettingRequest) (*UserSetting, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateUserSetting not implemented")
}
+func (UnimplementedUserServiceServer) ListUserSettings(context.Context, *ListUserSettingsRequest) (*ListUserSettingsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method ListUserSettings not implemented")
+}
func (UnimplementedUserServiceServer) ListUserAccessTokens(context.Context, *ListUserAccessTokensRequest) (*ListUserAccessTokensResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUserAccessTokens not implemented")
}
@@ -339,6 +417,18 @@ func (UnimplementedUserServiceServer) ListUserSessions(context.Context, *ListUse
func (UnimplementedUserServiceServer) RevokeUserSession(context.Context, *RevokeUserSessionRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method RevokeUserSession not implemented")
}
+func (UnimplementedUserServiceServer) ListUserWebhooks(context.Context, *ListUserWebhooksRequest) (*ListUserWebhooksResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method ListUserWebhooks not implemented")
+}
+func (UnimplementedUserServiceServer) CreateUserWebhook(context.Context, *CreateUserWebhookRequest) (*UserWebhook, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateUserWebhook not implemented")
+}
+func (UnimplementedUserServiceServer) UpdateUserWebhook(context.Context, *UpdateUserWebhookRequest) (*UserWebhook, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateUserWebhook not implemented")
+}
+func (UnimplementedUserServiceServer) DeleteUserWebhook(context.Context, *DeleteUserWebhookRequest) (*emptypb.Empty, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method DeleteUserWebhook not implemented")
+}
func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}
func (UnimplementedUserServiceServer) testEmbeddedByValue() {}
@@ -558,6 +648,24 @@ func _UserService_UpdateUserSetting_Handler(srv interface{}, ctx context.Context
return interceptor(ctx, in, info, handler)
}
+func _UserService_ListUserSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ListUserSettingsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserServiceServer).ListUserSettings(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserService_ListUserSettings_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserServiceServer).ListUserSettings(ctx, req.(*ListUserSettingsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _UserService_ListUserAccessTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListUserAccessTokensRequest)
if err := dec(in); err != nil {
@@ -648,6 +756,78 @@ func _UserService_RevokeUserSession_Handler(srv interface{}, ctx context.Context
return interceptor(ctx, in, info, handler)
}
+func _UserService_ListUserWebhooks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ListUserWebhooksRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserServiceServer).ListUserWebhooks(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserService_ListUserWebhooks_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserServiceServer).ListUserWebhooks(ctx, req.(*ListUserWebhooksRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _UserService_CreateUserWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateUserWebhookRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserServiceServer).CreateUserWebhook(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserService_CreateUserWebhook_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserServiceServer).CreateUserWebhook(ctx, req.(*CreateUserWebhookRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _UserService_UpdateUserWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateUserWebhookRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserServiceServer).UpdateUserWebhook(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserService_UpdateUserWebhook_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserServiceServer).UpdateUserWebhook(ctx, req.(*UpdateUserWebhookRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _UserService_DeleteUserWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeleteUserWebhookRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserServiceServer).DeleteUserWebhook(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserService_DeleteUserWebhook_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserServiceServer).DeleteUserWebhook(ctx, req.(*DeleteUserWebhookRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -699,6 +879,10 @@ var UserService_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpdateUserSetting",
Handler: _UserService_UpdateUserSetting_Handler,
},
+ {
+ MethodName: "ListUserSettings",
+ Handler: _UserService_ListUserSettings_Handler,
+ },
{
MethodName: "ListUserAccessTokens",
Handler: _UserService_ListUserAccessTokens_Handler,
@@ -719,6 +903,22 @@ var UserService_ServiceDesc = grpc.ServiceDesc{
MethodName: "RevokeUserSession",
Handler: _UserService_RevokeUserSession_Handler,
},
+ {
+ MethodName: "ListUserWebhooks",
+ Handler: _UserService_ListUserWebhooks_Handler,
+ },
+ {
+ MethodName: "CreateUserWebhook",
+ Handler: _UserService_CreateUserWebhook_Handler,
+ },
+ {
+ MethodName: "UpdateUserWebhook",
+ Handler: _UserService_UpdateUserWebhook_Handler,
+ },
+ {
+ MethodName: "DeleteUserWebhook",
+ Handler: _UserService_DeleteUserWebhook_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "api/v1/user_service.proto",
diff --git a/proto/gen/api/v1/webhook_service.pb.go b/proto/gen/api/v1/webhook_service.pb.go
deleted file mode 100644
index 16c386929..000000000
--- a/proto/gen/api/v1/webhook_service.pb.go
+++ /dev/null
@@ -1,497 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.36.6
-// protoc (unknown)
-// source: api/v1/webhook_service.proto
-
-package apiv1
-
-import (
- _ "google.golang.org/genproto/googleapis/api/annotations"
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- emptypb "google.golang.org/protobuf/types/known/emptypb"
- fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
- reflect "reflect"
- sync "sync"
- unsafe "unsafe"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type Webhook struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The resource name of the webhook.
- // Format: users/{user}/webhooks/{webhook}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- // The display name of the webhook.
- DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
- // The target URL for the webhook.
- Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *Webhook) Reset() {
- *x = Webhook{}
- mi := &file_api_v1_webhook_service_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *Webhook) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Webhook) ProtoMessage() {}
-
-func (x *Webhook) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_webhook_service_proto_msgTypes[0]
- 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 Webhook.ProtoReflect.Descriptor instead.
-func (*Webhook) Descriptor() ([]byte, []int) {
- return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *Webhook) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-func (x *Webhook) GetDisplayName() string {
- if x != nil {
- return x.DisplayName
- }
- return ""
-}
-
-func (x *Webhook) GetUrl() string {
- if x != nil {
- return x.Url
- }
- return ""
-}
-
-type ListWebhooksRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The parent resource where webhooks are listed.
- // Format: users/{user}
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ListWebhooksRequest) Reset() {
- *x = ListWebhooksRequest{}
- mi := &file_api_v1_webhook_service_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ListWebhooksRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListWebhooksRequest) ProtoMessage() {}
-
-func (x *ListWebhooksRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_webhook_service_proto_msgTypes[1]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ListWebhooksRequest.ProtoReflect.Descriptor instead.
-func (*ListWebhooksRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *ListWebhooksRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-type ListWebhooksResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The list of webhooks.
- Webhooks []*Webhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ListWebhooksResponse) Reset() {
- *x = ListWebhooksResponse{}
- mi := &file_api_v1_webhook_service_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ListWebhooksResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListWebhooksResponse) ProtoMessage() {}
-
-func (x *ListWebhooksResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_webhook_service_proto_msgTypes[2]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ListWebhooksResponse.ProtoReflect.Descriptor instead.
-func (*ListWebhooksResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *ListWebhooksResponse) GetWebhooks() []*Webhook {
- if x != nil {
- return x.Webhooks
- }
- return nil
-}
-
-type GetWebhookRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The resource name of the webhook to retrieve.
- // Format: users/{user}/webhooks/{webhook}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *GetWebhookRequest) Reset() {
- *x = GetWebhookRequest{}
- mi := &file_api_v1_webhook_service_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *GetWebhookRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*GetWebhookRequest) ProtoMessage() {}
-
-func (x *GetWebhookRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_webhook_service_proto_msgTypes[3]
- 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 GetWebhookRequest.ProtoReflect.Descriptor instead.
-func (*GetWebhookRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *GetWebhookRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-type CreateWebhookRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The parent resource where this webhook will be created.
- // Format: users/{user}
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- // Required. The webhook to create.
- Webhook *Webhook `protobuf:"bytes,2,opt,name=webhook,proto3" json:"webhook,omitempty"`
- // Optional. If set, validate the request, but do not actually create the webhook.
- ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *CreateWebhookRequest) Reset() {
- *x = CreateWebhookRequest{}
- mi := &file_api_v1_webhook_service_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *CreateWebhookRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CreateWebhookRequest) ProtoMessage() {}
-
-func (x *CreateWebhookRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_webhook_service_proto_msgTypes[4]
- 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 CreateWebhookRequest.ProtoReflect.Descriptor instead.
-func (*CreateWebhookRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *CreateWebhookRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-func (x *CreateWebhookRequest) GetWebhook() *Webhook {
- if x != nil {
- return x.Webhook
- }
- return nil
-}
-
-func (x *CreateWebhookRequest) GetValidateOnly() bool {
- if x != nil {
- return x.ValidateOnly
- }
- return false
-}
-
-type UpdateWebhookRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The webhook resource which replaces the resource on the server.
- Webhook *Webhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"`
- // Optional. The list of fields to update.
- UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *UpdateWebhookRequest) Reset() {
- *x = UpdateWebhookRequest{}
- mi := &file_api_v1_webhook_service_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *UpdateWebhookRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*UpdateWebhookRequest) ProtoMessage() {}
-
-func (x *UpdateWebhookRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_webhook_service_proto_msgTypes[5]
- 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 UpdateWebhookRequest.ProtoReflect.Descriptor instead.
-func (*UpdateWebhookRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{5}
-}
-
-func (x *UpdateWebhookRequest) GetWebhook() *Webhook {
- if x != nil {
- return x.Webhook
- }
- return nil
-}
-
-func (x *UpdateWebhookRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
- if x != nil {
- return x.UpdateMask
- }
- return nil
-}
-
-type DeleteWebhookRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // Required. The resource name of the webhook to delete.
- // Format: users/{user}/webhooks/{webhook}
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *DeleteWebhookRequest) Reset() {
- *x = DeleteWebhookRequest{}
- mi := &file_api_v1_webhook_service_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *DeleteWebhookRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*DeleteWebhookRequest) ProtoMessage() {}
-
-func (x *DeleteWebhookRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_webhook_service_proto_msgTypes[6]
- 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 DeleteWebhookRequest.ProtoReflect.Descriptor instead.
-func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{6}
-}
-
-func (x *DeleteWebhookRequest) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-var File_api_v1_webhook_service_proto protoreflect.FileDescriptor
-
-const file_api_v1_webhook_service_proto_rawDesc = "" +
- "\n" +
- "\x1capi/v1/webhook_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\xb0\x01\n" +
- "\aWebhook\x12\x17\n" +
- "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12&\n" +
- "\fdisplay_name\x18\x02 \x01(\tB\x03\xe0A\x02R\vdisplayName\x12\x15\n" +
- "\x03url\x18\x03 \x01(\tB\x03\xe0A\x02R\x03url:M\xeaAJ\n" +
- "\x14memos.api.v1/Webhook\x12\x1fusers/{user}/webhooks/{webhook}*\bwebhooks2\awebhook\"K\n" +
- "\x13ListWebhooksRequest\x124\n" +
- "\x06parent\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\x12\x14memos.api.v1/WebhookR\x06parent\"I\n" +
- "\x14ListWebhooksResponse\x121\n" +
- "\bwebhooks\x18\x01 \x03(\v2\x15.memos.api.v1.WebhookR\bwebhooks\"E\n" +
- "\x11GetWebhookRequest\x120\n" +
- "\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
- "\x14memos.api.v1/WebhookR\x04name\"\xac\x01\n" +
- "\x14CreateWebhookRequest\x124\n" +
- "\x06parent\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\x12\x14memos.api.v1/WebhookR\x06parent\x124\n" +
- "\awebhook\x18\x02 \x01(\v2\x15.memos.api.v1.WebhookB\x03\xe0A\x02R\awebhook\x12(\n" +
- "\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\"\x8e\x01\n" +
- "\x14UpdateWebhookRequest\x124\n" +
- "\awebhook\x18\x01 \x01(\v2\x15.memos.api.v1.WebhookB\x03\xe0A\x02R\awebhook\x12@\n" +
- "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\n" +
- "updateMask\"H\n" +
- "\x14DeleteWebhookRequest\x120\n" +
- "\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
- "\x14memos.api.v1/WebhookR\x04name2\xc4\x05\n" +
- "\x0eWebhookService\x12\x89\x01\n" +
- "\fListWebhooks\x12!.memos.api.v1.ListWebhooksRequest\x1a\".memos.api.v1.ListWebhooksResponse\"2\xdaA\x06parent\x82\xd3\xe4\x93\x02#\x12!/api/v1/{parent=users/*}/webhooks\x12v\n" +
- "\n" +
- "GetWebhook\x12\x1f.memos.api.v1.GetWebhookRequest\x1a\x15.memos.api.v1.Webhook\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#\x12!/api/v1/{name=users/*/webhooks/*}\x12\x8f\x01\n" +
- "\rCreateWebhook\x12\".memos.api.v1.CreateWebhookRequest\x1a\x15.memos.api.v1.Webhook\"C\xdaA\x0eparent,webhook\x82\xd3\xe4\x93\x02,:\awebhook\"!/api/v1/{parent=users/*}/webhooks\x12\x9c\x01\n" +
- "\rUpdateWebhook\x12\".memos.api.v1.UpdateWebhookRequest\x1a\x15.memos.api.v1.Webhook\"P\xdaA\x13webhook,update_mask\x82\xd3\xe4\x93\x024:\awebhook2)/api/v1/{webhook.name=users/*/webhooks/*}\x12}\n" +
- "\rDeleteWebhook\x12\".memos.api.v1.DeleteWebhookRequest\x1a\x16.google.protobuf.Empty\"0\xdaA\x04name\x82\xd3\xe4\x93\x02#*!/api/v1/{name=users/*/webhooks/*}B\xab\x01\n" +
- "\x10com.memos.api.v1B\x13WebhookServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
-
-var (
- file_api_v1_webhook_service_proto_rawDescOnce sync.Once
- file_api_v1_webhook_service_proto_rawDescData []byte
-)
-
-func file_api_v1_webhook_service_proto_rawDescGZIP() []byte {
- file_api_v1_webhook_service_proto_rawDescOnce.Do(func() {
- file_api_v1_webhook_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_webhook_service_proto_rawDesc), len(file_api_v1_webhook_service_proto_rawDesc)))
- })
- return file_api_v1_webhook_service_proto_rawDescData
-}
-
-var file_api_v1_webhook_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
-var file_api_v1_webhook_service_proto_goTypes = []any{
- (*Webhook)(nil), // 0: memos.api.v1.Webhook
- (*ListWebhooksRequest)(nil), // 1: memos.api.v1.ListWebhooksRequest
- (*ListWebhooksResponse)(nil), // 2: memos.api.v1.ListWebhooksResponse
- (*GetWebhookRequest)(nil), // 3: memos.api.v1.GetWebhookRequest
- (*CreateWebhookRequest)(nil), // 4: memos.api.v1.CreateWebhookRequest
- (*UpdateWebhookRequest)(nil), // 5: memos.api.v1.UpdateWebhookRequest
- (*DeleteWebhookRequest)(nil), // 6: memos.api.v1.DeleteWebhookRequest
- (*fieldmaskpb.FieldMask)(nil), // 7: google.protobuf.FieldMask
- (*emptypb.Empty)(nil), // 8: google.protobuf.Empty
-}
-var file_api_v1_webhook_service_proto_depIdxs = []int32{
- 0, // 0: memos.api.v1.ListWebhooksResponse.webhooks:type_name -> memos.api.v1.Webhook
- 0, // 1: memos.api.v1.CreateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook
- 0, // 2: memos.api.v1.UpdateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook
- 7, // 3: memos.api.v1.UpdateWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask
- 1, // 4: memos.api.v1.WebhookService.ListWebhooks:input_type -> memos.api.v1.ListWebhooksRequest
- 3, // 5: memos.api.v1.WebhookService.GetWebhook:input_type -> memos.api.v1.GetWebhookRequest
- 4, // 6: memos.api.v1.WebhookService.CreateWebhook:input_type -> memos.api.v1.CreateWebhookRequest
- 5, // 7: memos.api.v1.WebhookService.UpdateWebhook:input_type -> memos.api.v1.UpdateWebhookRequest
- 6, // 8: memos.api.v1.WebhookService.DeleteWebhook:input_type -> memos.api.v1.DeleteWebhookRequest
- 2, // 9: memos.api.v1.WebhookService.ListWebhooks:output_type -> memos.api.v1.ListWebhooksResponse
- 0, // 10: memos.api.v1.WebhookService.GetWebhook:output_type -> memos.api.v1.Webhook
- 0, // 11: memos.api.v1.WebhookService.CreateWebhook:output_type -> memos.api.v1.Webhook
- 0, // 12: memos.api.v1.WebhookService.UpdateWebhook:output_type -> memos.api.v1.Webhook
- 8, // 13: memos.api.v1.WebhookService.DeleteWebhook:output_type -> google.protobuf.Empty
- 9, // [9:14] is the sub-list for method output_type
- 4, // [4:9] is the sub-list for method input_type
- 4, // [4:4] is the sub-list for extension type_name
- 4, // [4:4] is the sub-list for extension extendee
- 0, // [0:4] is the sub-list for field type_name
-}
-
-func init() { file_api_v1_webhook_service_proto_init() }
-func file_api_v1_webhook_service_proto_init() {
- if File_api_v1_webhook_service_proto != nil {
- return
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_webhook_service_proto_rawDesc), len(file_api_v1_webhook_service_proto_rawDesc)),
- NumEnums: 0,
- NumMessages: 7,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_api_v1_webhook_service_proto_goTypes,
- DependencyIndexes: file_api_v1_webhook_service_proto_depIdxs,
- MessageInfos: file_api_v1_webhook_service_proto_msgTypes,
- }.Build()
- File_api_v1_webhook_service_proto = out.File
- file_api_v1_webhook_service_proto_goTypes = nil
- file_api_v1_webhook_service_proto_depIdxs = nil
-}
diff --git a/proto/gen/api/v1/webhook_service.pb.gw.go b/proto/gen/api/v1/webhook_service.pb.gw.go
deleted file mode 100644
index e8f938ea5..000000000
--- a/proto/gen/api/v1/webhook_service.pb.gw.go
+++ /dev/null
@@ -1,543 +0,0 @@
-// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
-// source: api/v1/webhook_service.proto
-
-/*
-Package apiv1 is a reverse proxy.
-
-It translates gRPC into RESTful JSON APIs.
-*/
-package apiv1
-
-import (
- "context"
- "errors"
- "io"
- "net/http"
-
- "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
- "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/grpclog"
- "google.golang.org/grpc/metadata"
- "google.golang.org/grpc/status"
- "google.golang.org/protobuf/proto"
-)
-
-// Suppress "imported and not used" errors
-var (
- _ codes.Code
- _ io.Reader
- _ status.Status
- _ = errors.New
- _ = runtime.String
- _ = utilities.NewDoubleArray
- _ = metadata.Join
-)
-
-func request_WebhookService_ListWebhooks_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq ListWebhooksRequest
- metadata runtime.ServerMetadata
- err error
- )
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- msg, err := client.ListWebhooks(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_WebhookService_ListWebhooks_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq ListWebhooksRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- msg, err := server.ListWebhooks(ctx, &protoReq)
- return msg, metadata, err
-}
-
-func request_WebhookService_GetWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq GetWebhookRequest
- metadata runtime.ServerMetadata
- err error
- )
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
- msg, err := client.GetWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_WebhookService_GetWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq GetWebhookRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
- msg, err := server.GetWebhook(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_WebhookService_CreateWebhook_0 = &utilities.DoubleArray{Encoding: map[string]int{"webhook": 0, "parent": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
-
-func request_WebhookService_CreateWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq CreateWebhookRequest
- metadata runtime.ServerMetadata
- err error
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_CreateWebhook_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.CreateWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_WebhookService_CreateWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq CreateWebhookRequest
- metadata runtime.ServerMetadata
- err error
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_CreateWebhook_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.CreateWebhook(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_WebhookService_UpdateWebhook_0 = &utilities.DoubleArray{Encoding: map[string]int{"webhook": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
-
-func request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateWebhookRequest
- metadata runtime.ServerMetadata
- err error
- )
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Webhook); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["webhook.name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "webhook.name")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "webhook.name", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "webhook.name", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_UpdateWebhook_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.UpdateWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateWebhookRequest
- metadata runtime.ServerMetadata
- err error
- )
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Webhook); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["webhook.name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "webhook.name")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "webhook.name", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "webhook.name", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_UpdateWebhook_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.UpdateWebhook(ctx, &protoReq)
- return msg, metadata, err
-}
-
-func request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq DeleteWebhookRequest
- metadata runtime.ServerMetadata
- err error
- )
- if req.Body != nil {
- _, _ = io.Copy(io.Discard, req.Body)
- }
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
- msg, err := client.DeleteWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq DeleteWebhookRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["name"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
- }
- protoReq.Name, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
- }
- msg, err := server.DeleteWebhook(ctx, &protoReq)
- return msg, metadata, err
-}
-
-// RegisterWebhookServiceHandlerServer registers the http handlers for service WebhookService to "mux".
-// UnaryRPC :call WebhookServiceServer directly.
-// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
-// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWebhookServiceHandlerFromEndpoint instead.
-// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
-func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WebhookServiceServer) error {
- mux.Handle(http.MethodGet, pattern_WebhookService_ListWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/ListWebhooks", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_WebhookService_ListWebhooks_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_ListWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodGet, pattern_WebhookService_GetWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_WebhookService_GetWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_GetWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_WebhookService_CreateWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_WebhookService_CreateWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_CreateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPatch, pattern_WebhookService_UpdateWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/UpdateWebhook", runtime.WithHTTPPathPattern("/api/v1/{webhook.name=users/*/webhooks/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_WebhookService_UpdateWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_UpdateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodDelete, pattern_WebhookService_DeleteWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/DeleteWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_WebhookService_DeleteWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams)
- md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_DeleteWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
-
- return nil
-}
-
-// RegisterWebhookServiceHandlerFromEndpoint is same as RegisterWebhookServiceHandler but
-// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
-func RegisterWebhookServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
- conn, err := grpc.NewClient(endpoint, opts...)
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- if cerr := conn.Close(); cerr != nil {
- grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- return
- }
- go func() {
- <-ctx.Done()
- if cerr := conn.Close(); cerr != nil {
- grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
- }
- }()
- }()
- return RegisterWebhookServiceHandler(ctx, mux, conn)
-}
-
-// RegisterWebhookServiceHandler registers the http handlers for service WebhookService to "mux".
-// The handlers forward requests to the grpc endpoint over "conn".
-func RegisterWebhookServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
- return RegisterWebhookServiceHandlerClient(ctx, mux, NewWebhookServiceClient(conn))
-}
-
-// RegisterWebhookServiceHandlerClient registers the http handlers for service WebhookService
-// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WebhookServiceClient".
-// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WebhookServiceClient"
-// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
-// "WebhookServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
-func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WebhookServiceClient) error {
- mux.Handle(http.MethodGet, pattern_WebhookService_ListWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/ListWebhooks", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_WebhookService_ListWebhooks_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_ListWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodGet, pattern_WebhookService_GetWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_WebhookService_GetWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_GetWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_WebhookService_CreateWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/webhooks"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_WebhookService_CreateWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_CreateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPatch, pattern_WebhookService_UpdateWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/UpdateWebhook", runtime.WithHTTPPathPattern("/api/v1/{webhook.name=users/*/webhooks/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_WebhookService_UpdateWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_UpdateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodDelete, pattern_WebhookService_DeleteWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/DeleteWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=users/*/webhooks/*}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_WebhookService_DeleteWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_WebhookService_DeleteWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- return nil
-}
-
-var (
- pattern_WebhookService_ListWebhooks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "webhooks"}, ""))
- pattern_WebhookService_GetWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "webhooks", "name"}, ""))
- pattern_WebhookService_CreateWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "webhooks"}, ""))
- pattern_WebhookService_UpdateWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "webhooks", "webhook.name"}, ""))
- pattern_WebhookService_DeleteWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 2, 3, 1, 0, 4, 4, 5, 4}, []string{"api", "v1", "users", "webhooks", "name"}, ""))
-)
-
-var (
- forward_WebhookService_ListWebhooks_0 = runtime.ForwardResponseMessage
- forward_WebhookService_GetWebhook_0 = runtime.ForwardResponseMessage
- forward_WebhookService_CreateWebhook_0 = runtime.ForwardResponseMessage
- forward_WebhookService_UpdateWebhook_0 = runtime.ForwardResponseMessage
- forward_WebhookService_DeleteWebhook_0 = runtime.ForwardResponseMessage
-)
diff --git a/proto/gen/api/v1/webhook_service_grpc.pb.go b/proto/gen/api/v1/webhook_service_grpc.pb.go
deleted file mode 100644
index e81076b7b..000000000
--- a/proto/gen/api/v1/webhook_service_grpc.pb.go
+++ /dev/null
@@ -1,284 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.5.1
-// - protoc (unknown)
-// source: api/v1/webhook_service.proto
-
-package apiv1
-
-import (
- context "context"
- grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
- emptypb "google.golang.org/protobuf/types/known/emptypb"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.64.0 or later.
-const _ = grpc.SupportPackageIsVersion9
-
-const (
- WebhookService_ListWebhooks_FullMethodName = "/memos.api.v1.WebhookService/ListWebhooks"
- WebhookService_GetWebhook_FullMethodName = "/memos.api.v1.WebhookService/GetWebhook"
- WebhookService_CreateWebhook_FullMethodName = "/memos.api.v1.WebhookService/CreateWebhook"
- WebhookService_UpdateWebhook_FullMethodName = "/memos.api.v1.WebhookService/UpdateWebhook"
- WebhookService_DeleteWebhook_FullMethodName = "/memos.api.v1.WebhookService/DeleteWebhook"
-)
-
-// WebhookServiceClient is the client API for WebhookService service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type WebhookServiceClient interface {
- // ListWebhooks returns a list of webhooks for a user.
- ListWebhooks(ctx context.Context, in *ListWebhooksRequest, opts ...grpc.CallOption) (*ListWebhooksResponse, error)
- // GetWebhook gets a webhook by name.
- GetWebhook(ctx context.Context, in *GetWebhookRequest, opts ...grpc.CallOption) (*Webhook, error)
- // CreateWebhook creates a new webhook for a user.
- CreateWebhook(ctx context.Context, in *CreateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error)
- // UpdateWebhook updates a webhook for a user.
- UpdateWebhook(ctx context.Context, in *UpdateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error)
- // DeleteWebhook deletes a webhook for a user.
- DeleteWebhook(ctx context.Context, in *DeleteWebhookRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
-}
-
-type webhookServiceClient struct {
- cc grpc.ClientConnInterface
-}
-
-func NewWebhookServiceClient(cc grpc.ClientConnInterface) WebhookServiceClient {
- return &webhookServiceClient{cc}
-}
-
-func (c *webhookServiceClient) ListWebhooks(ctx context.Context, in *ListWebhooksRequest, opts ...grpc.CallOption) (*ListWebhooksResponse, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(ListWebhooksResponse)
- err := c.cc.Invoke(ctx, WebhookService_ListWebhooks_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *webhookServiceClient) GetWebhook(ctx context.Context, in *GetWebhookRequest, opts ...grpc.CallOption) (*Webhook, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Webhook)
- err := c.cc.Invoke(ctx, WebhookService_GetWebhook_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *webhookServiceClient) CreateWebhook(ctx context.Context, in *CreateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Webhook)
- err := c.cc.Invoke(ctx, WebhookService_CreateWebhook_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *webhookServiceClient) UpdateWebhook(ctx context.Context, in *UpdateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Webhook)
- err := c.cc.Invoke(ctx, WebhookService_UpdateWebhook_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *webhookServiceClient) DeleteWebhook(ctx context.Context, in *DeleteWebhookRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(emptypb.Empty)
- err := c.cc.Invoke(ctx, WebhookService_DeleteWebhook_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// WebhookServiceServer is the server API for WebhookService service.
-// All implementations must embed UnimplementedWebhookServiceServer
-// for forward compatibility.
-type WebhookServiceServer interface {
- // ListWebhooks returns a list of webhooks for a user.
- ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error)
- // GetWebhook gets a webhook by name.
- GetWebhook(context.Context, *GetWebhookRequest) (*Webhook, error)
- // CreateWebhook creates a new webhook for a user.
- CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error)
- // UpdateWebhook updates a webhook for a user.
- UpdateWebhook(context.Context, *UpdateWebhookRequest) (*Webhook, error)
- // DeleteWebhook deletes a webhook for a user.
- DeleteWebhook(context.Context, *DeleteWebhookRequest) (*emptypb.Empty, error)
- mustEmbedUnimplementedWebhookServiceServer()
-}
-
-// UnimplementedWebhookServiceServer must be embedded to have
-// forward compatible implementations.
-//
-// NOTE: this should be embedded by value instead of pointer to avoid a nil
-// pointer dereference when methods are called.
-type UnimplementedWebhookServiceServer struct{}
-
-func (UnimplementedWebhookServiceServer) ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ListWebhooks not implemented")
-}
-func (UnimplementedWebhookServiceServer) GetWebhook(context.Context, *GetWebhookRequest) (*Webhook, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetWebhook not implemented")
-}
-func (UnimplementedWebhookServiceServer) CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error) {
- return nil, status.Errorf(codes.Unimplemented, "method CreateWebhook not implemented")
-}
-func (UnimplementedWebhookServiceServer) UpdateWebhook(context.Context, *UpdateWebhookRequest) (*Webhook, error) {
- return nil, status.Errorf(codes.Unimplemented, "method UpdateWebhook not implemented")
-}
-func (UnimplementedWebhookServiceServer) DeleteWebhook(context.Context, *DeleteWebhookRequest) (*emptypb.Empty, error) {
- return nil, status.Errorf(codes.Unimplemented, "method DeleteWebhook not implemented")
-}
-func (UnimplementedWebhookServiceServer) mustEmbedUnimplementedWebhookServiceServer() {}
-func (UnimplementedWebhookServiceServer) testEmbeddedByValue() {}
-
-// UnsafeWebhookServiceServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to WebhookServiceServer will
-// result in compilation errors.
-type UnsafeWebhookServiceServer interface {
- mustEmbedUnimplementedWebhookServiceServer()
-}
-
-func RegisterWebhookServiceServer(s grpc.ServiceRegistrar, srv WebhookServiceServer) {
- // If the following call pancis, it indicates UnimplementedWebhookServiceServer was
- // embedded by pointer and is nil. This will cause panics if an
- // unimplemented method is ever invoked, so we test this at initialization
- // time to prevent it from happening at runtime later due to I/O.
- if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
- t.testEmbeddedByValue()
- }
- s.RegisterService(&WebhookService_ServiceDesc, srv)
-}
-
-func _WebhookService_ListWebhooks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(ListWebhooksRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(WebhookServiceServer).ListWebhooks(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: WebhookService_ListWebhooks_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(WebhookServiceServer).ListWebhooks(ctx, req.(*ListWebhooksRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _WebhookService_GetWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(GetWebhookRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(WebhookServiceServer).GetWebhook(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: WebhookService_GetWebhook_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(WebhookServiceServer).GetWebhook(ctx, req.(*GetWebhookRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _WebhookService_CreateWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CreateWebhookRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(WebhookServiceServer).CreateWebhook(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: WebhookService_CreateWebhook_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(WebhookServiceServer).CreateWebhook(ctx, req.(*CreateWebhookRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _WebhookService_UpdateWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(UpdateWebhookRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(WebhookServiceServer).UpdateWebhook(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: WebhookService_UpdateWebhook_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(WebhookServiceServer).UpdateWebhook(ctx, req.(*UpdateWebhookRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _WebhookService_DeleteWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeleteWebhookRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(WebhookServiceServer).DeleteWebhook(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: WebhookService_DeleteWebhook_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(WebhookServiceServer).DeleteWebhook(ctx, req.(*DeleteWebhookRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-// WebhookService_ServiceDesc is the grpc.ServiceDesc for WebhookService service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var WebhookService_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "memos.api.v1.WebhookService",
- HandlerType: (*WebhookServiceServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "ListWebhooks",
- Handler: _WebhookService_ListWebhooks_Handler,
- },
- {
- MethodName: "GetWebhook",
- Handler: _WebhookService_GetWebhook_Handler,
- },
- {
- MethodName: "CreateWebhook",
- Handler: _WebhookService_CreateWebhook_Handler,
- },
- {
- MethodName: "UpdateWebhook",
- Handler: _WebhookService_UpdateWebhook_Handler,
- },
- {
- MethodName: "DeleteWebhook",
- Handler: _WebhookService_DeleteWebhook_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "api/v1/webhook_service.proto",
-}
diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml
index 6e521a0aa..352df8975 100644
--- a/proto/gen/openapi.yaml
+++ b/proto/gen/openapi.yaml
@@ -1644,6 +1644,124 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
+ /api/v1/users/{user}/settings:
+ get:
+ tags:
+ - UserService
+ description: ListUserSettings returns a list of user settings.
+ operationId: UserService_ListUserSettings
+ parameters:
+ - name: user
+ in: path
+ description: The user id.
+ required: true
+ schema:
+ type: string
+ - name: pageSize
+ in: query
+ description: |-
+ Optional. The maximum number of settings to return.
+ The service may return fewer than this value.
+ If unspecified, at most 50 settings will be returned.
+ The maximum value is 1000; values above 1000 will be coerced to 1000.
+ schema:
+ type: integer
+ format: int32
+ - name: pageToken
+ in: query
+ description: |-
+ Optional. A page token, received from a previous `ListUserSettings` call.
+ Provide this to retrieve the subsequent page.
+ schema:
+ type: string
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ListUserSettingsResponse'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
+ /api/v1/users/{user}/settings/{setting}:
+ get:
+ tags:
+ - UserService
+ description: GetUserSetting returns the user setting.
+ operationId: UserService_GetUserSetting
+ parameters:
+ - name: user
+ in: path
+ description: The user id.
+ required: true
+ schema:
+ type: string
+ - name: setting
+ in: path
+ description: The setting id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UserSetting'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
+ patch:
+ tags:
+ - UserService
+ description: UpdateUserSetting updates the user setting.
+ operationId: UserService_UpdateUserSetting
+ parameters:
+ - name: user
+ in: path
+ description: The user id.
+ required: true
+ schema:
+ type: string
+ - name: setting
+ in: path
+ description: The setting id.
+ required: true
+ schema:
+ type: string
+ - name: updateMask
+ in: query
+ description: Required. The list of fields to update.
+ schema:
+ type: string
+ format: field-mask
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UserSetting'
+ required: true
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UserSetting'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
/api/v1/users/{user}/shortcuts:
get:
tags:
@@ -1812,9 +1930,9 @@ paths:
/api/v1/users/{user}/webhooks:
get:
tags:
- - WebhookService
- description: ListWebhooks returns a list of webhooks for a user.
- operationId: WebhookService_ListWebhooks
+ - UserService
+ description: ListUserWebhooks returns a list of webhooks for a user.
+ operationId: UserService_ListUserWebhooks
parameters:
- name: user
in: path
@@ -1828,7 +1946,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/ListWebhooksResponse'
+ $ref: '#/components/schemas/ListUserWebhooksResponse'
default:
description: Default error response
content:
@@ -1837,9 +1955,9 @@ paths:
$ref: '#/components/schemas/Status'
post:
tags:
- - WebhookService
- description: CreateWebhook creates a new webhook for a user.
- operationId: WebhookService_CreateWebhook
+ - UserService
+ description: CreateUserWebhook creates a new webhook for a user.
+ operationId: UserService_CreateUserWebhook
parameters:
- name: user
in: path
@@ -1847,16 +1965,11 @@ paths:
required: true
schema:
type: string
- - name: validateOnly
- in: query
- description: Optional. If set, validate the request, but do not actually create the webhook.
- schema:
- type: boolean
requestBody:
content:
application/json:
schema:
- $ref: '#/components/schemas/Webhook'
+ $ref: '#/components/schemas/UserWebhook'
required: true
responses:
"200":
@@ -1864,7 +1977,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/Webhook'
+ $ref: '#/components/schemas/UserWebhook'
default:
description: Default error response
content:
@@ -1872,42 +1985,11 @@ paths:
schema:
$ref: '#/components/schemas/Status'
/api/v1/users/{user}/webhooks/{webhook}:
- get:
- tags:
- - WebhookService
- description: GetWebhook gets a webhook by name.
- operationId: WebhookService_GetWebhook
- parameters:
- - name: user
- in: path
- description: The user id.
- required: true
- schema:
- type: string
- - name: webhook
- in: path
- description: The webhook id.
- required: true
- schema:
- type: string
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Webhook'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
delete:
tags:
- - WebhookService
- description: DeleteWebhook deletes a webhook for a user.
- operationId: WebhookService_DeleteWebhook
+ - UserService
+ description: DeleteUserWebhook deletes a webhook for a user.
+ operationId: UserService_DeleteUserWebhook
parameters:
- name: user
in: path
@@ -1933,9 +2015,9 @@ paths:
$ref: '#/components/schemas/Status'
patch:
tags:
- - WebhookService
- description: UpdateWebhook updates a webhook for a user.
- operationId: WebhookService_UpdateWebhook
+ - UserService
+ description: UpdateUserWebhook updates an existing webhook for a user.
+ operationId: UserService_UpdateUserWebhook
parameters:
- name: user
in: path
@@ -1951,7 +2033,7 @@ paths:
type: string
- name: updateMask
in: query
- description: Optional. The list of fields to update.
+ description: The list of fields to update.
schema:
type: string
format: field-mask
@@ -1959,7 +2041,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/Webhook'
+ $ref: '#/components/schemas/UserWebhook'
required: true
responses:
"200":
@@ -1967,33 +2049,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/Webhook'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
- /api/v1/users/{user}:getSetting:
- get:
- tags:
- - UserService
- description: GetUserSetting returns the user setting.
- operationId: UserService_GetUserSetting
- parameters:
- - name: user
- in: path
- description: The user id.
- required: true
- schema:
- type: string
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/UserSetting'
+ $ref: '#/components/schemas/UserWebhook'
default:
description: Default error response
content:
@@ -2026,44 +2082,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
- /api/v1/users/{user}:updateSetting:
- patch:
- tags:
- - UserService
- description: UpdateUserSetting updates the user setting.
- operationId: UserService_UpdateUserSetting
- parameters:
- - name: user
- in: path
- description: The user id.
- required: true
- schema:
- type: string
- - name: updateMask
- in: query
- description: Required. The list of fields to update.
- schema:
- type: string
- format: field-mask
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/UserSetting'
- required: true
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/UserSetting'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
/api/v1/users:search:
get:
tags:
@@ -2106,18 +2124,6 @@ paths:
- UserService
description: ListAllUserStats returns statistics for all users.
operationId: UserService_ListAllUserStats
- parameters:
- - name: pageSize
- in: query
- description: Optional. The maximum number of user stats to return.
- schema:
- type: integer
- format: int32
- - name: pageToken
- in: query
- description: Optional. A page token for pagination.
- schema:
- type: string
responses:
"200":
description: OK
@@ -2250,6 +2256,19 @@ 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:
@@ -2685,18 +2704,11 @@ components:
ListAllUserStatsResponse:
type: object
properties:
- userStats:
+ stats:
type: array
items:
$ref: '#/components/schemas/UserStats'
description: The list of user statistics.
- nextPageToken:
- type: string
- description: A token for the next page of results.
- totalSize:
- type: integer
- description: The total count of user statistics.
- format: int32
ListAttachmentsResponse:
type: object
properties:
@@ -2865,14 +2877,14 @@ components:
items:
$ref: '#/components/schemas/UserSession'
description: The list of user sessions.
- ListUsersResponse:
+ ListUserSettingsResponse:
type: object
properties:
- users:
+ settings:
type: array
items:
- $ref: '#/components/schemas/User'
- description: The list of users.
+ $ref: '#/components/schemas/UserSetting'
+ description: The list of user settings.
nextPageToken:
type: string
description: |-
@@ -2880,16 +2892,34 @@ components:
If this field is omitted, there are no subsequent pages.
totalSize:
type: integer
- description: The total count of users (may be approximate).
+ description: The total count of settings (may be approximate).
format: int32
- ListWebhooksResponse:
+ description: Response message for ListUserSettings method.
+ ListUserWebhooksResponse:
type: object
properties:
webhooks:
type: array
items:
- $ref: '#/components/schemas/Webhook'
+ $ref: '#/components/schemas/UserWebhook'
description: The list of webhooks.
+ ListUsersResponse:
+ type: object
+ properties:
+ users:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ description: The list of users.
+ nextPageToken:
+ type: string
+ description: |-
+ A token that can be sent as `page_token` to retrieve the next page.
+ If this field is omitted, there are no subsequent pages.
+ totalSize:
+ type: integer
+ description: The total count of users (may be approximate).
+ format: int32
Location:
type: object
properties:
@@ -3314,6 +3344,55 @@ 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
@@ -3362,6 +3441,23 @@ 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:
@@ -3641,8 +3737,31 @@ components:
name:
type: string
description: |-
- The resource name of the user whose setting this is.
- Format: users/{user}
+ The name of the user setting.
+ Format: users/{user}/settings/{setting}
+ 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
+ UserSetting_AccessTokensSetting:
+ type: object
+ properties:
+ accessTokens:
+ type: array
+ items:
+ $ref: '#/components/schemas/AccessTokensSetting_AccessToken'
+ description: List of user access tokens.
+ description: User access tokens configuration.
+ UserSetting_GeneralSetting:
+ type: object
+ properties:
locale:
type: string
description: The preferred locale of the user.
@@ -3658,7 +3777,34 @@ components:
The preferred theme of the user.
This references a CSS file in the web/public/themes/ directory.
If not set, the default theme will be used.
- description: User settings message
+ description: General user settings configuration.
+ UserSetting_SessionsSetting:
+ type: object
+ properties:
+ sessions:
+ type: array
+ items:
+ $ref: '#/components/schemas/SessionsSetting_Session'
+ 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'
+ description: List of user webhooks.
+ description: User webhooks configuration.
UserStats:
type: object
properties:
@@ -3709,23 +3855,48 @@ components:
type: integer
format: int32
description: Memo type statistics.
- Webhook:
- required:
- - displayName
- - url
+ UserWebhook:
type: object
properties:
name:
type: string
description: |-
- The resource name of the webhook.
+ The name of the webhook.
Format: users/{user}/webhooks/{webhook}
+ url:
+ type: string
+ description: The URL to send the webhook to.
displayName:
type: string
- description: The display name of the webhook.
+ description: Optional. Human-readable name for the webhook.
+ createTime:
+ readOnly: true
+ type: string
+ description: The creation time of the webhook.
+ format: date-time
+ updateTime:
+ readOnly: true
+ type: string
+ 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 target URL for the webhook.
+ description: The webhook URL endpoint.
+ description: User webhook definition.
WorkspaceProfile:
type: object
properties:
@@ -3871,5 +4042,4 @@ tags:
- name: MemoService
- name: ShortcutService
- name: UserService
- - name: WebhookService
- name: WorkspaceService
diff --git a/server/router/api/v1/test/webhook_service_test.go b/server/router/api/v1/test/webhook_service_test.go
deleted file mode 100644
index 8960f94de..000000000
--- a/server/router/api/v1/test/webhook_service_test.go
+++ /dev/null
@@ -1,406 +0,0 @@
-package v1
-
-import (
- "context"
- "fmt"
- "testing"
-
- "github.com/stretchr/testify/require"
- "google.golang.org/protobuf/types/known/fieldmaskpb"
-
- v1pb "github.com/usememos/memos/proto/gen/api/v1"
-)
-
-func TestCreateWebhook(t *testing.T) {
- ctx := context.Background()
- t.Run("CreateWebhook with host user", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create and authenticate as host user
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
-
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
-
- // Create a webhook
- req := &v1pb.CreateWebhookRequest{
- Parent: fmt.Sprintf("users/%d", hostUser.ID),
- Webhook: &v1pb.Webhook{
- DisplayName: "Test Webhook",
- Url: "https://example.com/webhook",
- },
- }
-
- resp, err := ts.Service.CreateWebhook(userCtx, req)
-
- // Verify response
- require.NoError(t, err)
- require.NotNil(t, resp)
- require.Equal(t, "Test Webhook", resp.DisplayName)
- require.Equal(t, "https://example.com/webhook", resp.Url)
- require.Contains(t, resp.Name, "webhooks/")
- require.Contains(t, resp.Name, fmt.Sprintf("users/%d", hostUser.ID))
- })
-
- t.Run("CreateWebhook fails without authentication", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
- // Try to create webhook without authentication
- req := &v1pb.CreateWebhookRequest{
- Parent: "users/1", // Dummy parent since we don't have a real user
- Webhook: &v1pb.Webhook{
- DisplayName: "Test Webhook",
- Url: "https://example.com/webhook",
- },
- }
-
- _, err := ts.Service.CreateWebhook(ctx, req)
-
- // Should fail with permission denied or unauthenticated
- require.Error(t, err)
- })
-
- t.Run("CreateWebhook fails with regular user", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create and authenticate as regular user
- regularUser, err := ts.CreateRegularUser(ctx, "user1")
- require.NoError(t, err)
-
- userCtx := ts.CreateUserContext(ctx, regularUser.ID)
- // Try to create webhook as regular user
- req := &v1pb.CreateWebhookRequest{
- Parent: fmt.Sprintf("users/%d", regularUser.ID),
- Webhook: &v1pb.Webhook{
- DisplayName: "Test Webhook",
- Url: "https://example.com/webhook",
- },
- }
-
- _, err = ts.Service.CreateWebhook(userCtx, req)
-
- // Should fail with permission denied
- require.Error(t, err)
- require.Contains(t, err.Error(), "permission denied")
- })
-
- t.Run("CreateWebhook validates required fields", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create and authenticate as host user
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
-
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
- // Try to create webhook with missing URL
- req := &v1pb.CreateWebhookRequest{
- Parent: fmt.Sprintf("users/%d", hostUser.ID),
- Webhook: &v1pb.Webhook{
- DisplayName: "Test Webhook",
- // URL missing
- },
- }
-
- _, err = ts.Service.CreateWebhook(userCtx, req)
-
- // Should fail with validation error
- require.Error(t, err)
- })
-}
-
-func TestListWebhooks(t *testing.T) {
- ctx := context.Background()
-
- t.Run("ListWebhooks returns empty list initially", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create host user for authentication
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
-
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
- // List webhooks
- req := &v1pb.ListWebhooksRequest{
- Parent: fmt.Sprintf("users/%d", hostUser.ID),
- }
- resp, err := ts.Service.ListWebhooks(userCtx, req)
-
- // Verify response
- require.NoError(t, err)
- require.NotNil(t, resp)
- require.Empty(t, resp.Webhooks)
- })
-
- t.Run("ListWebhooks returns created webhooks", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create host user and authenticate
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
- // Create a webhook
- createReq := &v1pb.CreateWebhookRequest{
- Parent: fmt.Sprintf("users/%d", hostUser.ID),
- Webhook: &v1pb.Webhook{
- DisplayName: "Test Webhook",
- Url: "https://example.com/webhook",
- },
- }
- createdWebhook, err := ts.Service.CreateWebhook(userCtx, createReq)
- require.NoError(t, err)
-
- // List webhooks
- listReq := &v1pb.ListWebhooksRequest{
- Parent: fmt.Sprintf("users/%d", hostUser.ID),
- }
- resp, err := ts.Service.ListWebhooks(userCtx, listReq)
-
- // Verify response
- require.NoError(t, err)
- require.NotNil(t, resp)
- require.Len(t, resp.Webhooks, 1)
- require.Equal(t, createdWebhook.Name, resp.Webhooks[0].Name)
- require.Equal(t, createdWebhook.Url, resp.Webhooks[0].Url)
- })
-
- t.Run("ListWebhooks fails without authentication", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
- // Try to list webhooks without authentication
- req := &v1pb.ListWebhooksRequest{
- Parent: "users/1", // Dummy parent since we don't have a real user
- }
- _, err := ts.Service.ListWebhooks(ctx, req)
-
- // Should fail with permission denied or unauthenticated
- require.Error(t, err)
- })
-}
-
-func TestGetWebhook(t *testing.T) {
- ctx := context.Background()
-
- t.Run("GetWebhook returns webhook by name", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create host user and authenticate
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
- // Create a webhook
- createReq := &v1pb.CreateWebhookRequest{
- Parent: fmt.Sprintf("users/%d", hostUser.ID),
- Webhook: &v1pb.Webhook{
- DisplayName: "Test Webhook",
- Url: "https://example.com/webhook",
- },
- }
- createdWebhook, err := ts.Service.CreateWebhook(userCtx, createReq)
- require.NoError(t, err)
-
- // Get the webhook
- getReq := &v1pb.GetWebhookRequest{
- Name: createdWebhook.Name,
- }
- resp, err := ts.Service.GetWebhook(userCtx, getReq)
- // Verify response
- require.NoError(t, err)
- require.NotNil(t, resp)
- require.Equal(t, createdWebhook.Name, resp.Name)
- require.Equal(t, createdWebhook.Url, resp.Url)
- })
-
- t.Run("GetWebhook fails with invalid name", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create host user and authenticate
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
-
- // Try to get webhook with invalid name
- req := &v1pb.GetWebhookRequest{
- Name: "invalid/webhook/name",
- }
- _, err = ts.Service.GetWebhook(userCtx, req)
-
- // Should return an error
- require.Error(t, err)
- })
-
- t.Run("GetWebhook fails with non-existent webhook", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create host user and authenticate
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
- // Try to get non-existent webhook
- req := &v1pb.GetWebhookRequest{
- Name: fmt.Sprintf("users/%d/webhooks/999", hostUser.ID),
- }
- _, err = ts.Service.GetWebhook(userCtx, req)
-
- // Should return not found error
- require.Error(t, err)
- require.Contains(t, err.Error(), "not found")
- })
-}
-
-func TestUpdateWebhook(t *testing.T) {
- ctx := context.Background()
-
- t.Run("UpdateWebhook updates webhook properties", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create host user and authenticate
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
- // Create a webhook
- createReq := &v1pb.CreateWebhookRequest{
- Parent: fmt.Sprintf("users/%d", hostUser.ID),
- Webhook: &v1pb.Webhook{
- DisplayName: "Original Webhook",
- Url: "https://example.com/webhook",
- },
- }
- createdWebhook, err := ts.Service.CreateWebhook(userCtx, createReq)
- require.NoError(t, err)
-
- // Update the webhook
- updateReq := &v1pb.UpdateWebhookRequest{
- Webhook: &v1pb.Webhook{
- Name: createdWebhook.Name,
- Url: "https://updated.example.com/webhook",
- },
- UpdateMask: &fieldmaskpb.FieldMask{
- Paths: []string{"url"},
- },
- }
- resp, err := ts.Service.UpdateWebhook(userCtx, updateReq)
-
- // Verify response
- require.NoError(t, err)
- require.NotNil(t, resp)
- require.Equal(t, createdWebhook.Name, resp.Name)
- require.Equal(t, "https://updated.example.com/webhook", resp.Url)
- })
-
- t.Run("UpdateWebhook fails without authentication", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
- // Try to update webhook without authentication
- req := &v1pb.UpdateWebhookRequest{
- Webhook: &v1pb.Webhook{
- Name: "users/1/webhooks/1",
- Url: "https://updated.example.com/webhook",
- },
- }
-
- _, err := ts.Service.UpdateWebhook(ctx, req)
-
- // Should fail with permission denied or unauthenticated
- require.Error(t, err)
- })
-}
-
-func TestDeleteWebhook(t *testing.T) {
- ctx := context.Background()
- t.Run("DeleteWebhook removes webhook", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create host user and authenticate
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
-
- // Create a webhook
- createReq := &v1pb.CreateWebhookRequest{
- Parent: fmt.Sprintf("users/%d", hostUser.ID),
- Webhook: &v1pb.Webhook{
- DisplayName: "Test Webhook",
- Url: "https://example.com/webhook",
- },
- }
- createdWebhook, err := ts.Service.CreateWebhook(userCtx, createReq)
- require.NoError(t, err)
-
- // Delete the webhook
- deleteReq := &v1pb.DeleteWebhookRequest{
- Name: createdWebhook.Name,
- }
- _, err = ts.Service.DeleteWebhook(userCtx, deleteReq)
-
- // Verify deletion
- require.NoError(t, err)
-
- // Try to get the deleted webhook
- getReq := &v1pb.GetWebhookRequest{
- Name: createdWebhook.Name,
- }
- _, err = ts.Service.GetWebhook(userCtx, getReq)
-
- // Should return not found error
- require.Error(t, err)
- require.Contains(t, err.Error(), "not found")
- })
-
- t.Run("DeleteWebhook fails without authentication", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
- // Try to delete webhook without authentication
- req := &v1pb.DeleteWebhookRequest{
- Name: "users/1/webhooks/1",
- }
-
- _, err := ts.Service.DeleteWebhook(ctx, req)
-
- // Should fail with permission denied or unauthenticated
- require.Error(t, err)
- })
-
- t.Run("DeleteWebhook fails with non-existent webhook", func(t *testing.T) {
- // Create test service for this specific test
- ts := NewTestService(t)
- defer ts.Cleanup()
-
- // Create host user and authenticate
- hostUser, err := ts.CreateHostUser(ctx, "admin")
- require.NoError(t, err)
- userCtx := ts.CreateUserContext(ctx, hostUser.ID)
- // Try to delete non-existent webhook
- req := &v1pb.DeleteWebhookRequest{
- Name: fmt.Sprintf("users/%d/webhooks/999", hostUser.ID),
- }
- _, err = ts.Service.DeleteWebhook(userCtx, req)
-
- // Should return not found error
- require.Error(t, err)
- require.Contains(t, err.Error(), "not found")
- })
-}
diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go
index 74cacf67b..787540f4b 100644
--- a/server/router/api/v1/user_service.go
+++ b/server/router/api/v1/user_service.go
@@ -2,11 +2,14 @@ package v1
import (
"context"
+ "crypto/rand"
"encoding/base64"
+ "encoding/hex"
"fmt"
"net/http"
"regexp"
"slices"
+ "strconv"
"strings"
"time"
@@ -21,6 +24,7 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"
"github.com/usememos/memos/internal/base"
+ "github.com/usememos/memos/internal/util"
v1pb "github.com/usememos/memos/proto/gen/api/v1"
storepb "github.com/usememos/memos/proto/gen/store"
"github.com/usememos/memos/store"
@@ -329,9 +333,8 @@ func (s *APIV1Service) DeleteUser(ctx context.Context, request *v1pb.DeleteUserR
return &emptypb.Empty{}, nil
}
-func getDefaultUserSetting() *v1pb.UserSetting {
- return &v1pb.UserSetting{
- Name: "", // Will be set by caller
+func getDefaultUserGeneralSetting() *v1pb.UserSetting_GeneralSetting {
+ return &v1pb.UserSetting_GeneralSetting{
Locale: "en",
Appearance: "system",
MemoVisibility: "PRIVATE",
@@ -340,9 +343,10 @@ func getDefaultUserSetting() *v1pb.UserSetting {
}
func (s *APIV1Service) GetUserSetting(ctx context.Context, request *v1pb.GetUserSettingRequest) (*v1pb.UserSetting, error) {
- userID, err := ExtractUserIDFromName(request.Name)
+ // Parse resource name: users/{user}/settings/{setting}
+ userID, settingKey, err := ExtractUserIDAndSettingKeyFromName(request.Name)
if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err)
+ return nil, status.Errorf(codes.InvalidArgument, "invalid resource name: %v", err)
}
currentUser, err := s.GetCurrentUser(ctx)
@@ -355,49 +359,28 @@ func (s *APIV1Service) GetUserSetting(ctx context.Context, request *v1pb.GetUser
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
}
- userSettings, err := s.Store.ListUserSettings(ctx, &store.FindUserSetting{
- UserID: &userID,
- })
+ // Convert setting key string to store enum
+ storeKey, err := convertSettingKeyToStore(settingKey)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to list user settings: %v", err)
- }
-
- userSettingMessage := getDefaultUserSetting()
- userSettingMessage.Name = fmt.Sprintf("users/%d", userID)
-
- for _, setting := range userSettings {
- if setting.Key == storepb.UserSetting_GENERAL {
- general := setting.GetGeneral()
- if general != nil {
- userSettingMessage.Locale = general.Locale
- userSettingMessage.Appearance = general.Appearance
- userSettingMessage.MemoVisibility = general.MemoVisibility
- userSettingMessage.Theme = general.Theme
- }
- }
+ return nil, status.Errorf(codes.InvalidArgument, "invalid setting key: %v", err)
}
- // Backfill theme if empty: use workspace theme or default to "default"
- if userSettingMessage.Theme == "" {
- workspaceGeneralSetting, err := s.Store.GetWorkspaceGeneralSetting(ctx)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace general setting: %v", err)
- }
- workspaceTheme := workspaceGeneralSetting.Theme
- if workspaceTheme == "" {
- workspaceTheme = "default"
- }
- userSettingMessage.Theme = workspaceTheme
+ userSetting, err := s.Store.GetUserSetting(ctx, &store.FindUserSetting{
+ UserID: &userID,
+ Key: storeKey,
+ })
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get user setting: %v", err)
}
- return userSettingMessage, nil
+ return convertUserSettingFromStore(userSetting, userID, storeKey), nil
}
func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.UpdateUserSettingRequest) (*v1pb.UserSetting, error) {
- // Extract user ID from the setting resource name
- userID, err := ExtractUserIDFromName(request.Setting.Name)
+ // Parse resource name: users/{user}/settings/{setting}
+ userID, settingKey, err := ExtractUserIDAndSettingKeyFromName(request.Setting.Name)
if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err)
+ return nil, status.Errorf(codes.InvalidArgument, "invalid resource name: %v", err)
}
currentUser, err := s.GetCurrentUser(ctx)
@@ -414,60 +397,81 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda
return nil, status.Errorf(codes.InvalidArgument, "update mask is empty")
}
- // Get the current general setting
- existingGeneralSetting, err := s.Store.GetUserSetting(ctx, &store.FindUserSetting{
+ // Convert setting key string to store enum
+ storeKey, err := convertSettingKeyToStore(settingKey)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid setting key: %v", err)
+ }
+
+ // Convert API setting to store setting
+ storeSetting, err := convertUserSettingToStore(request.Setting, userID, storeKey)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "failed to convert setting: %v", err)
+ }
+
+ // Upsert the setting
+ if _, err := s.Store.UpsertUserSetting(ctx, storeSetting); err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to upsert user setting: %v", err)
+ }
+
+ return s.GetUserSetting(ctx, &v1pb.GetUserSettingRequest{Name: request.Setting.Name})
+}
+
+func (s *APIV1Service) ListUserSettings(ctx context.Context, request *v1pb.ListUserSettingsRequest) (*v1pb.ListUserSettingsResponse, error) {
+ userID, err := ExtractUserIDFromName(request.Parent)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid parent name: %v", err)
+ }
+
+ currentUser, err := s.GetCurrentUser(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
+ }
+
+ // Only allow user to list their own settings
+ if currentUser.ID != userID {
+ return nil, status.Errorf(codes.PermissionDenied, "permission denied")
+ }
+
+ userSettings, err := s.Store.ListUserSettings(ctx, &store.FindUserSetting{
UserID: &userID,
- Key: storepb.UserSetting_GENERAL,
})
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get existing general setting: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to list user settings: %v", err)
}
- // Create or update the general setting
- generalSetting := &storepb.GeneralUserSetting{
- Locale: "en",
- Appearance: "system",
- MemoVisibility: "PRIVATE",
- Theme: "",
+ settings := make([]*v1pb.UserSetting, 0, len(userSettings))
+ for _, storeSetting := range userSettings {
+ apiSetting := convertUserSettingFromStore(storeSetting, userID, storeSetting.Key)
+ if apiSetting != nil {
+ settings = append(settings, apiSetting)
+ }
}
- // If there's an existing setting, use its values as defaults
- if existingGeneralSetting != nil && existingGeneralSetting.GetGeneral() != nil {
- existing := existingGeneralSetting.GetGeneral()
- generalSetting.Locale = existing.Locale
- generalSetting.Appearance = existing.Appearance
- generalSetting.MemoVisibility = existing.MemoVisibility
- generalSetting.Theme = existing.Theme
+ // If no general setting exists, add a default one
+ hasGeneral := false
+ for _, setting := range settings {
+ if setting.GetGeneralSetting() != nil {
+ hasGeneral = true
+ break
+ }
}
-
- // Apply updates based on the update mask
- for _, field := range request.UpdateMask.Paths {
- switch field {
- case "locale":
- generalSetting.Locale = request.Setting.Locale
- case "appearance":
- generalSetting.Appearance = request.Setting.Appearance
- case "memo_visibility":
- generalSetting.MemoVisibility = request.Setting.MemoVisibility
- case "theme":
- generalSetting.Theme = request.Setting.Theme
- default:
- return nil, status.Errorf(codes.InvalidArgument, "invalid update path: %s", field)
+ if !hasGeneral {
+ defaultGeneral := &v1pb.UserSetting{
+ Name: fmt.Sprintf("users/%d/settings/general", userID),
+ Value: &v1pb.UserSetting_GeneralSetting_{
+ GeneralSetting: getDefaultUserGeneralSetting(),
+ },
}
+ settings = append([]*v1pb.UserSetting{defaultGeneral}, settings...)
}
- // Upsert the general setting
- if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{
- UserId: userID,
- Key: storepb.UserSetting_GENERAL,
- Value: &storepb.UserSetting_General{
- General: generalSetting,
- },
- }); err != nil {
- return nil, status.Errorf(codes.Internal, "failed to upsert user setting: %v", err)
+ response := &v1pb.ListUserSettingsResponse{
+ Settings: settings,
+ TotalSize: int32(len(settings)),
}
- return s.GetUserSetting(ctx, &v1pb.GetUserSettingRequest{Name: request.Setting.Name})
+ return response, nil
}
func (s *APIV1Service) ListUserAccessTokens(ctx context.Context, request *v1pb.ListUserAccessTokensRequest) (*v1pb.ListUserAccessTokensResponse, error) {
@@ -767,6 +771,216 @@ func (s *APIV1Service) UpsertAccessTokenToStore(ctx context.Context, user *store
return nil
}
+func (s *APIV1Service) ListUserWebhooks(ctx context.Context, request *v1pb.ListUserWebhooksRequest) (*v1pb.ListUserWebhooksResponse, error) {
+ userID, err := ExtractUserIDFromName(request.Parent)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid parent: %v", err)
+ }
+
+ currentUser, err := s.GetCurrentUser(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
+ }
+ if currentUser.ID != userID && currentUser.Role != store.RoleHost && currentUser.Role != store.RoleAdmin {
+ return nil, status.Errorf(codes.PermissionDenied, "permission denied")
+ }
+
+ webhooks, err := s.Store.GetUserWebhooks(ctx, userID)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get user webhooks: %v", err)
+ }
+
+ userWebhooks := make([]*v1pb.UserWebhook, 0, len(webhooks))
+ for _, webhook := range webhooks {
+ userWebhooks = append(userWebhooks, convertUserWebhookFromUserSetting(webhook, userID))
+ }
+
+ return &v1pb.ListUserWebhooksResponse{
+ Webhooks: userWebhooks,
+ }, nil
+}
+
+func (s *APIV1Service) CreateUserWebhook(ctx context.Context, request *v1pb.CreateUserWebhookRequest) (*v1pb.UserWebhook, error) {
+ userID, err := ExtractUserIDFromName(request.Parent)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid parent: %v", err)
+ }
+
+ currentUser, err := s.GetCurrentUser(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
+ }
+ if currentUser.ID != userID && currentUser.Role != store.RoleHost && currentUser.Role != store.RoleAdmin {
+ return nil, status.Errorf(codes.PermissionDenied, "permission denied")
+ }
+
+ if request.Webhook.Url == "" {
+ return nil, status.Errorf(codes.InvalidArgument, "webhook URL is required")
+ }
+
+ webhookID := generateUserWebhookID()
+ webhook := &storepb.WebhooksUserSetting_Webhook{
+ Id: webhookID,
+ Title: request.Webhook.DisplayName,
+ Url: strings.TrimSpace(request.Webhook.Url),
+ }
+
+ err = s.Store.AddUserWebhook(ctx, userID, webhook)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to create webhook: %v", err)
+ }
+
+ return convertUserWebhookFromUserSetting(webhook, userID), nil
+}
+
+func (s *APIV1Service) UpdateUserWebhook(ctx context.Context, request *v1pb.UpdateUserWebhookRequest) (*v1pb.UserWebhook, error) {
+ if request.Webhook == nil {
+ return nil, status.Errorf(codes.InvalidArgument, "webhook is required")
+ }
+
+ webhookID, userID, err := parseUserWebhookName(request.Webhook.Name)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err)
+ }
+
+ currentUser, err := s.GetCurrentUser(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
+ }
+ if currentUser.ID != userID && currentUser.Role != store.RoleHost && currentUser.Role != store.RoleAdmin {
+ return nil, status.Errorf(codes.PermissionDenied, "permission denied")
+ }
+
+ // Get existing webhooks
+ webhooks, err := s.Store.GetUserWebhooks(ctx, userID)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get user webhooks: %v", err)
+ }
+
+ // Find the webhook to update
+ var targetWebhook *storepb.WebhooksUserSetting_Webhook
+ for _, webhook := range webhooks {
+ if webhook.Id == webhookID {
+ targetWebhook = webhook
+ break
+ }
+ }
+
+ if targetWebhook == nil {
+ return nil, status.Errorf(codes.NotFound, "webhook not found")
+ }
+
+ // Update the webhook
+ updatedWebhook := &storepb.WebhooksUserSetting_Webhook{
+ Id: webhookID,
+ Title: targetWebhook.Title,
+ Url: targetWebhook.Url,
+ }
+
+ if request.UpdateMask != nil {
+ for _, path := range request.UpdateMask.Paths {
+ switch path {
+ case "url":
+ if request.Webhook.Url != "" {
+ updatedWebhook.Url = strings.TrimSpace(request.Webhook.Url)
+ }
+ case "display_name":
+ updatedWebhook.Title = request.Webhook.DisplayName
+ }
+ }
+ } else {
+ // If no update mask is provided, update all fields
+ if request.Webhook.Url != "" {
+ updatedWebhook.Url = strings.TrimSpace(request.Webhook.Url)
+ }
+ updatedWebhook.Title = request.Webhook.DisplayName
+ }
+
+ err = s.Store.UpdateUserWebhook(ctx, userID, updatedWebhook)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to update webhook: %v", err)
+ }
+
+ return convertUserWebhookFromUserSetting(updatedWebhook, userID), nil
+}
+
+func (s *APIV1Service) DeleteUserWebhook(ctx context.Context, request *v1pb.DeleteUserWebhookRequest) (*emptypb.Empty, error) {
+ webhookID, userID, err := parseUserWebhookName(request.Name)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err)
+ }
+
+ currentUser, err := s.GetCurrentUser(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
+ }
+ if currentUser.ID != userID && currentUser.Role != store.RoleHost && currentUser.Role != store.RoleAdmin {
+ return nil, status.Errorf(codes.PermissionDenied, "permission denied")
+ }
+
+ // Get existing webhooks to verify the webhook exists
+ webhooks, err := s.Store.GetUserWebhooks(ctx, userID)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get user webhooks: %v", err)
+ }
+
+ // Check if webhook exists
+ found := false
+ for _, webhook := range webhooks {
+ if webhook.Id == webhookID {
+ found = true
+ break
+ }
+ }
+
+ if !found {
+ return nil, status.Errorf(codes.NotFound, "webhook not found")
+ }
+
+ err = s.Store.RemoveUserWebhook(ctx, userID, webhookID)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to delete webhook: %v", err)
+ }
+
+ return &emptypb.Empty{}, nil
+}
+
+// Helper functions for webhook operations
+
+// generateUserWebhookID generates a unique ID for user webhooks
+func generateUserWebhookID() string {
+ b := make([]byte, 8)
+ rand.Read(b)
+ return hex.EncodeToString(b)
+}
+
+// parseUserWebhookName parses a webhook name and returns the webhook ID and user ID
+// Format: users/{user}/webhooks/{webhook}
+func parseUserWebhookName(name string) (string, int32, error) {
+ parts := strings.Split(name, "/")
+ if len(parts) != 4 || parts[0] != "users" || parts[2] != "webhooks" {
+ return "", 0, errors.New("invalid webhook name format")
+ }
+
+ userID, err := strconv.ParseInt(parts[1], 10, 32)
+ if err != nil {
+ return "", 0, errors.New("invalid user ID in webhook name")
+ }
+
+ return parts[3], int32(userID), nil
+}
+
+// convertUserWebhookFromUserSetting converts a storepb webhook to a v1pb UserWebhook
+func convertUserWebhookFromUserSetting(webhook *storepb.WebhooksUserSetting_Webhook, userID int32) *v1pb.UserWebhook {
+ return &v1pb.UserWebhook{
+ Name: fmt.Sprintf("users/%d/webhooks/%s", userID, webhook.Id),
+ Url: webhook.Url,
+ DisplayName: webhook.Title,
+ // Note: create_time and update_time are not available in the user setting webhook structure
+ // This is a limitation of storing webhooks in user settings vs the dedicated webhook table
+ }
+}
+
func convertUserFromStore(user *store.User) *v1pb.User {
userpb := &v1pb.User{
Name: fmt.Sprintf("%s%d", UserNamePrefix, user.ID),
@@ -829,3 +1043,307 @@ func extractImageInfo(dataURI string) (string, string, error) {
base64Data := matches[2]
return imageType, base64Data, nil
}
+
+// Helper functions for user settings
+
+// ExtractUserIDAndSettingKeyFromName extracts user ID and setting key from resource name
+// e.g., "users/123/settings/general" -> 123, "general"
+func ExtractUserIDAndSettingKeyFromName(name string) (int32, string, error) {
+ // Expected format: users/{user}/settings/{setting}
+ parts := strings.Split(name, "/")
+ if len(parts) != 4 || parts[0] != "users" || parts[2] != "settings" {
+ return 0, "", errors.Errorf("invalid resource name format: %s", name)
+ }
+
+ userID, err := util.ConvertStringToInt32(parts[1])
+ if err != nil {
+ return 0, "", errors.Errorf("invalid user ID: %s", parts[1])
+ }
+
+ settingKey := parts[3]
+ return userID, settingKey, nil
+}
+
+// convertSettingKeyToStore converts API setting key to store enum
+func convertSettingKeyToStore(key string) (storepb.UserSetting_Key, error) {
+ switch key {
+ case "general":
+ return storepb.UserSetting_GENERAL, nil
+ case "sessions":
+ return storepb.UserSetting_SESSIONS, nil
+ case "access-tokens":
+ return storepb.UserSetting_ACCESS_TOKENS, nil
+ case "shortcuts":
+ return storepb.UserSetting_SHORTCUTS, nil
+ case "webhooks":
+ return storepb.UserSetting_WEBHOOKS, nil
+ default:
+ return storepb.UserSetting_KEY_UNSPECIFIED, errors.Errorf("unknown setting key: %s", key)
+ }
+}
+
+// convertSettingKeyFromStore converts store enum to API setting key
+func convertSettingKeyFromStore(key storepb.UserSetting_Key) string {
+ switch key {
+ case storepb.UserSetting_GENERAL:
+ return "general"
+ case storepb.UserSetting_SESSIONS:
+ return "sessions"
+ case storepb.UserSetting_ACCESS_TOKENS:
+ return "access-tokens"
+ case storepb.UserSetting_SHORTCUTS:
+ return "shortcuts"
+ case storepb.UserSetting_WEBHOOKS:
+ return "webhooks"
+ default:
+ return "unknown"
+ }
+}
+
+// convertUserSettingFromStore converts store UserSetting to API UserSetting
+func convertUserSettingFromStore(storeSetting *storepb.UserSetting, userID int32, key storepb.UserSetting_Key) *v1pb.UserSetting {
+ if storeSetting == nil {
+ // Return default setting if none exists
+ settingKey := convertSettingKeyFromStore(key)
+ setting := &v1pb.UserSetting{
+ Name: fmt.Sprintf("users/%d/settings/%s", userID, settingKey),
+ }
+
+ switch key {
+ case storepb.UserSetting_GENERAL:
+ setting.Value = &v1pb.UserSetting_GeneralSetting_{
+ GeneralSetting: getDefaultUserGeneralSetting(),
+ }
+ case storepb.UserSetting_SESSIONS:
+ setting.Value = &v1pb.UserSetting_SessionsSetting_{
+ SessionsSetting: &v1pb.UserSetting_SessionsSetting{
+ Sessions: []*v1pb.UserSetting_SessionsSetting_Session{},
+ },
+ }
+ 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{},
+ },
+ }
+ case storepb.UserSetting_WEBHOOKS:
+ setting.Value = &v1pb.UserSetting_WebhooksSetting_{
+ WebhooksSetting: &v1pb.UserSetting_WebhooksSetting{
+ Webhooks: []*v1pb.UserSetting_WebhooksSetting_Webhook{},
+ },
+ }
+ }
+ return setting
+ }
+
+ settingKey := convertSettingKeyFromStore(storeSetting.Key)
+ setting := &v1pb.UserSetting{
+ Name: fmt.Sprintf("users/%d/settings/%s", userID, settingKey),
+ }
+
+ switch storeSetting.Key {
+ case storepb.UserSetting_GENERAL:
+ if general := storeSetting.GetGeneral(); general != nil {
+ setting.Value = &v1pb.UserSetting_GeneralSetting_{
+ GeneralSetting: &v1pb.UserSetting_GeneralSetting{
+ Locale: general.Locale,
+ Appearance: general.Appearance,
+ MemoVisibility: general.MemoVisibility,
+ Theme: general.Theme,
+ },
+ }
+ } else {
+ setting.Value = &v1pb.UserSetting_GeneralSetting_{
+ GeneralSetting: getDefaultUserGeneralSetting(),
+ }
+ }
+ case storepb.UserSetting_SESSIONS:
+ sessions := storeSetting.GetSessions()
+ apiSessions := make([]*v1pb.UserSetting_SessionsSetting_Session, 0, len(sessions.Sessions))
+ for _, session := range sessions.Sessions {
+ apiSession := &v1pb.UserSetting_SessionsSetting_Session{
+ SessionId: session.SessionId,
+ CreateTime: session.CreateTime,
+ LastAccessedTime: session.LastAccessedTime,
+ ClientInfo: &v1pb.UserSetting_SessionsSetting_ClientInfo{
+ UserAgent: session.ClientInfo.UserAgent,
+ IpAddress: session.ClientInfo.IpAddress,
+ DeviceType: session.ClientInfo.DeviceType,
+ Os: session.ClientInfo.Os,
+ Browser: session.ClientInfo.Browser,
+ },
+ }
+ apiSessions = append(apiSessions, apiSession)
+ }
+ setting.Value = &v1pb.UserSetting_SessionsSetting_{
+ SessionsSetting: &v1pb.UserSetting_SessionsSetting{
+ Sessions: apiSessions,
+ },
+ }
+ case storepb.UserSetting_ACCESS_TOKENS:
+ accessTokens := storeSetting.GetAccessTokens()
+ apiTokens := make([]*v1pb.UserSetting_AccessTokensSetting_AccessToken, 0, len(accessTokens.AccessTokens))
+ for _, token := range accessTokens.AccessTokens {
+ apiToken := &v1pb.UserSetting_AccessTokensSetting_AccessToken{
+ AccessToken: token.AccessToken,
+ Description: token.Description,
+ }
+ apiTokens = append(apiTokens, apiToken)
+ }
+ setting.Value = &v1pb.UserSetting_AccessTokensSetting_{
+ AccessTokensSetting: &v1pb.UserSetting_AccessTokensSetting{
+ 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))
+ for _, webhook := range webhooks.Webhooks {
+ apiWebhook := &v1pb.UserSetting_WebhooksSetting_Webhook{
+ Id: webhook.Id,
+ Title: webhook.Title,
+ Url: webhook.Url,
+ }
+ apiWebhooks = append(apiWebhooks, apiWebhook)
+ }
+ setting.Value = &v1pb.UserSetting_WebhooksSetting_{
+ WebhooksSetting: &v1pb.UserSetting_WebhooksSetting{
+ Webhooks: apiWebhooks,
+ },
+ }
+ }
+
+ return setting
+}
+
+// convertUserSettingToStore converts API UserSetting to store UserSetting
+func convertUserSettingToStore(apiSetting *v1pb.UserSetting, userID int32, key storepb.UserSetting_Key) (*storepb.UserSetting, error) {
+ storeSetting := &storepb.UserSetting{
+ UserId: userID,
+ Key: key,
+ }
+
+ switch key {
+ case storepb.UserSetting_GENERAL:
+ if general := apiSetting.GetGeneralSetting(); general != nil {
+ storeSetting.Value = &storepb.UserSetting_General{
+ General: &storepb.GeneralUserSetting{
+ Locale: general.Locale,
+ Appearance: general.Appearance,
+ MemoVisibility: general.MemoVisibility,
+ Theme: general.Theme,
+ },
+ }
+ } else {
+ return nil, errors.Errorf("general setting is required")
+ }
+ case storepb.UserSetting_SESSIONS:
+ if sessions := apiSetting.GetSessionsSetting(); sessions != nil {
+ storeSessions := make([]*storepb.SessionsUserSetting_Session, 0, len(sessions.Sessions))
+ for _, session := range sessions.Sessions {
+ storeSession := &storepb.SessionsUserSetting_Session{
+ SessionId: session.SessionId,
+ CreateTime: session.CreateTime,
+ LastAccessedTime: session.LastAccessedTime,
+ ClientInfo: &storepb.SessionsUserSetting_ClientInfo{
+ UserAgent: session.ClientInfo.UserAgent,
+ IpAddress: session.ClientInfo.IpAddress,
+ DeviceType: session.ClientInfo.DeviceType,
+ Os: session.ClientInfo.Os,
+ Browser: session.ClientInfo.Browser,
+ },
+ }
+ storeSessions = append(storeSessions, storeSession)
+ }
+ storeSetting.Value = &storepb.UserSetting_Sessions{
+ Sessions: &storepb.SessionsUserSetting{
+ Sessions: storeSessions,
+ },
+ }
+ } else {
+ return nil, errors.Errorf("sessions setting is required")
+ }
+ case storepb.UserSetting_ACCESS_TOKENS:
+ if accessTokens := apiSetting.GetAccessTokensSetting(); accessTokens != nil {
+ storeTokens := make([]*storepb.AccessTokensUserSetting_AccessToken, 0, len(accessTokens.AccessTokens))
+ for _, token := range accessTokens.AccessTokens {
+ storeToken := &storepb.AccessTokensUserSetting_AccessToken{
+ AccessToken: token.AccessToken,
+ Description: token.Description,
+ }
+ storeTokens = append(storeTokens, storeToken)
+ }
+ storeSetting.Value = &storepb.UserSetting_AccessTokens{
+ AccessTokens: &storepb.AccessTokensUserSetting{
+ AccessTokens: storeTokens,
+ },
+ }
+ } 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,
+ Url: webhook.Url,
+ }
+ storeWebhooks = append(storeWebhooks, storeWebhook)
+ }
+ storeSetting.Value = &storepb.UserSetting_Webhooks{
+ Webhooks: &storepb.WebhooksUserSetting{
+ Webhooks: storeWebhooks,
+ },
+ }
+ } else {
+ return nil, errors.Errorf("webhooks setting is required")
+ }
+ default:
+ return nil, errors.Errorf("unsupported setting key: %v", key)
+ }
+
+ return storeSetting, nil
+}
diff --git a/server/router/api/v1/user_service_stats.go b/server/router/api/v1/user_service_stats.go
index 775f6f189..95583aceb 100644
--- a/server/router/api/v1/user_service_stats.go
+++ b/server/router/api/v1/user_service_stats.go
@@ -65,7 +65,7 @@ func (s *APIV1Service) ListAllUserStats(ctx context.Context, _ *v1pb.ListAllUser
}
response := &v1pb.ListAllUserStatsResponse{
- UserStats: userMemoStats,
+ Stats: userMemoStats,
}
return response, nil
}
diff --git a/server/router/api/v1/v1.go b/server/router/api/v1/v1.go
index 2cdfe49d2..962356e96 100644
--- a/server/router/api/v1/v1.go
+++ b/server/router/api/v1/v1.go
@@ -30,7 +30,6 @@ type APIV1Service struct {
v1pb.UnimplementedShortcutServiceServer
v1pb.UnimplementedInboxServiceServer
v1pb.UnimplementedActivityServiceServer
- v1pb.UnimplementedWebhookServiceServer
v1pb.UnimplementedMarkdownServiceServer
v1pb.UnimplementedIdentityProviderServiceServer
@@ -58,7 +57,6 @@ func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store
v1pb.RegisterShortcutServiceServer(grpcServer, apiv1Service)
v1pb.RegisterInboxServiceServer(grpcServer, apiv1Service)
v1pb.RegisterActivityServiceServer(grpcServer, apiv1Service)
- v1pb.RegisterWebhookServiceServer(grpcServer, apiv1Service)
v1pb.RegisterMarkdownServiceServer(grpcServer, apiv1Service)
v1pb.RegisterIdentityProviderServiceServer(grpcServer, apiv1Service)
reflection.Register(grpcServer)
@@ -107,9 +105,6 @@ func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Ech
if err := v1pb.RegisterActivityServiceHandler(ctx, gwMux, conn); err != nil {
return err
}
- if err := v1pb.RegisterWebhookServiceHandler(ctx, gwMux, conn); err != nil {
- return err
- }
if err := v1pb.RegisterMarkdownServiceHandler(ctx, gwMux, conn); err != nil {
return err
}
diff --git a/server/router/api/v1/webhook_service.go b/server/router/api/v1/webhook_service.go
deleted file mode 100644
index 9b6768f99..000000000
--- a/server/router/api/v1/webhook_service.go
+++ /dev/null
@@ -1,317 +0,0 @@
-package v1
-
-import (
- "context"
- "crypto/rand"
- "encoding/hex"
- "fmt"
- "strings"
-
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
- "google.golang.org/protobuf/types/known/emptypb"
-
- "github.com/usememos/memos/internal/util"
- v1pb "github.com/usememos/memos/proto/gen/api/v1"
- storepb "github.com/usememos/memos/proto/gen/store"
-)
-
-func (s *APIV1Service) CreateWebhook(ctx context.Context, request *v1pb.CreateWebhookRequest) (*v1pb.Webhook, error) {
- currentUser, err := s.GetCurrentUser(ctx)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
- }
- if currentUser == nil {
- return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
- }
-
- // Extract user ID from parent (format: users/{user})
- parentUserID, err := ExtractUserIDFromName(request.Parent)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid parent: %v", err)
- }
-
- // Users can only create webhooks for themselves
- if parentUserID != currentUser.ID {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied")
- }
-
- // Only host users can create webhooks
- if !isSuperUser(currentUser) {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied")
- }
-
- // Validate required fields
- if request.Webhook == nil {
- return nil, status.Errorf(codes.InvalidArgument, "webhook is required")
- }
- if strings.TrimSpace(request.Webhook.Url) == "" {
- return nil, status.Errorf(codes.InvalidArgument, "webhook URL is required")
- }
-
- // Handle validate_only field
- if request.ValidateOnly {
- // Perform validation checks without actually creating the webhook
- return &v1pb.Webhook{
- Name: fmt.Sprintf("users/%d/webhooks/validate", currentUser.ID),
- DisplayName: request.Webhook.DisplayName,
- Url: request.Webhook.Url,
- }, nil
- }
-
- err = s.Store.AddUserWebhook(ctx, currentUser.ID, &storepb.WebhooksUserSetting_Webhook{
- Id: generateWebhookID(),
- Title: request.Webhook.DisplayName,
- Url: strings.TrimSpace(request.Webhook.Url),
- })
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to create webhook, error: %+v", err)
- }
-
- // Return the newly created webhook
- webhooks, err := s.Store.GetUserWebhooks(ctx, currentUser.ID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get user webhooks, error: %+v", err)
- }
-
- // Find the webhook we just created
- for _, webhook := range webhooks {
- if webhook.Title == request.Webhook.DisplayName && webhook.Url == strings.TrimSpace(request.Webhook.Url) {
- return convertWebhookFromUserSetting(webhook, currentUser.ID), nil
- }
- }
-
- return nil, status.Errorf(codes.Internal, "failed to find created webhook")
-}
-
-func (s *APIV1Service) ListWebhooks(ctx context.Context, request *v1pb.ListWebhooksRequest) (*v1pb.ListWebhooksResponse, error) {
- currentUser, err := s.GetCurrentUser(ctx)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
- }
- if currentUser == nil {
- return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
- }
-
- // Extract user ID from parent (format: users/{user})
- parentUserID, err := ExtractUserIDFromName(request.Parent)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid parent: %v", err)
- }
-
- // Users can only list their own webhooks
- if parentUserID != currentUser.ID {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied")
- }
-
- webhooks, err := s.Store.GetUserWebhooks(ctx, currentUser.ID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to list webhooks, error: %+v", err)
- }
-
- response := &v1pb.ListWebhooksResponse{
- Webhooks: []*v1pb.Webhook{},
- }
- for _, webhook := range webhooks {
- response.Webhooks = append(response.Webhooks, convertWebhookFromUserSetting(webhook, currentUser.ID))
- }
- return response, nil
-}
-
-func (s *APIV1Service) GetWebhook(ctx context.Context, request *v1pb.GetWebhookRequest) (*v1pb.Webhook, error) {
- // Extract user ID and webhook ID from name (format: users/{user}/webhooks/{webhook})
- tokens, err := GetNameParentTokens(request.Name, UserNamePrefix, WebhookNamePrefix)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err)
- }
- if len(tokens) != 2 {
- return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name format")
- }
-
- userIDStr := tokens[0]
- webhookID := tokens[1]
-
- requestedUserID, err := util.ConvertStringToInt32(userIDStr)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid user ID in webhook name: %v", err)
- }
-
- currentUser, err := s.GetCurrentUser(ctx)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
- }
- if currentUser == nil {
- return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
- }
-
- // Users can only access their own webhooks
- if requestedUserID != currentUser.ID {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied")
- }
-
- webhooks, err := s.Store.GetUserWebhooks(ctx, currentUser.ID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get webhooks, error: %+v", err)
- }
-
- // Find webhook by ID
- for _, webhook := range webhooks {
- if webhook.Id == webhookID {
- return convertWebhookFromUserSetting(webhook, currentUser.ID), nil
- }
- }
- return nil, status.Errorf(codes.NotFound, "webhook not found")
-}
-
-func (s *APIV1Service) UpdateWebhook(ctx context.Context, request *v1pb.UpdateWebhookRequest) (*v1pb.Webhook, error) {
- if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 {
- return nil, status.Errorf(codes.InvalidArgument, "update_mask is required")
- }
-
- // Extract user ID and webhook ID from name (format: users/{user}/webhooks/{webhook})
- tokens, err := GetNameParentTokens(request.Webhook.Name, UserNamePrefix, WebhookNamePrefix)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err)
- }
- if len(tokens) != 2 {
- return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name format")
- }
-
- userIDStr := tokens[0]
- webhookID := tokens[1]
-
- requestedUserID, err := util.ConvertStringToInt32(userIDStr)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid user ID in webhook name: %v", err)
- }
-
- currentUser, err := s.GetCurrentUser(ctx)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
- }
- if currentUser == nil {
- return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
- }
-
- // Users can only update their own webhooks
- if requestedUserID != currentUser.ID {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied")
- }
-
- // Get existing webhooks from user settings
- webhooks, err := s.Store.GetUserWebhooks(ctx, currentUser.ID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get webhooks: %v", err)
- }
-
- // Find the webhook to update
- var existingWebhook *storepb.WebhooksUserSetting_Webhook
- for _, webhook := range webhooks {
- if webhook.Id == webhookID {
- existingWebhook = webhook
- break
- }
- }
-
- if existingWebhook == nil {
- return nil, status.Errorf(codes.NotFound, "webhook not found")
- }
-
- // Create updated webhook
- updatedWebhook := &storepb.WebhooksUserSetting_Webhook{
- Id: existingWebhook.Id,
- Title: existingWebhook.Title,
- Url: existingWebhook.Url,
- }
-
- // Apply updates based on update mask
- for _, field := range request.UpdateMask.Paths {
- switch field {
- case "display_name":
- updatedWebhook.Title = request.Webhook.DisplayName
- case "url":
- updatedWebhook.Url = request.Webhook.Url
- default:
- return nil, status.Errorf(codes.InvalidArgument, "invalid update path: %s", field)
- }
- }
-
- // Update the webhook in user settings
- err = s.Store.UpdateUserWebhook(ctx, currentUser.ID, updatedWebhook)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to update webhook: %v", err)
- }
-
- return convertWebhookFromUserSetting(updatedWebhook, currentUser.ID), nil
-}
-
-func (s *APIV1Service) DeleteWebhook(ctx context.Context, request *v1pb.DeleteWebhookRequest) (*emptypb.Empty, error) {
- // Extract user ID and webhook ID from name (format: users/{user}/webhooks/{webhook})
- tokens, err := GetNameParentTokens(request.Name, UserNamePrefix, WebhookNamePrefix)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err)
- }
- if len(tokens) != 2 {
- return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name format")
- }
-
- userIDStr := tokens[0]
- webhookID := tokens[1]
-
- requestedUserID, err := util.ConvertStringToInt32(userIDStr)
- if err != nil {
- return nil, status.Errorf(codes.InvalidArgument, "invalid user ID in webhook name: %v", err)
- }
-
- currentUser, err := s.GetCurrentUser(ctx)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
- }
- if currentUser == nil {
- return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
- }
-
- // Users can only delete their own webhooks
- if requestedUserID != currentUser.ID {
- return nil, status.Errorf(codes.PermissionDenied, "permission denied")
- }
-
- // Get existing webhooks from user settings to verify it exists
- webhooks, err := s.Store.GetUserWebhooks(ctx, currentUser.ID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get webhooks: %v", err)
- }
-
- // Check if webhook exists
- webhookExists := false
- for _, webhook := range webhooks {
- if webhook.Id == webhookID {
- webhookExists = true
- break
- }
- }
-
- if !webhookExists {
- return nil, status.Errorf(codes.NotFound, "webhook not found")
- }
-
- err = s.Store.RemoveUserWebhook(ctx, currentUser.ID, webhookID)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to delete webhook: %v", err)
- }
- return &emptypb.Empty{}, nil
-}
-
-func convertWebhookFromUserSetting(webhook *storepb.WebhooksUserSetting_Webhook, userID int32) *v1pb.Webhook {
- return &v1pb.Webhook{
- Name: fmt.Sprintf("users/%d/webhooks/%s", userID, webhook.Id),
- DisplayName: webhook.Title,
- Url: webhook.Url,
- }
-}
-
-func generateWebhookID() string {
- b := make([]byte, 8)
- rand.Read(b)
- return hex.EncodeToString(b)
-}
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 1fbc6a53d..f61559a26 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -12,7 +12,7 @@ const App = observer(() => {
const navigateTo = useNavigateTo();
const [mode, setMode] = useState<"light" | "dark">("light");
const workspaceProfile = workspaceStore.state.profile;
- const userSetting = userStore.state.userSetting;
+ const userGeneralSetting = userStore.state.userGeneralSetting;
const workspaceGeneralSetting = workspaceStore.state.generalSetting;
// Redirect to sign up page if no instance owner.
@@ -94,22 +94,22 @@ const App = observer(() => {
}, [mode]);
useEffect(() => {
- if (!userSetting) {
+ if (!userGeneralSetting) {
return;
}
workspaceStore.state.setPartial({
- locale: userSetting.locale || workspaceStore.state.locale,
- appearance: userSetting.appearance || workspaceStore.state.appearance,
+ locale: userGeneralSetting.locale || workspaceStore.state.locale,
+ appearance: userGeneralSetting.appearance || workspaceStore.state.appearance,
});
- }, [userSetting?.locale, userSetting?.appearance]);
+ }, [userGeneralSetting?.locale, userGeneralSetting?.appearance]);
// Load theme when user setting changes (user theme is already backfilled with workspace theme)
useEffect(() => {
- if (userSetting?.theme) {
- loadTheme(userSetting.theme);
+ if (userGeneralSetting?.theme) {
+ loadTheme(userGeneralSetting.theme);
}
- }, [userSetting?.theme]);
+ }, [userGeneralSetting?.theme]);
return <Outlet />;
});
diff --git a/web/src/components/CreateShortcutDialog.tsx b/web/src/components/CreateShortcutDialog.tsx
index dd0383536..f169662a4 100644
--- a/web/src/components/CreateShortcutDialog.tsx
+++ b/web/src/components/CreateShortcutDialog.tsx
@@ -79,7 +79,7 @@ function CreateShortcutDialog({ open, onOpenChange, shortcut: initialShortcut, o
toast.success("Update shortcut successfully");
}
// Refresh shortcuts.
- await userStore.fetchShortcuts();
+ await userStore.fetchUserSettings();
requestState.setFinish();
onSuccess?.();
onOpenChange(false);
diff --git a/web/src/components/CreateWebhookDialog.tsx b/web/src/components/CreateWebhookDialog.tsx
index 7117a72e7..caa66af37 100644
--- a/web/src/components/CreateWebhookDialog.tsx
+++ b/web/src/components/CreateWebhookDialog.tsx
@@ -4,7 +4,7 @@ import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
-import { webhookServiceClient } from "@/grpcweb";
+import { userServiceClient } from "@/grpcweb";
import useCurrentUser from "@/hooks/useCurrentUser";
import useLoading from "@/hooks/useLoading";
import { useTranslate } from "@/utils/i18n";
@@ -32,19 +32,24 @@ function CreateWebhookDialog({ open, onOpenChange, webhookName, onSuccess }: Pro
const isCreating = webhookName === undefined;
useEffect(() => {
- if (webhookName) {
- webhookServiceClient
- .getWebhook({
- name: webhookName,
+ if (webhookName && currentUser) {
+ // For editing, we need to get the webhook data
+ // Since we're using user webhooks now, we need to list all webhooks and find the one we want
+ userServiceClient
+ .listUserWebhooks({
+ parent: currentUser.name,
})
- .then((webhook) => {
- setState({
- displayName: webhook.displayName,
- url: webhook.url,
- });
+ .then((response) => {
+ const webhook = response.webhooks.find((w) => w.name === webhookName);
+ if (webhook) {
+ setState({
+ displayName: webhook.displayName,
+ url: webhook.url,
+ });
+ }
});
}
- }, [webhookName]);
+ }, [webhookName, currentUser]);
const setPartialState = (partialState: Partial<State>) => {
setState({
@@ -79,7 +84,7 @@ function CreateWebhookDialog({ open, onOpenChange, webhookName, onSuccess }: Pro
try {
requestState.setLoading();
if (isCreating) {
- await webhookServiceClient.createWebhook({
+ await userServiceClient.createUserWebhook({
parent: currentUser.name,
webhook: {
displayName: state.displayName,
@@ -87,7 +92,7 @@ function CreateWebhookDialog({ open, onOpenChange, webhookName, onSuccess }: Pro
},
});
} else {
- await webhookServiceClient.updateWebhook({
+ await userServiceClient.updateUserWebhook({
webhook: {
name: webhookName,
displayName: state.displayName,
diff --git a/web/src/components/HomeSidebar/ShortcutsSection.tsx b/web/src/components/HomeSidebar/ShortcutsSection.tsx
index 2a2457809..f36c3a7f4 100644
--- a/web/src/components/HomeSidebar/ShortcutsSection.tsx
+++ b/web/src/components/HomeSidebar/ShortcutsSection.tsx
@@ -28,14 +28,14 @@ const ShortcutsSection = observer(() => {
const [editingShortcut, setEditingShortcut] = useState<Shortcut | undefined>();
useAsyncEffect(async () => {
- await userStore.fetchShortcuts();
+ await userStore.fetchUserSettings();
}, []);
const handleDeleteShortcut = async (shortcut: Shortcut) => {
const confirmed = window.confirm("Are you sure you want to delete this shortcut?");
if (confirmed) {
await shortcutServiceClient.deleteShortcut({ name: shortcut.name });
- await userStore.fetchShortcuts();
+ await userStore.fetchUserSettings();
}
};
diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx
index b0c32628b..aade37ceb 100644
--- a/web/src/components/MemoEditor/index.tsx
+++ b/web/src/components/MemoEditor/index.tsx
@@ -17,7 +17,6 @@ import { memoStore, attachmentStore, userStore, workspaceStore } from "@/store";
import { extractMemoIdFromName } from "@/store/common";
import { Attachment } from "@/types/proto/api/v1/attachment_service";
import { Location, Memo, MemoRelation, MemoRelation_Type, Visibility } from "@/types/proto/api/v1/memo_service";
-import { UserSetting } from "@/types/proto/api/v1/user_service";
import { useTranslate } from "@/utils/i18n";
import { convertVisibilityFromString } from "@/utils/memo";
import DateTimeInput from "../DateTimeInput";
@@ -77,7 +76,7 @@ const MemoEditor = observer((props: Props) => {
const [hasContent, setHasContent] = useState<boolean>(false);
const [isVisibilitySelectorOpen, setIsVisibilitySelectorOpen] = useState(false);
const editorRef = useRef<EditorRefActions>(null);
- const userSetting = userStore.state.userSetting as UserSetting;
+ const userGeneralSetting = userStore.state.userGeneralSetting;
const contentCacheKey = `${currentUser.name}-${cacheKey || ""}`;
const [contentCache, setContentCache] = useLocalStorage<string>(contentCacheKey, "");
const referenceRelations = memoName
@@ -99,7 +98,7 @@ const MemoEditor = observer((props: Props) => {
}, [autoFocus]);
useAsyncEffect(async () => {
- let visibility = convertVisibilityFromString(userSetting.memoVisibility);
+ let visibility = convertVisibilityFromString(userGeneralSetting?.memoVisibility || "PRIVATE");
if (workspaceMemoRelatedSetting.disallowPublicVisibility && visibility === Visibility.PUBLIC) {
visibility = Visibility.PROTECTED;
}
@@ -111,7 +110,7 @@ const MemoEditor = observer((props: Props) => {
...prevState,
memoVisibility: convertVisibilityFromString(visibility),
}));
- }, [parentMemoName, userSetting.memoVisibility, workspaceMemoRelatedSetting.disallowPublicVisibility]);
+ }, [parentMemoName, userGeneralSetting?.memoVisibility, workspaceMemoRelatedSetting.disallowPublicVisibility]);
useAsyncEffect(async () => {
if (!memoName) {
diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx
index 9937c2ec3..a61fbe234 100644
--- a/web/src/components/Settings/PreferencesSection.tsx
+++ b/web/src/components/Settings/PreferencesSection.tsx
@@ -3,7 +3,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
import { Separator } from "@/components/ui/separator";
import { userStore } from "@/store";
import { Visibility } from "@/types/proto/api/v1/memo_service";
-import { UserSetting } from "@/types/proto/api/v1/user_service";
+import { UserSetting_GeneralSetting } from "@/types/proto/api/v1/user_service";
import { useTranslate } from "@/utils/i18n";
import { convertVisibilityFromString, convertVisibilityToString } from "@/utils/memo";
import AppearanceSelect from "../AppearanceSelect";
@@ -14,22 +14,30 @@ import WebhookSection from "./WebhookSection";
const PreferencesSection = observer(() => {
const t = useTranslate();
- const setting = userStore.state.userSetting as UserSetting;
+ const generalSetting = userStore.state.userGeneralSetting;
const handleLocaleSelectChange = async (locale: Locale) => {
- await userStore.updateUserSetting({ locale }, ["locale"]);
+ await userStore.updateUserGeneralSetting({ locale }, ["locale"]);
};
const handleAppearanceSelectChange = async (appearance: Appearance) => {
- await userStore.updateUserSetting({ appearance }, ["appearance"]);
+ await userStore.updateUserGeneralSetting({ appearance }, ["appearance"]);
};
const handleDefaultMemoVisibilityChanged = async (value: string) => {
- await userStore.updateUserSetting({ memoVisibility: value }, ["memo_visibility"]);
+ await userStore.updateUserGeneralSetting({ memoVisibility: value }, ["memoVisibility"]);
};
const handleThemeChange = async (theme: string) => {
- await userStore.updateUserSetting({ theme }, ["theme"]);
+ await userStore.updateUserGeneralSetting({ theme }, ["theme"]);
+ };
+
+ // Provide default values if setting is not loaded yet
+ const setting: UserSetting_GeneralSetting = generalSetting || {
+ locale: "en",
+ appearance: "system",
+ memoVisibility: "PRIVATE",
+ theme: "",
};
return (
diff --git a/web/src/components/Settings/WebhookSection.tsx b/web/src/components/Settings/WebhookSection.tsx
index 3a84788b6..8ce8a0a42 100644
--- a/web/src/components/Settings/WebhookSection.tsx
+++ b/web/src/components/Settings/WebhookSection.tsx
@@ -2,21 +2,21 @@ import { ExternalLinkIcon, TrashIcon } from "lucide-react";
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { Button } from "@/components/ui/button";
-import { webhookServiceClient } from "@/grpcweb";
+import { userServiceClient } from "@/grpcweb";
import useCurrentUser from "@/hooks/useCurrentUser";
-import { Webhook } from "@/types/proto/api/v1/webhook_service";
+import { UserWebhook } from "@/types/proto/api/v1/user_service";
import { useTranslate } from "@/utils/i18n";
import CreateWebhookDialog from "../CreateWebhookDialog";
const WebhookSection = () => {
const t = useTranslate();
const currentUser = useCurrentUser();
- const [webhooks, setWebhooks] = useState<Webhook[]>([]);
+ const [webhooks, setWebhooks] = useState<UserWebhook[]>([]);
const [isCreateWebhookDialogOpen, setIsCreateWebhookDialogOpen] = useState(false);
const listWebhooks = async () => {
if (!currentUser) return [];
- const { webhooks } = await webhookServiceClient.listWebhooks({
+ const { webhooks } = await userServiceClient.listUserWebhooks({
parent: currentUser.name,
});
return webhooks;
@@ -34,10 +34,10 @@ const WebhookSection = () => {
setIsCreateWebhookDialogOpen(false);
};
- const handleDeleteWebhook = async (webhook: Webhook) => {
+ const handleDeleteWebhook = async (webhook: UserWebhook) => {
const confirmed = window.confirm(`Are you sure to delete webhook \`${webhook.displayName}\`? You cannot undo this action.`);
if (confirmed) {
- await webhookServiceClient.deleteWebhook({ name: webhook.name });
+ await userServiceClient.deleteUserWebhook({ name: webhook.name });
setWebhooks(webhooks.filter((item) => item.name !== webhook.name));
}
};
diff --git a/web/src/grpcweb.ts b/web/src/grpcweb.ts
index 27d7e9c21..11e6c67bc 100644
--- a/web/src/grpcweb.ts
+++ b/web/src/grpcweb.ts
@@ -8,7 +8,6 @@ import { MarkdownServiceDefinition } from "./types/proto/api/v1/markdown_service
import { MemoServiceDefinition } from "./types/proto/api/v1/memo_service";
import { ShortcutServiceDefinition } from "./types/proto/api/v1/shortcut_service";
import { UserServiceDefinition } from "./types/proto/api/v1/user_service";
-import { WebhookServiceDefinition } from "./types/proto/api/v1/webhook_service";
import { WorkspaceServiceDefinition } from "./types/proto/api/v1/workspace_service";
const channel = createChannel(
@@ -36,8 +35,6 @@ export const inboxServiceClient = clientFactory.create(InboxServiceDefinition, c
export const activityServiceClient = clientFactory.create(ActivityServiceDefinition, channel);
-export const webhookServiceClient = clientFactory.create(WebhookServiceDefinition, channel);
-
export const markdownServiceClient = clientFactory.create(MarkdownServiceDefinition, channel);
export const identityProviderServiceClient = clientFactory.create(IdentityProviderServiceDefinition, channel);
diff --git a/web/src/store/user.ts b/web/src/store/user.ts
index 4892ea164..ada7a29fd 100644
--- a/web/src/store/user.ts
+++ b/web/src/store/user.ts
@@ -1,15 +1,28 @@
import { uniqueId } from "lodash-es";
import { makeAutoObservable } from "mobx";
-import { authServiceClient, inboxServiceClient, shortcutServiceClient, userServiceClient } from "@/grpcweb";
+import { authServiceClient, inboxServiceClient, userServiceClient } from "@/grpcweb";
import { Inbox } from "@/types/proto/api/v1/inbox_service";
import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
-import { User, UserSetting, UserStats } from "@/types/proto/api/v1/user_service";
+import {
+ User,
+ UserSetting,
+ UserSetting_GeneralSetting,
+ UserSetting_SessionsSetting,
+ UserSetting_AccessTokensSetting,
+ UserSetting_ShortcutsSetting,
+ UserSetting_WebhooksSetting,
+ UserStats,
+} from "@/types/proto/api/v1/user_service";
import { findNearestMatchedLanguage } from "@/utils/i18n";
import workspaceStore from "./workspace";
class LocalState {
currentUser?: string;
- userSetting?: UserSetting;
+ userGeneralSetting?: UserSetting_GeneralSetting;
+ userSessionsSetting?: UserSetting_SessionsSetting;
+ userAccessTokensSetting?: UserSetting_AccessTokensSetting;
+ userShortcutsSetting?: UserSetting_ShortcutsSetting;
+ userWebhooksSetting?: UserSetting_WebhooksSetting;
shortcuts: Shortcut[] = [];
inboxes: Inbox[] = [];
userMapByName: Record<string, User> = {};
@@ -127,38 +140,77 @@ const userStore = (() => {
});
};
- const updateUserSetting = async (userSetting: Partial<UserSetting>, updateMask: string[]) => {
+ const updateUserGeneralSetting = async (generalSetting: Partial<UserSetting_GeneralSetting>, updateMask: string[]) => {
if (!state.currentUser) {
throw new Error("No current user");
}
- // Ensure the setting has the proper resource name
- const settingWithName = {
- ...userSetting,
- name: state.currentUser,
+
+ const settingName = `${state.currentUser}/settings/general`;
+ const userSetting: UserSetting = {
+ name: settingName,
+ generalSetting: generalSetting as UserSetting_GeneralSetting,
};
+
const updatedUserSetting = await userServiceClient.updateUserSetting({
- setting: settingWithName,
+ setting: userSetting,
updateMask: updateMask,
});
+
state.setPartial({
- userSetting: UserSetting.fromPartial({
- ...state.userSetting,
- ...updatedUserSetting,
- }),
+ userGeneralSetting: updatedUserSetting.generalSetting,
+ });
+ };
+
+ const getUserGeneralSetting = async () => {
+ if (!state.currentUser) {
+ throw new Error("No current user");
+ }
+
+ const settingName = `${state.currentUser}/settings/general`;
+ const userSetting = await userServiceClient.getUserSetting({ name: settingName });
+
+ state.setPartial({
+ userGeneralSetting: userSetting.generalSetting,
});
+
+ return userSetting.generalSetting;
};
- const fetchShortcuts = async () => {
+ const fetchUserSettings = async () => {
if (!state.currentUser) {
return;
}
- const { shortcuts } = await shortcutServiceClient.listShortcuts({ parent: state.currentUser });
+ const { settings } = await userServiceClient.listUserSettings({ parent: state.currentUser });
+
+ // Extract and store each setting type
+ 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,
});
};
+ // Note: fetchShortcuts is now handled by fetchUserSettings
+ // The shortcuts are extracted from the user shortcuts setting
+
const fetchInboxes = async () => {
if (!state.currentUser) {
throw new Error("No current user available");
@@ -199,9 +251,9 @@ const userStore = (() => {
const fetchUserStats = async (user?: string) => {
const userStatsByName: Record<string, UserStats> = {};
if (!user) {
- const { userStats } = await userServiceClient.listAllUserStats({});
- for (const stats of userStats) {
- userStatsByName[stats.name] = stats;
+ const { stats } = await userServiceClient.listAllUserStats({});
+ for (const userStats of stats) {
+ userStatsByName[userStats.name] = userStats;
}
} else {
const userStats = await userServiceClient.getUserStats({ name: user });
@@ -227,8 +279,9 @@ const userStore = (() => {
fetchUsers,
updateUser,
deleteUser,
- updateUserSetting,
- fetchShortcuts,
+ updateUserGeneralSetting,
+ getUserGeneralSetting,
+ fetchUserSettings,
fetchInboxes,
updateInbox,
deleteInbox,
@@ -244,25 +297,30 @@ export const initialUserStore = async () => {
// If no user is authenticated, we can skip the rest of the initialization.
userStore.state.setPartial({
currentUser: undefined,
- userSetting: undefined,
+ userGeneralSetting: undefined,
userMapByName: {},
});
return;
}
- const userSetting = await userServiceClient.getUserSetting({ name: currentUser.name });
+
+ // Fetch all user settings
+ await userStore.fetchUserSettings();
+
userStore.state.setPartial({
currentUser: currentUser.name,
- userSetting: UserSetting.fromPartial({
- ...userSetting,
- }),
userMapByName: {
[currentUser.name]: currentUser,
},
});
- workspaceStore.state.setPartial({
- locale: userSetting.locale,
- appearance: userSetting.appearance,
- });
+
+ // Apply general settings to workspace if available
+ const generalSetting = userStore.state.userGeneralSetting;
+ if (generalSetting) {
+ workspaceStore.state.setPartial({
+ locale: generalSetting.locale,
+ appearance: generalSetting.appearance,
+ });
+ }
} catch {
// find the nearest matched lang based on the `navigator.language` if the user is unauthenticated or settings retrieval fails.
const locale = findNearestMatchedLanguage(navigator.language);
diff --git a/web/src/types/proto/api/v1/user_service.ts b/web/src/types/proto/api/v1/user_service.ts
index 4ec9a0798..30247824a 100644
--- a/web/src/types/proto/api/v1/user_service.ts
+++ b/web/src/types/proto/api/v1/user_service.ts
@@ -259,13 +259,94 @@ export interface GetUserStatsRequest {
name: string;
}
+/** This endpoint doesn't take any parameters. */
+export interface ListAllUserStatsRequest {
+}
+
+export interface ListAllUserStatsResponse {
+ /** The list of user statistics. */
+ stats: UserStats[];
+}
+
/** User settings message */
export interface UserSetting {
/**
- * The resource name of the user whose setting this is.
- * Format: users/{user}
+ * The name of the user setting.
+ * Format: users/{user}/settings/{setting}
*/
name: string;
+ generalSetting?: UserSetting_GeneralSetting | undefined;
+ sessionsSetting?: UserSetting_SessionsSetting | undefined;
+ accessTokensSetting?: UserSetting_AccessTokensSetting | undefined;
+ shortcutsSetting?: UserSetting_ShortcutsSetting | undefined;
+ webhooksSetting?: UserSetting_WebhooksSetting | undefined;
+}
+
+/** Enumeration of user setting keys. */
+export enum UserSetting_Key {
+ KEY_UNSPECIFIED = "KEY_UNSPECIFIED",
+ /** GENERAL - GENERAL is the key for general user settings. */
+ GENERAL = "GENERAL",
+ /** SESSIONS - SESSIONS is the key for user authentication sessions. */
+ 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",
+}
+
+export function userSetting_KeyFromJSON(object: any): UserSetting_Key {
+ switch (object) {
+ case 0:
+ case "KEY_UNSPECIFIED":
+ return UserSetting_Key.KEY_UNSPECIFIED;
+ case 1:
+ case "GENERAL":
+ return UserSetting_Key.GENERAL;
+ case 2:
+ case "SESSIONS":
+ return UserSetting_Key.SESSIONS;
+ case 3:
+ 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:
+ case "UNRECOGNIZED":
+ default:
+ return UserSetting_Key.UNRECOGNIZED;
+ }
+}
+
+export function userSetting_KeyToNumber(object: UserSetting_Key): number {
+ switch (object) {
+ case UserSetting_Key.KEY_UNSPECIFIED:
+ return 0;
+ case UserSetting_Key.GENERAL:
+ return 1;
+ case UserSetting_Key.SESSIONS:
+ return 2;
+ case UserSetting_Key.ACCESS_TOKENS:
+ return 3;
+ case UserSetting_Key.SHORTCUTS:
+ return 4;
+ case UserSetting_Key.WEBHOOKS:
+ return 5;
+ case UserSetting_Key.UNRECOGNIZED:
+ default:
+ return -1;
+ }
+}
+
+/** General user settings configuration. */
+export interface UserSetting_GeneralSetting {
/** The preferred locale of the user. */
locale: string;
/** The preferred appearance of the user. */
@@ -280,10 +361,98 @@ export interface UserSetting {
theme: string;
}
+/** 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;
+}
+
+/** 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;
+}
+
+/** 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;
+}
+
export interface GetUserSettingRequest {
/**
- * Required. The resource name of the user.
- * Format: users/{user}
+ * Required. The resource name of the user setting.
+ * Format: users/{user}/settings/{setting}
*/
name: string;
}
@@ -297,6 +466,40 @@ export interface UpdateUserSettingRequest {
updateMask?: string[] | undefined;
}
+/** Request message for ListUserSettings method. */
+export interface ListUserSettingsRequest {
+ /**
+ * Required. The parent resource whose settings will be listed.
+ * Format: users/{user}
+ */
+ parent: string;
+ /**
+ * Optional. The maximum number of settings to return.
+ * The service may return fewer than this value.
+ * If unspecified, at most 50 settings will be returned.
+ * The maximum value is 1000; values above 1000 will be coerced to 1000.
+ */
+ pageSize: number;
+ /**
+ * Optional. A page token, received from a previous `ListUserSettings` call.
+ * Provide this to retrieve the subsequent page.
+ */
+ pageToken: string;
+}
+
+/** Response message for ListUserSettings method. */
+export interface ListUserSettingsResponse {
+ /** The list of user settings. */
+ settings: UserSetting[];
+ /**
+ * A token that can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ */
+ nextPageToken: string;
+ /** The total count of settings (may be approximate). */
+ totalSize: number;
+}
+
/** User access token message */
export interface UserAccessToken {
/**
@@ -410,26 +613,69 @@ export interface ListUserSessionsResponse {
export interface RevokeUserSessionRequest {
/**
- * Required. The resource name of the session to revoke.
+ * The name of the session to revoke.
* Format: users/{user}/sessions/{session}
*/
name: string;
}
-export interface ListAllUserStatsRequest {
- /** Optional. The maximum number of user stats to return. */
- pageSize: number;
- /** Optional. A page token for pagination. */
- pageToken: string;
+/** UserWebhook represents a webhook owned by a user. */
+export interface UserWebhook {
+ /**
+ * The name of the webhook.
+ * Format: users/{user}/webhooks/{webhook}
+ */
+ name: string;
+ /** The URL to send the webhook to. */
+ url: string;
+ /** Optional. Human-readable name for the webhook. */
+ displayName: string;
+ /** The creation time of the webhook. */
+ createTime?:
+ | Date
+ | undefined;
+ /** The last update time of the webhook. */
+ updateTime?: Date | undefined;
}
-export interface ListAllUserStatsResponse {
- /** The list of user statistics. */
- userStats: UserStats[];
- /** A token for the next page of results. */
- nextPageToken: string;
- /** The total count of user statistics. */
- totalSize: number;
+export interface ListUserWebhooksRequest {
+ /**
+ * The parent user resource.
+ * Format: users/{user}
+ */
+ parent: string;
+}
+
+export interface ListUserWebhooksResponse {
+ /** The list of webhooks. */
+ webhooks: UserWebhook[];
+}
+
+export interface CreateUserWebhookRequest {
+ /**
+ * The parent user resource.
+ * Format: users/{user}
+ */
+ parent: string;
+ /** The webhook to create. */
+ webhook?: UserWebhook | undefined;
+}
+
+export interface UpdateUserWebhookRequest {
+ /** The webhook to update. */
+ webhook?:
+ | UserWebhook
+ | undefined;
+ /** The list of fields to update. */
+ updateMask?: string[] | undefined;
+}
+
+export interface DeleteUserWebhookRequest {
+ /**
+ * The name of the webhook to delete.
+ * Format: users/{user}/webhooks/{webhook}
+ */
+ name: string;
}
function createBaseUser(): User {
@@ -1537,8 +1783,95 @@ export const GetUserStatsRequest: MessageFns<GetUserStatsRequest> = {
},
};
+function createBaseListAllUserStatsRequest(): ListAllUserStatsRequest {
+ return {};
+}
+
+export const ListAllUserStatsRequest: MessageFns<ListAllUserStatsRequest> = {
+ encode(_: ListAllUserStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListAllUserStatsRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<ListAllUserStatsRequest>): ListAllUserStatsRequest {
+ return ListAllUserStatsRequest.fromPartial(base ?? {});
+ },
+ fromPartial(_: DeepPartial<ListAllUserStatsRequest>): ListAllUserStatsRequest {
+ const message = createBaseListAllUserStatsRequest();
+ return message;
+ },
+};
+
+function createBaseListAllUserStatsResponse(): ListAllUserStatsResponse {
+ return { stats: [] };
+}
+
+export const ListAllUserStatsResponse: MessageFns<ListAllUserStatsResponse> = {
+ encode(message: ListAllUserStatsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ for (const v of message.stats) {
+ UserStats.encode(v!, writer.uint32(10).fork()).join();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsResponse {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListAllUserStatsResponse();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.stats.push(UserStats.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<ListAllUserStatsResponse>): ListAllUserStatsResponse {
+ return ListAllUserStatsResponse.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<ListAllUserStatsResponse>): ListAllUserStatsResponse {
+ const message = createBaseListAllUserStatsResponse();
+ message.stats = object.stats?.map((e) => UserStats.fromPartial(e)) || [];
+ return message;
+ },
+};
+
function createBaseUserSetting(): UserSetting {
- return { name: "", locale: "", appearance: "", memoVisibility: "", theme: "" };
+ return {
+ name: "",
+ generalSetting: undefined,
+ sessionsSetting: undefined,
+ accessTokensSetting: undefined,
+ shortcutsSetting: undefined,
+ webhooksSetting: undefined,
+ };
}
export const UserSetting: MessageFns<UserSetting> = {
@@ -1546,17 +1879,20 @@ export const UserSetting: MessageFns<UserSetting> = {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
- if (message.locale !== "") {
- writer.uint32(18).string(message.locale);
+ if (message.generalSetting !== undefined) {
+ UserSetting_GeneralSetting.encode(message.generalSetting, writer.uint32(18).fork()).join();
}
- if (message.appearance !== "") {
- writer.uint32(26).string(message.appearance);
+ if (message.sessionsSetting !== undefined) {
+ UserSetting_SessionsSetting.encode(message.sessionsSetting, writer.uint32(26).fork()).join();
}
- if (message.memoVisibility !== "") {
- writer.uint32(34).string(message.memoVisibility);
+ if (message.accessTokensSetting !== undefined) {
+ UserSetting_AccessTokensSetting.encode(message.accessTokensSetting, writer.uint32(34).fork()).join();
}
- if (message.theme !== "") {
- writer.uint32(42).string(message.theme);
+ 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();
}
return writer;
},
@@ -1581,7 +1917,7 @@ export const UserSetting: MessageFns<UserSetting> = {
break;
}
- message.locale = reader.string();
+ message.generalSetting = UserSetting_GeneralSetting.decode(reader, reader.uint32());
continue;
}
case 3: {
@@ -1589,7 +1925,7 @@ export const UserSetting: MessageFns<UserSetting> = {
break;
}
- message.appearance = reader.string();
+ message.sessionsSetting = UserSetting_SessionsSetting.decode(reader, reader.uint32());
continue;
}
case 4: {
@@ -1597,7 +1933,7 @@ export const UserSetting: MessageFns<UserSetting> = {
break;
}
- message.memoVisibility = reader.string();
+ message.accessTokensSetting = UserSetting_AccessTokensSetting.decode(reader, reader.uint32());
continue;
}
case 5: {
@@ -1605,7 +1941,15 @@ export const UserSetting: MessageFns<UserSetting> = {
break;
}
- message.theme = reader.string();
+ message.shortcutsSetting = UserSetting_ShortcutsSetting.decode(reader, reader.uint32());
+ continue;
+ }
+ case 6: {
+ if (tag !== 50) {
+ break;
+ }
+
+ message.webhooksSetting = UserSetting_WebhooksSetting.decode(reader, reader.uint32());
continue;
}
}
@@ -1623,27 +1967,686 @@ export const UserSetting: MessageFns<UserSetting> = {
fromPartial(object: DeepPartial<UserSetting>): UserSetting {
const message = createBaseUserSetting();
message.name = object.name ?? "";
- message.locale = object.locale ?? "";
- message.appearance = object.appearance ?? "";
- message.memoVisibility = object.memoVisibility ?? "";
- message.theme = object.theme ?? "";
+ message.generalSetting = (object.generalSetting !== undefined && object.generalSetting !== null)
+ ? UserSetting_GeneralSetting.fromPartial(object.generalSetting)
+ : undefined;
+ message.sessionsSetting = (object.sessionsSetting !== undefined && object.sessionsSetting !== null)
+ ? UserSetting_SessionsSetting.fromPartial(object.sessionsSetting)
+ : undefined;
+ 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;
return message;
},
};
-function createBaseGetUserSettingRequest(): GetUserSettingRequest {
- return { name: "" };
+function createBaseUserSetting_GeneralSetting(): UserSetting_GeneralSetting {
+ return { locale: "", appearance: "", memoVisibility: "", theme: "" };
}
-export const GetUserSettingRequest: MessageFns<GetUserSettingRequest> = {
- encode(message: GetUserSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
+export const UserSetting_GeneralSetting: MessageFns<UserSetting_GeneralSetting> = {
+ encode(message: UserSetting_GeneralSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.locale !== "") {
+ writer.uint32(10).string(message.locale);
+ }
+ if (message.appearance !== "") {
+ writer.uint32(18).string(message.appearance);
+ }
+ if (message.memoVisibility !== "") {
+ writer.uint32(26).string(message.memoVisibility);
+ }
+ if (message.theme !== "") {
+ writer.uint32(34).string(message.theme);
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): GetUserSettingRequest {
+ decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_GeneralSetting {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseUserSetting_GeneralSetting();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.locale = reader.string();
+ continue;
+ }
+ case 2: {
+ if (tag !== 18) {
+ break;
+ }
+
+ message.appearance = reader.string();
+ continue;
+ }
+ case 3: {
+ if (tag !== 26) {
+ break;
+ }
+
+ message.memoVisibility = reader.string();
+ continue;
+ }
+ case 4: {
+ if (tag !== 34) {
+ break;
+ }
+
+ message.theme = reader.string();
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<UserSetting_GeneralSetting>): UserSetting_GeneralSetting {
+ return UserSetting_GeneralSetting.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSetting_GeneralSetting>): UserSetting_GeneralSetting {
+ const message = createBaseUserSetting_GeneralSetting();
+ message.locale = object.locale ?? "";
+ message.appearance = object.appearance ?? "";
+ message.memoVisibility = object.memoVisibility ?? "";
+ message.theme = object.theme ?? "";
+ return message;
+ },
+};
+
+function createBaseUserSetting_SessionsSetting(): UserSetting_SessionsSetting {
+ return { sessions: [] };
+}
+
+export const UserSetting_SessionsSetting: MessageFns<UserSetting_SessionsSetting> = {
+ 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();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_SessionsSetting {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseUserSetting_SessionsSetting();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.sessions.push(UserSetting_SessionsSetting_Session.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<UserSetting_SessionsSetting>): UserSetting_SessionsSetting {
+ return UserSetting_SessionsSetting.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSetting_SessionsSetting>): 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<UserSetting_SessionsSetting_Session> = {
+ 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>): UserSetting_SessionsSetting_Session {
+ return UserSetting_SessionsSetting_Session.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSetting_SessionsSetting_Session>): 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<UserSetting_SessionsSetting_ClientInfo> = {
+ 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>): UserSetting_SessionsSetting_ClientInfo {
+ return UserSetting_SessionsSetting_ClientInfo.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSetting_SessionsSetting_ClientInfo>): 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 ?? "";
+ return message;
+ },
+};
+
+function createBaseUserSetting_AccessTokensSetting(): UserSetting_AccessTokensSetting {
+ return { accessTokens: [] };
+}
+
+export const UserSetting_AccessTokensSetting: MessageFns<UserSetting_AccessTokensSetting> = {
+ 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();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_AccessTokensSetting {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseUserSetting_AccessTokensSetting();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.accessTokens.push(UserSetting_AccessTokensSetting_AccessToken.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<UserSetting_AccessTokensSetting>): UserSetting_AccessTokensSetting {
+ return UserSetting_AccessTokensSetting.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSetting_AccessTokensSetting>): 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<UserSetting_AccessTokensSetting_AccessToken> = {
+ 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>): UserSetting_AccessTokensSetting_AccessToken {
+ return UserSetting_AccessTokensSetting_AccessToken.fromPartial(base ?? {});
+ },
+ fromPartial(
+ object: DeepPartial<UserSetting_AccessTokensSetting_AccessToken>,
+ ): 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<UserSetting_ShortcutsSetting> = {
+ 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>): UserSetting_ShortcutsSetting {
+ return UserSetting_ShortcutsSetting.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSetting_ShortcutsSetting>): 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<UserSetting_ShortcutsSetting_Shortcut> = {
+ 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>): UserSetting_ShortcutsSetting_Shortcut {
+ return UserSetting_ShortcutsSetting_Shortcut.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSetting_ShortcutsSetting_Shortcut>): UserSetting_ShortcutsSetting_Shortcut {
+ const message = createBaseUserSetting_ShortcutsSetting_Shortcut();
+ message.id = object.id ?? "";
+ message.title = object.title ?? "";
+ message.filter = object.filter ?? "";
+ return message;
+ },
+};
+
+function createBaseUserSetting_WebhooksSetting(): UserSetting_WebhooksSetting {
+ return { webhooks: [] };
+}
+
+export const UserSetting_WebhooksSetting: MessageFns<UserSetting_WebhooksSetting> = {
+ 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();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): UserSetting_WebhooksSetting {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseUserSetting_WebhooksSetting();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.webhooks.push(UserSetting_WebhooksSetting_Webhook.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<UserSetting_WebhooksSetting>): UserSetting_WebhooksSetting {
+ return UserSetting_WebhooksSetting.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSetting_WebhooksSetting>): 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<UserSetting_WebhooksSetting_Webhook> = {
+ 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>): UserSetting_WebhooksSetting_Webhook {
+ return UserSetting_WebhooksSetting_Webhook.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSetting_WebhooksSetting_Webhook>): UserSetting_WebhooksSetting_Webhook {
+ const message = createBaseUserSetting_WebhooksSetting_Webhook();
+ message.id = object.id ?? "";
+ message.title = object.title ?? "";
+ message.url = object.url ?? "";
+ return message;
+ },
+};
+
+function createBaseGetUserSettingRequest(): GetUserSettingRequest {
+ return { name: "" };
+}
+
+export const GetUserSettingRequest: MessageFns<GetUserSettingRequest> = {
+ encode(message: GetUserSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.name !== "") {
+ writer.uint32(10).string(message.name);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): GetUserSettingRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetUserSettingRequest();
@@ -1686,16 +2689,149 @@ export const UpdateUserSettingRequest: MessageFns<UpdateUserSettingRequest> = {
if (message.setting !== undefined) {
UserSetting.encode(message.setting, writer.uint32(10).fork()).join();
}
- if (message.updateMask !== undefined) {
- FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
+ if (message.updateMask !== undefined) {
+ FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserSettingRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseUpdateUserSettingRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.setting = UserSetting.decode(reader, reader.uint32());
+ continue;
+ }
+ case 2: {
+ if (tag !== 18) {
+ break;
+ }
+
+ message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<UpdateUserSettingRequest>): UpdateUserSettingRequest {
+ return UpdateUserSettingRequest.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UpdateUserSettingRequest>): UpdateUserSettingRequest {
+ const message = createBaseUpdateUserSettingRequest();
+ message.setting = (object.setting !== undefined && object.setting !== null)
+ ? UserSetting.fromPartial(object.setting)
+ : undefined;
+ message.updateMask = object.updateMask ?? undefined;
+ return message;
+ },
+};
+
+function createBaseListUserSettingsRequest(): ListUserSettingsRequest {
+ return { parent: "", pageSize: 0, pageToken: "" };
+}
+
+export const ListUserSettingsRequest: MessageFns<ListUserSettingsRequest> = {
+ encode(message: ListUserSettingsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.parent !== "") {
+ writer.uint32(10).string(message.parent);
+ }
+ if (message.pageSize !== 0) {
+ writer.uint32(16).int32(message.pageSize);
+ }
+ if (message.pageToken !== "") {
+ writer.uint32(26).string(message.pageToken);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): ListUserSettingsRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListUserSettingsRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.parent = reader.string();
+ continue;
+ }
+ case 2: {
+ if (tag !== 16) {
+ break;
+ }
+
+ message.pageSize = reader.int32();
+ continue;
+ }
+ case 3: {
+ if (tag !== 26) {
+ break;
+ }
+
+ message.pageToken = reader.string();
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<ListUserSettingsRequest>): ListUserSettingsRequest {
+ return ListUserSettingsRequest.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<ListUserSettingsRequest>): ListUserSettingsRequest {
+ const message = createBaseListUserSettingsRequest();
+ message.parent = object.parent ?? "";
+ message.pageSize = object.pageSize ?? 0;
+ message.pageToken = object.pageToken ?? "";
+ return message;
+ },
+};
+
+function createBaseListUserSettingsResponse(): ListUserSettingsResponse {
+ return { settings: [], nextPageToken: "", totalSize: 0 };
+}
+
+export const ListUserSettingsResponse: MessageFns<ListUserSettingsResponse> = {
+ encode(message: ListUserSettingsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ for (const v of message.settings) {
+ UserSetting.encode(v!, writer.uint32(10).fork()).join();
+ }
+ if (message.nextPageToken !== "") {
+ writer.uint32(18).string(message.nextPageToken);
+ }
+ if (message.totalSize !== 0) {
+ writer.uint32(24).int32(message.totalSize);
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserSettingRequest {
+ decode(input: BinaryReader | Uint8Array, length?: number): ListUserSettingsResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseUpdateUserSettingRequest();
+ const message = createBaseListUserSettingsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1704,7 +2840,7 @@ export const UpdateUserSettingRequest: MessageFns<UpdateUserSettingRequest> = {
break;
}
- message.setting = UserSetting.decode(reader, reader.uint32());
+ message.settings.push(UserSetting.decode(reader, reader.uint32()));
continue;
}
case 2: {
@@ -1712,7 +2848,15 @@ export const UpdateUserSettingRequest: MessageFns<UpdateUserSettingRequest> = {
break;
}
- message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
+ message.nextPageToken = reader.string();
+ continue;
+ }
+ case 3: {
+ if (tag !== 24) {
+ break;
+ }
+
+ message.totalSize = reader.int32();
continue;
}
}
@@ -1724,15 +2868,14 @@ export const UpdateUserSettingRequest: MessageFns<UpdateUserSettingRequest> = {
return message;
},
- create(base?: DeepPartial<UpdateUserSettingRequest>): UpdateUserSettingRequest {
- return UpdateUserSettingRequest.fromPartial(base ?? {});
+ create(base?: DeepPartial<ListUserSettingsResponse>): ListUserSettingsResponse {
+ return ListUserSettingsResponse.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<UpdateUserSettingRequest>): UpdateUserSettingRequest {
- const message = createBaseUpdateUserSettingRequest();
- message.setting = (object.setting !== undefined && object.setting !== null)
- ? UserSetting.fromPartial(object.setting)
- : undefined;
- message.updateMask = object.updateMask ?? undefined;
+ fromPartial(object: DeepPartial<ListUserSettingsResponse>): ListUserSettingsResponse {
+ const message = createBaseListUserSettingsResponse();
+ message.settings = object.settings?.map((e) => UserSetting.fromPartial(e)) || [];
+ message.nextPageToken = object.nextPageToken ?? "";
+ message.totalSize = object.totalSize ?? 0;
return message;
},
};
@@ -2149,15 +3292,253 @@ export const UserSession: MessageFns<UserSession> = {
break;
}
- message.lastAccessedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
- continue;
- }
- case 5: {
- if (tag !== 42) {
+ message.lastAccessedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ continue;
+ }
+ case 5: {
+ if (tag !== 42) {
+ break;
+ }
+
+ message.clientInfo = UserSession_ClientInfo.decode(reader, reader.uint32());
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<UserSession>): UserSession {
+ return UserSession.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSession>): UserSession {
+ const message = createBaseUserSession();
+ message.name = object.name ?? "";
+ message.sessionId = object.sessionId ?? "";
+ message.createTime = object.createTime ?? undefined;
+ message.lastAccessedTime = object.lastAccessedTime ?? undefined;
+ message.clientInfo = (object.clientInfo !== undefined && object.clientInfo !== null)
+ ? UserSession_ClientInfo.fromPartial(object.clientInfo)
+ : undefined;
+ return message;
+ },
+};
+
+function createBaseUserSession_ClientInfo(): UserSession_ClientInfo {
+ return { userAgent: "", ipAddress: "", deviceType: "", os: "", browser: "" };
+}
+
+export const UserSession_ClientInfo: MessageFns<UserSession_ClientInfo> = {
+ encode(message: UserSession_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): UserSession_ClientInfo {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseUserSession_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<UserSession_ClientInfo>): UserSession_ClientInfo {
+ return UserSession_ClientInfo.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UserSession_ClientInfo>): UserSession_ClientInfo {
+ const message = createBaseUserSession_ClientInfo();
+ message.userAgent = object.userAgent ?? "";
+ message.ipAddress = object.ipAddress ?? "";
+ message.deviceType = object.deviceType ?? "";
+ message.os = object.os ?? "";
+ message.browser = object.browser ?? "";
+ return message;
+ },
+};
+
+function createBaseListUserSessionsRequest(): ListUserSessionsRequest {
+ return { parent: "" };
+}
+
+export const ListUserSessionsRequest: MessageFns<ListUserSessionsRequest> = {
+ encode(message: ListUserSessionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.parent !== "") {
+ writer.uint32(10).string(message.parent);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): ListUserSessionsRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListUserSessionsRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.parent = reader.string();
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<ListUserSessionsRequest>): ListUserSessionsRequest {
+ return ListUserSessionsRequest.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<ListUserSessionsRequest>): ListUserSessionsRequest {
+ const message = createBaseListUserSessionsRequest();
+ message.parent = object.parent ?? "";
+ return message;
+ },
+};
+
+function createBaseListUserSessionsResponse(): ListUserSessionsResponse {
+ return { sessions: [] };
+}
+
+export const ListUserSessionsResponse: MessageFns<ListUserSessionsResponse> = {
+ encode(message: ListUserSessionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ for (const v of message.sessions) {
+ UserSession.encode(v!, writer.uint32(10).fork()).join();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): ListUserSessionsResponse {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListUserSessionsResponse();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.sessions.push(UserSession.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<ListUserSessionsResponse>): ListUserSessionsResponse {
+ return ListUserSessionsResponse.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<ListUserSessionsResponse>): ListUserSessionsResponse {
+ const message = createBaseListUserSessionsResponse();
+ message.sessions = object.sessions?.map((e) => UserSession.fromPartial(e)) || [];
+ return message;
+ },
+};
+
+function createBaseRevokeUserSessionRequest(): RevokeUserSessionRequest {
+ return { name: "" };
+}
+
+export const RevokeUserSessionRequest: MessageFns<RevokeUserSessionRequest> = {
+ encode(message: RevokeUserSessionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.name !== "") {
+ writer.uint32(10).string(message.name);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): RevokeUserSessionRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseRevokeUserSessionRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
break;
}
- message.clientInfo = UserSession_ClientInfo.decode(reader, reader.uint32());
+ message.name = reader.string();
continue;
}
}
@@ -2169,50 +3550,44 @@ export const UserSession: MessageFns<UserSession> = {
return message;
},
- create(base?: DeepPartial<UserSession>): UserSession {
- return UserSession.fromPartial(base ?? {});
+ create(base?: DeepPartial<RevokeUserSessionRequest>): RevokeUserSessionRequest {
+ return RevokeUserSessionRequest.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<UserSession>): UserSession {
- const message = createBaseUserSession();
+ fromPartial(object: DeepPartial<RevokeUserSessionRequest>): RevokeUserSessionRequest {
+ const message = createBaseRevokeUserSessionRequest();
message.name = object.name ?? "";
- message.sessionId = object.sessionId ?? "";
- message.createTime = object.createTime ?? undefined;
- message.lastAccessedTime = object.lastAccessedTime ?? undefined;
- message.clientInfo = (object.clientInfo !== undefined && object.clientInfo !== null)
- ? UserSession_ClientInfo.fromPartial(object.clientInfo)
- : undefined;
return message;
},
};
-function createBaseUserSession_ClientInfo(): UserSession_ClientInfo {
- return { userAgent: "", ipAddress: "", deviceType: "", os: "", browser: "" };
+function createBaseUserWebhook(): UserWebhook {
+ return { name: "", url: "", displayName: "", createTime: undefined, updateTime: undefined };
}
-export const UserSession_ClientInfo: MessageFns<UserSession_ClientInfo> = {
- encode(message: UserSession_ClientInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.userAgent !== "") {
- writer.uint32(10).string(message.userAgent);
+export const UserWebhook: MessageFns<UserWebhook> = {
+ encode(message: UserWebhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.name !== "") {
+ writer.uint32(10).string(message.name);
}
- if (message.ipAddress !== "") {
- writer.uint32(18).string(message.ipAddress);
+ if (message.url !== "") {
+ writer.uint32(18).string(message.url);
}
- if (message.deviceType !== "") {
- writer.uint32(26).string(message.deviceType);
+ if (message.displayName !== "") {
+ writer.uint32(26).string(message.displayName);
}
- if (message.os !== "") {
- writer.uint32(34).string(message.os);
+ if (message.createTime !== undefined) {
+ Timestamp.encode(toTimestamp(message.createTime), writer.uint32(34).fork()).join();
}
- if (message.browser !== "") {
- writer.uint32(42).string(message.browser);
+ if (message.updateTime !== undefined) {
+ Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).join();
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): UserSession_ClientInfo {
+ decode(input: BinaryReader | Uint8Array, length?: number): UserWebhook {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseUserSession_ClientInfo();
+ const message = createBaseUserWebhook();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -2221,7 +3596,7 @@ export const UserSession_ClientInfo: MessageFns<UserSession_ClientInfo> = {
break;
}
- message.userAgent = reader.string();
+ message.name = reader.string();
continue;
}
case 2: {
@@ -2229,7 +3604,7 @@ export const UserSession_ClientInfo: MessageFns<UserSession_ClientInfo> = {
break;
}
- message.ipAddress = reader.string();
+ message.url = reader.string();
continue;
}
case 3: {
@@ -2237,7 +3612,7 @@ export const UserSession_ClientInfo: MessageFns<UserSession_ClientInfo> = {
break;
}
- message.deviceType = reader.string();
+ message.displayName = reader.string();
continue;
}
case 4: {
@@ -2245,7 +3620,7 @@ export const UserSession_ClientInfo: MessageFns<UserSession_ClientInfo> = {
break;
}
- message.os = reader.string();
+ message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 5: {
@@ -2253,7 +3628,7 @@ export const UserSession_ClientInfo: MessageFns<UserSession_ClientInfo> = {
break;
}
- message.browser = reader.string();
+ message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
}
@@ -2265,36 +3640,36 @@ export const UserSession_ClientInfo: MessageFns<UserSession_ClientInfo> = {
return message;
},
- create(base?: DeepPartial<UserSession_ClientInfo>): UserSession_ClientInfo {
- return UserSession_ClientInfo.fromPartial(base ?? {});
+ create(base?: DeepPartial<UserWebhook>): UserWebhook {
+ return UserWebhook.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<UserSession_ClientInfo>): UserSession_ClientInfo {
- const message = createBaseUserSession_ClientInfo();
- message.userAgent = object.userAgent ?? "";
- message.ipAddress = object.ipAddress ?? "";
- message.deviceType = object.deviceType ?? "";
- message.os = object.os ?? "";
- message.browser = object.browser ?? "";
+ fromPartial(object: DeepPartial<UserWebhook>): UserWebhook {
+ const message = createBaseUserWebhook();
+ message.name = object.name ?? "";
+ message.url = object.url ?? "";
+ message.displayName = object.displayName ?? "";
+ message.createTime = object.createTime ?? undefined;
+ message.updateTime = object.updateTime ?? undefined;
return message;
},
};
-function createBaseListUserSessionsRequest(): ListUserSessionsRequest {
+function createBaseListUserWebhooksRequest(): ListUserWebhooksRequest {
return { parent: "" };
}
-export const ListUserSessionsRequest: MessageFns<ListUserSessionsRequest> = {
- encode(message: ListUserSessionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+export const ListUserWebhooksRequest: MessageFns<ListUserWebhooksRequest> = {
+ encode(message: ListUserWebhooksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.parent !== "") {
writer.uint32(10).string(message.parent);
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): ListUserSessionsRequest {
+ decode(input: BinaryReader | Uint8Array, length?: number): ListUserWebhooksRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListUserSessionsRequest();
+ const message = createBaseListUserWebhooksRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -2315,32 +3690,32 @@ export const ListUserSessionsRequest: MessageFns<ListUserSessionsRequest> = {
return message;
},
- create(base?: DeepPartial<ListUserSessionsRequest>): ListUserSessionsRequest {
- return ListUserSessionsRequest.fromPartial(base ?? {});
+ create(base?: DeepPartial<ListUserWebhooksRequest>): ListUserWebhooksRequest {
+ return ListUserWebhooksRequest.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<ListUserSessionsRequest>): ListUserSessionsRequest {
- const message = createBaseListUserSessionsRequest();
+ fromPartial(object: DeepPartial<ListUserWebhooksRequest>): ListUserWebhooksRequest {
+ const message = createBaseListUserWebhooksRequest();
message.parent = object.parent ?? "";
return message;
},
};
-function createBaseListUserSessionsResponse(): ListUserSessionsResponse {
- return { sessions: [] };
+function createBaseListUserWebhooksResponse(): ListUserWebhooksResponse {
+ return { webhooks: [] };
}
-export const ListUserSessionsResponse: MessageFns<ListUserSessionsResponse> = {
- encode(message: ListUserSessionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- for (const v of message.sessions) {
- UserSession.encode(v!, writer.uint32(10).fork()).join();
+export const ListUserWebhooksResponse: MessageFns<ListUserWebhooksResponse> = {
+ encode(message: ListUserWebhooksResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ for (const v of message.webhooks) {
+ UserWebhook.encode(v!, writer.uint32(10).fork()).join();
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): ListUserSessionsResponse {
+ decode(input: BinaryReader | Uint8Array, length?: number): ListUserWebhooksResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListUserSessionsResponse();
+ const message = createBaseListUserWebhooksResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -2349,7 +3724,7 @@ export const ListUserSessionsResponse: MessageFns<ListUserSessionsResponse> = {
break;
}
- message.sessions.push(UserSession.decode(reader, reader.uint32()));
+ message.webhooks.push(UserWebhook.decode(reader, reader.uint32()));
continue;
}
}
@@ -2361,32 +3736,35 @@ export const ListUserSessionsResponse: MessageFns<ListUserSessionsResponse> = {
return message;
},
- create(base?: DeepPartial<ListUserSessionsResponse>): ListUserSessionsResponse {
- return ListUserSessionsResponse.fromPartial(base ?? {});
+ create(base?: DeepPartial<ListUserWebhooksResponse>): ListUserWebhooksResponse {
+ return ListUserWebhooksResponse.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<ListUserSessionsResponse>): ListUserSessionsResponse {
- const message = createBaseListUserSessionsResponse();
- message.sessions = object.sessions?.map((e) => UserSession.fromPartial(e)) || [];
+ fromPartial(object: DeepPartial<ListUserWebhooksResponse>): ListUserWebhooksResponse {
+ const message = createBaseListUserWebhooksResponse();
+ message.webhooks = object.webhooks?.map((e) => UserWebhook.fromPartial(e)) || [];
return message;
},
};
-function createBaseRevokeUserSessionRequest(): RevokeUserSessionRequest {
- return { name: "" };
+function createBaseCreateUserWebhookRequest(): CreateUserWebhookRequest {
+ return { parent: "", webhook: undefined };
}
-export const RevokeUserSessionRequest: MessageFns<RevokeUserSessionRequest> = {
- encode(message: RevokeUserSessionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
+export const CreateUserWebhookRequest: MessageFns<CreateUserWebhookRequest> = {
+ encode(message: CreateUserWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.parent !== "") {
+ writer.uint32(10).string(message.parent);
+ }
+ if (message.webhook !== undefined) {
+ UserWebhook.encode(message.webhook, writer.uint32(18).fork()).join();
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): RevokeUserSessionRequest {
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateUserWebhookRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseRevokeUserSessionRequest();
+ const message = createBaseCreateUserWebhookRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -2395,7 +3773,15 @@ export const RevokeUserSessionRequest: MessageFns<RevokeUserSessionRequest> = {
break;
}
- message.name = reader.string();
+ message.parent = reader.string();
+ continue;
+ }
+ case 2: {
+ if (tag !== 18) {
+ break;
+ }
+
+ message.webhook = UserWebhook.decode(reader, reader.uint32());
continue;
}
}
@@ -2407,44 +3793,47 @@ export const RevokeUserSessionRequest: MessageFns<RevokeUserSessionRequest> = {
return message;
},
- create(base?: DeepPartial<RevokeUserSessionRequest>): RevokeUserSessionRequest {
- return RevokeUserSessionRequest.fromPartial(base ?? {});
+ create(base?: DeepPartial<CreateUserWebhookRequest>): CreateUserWebhookRequest {
+ return CreateUserWebhookRequest.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<RevokeUserSessionRequest>): RevokeUserSessionRequest {
- const message = createBaseRevokeUserSessionRequest();
- message.name = object.name ?? "";
+ fromPartial(object: DeepPartial<CreateUserWebhookRequest>): CreateUserWebhookRequest {
+ const message = createBaseCreateUserWebhookRequest();
+ message.parent = object.parent ?? "";
+ message.webhook = (object.webhook !== undefined && object.webhook !== null)
+ ? UserWebhook.fromPartial(object.webhook)
+ : undefined;
return message;
},
};
-function createBaseListAllUserStatsRequest(): ListAllUserStatsRequest {
- return { pageSize: 0, pageToken: "" };
+function createBaseUpdateUserWebhookRequest(): UpdateUserWebhookRequest {
+ return { webhook: undefined, updateMask: undefined };
}
-export const ListAllUserStatsRequest: MessageFns<ListAllUserStatsRequest> = {
- encode(message: ListAllUserStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.pageSize !== 0) {
- writer.uint32(8).int32(message.pageSize);
+export const UpdateUserWebhookRequest: MessageFns<UpdateUserWebhookRequest> = {
+ encode(message: UpdateUserWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.webhook !== undefined) {
+ UserWebhook.encode(message.webhook, writer.uint32(10).fork()).join();
}
- if (message.pageToken !== "") {
- writer.uint32(18).string(message.pageToken);
+ if (message.updateMask !== undefined) {
+ FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsRequest {
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserWebhookRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListAllUserStatsRequest();
+ const message = createBaseUpdateUserWebhookRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
- if (tag !== 8) {
+ if (tag !== 10) {
break;
}
- message.pageSize = reader.int32();
+ message.webhook = UserWebhook.decode(reader, reader.uint32());
continue;
}
case 2: {
@@ -2452,7 +3841,7 @@ export const ListAllUserStatsRequest: MessageFns<ListAllUserStatsRequest> = {
break;
}
- message.pageToken = reader.string();
+ message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
continue;
}
}
@@ -2464,39 +3853,35 @@ export const ListAllUserStatsRequest: MessageFns<ListAllUserStatsRequest> = {
return message;
},
- create(base?: DeepPartial<ListAllUserStatsRequest>): ListAllUserStatsRequest {
- return ListAllUserStatsRequest.fromPartial(base ?? {});
+ create(base?: DeepPartial<UpdateUserWebhookRequest>): UpdateUserWebhookRequest {
+ return UpdateUserWebhookRequest.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<ListAllUserStatsRequest>): ListAllUserStatsRequest {
- const message = createBaseListAllUserStatsRequest();
- message.pageSize = object.pageSize ?? 0;
- message.pageToken = object.pageToken ?? "";
+ fromPartial(object: DeepPartial<UpdateUserWebhookRequest>): UpdateUserWebhookRequest {
+ const message = createBaseUpdateUserWebhookRequest();
+ message.webhook = (object.webhook !== undefined && object.webhook !== null)
+ ? UserWebhook.fromPartial(object.webhook)
+ : undefined;
+ message.updateMask = object.updateMask ?? undefined;
return message;
},
};
-function createBaseListAllUserStatsResponse(): ListAllUserStatsResponse {
- return { userStats: [], nextPageToken: "", totalSize: 0 };
+function createBaseDeleteUserWebhookRequest(): DeleteUserWebhookRequest {
+ return { name: "" };
}
-export const ListAllUserStatsResponse: MessageFns<ListAllUserStatsResponse> = {
- encode(message: ListAllUserStatsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- for (const v of message.userStats) {
- UserStats.encode(v!, writer.uint32(10).fork()).join();
- }
- if (message.nextPageToken !== "") {
- writer.uint32(18).string(message.nextPageToken);
- }
- if (message.totalSize !== 0) {
- writer.uint32(24).int32(message.totalSize);
+export const DeleteUserWebhookRequest: MessageFns<DeleteUserWebhookRequest> = {
+ encode(message: DeleteUserWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.name !== "") {
+ writer.uint32(10).string(message.name);
}
return writer;
},
- decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsResponse {
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteUserWebhookRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListAllUserStatsResponse();
+ const message = createBaseDeleteUserWebhookRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -2505,23 +3890,7 @@ export const ListAllUserStatsResponse: MessageFns<ListAllUserStatsResponse> = {
break;
}
- message.userStats.push(UserStats.decode(reader, reader.uint32()));
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.nextPageToken = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.totalSize = reader.int32();
+ message.name = reader.string();
continue;
}
}
@@ -2533,14 +3902,12 @@ export const ListAllUserStatsResponse: MessageFns<ListAllUserStatsResponse> = {
return message;
},
- create(base?: DeepPartial<ListAllUserStatsResponse>): ListAllUserStatsResponse {
- return ListAllUserStatsResponse.fromPartial(base ?? {});
+ create(base?: DeepPartial<DeleteUserWebhookRequest>): DeleteUserWebhookRequest {
+ return DeleteUserWebhookRequest.fromPartial(base ?? {});
},
- fromPartial(object: DeepPartial<ListAllUserStatsResponse>): ListAllUserStatsResponse {
- const message = createBaseListAllUserStatsResponse();
- message.userStats = object.userStats?.map((e) => UserStats.fromPartial(e)) || [];
- message.nextPageToken = object.nextPageToken ?? "";
- message.totalSize = object.totalSize ?? 0;
+ fromPartial(object: DeepPartial<DeleteUserWebhookRequest>): DeleteUserWebhookRequest {
+ const message = createBaseDeleteUserWebhookRequest();
+ message.name = object.name ?? "";
return message;
},
};
@@ -2953,18 +4320,18 @@ export const UserServiceDefinition = {
115,
47,
42,
- 125,
- 58,
- 103,
- 101,
- 116,
- 83,
+ 47,
+ 115,
101,
116,
116,
105,
110,
103,
+ 115,
+ 47,
+ 42,
+ 125,
]),
],
},
@@ -3005,7 +4372,7 @@ export const UserServiceDefinition = {
],
578365826: [
new Uint8Array([
- 55,
+ 52,
58,
7,
115,
@@ -3016,7 +4383,68 @@ export const UserServiceDefinition = {
110,
103,
50,
- 44,
+ 41,
+ 47,
+ 97,
+ 112,
+ 105,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 115,
+ 101,
+ 116,
+ 116,
+ 105,
+ 110,
+ 103,
+ 46,
+ 110,
+ 97,
+ 109,
+ 101,
+ 61,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 47,
+ 42,
+ 47,
+ 115,
+ 101,
+ 116,
+ 116,
+ 105,
+ 110,
+ 103,
+ 115,
+ 47,
+ 42,
+ 125,
+ ]),
+ ],
+ },
+ },
+ },
+ /** ListUserSettings returns a list of user settings. */
+ listUserSettings: {
+ name: "ListUserSettings",
+ requestType: ListUserSettingsRequest,
+ requestStream: false,
+ responseType: ListUserSettingsResponse,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],
+ 578365826: [
+ new Uint8Array([
+ 35,
+ 18,
+ 33,
47,
97,
112,
@@ -3026,18 +4454,12 @@ export const UserServiceDefinition = {
49,
47,
123,
- 115,
- 101,
- 116,
- 116,
- 105,
- 110,
- 103,
- 46,
- 110,
+ 112,
97,
- 109,
+ 114,
101,
+ 110,
+ 116,
61,
117,
115,
@@ -3047,20 +4469,15 @@ export const UserServiceDefinition = {
47,
42,
125,
- 58,
- 117,
- 112,
- 100,
- 97,
- 116,
- 101,
- 83,
+ 47,
+ 115,
101,
116,
116,
105,
110,
103,
+ 115,
]),
],
},
@@ -3380,6 +4797,267 @@ export const UserServiceDefinition = {
},
},
},
+ /** ListUserWebhooks returns a list of webhooks for a user. */
+ listUserWebhooks: {
+ name: "ListUserWebhooks",
+ requestType: ListUserWebhooksRequest,
+ requestStream: false,
+ responseType: ListUserWebhooksResponse,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],
+ 578365826: [
+ new Uint8Array([
+ 35,
+ 18,
+ 33,
+ 47,
+ 97,
+ 112,
+ 105,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 112,
+ 97,
+ 114,
+ 101,
+ 110,
+ 116,
+ 61,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 47,
+ 42,
+ 125,
+ 47,
+ 119,
+ 101,
+ 98,
+ 104,
+ 111,
+ 111,
+ 107,
+ 115,
+ ]),
+ ],
+ },
+ },
+ },
+ /** CreateUserWebhook creates a new webhook for a user. */
+ createUserWebhook: {
+ name: "CreateUserWebhook",
+ requestType: CreateUserWebhookRequest,
+ requestStream: false,
+ responseType: UserWebhook,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [new Uint8Array([14, 112, 97, 114, 101, 110, 116, 44, 119, 101, 98, 104, 111, 111, 107])],
+ 578365826: [
+ new Uint8Array([
+ 44,
+ 58,
+ 7,
+ 119,
+ 101,
+ 98,
+ 104,
+ 111,
+ 111,
+ 107,
+ 34,
+ 33,
+ 47,
+ 97,
+ 112,
+ 105,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 112,
+ 97,
+ 114,
+ 101,
+ 110,
+ 116,
+ 61,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 47,
+ 42,
+ 125,
+ 47,
+ 119,
+ 101,
+ 98,
+ 104,
+ 111,
+ 111,
+ 107,
+ 115,
+ ]),
+ ],
+ },
+ },
+ },
+ /** UpdateUserWebhook updates an existing webhook for a user. */
+ updateUserWebhook: {
+ name: "UpdateUserWebhook",
+ requestType: UpdateUserWebhookRequest,
+ requestStream: false,
+ responseType: UserWebhook,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [
+ new Uint8Array([
+ 19,
+ 119,
+ 101,
+ 98,
+ 104,
+ 111,
+ 111,
+ 107,
+ 44,
+ 117,
+ 112,
+ 100,
+ 97,
+ 116,
+ 101,
+ 95,
+ 109,
+ 97,
+ 115,
+ 107,
+ ]),
+ ],
+ 578365826: [
+ new Uint8Array([
+ 52,
+ 58,
+ 7,
+ 119,
+ 101,
+ 98,
+ 104,
+ 111,
+ 111,
+ 107,
+ 50,
+ 41,
+ 47,
+ 97,
+ 112,
+ 105,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 119,
+ 101,
+ 98,
+ 104,
+ 111,
+ 111,
+ 107,
+ 46,
+ 110,
+ 97,
+ 109,
+ 101,
+ 61,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 47,
+ 42,
+ 47,
+ 119,
+ 101,
+ 98,
+ 104,
+ 111,
+ 111,
+ 107,
+ 115,
+ 47,
+ 42,
+ 125,
+ ]),
+ ],
+ },
+ },
+ },
+ /** DeleteUserWebhook deletes a webhook for a user. */
+ deleteUserWebhook: {
+ name: "DeleteUserWebhook",
+ requestType: DeleteUserWebhookRequest,
+ requestStream: false,
+ responseType: Empty,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [new Uint8Array([4, 110, 97, 109, 101])],
+ 578365826: [
+ new Uint8Array([
+ 35,
+ 42,
+ 33,
+ 47,
+ 97,
+ 112,
+ 105,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 110,
+ 97,
+ 109,
+ 101,
+ 61,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 47,
+ 42,
+ 47,
+ 119,
+ 101,
+ 98,
+ 104,
+ 111,
+ 111,
+ 107,
+ 115,
+ 47,
+ 42,
+ 125,
+ ]),
+ ],
+ },
+ },
+ },
},
} as const;
diff --git a/web/src/types/proto/api/v1/webhook_service.ts b/web/src/types/proto/api/v1/webhook_service.ts
deleted file mode 100644
index 255ad0820..000000000
--- a/web/src/types/proto/api/v1/webhook_service.ts
+++ /dev/null
@@ -1,799 +0,0 @@
-// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
-// versions:
-// protoc-gen-ts_proto v2.6.1
-// protoc unknown
-// source: api/v1/webhook_service.proto
-
-/* eslint-disable */
-import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
-import { Empty } from "../../google/protobuf/empty";
-import { FieldMask } from "../../google/protobuf/field_mask";
-
-export const protobufPackage = "memos.api.v1";
-
-export interface Webhook {
- /**
- * The resource name of the webhook.
- * Format: users/{user}/webhooks/{webhook}
- */
- name: string;
- /** The display name of the webhook. */
- displayName: string;
- /** The target URL for the webhook. */
- url: string;
-}
-
-export interface ListWebhooksRequest {
- /**
- * Required. The parent resource where webhooks are listed.
- * Format: users/{user}
- */
- parent: string;
-}
-
-export interface ListWebhooksResponse {
- /** The list of webhooks. */
- webhooks: Webhook[];
-}
-
-export interface GetWebhookRequest {
- /**
- * Required. The resource name of the webhook to retrieve.
- * Format: users/{user}/webhooks/{webhook}
- */
- name: string;
-}
-
-export interface CreateWebhookRequest {
- /**
- * Required. The parent resource where this webhook will be created.
- * Format: users/{user}
- */
- parent: string;
- /** Required. The webhook to create. */
- webhook?:
- | Webhook
- | undefined;
- /** Optional. If set, validate the request, but do not actually create the webhook. */
- validateOnly: boolean;
-}
-
-export interface UpdateWebhookRequest {
- /** Required. The webhook resource which replaces the resource on the server. */
- webhook?:
- | Webhook
- | undefined;
- /** Optional. The list of fields to update. */
- updateMask?: string[] | undefined;
-}
-
-export interface DeleteWebhookRequest {
- /**
- * Required. The resource name of the webhook to delete.
- * Format: users/{user}/webhooks/{webhook}
- */
- name: string;
-}
-
-function createBaseWebhook(): Webhook {
- return { name: "", displayName: "", url: "" };
-}
-
-export const Webhook: MessageFns<Webhook> = {
- encode(message: Webhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- if (message.displayName !== "") {
- writer.uint32(18).string(message.displayName);
- }
- if (message.url !== "") {
- writer.uint32(26).string(message.url);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): Webhook {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseWebhook();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.name = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.displayName = 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<Webhook>): Webhook {
- return Webhook.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<Webhook>): Webhook {
- const message = createBaseWebhook();
- message.name = object.name ?? "";
- message.displayName = object.displayName ?? "";
- message.url = object.url ?? "";
- return message;
- },
-};
-
-function createBaseListWebhooksRequest(): ListWebhooksRequest {
- return { parent: "" };
-}
-
-export const ListWebhooksRequest: MessageFns<ListWebhooksRequest> = {
- encode(message: ListWebhooksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListWebhooksRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<ListWebhooksRequest>): ListWebhooksRequest {
- return ListWebhooksRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<ListWebhooksRequest>): ListWebhooksRequest {
- const message = createBaseListWebhooksRequest();
- message.parent = object.parent ?? "";
- return message;
- },
-};
-
-function createBaseListWebhooksResponse(): ListWebhooksResponse {
- return { webhooks: [] };
-}
-
-export const ListWebhooksResponse: MessageFns<ListWebhooksResponse> = {
- encode(message: ListWebhooksResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- for (const v of message.webhooks) {
- Webhook.encode(v!, writer.uint32(10).fork()).join();
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksResponse {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListWebhooksResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.webhooks.push(Webhook.decode(reader, reader.uint32()));
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<ListWebhooksResponse>): ListWebhooksResponse {
- return ListWebhooksResponse.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<ListWebhooksResponse>): ListWebhooksResponse {
- const message = createBaseListWebhooksResponse();
- message.webhooks = object.webhooks?.map((e) => Webhook.fromPartial(e)) || [];
- return message;
- },
-};
-
-function createBaseGetWebhookRequest(): GetWebhookRequest {
- return { name: "" };
-}
-
-export const GetWebhookRequest: MessageFns<GetWebhookRequest> = {
- encode(message: GetWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): GetWebhookRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseGetWebhookRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.name = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<GetWebhookRequest>): GetWebhookRequest {
- return GetWebhookRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<GetWebhookRequest>): GetWebhookRequest {
- const message = createBaseGetWebhookRequest();
- message.name = object.name ?? "";
- return message;
- },
-};
-
-function createBaseCreateWebhookRequest(): CreateWebhookRequest {
- return { parent: "", webhook: undefined, validateOnly: false };
-}
-
-export const CreateWebhookRequest: MessageFns<CreateWebhookRequest> = {
- encode(message: CreateWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- if (message.webhook !== undefined) {
- Webhook.encode(message.webhook, writer.uint32(18).fork()).join();
- }
- if (message.validateOnly !== false) {
- writer.uint32(24).bool(message.validateOnly);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): CreateWebhookRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseCreateWebhookRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.webhook = Webhook.decode(reader, reader.uint32());
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.validateOnly = reader.bool();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<CreateWebhookRequest>): CreateWebhookRequest {
- return CreateWebhookRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<CreateWebhookRequest>): CreateWebhookRequest {
- const message = createBaseCreateWebhookRequest();
- message.parent = object.parent ?? "";
- message.webhook = (object.webhook !== undefined && object.webhook !== null)
- ? Webhook.fromPartial(object.webhook)
- : undefined;
- message.validateOnly = object.validateOnly ?? false;
- return message;
- },
-};
-
-function createBaseUpdateWebhookRequest(): UpdateWebhookRequest {
- return { webhook: undefined, updateMask: undefined };
-}
-
-export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = {
- encode(message: UpdateWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.webhook !== undefined) {
- Webhook.encode(message.webhook, writer.uint32(10).fork()).join();
- }
- if (message.updateMask !== undefined) {
- FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): UpdateWebhookRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseUpdateWebhookRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.webhook = Webhook.decode(reader, reader.uint32());
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<UpdateWebhookRequest>): UpdateWebhookRequest {
- return UpdateWebhookRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<UpdateWebhookRequest>): UpdateWebhookRequest {
- const message = createBaseUpdateWebhookRequest();
- message.webhook = (object.webhook !== undefined && object.webhook !== null)
- ? Webhook.fromPartial(object.webhook)
- : undefined;
- message.updateMask = object.updateMask ?? undefined;
- return message;
- },
-};
-
-function createBaseDeleteWebhookRequest(): DeleteWebhookRequest {
- return { name: "" };
-}
-
-export const DeleteWebhookRequest: MessageFns<DeleteWebhookRequest> = {
- encode(message: DeleteWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.name !== "") {
- writer.uint32(10).string(message.name);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): DeleteWebhookRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseDeleteWebhookRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.name = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<DeleteWebhookRequest>): DeleteWebhookRequest {
- return DeleteWebhookRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<DeleteWebhookRequest>): DeleteWebhookRequest {
- const message = createBaseDeleteWebhookRequest();
- message.name = object.name ?? "";
- return message;
- },
-};
-
-export type WebhookServiceDefinition = typeof WebhookServiceDefinition;
-export const WebhookServiceDefinition = {
- name: "WebhookService",
- fullName: "memos.api.v1.WebhookService",
- methods: {
- /** ListWebhooks returns a list of webhooks for a user. */
- listWebhooks: {
- name: "ListWebhooks",
- requestType: ListWebhooksRequest,
- requestStream: false,
- responseType: ListWebhooksResponse,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],
- 578365826: [
- new Uint8Array([
- 35,
- 18,
- 33,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 125,
- 47,
- 119,
- 101,
- 98,
- 104,
- 111,
- 111,
- 107,
- 115,
- ]),
- ],
- },
- },
- },
- /** GetWebhook gets a webhook by name. */
- getWebhook: {
- name: "GetWebhook",
- requestType: GetWebhookRequest,
- requestStream: false,
- responseType: Webhook,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([4, 110, 97, 109, 101])],
- 578365826: [
- new Uint8Array([
- 35,
- 18,
- 33,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 110,
- 97,
- 109,
- 101,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 47,
- 119,
- 101,
- 98,
- 104,
- 111,
- 111,
- 107,
- 115,
- 47,
- 42,
- 125,
- ]),
- ],
- },
- },
- },
- /** CreateWebhook creates a new webhook for a user. */
- createWebhook: {
- name: "CreateWebhook",
- requestType: CreateWebhookRequest,
- requestStream: false,
- responseType: Webhook,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([14, 112, 97, 114, 101, 110, 116, 44, 119, 101, 98, 104, 111, 111, 107])],
- 578365826: [
- new Uint8Array([
- 44,
- 58,
- 7,
- 119,
- 101,
- 98,
- 104,
- 111,
- 111,
- 107,
- 34,
- 33,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 125,
- 47,
- 119,
- 101,
- 98,
- 104,
- 111,
- 111,
- 107,
- 115,
- ]),
- ],
- },
- },
- },
- /** UpdateWebhook updates a webhook for a user. */
- updateWebhook: {
- name: "UpdateWebhook",
- requestType: UpdateWebhookRequest,
- requestStream: false,
- responseType: Webhook,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [
- new Uint8Array([
- 19,
- 119,
- 101,
- 98,
- 104,
- 111,
- 111,
- 107,
- 44,
- 117,
- 112,
- 100,
- 97,
- 116,
- 101,
- 95,
- 109,
- 97,
- 115,
- 107,
- ]),
- ],
- 578365826: [
- new Uint8Array([
- 52,
- 58,
- 7,
- 119,
- 101,
- 98,
- 104,
- 111,
- 111,
- 107,
- 50,
- 41,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 119,
- 101,
- 98,
- 104,
- 111,
- 111,
- 107,
- 46,
- 110,
- 97,
- 109,
- 101,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 47,
- 119,
- 101,
- 98,
- 104,
- 111,
- 111,
- 107,
- 115,
- 47,
- 42,
- 125,
- ]),
- ],
- },
- },
- },
- /** DeleteWebhook deletes a webhook for a user. */
- deleteWebhook: {
- name: "DeleteWebhook",
- requestType: DeleteWebhookRequest,
- requestStream: false,
- responseType: Empty,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([4, 110, 97, 109, 101])],
- 578365826: [
- new Uint8Array([
- 35,
- 42,
- 33,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 110,
- 97,
- 109,
- 101,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 47,
- 119,
- 101,
- 98,
- 104,
- 111,
- 111,
- 107,
- 115,
- 47,
- 42,
- 125,
- ]),
- ],
- },
- },
- },
- },
-} as const;
-
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
-
-export type DeepPartial<T> = T extends Builtin ? T
- : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
- : Partial<T>;
-
-export interface MessageFns<T> {
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
- decode(input: BinaryReader | Uint8Array, length?: number): T;
- create(base?: DeepPartial<T>): T;
- fromPartial(object: DeepPartial<T>): T;
-}