mirror of
https://github.com/usememos/memos.git
synced 2024-12-19 17:12:02 +03:00
chore: add user access token setting definition
This commit is contained in:
parent
c87df8791b
commit
8a796d12b4
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
// The value of the setting.
|
||||
UserSettingValue value = 3;
|
||||
message ListUserAccessTokensRequest {
|
||||
string username = 1;
|
||||
}
|
||||
|
||||
message UserSettingValue {
|
||||
oneof value {
|
||||
// Default value as a string.
|
||||
string string_value = 1;
|
||||
Visibility visibility_value = 2;
|
||||
}
|
||||
message ListUserAccessTokensResponse {
|
||||
repeated UserAccessToken access_tokens = 1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -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 @@
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-CreateUserAccessTokenRequest"></a>
|
||||
|
||||
### CreateUserAccessTokenRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| username | [string](#string) | | |
|
||||
| user_access_token | [UserAccessToken](#memos-api-v2-UserAccessToken) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-CreateUserAccessTokenResponse"></a>
|
||||
|
||||
### CreateUserAccessTokenResponse
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| access_token | [UserAccessToken](#memos-api-v2-UserAccessToken) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-DeleteUserAccessTokenRequest"></a>
|
||||
|
||||
### DeleteUserAccessTokenRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| username | [string](#string) | | |
|
||||
| access_token | [string](#string) | | access_token is the access token to delete. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-DeleteUserAccessTokenResponse"></a>
|
||||
|
||||
### DeleteUserAccessTokenResponse
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-GetUserRequest"></a>
|
||||
|
||||
### GetUserRequest
|
||||
@ -418,6 +479,36 @@
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-ListUserAccessTokensRequest"></a>
|
||||
|
||||
### ListUserAccessTokensRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| username | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-ListUserAccessTokensResponse"></a>
|
||||
|
||||
### ListUserAccessTokensResponse
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| access_tokens | [UserAccessToken](#memos-api-v2-UserAccessToken) | repeated | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-UpdateUserRequest"></a>
|
||||
|
||||
### 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) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-UserSetting"></a>
|
||||
<a name="memos-api-v2-UserAccessToken"></a>
|
||||
|
||||
### UserSetting
|
||||
### UserAccessToken
|
||||
|
||||
|
||||
|
||||
| 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. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-UserSettingValue"></a>
|
||||
|
||||
### UserSettingValue
|
||||
|
||||
|
||||
|
||||
| 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 | |
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-UserSetting-Key"></a>
|
||||
|
||||
### 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. |
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
)
|
||||
|
@ -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",
|
||||
|
@ -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 @@
|
||||
|
||||
|
||||
|
||||
<a name="store_user_setting-proto"></a>
|
||||
<p align="right"><a href="#top">Top</a></p>
|
||||
|
||||
## store/user_setting.proto
|
||||
|
||||
|
||||
|
||||
<a name="memos-store-AccessTokensUserSetting"></a>
|
||||
|
||||
### AccessTokensUserSetting
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| access_tokens | [AccessTokensUserSetting.AccessToken](#memos-store-AccessTokensUserSetting-AccessToken) | repeated | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-store-AccessTokensUserSetting-AccessToken"></a>
|
||||
|
||||
### 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. |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-store-UserSetting"></a>
|
||||
|
||||
### UserSetting
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| user_id | [int32](#int32) | | |
|
||||
| key | [UserSettingKey](#memos-store-UserSettingKey) | | |
|
||||
| access_tokens | [AccessTokensUserSetting](#memos-store-AccessTokensUserSetting) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-store-UserSettingKey"></a>
|
||||
|
||||
### UserSettingKey
|
||||
|
||||
|
||||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| USER_SETTING_KEY_UNSPECIFIED | 0 | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Scalar Value Types
|
||||
|
||||
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
|
||||
|
395
proto/gen/store/user_setting.pb.go
Normal file
395
proto/gen/store/user_setting.pb.go
Normal file
@ -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
|
||||
}
|
30
proto/store/user_setting.proto
Normal file
30
proto/store/user_setting.proto
Normal file
@ -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;
|
||||
}
|
275
web/src/types/proto/api/v2/user_service_pb.d.ts
vendored
275
web/src/types/proto/api/v2/user_service_pb.d.ts
vendored
@ -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,55 +17,55 @@ export declare class User extends Message<User> {
|
||||
id: number;
|
||||
|
||||
/**
|
||||
* @generated from field: memos.api.v2.RowStatus row_status = 2;
|
||||
*/
|
||||
rowStatus: RowStatus;
|
||||
|
||||
/**
|
||||
* @generated from field: google.protobuf.Timestamp create_time = 3;
|
||||
*/
|
||||
createTime?: Timestamp;
|
||||
|
||||
/**
|
||||
* @generated from field: google.protobuf.Timestamp update_time = 4;
|
||||
*/
|
||||
updateTime?: Timestamp;
|
||||
|
||||
/**
|
||||
* @generated from field: string username = 5;
|
||||
* @generated from field: string username = 2;
|
||||
*/
|
||||
username: string;
|
||||
|
||||
/**
|
||||
* @generated from field: memos.api.v2.User.Role role = 6;
|
||||
* @generated from field: memos.api.v2.User.Role role = 3;
|
||||
*/
|
||||
role: User_Role;
|
||||
|
||||
/**
|
||||
* @generated from field: string email = 7;
|
||||
* @generated from field: string email = 4;
|
||||
*/
|
||||
email: string;
|
||||
|
||||
/**
|
||||
* @generated from field: string nickname = 8;
|
||||
* @generated from field: string nickname = 5;
|
||||
*/
|
||||
nickname: string;
|
||||
|
||||
/**
|
||||
* @generated from field: string open_id = 9;
|
||||
* @generated from field: string open_id = 6;
|
||||
*/
|
||||
openId: string;
|
||||
|
||||
/**
|
||||
* @generated from field: string avatar_url = 10;
|
||||
* @generated from field: string avatar_url = 7;
|
||||
*/
|
||||
avatarUrl: string;
|
||||
|
||||
/**
|
||||
* @generated from field: string password = 11;
|
||||
* @generated from field: string password = 8;
|
||||
*/
|
||||
password: string;
|
||||
|
||||
/**
|
||||
* @generated from field: memos.api.v2.RowStatus row_status = 9;
|
||||
*/
|
||||
rowStatus: RowStatus;
|
||||
|
||||
/**
|
||||
* @generated from field: google.protobuf.Timestamp create_time = 10;
|
||||
*/
|
||||
createTime?: Timestamp;
|
||||
|
||||
/**
|
||||
* @generated from field: google.protobuf.Timestamp update_time = 11;
|
||||
*/
|
||||
updateTime?: Timestamp;
|
||||
|
||||
constructor(data?: PartialMessage<User>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
@ -216,118 +215,192 @@ export declare class UpdateUserResponse extends Message<UpdateUserResponse> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message memos.api.v2.UserSetting
|
||||
* @generated from message memos.api.v2.ListUserAccessTokensRequest
|
||||
*/
|
||||
export declare class UserSetting extends Message<UserSetting> {
|
||||
export declare class ListUserAccessTokensRequest extends Message<ListUserAccessTokensRequest> {
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The value of the setting.
|
||||
*
|
||||
* @generated from field: memos.api.v2.UserSettingValue value = 3;
|
||||
*/
|
||||
value?: UserSettingValue;
|
||||
|
||||
constructor(data?: PartialMessage<UserSetting>);
|
||||
constructor(data?: PartialMessage<ListUserAccessTokensRequest>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.api.v2.UserSetting";
|
||||
static readonly typeName = "memos.api.v2.ListUserAccessTokensRequest";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserSetting;
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListUserAccessTokensRequest;
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserSetting;
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListUserAccessTokensRequest;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserSetting;
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListUserAccessTokensRequest;
|
||||
|
||||
static equals(a: UserSetting | PlainMessage<UserSetting> | undefined, b: UserSetting | PlainMessage<UserSetting> | undefined): boolean;
|
||||
static equals(a: ListUserAccessTokensRequest | PlainMessage<ListUserAccessTokensRequest> | undefined, b: ListUserAccessTokensRequest | PlainMessage<ListUserAccessTokensRequest> | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from enum memos.api.v2.UserSetting.Key
|
||||
* @generated from message memos.api.v2.ListUserAccessTokensResponse
|
||||
*/
|
||||
export declare enum UserSetting_Key {
|
||||
export declare class ListUserAccessTokensResponse extends Message<ListUserAccessTokensResponse> {
|
||||
/**
|
||||
* @generated from enum value: KEY_UNSPECIFIED = 0;
|
||||
* @generated from field: repeated memos.api.v2.UserAccessToken access_tokens = 1;
|
||||
*/
|
||||
KEY_UNSPECIFIED = 0,
|
||||
accessTokens: UserAccessToken[];
|
||||
|
||||
/**
|
||||
* The preferred locale.
|
||||
*
|
||||
* @generated from enum value: LOCALE = 1;
|
||||
*/
|
||||
LOCALE = 1,
|
||||
constructor(data?: PartialMessage<ListUserAccessTokensResponse>);
|
||||
|
||||
/**
|
||||
* The preferred appearance.
|
||||
*
|
||||
* @generated from enum value: APPEARANCE = 2;
|
||||
*/
|
||||
APPEARANCE = 2,
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.api.v2.ListUserAccessTokensResponse";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
/**
|
||||
* The default visibility of the memo when creating a new memo.
|
||||
*
|
||||
* @generated from enum value: MEMO_VISIBILITY = 3;
|
||||
*/
|
||||
MEMO_VISIBILITY = 3,
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListUserAccessTokensResponse;
|
||||
|
||||
/**
|
||||
* User's telegram id
|
||||
*
|
||||
* @generated from enum value: TELEGRAM_USER_ID = 4;
|
||||
*/
|
||||
TELEGRAM_USER_ID = 4,
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListUserAccessTokensResponse;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListUserAccessTokensResponse;
|
||||
|
||||
static equals(a: ListUserAccessTokensResponse | PlainMessage<ListUserAccessTokensResponse> | undefined, b: ListUserAccessTokensResponse | PlainMessage<ListUserAccessTokensResponse> | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message memos.api.v2.UserSettingValue
|
||||
* @generated from message memos.api.v2.CreateUserAccessTokenRequest
|
||||
*/
|
||||
export declare class UserSettingValue extends Message<UserSettingValue> {
|
||||
export declare class CreateUserAccessTokenRequest extends Message<CreateUserAccessTokenRequest> {
|
||||
/**
|
||||
* @generated from oneof memos.api.v2.UserSettingValue.value
|
||||
* @generated from field: string username = 1;
|
||||
*/
|
||||
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 };
|
||||
username: string;
|
||||
|
||||
constructor(data?: PartialMessage<UserSettingValue>);
|
||||
/**
|
||||
* @generated from field: memos.api.v2.UserAccessToken user_access_token = 2;
|
||||
*/
|
||||
userAccessToken?: UserAccessToken;
|
||||
|
||||
constructor(data?: PartialMessage<CreateUserAccessTokenRequest>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.api.v2.UserSettingValue";
|
||||
static readonly typeName = "memos.api.v2.CreateUserAccessTokenRequest";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserSettingValue;
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateUserAccessTokenRequest;
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserSettingValue;
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateUserAccessTokenRequest;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserSettingValue;
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateUserAccessTokenRequest;
|
||||
|
||||
static equals(a: UserSettingValue | PlainMessage<UserSettingValue> | undefined, b: UserSettingValue | PlainMessage<UserSettingValue> | undefined): boolean;
|
||||
static equals(a: CreateUserAccessTokenRequest | PlainMessage<CreateUserAccessTokenRequest> | undefined, b: CreateUserAccessTokenRequest | PlainMessage<CreateUserAccessTokenRequest> | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message memos.api.v2.CreateUserAccessTokenResponse
|
||||
*/
|
||||
export declare class CreateUserAccessTokenResponse extends Message<CreateUserAccessTokenResponse> {
|
||||
/**
|
||||
* @generated from field: memos.api.v2.UserAccessToken access_token = 1;
|
||||
*/
|
||||
accessToken?: UserAccessToken;
|
||||
|
||||
constructor(data?: PartialMessage<CreateUserAccessTokenResponse>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.api.v2.CreateUserAccessTokenResponse";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateUserAccessTokenResponse;
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateUserAccessTokenResponse;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateUserAccessTokenResponse;
|
||||
|
||||
static equals(a: CreateUserAccessTokenResponse | PlainMessage<CreateUserAccessTokenResponse> | undefined, b: CreateUserAccessTokenResponse | PlainMessage<CreateUserAccessTokenResponse> | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message memos.api.v2.DeleteUserAccessTokenRequest
|
||||
*/
|
||||
export declare class DeleteUserAccessTokenRequest extends Message<DeleteUserAccessTokenRequest> {
|
||||
/**
|
||||
* @generated from field: string username = 1;
|
||||
*/
|
||||
username: string;
|
||||
|
||||
/**
|
||||
* access_token is the access token to delete.
|
||||
*
|
||||
* @generated from field: string access_token = 2;
|
||||
*/
|
||||
accessToken: string;
|
||||
|
||||
constructor(data?: PartialMessage<DeleteUserAccessTokenRequest>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.api.v2.DeleteUserAccessTokenRequest";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeleteUserAccessTokenRequest;
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeleteUserAccessTokenRequest;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeleteUserAccessTokenRequest;
|
||||
|
||||
static equals(a: DeleteUserAccessTokenRequest | PlainMessage<DeleteUserAccessTokenRequest> | undefined, b: DeleteUserAccessTokenRequest | PlainMessage<DeleteUserAccessTokenRequest> | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message memos.api.v2.DeleteUserAccessTokenResponse
|
||||
*/
|
||||
export declare class DeleteUserAccessTokenResponse extends Message<DeleteUserAccessTokenResponse> {
|
||||
constructor(data?: PartialMessage<DeleteUserAccessTokenResponse>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.api.v2.DeleteUserAccessTokenResponse";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeleteUserAccessTokenResponse;
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeleteUserAccessTokenResponse;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeleteUserAccessTokenResponse;
|
||||
|
||||
static equals(a: DeleteUserAccessTokenResponse | PlainMessage<DeleteUserAccessTokenResponse> | undefined, b: DeleteUserAccessTokenResponse | PlainMessage<DeleteUserAccessTokenResponse> | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message memos.api.v2.UserAccessToken
|
||||
*/
|
||||
export declare class UserAccessToken extends Message<UserAccessToken> {
|
||||
/**
|
||||
* @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<UserAccessToken>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.api.v2.UserAccessToken";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserAccessToken;
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserAccessToken;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserAccessToken;
|
||||
|
||||
static equals(a: UserAccessToken | PlainMessage<UserAccessToken> | undefined, b: UserAccessToken | PlainMessage<UserAccessToken> | undefined): boolean;
|
||||
}
|
||||
|
||||
|
@ -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.UserSettingValue
|
||||
* @generated from message memos.api.v2.CreateUserAccessTokenRequest
|
||||
*/
|
||||
export const UserSettingValue = proto3.makeMessageType(
|
||||
"memos.api.v2.UserSettingValue",
|
||||
export const CreateUserAccessTokenRequest = proto3.makeMessageType(
|
||||
"memos.api.v2.CreateUserAccessTokenRequest",
|
||||
() => [
|
||||
{ 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: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 2, name: "user_access_token", kind: "message", T: UserAccessToken },
|
||||
],
|
||||
);
|
||||
|
||||
/**
|
||||
* @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 UserAccessToken = proto3.makeMessageType(
|
||||
"memos.api.v2.UserAccessToken",
|
||||
() => [
|
||||
{ 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 },
|
||||
],
|
||||
);
|
||||
|
||||
|
116
web/src/types/proto/store/user_setting_pb.d.ts
vendored
Normal file
116
web/src/types/proto/store/user_setting_pb.d.ts
vendored
Normal file
@ -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<UserSetting> {
|
||||
/**
|
||||
* @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<UserSetting>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.store.UserSetting";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserSetting;
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserSetting;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserSetting;
|
||||
|
||||
static equals(a: UserSetting | PlainMessage<UserSetting> | undefined, b: UserSetting | PlainMessage<UserSetting> | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message memos.store.AccessTokensUserSetting
|
||||
*/
|
||||
export declare class AccessTokensUserSetting extends Message<AccessTokensUserSetting> {
|
||||
/**
|
||||
* @generated from field: repeated memos.store.AccessTokensUserSetting.AccessToken access_tokens = 1;
|
||||
*/
|
||||
accessTokens: AccessTokensUserSetting_AccessToken[];
|
||||
|
||||
constructor(data?: PartialMessage<AccessTokensUserSetting>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.store.AccessTokensUserSetting";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AccessTokensUserSetting;
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AccessTokensUserSetting;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AccessTokensUserSetting;
|
||||
|
||||
static equals(a: AccessTokensUserSetting | PlainMessage<AccessTokensUserSetting> | undefined, b: AccessTokensUserSetting | PlainMessage<AccessTokensUserSetting> | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message memos.store.AccessTokensUserSetting.AccessToken
|
||||
*/
|
||||
export declare class AccessTokensUserSetting_AccessToken extends Message<AccessTokensUserSetting_AccessToken> {
|
||||
/**
|
||||
* 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<AccessTokensUserSetting_AccessToken>);
|
||||
|
||||
static readonly runtime: typeof proto3;
|
||||
static readonly typeName = "memos.store.AccessTokensUserSetting.AccessToken";
|
||||
static readonly fields: FieldList;
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AccessTokensUserSetting_AccessToken;
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AccessTokensUserSetting_AccessToken;
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AccessTokensUserSetting_AccessToken;
|
||||
|
||||
static equals(a: AccessTokensUserSetting_AccessToken | PlainMessage<AccessTokensUserSetting_AccessToken> | undefined, b: AccessTokensUserSetting_AccessToken | PlainMessage<AccessTokensUserSetting_AccessToken> | undefined): boolean;
|
||||
}
|
||||
|
51
web/src/types/proto/store/user_setting_pb.js
Normal file
51
web/src/types/proto/store/user_setting_pb.js
Normal file
@ -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"},
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user