Skip to content

armgit / memos

Public Imported from GitHub
0

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

refactor: shortcut service

Steven64b27d5a4ec4
diff --git a/proto/api/v1/shortcut_service.proto b/proto/api/v1/shortcut_service.proto
new file mode 100644
index 000000000..cfdd3a7b0
--- /dev/null
+++ b/proto/api/v1/shortcut_service.proto
@@ -0,0 +1,83 @@
+syntax = "proto3";
+
+package memos.api.v1;
+
+import "google/api/annotations.proto";
+import "google/api/client.proto";
+import "google/protobuf/empty.proto";
+import "google/protobuf/field_mask.proto";
+
+option go_package = "gen/api/v1";
+
+service ShortcutService {
+ // ListShortcuts returns a list of shortcuts for a user.
+ rpc ListShortcuts(ListShortcutsRequest) returns (ListShortcutsResponse) {
+ option (google.api.http) = {get: "/api/v1/{parent=users/*}/shortcuts"};
+ option (google.api.method_signature) = "parent";
+ }
+
+ // CreateShortcut creates a new shortcut for a user.
+ rpc CreateShortcut(CreateShortcutRequest) returns (Shortcut) {
+ option (google.api.http) = {
+ post: "/api/v1/{parent=users/*}/shortcuts"
+ body: "shortcut"
+ };
+ option (google.api.method_signature) = "parent,shortcut";
+ }
+
+ // UpdateShortcut updates a shortcut for a user.
+ rpc UpdateShortcut(UpdateShortcutRequest) returns (Shortcut) {
+ option (google.api.http) = {
+ patch: "/api/v1/{parent=users/*}/shortcuts/{shortcut.id}"
+ body: "shortcut"
+ };
+ option (google.api.method_signature) = "parent,shortcut,update_mask";
+ }
+
+ // DeleteShortcut deletes a shortcut for a user.
+ rpc DeleteShortcut(DeleteShortcutRequest) returns (google.protobuf.Empty) {
+ option (google.api.http) = {delete: "/api/v1/{parent=users/*}/shortcuts/{id}"};
+ option (google.api.method_signature) = "parent,id";
+ }
+}
+
+message Shortcut {
+ string id = 1;
+ string title = 2;
+ string filter = 3;
+}
+
+message ListShortcutsRequest {
+ // The name of the user.
+ string parent = 1;
+}
+
+message ListShortcutsResponse {
+ repeated Shortcut shortcuts = 1;
+}
+
+message CreateShortcutRequest {
+ // The name of the user.
+ string parent = 1;
+
+ Shortcut shortcut = 2;
+
+ bool validate_only = 3;
+}
+
+message UpdateShortcutRequest {
+ // The name of the user.
+ string parent = 1;
+
+ Shortcut shortcut = 2;
+
+ google.protobuf.FieldMask update_mask = 3;
+}
+
+message DeleteShortcutRequest {
+ // The name of the user.
+ string parent = 1;
+
+ // The id of the shortcut.
+ string id = 2;
+}
diff --git a/proto/api/v1/user_service.proto b/proto/api/v1/user_service.proto
index bb86ef2bf..70251c441 100644
--- a/proto/api/v1/user_service.proto
+++ b/proto/api/v1/user_service.proto
@@ -94,32 +94,6 @@ service UserService {
option (google.api.http) = {delete: "/api/v1/{name=users/*}/access_tokens/{access_token}"};
option (google.api.method_signature) = "name,access_token";
}
- // ListShortcuts returns a list of shortcuts for a user.
- rpc ListShortcuts(ListShortcutsRequest) returns (ListShortcutsResponse) {
- option (google.api.http) = {get: "/api/v1/{parent=users/*}/shortcuts"};
- option (google.api.method_signature) = "parent";
- }
- // CreateShortcut creates a new shortcut for a user.
- rpc CreateShortcut(CreateShortcutRequest) returns (Shortcut) {
- option (google.api.http) = {
- post: "/api/v1/{parent=users/*}/shortcuts"
- body: "shortcut"
- };
- option (google.api.method_signature) = "parent,shortcut";
- }
- // UpdateShortcut updates a shortcut for a user.
- rpc UpdateShortcut(UpdateShortcutRequest) returns (Shortcut) {
- option (google.api.http) = {
- patch: "/api/v1/{parent=users/*}/shortcuts/{shortcut.id}"
- body: "shortcut"
- };
- option (google.api.method_signature) = "parent,shortcut,update_mask";
- }
- // DeleteShortcut deletes a shortcut for a user.
- rpc DeleteShortcut(DeleteShortcutRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {delete: "/api/v1/{parent=users/*}/shortcuts/{id}"};
- option (google.api.method_signature) = "parent,id";
- }
}
message User {
@@ -288,44 +262,3 @@ message DeleteUserAccessTokenRequest {
// access_token is the access token to delete.
string access_token = 2;
}
-
-message Shortcut {
- string id = 1;
- string title = 2;
- string filter = 3;
-}
-
-message ListShortcutsRequest {
- // The name of the user.
- string parent = 1;
-}
-
-message ListShortcutsResponse {
- repeated Shortcut shortcuts = 1;
-}
-
-message CreateShortcutRequest {
- // The name of the user.
- string parent = 1;
-
- Shortcut shortcut = 2;
-
- bool validate_only = 3;
-}
-
-message UpdateShortcutRequest {
- // The name of the user.
- string parent = 1;
-
- Shortcut shortcut = 2;
-
- google.protobuf.FieldMask update_mask = 3;
-}
-
-message DeleteShortcutRequest {
- // The name of the user.
- string parent = 1;
-
- // The id of the shortcut.
- string id = 2;
-}
diff --git a/proto/gen/api/v1/shortcut_service.pb.go b/proto/gen/api/v1/shortcut_service.pb.go
new file mode 100644
index 000000000..bc53bc6ff
--- /dev/null
+++ b/proto/gen/api/v1/shortcut_service.pb.go
@@ -0,0 +1,449 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.36.6
+// protoc (unknown)
+// source: api/v1/shortcut_service.proto
+
+package apiv1
+
+import (
+ _ "google.golang.org/genproto/googleapis/api/annotations"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ emptypb "google.golang.org/protobuf/types/known/emptypb"
+ fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
+ reflect "reflect"
+ sync "sync"
+ unsafe "unsafe"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type Shortcut struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
+ Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
+ Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *Shortcut) Reset() {
+ *x = Shortcut{}
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *Shortcut) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Shortcut) ProtoMessage() {}
+
+func (x *Shortcut) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[0]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Shortcut.ProtoReflect.Descriptor instead.
+func (*Shortcut) Descriptor() ([]byte, []int) {
+ return file_api_v1_shortcut_service_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Shortcut) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *Shortcut) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *Shortcut) GetFilter() string {
+ if x != nil {
+ return x.Filter
+ }
+ return ""
+}
+
+type ListShortcutsRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The name of the user.
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListShortcutsRequest) Reset() {
+ *x = ListShortcutsRequest{}
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListShortcutsRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListShortcutsRequest) ProtoMessage() {}
+
+func (x *ListShortcutsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[1]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ListShortcutsRequest.ProtoReflect.Descriptor instead.
+func (*ListShortcutsRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_shortcut_service_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *ListShortcutsRequest) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+type ListShortcutsResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Shortcuts []*Shortcut `protobuf:"bytes,1,rep,name=shortcuts,proto3" json:"shortcuts,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListShortcutsResponse) Reset() {
+ *x = ListShortcutsResponse{}
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListShortcutsResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListShortcutsResponse) ProtoMessage() {}
+
+func (x *ListShortcutsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[2]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ListShortcutsResponse.ProtoReflect.Descriptor instead.
+func (*ListShortcutsResponse) Descriptor() ([]byte, []int) {
+ return file_api_v1_shortcut_service_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *ListShortcutsResponse) GetShortcuts() []*Shortcut {
+ if x != nil {
+ return x.Shortcuts
+ }
+ return nil
+}
+
+type CreateShortcutRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The name of the user.
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ Shortcut *Shortcut `protobuf:"bytes,2,opt,name=shortcut,proto3" json:"shortcut,omitempty"`
+ ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *CreateShortcutRequest) Reset() {
+ *x = CreateShortcutRequest{}
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *CreateShortcutRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateShortcutRequest) ProtoMessage() {}
+
+func (x *CreateShortcutRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[3]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateShortcutRequest.ProtoReflect.Descriptor instead.
+func (*CreateShortcutRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_shortcut_service_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *CreateShortcutRequest) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+func (x *CreateShortcutRequest) GetShortcut() *Shortcut {
+ if x != nil {
+ return x.Shortcut
+ }
+ return nil
+}
+
+func (x *CreateShortcutRequest) GetValidateOnly() bool {
+ if x != nil {
+ return x.ValidateOnly
+ }
+ return false
+}
+
+type UpdateShortcutRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The name of the user.
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ Shortcut *Shortcut `protobuf:"bytes,2,opt,name=shortcut,proto3" json:"shortcut,omitempty"`
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,3,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UpdateShortcutRequest) Reset() {
+ *x = UpdateShortcutRequest{}
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UpdateShortcutRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateShortcutRequest) ProtoMessage() {}
+
+func (x *UpdateShortcutRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[4]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateShortcutRequest.ProtoReflect.Descriptor instead.
+func (*UpdateShortcutRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_shortcut_service_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *UpdateShortcutRequest) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+func (x *UpdateShortcutRequest) GetShortcut() *Shortcut {
+ if x != nil {
+ return x.Shortcut
+ }
+ return nil
+}
+
+func (x *UpdateShortcutRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+type DeleteShortcutRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The name of the user.
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ // The id of the shortcut.
+ Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *DeleteShortcutRequest) Reset() {
+ *x = DeleteShortcutRequest{}
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *DeleteShortcutRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteShortcutRequest) ProtoMessage() {}
+
+func (x *DeleteShortcutRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_shortcut_service_proto_msgTypes[5]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteShortcutRequest.ProtoReflect.Descriptor instead.
+func (*DeleteShortcutRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_shortcut_service_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *DeleteShortcutRequest) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+func (x *DeleteShortcutRequest) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+var File_api_v1_shortcut_service_proto protoreflect.FileDescriptor
+
+const file_api_v1_shortcut_service_proto_rawDesc = "" +
+ "\n" +
+ "\x1dapi/v1/shortcut_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"H\n" +
+ "\bShortcut\x12\x0e\n" +
+ "\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" +
+ "\x05title\x18\x02 \x01(\tR\x05title\x12\x16\n" +
+ "\x06filter\x18\x03 \x01(\tR\x06filter\".\n" +
+ "\x14ListShortcutsRequest\x12\x16\n" +
+ "\x06parent\x18\x01 \x01(\tR\x06parent\"M\n" +
+ "\x15ListShortcutsResponse\x124\n" +
+ "\tshortcuts\x18\x01 \x03(\v2\x16.memos.api.v1.ShortcutR\tshortcuts\"\x88\x01\n" +
+ "\x15CreateShortcutRequest\x12\x16\n" +
+ "\x06parent\x18\x01 \x01(\tR\x06parent\x122\n" +
+ "\bshortcut\x18\x02 \x01(\v2\x16.memos.api.v1.ShortcutR\bshortcut\x12#\n" +
+ "\rvalidate_only\x18\x03 \x01(\bR\fvalidateOnly\"\xa0\x01\n" +
+ "\x15UpdateShortcutRequest\x12\x16\n" +
+ "\x06parent\x18\x01 \x01(\tR\x06parent\x122\n" +
+ "\bshortcut\x18\x02 \x01(\v2\x16.memos.api.v1.ShortcutR\bshortcut\x12;\n" +
+ "\vupdate_mask\x18\x03 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +
+ "updateMask\"?\n" +
+ "\x15DeleteShortcutRequest\x12\x16\n" +
+ "\x06parent\x18\x01 \x01(\tR\x06parent\x12\x0e\n" +
+ "\x02id\x18\x02 \x01(\tR\x02id2\xf8\x04\n" +
+ "\x0fShortcutService\x12\x8d\x01\n" +
+ "\rListShortcuts\x12\".memos.api.v1.ListShortcutsRequest\x1a#.memos.api.v1.ListShortcutsResponse\"3\xdaA\x06parent\x82\xd3\xe4\x93\x02$\x12\"/api/v1/{parent=users/*}/shortcuts\x12\x95\x01\n" +
+ "\x0eCreateShortcut\x12#.memos.api.v1.CreateShortcutRequest\x1a\x16.memos.api.v1.Shortcut\"F\xdaA\x0fparent,shortcut\x82\xd3\xe4\x93\x02.:\bshortcut\"\"/api/v1/{parent=users/*}/shortcuts\x12\xaf\x01\n" +
+ "\x0eUpdateShortcut\x12#.memos.api.v1.UpdateShortcutRequest\x1a\x16.memos.api.v1.Shortcut\"`\xdaA\x1bparent,shortcut,update_mask\x82\xd3\xe4\x93\x02<:\bshortcut20/api/v1/{parent=users/*}/shortcuts/{shortcut.id}\x12\x8a\x01\n" +
+ "\x0eDeleteShortcut\x12#.memos.api.v1.DeleteShortcutRequest\x1a\x16.google.protobuf.Empty\";\xdaA\tparent,id\x82\xd3\xe4\x93\x02)*'/api/v1/{parent=users/*}/shortcuts/{id}B\xac\x01\n" +
+ "\x10com.memos.api.v1B\x14ShortcutServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
+
+var (
+ file_api_v1_shortcut_service_proto_rawDescOnce sync.Once
+ file_api_v1_shortcut_service_proto_rawDescData []byte
+)
+
+func file_api_v1_shortcut_service_proto_rawDescGZIP() []byte {
+ file_api_v1_shortcut_service_proto_rawDescOnce.Do(func() {
+ file_api_v1_shortcut_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_v1_shortcut_service_proto_rawDesc), len(file_api_v1_shortcut_service_proto_rawDesc)))
+ })
+ return file_api_v1_shortcut_service_proto_rawDescData
+}
+
+var file_api_v1_shortcut_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
+var file_api_v1_shortcut_service_proto_goTypes = []any{
+ (*Shortcut)(nil), // 0: memos.api.v1.Shortcut
+ (*ListShortcutsRequest)(nil), // 1: memos.api.v1.ListShortcutsRequest
+ (*ListShortcutsResponse)(nil), // 2: memos.api.v1.ListShortcutsResponse
+ (*CreateShortcutRequest)(nil), // 3: memos.api.v1.CreateShortcutRequest
+ (*UpdateShortcutRequest)(nil), // 4: memos.api.v1.UpdateShortcutRequest
+ (*DeleteShortcutRequest)(nil), // 5: memos.api.v1.DeleteShortcutRequest
+ (*fieldmaskpb.FieldMask)(nil), // 6: google.protobuf.FieldMask
+ (*emptypb.Empty)(nil), // 7: google.protobuf.Empty
+}
+var file_api_v1_shortcut_service_proto_depIdxs = []int32{
+ 0, // 0: memos.api.v1.ListShortcutsResponse.shortcuts:type_name -> memos.api.v1.Shortcut
+ 0, // 1: memos.api.v1.CreateShortcutRequest.shortcut:type_name -> memos.api.v1.Shortcut
+ 0, // 2: memos.api.v1.UpdateShortcutRequest.shortcut:type_name -> memos.api.v1.Shortcut
+ 6, // 3: memos.api.v1.UpdateShortcutRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 1, // 4: memos.api.v1.ShortcutService.ListShortcuts:input_type -> memos.api.v1.ListShortcutsRequest
+ 3, // 5: memos.api.v1.ShortcutService.CreateShortcut:input_type -> memos.api.v1.CreateShortcutRequest
+ 4, // 6: memos.api.v1.ShortcutService.UpdateShortcut:input_type -> memos.api.v1.UpdateShortcutRequest
+ 5, // 7: memos.api.v1.ShortcutService.DeleteShortcut:input_type -> memos.api.v1.DeleteShortcutRequest
+ 2, // 8: memos.api.v1.ShortcutService.ListShortcuts:output_type -> memos.api.v1.ListShortcutsResponse
+ 0, // 9: memos.api.v1.ShortcutService.CreateShortcut:output_type -> memos.api.v1.Shortcut
+ 0, // 10: memos.api.v1.ShortcutService.UpdateShortcut:output_type -> memos.api.v1.Shortcut
+ 7, // 11: memos.api.v1.ShortcutService.DeleteShortcut:output_type -> google.protobuf.Empty
+ 8, // [8:12] is the sub-list for method output_type
+ 4, // [4:8] is the sub-list for method input_type
+ 4, // [4:4] is the sub-list for extension type_name
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
+}
+
+func init() { file_api_v1_shortcut_service_proto_init() }
+func file_api_v1_shortcut_service_proto_init() {
+ if File_api_v1_shortcut_service_proto != nil {
+ return
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_shortcut_service_proto_rawDesc), len(file_api_v1_shortcut_service_proto_rawDesc)),
+ NumEnums: 0,
+ NumMessages: 6,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_api_v1_shortcut_service_proto_goTypes,
+ DependencyIndexes: file_api_v1_shortcut_service_proto_depIdxs,
+ MessageInfos: file_api_v1_shortcut_service_proto_msgTypes,
+ }.Build()
+ File_api_v1_shortcut_service_proto = out.File
+ file_api_v1_shortcut_service_proto_goTypes = nil
+ file_api_v1_shortcut_service_proto_depIdxs = nil
+}
diff --git a/proto/gen/api/v1/shortcut_service.pb.gw.go b/proto/gen/api/v1/shortcut_service.pb.gw.go
new file mode 100644
index 000000000..0ff147610
--- /dev/null
+++ b/proto/gen/api/v1/shortcut_service.pb.gw.go
@@ -0,0 +1,487 @@
+// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
+// source: api/v1/shortcut_service.proto
+
+/*
+Package apiv1 is a reverse proxy.
+
+It translates gRPC into RESTful JSON APIs.
+*/
+package apiv1
+
+import (
+ "context"
+ "errors"
+ "io"
+ "net/http"
+
+ "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
+ "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/grpclog"
+ "google.golang.org/grpc/metadata"
+ "google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
+)
+
+// Suppress "imported and not used" errors
+var (
+ _ codes.Code
+ _ io.Reader
+ _ status.Status
+ _ = errors.New
+ _ = runtime.String
+ _ = utilities.NewDoubleArray
+ _ = metadata.Join
+)
+
+func request_ShortcutService_ListShortcuts_0(ctx context.Context, marshaler runtime.Marshaler, client ShortcutServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListShortcutsRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ io.Copy(io.Discard, req.Body)
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ msg, err := client.ListShortcuts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_ShortcutService_ListShortcuts_0(ctx context.Context, marshaler runtime.Marshaler, server ShortcutServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListShortcutsRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ msg, err := server.ListShortcuts(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+var filter_ShortcutService_CreateShortcut_0 = &utilities.DoubleArray{Encoding: map[string]int{"shortcut": 0, "parent": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
+
+func request_ShortcutService_CreateShortcut_0(ctx context.Context, marshaler runtime.Marshaler, client ShortcutServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq CreateShortcutRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Shortcut); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ShortcutService_CreateShortcut_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := client.CreateShortcut(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_ShortcutService_CreateShortcut_0(ctx context.Context, marshaler runtime.Marshaler, server ShortcutServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq CreateShortcutRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Shortcut); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ShortcutService_CreateShortcut_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.CreateShortcut(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+var filter_ShortcutService_UpdateShortcut_0 = &utilities.DoubleArray{Encoding: map[string]int{"shortcut": 0, "parent": 1, "id": 2}, Base: []int{1, 2, 3, 1, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 3}}
+
+func request_ShortcutService_UpdateShortcut_0(ctx context.Context, marshaler runtime.Marshaler, client ShortcutServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq UpdateShortcutRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Shortcut); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
+ if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Shortcut); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ } else {
+ protoReq.UpdateMask = fieldMask
+ }
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ val, ok = pathParams["shortcut.id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shortcut.id")
+ }
+ err = runtime.PopulateFieldFromPath(&protoReq, "shortcut.id", val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shortcut.id", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ShortcutService_UpdateShortcut_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := client.UpdateShortcut(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_ShortcutService_UpdateShortcut_0(ctx context.Context, marshaler runtime.Marshaler, server ShortcutServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq UpdateShortcutRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Shortcut); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
+ if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Shortcut); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ } else {
+ protoReq.UpdateMask = fieldMask
+ }
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ val, ok = pathParams["shortcut.id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shortcut.id")
+ }
+ err = runtime.PopulateFieldFromPath(&protoReq, "shortcut.id", val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shortcut.id", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ShortcutService_UpdateShortcut_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.UpdateShortcut(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+func request_ShortcutService_DeleteShortcut_0(ctx context.Context, marshaler runtime.Marshaler, client ShortcutServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq DeleteShortcutRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ io.Copy(io.Discard, req.Body)
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ val, ok = pathParams["id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
+ }
+ protoReq.Id, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
+ }
+ msg, err := client.DeleteShortcut(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_ShortcutService_DeleteShortcut_0(ctx context.Context, marshaler runtime.Marshaler, server ShortcutServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq DeleteShortcutRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ val, ok = pathParams["id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
+ }
+ protoReq.Id, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
+ }
+ msg, err := server.DeleteShortcut(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+// RegisterShortcutServiceHandlerServer registers the http handlers for service ShortcutService to "mux".
+// UnaryRPC :call ShortcutServiceServer directly.
+// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
+// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterShortcutServiceHandlerFromEndpoint instead.
+// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
+func RegisterShortcutServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ShortcutServiceServer) error {
+ mux.Handle(http.MethodGet, pattern_ShortcutService_ListShortcuts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.ShortcutService/ListShortcuts", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_ShortcutService_ListShortcuts_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_ShortcutService_ListShortcuts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_ShortcutService_CreateShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.ShortcutService/CreateShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_ShortcutService_CreateShortcut_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_ShortcutService_CreateShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPatch, pattern_ShortcutService_UpdateShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.ShortcutService/UpdateShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts/{shortcut.id}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_ShortcutService_UpdateShortcut_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_ShortcutService_UpdateShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodDelete, pattern_ShortcutService_DeleteShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.ShortcutService/DeleteShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts/{id}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_ShortcutService_DeleteShortcut_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_ShortcutService_DeleteShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+
+ return nil
+}
+
+// RegisterShortcutServiceHandlerFromEndpoint is same as RegisterShortcutServiceHandler but
+// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
+func RegisterShortcutServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
+ conn, err := grpc.NewClient(endpoint, opts...)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if err != nil {
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ return
+ }
+ go func() {
+ <-ctx.Done()
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ }()
+ }()
+ return RegisterShortcutServiceHandler(ctx, mux, conn)
+}
+
+// RegisterShortcutServiceHandler registers the http handlers for service ShortcutService to "mux".
+// The handlers forward requests to the grpc endpoint over "conn".
+func RegisterShortcutServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
+ return RegisterShortcutServiceHandlerClient(ctx, mux, NewShortcutServiceClient(conn))
+}
+
+// RegisterShortcutServiceHandlerClient registers the http handlers for service ShortcutService
+// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ShortcutServiceClient".
+// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ShortcutServiceClient"
+// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
+// "ShortcutServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
+func RegisterShortcutServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ShortcutServiceClient) error {
+ mux.Handle(http.MethodGet, pattern_ShortcutService_ListShortcuts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.ShortcutService/ListShortcuts", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_ShortcutService_ListShortcuts_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_ShortcutService_ListShortcuts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_ShortcutService_CreateShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.ShortcutService/CreateShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_ShortcutService_CreateShortcut_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_ShortcutService_CreateShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPatch, pattern_ShortcutService_UpdateShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.ShortcutService/UpdateShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts/{shortcut.id}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_ShortcutService_UpdateShortcut_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_ShortcutService_UpdateShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodDelete, pattern_ShortcutService_DeleteShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.ShortcutService/DeleteShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts/{id}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_ShortcutService_DeleteShortcut_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_ShortcutService_DeleteShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ return nil
+}
+
+var (
+ pattern_ShortcutService_ListShortcuts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "shortcuts"}, ""))
+ pattern_ShortcutService_CreateShortcut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "shortcuts"}, ""))
+ pattern_ShortcutService_UpdateShortcut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v1", "users", "parent", "shortcuts", "shortcut.id"}, ""))
+ pattern_ShortcutService_DeleteShortcut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v1", "users", "parent", "shortcuts", "id"}, ""))
+)
+
+var (
+ forward_ShortcutService_ListShortcuts_0 = runtime.ForwardResponseMessage
+ forward_ShortcutService_CreateShortcut_0 = runtime.ForwardResponseMessage
+ forward_ShortcutService_UpdateShortcut_0 = runtime.ForwardResponseMessage
+ forward_ShortcutService_DeleteShortcut_0 = runtime.ForwardResponseMessage
+)
diff --git a/proto/gen/api/v1/shortcut_service_grpc.pb.go b/proto/gen/api/v1/shortcut_service_grpc.pb.go
new file mode 100644
index 000000000..a9b61572b
--- /dev/null
+++ b/proto/gen/api/v1/shortcut_service_grpc.pb.go
@@ -0,0 +1,244 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.5.1
+// - protoc (unknown)
+// source: api/v1/shortcut_service.proto
+
+package apiv1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+ emptypb "google.golang.org/protobuf/types/known/emptypb"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.64.0 or later.
+const _ = grpc.SupportPackageIsVersion9
+
+const (
+ ShortcutService_ListShortcuts_FullMethodName = "/memos.api.v1.ShortcutService/ListShortcuts"
+ ShortcutService_CreateShortcut_FullMethodName = "/memos.api.v1.ShortcutService/CreateShortcut"
+ ShortcutService_UpdateShortcut_FullMethodName = "/memos.api.v1.ShortcutService/UpdateShortcut"
+ ShortcutService_DeleteShortcut_FullMethodName = "/memos.api.v1.ShortcutService/DeleteShortcut"
+)
+
+// ShortcutServiceClient is the client API for ShortcutService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type ShortcutServiceClient interface {
+ // ListShortcuts returns a list of shortcuts for a user.
+ ListShortcuts(ctx context.Context, in *ListShortcutsRequest, opts ...grpc.CallOption) (*ListShortcutsResponse, error)
+ // CreateShortcut creates a new shortcut for a user.
+ CreateShortcut(ctx context.Context, in *CreateShortcutRequest, opts ...grpc.CallOption) (*Shortcut, error)
+ // UpdateShortcut updates a shortcut for a user.
+ UpdateShortcut(ctx context.Context, in *UpdateShortcutRequest, opts ...grpc.CallOption) (*Shortcut, error)
+ // DeleteShortcut deletes a shortcut for a user.
+ DeleteShortcut(ctx context.Context, in *DeleteShortcutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
+}
+
+type shortcutServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewShortcutServiceClient(cc grpc.ClientConnInterface) ShortcutServiceClient {
+ return &shortcutServiceClient{cc}
+}
+
+func (c *shortcutServiceClient) ListShortcuts(ctx context.Context, in *ListShortcutsRequest, opts ...grpc.CallOption) (*ListShortcutsResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(ListShortcutsResponse)
+ err := c.cc.Invoke(ctx, ShortcutService_ListShortcuts_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *shortcutServiceClient) CreateShortcut(ctx context.Context, in *CreateShortcutRequest, opts ...grpc.CallOption) (*Shortcut, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Shortcut)
+ err := c.cc.Invoke(ctx, ShortcutService_CreateShortcut_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *shortcutServiceClient) UpdateShortcut(ctx context.Context, in *UpdateShortcutRequest, opts ...grpc.CallOption) (*Shortcut, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Shortcut)
+ err := c.cc.Invoke(ctx, ShortcutService_UpdateShortcut_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *shortcutServiceClient) DeleteShortcut(ctx context.Context, in *DeleteShortcutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(emptypb.Empty)
+ err := c.cc.Invoke(ctx, ShortcutService_DeleteShortcut_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// ShortcutServiceServer is the server API for ShortcutService service.
+// All implementations must embed UnimplementedShortcutServiceServer
+// for forward compatibility.
+type ShortcutServiceServer interface {
+ // ListShortcuts returns a list of shortcuts for a user.
+ ListShortcuts(context.Context, *ListShortcutsRequest) (*ListShortcutsResponse, error)
+ // CreateShortcut creates a new shortcut for a user.
+ CreateShortcut(context.Context, *CreateShortcutRequest) (*Shortcut, error)
+ // UpdateShortcut updates a shortcut for a user.
+ UpdateShortcut(context.Context, *UpdateShortcutRequest) (*Shortcut, error)
+ // DeleteShortcut deletes a shortcut for a user.
+ DeleteShortcut(context.Context, *DeleteShortcutRequest) (*emptypb.Empty, error)
+ mustEmbedUnimplementedShortcutServiceServer()
+}
+
+// UnimplementedShortcutServiceServer must be embedded to have
+// forward compatible implementations.
+//
+// NOTE: this should be embedded by value instead of pointer to avoid a nil
+// pointer dereference when methods are called.
+type UnimplementedShortcutServiceServer struct{}
+
+func (UnimplementedShortcutServiceServer) ListShortcuts(context.Context, *ListShortcutsRequest) (*ListShortcutsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method ListShortcuts not implemented")
+}
+func (UnimplementedShortcutServiceServer) CreateShortcut(context.Context, *CreateShortcutRequest) (*Shortcut, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateShortcut not implemented")
+}
+func (UnimplementedShortcutServiceServer) UpdateShortcut(context.Context, *UpdateShortcutRequest) (*Shortcut, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateShortcut not implemented")
+}
+func (UnimplementedShortcutServiceServer) DeleteShortcut(context.Context, *DeleteShortcutRequest) (*emptypb.Empty, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method DeleteShortcut not implemented")
+}
+func (UnimplementedShortcutServiceServer) mustEmbedUnimplementedShortcutServiceServer() {}
+func (UnimplementedShortcutServiceServer) testEmbeddedByValue() {}
+
+// UnsafeShortcutServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to ShortcutServiceServer will
+// result in compilation errors.
+type UnsafeShortcutServiceServer interface {
+ mustEmbedUnimplementedShortcutServiceServer()
+}
+
+func RegisterShortcutServiceServer(s grpc.ServiceRegistrar, srv ShortcutServiceServer) {
+ // If the following call pancis, it indicates UnimplementedShortcutServiceServer was
+ // embedded by pointer and is nil. This will cause panics if an
+ // unimplemented method is ever invoked, so we test this at initialization
+ // time to prevent it from happening at runtime later due to I/O.
+ if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
+ t.testEmbeddedByValue()
+ }
+ s.RegisterService(&ShortcutService_ServiceDesc, srv)
+}
+
+func _ShortcutService_ListShortcuts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ListShortcutsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ShortcutServiceServer).ListShortcuts(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ShortcutService_ListShortcuts_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ShortcutServiceServer).ListShortcuts(ctx, req.(*ListShortcutsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ShortcutService_CreateShortcut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateShortcutRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ShortcutServiceServer).CreateShortcut(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ShortcutService_CreateShortcut_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ShortcutServiceServer).CreateShortcut(ctx, req.(*CreateShortcutRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ShortcutService_UpdateShortcut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateShortcutRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ShortcutServiceServer).UpdateShortcut(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ShortcutService_UpdateShortcut_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ShortcutServiceServer).UpdateShortcut(ctx, req.(*UpdateShortcutRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ShortcutService_DeleteShortcut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeleteShortcutRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ShortcutServiceServer).DeleteShortcut(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ShortcutService_DeleteShortcut_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ShortcutServiceServer).DeleteShortcut(ctx, req.(*DeleteShortcutRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// ShortcutService_ServiceDesc is the grpc.ServiceDesc for ShortcutService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var ShortcutService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "memos.api.v1.ShortcutService",
+ HandlerType: (*ShortcutServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "ListShortcuts",
+ Handler: _ShortcutService_ListShortcuts_Handler,
+ },
+ {
+ MethodName: "CreateShortcut",
+ Handler: _ShortcutService_CreateShortcut_Handler,
+ },
+ {
+ MethodName: "UpdateShortcut",
+ Handler: _ShortcutService_UpdateShortcut_Handler,
+ },
+ {
+ MethodName: "DeleteShortcut",
+ Handler: _ShortcutService_DeleteShortcut_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "api/v1/shortcut_service.proto",
+}
diff --git a/proto/gen/api/v1/user_service.pb.go b/proto/gen/api/v1/user_service.pb.go
index 8123e2b1f..db6bea2f9 100644
--- a/proto/gen/api/v1/user_service.pb.go
+++ b/proto/gen/api/v1/user_service.pb.go
@@ -1226,331 +1226,6 @@ func (x *DeleteUserAccessTokenRequest) GetAccessToken() string {
return ""
}
-type Shortcut struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
- Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
- Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *Shortcut) Reset() {
- *x = Shortcut{}
- mi := &file_api_v1_user_service_proto_msgTypes[21]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *Shortcut) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Shortcut) ProtoMessage() {}
-
-func (x *Shortcut) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[21]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Shortcut.ProtoReflect.Descriptor instead.
-func (*Shortcut) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{21}
-}
-
-func (x *Shortcut) GetId() string {
- if x != nil {
- return x.Id
- }
- return ""
-}
-
-func (x *Shortcut) GetTitle() string {
- if x != nil {
- return x.Title
- }
- return ""
-}
-
-func (x *Shortcut) GetFilter() string {
- if x != nil {
- return x.Filter
- }
- return ""
-}
-
-type ListShortcutsRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the user.
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ListShortcutsRequest) Reset() {
- *x = ListShortcutsRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[22]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ListShortcutsRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListShortcutsRequest) ProtoMessage() {}
-
-func (x *ListShortcutsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[22]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ListShortcutsRequest.ProtoReflect.Descriptor instead.
-func (*ListShortcutsRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{22}
-}
-
-func (x *ListShortcutsRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-type ListShortcutsResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Shortcuts []*Shortcut `protobuf:"bytes,1,rep,name=shortcuts,proto3" json:"shortcuts,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *ListShortcutsResponse) Reset() {
- *x = ListShortcutsResponse{}
- mi := &file_api_v1_user_service_proto_msgTypes[23]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *ListShortcutsResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListShortcutsResponse) ProtoMessage() {}
-
-func (x *ListShortcutsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[23]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ListShortcutsResponse.ProtoReflect.Descriptor instead.
-func (*ListShortcutsResponse) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{23}
-}
-
-func (x *ListShortcutsResponse) GetShortcuts() []*Shortcut {
- if x != nil {
- return x.Shortcuts
- }
- return nil
-}
-
-type CreateShortcutRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the user.
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- Shortcut *Shortcut `protobuf:"bytes,2,opt,name=shortcut,proto3" json:"shortcut,omitempty"`
- ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *CreateShortcutRequest) Reset() {
- *x = CreateShortcutRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[24]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *CreateShortcutRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CreateShortcutRequest) ProtoMessage() {}
-
-func (x *CreateShortcutRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[24]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CreateShortcutRequest.ProtoReflect.Descriptor instead.
-func (*CreateShortcutRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{24}
-}
-
-func (x *CreateShortcutRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-func (x *CreateShortcutRequest) GetShortcut() *Shortcut {
- if x != nil {
- return x.Shortcut
- }
- return nil
-}
-
-func (x *CreateShortcutRequest) GetValidateOnly() bool {
- if x != nil {
- return x.ValidateOnly
- }
- return false
-}
-
-type UpdateShortcutRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the user.
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- Shortcut *Shortcut `protobuf:"bytes,2,opt,name=shortcut,proto3" json:"shortcut,omitempty"`
- UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,3,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *UpdateShortcutRequest) Reset() {
- *x = UpdateShortcutRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[25]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *UpdateShortcutRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*UpdateShortcutRequest) ProtoMessage() {}
-
-func (x *UpdateShortcutRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[25]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use UpdateShortcutRequest.ProtoReflect.Descriptor instead.
-func (*UpdateShortcutRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{25}
-}
-
-func (x *UpdateShortcutRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-func (x *UpdateShortcutRequest) GetShortcut() *Shortcut {
- if x != nil {
- return x.Shortcut
- }
- return nil
-}
-
-func (x *UpdateShortcutRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
- if x != nil {
- return x.UpdateMask
- }
- return nil
-}
-
-type DeleteShortcutRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The name of the user.
- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
- // The id of the shortcut.
- Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *DeleteShortcutRequest) Reset() {
- *x = DeleteShortcutRequest{}
- mi := &file_api_v1_user_service_proto_msgTypes[26]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *DeleteShortcutRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*DeleteShortcutRequest) ProtoMessage() {}
-
-func (x *DeleteShortcutRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[26]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use DeleteShortcutRequest.ProtoReflect.Descriptor instead.
-func (*DeleteShortcutRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_user_service_proto_rawDescGZIP(), []int{26}
-}
-
-func (x *DeleteShortcutRequest) GetParent() string {
- if x != nil {
- return x.Parent
- }
- return ""
-}
-
-func (x *DeleteShortcutRequest) GetId() string {
- if x != nil {
- return x.Id
- }
- return ""
-}
-
type UserStats_MemoTypeStats struct {
state protoimpl.MessageState `protogen:"open.v1"`
LinkCount int32 `protobuf:"varint,1,opt,name=link_count,json=linkCount,proto3" json:"link_count,omitempty"`
@@ -1563,7 +1238,7 @@ type UserStats_MemoTypeStats struct {
func (x *UserStats_MemoTypeStats) Reset() {
*x = UserStats_MemoTypeStats{}
- mi := &file_api_v1_user_service_proto_msgTypes[28]
+ mi := &file_api_v1_user_service_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1575,7 +1250,7 @@ func (x *UserStats_MemoTypeStats) String() string {
func (*UserStats_MemoTypeStats) ProtoMessage() {}
func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_user_service_proto_msgTypes[28]
+ mi := &file_api_v1_user_service_proto_msgTypes[22]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1719,27 +1394,7 @@ const file_api_v1_user_service_proto_rawDesc = "" +
"\v_expires_at\"U\n" +
"\x1cDeleteUserAccessTokenRequest\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12!\n" +
- "\faccess_token\x18\x02 \x01(\tR\vaccessToken\"H\n" +
- "\bShortcut\x12\x0e\n" +
- "\x02id\x18\x01 \x01(\tR\x02id\x12\x14\n" +
- "\x05title\x18\x02 \x01(\tR\x05title\x12\x16\n" +
- "\x06filter\x18\x03 \x01(\tR\x06filter\".\n" +
- "\x14ListShortcutsRequest\x12\x16\n" +
- "\x06parent\x18\x01 \x01(\tR\x06parent\"M\n" +
- "\x15ListShortcutsResponse\x124\n" +
- "\tshortcuts\x18\x01 \x03(\v2\x16.memos.api.v1.ShortcutR\tshortcuts\"\x88\x01\n" +
- "\x15CreateShortcutRequest\x12\x16\n" +
- "\x06parent\x18\x01 \x01(\tR\x06parent\x122\n" +
- "\bshortcut\x18\x02 \x01(\v2\x16.memos.api.v1.ShortcutR\bshortcut\x12#\n" +
- "\rvalidate_only\x18\x03 \x01(\bR\fvalidateOnly\"\xa0\x01\n" +
- "\x15UpdateShortcutRequest\x12\x16\n" +
- "\x06parent\x18\x01 \x01(\tR\x06parent\x122\n" +
- "\bshortcut\x18\x02 \x01(\v2\x16.memos.api.v1.ShortcutR\bshortcut\x12;\n" +
- "\vupdate_mask\x18\x03 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +
- "updateMask\"?\n" +
- "\x15DeleteShortcutRequest\x12\x16\n" +
- "\x06parent\x18\x01 \x01(\tR\x06parent\x12\x0e\n" +
- "\x02id\x18\x02 \x01(\tR\x02id2\xa9\x13\n" +
+ "\faccess_token\x18\x02 \x01(\tR\vaccessToken2\xc2\x0e\n" +
"\vUserService\x12c\n" +
"\tListUsers\x12\x1e.memos.api.v1.ListUsersRequest\x1a\x1f.memos.api.v1.ListUsersResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/api/v1/users\x12b\n" +
"\aGetUser\x12\x1c.memos.api.v1.GetUserRequest\x1a\x12.memos.api.v1.User\"%\xdaA\x04name\x82\xd3\xe4\x93\x02\x18\x12\x16/api/v1/{name=users/*}\x12z\n" +
@@ -1757,11 +1412,7 @@ const file_api_v1_user_service_proto_rawDesc = "" +
"\x11UpdateUserSetting\x12&.memos.api.v1.UpdateUserSettingRequest\x1a\x19.memos.api.v1.UserSetting\"M\xdaA\x13setting,update_mask\x82\xd3\xe4\x93\x021:\asetting2&/api/v1/{setting.name=users/*/setting}\x12\xa2\x01\n" +
"\x14ListUserAccessTokens\x12).memos.api.v1.ListUserAccessTokensRequest\x1a*.memos.api.v1.ListUserAccessTokensResponse\"3\xdaA\x04name\x82\xd3\xe4\x93\x02&\x12$/api/v1/{name=users/*}/access_tokens\x12\x9a\x01\n" +
"\x15CreateUserAccessToken\x12*.memos.api.v1.CreateUserAccessTokenRequest\x1a\x1d.memos.api.v1.UserAccessToken\"6\xdaA\x04name\x82\xd3\xe4\x93\x02):\x01*\"$/api/v1/{name=users/*}/access_tokens\x12\xac\x01\n" +
- "\x15DeleteUserAccessToken\x12*.memos.api.v1.DeleteUserAccessTokenRequest\x1a\x16.google.protobuf.Empty\"O\xdaA\x11name,access_token\x82\xd3\xe4\x93\x025*3/api/v1/{name=users/*}/access_tokens/{access_token}\x12\x8d\x01\n" +
- "\rListShortcuts\x12\".memos.api.v1.ListShortcutsRequest\x1a#.memos.api.v1.ListShortcutsResponse\"3\xdaA\x06parent\x82\xd3\xe4\x93\x02$\x12\"/api/v1/{parent=users/*}/shortcuts\x12\x95\x01\n" +
- "\x0eCreateShortcut\x12#.memos.api.v1.CreateShortcutRequest\x1a\x16.memos.api.v1.Shortcut\"F\xdaA\x0fparent,shortcut\x82\xd3\xe4\x93\x02.:\bshortcut\"\"/api/v1/{parent=users/*}/shortcuts\x12\xaf\x01\n" +
- "\x0eUpdateShortcut\x12#.memos.api.v1.UpdateShortcutRequest\x1a\x16.memos.api.v1.Shortcut\"`\xdaA\x1bparent,shortcut,update_mask\x82\xd3\xe4\x93\x02<:\bshortcut20/api/v1/{parent=users/*}/shortcuts/{shortcut.id}\x12\x8a\x01\n" +
- "\x0eDeleteShortcut\x12#.memos.api.v1.DeleteShortcutRequest\x1a\x16.google.protobuf.Empty\";\xdaA\tparent,id\x82\xd3\xe4\x93\x02)*'/api/v1/{parent=users/*}/shortcuts/{id}B\xa8\x01\n" +
+ "\x15DeleteUserAccessToken\x12*.memos.api.v1.DeleteUserAccessTokenRequest\x1a\x16.google.protobuf.Empty\"O\xdaA\x11name,access_token\x82\xd3\xe4\x93\x025*3/api/v1/{name=users/*}/access_tokens/{access_token}B\xa8\x01\n" +
"\x10com.memos.api.v1B\x10UserServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
var (
@@ -1777,7 +1428,7 @@ func file_api_v1_user_service_proto_rawDescGZIP() []byte {
}
var file_api_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 29)
+var file_api_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 23)
var file_api_v1_user_service_proto_goTypes = []any{
(User_Role)(0), // 0: memos.api.v1.User.Role
(*User)(nil), // 1: memos.api.v1.User
@@ -1801,85 +1452,67 @@ var file_api_v1_user_service_proto_goTypes = []any{
(*ListUserAccessTokensResponse)(nil), // 19: memos.api.v1.ListUserAccessTokensResponse
(*CreateUserAccessTokenRequest)(nil), // 20: memos.api.v1.CreateUserAccessTokenRequest
(*DeleteUserAccessTokenRequest)(nil), // 21: memos.api.v1.DeleteUserAccessTokenRequest
- (*Shortcut)(nil), // 22: memos.api.v1.Shortcut
- (*ListShortcutsRequest)(nil), // 23: memos.api.v1.ListShortcutsRequest
- (*ListShortcutsResponse)(nil), // 24: memos.api.v1.ListShortcutsResponse
- (*CreateShortcutRequest)(nil), // 25: memos.api.v1.CreateShortcutRequest
- (*UpdateShortcutRequest)(nil), // 26: memos.api.v1.UpdateShortcutRequest
- (*DeleteShortcutRequest)(nil), // 27: memos.api.v1.DeleteShortcutRequest
- nil, // 28: memos.api.v1.UserStats.TagCountEntry
- (*UserStats_MemoTypeStats)(nil), // 29: memos.api.v1.UserStats.MemoTypeStats
- (State)(0), // 30: memos.api.v1.State
- (*timestamppb.Timestamp)(nil), // 31: google.protobuf.Timestamp
- (*httpbody.HttpBody)(nil), // 32: google.api.HttpBody
- (*fieldmaskpb.FieldMask)(nil), // 33: google.protobuf.FieldMask
- (*emptypb.Empty)(nil), // 34: google.protobuf.Empty
+ nil, // 22: memos.api.v1.UserStats.TagCountEntry
+ (*UserStats_MemoTypeStats)(nil), // 23: memos.api.v1.UserStats.MemoTypeStats
+ (State)(0), // 24: memos.api.v1.State
+ (*timestamppb.Timestamp)(nil), // 25: google.protobuf.Timestamp
+ (*httpbody.HttpBody)(nil), // 26: google.api.HttpBody
+ (*fieldmaskpb.FieldMask)(nil), // 27: google.protobuf.FieldMask
+ (*emptypb.Empty)(nil), // 28: google.protobuf.Empty
}
var file_api_v1_user_service_proto_depIdxs = []int32{
0, // 0: memos.api.v1.User.role:type_name -> memos.api.v1.User.Role
- 30, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State
- 31, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp
- 31, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp
+ 24, // 1: memos.api.v1.User.state:type_name -> memos.api.v1.State
+ 25, // 2: memos.api.v1.User.create_time:type_name -> google.protobuf.Timestamp
+ 25, // 3: memos.api.v1.User.update_time:type_name -> google.protobuf.Timestamp
1, // 4: memos.api.v1.ListUsersResponse.users:type_name -> memos.api.v1.User
- 32, // 5: memos.api.v1.GetUserAvatarBinaryRequest.http_body:type_name -> google.api.HttpBody
+ 26, // 5: memos.api.v1.GetUserAvatarBinaryRequest.http_body:type_name -> google.api.HttpBody
1, // 6: memos.api.v1.CreateUserRequest.user:type_name -> memos.api.v1.User
1, // 7: memos.api.v1.UpdateUserRequest.user:type_name -> memos.api.v1.User
- 33, // 8: memos.api.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask
- 31, // 9: memos.api.v1.UserStats.memo_display_timestamps:type_name -> google.protobuf.Timestamp
- 29, // 10: memos.api.v1.UserStats.memo_type_stats:type_name -> memos.api.v1.UserStats.MemoTypeStats
- 28, // 11: memos.api.v1.UserStats.tag_count:type_name -> memos.api.v1.UserStats.TagCountEntry
+ 27, // 8: memos.api.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 25, // 9: memos.api.v1.UserStats.memo_display_timestamps:type_name -> google.protobuf.Timestamp
+ 23, // 10: memos.api.v1.UserStats.memo_type_stats:type_name -> memos.api.v1.UserStats.MemoTypeStats
+ 22, // 11: memos.api.v1.UserStats.tag_count:type_name -> memos.api.v1.UserStats.TagCountEntry
10, // 12: memos.api.v1.ListAllUserStatsResponse.user_stats:type_name -> memos.api.v1.UserStats
14, // 13: memos.api.v1.UpdateUserSettingRequest.setting:type_name -> memos.api.v1.UserSetting
- 33, // 14: memos.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
- 31, // 15: memos.api.v1.UserAccessToken.issued_at:type_name -> google.protobuf.Timestamp
- 31, // 16: memos.api.v1.UserAccessToken.expires_at:type_name -> google.protobuf.Timestamp
+ 27, // 14: memos.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 25, // 15: memos.api.v1.UserAccessToken.issued_at:type_name -> google.protobuf.Timestamp
+ 25, // 16: memos.api.v1.UserAccessToken.expires_at:type_name -> google.protobuf.Timestamp
17, // 17: memos.api.v1.ListUserAccessTokensResponse.access_tokens:type_name -> memos.api.v1.UserAccessToken
- 31, // 18: memos.api.v1.CreateUserAccessTokenRequest.expires_at:type_name -> google.protobuf.Timestamp
- 22, // 19: memos.api.v1.ListShortcutsResponse.shortcuts:type_name -> memos.api.v1.Shortcut
- 22, // 20: memos.api.v1.CreateShortcutRequest.shortcut:type_name -> memos.api.v1.Shortcut
- 22, // 21: memos.api.v1.UpdateShortcutRequest.shortcut:type_name -> memos.api.v1.Shortcut
- 33, // 22: memos.api.v1.UpdateShortcutRequest.update_mask:type_name -> google.protobuf.FieldMask
- 2, // 23: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest
- 4, // 24: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest
- 5, // 25: memos.api.v1.UserService.GetUserByUsername:input_type -> memos.api.v1.GetUserByUsernameRequest
- 6, // 26: memos.api.v1.UserService.GetUserAvatarBinary:input_type -> memos.api.v1.GetUserAvatarBinaryRequest
- 7, // 27: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest
- 8, // 28: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest
- 9, // 29: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest
- 11, // 30: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest
- 13, // 31: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest
- 15, // 32: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest
- 16, // 33: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest
- 18, // 34: memos.api.v1.UserService.ListUserAccessTokens:input_type -> memos.api.v1.ListUserAccessTokensRequest
- 20, // 35: memos.api.v1.UserService.CreateUserAccessToken:input_type -> memos.api.v1.CreateUserAccessTokenRequest
- 21, // 36: memos.api.v1.UserService.DeleteUserAccessToken:input_type -> memos.api.v1.DeleteUserAccessTokenRequest
- 23, // 37: memos.api.v1.UserService.ListShortcuts:input_type -> memos.api.v1.ListShortcutsRequest
- 25, // 38: memos.api.v1.UserService.CreateShortcut:input_type -> memos.api.v1.CreateShortcutRequest
- 26, // 39: memos.api.v1.UserService.UpdateShortcut:input_type -> memos.api.v1.UpdateShortcutRequest
- 27, // 40: memos.api.v1.UserService.DeleteShortcut:input_type -> memos.api.v1.DeleteShortcutRequest
- 3, // 41: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse
- 1, // 42: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User
- 1, // 43: memos.api.v1.UserService.GetUserByUsername:output_type -> memos.api.v1.User
- 32, // 44: memos.api.v1.UserService.GetUserAvatarBinary:output_type -> google.api.HttpBody
- 1, // 45: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User
- 1, // 46: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User
- 34, // 47: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty
- 12, // 48: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse
- 10, // 49: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats
- 14, // 50: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting
- 14, // 51: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting
- 19, // 52: memos.api.v1.UserService.ListUserAccessTokens:output_type -> memos.api.v1.ListUserAccessTokensResponse
- 17, // 53: memos.api.v1.UserService.CreateUserAccessToken:output_type -> memos.api.v1.UserAccessToken
- 34, // 54: memos.api.v1.UserService.DeleteUserAccessToken:output_type -> google.protobuf.Empty
- 24, // 55: memos.api.v1.UserService.ListShortcuts:output_type -> memos.api.v1.ListShortcutsResponse
- 22, // 56: memos.api.v1.UserService.CreateShortcut:output_type -> memos.api.v1.Shortcut
- 22, // 57: memos.api.v1.UserService.UpdateShortcut:output_type -> memos.api.v1.Shortcut
- 34, // 58: memos.api.v1.UserService.DeleteShortcut:output_type -> google.protobuf.Empty
- 41, // [41:59] is the sub-list for method output_type
- 23, // [23:41] is the sub-list for method input_type
- 23, // [23:23] is the sub-list for extension type_name
- 23, // [23:23] is the sub-list for extension extendee
- 0, // [0:23] is the sub-list for field type_name
+ 25, // 18: memos.api.v1.CreateUserAccessTokenRequest.expires_at:type_name -> google.protobuf.Timestamp
+ 2, // 19: memos.api.v1.UserService.ListUsers:input_type -> memos.api.v1.ListUsersRequest
+ 4, // 20: memos.api.v1.UserService.GetUser:input_type -> memos.api.v1.GetUserRequest
+ 5, // 21: memos.api.v1.UserService.GetUserByUsername:input_type -> memos.api.v1.GetUserByUsernameRequest
+ 6, // 22: memos.api.v1.UserService.GetUserAvatarBinary:input_type -> memos.api.v1.GetUserAvatarBinaryRequest
+ 7, // 23: memos.api.v1.UserService.CreateUser:input_type -> memos.api.v1.CreateUserRequest
+ 8, // 24: memos.api.v1.UserService.UpdateUser:input_type -> memos.api.v1.UpdateUserRequest
+ 9, // 25: memos.api.v1.UserService.DeleteUser:input_type -> memos.api.v1.DeleteUserRequest
+ 11, // 26: memos.api.v1.UserService.ListAllUserStats:input_type -> memos.api.v1.ListAllUserStatsRequest
+ 13, // 27: memos.api.v1.UserService.GetUserStats:input_type -> memos.api.v1.GetUserStatsRequest
+ 15, // 28: memos.api.v1.UserService.GetUserSetting:input_type -> memos.api.v1.GetUserSettingRequest
+ 16, // 29: memos.api.v1.UserService.UpdateUserSetting:input_type -> memos.api.v1.UpdateUserSettingRequest
+ 18, // 30: memos.api.v1.UserService.ListUserAccessTokens:input_type -> memos.api.v1.ListUserAccessTokensRequest
+ 20, // 31: memos.api.v1.UserService.CreateUserAccessToken:input_type -> memos.api.v1.CreateUserAccessTokenRequest
+ 21, // 32: memos.api.v1.UserService.DeleteUserAccessToken:input_type -> memos.api.v1.DeleteUserAccessTokenRequest
+ 3, // 33: memos.api.v1.UserService.ListUsers:output_type -> memos.api.v1.ListUsersResponse
+ 1, // 34: memos.api.v1.UserService.GetUser:output_type -> memos.api.v1.User
+ 1, // 35: memos.api.v1.UserService.GetUserByUsername:output_type -> memos.api.v1.User
+ 26, // 36: memos.api.v1.UserService.GetUserAvatarBinary:output_type -> google.api.HttpBody
+ 1, // 37: memos.api.v1.UserService.CreateUser:output_type -> memos.api.v1.User
+ 1, // 38: memos.api.v1.UserService.UpdateUser:output_type -> memos.api.v1.User
+ 28, // 39: memos.api.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty
+ 12, // 40: memos.api.v1.UserService.ListAllUserStats:output_type -> memos.api.v1.ListAllUserStatsResponse
+ 10, // 41: memos.api.v1.UserService.GetUserStats:output_type -> memos.api.v1.UserStats
+ 14, // 42: memos.api.v1.UserService.GetUserSetting:output_type -> memos.api.v1.UserSetting
+ 14, // 43: memos.api.v1.UserService.UpdateUserSetting:output_type -> memos.api.v1.UserSetting
+ 19, // 44: memos.api.v1.UserService.ListUserAccessTokens:output_type -> memos.api.v1.ListUserAccessTokensResponse
+ 17, // 45: memos.api.v1.UserService.CreateUserAccessToken:output_type -> memos.api.v1.UserAccessToken
+ 28, // 46: memos.api.v1.UserService.DeleteUserAccessToken:output_type -> google.protobuf.Empty
+ 33, // [33:47] is the sub-list for method output_type
+ 19, // [19:33] is the sub-list for method input_type
+ 19, // [19:19] is the sub-list for extension type_name
+ 19, // [19:19] is the sub-list for extension extendee
+ 0, // [0:19] is the sub-list for field type_name
}
func init() { file_api_v1_user_service_proto_init() }
@@ -1895,7 +1528,7 @@ func file_api_v1_user_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_v1_user_service_proto_rawDesc), len(file_api_v1_user_service_proto_rawDesc)),
NumEnums: 1,
- NumMessages: 29,
+ NumMessages: 23,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/gen/api/v1/user_service.pb.gw.go b/proto/gen/api/v1/user_service.pb.gw.go
index 1ac6e81d5..0b14ae43d 100644
--- a/proto/gen/api/v1/user_service.pb.gw.go
+++ b/proto/gen/api/v1/user_service.pb.gw.go
@@ -617,246 +617,6 @@ func local_request_UserService_DeleteUserAccessToken_0(ctx context.Context, mars
return msg, metadata, err
}
-func request_UserService_ListShortcuts_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq ListShortcutsRequest
- metadata runtime.ServerMetadata
- err error
- )
- io.Copy(io.Discard, req.Body)
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- msg, err := client.ListShortcuts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_UserService_ListShortcuts_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq ListShortcutsRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- msg, err := server.ListShortcuts(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_UserService_CreateShortcut_0 = &utilities.DoubleArray{Encoding: map[string]int{"shortcut": 0, "parent": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
-
-func request_UserService_CreateShortcut_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq CreateShortcutRequest
- metadata runtime.ServerMetadata
- err error
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Shortcut); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_CreateShortcut_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.CreateShortcut(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_UserService_CreateShortcut_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq CreateShortcutRequest
- metadata runtime.ServerMetadata
- err error
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Shortcut); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_CreateShortcut_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.CreateShortcut(ctx, &protoReq)
- return msg, metadata, err
-}
-
-var filter_UserService_UpdateShortcut_0 = &utilities.DoubleArray{Encoding: map[string]int{"shortcut": 0, "parent": 1, "id": 2}, Base: []int{1, 2, 3, 1, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 3}}
-
-func request_UserService_UpdateShortcut_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateShortcutRequest
- metadata runtime.ServerMetadata
- err error
- )
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Shortcut); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Shortcut); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- val, ok = pathParams["shortcut.id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shortcut.id")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "shortcut.id", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shortcut.id", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateShortcut_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.UpdateShortcut(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_UserService_UpdateShortcut_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq UpdateShortcutRequest
- metadata runtime.ServerMetadata
- err error
- )
- newReader, berr := utilities.IOReaderFactory(req.Body)
- if berr != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
- }
- if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Shortcut); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
- if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Shortcut); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- } else {
- protoReq.UpdateMask = fieldMask
- }
- }
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- val, ok = pathParams["shortcut.id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "shortcut.id")
- }
- err = runtime.PopulateFieldFromPath(&protoReq, "shortcut.id", val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "shortcut.id", err)
- }
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_UserService_UpdateShortcut_0); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.UpdateShortcut(ctx, &protoReq)
- return msg, metadata, err
-}
-
-func request_UserService_DeleteShortcut_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq DeleteShortcutRequest
- metadata runtime.ServerMetadata
- err error
- )
- io.Copy(io.Discard, req.Body)
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- val, ok = pathParams["id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
- }
- protoReq.Id, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
- }
- msg, err := client.DeleteShortcut(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_UserService_DeleteShortcut_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq DeleteShortcutRequest
- metadata runtime.ServerMetadata
- err error
- )
- val, ok := pathParams["parent"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
- }
- protoReq.Parent, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
- }
- val, ok = pathParams["id"]
- if !ok {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
- }
- protoReq.Id, err = runtime.String(val)
- if err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
- }
- msg, err := server.DeleteShortcut(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.
@@ -1143,86 +903,6 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_DeleteUserAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodGet, pattern_UserService_ListShortcuts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/ListShortcuts", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_UserService_ListShortcuts_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_ListShortcuts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_UserService_CreateShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/CreateShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_UserService_CreateShortcut_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_CreateShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPatch, pattern_UserService_UpdateShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts/{shortcut.id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_UserService_UpdateShortcut_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_UpdateShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodDelete, pattern_UserService_DeleteShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- var stream runtime.ServerTransportStream
- ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts/{id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_UserService_DeleteShortcut_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_DeleteShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
return nil
}
@@ -1501,74 +1181,6 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_DeleteUserAccessToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodGet, pattern_UserService_ListShortcuts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/ListShortcuts", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_UserService_ListShortcuts_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_ListShortcuts_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPost, pattern_UserService_CreateShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/CreateShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_UserService_CreateShortcut_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_CreateShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodPatch, pattern_UserService_UpdateShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/UpdateShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts/{shortcut.id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_UserService_UpdateShortcut_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_UpdateShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
- mux.Handle(http.MethodDelete, pattern_UserService_DeleteShortcut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
- ctx, cancel := context.WithCancel(req.Context())
- defer cancel()
- inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.UserService/DeleteShortcut", runtime.WithHTTPPathPattern("/api/v1/{parent=users/*}/shortcuts/{id}"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_UserService_DeleteShortcut_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_DeleteShortcut_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
return nil
}
@@ -1587,10 +1199,6 @@ var (
pattern_UserService_ListUserAccessTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "name", "access_tokens"}, ""))
pattern_UserService_CreateUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "name", "access_tokens"}, ""))
pattern_UserService_DeleteUserAccessToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v1", "users", "name", "access_tokens", "access_token"}, ""))
- pattern_UserService_ListShortcuts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "shortcuts"}, ""))
- pattern_UserService_CreateShortcut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4}, []string{"api", "v1", "users", "parent", "shortcuts"}, ""))
- pattern_UserService_UpdateShortcut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v1", "users", "parent", "shortcuts", "shortcut.id"}, ""))
- pattern_UserService_DeleteShortcut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v1", "users", "parent", "shortcuts", "id"}, ""))
)
var (
@@ -1608,8 +1216,4 @@ var (
forward_UserService_ListUserAccessTokens_0 = runtime.ForwardResponseMessage
forward_UserService_CreateUserAccessToken_0 = runtime.ForwardResponseMessage
forward_UserService_DeleteUserAccessToken_0 = runtime.ForwardResponseMessage
- forward_UserService_ListShortcuts_0 = runtime.ForwardResponseMessage
- forward_UserService_CreateShortcut_0 = runtime.ForwardResponseMessage
- forward_UserService_UpdateShortcut_0 = runtime.ForwardResponseMessage
- forward_UserService_DeleteShortcut_0 = runtime.ForwardResponseMessage
)
diff --git a/proto/gen/api/v1/user_service_grpc.pb.go b/proto/gen/api/v1/user_service_grpc.pb.go
index 622c7bda7..72fe8d553 100644
--- a/proto/gen/api/v1/user_service_grpc.pb.go
+++ b/proto/gen/api/v1/user_service_grpc.pb.go
@@ -35,10 +35,6 @@ const (
UserService_ListUserAccessTokens_FullMethodName = "/memos.api.v1.UserService/ListUserAccessTokens"
UserService_CreateUserAccessToken_FullMethodName = "/memos.api.v1.UserService/CreateUserAccessToken"
UserService_DeleteUserAccessToken_FullMethodName = "/memos.api.v1.UserService/DeleteUserAccessToken"
- UserService_ListShortcuts_FullMethodName = "/memos.api.v1.UserService/ListShortcuts"
- UserService_CreateShortcut_FullMethodName = "/memos.api.v1.UserService/CreateShortcut"
- UserService_UpdateShortcut_FullMethodName = "/memos.api.v1.UserService/UpdateShortcut"
- UserService_DeleteShortcut_FullMethodName = "/memos.api.v1.UserService/DeleteShortcut"
)
// UserServiceClient is the client API for UserService service.
@@ -73,14 +69,6 @@ type UserServiceClient interface {
CreateUserAccessToken(ctx context.Context, in *CreateUserAccessTokenRequest, opts ...grpc.CallOption) (*UserAccessToken, error)
// DeleteUserAccessToken deletes an access token for a user.
DeleteUserAccessToken(ctx context.Context, in *DeleteUserAccessTokenRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
- // ListShortcuts returns a list of shortcuts for a user.
- ListShortcuts(ctx context.Context, in *ListShortcutsRequest, opts ...grpc.CallOption) (*ListShortcutsResponse, error)
- // CreateShortcut creates a new shortcut for a user.
- CreateShortcut(ctx context.Context, in *CreateShortcutRequest, opts ...grpc.CallOption) (*Shortcut, error)
- // UpdateShortcut updates a shortcut for a user.
- UpdateShortcut(ctx context.Context, in *UpdateShortcutRequest, opts ...grpc.CallOption) (*Shortcut, error)
- // DeleteShortcut deletes a shortcut for a user.
- DeleteShortcut(ctx context.Context, in *DeleteShortcutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type userServiceClient struct {
@@ -231,46 +219,6 @@ func (c *userServiceClient) DeleteUserAccessToken(ctx context.Context, in *Delet
return out, nil
}
-func (c *userServiceClient) ListShortcuts(ctx context.Context, in *ListShortcutsRequest, opts ...grpc.CallOption) (*ListShortcutsResponse, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(ListShortcutsResponse)
- err := c.cc.Invoke(ctx, UserService_ListShortcuts_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *userServiceClient) CreateShortcut(ctx context.Context, in *CreateShortcutRequest, opts ...grpc.CallOption) (*Shortcut, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Shortcut)
- err := c.cc.Invoke(ctx, UserService_CreateShortcut_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *userServiceClient) UpdateShortcut(ctx context.Context, in *UpdateShortcutRequest, opts ...grpc.CallOption) (*Shortcut, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(Shortcut)
- err := c.cc.Invoke(ctx, UserService_UpdateShortcut_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *userServiceClient) DeleteShortcut(ctx context.Context, in *DeleteShortcutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(emptypb.Empty)
- err := c.cc.Invoke(ctx, UserService_DeleteShortcut_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
// UserServiceServer is the server API for UserService service.
// All implementations must embed UnimplementedUserServiceServer
// for forward compatibility.
@@ -303,14 +251,6 @@ type UserServiceServer interface {
CreateUserAccessToken(context.Context, *CreateUserAccessTokenRequest) (*UserAccessToken, error)
// DeleteUserAccessToken deletes an access token for a user.
DeleteUserAccessToken(context.Context, *DeleteUserAccessTokenRequest) (*emptypb.Empty, error)
- // ListShortcuts returns a list of shortcuts for a user.
- ListShortcuts(context.Context, *ListShortcutsRequest) (*ListShortcutsResponse, error)
- // CreateShortcut creates a new shortcut for a user.
- CreateShortcut(context.Context, *CreateShortcutRequest) (*Shortcut, error)
- // UpdateShortcut updates a shortcut for a user.
- UpdateShortcut(context.Context, *UpdateShortcutRequest) (*Shortcut, error)
- // DeleteShortcut deletes a shortcut for a user.
- DeleteShortcut(context.Context, *DeleteShortcutRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedUserServiceServer()
}
@@ -363,18 +303,6 @@ func (UnimplementedUserServiceServer) CreateUserAccessToken(context.Context, *Cr
func (UnimplementedUserServiceServer) DeleteUserAccessToken(context.Context, *DeleteUserAccessTokenRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteUserAccessToken not implemented")
}
-func (UnimplementedUserServiceServer) ListShortcuts(context.Context, *ListShortcutsRequest) (*ListShortcutsResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ListShortcuts not implemented")
-}
-func (UnimplementedUserServiceServer) CreateShortcut(context.Context, *CreateShortcutRequest) (*Shortcut, error) {
- return nil, status.Errorf(codes.Unimplemented, "method CreateShortcut not implemented")
-}
-func (UnimplementedUserServiceServer) UpdateShortcut(context.Context, *UpdateShortcutRequest) (*Shortcut, error) {
- return nil, status.Errorf(codes.Unimplemented, "method UpdateShortcut not implemented")
-}
-func (UnimplementedUserServiceServer) DeleteShortcut(context.Context, *DeleteShortcutRequest) (*emptypb.Empty, error) {
- return nil, status.Errorf(codes.Unimplemented, "method DeleteShortcut not implemented")
-}
func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}
func (UnimplementedUserServiceServer) testEmbeddedByValue() {}
@@ -648,78 +576,6 @@ func _UserService_DeleteUserAccessToken_Handler(srv interface{}, ctx context.Con
return interceptor(ctx, in, info, handler)
}
-func _UserService_ListShortcuts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(ListShortcutsRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(UserServiceServer).ListShortcuts(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: UserService_ListShortcuts_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(UserServiceServer).ListShortcuts(ctx, req.(*ListShortcutsRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _UserService_CreateShortcut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CreateShortcutRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(UserServiceServer).CreateShortcut(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: UserService_CreateShortcut_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(UserServiceServer).CreateShortcut(ctx, req.(*CreateShortcutRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _UserService_UpdateShortcut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(UpdateShortcutRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(UserServiceServer).UpdateShortcut(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: UserService_UpdateShortcut_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(UserServiceServer).UpdateShortcut(ctx, req.(*UpdateShortcutRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _UserService_DeleteShortcut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeleteShortcutRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(UserServiceServer).DeleteShortcut(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: UserService_DeleteShortcut_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(UserServiceServer).DeleteShortcut(ctx, req.(*DeleteShortcutRequest))
- }
- 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)
@@ -783,22 +639,6 @@ var UserService_ServiceDesc = grpc.ServiceDesc{
MethodName: "DeleteUserAccessToken",
Handler: _UserService_DeleteUserAccessToken_Handler,
},
- {
- MethodName: "ListShortcuts",
- Handler: _UserService_ListShortcuts_Handler,
- },
- {
- MethodName: "CreateShortcut",
- Handler: _UserService_CreateShortcut_Handler,
- },
- {
- MethodName: "UpdateShortcut",
- Handler: _UserService_UpdateShortcut_Handler,
- },
- {
- MethodName: "DeleteShortcut",
- Handler: _UserService_DeleteShortcut_Handler,
- },
},
Streams: []grpc.StreamDesc{},
Metadata: "api/v1/user_service.proto",
diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml
index 49e5ec070..d39efe174 100644
--- a/proto/gen/apidocs.swagger.yaml
+++ b/proto/gen/apidocs.swagger.yaml
@@ -11,6 +11,7 @@ tags:
- name: MarkdownService
- name: ResourceService
- name: MemoService
+ - name: ShortcutService
- name: WebhookService
- name: WorkspaceService
- name: WorkspaceSettingService
@@ -1520,7 +1521,7 @@ paths:
/api/v1/{parent}/shortcuts:
get:
summary: ListShortcuts returns a list of shortcuts for a user.
- operationId: UserService_ListShortcuts
+ operationId: ShortcutService_ListShortcuts
responses:
"200":
description: A successful response.
@@ -1538,10 +1539,10 @@ paths:
type: string
pattern: users/[^/]+
tags:
- - UserService
+ - ShortcutService
post:
summary: CreateShortcut creates a new shortcut for a user.
- operationId: UserService_CreateShortcut
+ operationId: ShortcutService_CreateShortcut
responses:
"200":
description: A successful response.
@@ -1568,11 +1569,11 @@ paths:
required: false
type: boolean
tags:
- - UserService
+ - ShortcutService
/api/v1/{parent}/shortcuts/{id}:
delete:
summary: DeleteShortcut deletes a shortcut for a user.
- operationId: UserService_DeleteShortcut
+ operationId: ShortcutService_DeleteShortcut
responses:
"200":
description: A successful response.
@@ -1596,11 +1597,11 @@ paths:
required: true
type: string
tags:
- - UserService
+ - ShortcutService
/api/v1/{parent}/shortcuts/{shortcut.id}:
patch:
summary: UpdateShortcut updates a shortcut for a user.
- operationId: UserService_UpdateShortcut
+ operationId: ShortcutService_UpdateShortcut
responses:
"200":
description: A successful response.
@@ -1632,7 +1633,7 @@ paths:
filter:
type: string
tags:
- - UserService
+ - ShortcutService
/api/v1/{parent}/tags/{tag}:
delete:
summary: DeleteMemoTag deletes a tag for a memo.
diff --git a/server/router/api/v1/user_service_shortcuts.go b/server/router/api/v1/shortcuts_service.go
similarity index 100%
rename from server/router/api/v1/user_service_shortcuts.go
rename to server/router/api/v1/shortcuts_service.go
diff --git a/web/src/components/CreateShortcutDialog.tsx b/web/src/components/CreateShortcutDialog.tsx
index 9966c21b5..945695ad6 100644
--- a/web/src/components/CreateShortcutDialog.tsx
+++ b/web/src/components/CreateShortcutDialog.tsx
@@ -2,11 +2,11 @@ import { Input, Textarea, Button } from "@usememos/mui";
import { XIcon } from "lucide-react";
import React, { useState } from "react";
import { toast } from "react-hot-toast";
-import { userServiceClient } from "@/grpcweb";
+import { shortcutServiceClient } from "@/grpcweb";
import useCurrentUser from "@/hooks/useCurrentUser";
import useLoading from "@/hooks/useLoading";
import { userStore } from "@/store/v2";
-import { Shortcut } from "@/types/proto/api/v1/user_service";
+import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { useTranslate } from "@/utils/i18n";
import { generateUUID } from "@/utils/uuid";
import { generateDialog } from "./Dialog";
@@ -19,7 +19,11 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
const { destroy } = props;
const t = useTranslate();
const user = useCurrentUser();
- const [shortcut, setShortcut] = useState(Shortcut.fromPartial({ ...props.shortcut }));
+ const [shortcut, setShortcut] = useState<Shortcut>({
+ id: props.shortcut?.id || "",
+ title: props.shortcut?.title || "",
+ filter: props.shortcut?.filter || "",
+ });
const requestState = useLoading(false);
const isCreating = !props.shortcut;
@@ -39,7 +43,7 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
try {
if (isCreating) {
- await userServiceClient.createShortcut({
+ await shortcutServiceClient.createShortcut({
parent: user.name,
shortcut: {
...shortcut,
@@ -48,7 +52,7 @@ const CreateShortcutDialog: React.FC<Props> = (props: Props) => {
});
toast.success("Create shortcut successfully");
} else {
- await userServiceClient.updateShortcut({ parent: user.name, shortcut, updateMask: ["title", "filter"] });
+ await shortcutServiceClient.updateShortcut({ parent: user.name, shortcut, updateMask: ["title", "filter"] });
toast.success("Update shortcut successfully");
}
// Refresh shortcuts.
diff --git a/web/src/components/HomeSidebar/ShortcutsSection.tsx b/web/src/components/HomeSidebar/ShortcutsSection.tsx
index f7e6a87cf..f943d266b 100644
--- a/web/src/components/HomeSidebar/ShortcutsSection.tsx
+++ b/web/src/components/HomeSidebar/ShortcutsSection.tsx
@@ -1,12 +1,12 @@
import { Dropdown, Menu, MenuButton, MenuItem, Tooltip } from "@mui/joy";
import { Edit3Icon, MoreVerticalIcon, TrashIcon, PlusIcon } from "lucide-react";
import { observer } from "mobx-react-lite";
-import { userServiceClient } from "@/grpcweb";
+import { shortcutServiceClient } from "@/grpcweb";
import useAsyncEffect from "@/hooks/useAsyncEffect";
import useCurrentUser from "@/hooks/useCurrentUser";
import { useMemoFilterStore } from "@/store/v1";
import { userStore } from "@/store/v2";
-import { Shortcut } from "@/types/proto/api/v1/user_service";
+import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
import { cn } from "@/utils";
import { useTranslate } from "@/utils/i18n";
import showCreateShortcutDialog from "../CreateShortcutDialog";
@@ -26,7 +26,7 @@ const ShortcutsSection = observer(() => {
const handleDeleteShortcut = async (shortcut: Shortcut) => {
const confirmed = window.confirm("Are you sure you want to delete this shortcut?");
if (confirmed) {
- await userServiceClient.deleteShortcut({ parent: user.name, id: shortcut.id });
+ await shortcutServiceClient.deleteShortcut({ parent: user.name, id: shortcut.id });
await userStore.fetchShortcuts();
}
};
diff --git a/web/src/grpcweb.ts b/web/src/grpcweb.ts
index abecc81cb..88021dd87 100644
--- a/web/src/grpcweb.ts
+++ b/web/src/grpcweb.ts
@@ -6,6 +6,7 @@ import { InboxServiceDefinition } from "./types/proto/api/v1/inbox_service";
import { MarkdownServiceDefinition } from "./types/proto/api/v1/markdown_service";
import { MemoServiceDefinition } from "./types/proto/api/v1/memo_service";
import { ResourceServiceDefinition } from "./types/proto/api/v1/resource_service";
+import { ShortcutServiceDefinition } from "./types/proto/api/v1/shortcut_service";
import { UserServiceDefinition } from "./types/proto/api/v1/user_service";
import { WebhookServiceDefinition } from "./types/proto/api/v1/webhook_service";
import { WorkspaceServiceDefinition } from "./types/proto/api/v1/workspace_service";
@@ -32,6 +33,8 @@ export const memoServiceClient = clientFactory.create(MemoServiceDefinition, cha
export const resourceServiceClient = clientFactory.create(ResourceServiceDefinition, channel);
+export const shortcutServiceClient = clientFactory.create(ShortcutServiceDefinition, channel);
+
export const inboxServiceClient = clientFactory.create(InboxServiceDefinition, channel);
export const activityServiceClient = clientFactory.create(ActivityServiceDefinition, channel);
diff --git a/web/src/store/v2/user.ts b/web/src/store/v2/user.ts
index 29c356260..90e2de82d 100644
--- a/web/src/store/v2/user.ts
+++ b/web/src/store/v2/user.ts
@@ -1,8 +1,9 @@
import { uniqueId } from "lodash-es";
import { makeAutoObservable } from "mobx";
-import { authServiceClient, inboxServiceClient, userServiceClient } from "@/grpcweb";
+import { authServiceClient, inboxServiceClient, shortcutServiceClient, userServiceClient } from "@/grpcweb";
import { Inbox } from "@/types/proto/api/v1/inbox_service";
-import { Shortcut, User, UserSetting, UserStats } from "@/types/proto/api/v1/user_service";
+import { Shortcut } from "@/types/proto/api/v1/shortcut_service";
+import { User, UserSetting, UserStats } from "@/types/proto/api/v1/user_service";
import { findNearestMatchedLanguage } from "@/utils/i18n";
import workspaceStore from "./workspace";
@@ -138,7 +139,7 @@ const userStore = (() => {
return;
}
- const { shortcuts } = await userServiceClient.listShortcuts({ parent: state.currentUser });
+ const { shortcuts } = await shortcutServiceClient.listShortcuts({ parent: state.currentUser });
state.setPartial({
shortcuts,
});
diff --git a/web/src/types/proto/api/v1/shortcut_service.ts b/web/src/types/proto/api/v1/shortcut_service.ts
new file mode 100644
index 000000000..4859c6097
--- /dev/null
+++ b/web/src/types/proto/api/v1/shortcut_service.ts
@@ -0,0 +1,721 @@
+// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
+// versions:
+// protoc-gen-ts_proto v2.6.1
+// protoc unknown
+// source: api/v1/shortcut_service.proto
+
+/* eslint-disable */
+import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
+import { Empty } from "../../google/protobuf/empty";
+import { FieldMask } from "../../google/protobuf/field_mask";
+
+export const protobufPackage = "memos.api.v1";
+
+export interface Shortcut {
+ id: string;
+ title: string;
+ filter: string;
+}
+
+export interface ListShortcutsRequest {
+ /** The name of the user. */
+ parent: string;
+}
+
+export interface ListShortcutsResponse {
+ shortcuts: Shortcut[];
+}
+
+export interface CreateShortcutRequest {
+ /** The name of the user. */
+ parent: string;
+ shortcut?: Shortcut | undefined;
+ validateOnly: boolean;
+}
+
+export interface UpdateShortcutRequest {
+ /** The name of the user. */
+ parent: string;
+ shortcut?: Shortcut | undefined;
+ updateMask?: string[] | undefined;
+}
+
+export interface DeleteShortcutRequest {
+ /** The name of the user. */
+ parent: string;
+ /** The id of the shortcut. */
+ id: string;
+}
+
+function createBaseShortcut(): Shortcut {
+ return { id: "", title: "", filter: "" };
+}
+
+export const Shortcut: MessageFns<Shortcut> = {
+ encode(message: Shortcut, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.id !== "") {
+ writer.uint32(10).string(message.id);
+ }
+ if (message.title !== "") {
+ writer.uint32(18).string(message.title);
+ }
+ if (message.filter !== "") {
+ writer.uint32(26).string(message.filter);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): Shortcut {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseShortcut();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.id = reader.string();
+ continue;
+ }
+ case 2: {
+ if (tag !== 18) {
+ break;
+ }
+
+ message.title = reader.string();
+ continue;
+ }
+ case 3: {
+ if (tag !== 26) {
+ break;
+ }
+
+ message.filter = reader.string();
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<Shortcut>): Shortcut {
+ return Shortcut.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<Shortcut>): Shortcut {
+ const message = createBaseShortcut();
+ message.id = object.id ?? "";
+ message.title = object.title ?? "";
+ message.filter = object.filter ?? "";
+ return message;
+ },
+};
+
+function createBaseListShortcutsRequest(): ListShortcutsRequest {
+ return { parent: "" };
+}
+
+export const ListShortcutsRequest: MessageFns<ListShortcutsRequest> = {
+ encode(message: ListShortcutsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.parent !== "") {
+ writer.uint32(10).string(message.parent);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): ListShortcutsRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListShortcutsRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.parent = reader.string();
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<ListShortcutsRequest>): ListShortcutsRequest {
+ return ListShortcutsRequest.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<ListShortcutsRequest>): ListShortcutsRequest {
+ const message = createBaseListShortcutsRequest();
+ message.parent = object.parent ?? "";
+ return message;
+ },
+};
+
+function createBaseListShortcutsResponse(): ListShortcutsResponse {
+ return { shortcuts: [] };
+}
+
+export const ListShortcutsResponse: MessageFns<ListShortcutsResponse> = {
+ encode(message: ListShortcutsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ for (const v of message.shortcuts) {
+ Shortcut.encode(v!, writer.uint32(10).fork()).join();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): ListShortcutsResponse {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListShortcutsResponse();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.shortcuts.push(Shortcut.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<ListShortcutsResponse>): ListShortcutsResponse {
+ return ListShortcutsResponse.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<ListShortcutsResponse>): ListShortcutsResponse {
+ const message = createBaseListShortcutsResponse();
+ message.shortcuts = object.shortcuts?.map((e) => Shortcut.fromPartial(e)) || [];
+ return message;
+ },
+};
+
+function createBaseCreateShortcutRequest(): CreateShortcutRequest {
+ return { parent: "", shortcut: undefined, validateOnly: false };
+}
+
+export const CreateShortcutRequest: MessageFns<CreateShortcutRequest> = {
+ encode(message: CreateShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.parent !== "") {
+ writer.uint32(10).string(message.parent);
+ }
+ if (message.shortcut !== undefined) {
+ Shortcut.encode(message.shortcut, writer.uint32(18).fork()).join();
+ }
+ if (message.validateOnly !== false) {
+ writer.uint32(24).bool(message.validateOnly);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateShortcutRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseCreateShortcutRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.parent = reader.string();
+ continue;
+ }
+ case 2: {
+ if (tag !== 18) {
+ break;
+ }
+
+ message.shortcut = Shortcut.decode(reader, reader.uint32());
+ continue;
+ }
+ case 3: {
+ if (tag !== 24) {
+ break;
+ }
+
+ message.validateOnly = reader.bool();
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<CreateShortcutRequest>): CreateShortcutRequest {
+ return CreateShortcutRequest.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<CreateShortcutRequest>): CreateShortcutRequest {
+ const message = createBaseCreateShortcutRequest();
+ message.parent = object.parent ?? "";
+ message.shortcut = (object.shortcut !== undefined && object.shortcut !== null)
+ ? Shortcut.fromPartial(object.shortcut)
+ : undefined;
+ message.validateOnly = object.validateOnly ?? false;
+ return message;
+ },
+};
+
+function createBaseUpdateShortcutRequest(): UpdateShortcutRequest {
+ return { parent: "", shortcut: undefined, updateMask: undefined };
+}
+
+export const UpdateShortcutRequest: MessageFns<UpdateShortcutRequest> = {
+ encode(message: UpdateShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.parent !== "") {
+ writer.uint32(10).string(message.parent);
+ }
+ if (message.shortcut !== undefined) {
+ Shortcut.encode(message.shortcut, writer.uint32(18).fork()).join();
+ }
+ if (message.updateMask !== undefined) {
+ FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(26).fork()).join();
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateShortcutRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseUpdateShortcutRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.parent = reader.string();
+ continue;
+ }
+ case 2: {
+ if (tag !== 18) {
+ break;
+ }
+
+ message.shortcut = Shortcut.decode(reader, reader.uint32());
+ continue;
+ }
+ case 3: {
+ if (tag !== 26) {
+ break;
+ }
+
+ message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<UpdateShortcutRequest>): UpdateShortcutRequest {
+ return UpdateShortcutRequest.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<UpdateShortcutRequest>): UpdateShortcutRequest {
+ const message = createBaseUpdateShortcutRequest();
+ message.parent = object.parent ?? "";
+ message.shortcut = (object.shortcut !== undefined && object.shortcut !== null)
+ ? Shortcut.fromPartial(object.shortcut)
+ : undefined;
+ message.updateMask = object.updateMask ?? undefined;
+ return message;
+ },
+};
+
+function createBaseDeleteShortcutRequest(): DeleteShortcutRequest {
+ return { parent: "", id: "" };
+}
+
+export const DeleteShortcutRequest: MessageFns<DeleteShortcutRequest> = {
+ encode(message: DeleteShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.parent !== "") {
+ writer.uint32(10).string(message.parent);
+ }
+ if (message.id !== "") {
+ writer.uint32(18).string(message.id);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteShortcutRequest {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseDeleteShortcutRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 10) {
+ break;
+ }
+
+ message.parent = reader.string();
+ continue;
+ }
+ case 2: {
+ if (tag !== 18) {
+ break;
+ }
+
+ message.id = reader.string();
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ create(base?: DeepPartial<DeleteShortcutRequest>): DeleteShortcutRequest {
+ return DeleteShortcutRequest.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<DeleteShortcutRequest>): DeleteShortcutRequest {
+ const message = createBaseDeleteShortcutRequest();
+ message.parent = object.parent ?? "";
+ message.id = object.id ?? "";
+ return message;
+ },
+};
+
+export type ShortcutServiceDefinition = typeof ShortcutServiceDefinition;
+export const ShortcutServiceDefinition = {
+ name: "ShortcutService",
+ fullName: "memos.api.v1.ShortcutService",
+ methods: {
+ /** ListShortcuts returns a list of shortcuts for a user. */
+ listShortcuts: {
+ name: "ListShortcuts",
+ requestType: ListShortcutsRequest,
+ requestStream: false,
+ responseType: ListShortcutsResponse,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],
+ 578365826: [
+ new Uint8Array([
+ 36,
+ 18,
+ 34,
+ 47,
+ 97,
+ 112,
+ 105,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 112,
+ 97,
+ 114,
+ 101,
+ 110,
+ 116,
+ 61,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 47,
+ 42,
+ 125,
+ 47,
+ 115,
+ 104,
+ 111,
+ 114,
+ 116,
+ 99,
+ 117,
+ 116,
+ 115,
+ ]),
+ ],
+ },
+ },
+ },
+ /** CreateShortcut creates a new shortcut for a user. */
+ createShortcut: {
+ name: "CreateShortcut",
+ requestType: CreateShortcutRequest,
+ requestStream: false,
+ responseType: Shortcut,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [new Uint8Array([15, 112, 97, 114, 101, 110, 116, 44, 115, 104, 111, 114, 116, 99, 117, 116])],
+ 578365826: [
+ new Uint8Array([
+ 46,
+ 58,
+ 8,
+ 115,
+ 104,
+ 111,
+ 114,
+ 116,
+ 99,
+ 117,
+ 116,
+ 34,
+ 34,
+ 47,
+ 97,
+ 112,
+ 105,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 112,
+ 97,
+ 114,
+ 101,
+ 110,
+ 116,
+ 61,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 47,
+ 42,
+ 125,
+ 47,
+ 115,
+ 104,
+ 111,
+ 114,
+ 116,
+ 99,
+ 117,
+ 116,
+ 115,
+ ]),
+ ],
+ },
+ },
+ },
+ /** UpdateShortcut updates a shortcut for a user. */
+ updateShortcut: {
+ name: "UpdateShortcut",
+ requestType: UpdateShortcutRequest,
+ requestStream: false,
+ responseType: Shortcut,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [
+ new Uint8Array([
+ 27,
+ 112,
+ 97,
+ 114,
+ 101,
+ 110,
+ 116,
+ 44,
+ 115,
+ 104,
+ 111,
+ 114,
+ 116,
+ 99,
+ 117,
+ 116,
+ 44,
+ 117,
+ 112,
+ 100,
+ 97,
+ 116,
+ 101,
+ 95,
+ 109,
+ 97,
+ 115,
+ 107,
+ ]),
+ ],
+ 578365826: [
+ new Uint8Array([
+ 60,
+ 58,
+ 8,
+ 115,
+ 104,
+ 111,
+ 114,
+ 116,
+ 99,
+ 117,
+ 116,
+ 50,
+ 48,
+ 47,
+ 97,
+ 112,
+ 105,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 112,
+ 97,
+ 114,
+ 101,
+ 110,
+ 116,
+ 61,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 47,
+ 42,
+ 125,
+ 47,
+ 115,
+ 104,
+ 111,
+ 114,
+ 116,
+ 99,
+ 117,
+ 116,
+ 115,
+ 47,
+ 123,
+ 115,
+ 104,
+ 111,
+ 114,
+ 116,
+ 99,
+ 117,
+ 116,
+ 46,
+ 105,
+ 100,
+ 125,
+ ]),
+ ],
+ },
+ },
+ },
+ /** DeleteShortcut deletes a shortcut for a user. */
+ deleteShortcut: {
+ name: "DeleteShortcut",
+ requestType: DeleteShortcutRequest,
+ requestStream: false,
+ responseType: Empty,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [new Uint8Array([9, 112, 97, 114, 101, 110, 116, 44, 105, 100])],
+ 578365826: [
+ new Uint8Array([
+ 41,
+ 42,
+ 39,
+ 47,
+ 97,
+ 112,
+ 105,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 112,
+ 97,
+ 114,
+ 101,
+ 110,
+ 116,
+ 61,
+ 117,
+ 115,
+ 101,
+ 114,
+ 115,
+ 47,
+ 42,
+ 125,
+ 47,
+ 115,
+ 104,
+ 111,
+ 114,
+ 116,
+ 99,
+ 117,
+ 116,
+ 115,
+ 47,
+ 123,
+ 105,
+ 100,
+ 125,
+ ]),
+ ],
+ },
+ },
+ },
+ },
+} as const;
+
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
+export type DeepPartial<T> = T extends Builtin ? T
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
+ : Partial<T>;
+
+export interface MessageFns<T> {
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
+ create(base?: DeepPartial<T>): T;
+ fromPartial(object: DeepPartial<T>): T;
+}
diff --git a/web/src/types/proto/api/v1/user_service.ts b/web/src/types/proto/api/v1/user_service.ts
index 8a2d5dd63..81234f6c2 100644
--- a/web/src/types/proto/api/v1/user_service.ts
+++ b/web/src/types/proto/api/v1/user_service.ts
@@ -212,42 +212,6 @@ export interface DeleteUserAccessTokenRequest {
accessToken: string;
}
-export interface Shortcut {
- id: string;
- title: string;
- filter: string;
-}
-
-export interface ListShortcutsRequest {
- /** The name of the user. */
- parent: string;
-}
-
-export interface ListShortcutsResponse {
- shortcuts: Shortcut[];
-}
-
-export interface CreateShortcutRequest {
- /** The name of the user. */
- parent: string;
- shortcut?: Shortcut | undefined;
- validateOnly: boolean;
-}
-
-export interface UpdateShortcutRequest {
- /** The name of the user. */
- parent: string;
- shortcut?: Shortcut | undefined;
- updateMask?: string[] | undefined;
-}
-
-export interface DeleteShortcutRequest {
- /** The name of the user. */
- parent: string;
- /** The id of the shortcut. */
- id: string;
-}
-
function createBaseUser(): User {
return {
name: "",
@@ -1687,370 +1651,6 @@ export const DeleteUserAccessTokenRequest: MessageFns<DeleteUserAccessTokenReque
},
};
-function createBaseShortcut(): Shortcut {
- return { id: "", title: "", filter: "" };
-}
-
-export const Shortcut: MessageFns<Shortcut> = {
- encode(message: Shortcut, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.id !== "") {
- writer.uint32(10).string(message.id);
- }
- if (message.title !== "") {
- writer.uint32(18).string(message.title);
- }
- if (message.filter !== "") {
- writer.uint32(26).string(message.filter);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): Shortcut {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseShortcut();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.id = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.title = reader.string();
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.filter = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<Shortcut>): Shortcut {
- return Shortcut.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<Shortcut>): Shortcut {
- const message = createBaseShortcut();
- message.id = object.id ?? "";
- message.title = object.title ?? "";
- message.filter = object.filter ?? "";
- return message;
- },
-};
-
-function createBaseListShortcutsRequest(): ListShortcutsRequest {
- return { parent: "" };
-}
-
-export const ListShortcutsRequest: MessageFns<ListShortcutsRequest> = {
- encode(message: ListShortcutsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): ListShortcutsRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListShortcutsRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<ListShortcutsRequest>): ListShortcutsRequest {
- return ListShortcutsRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<ListShortcutsRequest>): ListShortcutsRequest {
- const message = createBaseListShortcutsRequest();
- message.parent = object.parent ?? "";
- return message;
- },
-};
-
-function createBaseListShortcutsResponse(): ListShortcutsResponse {
- return { shortcuts: [] };
-}
-
-export const ListShortcutsResponse: MessageFns<ListShortcutsResponse> = {
- encode(message: ListShortcutsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- for (const v of message.shortcuts) {
- Shortcut.encode(v!, writer.uint32(10).fork()).join();
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): ListShortcutsResponse {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseListShortcutsResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.shortcuts.push(Shortcut.decode(reader, reader.uint32()));
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<ListShortcutsResponse>): ListShortcutsResponse {
- return ListShortcutsResponse.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<ListShortcutsResponse>): ListShortcutsResponse {
- const message = createBaseListShortcutsResponse();
- message.shortcuts = object.shortcuts?.map((e) => Shortcut.fromPartial(e)) || [];
- return message;
- },
-};
-
-function createBaseCreateShortcutRequest(): CreateShortcutRequest {
- return { parent: "", shortcut: undefined, validateOnly: false };
-}
-
-export const CreateShortcutRequest: MessageFns<CreateShortcutRequest> = {
- encode(message: CreateShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- if (message.shortcut !== undefined) {
- Shortcut.encode(message.shortcut, writer.uint32(18).fork()).join();
- }
- if (message.validateOnly !== false) {
- writer.uint32(24).bool(message.validateOnly);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): CreateShortcutRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseCreateShortcutRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.shortcut = Shortcut.decode(reader, reader.uint32());
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.validateOnly = reader.bool();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<CreateShortcutRequest>): CreateShortcutRequest {
- return CreateShortcutRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<CreateShortcutRequest>): CreateShortcutRequest {
- const message = createBaseCreateShortcutRequest();
- message.parent = object.parent ?? "";
- message.shortcut = (object.shortcut !== undefined && object.shortcut !== null)
- ? Shortcut.fromPartial(object.shortcut)
- : undefined;
- message.validateOnly = object.validateOnly ?? false;
- return message;
- },
-};
-
-function createBaseUpdateShortcutRequest(): UpdateShortcutRequest {
- return { parent: "", shortcut: undefined, updateMask: undefined };
-}
-
-export const UpdateShortcutRequest: MessageFns<UpdateShortcutRequest> = {
- encode(message: UpdateShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- if (message.shortcut !== undefined) {
- Shortcut.encode(message.shortcut, writer.uint32(18).fork()).join();
- }
- if (message.updateMask !== undefined) {
- FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(26).fork()).join();
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): UpdateShortcutRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseUpdateShortcutRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.shortcut = Shortcut.decode(reader, reader.uint32());
- continue;
- }
- case 3: {
- if (tag !== 26) {
- break;
- }
-
- message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<UpdateShortcutRequest>): UpdateShortcutRequest {
- return UpdateShortcutRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<UpdateShortcutRequest>): UpdateShortcutRequest {
- const message = createBaseUpdateShortcutRequest();
- message.parent = object.parent ?? "";
- message.shortcut = (object.shortcut !== undefined && object.shortcut !== null)
- ? Shortcut.fromPartial(object.shortcut)
- : undefined;
- message.updateMask = object.updateMask ?? undefined;
- return message;
- },
-};
-
-function createBaseDeleteShortcutRequest(): DeleteShortcutRequest {
- return { parent: "", id: "" };
-}
-
-export const DeleteShortcutRequest: MessageFns<DeleteShortcutRequest> = {
- encode(message: DeleteShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.parent !== "") {
- writer.uint32(10).string(message.parent);
- }
- if (message.id !== "") {
- writer.uint32(18).string(message.id);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): DeleteShortcutRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseDeleteShortcutRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.parent = reader.string();
- continue;
- }
- case 2: {
- if (tag !== 18) {
- break;
- }
-
- message.id = reader.string();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- create(base?: DeepPartial<DeleteShortcutRequest>): DeleteShortcutRequest {
- return DeleteShortcutRequest.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<DeleteShortcutRequest>): DeleteShortcutRequest {
- const message = createBaseDeleteShortcutRequest();
- message.parent = object.parent ?? "";
- message.id = object.id ?? "";
- return message;
- },
-};
-
export type UserServiceDefinition = typeof UserServiceDefinition;
export const UserServiceDefinition = {
name: "UserService",
@@ -2748,292 +2348,6 @@ export const UserServiceDefinition = {
},
},
},
- /** ListShortcuts returns a list of shortcuts for a user. */
- listShortcuts: {
- name: "ListShortcuts",
- requestType: ListShortcutsRequest,
- requestStream: false,
- responseType: ListShortcutsResponse,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],
- 578365826: [
- new Uint8Array([
- 36,
- 18,
- 34,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 125,
- 47,
- 115,
- 104,
- 111,
- 114,
- 116,
- 99,
- 117,
- 116,
- 115,
- ]),
- ],
- },
- },
- },
- /** CreateShortcut creates a new shortcut for a user. */
- createShortcut: {
- name: "CreateShortcut",
- requestType: CreateShortcutRequest,
- requestStream: false,
- responseType: Shortcut,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([15, 112, 97, 114, 101, 110, 116, 44, 115, 104, 111, 114, 116, 99, 117, 116])],
- 578365826: [
- new Uint8Array([
- 46,
- 58,
- 8,
- 115,
- 104,
- 111,
- 114,
- 116,
- 99,
- 117,
- 116,
- 34,
- 34,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 125,
- 47,
- 115,
- 104,
- 111,
- 114,
- 116,
- 99,
- 117,
- 116,
- 115,
- ]),
- ],
- },
- },
- },
- /** UpdateShortcut updates a shortcut for a user. */
- updateShortcut: {
- name: "UpdateShortcut",
- requestType: UpdateShortcutRequest,
- requestStream: false,
- responseType: Shortcut,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [
- new Uint8Array([
- 27,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 44,
- 115,
- 104,
- 111,
- 114,
- 116,
- 99,
- 117,
- 116,
- 44,
- 117,
- 112,
- 100,
- 97,
- 116,
- 101,
- 95,
- 109,
- 97,
- 115,
- 107,
- ]),
- ],
- 578365826: [
- new Uint8Array([
- 60,
- 58,
- 8,
- 115,
- 104,
- 111,
- 114,
- 116,
- 99,
- 117,
- 116,
- 50,
- 48,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 125,
- 47,
- 115,
- 104,
- 111,
- 114,
- 116,
- 99,
- 117,
- 116,
- 115,
- 47,
- 123,
- 115,
- 104,
- 111,
- 114,
- 116,
- 99,
- 117,
- 116,
- 46,
- 105,
- 100,
- 125,
- ]),
- ],
- },
- },
- },
- /** DeleteShortcut deletes a shortcut for a user. */
- deleteShortcut: {
- name: "DeleteShortcut",
- requestType: DeleteShortcutRequest,
- requestStream: false,
- responseType: Empty,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([9, 112, 97, 114, 101, 110, 116, 44, 105, 100])],
- 578365826: [
- new Uint8Array([
- 41,
- 42,
- 39,
- 47,
- 97,
- 112,
- 105,
- 47,
- 118,
- 49,
- 47,
- 123,
- 112,
- 97,
- 114,
- 101,
- 110,
- 116,
- 61,
- 117,
- 115,
- 101,
- 114,
- 115,
- 47,
- 42,
- 125,
- 47,
- 115,
- 104,
- 111,
- 114,
- 116,
- 99,
- 117,
- 116,
- 115,
- 47,
- 123,
- 105,
- 100,
- 125,
- ]),
- ],
- },
- },
- },
},
} as const;