From 8a796d12b4b6f2735d1eb09b5975746dabbd0e70 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 14 Sep 2023 19:18:54 +0800 Subject: [PATCH] chore: add user access token setting definition --- api/v2/user_service.go | 33 - proto/api/v2/user_service.proto | 97 +- proto/gen/api/v2/README.md | 148 ++- proto/gen/api/v2/user_service.pb.go | 871 ++++++++++++------ proto/gen/api/v2/user_service.pb.gw.go | 345 +++++++ proto/gen/api/v2/user_service_grpc.pb.go | 121 ++- proto/gen/store/README.md | 82 ++ proto/gen/store/user_setting.pb.go | 395 ++++++++ proto/store/user_setting.proto | 30 + .../types/proto/api/v2/user_service_pb.d.ts | 251 +++-- web/src/types/proto/api/v2/user_service_pb.js | 97 +- .../types/proto/store/user_setting_pb.d.ts | 116 +++ web/src/types/proto/store/user_setting_pb.js | 51 + 13 files changed, 2103 insertions(+), 534 deletions(-) create mode 100644 proto/gen/store/user_setting.pb.go create mode 100644 proto/store/user_setting.proto create mode 100644 web/src/types/proto/store/user_setting_pb.d.ts create mode 100644 web/src/types/proto/store/user_setting_pb.js diff --git a/api/v2/user_service.go b/api/v2/user_service.go index 8db882ca..32ff29a9 100644 --- a/api/v2/user_service.go +++ b/api/v2/user_service.go @@ -156,36 +156,3 @@ func convertUserRoleToStore(role apiv2pb.User_Role) store.Role { return store.RoleUser } } - -// ConvertUserSettingFromStore converts a user setting from store to protobuf. -func ConvertUserSettingFromStore(userSetting *store.UserSetting) *apiv2pb.UserSetting { - userSettingKey := apiv2pb.UserSetting_KEY_UNSPECIFIED - userSettingValue := &apiv2pb.UserSettingValue{} - switch userSetting.Key { - case "locale": - userSettingKey = apiv2pb.UserSetting_LOCALE - userSettingValue.Value = &apiv2pb.UserSettingValue_StringValue{ - StringValue: userSetting.Value, - } - case "appearance": - userSettingKey = apiv2pb.UserSetting_APPEARANCE - userSettingValue.Value = &apiv2pb.UserSettingValue_StringValue{ - StringValue: userSetting.Value, - } - case "memo-visibility": - userSettingKey = apiv2pb.UserSetting_MEMO_VISIBILITY - userSettingValue.Value = &apiv2pb.UserSettingValue_VisibilityValue{ - VisibilityValue: convertVisibilityFromStore(store.Visibility(userSetting.Value)), - } - case "telegram-user-id": - userSettingKey = apiv2pb.UserSetting_TELEGRAM_USER_ID - userSettingValue.Value = &apiv2pb.UserSettingValue_StringValue{ - StringValue: userSetting.Value, - } - } - return &apiv2pb.UserSetting{ - UserId: int32(userSetting.UserID), - Key: userSettingKey, - Value: userSettingValue, - } -} diff --git a/proto/api/v2/user_service.proto b/proto/api/v2/user_service.proto index 2c0db612..80d56d91 100644 --- a/proto/api/v2/user_service.proto +++ b/proto/api/v2/user_service.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package memos.api.v2; import "api/v2/common.proto"; -import "api/v2/memo_service.proto"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; @@ -23,18 +22,30 @@ service UserService { }; option (google.api.method_signature) = "username"; } + // ListUserAccessTokens returns a list of access tokens for a user. + rpc ListUserAccessTokens(ListUserAccessTokensRequest) returns (ListUserAccessTokensResponse) { + option (google.api.http) = {get: "/api/v2/users/{username}/access_tokens"}; + option (google.api.method_signature) = "username"; + } + // CreateUserAccessToken creates a new access token for a user. + rpc CreateUserAccessToken(CreateUserAccessTokenRequest) returns (CreateUserAccessTokenResponse) { + option (google.api.http) = { + post: "/api/v2/users/{username}/access_tokens" + body: "user_access_token" + }; + option (google.api.method_signature) = "username"; + } + // DeleteUserAccessToken deletes an access token for a user. + rpc DeleteUserAccessToken(DeleteUserAccessTokenRequest) returns (DeleteUserAccessTokenResponse) { + option (google.api.http) = {delete: "/api/v2/users/{username}/access_tokens/{access_token}"}; + option (google.api.method_signature) = "username,access_token"; + } } message User { int32 id = 1; - RowStatus row_status = 2; - - google.protobuf.Timestamp create_time = 3; - - google.protobuf.Timestamp update_time = 4; - - string username = 5; + string username = 2; enum Role { ROLE_UNSPECIFIED = 0; @@ -42,18 +53,23 @@ message User { ADMIN = 2; USER = 3; } + Role role = 3; - Role role = 6; + string email = 4; - string email = 7; + string nickname = 5; - string nickname = 8; + string open_id = 6; - string open_id = 9; + string avatar_url = 7; - string avatar_url = 10; + string password = 8 [(google.api.field_behavior) = INPUT_ONLY]; - string password = 11 [(google.api.field_behavior) = INPUT_ONLY]; + RowStatus row_status = 9; + + google.protobuf.Timestamp create_time = 10; + + google.protobuf.Timestamp update_time = 11; } message GetUserRequest { @@ -77,32 +93,35 @@ message UpdateUserResponse { User user = 1; } -message UserSetting { - // The user id of the setting. - int32 user_id = 1; - - enum Key { - KEY_UNSPECIFIED = 0; - // The preferred locale. - LOCALE = 1; - // The preferred appearance. - APPEARANCE = 2; - // The default visibility of the memo when creating a new memo. - MEMO_VISIBILITY = 3; - // User's telegram id - TELEGRAM_USER_ID = 4; - } - // The key of the setting. - Key key = 2; +message ListUserAccessTokensRequest { + string username = 1; +} - // The value of the setting. - UserSettingValue value = 3; +message ListUserAccessTokensResponse { + repeated UserAccessToken access_tokens = 1; } -message UserSettingValue { - oneof value { - // Default value as a string. - string string_value = 1; - Visibility visibility_value = 2; - } +message CreateUserAccessTokenRequest { + string username = 1; + + UserAccessToken user_access_token = 2; +} + +message CreateUserAccessTokenResponse { + UserAccessToken access_token = 1; +} + +message DeleteUserAccessTokenRequest { + string username = 1; + // access_token is the access token to delete. + string access_token = 2; +} + +message DeleteUserAccessTokenResponse {} + +message UserAccessToken { + string access_token = 1; + string description = 2; + google.protobuf.Timestamp issued_at = 3; + google.protobuf.Timestamp expires_at = 4; } diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 9bf1fe0b..f28dfe17 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -34,16 +34,20 @@ - [TagService](#memos-api-v2-TagService) - [api/v2/user_service.proto](#api_v2_user_service-proto) + - [CreateUserAccessTokenRequest](#memos-api-v2-CreateUserAccessTokenRequest) + - [CreateUserAccessTokenResponse](#memos-api-v2-CreateUserAccessTokenResponse) + - [DeleteUserAccessTokenRequest](#memos-api-v2-DeleteUserAccessTokenRequest) + - [DeleteUserAccessTokenResponse](#memos-api-v2-DeleteUserAccessTokenResponse) - [GetUserRequest](#memos-api-v2-GetUserRequest) - [GetUserResponse](#memos-api-v2-GetUserResponse) + - [ListUserAccessTokensRequest](#memos-api-v2-ListUserAccessTokensRequest) + - [ListUserAccessTokensResponse](#memos-api-v2-ListUserAccessTokensResponse) - [UpdateUserRequest](#memos-api-v2-UpdateUserRequest) - [UpdateUserResponse](#memos-api-v2-UpdateUserResponse) - [User](#memos-api-v2-User) - - [UserSetting](#memos-api-v2-UserSetting) - - [UserSettingValue](#memos-api-v2-UserSettingValue) + - [UserAccessToken](#memos-api-v2-UserAccessToken) - [User.Role](#memos-api-v2-User-Role) - - [UserSetting.Key](#memos-api-v2-UserSetting-Key) - [UserService](#memos-api-v2-UserService) @@ -388,6 +392,63 @@ + + +### CreateUserAccessTokenRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| username | [string](#string) | | | +| user_access_token | [UserAccessToken](#memos-api-v2-UserAccessToken) | | | + + + + + + + + +### CreateUserAccessTokenResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| access_token | [UserAccessToken](#memos-api-v2-UserAccessToken) | | | + + + + + + + + +### DeleteUserAccessTokenRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| username | [string](#string) | | | +| access_token | [string](#string) | | access_token is the access token to delete. | + + + + + + + + +### DeleteUserAccessTokenResponse + + + + + + + ### GetUserRequest @@ -418,6 +479,36 @@ + + +### ListUserAccessTokensRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| username | [string](#string) | | | + + + + + + + + +### ListUserAccessTokensResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| access_tokens | [UserAccessToken](#memos-api-v2-UserAccessToken) | repeated | | + + + + + + ### UpdateUserRequest @@ -459,9 +550,6 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | id | [int32](#int32) | | | -| row_status | [RowStatus](#memos-api-v2-RowStatus) | | | -| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | | username | [string](#string) | | | | role | [User.Role](#memos-api-v2-User-Role) | | | | email | [string](#string) | | | @@ -469,39 +557,27 @@ | open_id | [string](#string) | | | | avatar_url | [string](#string) | | | | password | [string](#string) | | | +| row_status | [RowStatus](#memos-api-v2-RowStatus) | | | +| create_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| update_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | - - -### UserSetting - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| user_id | [int32](#int32) | | The user id of the setting. | -| key | [UserSetting.Key](#memos-api-v2-UserSetting-Key) | | The key of the setting. | -| value | [UserSettingValue](#memos-api-v2-UserSettingValue) | | The value of the setting. | - - - - - - - + -### UserSettingValue +### UserAccessToken | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| string_value | [string](#string) | | Default value as a string. | -| visibility_value | [Visibility](#memos-api-v2-Visibility) | | | +| access_token | [string](#string) | | | +| description | [string](#string) | | | +| issued_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| expires_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | @@ -523,21 +599,6 @@ | USER | 3 | | - - - -### UserSetting.Key - - -| Name | Number | Description | -| ---- | ------ | ----------- | -| KEY_UNSPECIFIED | 0 | | -| LOCALE | 1 | The preferred locale. | -| APPEARANCE | 2 | The preferred appearance. | -| MEMO_VISIBILITY | 3 | The default visibility of the memo when creating a new memo. | -| TELEGRAM_USER_ID | 4 | User's telegram id | - - @@ -552,6 +613,9 @@ | ----------- | ------------ | ------------- | ------------| | GetUser | [GetUserRequest](#memos-api-v2-GetUserRequest) | [GetUserResponse](#memos-api-v2-GetUserResponse) | | | UpdateUser | [UpdateUserRequest](#memos-api-v2-UpdateUserRequest) | [UpdateUserResponse](#memos-api-v2-UpdateUserResponse) | | +| ListUserAccessTokens | [ListUserAccessTokensRequest](#memos-api-v2-ListUserAccessTokensRequest) | [ListUserAccessTokensResponse](#memos-api-v2-ListUserAccessTokensResponse) | ListUserAccessTokens returns a list of access tokens for a user. | +| CreateUserAccessToken | [CreateUserAccessTokenRequest](#memos-api-v2-CreateUserAccessTokenRequest) | [CreateUserAccessTokenResponse](#memos-api-v2-CreateUserAccessTokenResponse) | CreateUserAccessToken creates a new access token for a user. | +| DeleteUserAccessToken | [DeleteUserAccessTokenRequest](#memos-api-v2-DeleteUserAccessTokenRequest) | [DeleteUserAccessTokenResponse](#memos-api-v2-DeleteUserAccessTokenResponse) | DeleteUserAccessToken deletes an access token for a user. | diff --git a/proto/gen/api/v2/user_service.pb.go b/proto/gen/api/v2/user_service.pb.go index 3ee8506f..71184b36 100644 --- a/proto/gen/api/v2/user_service.pb.go +++ b/proto/gen/api/v2/user_service.pb.go @@ -74,81 +74,22 @@ func (User_Role) EnumDescriptor() ([]byte, []int) { return file_api_v2_user_service_proto_rawDescGZIP(), []int{0, 0} } -type UserSetting_Key int32 - -const ( - UserSetting_KEY_UNSPECIFIED UserSetting_Key = 0 - // The preferred locale. - UserSetting_LOCALE UserSetting_Key = 1 - // The preferred appearance. - UserSetting_APPEARANCE UserSetting_Key = 2 - // The default visibility of the memo when creating a new memo. - UserSetting_MEMO_VISIBILITY UserSetting_Key = 3 - // User's telegram id - UserSetting_TELEGRAM_USER_ID UserSetting_Key = 4 -) - -// Enum value maps for UserSetting_Key. -var ( - UserSetting_Key_name = map[int32]string{ - 0: "KEY_UNSPECIFIED", - 1: "LOCALE", - 2: "APPEARANCE", - 3: "MEMO_VISIBILITY", - 4: "TELEGRAM_USER_ID", - } - UserSetting_Key_value = map[string]int32{ - "KEY_UNSPECIFIED": 0, - "LOCALE": 1, - "APPEARANCE": 2, - "MEMO_VISIBILITY": 3, - "TELEGRAM_USER_ID": 4, - } -) - -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_v2_user_service_proto_enumTypes[1].Descriptor() -} - -func (UserSetting_Key) Type() protoreflect.EnumType { - return &file_api_v2_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_v2_user_service_proto_rawDescGZIP(), []int{5, 0} -} - type User struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - RowStatus RowStatus `protobuf:"varint,2,opt,name=row_status,json=rowStatus,proto3,enum=memos.api.v2.RowStatus" json:"row_status,omitempty"` - CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` - UpdateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` - Username string `protobuf:"bytes,5,opt,name=username,proto3" json:"username,omitempty"` - Role User_Role `protobuf:"varint,6,opt,name=role,proto3,enum=memos.api.v2.User_Role" json:"role,omitempty"` - Email string `protobuf:"bytes,7,opt,name=email,proto3" json:"email,omitempty"` - Nickname string `protobuf:"bytes,8,opt,name=nickname,proto3" json:"nickname,omitempty"` - OpenId string `protobuf:"bytes,9,opt,name=open_id,json=openId,proto3" json:"open_id,omitempty"` - AvatarUrl string `protobuf:"bytes,10,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` - Password string `protobuf:"bytes,11,opt,name=password,proto3" json:"password,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Role User_Role `protobuf:"varint,3,opt,name=role,proto3,enum=memos.api.v2.User_Role" json:"role,omitempty"` + Email string `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"` + Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname,omitempty"` + OpenId string `protobuf:"bytes,6,opt,name=open_id,json=openId,proto3" json:"open_id,omitempty"` + AvatarUrl string `protobuf:"bytes,7,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` + Password string `protobuf:"bytes,8,opt,name=password,proto3" json:"password,omitempty"` + RowStatus RowStatus `protobuf:"varint,9,opt,name=row_status,json=rowStatus,proto3,enum=memos.api.v2.RowStatus" json:"row_status,omitempty"` + CreateTime *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` + UpdateTime *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` } func (x *User) Reset() { @@ -190,27 +131,6 @@ func (x *User) GetId() int32 { return 0 } -func (x *User) GetRowStatus() RowStatus { - if x != nil { - return x.RowStatus - } - return RowStatus_ROW_STATUS_UNSPECIFIED -} - -func (x *User) GetCreateTime() *timestamppb.Timestamp { - if x != nil { - return x.CreateTime - } - return nil -} - -func (x *User) GetUpdateTime() *timestamppb.Timestamp { - if x != nil { - return x.UpdateTime - } - return nil -} - func (x *User) GetUsername() string { if x != nil { return x.Username @@ -260,6 +180,27 @@ func (x *User) GetPassword() string { return "" } +func (x *User) GetRowStatus() RowStatus { + if x != nil { + return x.RowStatus + } + return RowStatus_ROW_STATUS_UNSPECIFIED +} + +func (x *User) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +func (x *User) GetUpdateTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdateTime + } + return nil +} + type GetUserRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -465,21 +406,16 @@ func (x *UpdateUserResponse) GetUser() *User { return nil } -type UserSetting struct { +type ListUserAccessTokensRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The user id of the setting. - UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - // The key of the setting. - Key UserSetting_Key `protobuf:"varint,2,opt,name=key,proto3,enum=memos.api.v2.UserSetting_Key" json:"key,omitempty"` - // The value of the setting. - Value *UserSettingValue `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` } -func (x *UserSetting) Reset() { - *x = UserSetting{} +func (x *ListUserAccessTokensRequest) Reset() { + *x = ListUserAccessTokensRequest{} if protoimpl.UnsafeEnabled { mi := &file_api_v2_user_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -487,13 +423,13 @@ func (x *UserSetting) Reset() { } } -func (x *UserSetting) String() string { +func (x *ListUserAccessTokensRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*UserSetting) ProtoMessage() {} +func (*ListUserAccessTokensRequest) ProtoMessage() {} -func (x *UserSetting) ProtoReflect() protoreflect.Message { +func (x *ListUserAccessTokensRequest) ProtoReflect() protoreflect.Message { mi := &file_api_v2_user_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -505,61 +441,145 @@ func (x *UserSetting) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UserSetting.ProtoReflect.Descriptor instead. -func (*UserSetting) Descriptor() ([]byte, []int) { +// Deprecated: Use ListUserAccessTokensRequest.ProtoReflect.Descriptor instead. +func (*ListUserAccessTokensRequest) Descriptor() ([]byte, []int) { return file_api_v2_user_service_proto_rawDescGZIP(), []int{5} } -func (x *UserSetting) GetUserId() int32 { +func (x *ListUserAccessTokensRequest) GetUsername() string { if x != nil { - return x.UserId + return x.Username + } + return "" +} + +type ListUserAccessTokensResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AccessTokens []*UserAccessToken `protobuf:"bytes,1,rep,name=access_tokens,json=accessTokens,proto3" json:"access_tokens,omitempty"` +} + +func (x *ListUserAccessTokensResponse) Reset() { + *x = ListUserAccessTokensResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -func (x *UserSetting) GetKey() UserSetting_Key { +func (x *ListUserAccessTokensResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserAccessTokensResponse) ProtoMessage() {} + +func (x *ListUserAccessTokensResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserAccessTokensResponse.ProtoReflect.Descriptor instead. +func (*ListUserAccessTokensResponse) Descriptor() ([]byte, []int) { + return file_api_v2_user_service_proto_rawDescGZIP(), []int{6} +} + +func (x *ListUserAccessTokensResponse) GetAccessTokens() []*UserAccessToken { if x != nil { - return x.Key + return x.AccessTokens } - return UserSetting_KEY_UNSPECIFIED + return nil } -func (x *UserSetting) GetValue() *UserSettingValue { +type CreateUserAccessTokenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + UserAccessToken *UserAccessToken `protobuf:"bytes,2,opt,name=user_access_token,json=userAccessToken,proto3" json:"user_access_token,omitempty"` +} + +func (x *CreateUserAccessTokenRequest) Reset() { + *x = CreateUserAccessTokenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateUserAccessTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserAccessTokenRequest) ProtoMessage() {} + +func (x *CreateUserAccessTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserAccessTokenRequest.ProtoReflect.Descriptor instead. +func (*CreateUserAccessTokenRequest) Descriptor() ([]byte, []int) { + return file_api_v2_user_service_proto_rawDescGZIP(), []int{7} +} + +func (x *CreateUserAccessTokenRequest) GetUsername() string { if x != nil { - return x.Value + return x.Username + } + return "" +} + +func (x *CreateUserAccessTokenRequest) GetUserAccessToken() *UserAccessToken { + if x != nil { + return x.UserAccessToken } return nil } -type UserSettingValue struct { +type CreateUserAccessTokenResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Types that are assignable to Value: - // - // *UserSettingValue_StringValue - // *UserSettingValue_VisibilityValue - Value isUserSettingValue_Value `protobuf_oneof:"value"` + AccessToken *UserAccessToken `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` } -func (x *UserSettingValue) Reset() { - *x = UserSettingValue{} +func (x *CreateUserAccessTokenResponse) Reset() { + *x = CreateUserAccessTokenResponse{} if protoimpl.UnsafeEnabled { - mi := &file_api_v2_user_service_proto_msgTypes[6] + mi := &file_api_v2_user_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *UserSettingValue) String() string { +func (x *CreateUserAccessTokenResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*UserSettingValue) ProtoMessage() {} +func (*CreateUserAccessTokenResponse) ProtoMessage() {} -func (x *UserSettingValue) ProtoReflect() protoreflect.Message { - mi := &file_api_v2_user_service_proto_msgTypes[6] +func (x *CreateUserAccessTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_service_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -570,48 +590,182 @@ func (x *UserSettingValue) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UserSettingValue.ProtoReflect.Descriptor instead. -func (*UserSettingValue) Descriptor() ([]byte, []int) { - return file_api_v2_user_service_proto_rawDescGZIP(), []int{6} +// Deprecated: Use CreateUserAccessTokenResponse.ProtoReflect.Descriptor instead. +func (*CreateUserAccessTokenResponse) Descriptor() ([]byte, []int) { + return file_api_v2_user_service_proto_rawDescGZIP(), []int{8} } -func (m *UserSettingValue) GetValue() isUserSettingValue_Value { - if m != nil { - return m.Value +func (x *CreateUserAccessTokenResponse) GetAccessToken() *UserAccessToken { + if x != nil { + return x.AccessToken } return nil } -func (x *UserSettingValue) GetStringValue() string { - if x, ok := x.GetValue().(*UserSettingValue_StringValue); ok { - return x.StringValue +type DeleteUserAccessTokenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + // access_token is the access token to delete. + AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` +} + +func (x *DeleteUserAccessTokenRequest) Reset() { + *x = DeleteUserAccessTokenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteUserAccessTokenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserAccessTokenRequest) ProtoMessage() {} + +func (x *DeleteUserAccessTokenRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserAccessTokenRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserAccessTokenRequest) Descriptor() ([]byte, []int) { + return file_api_v2_user_service_proto_rawDescGZIP(), []int{9} +} + +func (x *DeleteUserAccessTokenRequest) GetUsername() string { + if x != nil { + return x.Username } return "" } -func (x *UserSettingValue) GetVisibilityValue() Visibility { - if x, ok := x.GetValue().(*UserSettingValue_VisibilityValue); ok { - return x.VisibilityValue +func (x *DeleteUserAccessTokenRequest) GetAccessToken() string { + if x != nil { + return x.AccessToken } - return Visibility_VISIBILITY_UNSPECIFIED + return "" } -type isUserSettingValue_Value interface { - isUserSettingValue_Value() +type DeleteUserAccessTokenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -type UserSettingValue_StringValue struct { - // Default value as a string. - StringValue string `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3,oneof"` +func (x *DeleteUserAccessTokenResponse) Reset() { + *x = DeleteUserAccessTokenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -type UserSettingValue_VisibilityValue struct { - VisibilityValue Visibility `protobuf:"varint,2,opt,name=visibility_value,json=visibilityValue,proto3,enum=memos.api.v2.Visibility,oneof"` +func (x *DeleteUserAccessTokenResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (*UserSettingValue_StringValue) isUserSettingValue_Value() {} +func (*DeleteUserAccessTokenResponse) ProtoMessage() {} -func (*UserSettingValue_VisibilityValue) isUserSettingValue_Value() {} +func (x *DeleteUserAccessTokenResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_user_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserAccessTokenResponse.ProtoReflect.Descriptor instead. +func (*DeleteUserAccessTokenResponse) Descriptor() ([]byte, []int) { + return file_api_v2_user_service_proto_rawDescGZIP(), []int{10} +} + +type UserAccessToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + IssuedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=issued_at,json=issuedAt,proto3" json:"issued_at,omitempty"` + ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` +} + +func (x *UserAccessToken) Reset() { + *x = UserAccessToken{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_user_service_proto_msgTypes[11] + 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_v2_user_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && 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_v2_user_service_proto_rawDescGZIP(), []int{11} +} + +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 +} var File_api_v2_user_service_proto protoreflect.FileDescriptor @@ -619,116 +773,171 @@ var file_api_v2_user_service_proto_rawDesc = []byte{ 0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x13, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x32, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, - 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xd9, 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x36, 0x0a, 0x0a, 0x72, - 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x17, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, - 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x72, 0x6f, 0x77, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, - 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x72, 0x6f, 0x6c, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x6f, 0x6c, 0x65, - 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, - 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x70, 0x65, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49, - 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, - 0x12, 0x1f, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x04, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x22, 0x3b, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x4f, 0x4c, - 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x08, 0x0a, 0x04, 0x48, 0x4f, 0x53, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x44, 0x4d, - 0x49, 0x4e, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x03, 0x22, 0x2c, - 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x39, 0x0a, 0x0f, - 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, - 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x78, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, - 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, - 0x6b, 0x22, 0x3c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, - 0xf0, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, - 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x61, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x13, 0x0a, 0x0f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4c, - 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x50, 0x50, 0x45, 0x41, - 0x52, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, - 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, - 0x54, 0x45, 0x4c, 0x45, 0x47, 0x52, 0x41, 0x4d, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x49, 0x44, - 0x10, 0x04, 0x22, 0x87, 0x01, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x45, 0x0a, 0x10, - 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, - 0x48, 0x00, 0x52, 0x0f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x32, 0x83, 0x02, 0x0a, - 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x73, 0x0a, 0x07, - 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0xda, 0x41, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, - 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, + 0x32, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd9, 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x04, + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x52, + 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, + 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, + 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6f, + 0x70, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, + 0x65, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, + 0x55, 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x04, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x12, 0x36, 0x0a, 0x0a, 0x72, 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x09, 0x72, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3b, 0x0a, 0x0b, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x3b, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x14, + 0x0a, 0x10, 0x52, 0x4f, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x4f, 0x53, 0x54, 0x10, 0x01, 0x12, 0x09, + 0x0a, 0x05, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, + 0x52, 0x10, 0x03, 0x22, 0x2c, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, + 0x65, 0x22, 0x39, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x78, 0x0a, 0x11, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, + 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x3c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x22, 0x39, 0x0a, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0x62, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x42, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x73, 0x22, 0x85, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x49, 0x0a, 0x11, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x72, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x61, 0x0a, 0x1d, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x5d, + 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, + 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x1f, 0x0a, + 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xca, + 0x01, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x09, 0x69, 0x73, 0x73, 0x75, 0x65, + 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x08, 0x69, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x74, + 0x12, 0x39, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x61, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x32, 0xb9, 0x06, 0x0a, 0x0b, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x73, 0x0a, 0x07, 0x47, + 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x2b, 0xda, 0x41, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, + 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x7d, + 0x12, 0x7f, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x2e, 0xda, 0x41, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x1d, 0x3a, 0x01, 0x2a, 0x22, 0x18, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, - 0x7d, 0x12, 0x7f, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, - 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x2e, 0xda, 0x41, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x3a, 0x01, 0x2a, 0x22, 0x18, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, - 0x65, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, - 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, - 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, - 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, - 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x7d, 0x12, 0xa8, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x29, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x39, 0xda, 0x41, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x73, + 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0xbe, 0x01, 0x0a, + 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x4c, 0xda, 0x41, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x3b, 0x3a, 0x11, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x26, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x75, + 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0xc7, 0x01, + 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x55, 0xda, 0x41, 0x15, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, + 0x2a, 0x35, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, + 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2f, 0x7b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x10, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, + 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, + 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, + 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, + 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -743,42 +952,53 @@ func file_api_v2_user_service_proto_rawDescGZIP() []byte { return file_api_v2_user_service_proto_rawDescData } -var file_api_v2_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_api_v2_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_api_v2_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_v2_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_api_v2_user_service_proto_goTypes = []interface{}{ - (User_Role)(0), // 0: memos.api.v2.User.Role - (UserSetting_Key)(0), // 1: memos.api.v2.UserSetting.Key - (*User)(nil), // 2: memos.api.v2.User - (*GetUserRequest)(nil), // 3: memos.api.v2.GetUserRequest - (*GetUserResponse)(nil), // 4: memos.api.v2.GetUserResponse - (*UpdateUserRequest)(nil), // 5: memos.api.v2.UpdateUserRequest - (*UpdateUserResponse)(nil), // 6: memos.api.v2.UpdateUserResponse - (*UserSetting)(nil), // 7: memos.api.v2.UserSetting - (*UserSettingValue)(nil), // 8: memos.api.v2.UserSettingValue - (RowStatus)(0), // 9: memos.api.v2.RowStatus - (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp - (Visibility)(0), // 11: memos.api.v2.Visibility + (User_Role)(0), // 0: memos.api.v2.User.Role + (*User)(nil), // 1: memos.api.v2.User + (*GetUserRequest)(nil), // 2: memos.api.v2.GetUserRequest + (*GetUserResponse)(nil), // 3: memos.api.v2.GetUserResponse + (*UpdateUserRequest)(nil), // 4: memos.api.v2.UpdateUserRequest + (*UpdateUserResponse)(nil), // 5: memos.api.v2.UpdateUserResponse + (*ListUserAccessTokensRequest)(nil), // 6: memos.api.v2.ListUserAccessTokensRequest + (*ListUserAccessTokensResponse)(nil), // 7: memos.api.v2.ListUserAccessTokensResponse + (*CreateUserAccessTokenRequest)(nil), // 8: memos.api.v2.CreateUserAccessTokenRequest + (*CreateUserAccessTokenResponse)(nil), // 9: memos.api.v2.CreateUserAccessTokenResponse + (*DeleteUserAccessTokenRequest)(nil), // 10: memos.api.v2.DeleteUserAccessTokenRequest + (*DeleteUserAccessTokenResponse)(nil), // 11: memos.api.v2.DeleteUserAccessTokenResponse + (*UserAccessToken)(nil), // 12: memos.api.v2.UserAccessToken + (RowStatus)(0), // 13: memos.api.v2.RowStatus + (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp } var file_api_v2_user_service_proto_depIdxs = []int32{ - 9, // 0: memos.api.v2.User.row_status:type_name -> memos.api.v2.RowStatus - 10, // 1: memos.api.v2.User.create_time:type_name -> google.protobuf.Timestamp - 10, // 2: memos.api.v2.User.update_time:type_name -> google.protobuf.Timestamp - 0, // 3: memos.api.v2.User.role:type_name -> memos.api.v2.User.Role - 2, // 4: memos.api.v2.GetUserResponse.user:type_name -> memos.api.v2.User - 2, // 5: memos.api.v2.UpdateUserRequest.user:type_name -> memos.api.v2.User - 2, // 6: memos.api.v2.UpdateUserResponse.user:type_name -> memos.api.v2.User - 1, // 7: memos.api.v2.UserSetting.key:type_name -> memos.api.v2.UserSetting.Key - 8, // 8: memos.api.v2.UserSetting.value:type_name -> memos.api.v2.UserSettingValue - 11, // 9: memos.api.v2.UserSettingValue.visibility_value:type_name -> memos.api.v2.Visibility - 3, // 10: memos.api.v2.UserService.GetUser:input_type -> memos.api.v2.GetUserRequest - 5, // 11: memos.api.v2.UserService.UpdateUser:input_type -> memos.api.v2.UpdateUserRequest - 4, // 12: memos.api.v2.UserService.GetUser:output_type -> memos.api.v2.GetUserResponse - 6, // 13: memos.api.v2.UserService.UpdateUser:output_type -> memos.api.v2.UpdateUserResponse - 12, // [12:14] is the sub-list for method output_type - 10, // [10:12] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 0, // 0: memos.api.v2.User.role:type_name -> memos.api.v2.User.Role + 13, // 1: memos.api.v2.User.row_status:type_name -> memos.api.v2.RowStatus + 14, // 2: memos.api.v2.User.create_time:type_name -> google.protobuf.Timestamp + 14, // 3: memos.api.v2.User.update_time:type_name -> google.protobuf.Timestamp + 1, // 4: memos.api.v2.GetUserResponse.user:type_name -> memos.api.v2.User + 1, // 5: memos.api.v2.UpdateUserRequest.user:type_name -> memos.api.v2.User + 1, // 6: memos.api.v2.UpdateUserResponse.user:type_name -> memos.api.v2.User + 12, // 7: memos.api.v2.ListUserAccessTokensResponse.access_tokens:type_name -> memos.api.v2.UserAccessToken + 12, // 8: memos.api.v2.CreateUserAccessTokenRequest.user_access_token:type_name -> memos.api.v2.UserAccessToken + 12, // 9: memos.api.v2.CreateUserAccessTokenResponse.access_token:type_name -> memos.api.v2.UserAccessToken + 14, // 10: memos.api.v2.UserAccessToken.issued_at:type_name -> google.protobuf.Timestamp + 14, // 11: memos.api.v2.UserAccessToken.expires_at:type_name -> google.protobuf.Timestamp + 2, // 12: memos.api.v2.UserService.GetUser:input_type -> memos.api.v2.GetUserRequest + 4, // 13: memos.api.v2.UserService.UpdateUser:input_type -> memos.api.v2.UpdateUserRequest + 6, // 14: memos.api.v2.UserService.ListUserAccessTokens:input_type -> memos.api.v2.ListUserAccessTokensRequest + 8, // 15: memos.api.v2.UserService.CreateUserAccessToken:input_type -> memos.api.v2.CreateUserAccessTokenRequest + 10, // 16: memos.api.v2.UserService.DeleteUserAccessToken:input_type -> memos.api.v2.DeleteUserAccessTokenRequest + 3, // 17: memos.api.v2.UserService.GetUser:output_type -> memos.api.v2.GetUserResponse + 5, // 18: memos.api.v2.UserService.UpdateUser:output_type -> memos.api.v2.UpdateUserResponse + 7, // 19: memos.api.v2.UserService.ListUserAccessTokens:output_type -> memos.api.v2.ListUserAccessTokensResponse + 9, // 20: memos.api.v2.UserService.CreateUserAccessToken:output_type -> memos.api.v2.CreateUserAccessTokenResponse + 11, // 21: memos.api.v2.UserService.DeleteUserAccessToken:output_type -> memos.api.v2.DeleteUserAccessTokenResponse + 17, // [17:22] is the sub-list for method output_type + 12, // [12:17] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_api_v2_user_service_proto_init() } @@ -787,7 +1007,6 @@ func file_api_v2_user_service_proto_init() { return } file_api_v2_common_proto_init() - file_api_v2_memo_service_proto_init() if !protoimpl.UnsafeEnabled { file_api_v2_user_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*User); i { @@ -850,7 +1069,7 @@ func file_api_v2_user_service_proto_init() { } } file_api_v2_user_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserSetting); i { + switch v := v.(*ListUserAccessTokensRequest); i { case 0: return &v.state case 1: @@ -862,7 +1081,67 @@ func file_api_v2_user_service_proto_init() { } } file_api_v2_user_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserSettingValue); i { + switch v := v.(*ListUserAccessTokensResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_user_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateUserAccessTokenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_user_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateUserAccessTokenResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_user_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteUserAccessTokenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_user_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteUserAccessTokenResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_user_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserAccessToken); i { case 0: return &v.state case 1: @@ -873,18 +1152,14 @@ func file_api_v2_user_service_proto_init() { return nil } } - } - file_api_v2_user_service_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*UserSettingValue_StringValue)(nil), - (*UserSettingValue_VisibilityValue)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_v2_user_service_proto_rawDesc, - NumEnums: 2, - NumMessages: 7, + NumEnums: 1, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/gen/api/v2/user_service.pb.gw.go b/proto/gen/api/v2/user_service.pb.gw.go index 3d2c5462..187a4139 100644 --- a/proto/gen/api/v2/user_service.pb.gw.go +++ b/proto/gen/api/v2/user_service.pb.gw.go @@ -151,6 +151,198 @@ func local_request_UserService_UpdateUser_0(ctx context.Context, marshaler runti } +func request_UserService_ListUserAccessTokens_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListUserAccessTokensRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["username"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "username") + } + + protoReq.Username, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "username", err) + } + + msg, err := client.ListUserAccessTokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserService_ListUserAccessTokens_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListUserAccessTokensRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["username"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "username") + } + + protoReq.Username, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "username", err) + } + + msg, err := server.ListUserAccessTokens(ctx, &protoReq) + return msg, metadata, err + +} + +func request_UserService_CreateUserAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateUserAccessTokenRequest + var metadata runtime.ServerMetadata + + 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.UserAccessToken); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["username"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "username") + } + + protoReq.Username, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "username", err) + } + + msg, err := client.CreateUserAccessToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserService_CreateUserAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateUserAccessTokenRequest + var metadata runtime.ServerMetadata + + 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.UserAccessToken); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["username"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "username") + } + + protoReq.Username, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "username", err) + } + + msg, err := server.CreateUserAccessToken(ctx, &protoReq) + return msg, metadata, err + +} + +func request_UserService_DeleteUserAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteUserAccessTokenRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["username"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "username") + } + + protoReq.Username, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "username", err) + } + + val, ok = pathParams["access_token"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "access_token") + } + + protoReq.AccessToken, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "access_token", err) + } + + msg, err := client.DeleteUserAccessToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserService_DeleteUserAccessToken_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteUserAccessTokenRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["username"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "username") + } + + protoReq.Username, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "username", err) + } + + val, ok = pathParams["access_token"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "access_token") + } + + protoReq.AccessToken, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "access_token", err) + } + + msg, err := server.DeleteUserAccessToken(ctx, &protoReq) + return msg, metadata, err + +} + // 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. @@ -207,6 +399,81 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("GET", pattern_UserService_ListUserAccessTokens_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.UserService/ListUserAccessTokens", runtime.WithHTTPPathPattern("/api/v2/users/{username}/access_tokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_ListUserAccessTokens_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_ListUserAccessTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_UserService_CreateUserAccessToken_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.UserService/CreateUserAccessToken", runtime.WithHTTPPathPattern("/api/v2/users/{username}/access_tokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_CreateUserAccessToken_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_CreateUserAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_UserService_DeleteUserAccessToken_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.UserService/DeleteUserAccessToken", runtime.WithHTTPPathPattern("/api/v2/users/{username}/access_tokens/{access_token}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_DeleteUserAccessToken_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_DeleteUserAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -292,6 +559,72 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) + mux.Handle("GET", pattern_UserService_ListUserAccessTokens_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.UserService/ListUserAccessTokens", runtime.WithHTTPPathPattern("/api/v2/users/{username}/access_tokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_ListUserAccessTokens_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_ListUserAccessTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_UserService_CreateUserAccessToken_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.UserService/CreateUserAccessToken", runtime.WithHTTPPathPattern("/api/v2/users/{username}/access_tokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_CreateUserAccessToken_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_CreateUserAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_UserService_DeleteUserAccessToken_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.UserService/DeleteUserAccessToken", runtime.WithHTTPPathPattern("/api/v2/users/{username}/access_tokens/{access_token}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_DeleteUserAccessToken_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_DeleteUserAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -299,10 +632,22 @@ var ( pattern_UserService_GetUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "users", "username"}, "")) pattern_UserService_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "users", "username"}, "")) + + pattern_UserService_ListUserAccessTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "users", "username", "access_tokens"}, "")) + + pattern_UserService_CreateUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "users", "username", "access_tokens"}, "")) + + pattern_UserService_DeleteUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v2", "users", "username", "access_tokens", "access_token"}, "")) ) var ( forward_UserService_GetUser_0 = runtime.ForwardResponseMessage forward_UserService_UpdateUser_0 = runtime.ForwardResponseMessage + + forward_UserService_ListUserAccessTokens_0 = runtime.ForwardResponseMessage + + forward_UserService_CreateUserAccessToken_0 = runtime.ForwardResponseMessage + + forward_UserService_DeleteUserAccessToken_0 = runtime.ForwardResponseMessage ) diff --git a/proto/gen/api/v2/user_service_grpc.pb.go b/proto/gen/api/v2/user_service_grpc.pb.go index f6f9f2ce..2a533faa 100644 --- a/proto/gen/api/v2/user_service_grpc.pb.go +++ b/proto/gen/api/v2/user_service_grpc.pb.go @@ -19,8 +19,11 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - UserService_GetUser_FullMethodName = "/memos.api.v2.UserService/GetUser" - UserService_UpdateUser_FullMethodName = "/memos.api.v2.UserService/UpdateUser" + UserService_GetUser_FullMethodName = "/memos.api.v2.UserService/GetUser" + UserService_UpdateUser_FullMethodName = "/memos.api.v2.UserService/UpdateUser" + UserService_ListUserAccessTokens_FullMethodName = "/memos.api.v2.UserService/ListUserAccessTokens" + UserService_CreateUserAccessToken_FullMethodName = "/memos.api.v2.UserService/CreateUserAccessToken" + UserService_DeleteUserAccessToken_FullMethodName = "/memos.api.v2.UserService/DeleteUserAccessToken" ) // UserServiceClient is the client API for UserService service. @@ -29,6 +32,12 @@ const ( type UserServiceClient interface { GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) + // ListUserAccessTokens returns a list of access tokens for a user. + ListUserAccessTokens(ctx context.Context, in *ListUserAccessTokensRequest, opts ...grpc.CallOption) (*ListUserAccessTokensResponse, error) + // CreateUserAccessToken creates a new access token for a user. + CreateUserAccessToken(ctx context.Context, in *CreateUserAccessTokenRequest, opts ...grpc.CallOption) (*CreateUserAccessTokenResponse, error) + // DeleteUserAccessToken deletes an access token for a user. + DeleteUserAccessToken(ctx context.Context, in *DeleteUserAccessTokenRequest, opts ...grpc.CallOption) (*DeleteUserAccessTokenResponse, error) } type userServiceClient struct { @@ -57,12 +66,45 @@ func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserReques return out, nil } +func (c *userServiceClient) ListUserAccessTokens(ctx context.Context, in *ListUserAccessTokensRequest, opts ...grpc.CallOption) (*ListUserAccessTokensResponse, error) { + out := new(ListUserAccessTokensResponse) + err := c.cc.Invoke(ctx, UserService_ListUserAccessTokens_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) CreateUserAccessToken(ctx context.Context, in *CreateUserAccessTokenRequest, opts ...grpc.CallOption) (*CreateUserAccessTokenResponse, error) { + out := new(CreateUserAccessTokenResponse) + err := c.cc.Invoke(ctx, UserService_CreateUserAccessToken_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) DeleteUserAccessToken(ctx context.Context, in *DeleteUserAccessTokenRequest, opts ...grpc.CallOption) (*DeleteUserAccessTokenResponse, error) { + out := new(DeleteUserAccessTokenResponse) + err := c.cc.Invoke(ctx, UserService_DeleteUserAccessToken_FullMethodName, in, out, opts...) + 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 type UserServiceServer interface { GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) + // ListUserAccessTokens returns a list of access tokens for a user. + ListUserAccessTokens(context.Context, *ListUserAccessTokensRequest) (*ListUserAccessTokensResponse, error) + // CreateUserAccessToken creates a new access token for a user. + CreateUserAccessToken(context.Context, *CreateUserAccessTokenRequest) (*CreateUserAccessTokenResponse, error) + // DeleteUserAccessToken deletes an access token for a user. + DeleteUserAccessToken(context.Context, *DeleteUserAccessTokenRequest) (*DeleteUserAccessTokenResponse, error) mustEmbedUnimplementedUserServiceServer() } @@ -76,6 +118,15 @@ func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented") } +func (UnimplementedUserServiceServer) ListUserAccessTokens(context.Context, *ListUserAccessTokensRequest) (*ListUserAccessTokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUserAccessTokens not implemented") +} +func (UnimplementedUserServiceServer) CreateUserAccessToken(context.Context, *CreateUserAccessTokenRequest) (*CreateUserAccessTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateUserAccessToken not implemented") +} +func (UnimplementedUserServiceServer) DeleteUserAccessToken(context.Context, *DeleteUserAccessTokenRequest) (*DeleteUserAccessTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteUserAccessToken not implemented") +} func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} // UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. @@ -125,6 +176,60 @@ func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec f 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 { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).ListUserAccessTokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_ListUserAccessTokens_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).ListUserAccessTokens(ctx, req.(*ListUserAccessTokensRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_CreateUserAccessToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserAccessTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).CreateUserAccessToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_CreateUserAccessToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).CreateUserAccessToken(ctx, req.(*CreateUserAccessTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_DeleteUserAccessToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserAccessTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).DeleteUserAccessToken(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_DeleteUserAccessToken_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).DeleteUserAccessToken(ctx, req.(*DeleteUserAccessTokenRequest)) + } + 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) @@ -140,6 +245,18 @@ var UserService_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdateUser", Handler: _UserService_UpdateUser_Handler, }, + { + MethodName: "ListUserAccessTokens", + Handler: _UserService_ListUserAccessTokens_Handler, + }, + { + MethodName: "CreateUserAccessToken", + Handler: _UserService_CreateUserAccessToken_Handler, + }, + { + MethodName: "DeleteUserAccessToken", + Handler: _UserService_DeleteUserAccessToken_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/v2/user_service.proto", diff --git a/proto/gen/store/README.md b/proto/gen/store/README.md index 5aa63d85..0e87c071 100644 --- a/proto/gen/store/README.md +++ b/proto/gen/store/README.md @@ -9,6 +9,13 @@ - [SystemSettingKey](#memos-store-SystemSettingKey) +- [store/user_setting.proto](#store_user_setting-proto) + - [AccessTokensUserSetting](#memos-store-AccessTokensUserSetting) + - [AccessTokensUserSetting.AccessToken](#memos-store-AccessTokensUserSetting-AccessToken) + - [UserSetting](#memos-store-UserSetting) + + - [UserSettingKey](#memos-store-UserSettingKey) + - [Scalar Value Types](#scalar-value-types) @@ -74,6 +81,81 @@ + +

