mirror of https://github.com/usememos/memos
refactor: shortcut service
parent
6964c1df05
commit
64b27d5a4e
@ -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;
|
||||||
|
}
|
@ -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
|
||||||
|
}
|
@ -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
|
||||||
|
)
|
@ -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",
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue