chore: update embedded content renderers

pull/2815/head
Steven 1 year ago
parent 370054e040
commit a620d140c5

@ -73,7 +73,7 @@ func (s *APIV2Service) GetResource(ctx context.Context, request *apiv2pb.GetReso
ID: &request.Id, ID: &request.Id,
}) })
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to list resources: %v", err) return nil, status.Errorf(codes.Internal, "failed to get resource: %v", err)
} }
if resource == nil { if resource == nil {
return nil, status.Errorf(codes.NotFound, "resource not found") return nil, status.Errorf(codes.NotFound, "resource not found")
@ -84,6 +84,22 @@ func (s *APIV2Service) GetResource(ctx context.Context, request *apiv2pb.GetReso
}, nil }, nil
} }
func (s *APIV2Service) GetResourceByName(ctx context.Context, request *apiv2pb.GetResourceByNameRequest) (*apiv2pb.GetResourceByNameResponse, error) {
resource, err := s.Store.GetResource(ctx, &store.FindResource{
ResourceName: &request.Name,
})
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get resource: %v", err)
}
if resource == nil {
return nil, status.Errorf(codes.NotFound, "resource not found")
}
return &apiv2pb.GetResourceByNameResponse{
Resource: s.convertResourceFromStore(ctx, resource),
}, nil
}
func (s *APIV2Service) UpdateResource(ctx context.Context, request *apiv2pb.UpdateResourceRequest) (*apiv2pb.UpdateResourceResponse, error) { func (s *APIV2Service) UpdateResource(ctx context.Context, request *apiv2pb.UpdateResourceRequest) (*apiv2pb.UpdateResourceResponse, error) {
if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 { if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 {
return nil, status.Errorf(codes.InvalidArgument, "update mask is required") return nil, status.Errorf(codes.InvalidArgument, "update mask is required")

@ -48,6 +48,13 @@ func TestEmbeddedContentParser(t *testing.T) {
Params: "align=center", Params: "align=center",
}, },
}, },
{
text: "![[resources/6uxnhT98q8vN8anBbUbRGu?align=center]]",
embeddedContent: &ast.EmbeddedContent{
ResourceName: "resources/6uxnhT98q8vN8anBbUbRGu",
Params: "align=center",
},
},
} }
for _, test := range tests { for _, test := range tests {

@ -20,6 +20,10 @@ service ResourceService {
option (google.api.http) = {get: "/api/v2/resources/{id}"}; option (google.api.http) = {get: "/api/v2/resources/{id}"};
option (google.api.method_signature) = "id"; option (google.api.method_signature) = "id";
} }
rpc GetResourceByName(GetResourceByNameRequest) returns (GetResourceByNameResponse) {
option (google.api.http) = {get: "/api/v2/resources/{name}"};
option (google.api.method_signature) = "name";
}
rpc UpdateResource(UpdateResourceRequest) returns (UpdateResourceResponse) { rpc UpdateResource(UpdateResourceRequest) returns (UpdateResourceResponse) {
option (google.api.http) = { option (google.api.http) = {
patch: "/api/v2/resources/{resource.id}", patch: "/api/v2/resources/{resource.id}",
@ -78,6 +82,14 @@ message GetResourceResponse {
Resource resource = 1; Resource resource = 1;
} }
message GetResourceByNameRequest {
string name = 1;
}
message GetResourceByNameResponse {
Resource resource = 1;
}
message UpdateResourceRequest { message UpdateResourceRequest {
Resource resource = 1; Resource resource = 1;

@ -112,6 +112,8 @@
- [CreateResourceResponse](#memos-api-v2-CreateResourceResponse) - [CreateResourceResponse](#memos-api-v2-CreateResourceResponse)
- [DeleteResourceRequest](#memos-api-v2-DeleteResourceRequest) - [DeleteResourceRequest](#memos-api-v2-DeleteResourceRequest)
- [DeleteResourceResponse](#memos-api-v2-DeleteResourceResponse) - [DeleteResourceResponse](#memos-api-v2-DeleteResourceResponse)
- [GetResourceByNameRequest](#memos-api-v2-GetResourceByNameRequest)
- [GetResourceByNameResponse](#memos-api-v2-GetResourceByNameResponse)
- [GetResourceRequest](#memos-api-v2-GetResourceRequest) - [GetResourceRequest](#memos-api-v2-GetResourceRequest)
- [GetResourceResponse](#memos-api-v2-GetResourceResponse) - [GetResourceResponse](#memos-api-v2-GetResourceResponse)
- [ListResourcesRequest](#memos-api-v2-ListResourcesRequest) - [ListResourcesRequest](#memos-api-v2-ListResourcesRequest)
@ -1642,6 +1644,36 @@
<a name="memos-api-v2-GetResourceByNameRequest"></a>
### GetResourceByNameRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| name | [string](#string) | | |
<a name="memos-api-v2-GetResourceByNameResponse"></a>
### GetResourceByNameResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| resource | [Resource](#memos-api-v2-Resource) | | |
<a name="memos-api-v2-GetResourceRequest"></a> <a name="memos-api-v2-GetResourceRequest"></a>
### GetResourceRequest ### GetResourceRequest
@ -1766,6 +1798,7 @@
| CreateResource | [CreateResourceRequest](#memos-api-v2-CreateResourceRequest) | [CreateResourceResponse](#memos-api-v2-CreateResourceResponse) | | | CreateResource | [CreateResourceRequest](#memos-api-v2-CreateResourceRequest) | [CreateResourceResponse](#memos-api-v2-CreateResourceResponse) | |
| ListResources | [ListResourcesRequest](#memos-api-v2-ListResourcesRequest) | [ListResourcesResponse](#memos-api-v2-ListResourcesResponse) | | | ListResources | [ListResourcesRequest](#memos-api-v2-ListResourcesRequest) | [ListResourcesResponse](#memos-api-v2-ListResourcesResponse) | |
| GetResource | [GetResourceRequest](#memos-api-v2-GetResourceRequest) | [GetResourceResponse](#memos-api-v2-GetResourceResponse) | | | GetResource | [GetResourceRequest](#memos-api-v2-GetResourceRequest) | [GetResourceResponse](#memos-api-v2-GetResourceResponse) | |
| GetResourceByName | [GetResourceByNameRequest](#memos-api-v2-GetResourceByNameRequest) | [GetResourceByNameResponse](#memos-api-v2-GetResourceByNameResponse) | |
| UpdateResource | [UpdateResourceRequest](#memos-api-v2-UpdateResourceRequest) | [UpdateResourceResponse](#memos-api-v2-UpdateResourceResponse) | | | UpdateResource | [UpdateResourceRequest](#memos-api-v2-UpdateResourceRequest) | [UpdateResourceResponse](#memos-api-v2-UpdateResourceResponse) | |
| DeleteResource | [DeleteResourceRequest](#memos-api-v2-DeleteResourceRequest) | [DeleteResourceResponse](#memos-api-v2-DeleteResourceResponse) | | | DeleteResource | [DeleteResourceRequest](#memos-api-v2-DeleteResourceRequest) | [DeleteResourceResponse](#memos-api-v2-DeleteResourceResponse) | |

@ -425,6 +425,100 @@ func (x *GetResourceResponse) GetResource() *Resource {
return nil return nil
} }
type GetResourceByNameRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
}
func (x *GetResourceByNameRequest) Reset() {
*x = GetResourceByNameRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_resource_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetResourceByNameRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetResourceByNameRequest) ProtoMessage() {}
func (x *GetResourceByNameRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_resource_service_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetResourceByNameRequest.ProtoReflect.Descriptor instead.
func (*GetResourceByNameRequest) Descriptor() ([]byte, []int) {
return file_api_v2_resource_service_proto_rawDescGZIP(), []int{7}
}
func (x *GetResourceByNameRequest) GetName() string {
if x != nil {
return x.Name
}
return ""
}
type GetResourceByNameResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"`
}
func (x *GetResourceByNameResponse) Reset() {
*x = GetResourceByNameResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v2_resource_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetResourceByNameResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetResourceByNameResponse) ProtoMessage() {}
func (x *GetResourceByNameResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_resource_service_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetResourceByNameResponse.ProtoReflect.Descriptor instead.
func (*GetResourceByNameResponse) Descriptor() ([]byte, []int) {
return file_api_v2_resource_service_proto_rawDescGZIP(), []int{8}
}
func (x *GetResourceByNameResponse) GetResource() *Resource {
if x != nil {
return x.Resource
}
return nil
}
type UpdateResourceRequest struct { type UpdateResourceRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -437,7 +531,7 @@ type UpdateResourceRequest struct {
func (x *UpdateResourceRequest) Reset() { func (x *UpdateResourceRequest) Reset() {
*x = UpdateResourceRequest{} *x = UpdateResourceRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v2_resource_service_proto_msgTypes[7] mi := &file_api_v2_resource_service_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -450,7 +544,7 @@ func (x *UpdateResourceRequest) String() string {
func (*UpdateResourceRequest) ProtoMessage() {} func (*UpdateResourceRequest) ProtoMessage() {}
func (x *UpdateResourceRequest) ProtoReflect() protoreflect.Message { func (x *UpdateResourceRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_resource_service_proto_msgTypes[7] mi := &file_api_v2_resource_service_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -463,7 +557,7 @@ func (x *UpdateResourceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateResourceRequest.ProtoReflect.Descriptor instead. // Deprecated: Use UpdateResourceRequest.ProtoReflect.Descriptor instead.
func (*UpdateResourceRequest) Descriptor() ([]byte, []int) { func (*UpdateResourceRequest) Descriptor() ([]byte, []int) {
return file_api_v2_resource_service_proto_rawDescGZIP(), []int{7} return file_api_v2_resource_service_proto_rawDescGZIP(), []int{9}
} }
func (x *UpdateResourceRequest) GetResource() *Resource { func (x *UpdateResourceRequest) GetResource() *Resource {
@ -491,7 +585,7 @@ type UpdateResourceResponse struct {
func (x *UpdateResourceResponse) Reset() { func (x *UpdateResourceResponse) Reset() {
*x = UpdateResourceResponse{} *x = UpdateResourceResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v2_resource_service_proto_msgTypes[8] mi := &file_api_v2_resource_service_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -504,7 +598,7 @@ func (x *UpdateResourceResponse) String() string {
func (*UpdateResourceResponse) ProtoMessage() {} func (*UpdateResourceResponse) ProtoMessage() {}
func (x *UpdateResourceResponse) ProtoReflect() protoreflect.Message { func (x *UpdateResourceResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_resource_service_proto_msgTypes[8] mi := &file_api_v2_resource_service_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -517,7 +611,7 @@ func (x *UpdateResourceResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateResourceResponse.ProtoReflect.Descriptor instead. // Deprecated: Use UpdateResourceResponse.ProtoReflect.Descriptor instead.
func (*UpdateResourceResponse) Descriptor() ([]byte, []int) { func (*UpdateResourceResponse) Descriptor() ([]byte, []int) {
return file_api_v2_resource_service_proto_rawDescGZIP(), []int{8} return file_api_v2_resource_service_proto_rawDescGZIP(), []int{10}
} }
func (x *UpdateResourceResponse) GetResource() *Resource { func (x *UpdateResourceResponse) GetResource() *Resource {
@ -538,7 +632,7 @@ type DeleteResourceRequest struct {
func (x *DeleteResourceRequest) Reset() { func (x *DeleteResourceRequest) Reset() {
*x = DeleteResourceRequest{} *x = DeleteResourceRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v2_resource_service_proto_msgTypes[9] mi := &file_api_v2_resource_service_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -551,7 +645,7 @@ func (x *DeleteResourceRequest) String() string {
func (*DeleteResourceRequest) ProtoMessage() {} func (*DeleteResourceRequest) ProtoMessage() {}
func (x *DeleteResourceRequest) ProtoReflect() protoreflect.Message { func (x *DeleteResourceRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_resource_service_proto_msgTypes[9] mi := &file_api_v2_resource_service_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -564,7 +658,7 @@ func (x *DeleteResourceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteResourceRequest.ProtoReflect.Descriptor instead. // Deprecated: Use DeleteResourceRequest.ProtoReflect.Descriptor instead.
func (*DeleteResourceRequest) Descriptor() ([]byte, []int) { func (*DeleteResourceRequest) Descriptor() ([]byte, []int) {
return file_api_v2_resource_service_proto_rawDescGZIP(), []int{9} return file_api_v2_resource_service_proto_rawDescGZIP(), []int{11}
} }
func (x *DeleteResourceRequest) GetId() int32 { func (x *DeleteResourceRequest) GetId() int32 {
@ -583,7 +677,7 @@ type DeleteResourceResponse struct {
func (x *DeleteResourceResponse) Reset() { func (x *DeleteResourceResponse) Reset() {
*x = DeleteResourceResponse{} *x = DeleteResourceResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v2_resource_service_proto_msgTypes[10] mi := &file_api_v2_resource_service_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -596,7 +690,7 @@ func (x *DeleteResourceResponse) String() string {
func (*DeleteResourceResponse) ProtoMessage() {} func (*DeleteResourceResponse) ProtoMessage() {}
func (x *DeleteResourceResponse) ProtoReflect() protoreflect.Message { func (x *DeleteResourceResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v2_resource_service_proto_msgTypes[10] mi := &file_api_v2_resource_service_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -609,7 +703,7 @@ func (x *DeleteResourceResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteResourceResponse.ProtoReflect.Descriptor instead. // Deprecated: Use DeleteResourceResponse.ProtoReflect.Descriptor instead.
func (*DeleteResourceResponse) Descriptor() ([]byte, []int) { func (*DeleteResourceResponse) Descriptor() ([]byte, []int) {
return file_api_v2_resource_service_proto_rawDescGZIP(), []int{10} return file_api_v2_resource_service_proto_rawDescGZIP(), []int{12}
} }
var File_api_v2_resource_service_proto protoreflect.FileDescriptor var File_api_v2_resource_service_proto protoreflect.FileDescriptor
@ -669,78 +763,95 @@ var file_api_v2_resource_service_proto_rawDesc = []byte{
0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x2e, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x52, 0x65,
0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75,
0x74, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4f, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x52, 0x65,
0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08,
0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64,
0x73, 0x6b, 0x22, 0x4c, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x22, 0x27, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f,
0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d,
0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x61, 0x73, 0x6b, 0x22, 0x4c, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73,
0x6e, 0x73, 0x65, 0x32, 0xa2, 0x05, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x76, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x22, 0x27, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75,
0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb2, 0x06, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x76, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61,
0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d,
0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
0x12, 0x73, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x73, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93,
0x02, 0x13, 0x12, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x77, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0xda, 0x41, 0x02, 0x69, 0x64,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x8d,
0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42,
0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6d,
0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3,
0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0xa5,
0x01, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x48, 0xda, 0x41,
0x14, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x08, 0x72, 0x65, 0x73,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x32, 0x1f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x2e, 0x69, 0x64, 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f,
0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24,
0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65,
0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, 0x2f, 0x61, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75,
0x73, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x42, 0xac, 0x01, 0x0a, 0x10, 0x63, 0x6f,
0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x14,
0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x13, 0x12, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02,
0x72, 0x63, 0x65, 0x73, 0x12, 0x77, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c,
0x72, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d,
0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xa5, 0x01,
0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75,
0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x48, 0xda, 0x41, 0x14,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f,
0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x08, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x32, 0x1f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x2e, 0x69, 0x64, 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e,
0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x23, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18,
0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x42, 0xac, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d,
0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x14, 0x52,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c,
0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d,
0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65,
0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a,
0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -755,7 +866,7 @@ func file_api_v2_resource_service_proto_rawDescGZIP() []byte {
return file_api_v2_resource_service_proto_rawDescData return file_api_v2_resource_service_proto_rawDescData
} }
var file_api_v2_resource_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_api_v2_resource_service_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_api_v2_resource_service_proto_goTypes = []interface{}{ var file_api_v2_resource_service_proto_goTypes = []interface{}{
(*Resource)(nil), // 0: memos.api.v2.Resource (*Resource)(nil), // 0: memos.api.v2.Resource
(*CreateResourceRequest)(nil), // 1: memos.api.v2.CreateResourceRequest (*CreateResourceRequest)(nil), // 1: memos.api.v2.CreateResourceRequest
@ -764,36 +875,41 @@ var file_api_v2_resource_service_proto_goTypes = []interface{}{
(*ListResourcesResponse)(nil), // 4: memos.api.v2.ListResourcesResponse (*ListResourcesResponse)(nil), // 4: memos.api.v2.ListResourcesResponse
(*GetResourceRequest)(nil), // 5: memos.api.v2.GetResourceRequest (*GetResourceRequest)(nil), // 5: memos.api.v2.GetResourceRequest
(*GetResourceResponse)(nil), // 6: memos.api.v2.GetResourceResponse (*GetResourceResponse)(nil), // 6: memos.api.v2.GetResourceResponse
(*UpdateResourceRequest)(nil), // 7: memos.api.v2.UpdateResourceRequest (*GetResourceByNameRequest)(nil), // 7: memos.api.v2.GetResourceByNameRequest
(*UpdateResourceResponse)(nil), // 8: memos.api.v2.UpdateResourceResponse (*GetResourceByNameResponse)(nil), // 8: memos.api.v2.GetResourceByNameResponse
(*DeleteResourceRequest)(nil), // 9: memos.api.v2.DeleteResourceRequest (*UpdateResourceRequest)(nil), // 9: memos.api.v2.UpdateResourceRequest
(*DeleteResourceResponse)(nil), // 10: memos.api.v2.DeleteResourceResponse (*UpdateResourceResponse)(nil), // 10: memos.api.v2.UpdateResourceResponse
(*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp (*DeleteResourceRequest)(nil), // 11: memos.api.v2.DeleteResourceRequest
(*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask (*DeleteResourceResponse)(nil), // 12: memos.api.v2.DeleteResourceResponse
(*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp
(*fieldmaskpb.FieldMask)(nil), // 14: google.protobuf.FieldMask
} }
var file_api_v2_resource_service_proto_depIdxs = []int32{ var file_api_v2_resource_service_proto_depIdxs = []int32{
11, // 0: memos.api.v2.Resource.create_time:type_name -> google.protobuf.Timestamp 13, // 0: memos.api.v2.Resource.create_time:type_name -> google.protobuf.Timestamp
0, // 1: memos.api.v2.CreateResourceResponse.resource:type_name -> memos.api.v2.Resource 0, // 1: memos.api.v2.CreateResourceResponse.resource:type_name -> memos.api.v2.Resource
0, // 2: memos.api.v2.ListResourcesResponse.resources:type_name -> memos.api.v2.Resource 0, // 2: memos.api.v2.ListResourcesResponse.resources:type_name -> memos.api.v2.Resource
0, // 3: memos.api.v2.GetResourceResponse.resource:type_name -> memos.api.v2.Resource 0, // 3: memos.api.v2.GetResourceResponse.resource:type_name -> memos.api.v2.Resource
0, // 4: memos.api.v2.UpdateResourceRequest.resource:type_name -> memos.api.v2.Resource 0, // 4: memos.api.v2.GetResourceByNameResponse.resource:type_name -> memos.api.v2.Resource
12, // 5: memos.api.v2.UpdateResourceRequest.update_mask:type_name -> google.protobuf.FieldMask 0, // 5: memos.api.v2.UpdateResourceRequest.resource:type_name -> memos.api.v2.Resource
0, // 6: memos.api.v2.UpdateResourceResponse.resource:type_name -> memos.api.v2.Resource 14, // 6: memos.api.v2.UpdateResourceRequest.update_mask:type_name -> google.protobuf.FieldMask
1, // 7: memos.api.v2.ResourceService.CreateResource:input_type -> memos.api.v2.CreateResourceRequest 0, // 7: memos.api.v2.UpdateResourceResponse.resource:type_name -> memos.api.v2.Resource
3, // 8: memos.api.v2.ResourceService.ListResources:input_type -> memos.api.v2.ListResourcesRequest 1, // 8: memos.api.v2.ResourceService.CreateResource:input_type -> memos.api.v2.CreateResourceRequest
5, // 9: memos.api.v2.ResourceService.GetResource:input_type -> memos.api.v2.GetResourceRequest 3, // 9: memos.api.v2.ResourceService.ListResources:input_type -> memos.api.v2.ListResourcesRequest
7, // 10: memos.api.v2.ResourceService.UpdateResource:input_type -> memos.api.v2.UpdateResourceRequest 5, // 10: memos.api.v2.ResourceService.GetResource:input_type -> memos.api.v2.GetResourceRequest
9, // 11: memos.api.v2.ResourceService.DeleteResource:input_type -> memos.api.v2.DeleteResourceRequest 7, // 11: memos.api.v2.ResourceService.GetResourceByName:input_type -> memos.api.v2.GetResourceByNameRequest
2, // 12: memos.api.v2.ResourceService.CreateResource:output_type -> memos.api.v2.CreateResourceResponse 9, // 12: memos.api.v2.ResourceService.UpdateResource:input_type -> memos.api.v2.UpdateResourceRequest
4, // 13: memos.api.v2.ResourceService.ListResources:output_type -> memos.api.v2.ListResourcesResponse 11, // 13: memos.api.v2.ResourceService.DeleteResource:input_type -> memos.api.v2.DeleteResourceRequest
6, // 14: memos.api.v2.ResourceService.GetResource:output_type -> memos.api.v2.GetResourceResponse 2, // 14: memos.api.v2.ResourceService.CreateResource:output_type -> memos.api.v2.CreateResourceResponse
8, // 15: memos.api.v2.ResourceService.UpdateResource:output_type -> memos.api.v2.UpdateResourceResponse 4, // 15: memos.api.v2.ResourceService.ListResources:output_type -> memos.api.v2.ListResourcesResponse
10, // 16: memos.api.v2.ResourceService.DeleteResource:output_type -> memos.api.v2.DeleteResourceResponse 6, // 16: memos.api.v2.ResourceService.GetResource:output_type -> memos.api.v2.GetResourceResponse
12, // [12:17] is the sub-list for method output_type 8, // 17: memos.api.v2.ResourceService.GetResourceByName:output_type -> memos.api.v2.GetResourceByNameResponse
7, // [7:12] is the sub-list for method input_type 10, // 18: memos.api.v2.ResourceService.UpdateResource:output_type -> memos.api.v2.UpdateResourceResponse
7, // [7:7] is the sub-list for extension type_name 12, // 19: memos.api.v2.ResourceService.DeleteResource:output_type -> memos.api.v2.DeleteResourceResponse
7, // [7:7] is the sub-list for extension extendee 14, // [14:20] is the sub-list for method output_type
0, // [0:7] is the sub-list for field type_name 8, // [8:14] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
} }
func init() { file_api_v2_resource_service_proto_init() } func init() { file_api_v2_resource_service_proto_init() }
@ -887,7 +1003,7 @@ func file_api_v2_resource_service_proto_init() {
} }
} }
file_api_v2_resource_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { file_api_v2_resource_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateResourceRequest); i { switch v := v.(*GetResourceByNameRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -899,7 +1015,7 @@ func file_api_v2_resource_service_proto_init() {
} }
} }
file_api_v2_resource_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_api_v2_resource_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateResourceResponse); i { switch v := v.(*GetResourceByNameResponse); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -911,7 +1027,7 @@ func file_api_v2_resource_service_proto_init() {
} }
} }
file_api_v2_resource_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_api_v2_resource_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteResourceRequest); i { switch v := v.(*UpdateResourceRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -923,6 +1039,30 @@ func file_api_v2_resource_service_proto_init() {
} }
} }
file_api_v2_resource_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { file_api_v2_resource_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateResourceResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_v2_resource_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteResourceRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_v2_resource_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteResourceResponse); i { switch v := v.(*DeleteResourceResponse); i {
case 0: case 0:
return &v.state return &v.state
@ -943,7 +1083,7 @@ func file_api_v2_resource_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_v2_resource_service_proto_rawDesc, RawDescriptor: file_api_v2_resource_service_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 11, NumMessages: 13,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

@ -137,6 +137,58 @@ func local_request_ResourceService_GetResource_0(ctx context.Context, marshaler
} }
func request_ResourceService_GetResourceByName_0(ctx context.Context, marshaler runtime.Marshaler, client ResourceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetResourceByNameRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
}
protoReq.Name, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
}
msg, err := client.GetResourceByName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_ResourceService_GetResourceByName_0(ctx context.Context, marshaler runtime.Marshaler, server ResourceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetResourceByNameRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
}
protoReq.Name, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
}
msg, err := server.GetResourceByName(ctx, &protoReq)
return msg, metadata, err
}
var ( var (
filter_ResourceService_UpdateResource_0 = &utilities.DoubleArray{Encoding: map[string]int{"resource": 0, "id": 1}, Base: []int{1, 4, 5, 2, 0, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 2, 3}} filter_ResourceService_UpdateResource_0 = &utilities.DoubleArray{Encoding: map[string]int{"resource": 0, "id": 1}, Base: []int{1, 4, 5, 2, 0, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 2, 3}}
) )
@ -370,6 +422,31 @@ func RegisterResourceServiceHandlerServer(ctx context.Context, mux *runtime.Serv
}) })
mux.Handle("GET", pattern_ResourceService_GetResourceByName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.ResourceService/GetResourceByName", runtime.WithHTTPPathPattern("/api/v2/resources/{name}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_ResourceService_GetResourceByName_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_ResourceService_GetResourceByName_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("PATCH", pattern_ResourceService_UpdateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("PATCH", pattern_ResourceService_UpdateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
@ -527,6 +604,28 @@ func RegisterResourceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
}) })
mux.Handle("GET", pattern_ResourceService_GetResourceByName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.ResourceService/GetResourceByName", runtime.WithHTTPPathPattern("/api/v2/resources/{name}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_ResourceService_GetResourceByName_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_ResourceService_GetResourceByName_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("PATCH", pattern_ResourceService_UpdateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("PATCH", pattern_ResourceService_UpdateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
@ -581,6 +680,8 @@ var (
pattern_ResourceService_GetResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "resources", "id"}, "")) pattern_ResourceService_GetResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "resources", "id"}, ""))
pattern_ResourceService_GetResourceByName_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "resources", "name"}, ""))
pattern_ResourceService_UpdateResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "resources", "resource.id"}, "")) pattern_ResourceService_UpdateResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "resources", "resource.id"}, ""))
pattern_ResourceService_DeleteResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "resources", "id"}, "")) pattern_ResourceService_DeleteResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "resources", "id"}, ""))
@ -593,6 +694,8 @@ var (
forward_ResourceService_GetResource_0 = runtime.ForwardResponseMessage forward_ResourceService_GetResource_0 = runtime.ForwardResponseMessage
forward_ResourceService_GetResourceByName_0 = runtime.ForwardResponseMessage
forward_ResourceService_UpdateResource_0 = runtime.ForwardResponseMessage forward_ResourceService_UpdateResource_0 = runtime.ForwardResponseMessage
forward_ResourceService_DeleteResource_0 = runtime.ForwardResponseMessage forward_ResourceService_DeleteResource_0 = runtime.ForwardResponseMessage

@ -22,6 +22,7 @@ const (
ResourceService_CreateResource_FullMethodName = "/memos.api.v2.ResourceService/CreateResource" ResourceService_CreateResource_FullMethodName = "/memos.api.v2.ResourceService/CreateResource"
ResourceService_ListResources_FullMethodName = "/memos.api.v2.ResourceService/ListResources" ResourceService_ListResources_FullMethodName = "/memos.api.v2.ResourceService/ListResources"
ResourceService_GetResource_FullMethodName = "/memos.api.v2.ResourceService/GetResource" ResourceService_GetResource_FullMethodName = "/memos.api.v2.ResourceService/GetResource"
ResourceService_GetResourceByName_FullMethodName = "/memos.api.v2.ResourceService/GetResourceByName"
ResourceService_UpdateResource_FullMethodName = "/memos.api.v2.ResourceService/UpdateResource" ResourceService_UpdateResource_FullMethodName = "/memos.api.v2.ResourceService/UpdateResource"
ResourceService_DeleteResource_FullMethodName = "/memos.api.v2.ResourceService/DeleteResource" ResourceService_DeleteResource_FullMethodName = "/memos.api.v2.ResourceService/DeleteResource"
) )
@ -33,6 +34,7 @@ type ResourceServiceClient interface {
CreateResource(ctx context.Context, in *CreateResourceRequest, opts ...grpc.CallOption) (*CreateResourceResponse, error) CreateResource(ctx context.Context, in *CreateResourceRequest, opts ...grpc.CallOption) (*CreateResourceResponse, error)
ListResources(ctx context.Context, in *ListResourcesRequest, opts ...grpc.CallOption) (*ListResourcesResponse, error) ListResources(ctx context.Context, in *ListResourcesRequest, opts ...grpc.CallOption) (*ListResourcesResponse, error)
GetResource(ctx context.Context, in *GetResourceRequest, opts ...grpc.CallOption) (*GetResourceResponse, error) GetResource(ctx context.Context, in *GetResourceRequest, opts ...grpc.CallOption) (*GetResourceResponse, error)
GetResourceByName(ctx context.Context, in *GetResourceByNameRequest, opts ...grpc.CallOption) (*GetResourceByNameResponse, error)
UpdateResource(ctx context.Context, in *UpdateResourceRequest, opts ...grpc.CallOption) (*UpdateResourceResponse, error) UpdateResource(ctx context.Context, in *UpdateResourceRequest, opts ...grpc.CallOption) (*UpdateResourceResponse, error)
DeleteResource(ctx context.Context, in *DeleteResourceRequest, opts ...grpc.CallOption) (*DeleteResourceResponse, error) DeleteResource(ctx context.Context, in *DeleteResourceRequest, opts ...grpc.CallOption) (*DeleteResourceResponse, error)
} }
@ -72,6 +74,15 @@ func (c *resourceServiceClient) GetResource(ctx context.Context, in *GetResource
return out, nil return out, nil
} }
func (c *resourceServiceClient) GetResourceByName(ctx context.Context, in *GetResourceByNameRequest, opts ...grpc.CallOption) (*GetResourceByNameResponse, error) {
out := new(GetResourceByNameResponse)
err := c.cc.Invoke(ctx, ResourceService_GetResourceByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *resourceServiceClient) UpdateResource(ctx context.Context, in *UpdateResourceRequest, opts ...grpc.CallOption) (*UpdateResourceResponse, error) { func (c *resourceServiceClient) UpdateResource(ctx context.Context, in *UpdateResourceRequest, opts ...grpc.CallOption) (*UpdateResourceResponse, error) {
out := new(UpdateResourceResponse) out := new(UpdateResourceResponse)
err := c.cc.Invoke(ctx, ResourceService_UpdateResource_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, ResourceService_UpdateResource_FullMethodName, in, out, opts...)
@ -97,6 +108,7 @@ type ResourceServiceServer interface {
CreateResource(context.Context, *CreateResourceRequest) (*CreateResourceResponse, error) CreateResource(context.Context, *CreateResourceRequest) (*CreateResourceResponse, error)
ListResources(context.Context, *ListResourcesRequest) (*ListResourcesResponse, error) ListResources(context.Context, *ListResourcesRequest) (*ListResourcesResponse, error)
GetResource(context.Context, *GetResourceRequest) (*GetResourceResponse, error) GetResource(context.Context, *GetResourceRequest) (*GetResourceResponse, error)
GetResourceByName(context.Context, *GetResourceByNameRequest) (*GetResourceByNameResponse, error)
UpdateResource(context.Context, *UpdateResourceRequest) (*UpdateResourceResponse, error) UpdateResource(context.Context, *UpdateResourceRequest) (*UpdateResourceResponse, error)
DeleteResource(context.Context, *DeleteResourceRequest) (*DeleteResourceResponse, error) DeleteResource(context.Context, *DeleteResourceRequest) (*DeleteResourceResponse, error)
mustEmbedUnimplementedResourceServiceServer() mustEmbedUnimplementedResourceServiceServer()
@ -115,6 +127,9 @@ func (UnimplementedResourceServiceServer) ListResources(context.Context, *ListRe
func (UnimplementedResourceServiceServer) GetResource(context.Context, *GetResourceRequest) (*GetResourceResponse, error) { func (UnimplementedResourceServiceServer) GetResource(context.Context, *GetResourceRequest) (*GetResourceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetResource not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetResource not implemented")
} }
func (UnimplementedResourceServiceServer) GetResourceByName(context.Context, *GetResourceByNameRequest) (*GetResourceByNameResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetResourceByName not implemented")
}
func (UnimplementedResourceServiceServer) UpdateResource(context.Context, *UpdateResourceRequest) (*UpdateResourceResponse, error) { func (UnimplementedResourceServiceServer) UpdateResource(context.Context, *UpdateResourceRequest) (*UpdateResourceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateResource not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateResource not implemented")
} }
@ -188,6 +203,24 @@ func _ResourceService_GetResource_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _ResourceService_GetResourceByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetResourceByNameRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ResourceServiceServer).GetResourceByName(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ResourceService_GetResourceByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ResourceServiceServer).GetResourceByName(ctx, req.(*GetResourceByNameRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ResourceService_UpdateResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _ResourceService_UpdateResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateResourceRequest) in := new(UpdateResourceRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -243,6 +276,10 @@ var ResourceService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetResource", MethodName: "GetResource",
Handler: _ResourceService_GetResource_Handler, Handler: _ResourceService_GetResource_Handler,
}, },
{
MethodName: "GetResourceByName",
Handler: _ResourceService_GetResourceByName_Handler,
},
{ {
MethodName: "UpdateResource", MethodName: "UpdateResource",
Handler: _ResourceService_UpdateResource_Handler, Handler: _ResourceService_UpdateResource_Handler,

@ -9,7 +9,7 @@ import (
// Version is the service current released version. // Version is the service current released version.
// Semantic versioning: https://semver.org/ // Semantic versioning: https://semver.org/
var Version = "0.18.2" var Version = "0.19.0"
// DevVersion is the service current development version. // DevVersion is the service current development version.
var DevVersion = "0.18.2" var DevVersion = "0.18.2"

@ -7,28 +7,28 @@ import { RendererContext } from "../types";
import Error from "./Error"; import Error from "./Error";
interface Props { interface Props {
memoId: number; resourceId: string;
params: string; params: string;
} }
const EmbeddedMemo = ({ memoId }: Props) => { const EmbeddedMemo = ({ resourceId }: Props) => {
const context = useContext(RendererContext); const context = useContext(RendererContext);
const loadingState = useLoading(); const loadingState = useLoading();
const memoStore = useMemoStore(); const memoStore = useMemoStore();
const memo = memoStore.getMemoById(memoId); const memo = memoStore.getMemoByName(resourceId);
const resourceName = `memos/${memoId}`; const resourceName = `memos/${resourceId}`;
useEffect(() => { useEffect(() => {
memoStore.getOrFetchMemoById(memoId).finally(() => loadingState.setFinish()); memoStore.getOrFetchMemoByName(resourceId).finally(() => loadingState.setFinish());
}, [memoId]); }, [resourceId]);
if (loadingState.isLoading) { if (loadingState.isLoading) {
return null; return null;
} }
if (!memo) { if (!memo) {
return <Error message={`Memo not found: ${memoId}`} />; return <Error message={`Memo not found: ${resourceId}`} />;
} }
if (memoId === context.memoId || context.embeddedMemos.has(resourceName)) { if (memo.id === context.memoId || context.embeddedMemos.has(resourceName)) {
return <Error message={`Nested Rendering Error: ![[${resourceName}]]`} />; return <Error message={`Nested Rendering Error: ![[${resourceName}]]`} />;
} }
@ -36,7 +36,7 @@ const EmbeddedMemo = ({ memoId }: Props) => {
context.embeddedMemos.add(resourceName); context.embeddedMemos.add(resourceName);
return ( return (
<div className="w-full"> <div className="w-full">
<MemoContent nodes={memo.nodes} memoId={memoId} embeddedMemos={context.embeddedMemos} /> <MemoContent nodes={memo.nodes} memoId={memo.id} embeddedMemos={context.embeddedMemos} />
<MemoResourceListView resources={memo.resources} /> <MemoResourceListView resources={memo.resources} />
</div> </div>
); );

@ -6,7 +6,7 @@ import { useResourceStore } from "@/store/v1";
import Error from "./Error"; import Error from "./Error";
interface Props { interface Props {
resourceId: number; resourceId: string;
params: string; params: string;
} }
@ -38,11 +38,11 @@ const getAdditionalClassNameWithParams = (params: URLSearchParams) => {
const EmbeddedResource = ({ resourceId, params: paramsStr }: Props) => { const EmbeddedResource = ({ resourceId, params: paramsStr }: Props) => {
const loadingState = useLoading(); const loadingState = useLoading();
const resourceStore = useResourceStore(); const resourceStore = useResourceStore();
const resource = resourceStore.getResourceById(resourceId); const resource = resourceStore.getResourceByName(resourceId);
const params = new URLSearchParams(paramsStr); const params = new URLSearchParams(paramsStr);
useEffect(() => { useEffect(() => {
resourceStore.getOrFetchResourceById(resourceId).finally(() => loadingState.setFinish()); resourceStore.getOrFetchResourceByName(resourceId).finally(() => loadingState.setFinish());
}, [resourceId]); }, [resourceId]);
if (loadingState.isLoading) { if (loadingState.isLoading) {

@ -15,9 +15,9 @@ const extractResourceTypeAndId = (resourceName: string) => {
const EmbeddedContent = ({ resourceName, params }: Props) => { const EmbeddedContent = ({ resourceName, params }: Props) => {
const { resourceType, resourceId } = extractResourceTypeAndId(resourceName); const { resourceType, resourceId } = extractResourceTypeAndId(resourceName);
if (resourceType === "memos") { if (resourceType === "memos") {
return <EmbeddedMemo memoId={Number(resourceId)} params={params} />; return <EmbeddedMemo resourceId={resourceId} params={params} />;
} else if (resourceType === "resources") { } else if (resourceType === "resources") {
return <EmbeddedResource resourceId={Number(resourceId)} params={params} />; return <EmbeddedResource resourceId={resourceId} params={params} />;
} }
return <Error message={`Unknown resource: ${resourceName}`} />; return <Error message={`Unknown resource: ${resourceName}`} />;
}; };

@ -38,5 +38,29 @@ export const useResourceStore = create(
getResourceById: (id: number) => { getResourceById: (id: number) => {
return get().resourceMapById[id]; return get().resourceMapById[id];
}, },
getOrFetchResourceByName: async (name: string, options?: { skipCache?: boolean; skipStore?: boolean }) => {
const resourceMap = get().resourceMapById;
const cachedResource = Object.values(resourceMap).find((r) => r.name === name);
if (cachedResource && !options?.skipCache) {
return cachedResource;
}
const { resource } = await resourceServiceClient.getResourceByName({
name,
});
if (!resource) {
throw new Error("Resource not found");
}
if (!options?.skipStore) {
resourceMap[resource.id] = resource;
set({ resourceMapById: resourceMap });
}
return resource;
},
getResourceByName: (name: string) => {
const resourceMap = get().resourceMapById;
return Object.values(resourceMap).find((r) => r.name === name);
},
})) }))
); );

Loading…
Cancel
Save