Top

+ +## store/user_setting.proto + + + + + +### AccessTokensUserSetting + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| access_tokens | [AccessTokensUserSetting.AccessToken](#memos-store-AccessTokensUserSetting-AccessToken) | repeated | | + + + + + + + + +### AccessTokensUserSetting.AccessToken + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| access_token | [string](#string) | | The access token is a JWT token. Including expiration time, issuer, etc. | +| description | [string](#string) | | A description for the access token. | + + + + + + + + +### UserSetting + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| user_id | [int32](#int32) | | | +| key | [UserSettingKey](#memos-store-UserSettingKey) | | | +| access_tokens | [AccessTokensUserSetting](#memos-store-AccessTokensUserSetting) | | | + + + + + + + + + + +### UserSettingKey + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| USER_SETTING_KEY_UNSPECIFIED | 0 | | + + + + + + + + + + ## Scalar Value Types | .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | diff --git a/proto/gen/store/user_setting.pb.go b/proto/gen/store/user_setting.pb.go new file mode 100644 index 00000000..203cc890 --- /dev/null +++ b/proto/gen/store/user_setting.pb.go @@ -0,0 +1,395 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: store/user_setting.proto + +package store + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 UserSettingKey int32 + +const ( + UserSettingKey_USER_SETTING_KEY_UNSPECIFIED UserSettingKey = 0 +) + +// Enum value maps for UserSettingKey. +var ( + UserSettingKey_name = map[int32]string{ + 0: "USER_SETTING_KEY_UNSPECIFIED", + } + UserSettingKey_value = map[string]int32{ + "USER_SETTING_KEY_UNSPECIFIED": 0, + } +) + +func (x UserSettingKey) Enum() *UserSettingKey { + p := new(UserSettingKey) + *p = x + return p +} + +func (x UserSettingKey) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (UserSettingKey) Descriptor() protoreflect.EnumDescriptor { + return file_store_user_setting_proto_enumTypes[0].Descriptor() +} + +func (UserSettingKey) Type() protoreflect.EnumType { + return &file_store_user_setting_proto_enumTypes[0] +} + +func (x UserSettingKey) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use UserSettingKey.Descriptor instead. +func (UserSettingKey) EnumDescriptor() ([]byte, []int) { + return file_store_user_setting_proto_rawDescGZIP(), []int{0} +} + +type UserSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Key UserSettingKey `protobuf:"varint,2,opt,name=key,proto3,enum=memos.store.UserSettingKey" json:"key,omitempty"` + // Types that are assignable to Value: + // + // *UserSetting_AccessTokens + Value isUserSetting_Value `protobuf_oneof:"value"` +} + +func (x *UserSetting) Reset() { + *x = UserSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_store_user_setting_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserSetting) ProtoMessage() {} + +func (x *UserSetting) ProtoReflect() protoreflect.Message { + mi := &file_store_user_setting_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && 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.ProtoReflect.Descriptor instead. +func (*UserSetting) Descriptor() ([]byte, []int) { + return file_store_user_setting_proto_rawDescGZIP(), []int{0} +} + +func (x *UserSetting) GetUserId() int32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *UserSetting) GetKey() UserSettingKey { + if x != nil { + return x.Key + } + return UserSettingKey_USER_SETTING_KEY_UNSPECIFIED +} + +func (m *UserSetting) GetValue() isUserSetting_Value { + if m != nil { + return m.Value + } + return nil +} + +func (x *UserSetting) GetAccessTokens() *AccessTokensUserSetting { + if x, ok := x.GetValue().(*UserSetting_AccessTokens); ok { + return x.AccessTokens + } + return nil +} + +type isUserSetting_Value interface { + isUserSetting_Value() +} + +type UserSetting_AccessTokens struct { + AccessTokens *AccessTokensUserSetting `protobuf:"bytes,3,opt,name=access_tokens,json=accessTokens,proto3,oneof"` +} + +func (*UserSetting_AccessTokens) isUserSetting_Value() {} + +type AccessTokensUserSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AccessTokens []*AccessTokensUserSetting_AccessToken `protobuf:"bytes,1,rep,name=access_tokens,json=accessTokens,proto3" json:"access_tokens,omitempty"` +} + +func (x *AccessTokensUserSetting) Reset() { + *x = AccessTokensUserSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_store_user_setting_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AccessTokensUserSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccessTokensUserSetting) ProtoMessage() {} + +func (x *AccessTokensUserSetting) ProtoReflect() protoreflect.Message { + mi := &file_store_user_setting_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AccessTokensUserSetting.ProtoReflect.Descriptor instead. +func (*AccessTokensUserSetting) Descriptor() ([]byte, []int) { + return file_store_user_setting_proto_rawDescGZIP(), []int{1} +} + +func (x *AccessTokensUserSetting) GetAccessTokens() []*AccessTokensUserSetting_AccessToken { + if x != nil { + return x.AccessTokens + } + return nil +} + +type AccessTokensUserSetting_AccessToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 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"` +} + +func (x *AccessTokensUserSetting_AccessToken) Reset() { + *x = AccessTokensUserSetting_AccessToken{} + if protoimpl.UnsafeEnabled { + mi := &file_store_user_setting_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AccessTokensUserSetting_AccessToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccessTokensUserSetting_AccessToken) ProtoMessage() {} + +func (x *AccessTokensUserSetting_AccessToken) ProtoReflect() protoreflect.Message { + mi := &file_store_user_setting_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AccessTokensUserSetting_AccessToken.ProtoReflect.Descriptor instead. +func (*AccessTokensUserSetting_AccessToken) Descriptor() ([]byte, []int) { + return file_store_user_setting_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *AccessTokensUserSetting_AccessToken) GetAccessToken() string { + if x != nil { + return x.AccessToken + } + return "" +} + +func (x *AccessTokensUserSetting_AccessToken) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +var File_store_user_setting_proto protoreflect.FileDescriptor + +var file_store_user_setting_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x2d, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x4b, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x73, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0c, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x42, 0x07, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc4, 0x01, 0x0a, 0x17, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x12, 0x55, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x73, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x1a, 0x52, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x32, 0x0a, 0x0e, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x20, + 0x0a, 0x1c, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, + 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x42, 0x9b, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x42, 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, + 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_store_user_setting_proto_rawDescOnce sync.Once + file_store_user_setting_proto_rawDescData = file_store_user_setting_proto_rawDesc +) + +func file_store_user_setting_proto_rawDescGZIP() []byte { + file_store_user_setting_proto_rawDescOnce.Do(func() { + file_store_user_setting_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_user_setting_proto_rawDescData) + }) + return file_store_user_setting_proto_rawDescData +} + +var file_store_user_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_store_user_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_store_user_setting_proto_goTypes = []interface{}{ + (UserSettingKey)(0), // 0: memos.store.UserSettingKey + (*UserSetting)(nil), // 1: memos.store.UserSetting + (*AccessTokensUserSetting)(nil), // 2: memos.store.AccessTokensUserSetting + (*AccessTokensUserSetting_AccessToken)(nil), // 3: memos.store.AccessTokensUserSetting.AccessToken +} +var file_store_user_setting_proto_depIdxs = []int32{ + 0, // 0: memos.store.UserSetting.key:type_name -> memos.store.UserSettingKey + 2, // 1: memos.store.UserSetting.access_tokens:type_name -> memos.store.AccessTokensUserSetting + 3, // 2: memos.store.AccessTokensUserSetting.access_tokens:type_name -> memos.store.AccessTokensUserSetting.AccessToken + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_store_user_setting_proto_init() } +func file_store_user_setting_proto_init() { + if File_store_user_setting_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_store_user_setting_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_user_setting_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AccessTokensUserSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_store_user_setting_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AccessTokensUserSetting_AccessToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_store_user_setting_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*UserSetting_AccessTokens)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_store_user_setting_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_store_user_setting_proto_goTypes, + DependencyIndexes: file_store_user_setting_proto_depIdxs, + EnumInfos: file_store_user_setting_proto_enumTypes, + MessageInfos: file_store_user_setting_proto_msgTypes, + }.Build() + File_store_user_setting_proto = out.File + file_store_user_setting_proto_rawDesc = nil + file_store_user_setting_proto_goTypes = nil + file_store_user_setting_proto_depIdxs = nil +} diff --git a/proto/store/user_setting.proto b/proto/store/user_setting.proto new file mode 100644 index 00000000..b4607af1 --- /dev/null +++ b/proto/store/user_setting.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package memos.store; + +option go_package = "gen/store"; + +message UserSetting { + int32 user_id = 1; + + UserSettingKey key = 2; + + oneof value { + AccessTokensUserSetting access_tokens = 3; + } +} + +enum UserSettingKey { + USER_SETTING_KEY_UNSPECIFIED = 0; +} + +message AccessTokensUserSetting { + message AccessToken { + // The access token is a JWT token. + // Including expiration time, issuer, etc. + string access_token = 1; + // A description for the access token. + string description = 2; + } + repeated AccessToken access_tokens = 1; +} diff --git a/web/src/types/proto/api/v2/user_service_pb.d.ts b/web/src/types/proto/api/v2/user_service_pb.d.ts index 329e305d..41e60e03 100644 --- a/web/src/types/proto/api/v2/user_service_pb.d.ts +++ b/web/src/types/proto/api/v2/user_service_pb.d.ts @@ -6,7 +6,6 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage, Timestamp } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; import type { RowStatus } from "./common_pb.js"; -import type { Visibility } from "./memo_service_pb.js"; /** * @generated from message memos.api.v2.User @@ -18,54 +17,54 @@ export declare class User extends Message { id: number; /** - * @generated from field: memos.api.v2.RowStatus row_status = 2; + * @generated from field: string username = 2; */ - rowStatus: RowStatus; + username: string; /** - * @generated from field: google.protobuf.Timestamp create_time = 3; + * @generated from field: memos.api.v2.User.Role role = 3; */ - createTime?: Timestamp; + role: User_Role; /** - * @generated from field: google.protobuf.Timestamp update_time = 4; + * @generated from field: string email = 4; */ - updateTime?: Timestamp; + email: string; /** - * @generated from field: string username = 5; + * @generated from field: string nickname = 5; */ - username: string; + nickname: string; /** - * @generated from field: memos.api.v2.User.Role role = 6; + * @generated from field: string open_id = 6; */ - role: User_Role; + openId: string; /** - * @generated from field: string email = 7; + * @generated from field: string avatar_url = 7; */ - email: string; + avatarUrl: string; /** - * @generated from field: string nickname = 8; + * @generated from field: string password = 8; */ - nickname: string; + password: string; /** - * @generated from field: string open_id = 9; + * @generated from field: memos.api.v2.RowStatus row_status = 9; */ - openId: string; + rowStatus: RowStatus; /** - * @generated from field: string avatar_url = 10; + * @generated from field: google.protobuf.Timestamp create_time = 10; */ - avatarUrl: string; + createTime?: Timestamp; /** - * @generated from field: string password = 11; + * @generated from field: google.protobuf.Timestamp update_time = 11; */ - password: string; + updateTime?: Timestamp; constructor(data?: PartialMessage); @@ -216,118 +215,192 @@ export declare class UpdateUserResponse extends Message { } /** - * @generated from message memos.api.v2.UserSetting + * @generated from message memos.api.v2.ListUserAccessTokensRequest */ -export declare class UserSetting extends Message { +export declare class ListUserAccessTokensRequest extends Message { /** - * The user id of the setting. - * - * @generated from field: int32 user_id = 1; + * @generated from field: string username = 1; */ - userId: number; + username: string; - /** - * The key of the setting. - * - * @generated from field: memos.api.v2.UserSetting.Key key = 2; - */ - key: UserSetting_Key; + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "memos.api.v2.ListUserAccessTokensRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ListUserAccessTokensRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): ListUserAccessTokensRequest; + static fromJsonString(jsonString: string, options?: Partial): ListUserAccessTokensRequest; + + static equals(a: ListUserAccessTokensRequest | PlainMessage | undefined, b: ListUserAccessTokensRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message memos.api.v2.ListUserAccessTokensResponse + */ +export declare class ListUserAccessTokensResponse extends Message { /** - * The value of the setting. - * - * @generated from field: memos.api.v2.UserSettingValue value = 3; + * @generated from field: repeated memos.api.v2.UserAccessToken access_tokens = 1; */ - value?: UserSettingValue; + accessTokens: UserAccessToken[]; - constructor(data?: PartialMessage); + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "memos.api.v2.UserSetting"; + static readonly typeName = "memos.api.v2.ListUserAccessTokensResponse"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): UserSetting; + static fromBinary(bytes: Uint8Array, options?: Partial): ListUserAccessTokensResponse; - static fromJson(jsonValue: JsonValue, options?: Partial): UserSetting; + static fromJson(jsonValue: JsonValue, options?: Partial): ListUserAccessTokensResponse; - static fromJsonString(jsonString: string, options?: Partial): UserSetting; + static fromJsonString(jsonString: string, options?: Partial): ListUserAccessTokensResponse; - static equals(a: UserSetting | PlainMessage | undefined, b: UserSetting | PlainMessage | undefined): boolean; + static equals(a: ListUserAccessTokensResponse | PlainMessage | undefined, b: ListUserAccessTokensResponse | PlainMessage | undefined): boolean; } /** - * @generated from enum memos.api.v2.UserSetting.Key + * @generated from message memos.api.v2.CreateUserAccessTokenRequest */ -export declare enum UserSetting_Key { +export declare class CreateUserAccessTokenRequest extends Message { /** - * @generated from enum value: KEY_UNSPECIFIED = 0; + * @generated from field: string username = 1; */ - KEY_UNSPECIFIED = 0, + username: string; /** - * The preferred locale. - * - * @generated from enum value: LOCALE = 1; + * @generated from field: memos.api.v2.UserAccessToken user_access_token = 2; */ - LOCALE = 1, + userAccessToken?: UserAccessToken; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "memos.api.v2.CreateUserAccessTokenRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): CreateUserAccessTokenRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): CreateUserAccessTokenRequest; + + static fromJsonString(jsonString: string, options?: Partial): CreateUserAccessTokenRequest; + + static equals(a: CreateUserAccessTokenRequest | PlainMessage | undefined, b: CreateUserAccessTokenRequest | PlainMessage | undefined): boolean; +} +/** + * @generated from message memos.api.v2.CreateUserAccessTokenResponse + */ +export declare class CreateUserAccessTokenResponse extends Message { /** - * The preferred appearance. - * - * @generated from enum value: APPEARANCE = 2; + * @generated from field: memos.api.v2.UserAccessToken access_token = 1; */ - APPEARANCE = 2, + accessToken?: UserAccessToken; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "memos.api.v2.CreateUserAccessTokenResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): CreateUserAccessTokenResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): CreateUserAccessTokenResponse; + + static fromJsonString(jsonString: string, options?: Partial): CreateUserAccessTokenResponse; + + static equals(a: CreateUserAccessTokenResponse | PlainMessage | undefined, b: CreateUserAccessTokenResponse | PlainMessage | undefined): boolean; +} +/** + * @generated from message memos.api.v2.DeleteUserAccessTokenRequest + */ +export declare class DeleteUserAccessTokenRequest extends Message { /** - * The default visibility of the memo when creating a new memo. - * - * @generated from enum value: MEMO_VISIBILITY = 3; + * @generated from field: string username = 1; */ - MEMO_VISIBILITY = 3, + username: string; /** - * User's telegram id + * access_token is the access token to delete. * - * @generated from enum value: TELEGRAM_USER_ID = 4; + * @generated from field: string access_token = 2; */ - TELEGRAM_USER_ID = 4, + accessToken: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "memos.api.v2.DeleteUserAccessTokenRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DeleteUserAccessTokenRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): DeleteUserAccessTokenRequest; + + static fromJsonString(jsonString: string, options?: Partial): DeleteUserAccessTokenRequest; + + static equals(a: DeleteUserAccessTokenRequest | PlainMessage | undefined, b: DeleteUserAccessTokenRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message memos.api.v2.DeleteUserAccessTokenResponse + */ +export declare class DeleteUserAccessTokenResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "memos.api.v2.DeleteUserAccessTokenResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DeleteUserAccessTokenResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): DeleteUserAccessTokenResponse; + + static fromJsonString(jsonString: string, options?: Partial): DeleteUserAccessTokenResponse; + + static equals(a: DeleteUserAccessTokenResponse | PlainMessage | undefined, b: DeleteUserAccessTokenResponse | PlainMessage | undefined): boolean; } /** - * @generated from message memos.api.v2.UserSettingValue + * @generated from message memos.api.v2.UserAccessToken */ -export declare class UserSettingValue extends Message { - /** - * @generated from oneof memos.api.v2.UserSettingValue.value - */ - value: { - /** - * Default value as a string. - * - * @generated from field: string string_value = 1; - */ - value: string; - case: "stringValue"; - } | { - /** - * @generated from field: memos.api.v2.Visibility visibility_value = 2; - */ - value: Visibility; - case: "visibilityValue"; - } | { case: undefined; value?: undefined }; - - constructor(data?: PartialMessage); +export declare class UserAccessToken extends Message { + /** + * @generated from field: string access_token = 1; + */ + accessToken: string; + + /** + * @generated from field: string description = 2; + */ + description: string; + + /** + * @generated from field: google.protobuf.Timestamp issued_at = 3; + */ + issuedAt?: Timestamp; + + /** + * @generated from field: google.protobuf.Timestamp expires_at = 4; + */ + expiresAt?: Timestamp; + + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "memos.api.v2.UserSettingValue"; + static readonly typeName = "memos.api.v2.UserAccessToken"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): UserSettingValue; + static fromBinary(bytes: Uint8Array, options?: Partial): UserAccessToken; - static fromJson(jsonValue: JsonValue, options?: Partial): UserSettingValue; + static fromJson(jsonValue: JsonValue, options?: Partial): UserAccessToken; - static fromJsonString(jsonString: string, options?: Partial): UserSettingValue; + static fromJsonString(jsonString: string, options?: Partial): UserAccessToken; - static equals(a: UserSettingValue | PlainMessage | undefined, b: UserSettingValue | PlainMessage | undefined): boolean; + static equals(a: UserAccessToken | PlainMessage | undefined, b: UserAccessToken | PlainMessage | undefined): boolean; } diff --git a/web/src/types/proto/api/v2/user_service_pb.js b/web/src/types/proto/api/v2/user_service_pb.js index 876fdd68..bb3fc25b 100644 --- a/web/src/types/proto/api/v2/user_service_pb.js +++ b/web/src/types/proto/api/v2/user_service_pb.js @@ -5,7 +5,6 @@ import { proto3, Timestamp } from "@bufbuild/protobuf"; import { RowStatus } from "./common_pb.js"; -import { Visibility } from "./memo_service_pb.js"; /** * @generated from message memos.api.v2.User @@ -14,16 +13,16 @@ export const User = proto3.makeMessageType( "memos.api.v2.User", () => [ { no: 1, name: "id", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, - { no: 2, name: "row_status", kind: "enum", T: proto3.getEnumType(RowStatus) }, - { no: 3, name: "create_time", kind: "message", T: Timestamp }, - { no: 4, name: "update_time", kind: "message", T: Timestamp }, - { no: 5, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ }, - { no: 6, name: "role", kind: "enum", T: proto3.getEnumType(User_Role) }, - { no: 7, name: "email", kind: "scalar", T: 9 /* ScalarType.STRING */ }, - { no: 8, name: "nickname", kind: "scalar", T: 9 /* ScalarType.STRING */ }, - { no: 9, name: "open_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, - { no: 10, name: "avatar_url", kind: "scalar", T: 9 /* ScalarType.STRING */ }, - { no: 11, name: "password", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "role", kind: "enum", T: proto3.getEnumType(User_Role) }, + { no: 4, name: "email", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "nickname", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "open_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "avatar_url", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "password", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "row_status", kind: "enum", T: proto3.getEnumType(RowStatus) }, + { no: 10, name: "create_time", kind: "message", T: Timestamp }, + { no: 11, name: "update_time", kind: "message", T: Timestamp }, ], ); @@ -83,39 +82,75 @@ export const UpdateUserResponse = proto3.makeMessageType( ); /** - * @generated from message memos.api.v2.UserSetting + * @generated from message memos.api.v2.ListUserAccessTokensRequest */ -export const UserSetting = proto3.makeMessageType( - "memos.api.v2.UserSetting", +export const ListUserAccessTokensRequest = proto3.makeMessageType( + "memos.api.v2.ListUserAccessTokensRequest", () => [ - { no: 1, name: "user_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, - { no: 2, name: "key", kind: "enum", T: proto3.getEnumType(UserSetting_Key) }, - { no: 3, name: "value", kind: "message", T: UserSettingValue }, + { no: 1, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ }, ], ); /** - * @generated from enum memos.api.v2.UserSetting.Key + * @generated from message memos.api.v2.ListUserAccessTokensResponse */ -export const UserSetting_Key = proto3.makeEnum( - "memos.api.v2.UserSetting.Key", - [ - {no: 0, name: "KEY_UNSPECIFIED"}, - {no: 1, name: "LOCALE"}, - {no: 2, name: "APPEARANCE"}, - {no: 3, name: "MEMO_VISIBILITY"}, - {no: 4, name: "TELEGRAM_USER_ID"}, +export const ListUserAccessTokensResponse = proto3.makeMessageType( + "memos.api.v2.ListUserAccessTokensResponse", + () => [ + { no: 1, name: "access_tokens", kind: "message", T: UserAccessToken, repeated: true }, + ], +); + +/** + * @generated from message memos.api.v2.CreateUserAccessTokenRequest + */ +export const CreateUserAccessTokenRequest = proto3.makeMessageType( + "memos.api.v2.CreateUserAccessTokenRequest", + () => [ + { no: 1, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "user_access_token", kind: "message", T: UserAccessToken }, ], ); /** - * @generated from message memos.api.v2.UserSettingValue + * @generated from message memos.api.v2.CreateUserAccessTokenResponse + */ +export const CreateUserAccessTokenResponse = proto3.makeMessageType( + "memos.api.v2.CreateUserAccessTokenResponse", + () => [ + { no: 1, name: "access_token", kind: "message", T: UserAccessToken }, + ], +); + +/** + * @generated from message memos.api.v2.DeleteUserAccessTokenRequest + */ +export const DeleteUserAccessTokenRequest = proto3.makeMessageType( + "memos.api.v2.DeleteUserAccessTokenRequest", + () => [ + { no: 1, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "access_token", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message memos.api.v2.DeleteUserAccessTokenResponse + */ +export const DeleteUserAccessTokenResponse = proto3.makeMessageType( + "memos.api.v2.DeleteUserAccessTokenResponse", + [], +); + +/** + * @generated from message memos.api.v2.UserAccessToken */ -export const UserSettingValue = proto3.makeMessageType( - "memos.api.v2.UserSettingValue", +export const UserAccessToken = proto3.makeMessageType( + "memos.api.v2.UserAccessToken", () => [ - { no: 1, name: "string_value", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "value" }, - { no: 2, name: "visibility_value", kind: "enum", T: proto3.getEnumType(Visibility), oneof: "value" }, + { no: 1, name: "access_token", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "issued_at", kind: "message", T: Timestamp }, + { no: 4, name: "expires_at", kind: "message", T: Timestamp }, ], ); diff --git a/web/src/types/proto/store/user_setting_pb.d.ts b/web/src/types/proto/store/user_setting_pb.d.ts new file mode 100644 index 00000000..1c6fd18d --- /dev/null +++ b/web/src/types/proto/store/user_setting_pb.d.ts @@ -0,0 +1,116 @@ +// @generated by protoc-gen-es v1.3.0 +// @generated from file store/user_setting.proto (package memos.store, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum memos.store.UserSettingKey + */ +export declare enum UserSettingKey { + /** + * @generated from enum value: USER_SETTING_KEY_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, +} + +/** + * @generated from message memos.store.UserSetting + */ +export declare class UserSetting extends Message { + /** + * @generated from field: int32 user_id = 1; + */ + userId: number; + + /** + * @generated from field: memos.store.UserSettingKey key = 2; + */ + key: UserSettingKey; + + /** + * @generated from oneof memos.store.UserSetting.value + */ + value: { + /** + * @generated from field: memos.store.AccessTokensUserSetting access_tokens = 3; + */ + value: AccessTokensUserSetting; + case: "accessTokens"; + } | { case: undefined; value?: undefined }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "memos.store.UserSetting"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UserSetting; + + static fromJson(jsonValue: JsonValue, options?: Partial): UserSetting; + + static fromJsonString(jsonString: string, options?: Partial): UserSetting; + + static equals(a: UserSetting | PlainMessage | undefined, b: UserSetting | PlainMessage | undefined): boolean; +} + +/** + * @generated from message memos.store.AccessTokensUserSetting + */ +export declare class AccessTokensUserSetting extends Message { + /** + * @generated from field: repeated memos.store.AccessTokensUserSetting.AccessToken access_tokens = 1; + */ + accessTokens: AccessTokensUserSetting_AccessToken[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "memos.store.AccessTokensUserSetting"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): AccessTokensUserSetting; + + static fromJson(jsonValue: JsonValue, options?: Partial): AccessTokensUserSetting; + + static fromJsonString(jsonString: string, options?: Partial): AccessTokensUserSetting; + + static equals(a: AccessTokensUserSetting | PlainMessage | undefined, b: AccessTokensUserSetting | PlainMessage | undefined): boolean; +} + +/** + * @generated from message memos.store.AccessTokensUserSetting.AccessToken + */ +export declare class AccessTokensUserSetting_AccessToken extends Message { + /** + * The access token is a JWT token. + * Including expiration time, issuer, etc. + * + * @generated from field: string access_token = 1; + */ + accessToken: string; + + /** + * A description for the access token. + * + * @generated from field: string description = 2; + */ + description: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "memos.store.AccessTokensUserSetting.AccessToken"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): AccessTokensUserSetting_AccessToken; + + static fromJson(jsonValue: JsonValue, options?: Partial): AccessTokensUserSetting_AccessToken; + + static fromJsonString(jsonString: string, options?: Partial): AccessTokensUserSetting_AccessToken; + + static equals(a: AccessTokensUserSetting_AccessToken | PlainMessage | undefined, b: AccessTokensUserSetting_AccessToken | PlainMessage | undefined): boolean; +} + diff --git a/web/src/types/proto/store/user_setting_pb.js b/web/src/types/proto/store/user_setting_pb.js new file mode 100644 index 00000000..0e2a875d --- /dev/null +++ b/web/src/types/proto/store/user_setting_pb.js @@ -0,0 +1,51 @@ +// @generated by protoc-gen-es v1.3.0 +// @generated from file store/user_setting.proto (package memos.store, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum memos.store.UserSettingKey + */ +export const UserSettingKey = proto3.makeEnum( + "memos.store.UserSettingKey", + [ + {no: 0, name: "USER_SETTING_KEY_UNSPECIFIED", localName: "UNSPECIFIED"}, + ], +); + +/** + * @generated from message memos.store.UserSetting + */ +export const UserSetting = proto3.makeMessageType( + "memos.store.UserSetting", + () => [ + { no: 1, name: "user_id", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 2, name: "key", kind: "enum", T: proto3.getEnumType(UserSettingKey) }, + { no: 3, name: "access_tokens", kind: "message", T: AccessTokensUserSetting, oneof: "value" }, + ], +); + +/** + * @generated from message memos.store.AccessTokensUserSetting + */ +export const AccessTokensUserSetting = proto3.makeMessageType( + "memos.store.AccessTokensUserSetting", + () => [ + { no: 1, name: "access_tokens", kind: "message", T: AccessTokensUserSetting_AccessToken, repeated: true }, + ], +); + +/** + * @generated from message memos.store.AccessTokensUserSetting.AccessToken + */ +export const AccessTokensUserSetting_AccessToken = proto3.makeMessageType( + "memos.store.AccessTokensUserSetting.AccessToken", + () => [ + { no: 1, name: "access_token", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], + {localName: "AccessTokensUserSetting_AccessToken"}, +); +